From b846c68a28ca61fd05e5b24bfe2216c57357a6a4 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 16 Sep 2026 13:24:25 +0200 Subject: [PATCH] Map the stock lenses cuts (plan step 15, L1) Six cuts against 817c9f4: captures, the lens module, lens weights as world data with an owner command (consumer.v5), the lens on the session and in the prompt (controller_work.v16), concurrent elaboration under split permit pools, and doc reconciliation. Status is derived rather than maintained. A question is open until it carries a ruling with its authority, and a cut is closed when every promise has a verdict. The operator ruled on the seed, weights in the world, the owner weights command, split pools, emphasis as prompt text, and explicit weights at creation with world_create.v4. Q7 (where lens text lives) is open with a probed recommendation. Q8 was defaulted and is under review. Probes, all on Windows: two sessions on one answer collide today; a lensed session survives reopen and resume under v16; storing instructions in the checkpoint passes integrity through resume and repair; the Dungeon test count differs by four Linux-only tests. Co-Authored-By: Claude Opus 5 --- .../ghostlight-stock-lenses-cut.md | 1281 +++++++++++++++++ 1 file changed, 1281 insertions(+) create mode 100644 docs/architecture/ghostlight-stock-lenses-cut.md diff --git a/docs/architecture/ghostlight-stock-lenses-cut.md b/docs/architecture/ghostlight-stock-lenses-cut.md new file mode 100644 index 0000000..d081ff3 --- /dev/null +++ b/docs/architecture/ghostlight-stock-lenses-cut.md @@ -0,0 +1,1281 @@ +# Ghostlight stock lenses — cut map (plan step 15, L1) + +Ends are owned by `ghostlight-stock-lenses.md`; this document owns the means. +Written 2026-09-16 against Ghostlight `817c9f4` on +`codex/ghostlight-dungeon-mvp`; refreshed the same day with the operator's +rulings on L1-Q4, L1-Q5 and L1-Q6. Every line number below is against +`817c9f4` unless a cut says otherwise. Where a ruling superseded an earlier +recommendation, the earlier text is kept under "History" inside the question +and nowhere else, so there is one live design. + +## How status is read + +Status is derived from what this document records; nothing here is a +maintained header. + +- A **question** (`L1-Qn`) is open exactly when it has no `Ruling` field. + `Authority` is `operator`, `self-under-standing-go`, or `defaulted`. +- A **cut** is landed when its `Landed` field names commits, and closed when + every promise (`P.`) in its Verdicts table has a verdict + (`HOLDS | FALSIFIED | UNPROVEN`). The root agent fills `Landed` and the + Verdicts; Hands and Soul do not edit this file. +- A **mutation** (`M.`) names file, line, before and after; the commit + it ran against is filled at execution. Mutations run against committed code + and are restored with a diff, never `git checkout`. +- A **finding** (`L1.f`) is something no cut owns; each carries + introduced-or-pre-existing, severity, and triage (`fix | operator | recorded`). +- The **ledger** carries an estimate per cut; the Actual column is computed + from the diff at landing and is empty until then. + +The pass is open until every cut is closed and every question has a ruling. + +## What the probes established + +All probes ran in detached scratch worktrees at `817c9f4` (removed; repo +clean) on the Windows workstation with a scratch `CARGO_TARGET_DIR` (removed). +They prove mechanism on Windows only. Logs: session scratchpad +`base-test-list.log`, `probe1.log`, `probe2.log`, `probe2b.log`, +`probe2-dungeon.log`, `probeq7-base.log`, `probeq7-a.log`; not repo artifacts. + +- **Base test census** (`-- --list`, which counts ignored tests): library + `--lib` 420 (419 + 1 ignored, + `controllers::tests::real_codex_connector_cognition_modes_commit_speech`); + `--doc` 10; `--test external_admission` 8; Dungeon + `--bin ghostlight-dungeon` 51 (50 + 1 ignored, + `runtime::tests::live_smoke_seeds_then_ticks_a_world_against_the_connector`); + `--test build_provenance` 1; `ghostlight-persona-projection` 13. Library by + module: action 34, clock_tests 45, consumer 30, controllers 81, cover 18, + custody_tests 17, elaboration 14, journal 24, knowledge_tests 21, mailbox 15, + patch 34, sdk_inference 23, soul_knowledge_tests 9, tests 32, vault 6, + witness_tests 17. Dungeon by module: app_session 8, eve 5, heimdall 5, + idunn_health 4, mesh 4, runtime 25. +- **The 55-versus-51 discrepancy is resolved.** The Dungeon crate carries 55 + `#[test]`/`#[tokio::test]` attributes in `src/` (app_session 8, eve 5, + heimdall 5, idunn_health 6, mesh 4, runtime 27). Four are + `#[cfg(target_os = "linux")]`: `runtime.rs:2448`, `:2472`, + `idunn_health.rs:1330`, `:1367`. On Windows the bin lists 51; on Linux + (Idunn's recipe run) it lists 55. The substrate map's "expected 50 + 1 + ignored" was the Windows count. This map pins the Windows baseline and + states the Linux one. +- **Probe 1, collision (concrete).** Two `ElaborationRunner`s over one real + `CultCacheControllerWorkStore`, one `elaboration_mailbox()` world (one + boundary in `PlaceSubtree(commons)`), started with `tokio::join!` on the + same jurisdiction through a barrier port that holds both in `infer` until + each has persisted its initial checkpoint. Result: `a=Ok(Committed)`, + `b=Err(WorkPersistence("controller command attempted an illegal + checkpoint transition"))`, `inferences=2`, `distinct_request_ids=1`, + custody `elaboration_commands: 1`. So today two concurrent sessions on one + answer share one command id (`elaboration.rs:1271-1277`), one store row, + and one provider request id (`controllers.rs:6314-6327` hashes command id, + purpose, round, instructions, input — all equal), spend two inferences, and + the loser dies at `persist` (`controllers.rs:1701-1705`) when its + `ReadyToSubmit{completed:[o2]}` fails `valid_elaboration_progression` + against the winner's `ReadyToSubmit{completed:[o1]}` (`elaboration.rs:245`, + the `_ => false` arm). Under `sweep` (`runtime.rs:1837`) that error is a + `tracing::debug!` and nothing else. What makes this path unreachable after + Cut 4 is stated there. +- **Probe 2, lens on the session under v16 (mechanism).** Adding + `lens: String` to `ElaboratorSession` (`elaboration.rs:57-66`, + `deny_unknown_fields`), setting it in both `select_answer` arms, and bumping + `controller_work.v15` → `v16` (`controllers.rs:77-78`): the whole library + suite passes (419 + 1 ignored, plus the probe tests), Dungeon passes 50 + 1 + ignored, and `sdk_inference::tests::schema_fixtures_match_the_checked_in_sidecar_grammar` + is untouched. A lensed session persisted as `ElaboratorInFlight` through + the real store, reopened from disk (decode, canonical-bytes check, + `integrity_is_valid` at open, `controllers.rs:1591-1608`), resumed by a + fresh runner through the repair path (`Rejected` → reopen → `Committed`) + under one command id: `rows=1`, `row_type=controller_work.v16`, the lens + read back from the row's bytes equals what was written, and the same + payload under a `controller_work.v15` envelope is refused at open. The four + existing refusal tests (`controllers.rs:6439`, `:10605`, `:11343` for + v10/v9) do not pin `v15` literally and pass unchanged. +- **Probe Q7, base: an instruction edit refuses the whole store.** At + `817c9f4`, an `ElaboratorInFlight` row whose stored `PreparedInference` was + prepared under `"OLD INSTRUCTIONS FROM A PREVIOUS BUILD"` (via + `tool_request`, pushed raw through `OwnedRedbMessagePackBackingStore` + under the current `v15` envelope) is refused at open with + `"controller work row failed its checkpoint binding"`, because + `integrity_is_valid` rebuilds the request from the code constant + (`elaboration.rs:153`, `:1244`) and `prepared_matches_request` compares + the whole provider request (`controllers.rs:1462-1470`). The same row + prepared under the current constant opens. So today any edit to + `ELABORATION_INSTRUCTIONS` refuses every store holding an in-flight + elaboration row; the pass discipline has always bumped the row version on + such edits, which refuses the same rows one check earlier. Row sizes: the + in-flight row is 58,366 bytes under the current text and 58,233 under the + 133-character-shorter text; the row is dominated by the 39 tool schemas + inside the stored invocation, so instruction text is well under 1% of it. +- **Probe Q7, option (a): instructions persisted on the session.** With + `ElaboratorSession { lens: String, instructions: String }`, `select_answer` + filling `instructions` with the constant plus a `Lens: Patina …` clause, + `elaboration_request` taking `instructions: &str`, and all three callers + (`step` `:445`, `persist_repair` `:584`, `integrity_is_valid` `:153`) + passing `session.instructions`: the library suite passes (419 + 1 ignored + plus the probes); through the real store, round one is `Rejected` and + persisted, the store is dropped and reopened (open-time integrity now + binds the stored invocation to the stored text, and the stored text + differs from the bare constant, so it passed by the new rule), a fresh + runner resumes, `persist_repair` builds the round-two invocation from the + stored text, and the session ends `Committed` under one command id; both + wire invocations carry `Lens: Patina` in `instructions` (241 bytes), and + the two rounds have distinct provider request ids (round is in the id). A + row whose stored text and stored request disagree is refused by the same + comparison, from source: `prepared_matches_request` compares + `request.instructions` against the request rebuilt from the stored text. + `PreparedInference::prepare` refuses empty instructions + (`InferenceFault { RecoveryRequired, "invalid instructions" }`), so an + empty stored text cannot be persisted. +- **Source-verified facts the design rests on** (read, not probed): + `agent_prompt` is persisted and reused on resume, never rebuilt + (`elaboration.rs:414-435`); `ELABORATION_INSTRUCTIONS` is a static feeding + `tool_request` → `provider_request_id` (`elaboration.rs:1244`, + `controllers.rs:6018`, `:6314-6327`); the SDK sidecar takes + `instructions` as `systemPrompt` (`sdk_inference.rs:558`, + `sidecar/claude-sdk/src/main.ts:242`); `patch_tools()` and + `patch_tool_signatures()` read only `PATCH_TOOLS` and take no world input + (`patch.rs:6114-6146`); the only kernel entropy is `select_band` over + `BandPreimage` (`action.rs:121-127`, `:780-818`), and the library has no + `rand` (Dungeon does, `crates/ghostlight-dungeon/Cargo.toml:28`, for cookies + and nonces only); the runtime's sweep holds no controller permit + (`runtime.rs:1823-1841`) and sweeps never overlap (the loop awaits + `sweep()` before the next `interval.tick()`); the pool is one `Semaphore` + (`runtime.rs:80`, `:355`, `:1866-1872`, env + `GHOSTLIGHT_CONTROLLER_MAX_CONCURRENT`, default 4, documented at + `docs/architecture/ghostlight-dungeon-mvp.md:478`) that a speak turn + (`:1082`) and each cover cell (`:1959-1980`) take from; `scale_intent` is + written by `admit_resolved` from `ResolvedPatch.scale_intent`, which is + `Some` only on the genesis lane (`lib.rs:2045-2047`, `patch.rs:1900-1903`), + and `reduce` hands `resolve_patch` `None` for every `AdmitPatch` + (`lib.rs:1641`); `CreateWorld` is serialized into the genesis commit row + (`lib.rs:905-908`, `journal.rs:214`), so a new field on it is a commit + schema change; `require_system_capability` (`lib.rs:1656-1673`) and its + twin at `apply_effect` (`:4716-4728`) admit a system caller for exactly the + listed pairs, so a new owner-only `CommandBody` is refused to every system + caller without a new clause; Dungeon matches `CommandBody` only by + construction (`runtime.rs:1504-1537`), never exhaustively, and never names + `Mismatch::` or `WorldEffect`; the create path is `CreatePayload` + (`runtime.rs:158-179`, `deny_unknown_fields`) → `CreateWorldIntent` + (`:1441-1478`), the Eve descriptor is `CREATE_BINDINGS` (`eve.rs:49-57`, + used at `:307` and `:312`) with `operation_schema` at `:614`, and the tests + that name `ghostlight.world_create.v3` are `runtime.rs:2886`, `:2967`, + `:4017-4045` (a v2 payload is denied) and the smoke harness's + `titled_two_cell_world` (`:3122-3154`) used by the road test (`:3792`). + +## Questions + +### L1-Q1 What seeds the lens draw + +- **Asked:** 2026-09-16. +- **Context:** nothing counts sessions. The kernel's one entropy recipe is a + digest over a typed preimage plus modulo and a cumulative walk + (`action.rs:780-818`). Under L1-Q4 the lens enters the command id, so the + draw cannot be seeded by the command id (it would be circular); it is + seeded by the identity fields the command id is derived from. +- **Options:** A: seed from the session identity — `LensPreimage { + world_id, jurisdiction, answer_digest }` (the same fields + `session_command_id` hashes before the lens joins) digested with the + kernel's `sha256:` recipe, first sixteen hex as `u64`, modulo the weight + total, cumulative walk in `Lens` order; the draw is a pure function of + (world, answer identity, weights). B: a new session ordinal counted + somewhere; requires a counter owner and a write per session. C: the + snapshot revision at session start; not replayable across resume without + recording it, which is A with an extra field. +- **Recommendation: A**, because it introduces no counter, reuses the one + recipe, and makes "the same session identity draws the same lens" true by + construction. Replayability, not determinism of model output, is the + invariant. +- **Depends on it:** Cut 1 (`lens::draw`), Cut 3 (draw site). +- **Ruling:** A. The operator: "I couldn't care less what seeds the lens draw + as long as it's replayable - deterministic generation is out of reach + regardless." The seed is chosen on engineering grounds as A; the preimage + was amended from `{world_id, command_id}` to the identity fields when + L1-Q4 put the lens into the command id (same authority, same day). +- **Authority:** self-under-standing-go. +- **Ruled:** 2026-09-16. + +### L1-Q2 Where weights live and how they are admitted + +- **Asked:** 2026-09-16. +- **Context:** `WorldState` has no `deny_unknown_fields` (`lib.rs:780`); the + only genesis-written world scalar is `scale_intent` (`lib.rs:845`), + validated in `resolve_patch` (`patch.rs:4597-4615`) and re-checked at + replay (`journal.rs:722-738`); `STATE_SCHEMA`/`COMMIT_SCHEMA` are + `consumer.v4` (`lib.rs:172-173`), pinned literally at `consumer.rs:2237` + and by length at `:1771`, and older stores are refused (`journal.rs:473`, + `:1245`). +- **Options:** A: `WorldState.lens_weights: LensWeights` beside + `scale_intent`, written by genesis through `ResolvedPatch.lens_weights: + Option` exactly as `scale_intent` is, carried on `CreateWorld` + and `CreateWorldIntent`, validated in `resolve_patch` and + `verify_state_shape`; both schemas bump to `consumer.v5`. B: fold the + weights into `WorldScaleIntent`; wrong owner — scale is a count target, + lenses are flavor, and L3 replaces the intent's permille half. C: keep + weights outside the world (runtime config); then a world's flavor is not + world data and replay cannot re-derive a session's draw. +- **Recommendation: A.** +- **Depends on it:** Cut 2. +- **Ruling:** A. The operator: "Lens weights live in the world, they're what + determine the flavor of the world after all." +- **Authority:** operator. +- **Ruled:** 2026-09-16. + +### L1-Q3 Whether an owner command to change weights belongs in L1 + +- **Asked:** 2026-09-16. +- **Context:** no command changes a world scalar after creation except + `AdvanceTime` (`lib.rs:651-673`); `soul_the_scale_intent_is_written_once_by_genesis` + (`lib.rs:14330`) pins that shape for scale. Session Zero's policy says the + owner changes weights in Draft and Active (`ghostlight-session-zero.md:59-61`). +- **Options:** A: `CommandBody::SetLensWeights { weights }` in L1, owner-only, + any phase, same admission as genesis, one reducer arm and one effect. B: + defer to a later pass; weights are write-once in L1. +- **Recommendation: A**, given the ruling; its L1 consumers are the library + and external-admission tests, and Dungeon's route and button are D2. +- **Depends on it:** Cut 2; L1-Q8 (resume after a weight change). +- **Ruling:** A. The operator: "Changing weights after creation, sure, I + don't see why not." A session that already drew keeps its recorded lens. +- **Authority:** operator. +- **Ruled:** 2026-09-16. + +### L1-Q4 How concurrent sessions stay distinct and take controller permits + +- **Asked:** 2026-09-16. +- **Context:** probe 1 above. `sweep` is a sequential loop over + jurisdictions (`elaboration.rs:607-632`); `select_answer` (`:642-677`) + picks one answer per jurisdiction per call — the oldest boundary, else the + deficit — so two runners on one jurisdiction pick the same answer. The + runtime holds no permit for the sweep; today one pool serves speak turns + and cover cells (`runtime.rs:1080-1082` "There is no second concurrency + owner"). +- **Options as posed:** A: claim distinct demand, identity unchanged, the + sweep borrows Dungeon's single pool. B: a slot ordinal in the identity. C: + A plus deficit slots. D: both — the lens in the identity and a per-sweep + claim set — with the pool split. +- **Ruling: D.** The operator: "Both, split the pool. Neither elaboration nor + simulation should starve the other. Elaboration pool is a ceiling, not a + budget like the Simulation pool." Read as: + - **Both.** The drawn lens enters the session's command identity: + `session_command_id` = `CommandId::derived(ELABORATION_NAMESPACE, + [scope, answer_digest, lens.name()])`. And the runner hands concurrently + running sessions distinct demand entries: `demand_entries(snapshot)` + enumerates every open boundary per jurisdiction plus one deficit per + jurisdiction with a nonzero row, draws each entry's lens, derives each + id, and dedups by id. That claim set is an in-memory value rebuilt each + sweep — scheduling state, never world state, never persisted. + - **Split the pool.** Dungeon carries two `Semaphore`s: the existing + `controller_permits` becomes the **simulation pool** (speak turns at + `runtime.rs:1082`, cover cells at `:1975`), configured by + `GHOSTLIGHT_CONTROLLER_MAX_CONCURRENT` (default 4, unchanged); a new + `elaboration_permits` is the **elaboration pool**, configured by + `GHOSTLIGHT_ELABORATION_MAX_CONCURRENT` (default 2, minimum 1, read at + open beside the other, `:1866-1872` shape). `sweep(&self, permits: + Arc)` receives the elaboration pool only. Neither lane ever + acquires from the other's semaphore, so neither can starve the other in + this process. + - **Budget versus ceiling.** The simulation pool is capacity simulation + always has: no other lane draws from it. The elaboration pool is a + ceiling: the most sessions elaboration may run at once, and nothing + reserves that capacity for it downstream. The ceiling is enforced by the + semaphore's size alone: a session holds one permit for its whole step + and is spawned only after `acquire_owned` returns, so at most N + elaboration inferences are in flight. Connector-level quota is shared + by both pools through one caller id; when the connector refuses for + capacity, elaboration's refusal is a retryable fault that ends the + session's step and is retried next sweep, and simulation's is the same + retryable fault it is today (`runtime.rs:1863-1865`). The process + guarantees no local starvation; it cannot make the connector prefer + simulation, and this map says so (L1.f8). + - **Test.** `saturating_one_pool_never_delays_the_other` (Dungeon, + `runtime.rs` tests): hold every elaboration permit in the test, run + `run_cover_tick` on the two-cell world with a counting port, assert both + cells ran and the tick's wall time is bounded (no wait on the held + pool); then hold every simulation permit and run a sweep on a world with + one boundary, assert one `infer` call completed. Library side: + `the_sweep_never_exceeds_its_ceiling` (pool 1 → max one in flight) and + `distinct_entries_run_at_once_under_the_ceiling` (pool 2 → max two). +- **Authority:** operator. +- **Ruled:** 2026-09-16. +- **History (superseded):** this map first recommended A — identity + unchanged, `sweep(permits)` taking Dungeon's single pool — on the grounds + that distinct entries alone make probe 1's collision unreachable without + touching identity or its tests. The ruling puts the lens in the identity + as well and splits the pool; the deficit-parallelism limit noted under A + (one deficit session per jurisdiction per ancestry) still holds under D + and is stated in Cut 4. + +### L1-Q5 How the ordered emphasis is expressed without reordering `PATCH_TOOLS` + +- **Asked:** 2026-09-16. +- **Context:** `PATCH_TOOLS` is one const (`patch.rs:5586-6112`) rendered as + both the tool schemas and the prompt's `Tools:` line by two functions with + one owner (`:6114-6146`, comment at `:6135`: "cannot drift"); counts + (7, 30, 39) are pinned (`:6837`, `:6981`), order is not; the sidecar + fixture carries names and parameters only (`sdk_inference.rs:1874-1913`). +- **Options:** A: each `Lens` carries a list of existing `PATCH_TOOLS` + names in emphasis order plus "reaches for" prose, rendered as one prompt + paragraph; `PATCH_TOOLS`, `patch_tools()`, `patch_tool_signatures()`, tool + descriptions and the sidecar fixture do not change; a test pins every + listed name to a `PATCH_TOOLS` entry. B: render the `Tools:` line in lens + order. C: per-lens tool descriptions. +- **Recommendation: A.** +- **Depends on it:** Cut 1 (the table), Cut 3 (the prompt). +- **Ruling:** A. The operator: "A, dear Lord, we don't need even more + machinery." A lens expresses its emphasis only as prompt text naming the + operations it leads with; no per-lens catalog, no reordered tool line, no + new type, rendering path, or fixture change beyond that list. +- **Authority:** operator. +- **Ruled:** 2026-09-16. + +### L1-Q6 What Dungeon passes at creation in L1 + +- **Asked:** 2026-09-16. +- **Context:** `CreatePayload` is `deny_unknown_fields` and "a payload that + omits it is refused, which is what `world_create.v3` means" + (`runtime.rs:156-179`); the descriptor advertises seven bindings + (`eve.rs:49-57`); the smoke harness creates through `CreateWorldIntent` + directly (`runtime.rs:3141`). +- **Options:** A: Dungeon names uniform weights in its handler; `world_create.v3` + unchanged. B: the library requires explicit weights at creation and holds + no default; `CreatePayload` gains a required `lens_weights` and + `world_create` becomes `v4`; Dungeon's create surface supplies uniform + weights as Dungeon policy. C: an optional payload field under the `v3` + name. +- **Ruling: B.** The operator: "B." The library requires explicit lens + weights at world creation and has no default weights; Dungeon's create + handler supplies uniform weights as Dungeon policy for now; + `world_create` becomes `v4`; the smoke harness and the Eve create path + (bindings and `operation_schema`) are updated. The library keeps no + `uniform()` constructor; `LensWeights` derives `Default` only as the empty + map that `WorldState::empty` needs before genesis writes (it never draws + and never persists — `verify_state_shape` refuses it). The two places that + need a way to build uniform weights each own their own: Dungeon's + `uniform_lens_weights()` (Dungeon policy, used by the create surface's + default value and the smoke harness) and the library test module's + `stock_weights()` (test fixture). +- **Authority:** operator. +- **Ruled:** 2026-09-16. +- **History (superseded):** this map first recommended A, keeping + `world_create.v3` and naming `LensWeights::uniform()` from the library at + `runtime.rs:1457`, on the grounds that a payload field without its slider + belongs to D1/D2. Cut 2 is written to B. + +### L1-Q7 Where the lens text lives: per-lens instructions or the user turn + +- **Asked:** 2026-09-16; reposed the same day after the operator asked why + per-lens instruction strings cannot be versioned when a checkpoint + references them. Probed (see "Probe Q7" above). +- **Context:** the checkpoint persists `agent_prompt` and the whole + `PreparedInference` (`elaboration.rs:77-84`); `integrity_is_valid` + rebuilds the request from the code constant and demands equality + (`:134-170`); an edit to that constant refuses every store holding an + in-flight row (probe, base). The sidecar places `instructions` as the + system prompt (`main.ts:242`). Row size ≈ 58 KB, dominated by tool + schemas. +- **Options:** + - (a) **Per-lens instructions persisted on the session.** + `ElaboratorSession.instructions: String` is filled once from + `lens.instructions()` (the constant's sentence plus the lens clause) + when the session is built; `elaboration_request` takes the text; + `step`, `persist_repair` and `integrity_is_valid` read it from the + session. Probed: open-time integrity, resume and the repair path all + work, and the lens clause reaches the wire on every round. + `provider_request_id` stays stable across resume (it hashes the stored + text) and becomes a stable per-lens prefix across sessions of one lens + (same text, so the connector's cache prefix is shared per lens rather + than per world). What is lost: the stored instructions are no longer + proven equal to current code; a row whose text was written by an older + build, or forged, validates as long as its stored invocation agrees with + its stored text. What is kept: the stored invocation is proven to equal + a request rebuilt from the stored text and the stored conversation + (request id, conversation id, tools, model, shape). Cost: about 250 + bytes per row against ≈ 58 KB (< 0.5 %); no version table; a lens-text + edit needs no row-version bump and strands no store. + - (b) **A version id with every historical string retained in code.** + `ElaboratorSession.instructions_version: u32` (or `lens_text.vN`) and a + table `LENS_INSTRUCTIONS: &[(u32, [&str; 8])]`; integrity rebuilds from + the table entry the row names. Keeps "stored text equals code" for every + version ever shipped, at the cost of the table growing by eight strings + per edit forever, and a review question ("which version is live?") the + code must answer twice. + - (c) **A version id, rows naming a retired version refused at open.** + The same field, one live entry; a row from a retired version fails + integrity at open. Behaviourally this is today's rule with a named + error, so it buys nothing over the existing row-version bump except the + version field. + - (d) **User turn.** The lens paragraph rides in `build_prompt` → + `agent_prompt`, already persisted and never rebuilt; `ELABORATION_INSTRUCTIONS` + stays one static; nothing about integrity changes; the constant keeps + refusing stores when edited (the base hazard stays); steering is weaker + than the system prompt and the connector's cache prefix stays one for + every lens. +- **Recommendation: (a).** The probe did not falsify it: every path the + question named works, and the guarantee it gives up (stored text equals + code) was in practice the store-refusing hazard the operator was asking + about, with the pass discipline already making it moot by bumping the row + version. The row keeps carrying what the model actually saw, as + `agent_prompt` already does, which is the property a resumed conversation + needs. (b) grows code per edit; (c) is the present behaviour with a + field; (d) is the fallback if the operator wants the instruction text + provably equal to code, at the cost of weaker steering and no per-lens + cache prefix. Cut 3 is written for (a) with a one-line delta for (d). +- **Depends on it:** Cut 3. + +### L1-Q8 How a session is resumed after a weight change moves its draw + +- **Asked:** 2026-09-16 (new, from L1-Q4's ruling meeting L1-Q3's). +- **Context:** with the lens in the command id, a session's row is found by + `lookup(command_id)` (`controllers.rs:1645-1668`; the store has no listing + method). If the owner replaces the weights after a session drew and before + it resumes, the redraw for the same answer may yield a different lens, a + different id, and a `Missing` lookup: the old row would be stranded and a + second session would spend inference on the same answer, against L1-Q3's + "a session that already drew keeps its recorded lens". +- **Options:** A: before drawing, `demand_entries` probes the eight + candidate ids for the answer (one per lens; in-memory `BTreeMap` lookups) + and, if exactly one holds an elaboration row that is not `NoPatch`, + adopts that row's session (its lens and text) instead of drawing; no + schema, no trait change, eight cheap lookups per entry. B: add + `ControllerWorkStore::elaboration_rows()` to the trait (every store, + including test stores, implements it) and select from the listing. C: + accept the stranding: the old row keeps its lens (the letter of L1-Q3) + and is never resumed. +- **Recommendation: A**, because it honours L1-Q3 without a schema or trait + change and the store already answers `lookup` from memory. +- **Depends on it:** Cut 3. +- **Ruling:** A. +- **Authority:** defaulted — an internal lookup strategy that changes no + persisted shape and guards a ruling already given; the operator may + reverse it. +- **Ruled:** 2026-09-16. + +## Cut 0. Captures + +- **Repo/branch:** Ghostlight `codex/ghostlight-dungeon-mvp` at `817c9f4`. + No commit; output lives in the session scratchpad. A detached scratch + worktree is acceptable here because nothing comes back; `git ls-files + --eol crates` shows `w/crlf` under `core.autocrlf=true` and it does not + affect these captures. +- **First:** + - Test census: recorded above (this map ran it; Hands need not rerun). + Compare post-cut with `-- --list` and the same per-module tally. + - `base-session-id.txt`: in the scratch worktree, add a temporary test + beside `a_session_identity_is_derived_from_its_answer` + (`elaboration.rs:2549`) that prints + `session_command_id(&session("sha256:one")).unwrap().to_string()` for + that test's session (`nil_for_test` world, `Uncovered`, deficit answer, + ancestry `sha256:ancestry`). Record the UUID text. Cut 3 pins that the + new derivation (lens in the id) is not equal to it, the way + `soul_the_session_command_id_derivation_moved_under_the_refactor` + pins the pass-9 spelling. + - `base-catalog.txt`: print `patch_tool_signatures()` and + `sha256(serde_json::to_vec(&patch_tools()))` from a temporary test in + `patch.rs`. Record both. Soul compares them after Cut 3 with the same + method; the permanent proof is by signature (Q5). + - `base-mismatches.json`: in the scratch worktree, print + `serde_json::to_string(&refusals[0].mismatches)` from + `soul_an_elaboration_session_resumes_and_repairs_from_its_mismatch_set` + (`controllers.rs:9579`). Record it. Cut 3's lens-invariance test asserts + the same JSON under every lens. + - `Get-ChildItem target -Recurse | Measure-Object Length -Sum`: record the + repo target size before Cut 1 (L0 recorded 7.5 GiB; not re-measured + here). + +## Cut 1. The lens module + +- **Repo/branch:** Ghostlight `codex/ghostlight-dungeon-mvp` from `817c9f4`. + One commit; builds alone; nothing reads it yet except its tests. Depends on + Cut 0 and rulings L1-Q1, L1-Q5. +- **First:** `git status` clean; working in the main checkout (LF). +- **Deletes first:** none. (L1's deletions are in Cut 4; this cut is the + smallest surface that Cut 2 and Cut 3 can consume.) +- **Keeps and moves:** none. +- **Adds:** `crates/ghostlight/src/lens.rs` (about 130 lines plus tests): + - `pub enum Lens { Patina, Charter, Ledger, Hearth, Tangle, Veil, Ember, + Numen }` with `Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, + Serialize, Deserialize`, `#[serde(rename_all = "snake_case")]`. `pub const + ALL: [Lens; 8]` in declaration order; `pub fn name(self) -> &'static str`. + - `pub(crate) fn reaches_for(self) -> &'static str`: the "Reaches for" + column of the target table, verbatim. + - `pub(crate) fn leads_with(self) -> &'static [&'static str]`: existing + `PATCH_TOOLS` names in emphasis order, from the "Leads with" column. + Initial table (Hands may reorder within a lens; every name must be a + `PATCH_TOOLS` entry, pinned by test): Patina `set_persona_material, + declare_affordance, declare_resource, declare_place`; Charter + `grant_authority, open_office, install_incumbent, open_forum, + declare_subject`; Ledger `transfer, bind, declare_resource, alter_cost, + declare_route`; Hearth `create_commitment, set_persona_material, + declare_subject`; Tangle `advance_pressure, create_commitment, + grant_authority, declare_subject, bind`; Veil `acquire_knowledge, + communicate, declare_channel, set_reach, declare_fact, forget`; Ember + `advance_pressure, create_commitment, close_route, consume`; Numen + `declare_fact, declare_affordance, set_persona_material, witness`. + - `pub(crate) fn instructions(self) -> String` (Q7 (a)): + `ELABORATION_INSTRUCTIONS` (moved here from `elaboration.rs:52`, still + one sentence) followed by `" Lens: {name}. Reach for {reaches_for}. Lead + with {leads_with joined by ", "}; every supplied tool remains + available."` Under Q7 (d) this function renders the same text as a + prompt paragraph instead and the constant stays where it is. + - `pub struct LensWeights(BTreeMap)` with `Clone, Debug, + Default, PartialEq, Eq, Serialize, Deserialize`, `#[serde(transparent)]`; + `pub fn new(BTreeMap) -> Self`; `pub fn get(&self, Lens) -> + u32`; `pub fn iter(&self)`; `pub(crate) fn draws(&self) -> bool` (some + weight is nonzero). No `uniform()`, no default weights (Q6): `Default` + is the empty map, used only by `WorldState::empty`. Validity is decided + at admission (Cut 2), as it is for `WorldScaleIntentRef`. An unknown + lens name cannot be represented; serde refuses it at every + deserialization boundary. + - `#[derive(Serialize)] struct LensPreimage<'a> { world_id: WorldId, + jurisdiction: JurisdictionKey, answer_digest: &'a str }` and + `pub(crate) fn draw(weights: &LensWeights, world_id: WorldId, + jurisdiction: JurisdictionKey, answer_digest: &BoundaryDigest) -> + Result`: `super::digest(&LensPreimage{..})`, + `strip_prefix("sha256:")`, first 16 hex → `u64`, `u128` position modulo + the total, cumulative walk over `Lens::ALL` skipping zero weights; + `Err(KernelError::Invariant("lens weights never draw"))` when the total + is zero. Same shape as `select_band` (`action.rs:780-818`); the bias + bound is the same and is stated in the doc comment. + - `crates/ghostlight/src/lib.rs`: `mod lens;` beside the other modules and + `pub use lens::{Lens, LensWeights};` in the public boundary list. + - `crates/ghostlight/src/lib.rs` tests module: `pub(crate) fn + stock_weights() -> LensWeights` (every lens at 1) beside `creation()` + (`:4997`), for the literals Cut 2 touches. Library tests only. +- **Per-file changes:** `lib.rs:77-116` region: the `mod` and `pub use` lines + above; `elaboration.rs:52`: the constant moves to `lens.rs` (Q7 (a)) or + stays (Q7 (d)) — Cut 1 leaves it in place and Cut 3 moves it, so this cut + does not depend on Q7. +- **Authority map:** no ownership change. `lens.rs` owns the stock table, + the per-lens text, and the draw recipe; it reads nothing and writes + nothing. +- **Verification** (Windows; proves Windows only): + - builds: `cargo check -p ghostlight`; `cargo check -p ghostlight-dungeon + --bin ghostlight-dungeon`; no new warnings (measure from a forced + rebuild: `cargo clean -p ghostlight` first, compare distinct messages + by `cmp` against Cut 0's capture). + - tests (`cargo test -p ghostlight --lib lens::`): + `every_lead_names_a_patch_tool` pins `leads_with()` ⊆ `PATCH_TOOLS` + names for all eight, each list nonempty and duplicate-free; + `the_draw_is_a_function_of_world_and_answer` pins `draw` equal on + repeated calls and over 200 answer digests + `format!("sha256:{:064x}", i)` records the exact multiset of lenses + drawn under `stock_weights()` as a literal (computed at the cut and + pinned; the literal is the replay proof); `a_zero_weight_never_draws` + pins that with `{patina:0, charter:3, ledger:1}` over the same 200 + digests `Patina` is drawn 0 times and the charter:ledger split equals a + pinned literal (near 3:1; the exact counts are the assertion); + `all_zero_weights_are_an_error` pins `Err(Invariant)` for + `LensWeights::default()` and for `{patina:0, …, numen:0}` (all eight + named, all zero — a real-shaped value, not an empty map); + `an_unknown_lens_name_does_not_deserialize` pins + `serde_json::from_str::` refusing `{"Patina":1}`, + `{"patina ":1}`, `{"patinaa":1}`, and `{"patina":1,"tribunal":1}`, and + accepting `{"patina":1}`; `rmp_serde` round-trips `stock_weights()` + byte-equal through `to_vec_named`/`from_slice`; + `each_lens_text_names_its_own_leads` pins `instructions()` contains the + lens name and every `leads_with` name, and all eight texts differ. + - negative: `rg -n '\brand\b' crates/ghostlight/Cargo.toml` = 0; + `cargo tree -p ghostlight -e normal | rg -n '\brand\b'` = 0 (checked at + base: the library's tree has no `rand`; Dungeon's does); + `rg -n 'lens' crates/ghostlight-dungeon/src` = 0 after this cut + (Dungeon touches lenses only in Cut 2); `rg -n 'fn uniform' + crates/ghostlight/src` = 0; `rg -n '\bDungeon\b|Session Zero|slider|player' + crates/ghostlight/src/lens.rs` = 0 (collision check: the L0 `player` + hit is `consumer.rs:966`, outside this file, so the bare pattern is + safe scoped to `lens.rs`). + - mutations: M1.1 `lens.rs` draw: `position < weight` → `position <= + weight` (an off-by-one that lets a zero weight draw): `a_zero_weight_never_draws` + must fail. M1.2 `lens.rs` draw: replace `answer_digest` in the preimage + with a constant: `the_draw_is_a_function_of_world_and_answer`'s pinned + multiset must fail. M1.3 `lens.rs` `draws()`: `any(|w| *w > 0)` → + `!is_empty()`: `all_zero_weights_are_an_error` (the all-eight-zero + value) must fail. +- **Promises:** + - P1.1 `Lens` has exactly eight variants named as the target table and + serializes as snake_case strings. + - P1.2 Every `leads_with` name is a `PATCH_TOOLS` entry; `patch_tools()`, + `patch_tool_signatures()`, tool descriptions and + `sidecar/claude-sdk/test/schemas.json` are not edited in this cut (diff + shows no change in `patch.rs` or the fixture). + - P1.3 `draw` is deterministic over (world, jurisdiction, answer digest, + weights), never returns a zero-weight lens, and errors on an all-zero + set. + - P1.4 An unknown lens name is refused by deserialization with values + shaped like real ones (case, whitespace, near-miss). + - P1.5 The library's dependency tree gains nothing; no `rand`; no + `uniform()` or default weights in the library. +- **Landed:** +- **Verdicts:** + +| Promise | Verdict | Evidence | Mutations | +|---|---|---|---| +| | | | | + +## Cut 2. Lens weights as world data, the owner command, and `world_create.v4` + +- **Repo/branch:** Ghostlight `codex/ghostlight-dungeon-mvp` from Cut 1's + commit. One commit: the state field, the command, the effect, the two + schema bumps, the Dungeon create path and every construction site move + together, because the crate graph does not build with `CreateWorld` + half-changed and a schema bump without its shape change is a lie. Depends + on Cut 1 and rulings L1-Q2, L1-Q3, L1-Q6. +- **First:** Cut 1 pushed; `cargo test -p ghostlight` green; the base + `consumer.rs:1771` length trick requires `consumer.v5` to be the same + length as `consumer.v0` (it is). +- **Deletes first:** none in code. `soul_the_scale_intent_is_written_once_by_genesis` + keeps its name and gains no lens assertion; the lens twin is a new test. +- **Keeps and moves:** none. +- **Adds (library):** + - `lib.rs:845` region: `WorldState.lens_weights: LensWeights` directly + after `scale_intent`, doc: "Written by genesis and replaced only by + `SetLensWeights`; read by the elaborator's draw and by nothing that + admits." It enters `state_digest` (whole-struct digest, `lib.rs:4903`) + and no `ScopePreimage`. + - `lib.rs:400-411`: `CreateWorld.lens_weights: LensWeights`. + `lib.rs:416-432`: `CreateWorldIntent.lens_weights: LensWeights` (pub, + required; doc: "Required. The library holds no default weights; a + consumer states the world's flavor or is refused."). `mailbox.rs:171-191`: + pass it through. + - `patch.rs:1903` region: `ResolvedPatch.lens_weights: Option` + with the same "`Some` on the genesis lane and nowhere else" doc. + `patch.rs:2941-2946`: `resolve_patch(state, command_id, patch, + scale_intent, lens_weights: Option<&LensWeights>)`. `patch.rs:4597-4615` + region: `if let Some(weights) = lens_weights { if !weights.draws() { + mismatches.push(Mismatch::LensWeightsNeverDraw) } }` and carry + `lens_weights: lens_weights.cloned()` into the resolved value at + `:5271` region. `patch.rs:1549-1554` region: `Mismatch::LensWeightsNeverDraw` + (unit variant, serde tag as the others). Call sites: `lib.rs:1314-1319` + (`Some(&input.lens_weights)`), `:1808-1813` (`Some(&command.lens_weights)`), + `:1641` (`None`), `:14368` (`None`), plus every `resolve_patch` call in + `patch.rs` tests (the compiler names them). + - `lib.rs:2045-2047` region: `if let Some(weights) = &resolved.lens_weights + { state.lens_weights = weights.clone(); }`. + - `lib.rs:1743-1778` `WorldState::empty`: `lens_weights: + LensWeights::default()`; genesis overwrites it and `verify_state_shape` + refuses a persisted all-zero set, so no state on disk ever holds the + empty value. + - `lib.rs:651-673`: `CommandBody::SetLensWeights { weights: LensWeights }` + with doc: owner only, any phase, replaces the whole set; a session that + already drew keeps its recorded lens. + - `lib.rs:860-897`: `WorldEffect::LensWeightsReplaced { weights: LensWeights }`. + - `lib.rs:1542-1652` `reduce`: arm `CommandBody::SetLensWeights { weights } + => { require_owner(state, &command.caller)?; if !weights.draws() { + return Err(KernelError::PatchRejected(vec![Mismatch::LensWeightsNeverDraw])); } + Ok(WorldEffect::LensWeightsReplaced { weights: weights.clone() }) }`. + Identical weights are still a commit (the owner's act is canonical, as an + empty-motion tick is, `lib.rs:1619-1621`); the doc says so. + - `lib.rs:4708-4894` `apply_effect`: arm `WorldEffect::LensWeightsReplaced + { weights }` re-deciding `require_owner` and `draws()` (the same + re-decide shape as `WorldActivated`, `:4788-4798`) then `state.lens_weights + = weights.clone()`. `require_system_capability` (`:1656-1673`) and its + twin (`:4716-4728`) need no clause: the new pair is not listed, so a + system caller is `Unauthorized` on both sides. + - `lib.rs:3694-3721` `snapshot`: `lens_weights: state.lens_weights.clone()`; + `lib.rs:1088-1116`: `WorldSnapshot.lens_weights: LensWeights` (pub). + - `journal.rs:722-738` region: after the scale-intent check, `if + !state.lens_weights.draws() { return Err(JournalError::Corrupt("the + lens weights never draw".into())); }`. + - `lib.rs:172-173`: `ghostlight.world_state.consumer.v5`, + `ghostlight.world_commit.consumer.v5`. `consumer.rs:2237`: the literal + becomes `consumer.v5`; `:1771` unchanged (same length). + - `CreateWorld` literals gain `lens_weights: stock_weights()` (library + tests) at `mailbox.rs:180` (production: `input.lens_weights`), `:935`, + `:1356`; `journal.rs:1064`, `:1146`, `:1497`; `lib.rs:4998`; + `controllers.rs:8417`, `:9012`, `:9415`, `:9705`, `:10252`, `:10697`, + `:11609`, `:13137`, `:13636`. `crates/ghostlight/tests/external_admission.rs:46` + builds its own `LensWeights::new(BTreeMap::from([(Lens::Patina, 1)]))` + (an external crate has no fixture). The compiler names any site this + list missed. +- **Adds (Dungeon, Q6 B):** + - `runtime.rs:158-179` `CreatePayload.lens_weights: LensWeights` (required; + doc: "Required, and must draw: a payload that omits it is refused, which + is what `world_create.v4` means. An unknown lens name is refused by + deserialization before any handler runs."). `:1457-1474`: pass + `lens_weights: payload.lens_weights`. + - `runtime.rs` (production, beside `configured_cover_budget`): + `pub(crate) fn uniform_lens_weights() -> LensWeights` — every stock lens + at 1 — with doc: "Dungeon policy for a world created before Session + Zero's sliders exist (D2). Not a library default; the library requires + the weights to be stated." Used by `eve.rs` for the create surface's + default value and by the smoke harness. + - `eve.rs:49-57`: `CREATE_BINDINGS: [&str; 8]` adds `"lens_weights"`; + `:295-301` region: a `world.create.lens_weights` `control.input.textarea` + bound as `local_draft("lens_weights", "json")` whose `props.value` is + `serde_json::to_string(&uniform_lens_weights())` (the policy default, + editable) and whose placeholder shows the same JSON; `:312` and `:614`: + `ghostlight.world_create.v4`. + - `runtime.rs:3122-3154` `titled_two_cell_world`: `lens_weights: + uniform_lens_weights()`; `:2886`, `:2967`: `ghostlight.world_create.v4` + with `"lens_weights":{"patina":1,…}` in the payload (all eight); + `:4017-4045`: the stale case names `v3` and is denied (the `v2` case + becomes history and is replaced, not kept beside it); a new case posts a + `v4` payload with `"lens_weights":{"patina":1,"tribunal":1}` and asserts + `denied` with no world created, and another posts every lens at zero + and asserts `denied` (the resolver's `LensWeightsNeverDraw` surfaces as + the payload error) with no world created. +- **Tests (library, `lib.rs` tests module unless said):** + `genesis_writes_the_lens_weights_it_was_given` (create with + `{patina:2, numen:1}`, snapshot carries it, replay through + `WorldKernel::open` equal); + `a_genesis_lens_set_that_never_draws_is_refused` (all eight named at + zero → `PatchRejected` containing exactly `LensWeightsNeverDraw`, no + world file written); + `soul_the_lens_weights_are_replaced_only_by_the_owner_command`: the + lens twin of `lib.rs:14330` — an Active `AdmitPatch` resolves with + `lens_weights: None`; `SetLensWeights` from the owner in Draft and again + in Active replaces the set and moves the revision; the same body from a + non-owner principal is `Unauthorized`; from + `CallerId::System(SystemCapability::Elaborator{..})` is `Unauthorized`; + from `Clock` is `Unauthorized`; a set with every lens at zero is + `PatchRejected([LensWeightsNeverDraw])`; a set with a single nonzero + lens is admitted (a zero weight is admitted, it just never draws); a + journal row forged with a non-owner caller and a `LensWeightsReplaced` + effect fails replay (the `journal.rs:1130` forgery shape); + `a_store_written_before_the_lens_schema_is_refused`: the `consumer.v4` + strings for state and commit rows refused at open, beside the existing + v1 test (`journal.rs:1245`), same shape; + `lens_weights_enter_the_state_digest_and_no_scope_digest`: two states + differing only in weights have different `state_digest`, and every + subject's scope digest (`bound_scope_digest`) is equal before and after + a `SetLensWeights` commit; + `external_admission.rs`: `set_lens_weights_from_a_non_owner_is_refused_and_commits_nothing` + through `submit_principal` with a second `VerifiedPrincipalEvidence` + (revision, state digest, last commit digest, operator log length + unchanged, same shape as the file's other rejections), and + `set_lens_weights_with_an_unknown_lens_does_not_decode` pinning + `serde_json::from_value::(json!({"type":"set_lens_weights", + "weights":{"patina":1,"veil ":1}}))` is `Err` — a serde limit, stated as + such, not a kernel admission proof. +- **Per-file changes:** as listed under Adds; additionally + `docs/architecture/ghostlight-world-ontology.md:260` and `:307-308` name + `world_create.v4` and `consumer.v5`; `ghostlight-world-consumer-api.md:182-183` + names `consumer.v5` [Hands]; `notes/local-live-smoke.md:276` is history + and stays; `notes/fresh-workspace-handoff.md:241` and `state/map.yaml:378,385` + [steward]. +- **Authority map:** + - Owner: the reducer owns lens weights. Genesis writes them through + `ResolvedPatch.lens_weights`; `SetLensWeights` replaces them through + `reduce` → `apply_effect`; replay re-derives both. + - Inputs: `CreateWorldIntent.lens_weights` from the consumer (Dungeon's + from its `v4` payload, defaulted on the surface by Dungeon policy); + `CommandBody::SetLensWeights` from the owner principal. + - Outputs: `WorldSnapshot.lens_weights` (read by the elaborator's draw in + Cut 3 and by any projection); the effect in the commit row. + - Derived state: the Eve create surface's default value (Dungeon policy, + display until submitted). The drawn lens (Cut 3) is derived from the + weights at draw time and then recorded; it is not re-derived. + - Forbidden writers: `AdmitPatch` (resolves with `None`, pinned); + any system capability (`require_system_capability` table, pinned); + any consumer or elaborator lane; the library (no default weights). + - Shared paths: genesis and `SetLensWeights` share `LensWeights::draws` + and `Mismatch::LensWeightsNeverDraw`; replay and live commits share + `reduce`/`apply_effect`; `verify_state_shape` is the third statement of + validity, as it is for `scale_intent`; the Eve button and the smoke + harness both reach `CreateWorldIntent` with weights Dungeon stated. + - Deletion line: nothing deleted; three schema strings are replaced and + the old ones become refused, not read. +- **Verification:** + - builds: `cargo check -p ghostlight`, `cargo check -p ghostlight + --tests`, `cargo check -p ghostlight-dungeon --tests`; warning set + unchanged (forced rebuild, `cmp`). + - tests: `cargo test -p ghostlight` = 420 + new (`-- --list` tally: every + base name present); `cargo test -p ghostlight --test external_admission` + = 8 + 2; `cargo test -p ghostlight-dungeon --bin ghostlight-dungeon` = 51 + + 2 (same base names; `every_operation_the_panel_emits_has_a_schema` + `runtime.rs:4065` passes with the eighth binding); `cargo test -p + ghostlight --doc` = 10 (with `--all-features` too: the standing seal + check). + - negative: `rg -n 'consumer\.v4' crates docs notes state --glob + '!state/evidence*'` lists only history lines (L0 map and postmortem, + `docs/architecture/ghostlight-library-extraction*.md`; ontology `:255` + names v2 as history and stays); `rg -n 'world_create\.v3' crates` = 1, + the stale-payload denial test; `rg -n 'fn uniform' crates/ghostlight/src` + = 0 and `rg -n 'uniform_lens_weights' crates/ghostlight-dungeon/src` ≥ 3 + (definition, Eve default, smoke harness); `rg -n 'lens' crates/ghostlight-dungeon/src/mesh.rs + crates/ghostlight-dungeon/src/idunn_health.rs` = 0. + - mutations: M2.1 `lib.rs` `reduce` SetLensWeights arm: delete the + `require_owner` call: `soul_the_lens_weights_are_replaced_only_by_the_owner_command` + (non-owner principal) must fail. M2.2 `lib.rs` `apply_effect` + LensWeightsReplaced arm: delete its owner re-check only: the forged + journal row half of the same test must fail. M2.3 `patch.rs` genesis + check: `!weights.draws()` → `weights.0.is_empty()`: + `a_genesis_lens_set_that_never_draws_is_refused` (all eight named at + zero) must fail. M2.4 `journal.rs` lens check deleted: a state row with + an all-zero set written by hand must open; the refusal test must fail. + M2.5 `lib.rs:172` schema string reverted to `v4`: `a_store_written_before_the_lens_schema_is_refused` + must fail. M2.6 `runtime.rs` `CreatePayload.lens_weights` given + `#[serde(default)]`: the Dungeon test posting a `v4` payload without + `lens_weights` (add it) must fail to be denied. + - operator: none in this cut; the Linux proof is the recipe run and is + listed under findings. +- **Promises:** + - P2.1 A created world carries the weights it was given; replay reproduces + them digest-for-digest. + - P2.2 An all-zero set is refused at genesis, by the command, and at the + Dungeon payload boundary with `Mismatch::LensWeightsNeverDraw`; a single + zero weight is admitted. + - P2.3 Only the owner principal can replace weights; every system + capability and every non-owner principal is `Unauthorized`, from inside + the crate and from the external crate; a forged owner row fails replay. + - P2.4 `AdmitPatch` cannot carry or change weights (resolves `None`). + - P2.5 `consumer.v4` stores are refused at open; no migration path exists + (`rg -n 'v4' crates/ghostlight/src/journal.rs` shows only the refusal + test's literal). + - P2.6 The library requires explicit weights and holds none; + `world_create.v4` carries them; Dungeon's surface defaults them by its + own `uniform_lens_weights()`; a `v3` invocation is denied. + - P2.7 Weights enter `state_digest` and no scope digest. +- **Landed:** +- **Verdicts:** + +| Promise | Verdict | Evidence | Mutations | +|---|---|---|---| +| | | | | + +## Cut 3. The lens in the session identity, in the instructions, and in the store + +- **Repo/branch:** Ghostlight `codex/ghostlight-dungeon-mvp` from Cut 2's + commit. One commit. Depends on Cuts 1–2 and rulings L1-Q1, L1-Q4 (the + identity half), L1-Q5, L1-Q8, and L1-Q7 (written for (a); the (d) delta + is one paragraph below). +- **First:** Cut 0's `base-session-id.txt` and `base-mismatches.json` in + hand; Cut 2 pushed and green. +- **Deletes first:** `elaboration.rs:52` `ELABORATION_INSTRUCTIONS` as a + bare constant referenced by `elaboration_request` (it moves into + `lens::instructions()` under (a); under (d) it stays and this line is + void). +- **Keeps and moves:** `session_command_id` (`elaboration.rs:1271-1277`) + keeps its name and namespace and gains the lens as a third part: + `&[&scope, session.answer_digest.text(), session.lens.name()]`. +- **Adds:** + - `elaboration.rs:57-66`: `ElaboratorSession.lens: Lens` and + `ElaboratorSession.instructions: String` after `ancestry`, docs: "Drawn + once when the session is first built, recorded here, and never + redrawn; a resumed session reads it back." and "The instruction text + this session was built with, persisted as `agent_prompt` is; integrity + binds the stored invocation to this text, not to the code constant." + `deny_unknown_fields` stays. Under (d) only `lens` is added. + - `elaboration.rs:642-677` `select_answer` becomes the entry builder used + by Cut 4's `demand_entries`: for an answer, build the identity fields, + then (L1-Q8 A) probe the eight candidate ids `session_command_id` would + yield for each lens against `self.work.lookup`; if exactly one is + `Confirmed(ControllerWork::Elaboration(cp))` or `CustodyUncertain(..)` + whose session is not `NoPatch` and whose identity fields equal, adopt + `cp.session().clone()`; otherwise `lens = lens::draw(&snapshot.lens_weights, + world_id, jurisdiction, &answer_digest)?` and `instructions = + lens.instructions()`. The lookup is async, so the builder is `async fn + session_for(&self, snapshot, jurisdiction, answer) -> Result>`. + - `elaboration.rs:400-412` lookup in `step_session`: the existing + `checkpoint.session() != &session → Superseded` comparison stays as is + (full equality; the adopted session is the row's own, so it is equal). + - `elaboration.rs:1233-1254` `elaboration_request(command_id, round, model, + instructions: &str, input)`; callers `:445`, `:584`, and `:153` pass + `&session.instructions` (the `ElaboratorInFlight` arm of + `integrity_is_valid` destructures `session`). Under (d): no signature + change; `build_prompt` (`:787-808`) gains `render_lens(session.lens)` + after the `Answer:` line instead, and `instructions` is not a field. + - `elaboration.rs:201-247` `valid_elaboration_progression`: unchanged; it + compares whole sessions, so a checkpoint that changes the lens or the + text is an illegal transition. Pin it. + - `controllers.rs:77-78`: `controller_work.v16` / + `ghostlight.controller_work.v16`. + - Tests (`elaboration.rs` tests unless said): the four `ElaboratorSession` + literals at `:2399`, `:2428`, `:2550`, `:2574` gain `lens: Lens::Patina, + instructions: Lens::Patina.instructions()`; + `a_session_identity_is_derived_from_its_answer` (`:2549`) additionally + asserts `first.to_string() != ""` (the derivation + moved: the lens joined), pins the new UUID as a literal, and asserts + that changing only `lens` changes the id while changing only + `instructions` does not; + `soul_a_session_identity_separates_world_jurisdiction_and_answer` + (`:2569`) gains a lens clause and keeps its ancestry clause; + `a_resumed_session_keeps_its_recorded_lens_when_the_weights_change` + (controllers tests, beside `:9497`): world created with `{patina:1}` + only; round one is refused and persisted; the owner submits + `SetLensWeights{{numen:1}}`; a fresh runner over the same store resumes + (L1-Q8 A finds the row under the Patina id) and commits under the same + command id with the checkpoint's `session.lens == Patina` and the + second invocation's `instructions` still naming Patina; then a new + boundary (a second dead-end route declared by the owner) starts a new + session whose lens is `Numen`; + `a_checkpoint_that_changes_the_lens_or_its_text_is_an_illegal_transition`: + from a persisted `ElaboratorInFlight`, a next checkpoint identical + except `lens` is refused by the real store with the "illegal checkpoint + transition" error; likewise except `instructions`; + `a_row_whose_text_and_invocation_disagree_is_refused_at_open` + (controllers tests, the Q7 probe as a permanent test): a raw row whose + stored `instructions` is `"STORED TEXT A"` and whose invocation was + prepared under `"REQUEST TEXT B"` fails its checkpoint binding at open, + and the same row with both texts equal to a string that is not the + current `Lens::Patina.instructions()` opens (the property (a) buys, + stated as such); + `soul_the_same_patch_admits_the_same_under_every_lens` (controllers + tests): for each of the eight lenses, a world created with that lens at + 1 and every other at 0, the round-one bad shed patch of `:9497` yields + `refusals[0].mismatches` JSON equal to `base-mismatches.json`, and the + repaired patch commits; the eight `agent_prompt`s are byte-equal (under + (a) the prompt carries no lens text) and the eight `instructions` differ + only in the lens clause; `the_catalog_takes_no_lens`: `patch_tools()` + and `patch_tool_signatures()` are called with no argument (proof by + signature; the test asserts the `Tools:` line of a lensed prompt equals + `patch_tool_signatures()` byte-for-byte); + `a_controller_work_row_from_v15_is_refused_at_open` (controllers + tests): a real lensed `ElaboratorInFlight` payload under a `v15` + envelope is refused at open (the shape of `:11343`), beside the v10/v9 + loop. +- **Per-file changes:** as listed; `docs/architecture/ghostlight-world-ontology.md:308` + names `controller_work.v16` [Hands]; `notes/fresh-workspace-handoff.md:227` + [steward]. +- **Authority map:** + - Owner: the entry builder owns the draw and the text; the checkpoint row + owns both for the life of the session. + - Inputs: `WorldSnapshot.lens_weights`, the answer identity, the store's + answer to the eight candidate lookups. + - Outputs: `ElaboratorSession.{lens, instructions}` in every checkpoint + stage; the lens name inside the command id; the text on the wire as the + system prompt. + - Derived state: none; the text is authored once from `lens::instructions` + and thereafter is the row's. + - Forbidden writers: a resume path that redraws (structurally absent: the + only draw site runs only when no candidate row exists); a checkpoint + transition that changes the lens or the text (refused by session + equality); the code constant (no longer consulted by integrity for this + lane; the seed, narrative and operational lanes keep theirs — L1.f9). + - Shared paths: first run and resume share `step_session`'s `match + existing`; the real store and `RecordingWorkStore` share + `valid_controller_work_progression`; the connector and the SDK sidecar + both receive `request.instructions`. + - Deletion line: `ELABORATION_INSTRUCTIONS` as the integrity reference is + gone before the session field is read; `controller_work.v15` rows become + refused. +- **Verification:** + - builds: as Cut 2. + - tests: `cargo test -p ghostlight` = Cut 2 count + new; + `sdk_inference::tests::schema_fixtures_match_the_checked_in_sidecar_grammar` + passes without regenerating the fixture (the diff shows + `sidecar/claude-sdk/test/schemas.json` unchanged); Dungeon 53 unchanged. + - negative: `rg -n 'controller_work\.v15' crates` = 0 outside the new + refusal test; `git diff Cut2..Cut3 -- crates/ghostlight/src/patch.rs + sidecar` is empty; `rg -n 'ELABORATION_INSTRUCTIONS' crates/ghostlight/src` + = 1 (its definition in `lens.rs`) under (a); `rg -n 'lens' + crates/ghostlight/src/controllers.rs` matches only tests and the two + constants' doc lines. + - captures compared: `patch_tool_signatures()` and the `patch_tools()` + digest equal `base-catalog.txt` (same method). + - mutations: M3.1 `elaboration.rs` entry builder: skip the eight-candidate + probe and always draw: `a_resumed_session_keeps_its_recorded_lens_when_the_weights_change` + must fail (the resume misses the row). M3.2 `elaboration.rs` + `session_command_id`: drop the lens part: `a_session_identity_is_derived_from_its_answer`'s + lens clause and pinned UUID must fail. M3.3 `elaboration.rs` entry + builder: draw from `stock_weights()`-shaped uniform weights instead of + the snapshot: the eight-lens test (each world with one nonzero lens) + must fail. M3.4 `elaboration.rs:205` `existing.session() != + next.session()` → compare identity fields only: + `a_checkpoint_that_changes_the_lens_or_its_text_is_an_illegal_transition` + must fail. M3.5 `integrity_is_valid`: pass `Lens::Patina.instructions()` + instead of `session.instructions`: `a_row_whose_text_and_invocation_disagree_is_refused_at_open`'s + second half (a non-current text opens) must fail. +- **Promises:** + - P3.1 The lens is drawn once, when no candidate row exists, from the + snapshot's weights and the answer identity; the command id carries the + lens; the pre-L1 id for the fixed session is no longer produced. + - P3.2 A resumed session keeps its recorded lens and text across a weight + change, a fresh runner, and a store reopen; a checkpoint that changes + either is refused. + - P3.3 The same patch admits the same under every lens (pinned against + the base mismatch set). + - P3.4 The catalog is lens-independent by signature; the sidecar fixture + and `patch.rs` are untouched. + - P3.5 `controller_work.v15` rows are refused at open; no migration. + - P3.6 Integrity binds the stored invocation to the stored text; a row + whose two disagree is refused, and a row whose text is not the current + code's still opens (the (a) trade, stated). +- **Landed:** +- **Verdicts:** + +| Promise | Verdict | Evidence | Mutations | +|---|---|---|---| +| | | | | + +## Cut 4. Concurrent sessions over a per-sweep claim set, under the elaboration ceiling + +- **Repo/branch:** Ghostlight `codex/ghostlight-dungeon-mvp` from Cut 3's + commit. One commit (library and Dungeon driver together: the `sweep` + signature changes and the second pool is born). Depends on Cut 3 and + ruling L1-Q4. +- **First:** Cut 3 pushed and green; probe 1's collision reproduced once + more at Cut 3 as a temporary test through two direct `step_session` + calls (it must still collide there; that is the before-state this cut + makes unreachable). +- **Deletes first:** + - `crates/ghostlight/src/elaboration.rs:603-632`: the sequential `sweep` + loop and its comment about eight tasks and a capacity-32 mailbox (30 + lines). + - `elaboration.rs:328-342`: `ElaborationOutcome::Inactive` if no arm + produces it after the phase check moves to `sweep` (the compiler + decides; delete, do not `allow(dead_code)`). + - `crates/ghostlight-dungeon/src/runtime.rs:1821-1822`: the "One + sequential sweep per wake" doc lines; `:1080-1081` "There is no second + concurrency owner" becomes "Two pools, one per lane; neither lane draws + from the other's." +- **Keeps and moves:** `step(jurisdiction)` becomes `step_session(session: + ElaboratorSession, snapshot: &WorldSnapshot)` with the body from `:386` + on; the phase check moves to `sweep`. +- **Adds (library):** + - `elaboration.rs`: `async fn demand_entries(&self, snapshot) -> + Result, ControllerError>`: for each jurisdiction + of `scale_deficit` plus `Uncovered` (the list `:609-617` builds), every + boundary `boundary_in` admits in snapshot order, then the deficit entry + when the row is nonzero, each through Cut 3's `session_for`; a boundary + under nested roots appears under each covering root, so the list is + deduped by command id keeping first occurrence. The claim set is this + `Vec`, alive for one sweep and never persisted. + - `elaboration.rs`: `pub async fn sweep(&self, permits: + Arc) -> Result<(), ControllerError>`: snapshot; + return `Ok(())` unless Active; `demand_entries`; a `tokio::task::JoinSet`; + for each entry `let permit = permits.clone().acquire_owned().await` + (a closed semaphore ends the sweep with `Ok(())`), spawn a task that + holds the permit across `step_session` (the runner derives `Clone`; + every field is `Arc` or `Clone`); collect; a `requires_quarantine` + error is returned after every task has finished (so no task is + orphaned), others are `tracing::debug!` as today. Doc: "One permit per + session for its whole step, from the ceiling the caller owns. The + library holds no concurrency number of its own." +- **Adds (Dungeon):** + - `runtime.rs:68-96` `AppState.elaboration_permits: Arc` beside + `controller_permits`, doc: "The elaboration ceiling. `controller_permits` + is the simulation budget: speak turns and cover cells, and nothing + else, draw from it."; `:355` region: `Arc::new(Semaphore::new(configured_elaboration_ceiling()))`; + `:1866-1872` region: `fn configured_elaboration_ceiling() -> usize` + reading `GHOSTLIGHT_ELABORATION_MAX_CONCURRENT`, `>= 1`, default 2, with + the doc: "A ceiling, not a budget: the most sessions elaboration may + run at once. Nothing reserves connector capacity for it; a connector + capacity refusal is a retryable fault the next sweep retries." + `:1837`: `runner.sweep(state.elaboration_permits.clone())`; `:1817-1822` + doc: sweeps still never overlap (the loop awaits the sweep), so one + sweep's claim set is the only set of sessions alive. Test fixtures at + `:2602` gain the second semaphore (`TEST_ELABORATION_CEILING = 2`). + `docs/architecture/ghostlight-dungeon-mvp.md:478` names both variables + [Hands]. +- **Tests:** + - Library (controllers tests): `distinct_entries_run_at_once_under_the_ceiling`: + a world with two boundaries (two dead-end routes from the commons; the + fixture at `:9402` plus one route), a counting port that records the + maximum simultaneous `infer` calls and yields inside `infer`, pool of 2 + → maximum 2, two distinct rows, both `Committed`, two distinct provider + request ids; `the_sweep_never_exceeds_its_ceiling`: same world, pool + of 1 → maximum 1; `a_sweep_holds_a_permit_while_it_infers`: pool of 1 + already held by the test → no `infer` call until the permit is released + (release after a timeout; zero calls before, one after); + `one_answer_is_one_session_per_sweep`: with one boundary and pool 2 the + sweep runs exactly one session (`custody elaboration_commands == 1`, + one `infer`); `a_boundary_under_nested_roots_is_claimed_once`: the + two-root world of `:11605` with a boundary inside the inner root runs + one session for it; `a_deficit_entry_is_one_per_jurisdiction_per_ancestry`: + a world with a deficit and no boundary runs one session per sweep and + a second sweep after the commit runs a new id. + - Dungeon (`runtime.rs` tests): `saturating_one_pool_never_delays_the_other` + as specified under L1-Q4: hold all elaboration permits, run + `run_cover_tick` on `active_two_cell_world` with a counting port, both + cells run within a bounded wall time; hold all simulation permits, run + `elaborator().sweep(state.elaboration_permits.clone())` on a world with + one boundary, one `infer` completes. `the_tick_driver_never_exceeds_its_controller_permit_pool` + (`:3269`) is unchanged and still passes on the simulation pool. +- **What makes probe 1's path unreachable after this cut.** The loser died + because two sessions shared one command id. After Cut 3 the id includes + the lens, and after this cut every session alive in the process is one + entry of one sweep's claim set, deduped by id, started by `sweep` alone + (`step_session` is `pub(super)`; the seed lane has its own runner), and + sweeps do not overlap (`runtime.rs:1827-1839` awaits one before ticking + the next). Two sessions with one id would need two entries with one id in + one claim set, which the dedup forbids, or two overlapping sweeps, which + the driver forbids and the library does not guard (stated under + Forbidden writers). The `_ => false` arm stays as the store's refusal of + any such row. +- **Per-file changes:** `elaboration.rs:603-632` replaced; `:375-386` + split; `runtime.rs:68-96`, `:355`, `:1080-1081`, `:1817-1841`, `:1866-1872`, + `:2602`; `docs/architecture/ghostlight-world-ontology.md:668` rewritten + as the live rule: "Sessions run concurrently over distinct demand entries + — every open boundary and one deficit per jurisdiction — each drawing its + lens by the world's weights, each carrying its lens in its identity, and + each holding one permit of the elaboration ceiling; the sweep is one at a + time." [Hands]; `ghostlight-world-ontology.md:773-775` "Sessions" bullet: + the "in Draft" clause stays target (L3) [Hands]; + `ghostlight-dungeon-mvp.md:473-479` names the two pools [Hands]; + `notes/fresh-workspace-handoff.md:284-290` [steward]. +- **Authority map:** + - Owner: `sweep` owns which sessions exist in a wake (the claim set); + the caller's elaboration `Semaphore` owns how many infer at once; the + simulation `Semaphore` owns speak turns and cover cells; the mailbox + owns commit order. + - Inputs: one snapshot per sweep; the elaboration pool; the store's + candidate lookups (Cut 3). + - Outputs: one `step_session` per distinct entry. + - Derived state: the claim set (never stored). + - Forbidden writers: any second `sweep` concurrent with the first (the + runtime loop awaits; the library does not guard it — stated); any + caller starting `step_session` directly (`pub(super)`); any library-side + concurrency number; any lane acquiring the other lane's pool. + - Shared paths: every session takes the same permit path and the same + `step_session`; a test port and the production port see the same + `PreparedInference`; both pools are read at open by the same shape of + function. + - Deletion line: the sequential loop is gone before `JoinSet` is written. +- **Verification:** + - builds: `cargo check -p ghostlight-dungeon --bin ghostlight-dungeon` + (the signature change and the second pool are the Dungeon edits). + - tests: `cargo test -p ghostlight` = Cut 3 count − any deleted probe + + new; Dungeon 53 + 1 with the same base names. + - negative: `rg -n 'for jurisdiction in jurisdictions' crates/ghostlight/src` + = 0; `rg -n 'fn step\(' crates/ghostlight/src/elaboration.rs` = 0 (only + `step_session`); `rg -n '\.sweep\(\)' crates` = 0 (checked at base: the + only `sweep()` calls are `runtime.rs:1837` and `:3934`, the ignored road + test, which must also pass the elaboration pool; the seed lane's + `sweep(1)` at `:1809` is a different function and does not match); + `rg -n 'Semaphore' crates/ghostlight/src` = the `sweep` signature and + its doc only; `rg -n 'controller_permits' crates/ghostlight-dungeon/src` + lists no line inside `elaborate_world`; `rg -n 'elaboration_permits' + crates/ghostlight-dungeon/src` lists no line inside `run_cover_tick` or + the speak handler. + - mutations: M4.1 `elaboration.rs` `sweep`: drop the `acquire_owned` + (spawn without a permit): `the_sweep_never_exceeds_its_ceiling` and + `a_sweep_holds_a_permit_while_it_infers` must fail. M4.2 + `demand_entries`: remove the dedup by command id: + `a_boundary_under_nested_roots_is_claimed_once` must fail. M4.3 + `sweep`: return on the first error instead of after the JoinSet drains: + `distinct_entries_run_at_once_under_the_ceiling` with one scripted + `Retryable` fault must fail on the orphaned task's missing commit. M4.4 + `runtime.rs:1837`: pass `state.controller_permits` instead of + `elaboration_permits`: `saturating_one_pool_never_delays_the_other`'s + second half must fail. + - operator: one `GHOSTLIGHT_SMOKE_TRACE` road run (`runtime.rs:3738`, + ignored) after this cut with `GHOSTLIGHT_ELABORATION_MAX_CONCURRENT=2`: + the trace shows two elaboration sessions in one sweep when the seeded + world has several boundaries, never more than two, and cover ticks + proceeding while they run. +- **Promises:** + - P4.1 Two sessions in one sweep never share a command id, a store row, + or a provider request id; probe 1's collision cannot be reproduced + through `sweep`. + - P4.2 Sessions in one sweep run concurrently up to the elaboration + ceiling and never beyond it; a sweep with no permit available makes no + inference. + - P4.3 Saturating either pool never delays the other lane. + - P4.4 The sequential loop is deleted; no library-side concurrency number + exists; the two pools are configured by two named variables with the + stated defaults. + - P4.5 A quarantine-class error still ends the sweep with `Err`, after + every spawned session has finished. +- **Landed:** +- **Verdicts:** + +| Promise | Verdict | Evidence | Mutations | +|---|---|---|---| +| | | | | + +## Cut 5. Reconcile the target and the maps + +- **Repo/branch:** Ghostlight `codex/ghostlight-dungeon-mvp` from Cut 4's + commit. Text only; one commit; may be folded into Cut 4's landing commit + by the root agent. +- **First:** Cuts 1–4 pushed; Soul verdicts recorded here. +- **Deletes first:** `docs/architecture/ghostlight-stock-lenses.md:92-105` + ("Questions for Imagination to bring back") — the rulings live here. +- **Keeps and moves:** none. +- **Adds:** `ghostlight-stock-lenses.md:3-8` status paragraph rewritten to + the derived rule ("open until the cut map's cuts are closed"); its "Known + constraints" section rewritten as the live design (lens in the identity, + text on the session, `v16`, `consumer.v5`, `world_create.v4`, + `sweep(ceiling)`, two pools); the target's invariant 3 gains "the lens is + part of the session identity" and invariant 4 names `SetLensWeights` as + the second writer; invariant 5 names the two pools. The target's "Out of + scope" keeps D1–D3 but notes `world_create.v4` landed here by ruling + L1-Q6. `notes/ghostlight-implementation-plan.md:878`: L1 marked landed + with the commit range [Hands]. `notes/fresh-workspace-handoff.md`, + `notes/ghostlight-current-system-map.md`, `state/map.yaml` [steward]. +- **Verification:** `rg -n 'Shipped: the sweep runs one sequential' + docs notes` = 0; `rg -n 'consumer\.v4|controller_work\.v15|world_create\.v3' + docs notes state/map.yaml` matches only the L0 history documents, + `notes/local-live-smoke.md`, and evidence. +- **Promises:** P5.1 No document describes the sequential unlensed sweep + as the live system. P5.2 Every schema string in the live docs matches + `lib.rs:172-173`, `controllers.rs:77-78` and `eve.rs:614`. +- **Landed:** +- **Verdicts:** + +| Promise | Verdict | Evidence | Mutations | +|---|---|---|---| +| | | | | + +## Subtraction ledger + +| Cut | Removed (estimate) | Added (estimate) | Deps / formats / targets | Actual | +|---|---|---|---|---| +| 0 | — | — | scratch captures only | | +| 1 | 0 | `lens.rs` ~150 + tests ~130; `lib.rs` 2 lines + test helper ~6 | 0 deps; 0 targets | | +| 2 | ~6 (doc lines replaced, the v2 denial case) | library: state field, command, effect, two reducer arms, resolve param, mismatch variant, snapshot field, replay check ~90; 19 literal sites × 1 line; tests ~220; Dungeon: payload field, policy fn, Eve control and binding, three schema strings, harness ~40; tests ~60; docs ~8 | 0 deps; `consumer.v4` → `v5`; `world_create.v3` → `v4` | | +| 3 | ~2 (the constant as integrity reference) | session fields, entry builder with candidate probe, request param, identity part ~80; tests ~200; docs ~3 | `controller_work.v15` → `v16` | | +| 4 | ~35 (sequential sweep, `Inactive`, doc lines) | `sweep` + `demand_entries` ~80; second pool and its config ~25; tests ~230; docs ~12 | public `sweep` signature gains a `Semaphore`; one new env variable | | +| 5 | ~14 | ~25 | 0 | | + +Net for L1: about +1,150 lines, of which about two thirds are tests, no new +dependency, no new crate, no new binary, four schema strings replaced, one +environment variable added. The growth buys the capabilities the target +names (lenses, world-owned weights and their owner command, a recorded +replayable draw inside the session identity, concurrent sessions under a +ceiling that cannot starve simulation, an explicit weights payload) and +retires one liability: a sweep whose only protection against a second +session on one answer was that nobody wrote one. + +## Findings not assigned to a cut + +- **L1.f1 (pre-existing, medium, operator-triaged, not blocking L1):** a + sweep error whose `requires_quarantine()` is true reaches + `runtime.rs:1837-1838` and is logged at `debug`; `controller_quarantined` + is never set by the elaboration lane, unlike a speak turn (`:1102-1105`) + or a cover cell. Cut 4 changes the call's argument and keeps the call + shape; it does not touch this path, so the operator's triage stands: + whether elaboration faults quarantine cognition is a Dungeon behaviour + change with its own reason, outside L1. +- **L1.f2 (introduced by Cut 3, low, recorded):** integrity cannot check + that the persisted text is the text current code would author for the + session's lens (Q7 (a) gives that up by design); a hand-forged row with + `lens: Numen` and Patina's text passes integrity as long as its invocation + agrees with its text. A `contains` check would be a text tripwire with the + limits L0 recorded; not added. +- **L1.f3 (pre-existing, low, recorded):** probe 1 showed two invocations + under one command id carry one `provider_request_id`, so the connector's + replay record for the first attempt would answer the second. Cut 3 and + Cut 4 make it unreachable through `sweep`; the request-id recipe itself is + unchanged. +- **L1.f4 (pre-existing, cosmetic, recorded):** the substrate map's Dungeon + count (50 + 1) is the Windows count; on Linux the bin carries four more + tests (`cfg(target_os = "linux")`), so the recipe's `test-dungeon` step + runs 54 + 1 at base. Any "Dungeon count unchanged" claim must say which + host. +- **L1.f5 (pre-existing, low, recorded):** `deployment/idunn/recipe.toml` + state slots still declare `world_state.foundation.v0` and + `controller_work.v3` (L0's F6); Cut 2 and Cut 3 make the drift one + version wider and change nothing about it. Deployment gate owns it. +- **L1.f6 (introduced by Cut 2, low, recorded):** `SetLensWeights` has no + Dungeon route or Eve control in L1; its live consumers are the library and + the external-admission tests. The route is D2's, with `world.set_lens_weights` + → `ghostlight.world_set_lens_weights.v0` in `eve.rs:609-623` and a + `runtime.rs:1530` arm when the slider exists. +- **L1.f7 (pre-existing, low, recorded):** the Linux release remains + unproven by anything here; the recipe's `test-world-library` and + `test-dungeon` steps are the proof and run only through Idunn. +- **L1.f8 (introduced by Cut 4's design, medium, recorded):** the split + pools remove process-local starvation only. Both lanes reach the + connector under one caller id and one quota (`runtime.rs:1863-1865`), so + under connector capacity pressure the connector, not Dungeon, decides who + is refused; elaboration's refusal is retried next sweep and simulation's + is the retryable fault it is today. Making simulation win at the + connector needs connector-side priority or two caller ids, either of + which is outside L1. +- **L1.f9 (pre-existing, low, recorded):** under Q7 (a) only the elaboration + lane binds integrity to stored text. `SEED_INSTRUCTIONS` + (`elaboration.rs:1299`), `PERSONA_PROVIDER_INSTRUCTIONS` and the + operational and interpreter constants still feed `integrity_is_valid` + from code, so an edit to any of them still refuses a store holding that + lane's in-flight row until the row version is bumped (probe Q7, base + behaviour). Whether those lanes should follow (a) is a question for the + pass that next edits them.