On this page

One workshop many worlds๏ƒ

๐Ÿ”ต Expert ยท Lesson 13

ONE CODEGEN ROOM, SEVERAL WORLDS. Expert 11 attached a rift to a frame; 12 ran the loop against one. This is the shape you actually end up with: a single workshop wired to several frames, each holding different objects, with the agent choosing per call which world it is writing into.

THIS IS WHERE frame_name STOPS BEING A NUISANCE

In 12 it looked like ceremony - one room, one frame, why type it. Here the room can reach three worlds that hold DIFFERENT bindings, and execute_codegen(code, frame_name=...) is the only thing deciding which one the code lands in. A default would not be a convenience, it would be a coin flip with side effects.

ATTACHMENT IS PER FRAME AND EACH ONE IS ITS OWN DECISION rift.create_frame_link("billing") rift.create_frame_link("catalog") Two calls, two gate checks. A rift does not acquire a world by being near it, and there is no "attach to everything" verb - because there is no honest way to ask for that.

AND MULTI-FRAME IS OFF BY DEFAULT, IN TWO SEPARATE KNOBS with_allowed_target_frame_names([...]) the observer's policy with_multiple_target_frames(True) may there be more than one with_max_target_frame_count(3) how many, across the Nexus The boolean and the count are not redundant: the first decides whether the plural case is permitted at all, the second bounds it. Shipped defaults are False and 1, so this whole lesson is a deliberate opt-in - and the cap is spent NEXUS-WIDE because target frames are ref-counted across every rift, not per rift.

THE FRAMES ARE STILL WALLED. Advanced 02's law does not soften because one observer can see several worlds: billing and catalog hold their own bindings, their own singletons, their own posture. The workshop is a room with several windows, not a room that merged the buildings.

WHAT THE AGENT ACTUALLY GETS rift.list_accessible_non_nexus_frame_names() The rift asks which worlds it may target, and the answer runs BOTH of expert 11's gates - Nexus allow/deny policy AND per-frame posture, filtered by this rift's space type. So it answers exactly "what would attach if I tried". An agent does not have to guess and does not have to probe by attempting.

CAVEAT, STATED PLAINLY: that method and its Nexus-level twin are both marked Internal in their own docstrings. The capability is real and it is the best AIX door in the subsystem, but it has no public marking yet - recorded as a finding, not taught as surface.

AND THE POSTURE BAR IS PER FRAME TOO. A codegen room needs rift_enabled AND ai_native AND dynamic on EVERY frame it targets. One qualifying world does not qualify its neighbours.

Before you run๏ƒ

Use the Expert guide for prerequisite concepts. Run from a checkout with Melder installed and Python 3.14 free-threading selected. The collection download includes the level's local helper modules.

Run the saved script๏ƒ

python UX_and_AIX_experiences/04_expert/13_one_workshop_many_worlds.py
py -3.14t UX_and_AIX_experiences/04_expert/13_one_workshop_many_worlds.py

Download this collection ยท Source on GitHub

Public surface๏ƒ

several postured frames, the Nexus target-frame policy and budget knobs, one codegen rift with several frame links, validate_codegen / execute_codegen once PER FRAME through the one room, and the accessible-frames enumeration

Code๏ƒ

  1"""
  2TIER: expert (13)
  3GOAL: ONE CODEGEN ROOM, SEVERAL WORLDS. Expert 11 attached a rift to a
  4      frame; 12 ran the loop against one. This is the shape you actually
  5      end up with: a single workshop wired to several frames, each
  6      holding different objects, with the agent choosing per call which
  7      world it is writing into.
  8
  9      THIS IS WHERE `frame_name` STOPS BEING A NUISANCE
 10
 11      In 12 it looked like ceremony - one room, one frame, why type it.
 12      Here the room can reach three worlds that hold DIFFERENT bindings,
 13      and `execute_codegen(code, frame_name=...)` is the only thing
 14      deciding which one the code lands in. A default would not be a
 15      convenience, it would be a coin flip with side effects.
 16
 17      ATTACHMENT IS PER FRAME AND EACH ONE IS ITS OWN DECISION
 18        rift.create_frame_link("billing")
 19        rift.create_frame_link("catalog")
 20      Two calls, two gate checks. A rift does not acquire a world by
 21      being near it, and there is no "attach to everything" verb -
 22      because there is no honest way to ask for that.
 23
 24      AND MULTI-FRAME IS OFF BY DEFAULT, IN TWO SEPARATE KNOBS
 25        with_allowed_target_frame_names([...])  the observer's policy
 26        with_multiple_target_frames(True)       may there be more than one
 27        with_max_target_frame_count(3)          how many, across the Nexus
 28      The boolean and the count are not redundant: the first decides
 29      whether the plural case is permitted at all, the second bounds it.
 30      Shipped defaults are False and 1, so this whole lesson is a
 31      deliberate opt-in - and the cap is spent NEXUS-WIDE because target
 32      frames are ref-counted across every rift, not per rift.
 33
 34      THE FRAMES ARE STILL WALLED. Advanced 02's law does not soften
 35      because one observer can see several worlds: `billing` and
 36      `catalog` hold their own bindings, their own singletons, their own
 37      posture. The workshop is a room with several windows, not a room
 38      that merged the buildings.
 39
 40      WHAT THE AGENT ACTUALLY GETS
 41        rift.list_accessible_non_nexus_frame_names()
 42      The rift asks which worlds it may target, and the answer runs BOTH
 43      of expert 11's gates - Nexus allow/deny policy AND per-frame
 44      posture, filtered by this rift's space type. So it answers exactly
 45      "what would attach if I tried". An agent does not have to guess and
 46      does not have to probe by attempting.
 47
 48      CAVEAT, STATED PLAINLY: that method and its Nexus-level twin are
 49      both marked `Internal` in their own docstrings. The capability is
 50      real and it is the best AIX door in the subsystem, but it has no
 51      public marking yet - recorded as a finding, not taught as surface.
 52
 53      AND THE POSTURE BAR IS PER FRAME TOO. A codegen room needs
 54      rift_enabled AND ai_native AND dynamic on EVERY frame it targets.
 55      One qualifying world does not qualify its neighbours.
 56SURFACE EXERCISED: several postured frames, the Nexus target-frame policy
 57                   and budget knobs, one codegen rift with several frame
 58                   links, validate_codegen / execute_codegen once PER
 59                   FRAME through the one room, and the accessible-frames
 60                   enumeration
 61VERIFY: went RED 2026-08-03 and was fixed the same day; awaiting
 62        re-run. See the header note for what the failure taught. The
 63        SURFACE line was corrected 2026-08-05; executable code unchanged.
 64"""
 65import melder as md
 66
 67
 68class Invoice:
 69    def __init__(self) -> None:
 70        self.kind = "invoice"
 71
 72
 73class Product:
 74    def __init__(self) -> None:
 75        self.kind = "product"
 76
 77
 78class AuditTrail:
 79    def __init__(self) -> None:
 80        self.kind = "audit"
 81
 82
 83def _workshop_frame(frame_name: str, spell: type):
 84    """One AI-native, rift-visible world holding its own object."""
 85    book = md.Spellbook(aetheric_frame=frame_name)
 86    # A distinct class per frame: a spell_id is the SHA256 of the class's
 87    # code, process-wide by default, with neither the frame nor the
 88    # binding_name in it (advanced 02), so one class bound in two worlds
 89    # would be refused. The binding_name only names each world's address.
 90    book.bind(spell=spell, existence="unique", binding_name=frame_name)
 91    book.configure_aether_frame(
 92        system_state="dynamic",
 93        disposal=None,
 94        disposal_method_names=None,
 95        rift_enabled=True,
 96        ai_native=True,
 97    )
 98    # Hand the conduit back. A frame is not a shared pool: a SECOND book
 99    # in the same frame owns nothing this one bound, so the only way to
100    # reach these spells later is to keep this conduit.
101    return book.conjure(name=f"{frame_name}-root")
102
103
104def main() -> None:
105    # THREE WORLDS, THREE DIFFERENT OBJECTS. Two will be attached; the
106    # third is postured but deliberately left unattached, to show that
107    # reach is something you grant, not something that leaks.
108    billing_conduit = _workshop_frame("billing", Invoice)
109    _workshop_frame("catalog", Product)
110    _workshop_frame("compliance", AuditTrail)
111    print("three worlds up: billing/Invoice, catalog/Product,",
112          "compliance/AuditTrail")
113
114    nexus = md.Nexus()
115    system_configuration = nexus.create_configuration()
116    system_configuration.with_rift_creation_enabled(True)
117    # THE OBSERVER'S HALF OF THE CONSENT (expert 11, gate A). All three
118    # worlds are named here even though only two get attached - because
119    # eligibility and attachment are separate bits, and the enumeration
120    # below is only interesting if a reachable-but-unattached world exists.
121    system_configuration.with_allowed_target_frame_names(
122        ["billing", "catalog", "compliance"],
123    )
124    # BOTH budget knobs, and both are required. The boolean permits more
125    # than one target frame at all; the count caps how many. Defaults are
126    # False and 1, so a second attachment fails on the boolean and a third
127    # would fail on the count.
128    system_configuration.with_multiple_target_frames(True)
129    system_configuration.with_max_target_frame_count(3)
130    nexus.activate(system_configuration)
131
132    rift_configuration = nexus.create_rift_configuration()
133    rift_configuration.with_space_type("codegen")
134    rift = nexus.create_rift(configuration=rift_configuration,
135                             rift_name="workshop")
136    rift.mark_active()
137    room = rift.space
138    commands = room.command_system
139    print("codegen workshop up:", type(room).__name__)
140
141    # ATTACH TWO OF THE THREE. Each link is its own decision and its own
142    # gate check - there is no attach-to-everything verb.
143    rift.create_frame_link("billing")
144    rift.create_frame_link("catalog")
145    print()
146    print("attached: billing, catalog   (compliance deliberately not)")
147
148    # THE AGENT CAN ENUMERATE ITS OWN REACH before attempting anything.
149    # The Rift-level form needs no id - it knows which rift it is.
150    reachable = rift.list_accessible_non_nexus_frame_names()
151    print("rift may target:", sorted(reachable))
152    # It applies BOTH of expert 11's gates - the Nexus allow/deny policy
153    # AND the per-frame posture, filtered by THIS rift's space type - so
154    # the answer is exactly "what would attach if I tried".
155    assert "compliance" in reachable, (
156        "postured and allow-listed, so eligible - even though unattached"
157    )
158    # Eligibility is not attachment. Two bits, the same way configured and
159    # activated are everywhere else in melder.
160    print("  'compliance' is ELIGIBLE and NOT ATTACHED - two different bits")
161    # HONESTY NOTE: both this and the Nexus-level
162    # `list_accessible_non_nexus_frame_names(rift_id)` are marked
163    # `Internal` in their own docstrings. They are the only way an agent
164    # can survey its reach instead of probing by attempting, so the
165    # capability exists but has no public door yet. Recorded as a finding
166    # in _concept_map.txt rather than taught as public surface.
167
168    # PER-FRAME CODEGEN. Same room, same verb, different world - and the
169    # ONLY thing that decides is the argument.
170    for frame_name in ("billing", "catalog"):
171        verdict = commands.validate_codegen(
172            "result = 1\n", frame_name=frame_name,
173        )
174        print()
175        print(f"validate into {frame_name!r} ->", verdict)
176
177    outcome = commands.execute_codegen("result = 1\n", frame_name="billing")
178    print()
179    print("executed into 'billing' ->", type(outcome).__name__)
180    print("  the same call with frame_name='catalog' lands somewhere else")
181    print("  entirely - which is why there is no default")
182
183    # THE WALL HOLDS. Each frame still owns its own bindings; one observer
184    # seeing both worlds did not merge them. Note we meld through the
185    # conduit that BOUND these spells - a fresh book in the same frame
186    # would own nothing and resolve nothing.
187    invoice = billing_conduit.meld("Invoice", binding_name="billing")
188    assert invoice.kind == "invoice"
189    try:
190        billing_conduit.meld("Product", binding_name="catalog")
191        raise AssertionError("catalog's object must not resolve in billing")
192    except Exception as error:
193        print()
194        print("billing cannot resolve catalog's object -",
195              type(error).__name__)
196        print("  a shared observer is not a shared world")
197
198    print()
199    print("one workshop, many windows - never one merged building")
200    print("frame_name is the steering wheel, not paperwork")
201
202
203if __name__ == "__main__":
204    main()

Check the outcome๏ƒ

The script contains its own assertions or demonstrated refusal paths. Run it to evaluate those checks against your installed version. The code above is taken directly from the saved file; no run output is invented here.

More expert examples ยท Level guide

API contracts๏ƒ