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 binding_name per frame: spell_id is process-wide and the
 87    # frame is NOT in the fingerprint (advanced 02), so identical bindings
 88    # across worlds would collide.
 89    book.bind(spell=spell, existence="unique", binding_name=frame_name)
 90    book.configure_aether_frame(
 91        system_state="dynamic",
 92        disposal=None,
 93        disposal_method_names=None,
 94        rift_enabled=True,
 95        ai_native=True,
 96    )
 97    # Hand the conduit back. A frame is not a shared pool: a SECOND book
 98    # in the same frame owns nothing this one bound, so the only way to
 99    # reach these spells later is to keep this conduit.
100    return book.conjure(name=f"{frame_name}-root")
101
102
103def main() -> None:
104    # THREE WORLDS, THREE DIFFERENT OBJECTS. Two will be attached; the
105    # third is postured but deliberately left unattached, to show that
106    # reach is something you grant, not something that leaks.
107    billing_conduit = _workshop_frame("billing", Invoice)
108    _workshop_frame("catalog", Product)
109    _workshop_frame("compliance", AuditTrail)
110    print("three worlds up: billing/Invoice, catalog/Product,",
111          "compliance/AuditTrail")
112
113    nexus = md.Nexus()
114    system_configuration = nexus.create_configuration()
115    system_configuration.with_rift_creation_enabled(True)
116    # THE OBSERVER'S HALF OF THE CONSENT (expert 11, gate A). All three
117    # worlds are named here even though only two get attached - because
118    # eligibility and attachment are separate bits, and the enumeration
119    # below is only interesting if a reachable-but-unattached world exists.
120    system_configuration.with_allowed_target_frame_names(
121        ["billing", "catalog", "compliance"],
122    )
123    # BOTH budget knobs, and both are required. The boolean permits more
124    # than one target frame at all; the count caps how many. Defaults are
125    # False and 1, so a second attachment fails on the boolean and a third
126    # would fail on the count.
127    system_configuration.with_multiple_target_frames(True)
128    system_configuration.with_max_target_frame_count(3)
129    nexus.activate(system_configuration)
130
131    rift_configuration = nexus.create_rift_configuration()
132    rift_configuration.with_space_type("codegen")
133    rift = nexus.create_rift(configuration=rift_configuration,
134                             rift_name="workshop")
135    rift.mark_active()
136    room = rift.space
137    commands = room.command_system
138    print("codegen workshop up:", type(room).__name__)
139
140    # ATTACH TWO OF THE THREE. Each link is its own decision and its own
141    # gate check - there is no attach-to-everything verb.
142    rift.create_frame_link("billing")
143    rift.create_frame_link("catalog")
144    print()
145    print("attached: billing, catalog   (compliance deliberately not)")
146
147    # THE AGENT CAN ENUMERATE ITS OWN REACH before attempting anything.
148    # The Rift-level form needs no id - it knows which rift it is.
149    reachable = rift.list_accessible_non_nexus_frame_names()
150    print("rift may target:", sorted(reachable))
151    # It applies BOTH of expert 11's gates - the Nexus allow/deny policy
152    # AND the per-frame posture, filtered by THIS rift's space type - so
153    # the answer is exactly "what would attach if I tried".
154    assert "compliance" in reachable, (
155        "postured and allow-listed, so eligible - even though unattached"
156    )
157    # Eligibility is not attachment. Two bits, the same way configured and
158    # activated are everywhere else in melder.
159    print("  'compliance' is ELIGIBLE and NOT ATTACHED - two different bits")
160    # HONESTY NOTE: both this and the Nexus-level
161    # `list_accessible_non_nexus_frame_names(rift_id)` are marked
162    # `Internal` in their own docstrings. They are the only way an agent
163    # can survey its reach instead of probing by attempting, so the
164    # capability exists but has no public door yet. Recorded as a finding
165    # in _concept_map.txt rather than taught as public surface.
166
167    # PER-FRAME CODEGEN. Same room, same verb, different world - and the
168    # ONLY thing that decides is the argument.
169    for frame_name in ("billing", "catalog"):
170        verdict = commands.validate_codegen(
171            "result = 1\n", frame_name=frame_name,
172        )
173        print()
174        print(f"validate into {frame_name!r} ->", verdict)
175
176    outcome = commands.execute_codegen("result = 1\n", frame_name="billing")
177    print()
178    print("executed into 'billing' ->", type(outcome).__name__)
179    print("  the same call with frame_name='catalog' lands somewhere else")
180    print("  entirely - which is why there is no default")
181
182    # THE WALL HOLDS. Each frame still owns its own bindings; one observer
183    # seeing both worlds did not merge them. Note we meld through the
184    # conduit that BOUND these spells - a fresh book in the same frame
185    # would own nothing and resolve nothing.
186    invoice = billing_conduit.meld(spell=Invoice, binding_name="billing")
187    assert invoice.kind == "invoice"
188    try:
189        billing_conduit.meld(spell=Product, binding_name="catalog")
190        raise AssertionError("catalog's object must not resolve in billing")
191    except Exception as error:
192        print()
193        print("billing cannot resolve catalog's object -",
194              type(error).__name__)
195        print("  a shared observer is not a shared world")
196
197    print()
198    print("one workshop, many windows - never one merged building")
199    print("frame_name is the steering wheel, not paperwork")
200
201
202if __name__ == "__main__":
203    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๏ƒ