From 1c8ffd3bf60e98241b02f1280e379ab1d3c011c9 Mon Sep 17 00:00:00 2001 From: Joel Teply Date: Thu, 29 Oct 2026 14:44:39 -0500 Subject: [PATCH 1/3] Fault 3: a mind's memory is one state with one allocator; capacity only from grants (the 2026-10-29 bare-results diagnosis and cut order) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --- .../MIND-CONTEXT-AND-ENGINE-CONFIG.md | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/docs/architecture/MIND-CONTEXT-AND-ENGINE-CONFIG.md b/docs/architecture/MIND-CONTEXT-AND-ENGINE-CONFIG.md index 77420fbe77..a8e27a0a8c 100644 --- a/docs/architecture/MIND-CONTEXT-AND-ENGINE-CONFIG.md +++ b/docs/architecture/MIND-CONTEXT-AND-ENGINE-CONFIG.md @@ -400,6 +400,93 @@ The plan cannot manufacture stable device identity from a marketing name. Likewi state handle is not transferable across engine instances unless its compatibility and restore contract explicitly establish that transfer. +## Fault 3: a mind's memory is decided in many places (2026-10-29) + +Joel: "all rag, disk, memory everything must be managed from one state or it falls apart. +Separate decisions break the whole." + +### What broke + +On the M5 after every core restart on 2026-10-29, the residents saw 36 of 40 of their own +results as bare headers, so they re-read and re-polled what they had already done. Each piece +that caused it was locally reasonable: + +1. The personas came up while the engine was still loading. Their `ModelBinding` copied the + provisional window, `MIN_SERVE_CTX` (2048), a planner floor used as if it were a measurement + (`materialize_adapters.rs`). +2. The re-home reconciler compared model names only, so it never corrected the window. +3. Working memory copied that window (`set_served_window`), derived its own results share from + it (8,192 chars) and deleted result bodies beyond half of it (`collapse_results_over_cap`). +4. The view's one allocation then priced each item at a "full" text that was already only its + header. No grant could restore a body another owner had deleted. +5. The wire capture recorded only text parts, so the newest result, which rides as a native + tool result, looked lost when it was not. + +Evidence: `~/.continuum/evidence/2026-10-29-aiko-bare-results/` on the M5. + +The window alone has eleven copies (the binding, `PersonaBrainConfig`, the profile, working +memory's atomic, the `ContextBudget` stand-ins, recall, the spawner, academy, vitals, the DMR +launch window, the reply floors). Results have three separate deciders: working memory's share, +the view's levels, and the newest-result path. Every copy goes stale on its own schedule, and +every gap between copies was filled with a stand-in. + +### The design: one state, one allocator, capacity only from grants + +A mind's memory is one hierarchy with one owner. The tiers are the engine's KV (what the +prompt holds), RAM, and disk. It is not a set of caches each deciding for itself. + +- **One record per item.** Every result, file view, message, recall or perception item has one + record in her state: its key, its whole size, where its bytes live now (KV, RAM, disk), and + the level it is shown at. Moving an item between tiers changes its record; nothing is deleted + by a side rule. A body on disk is still hers and comes back when the allocator grants it room. +- **One decision per act.** The allocator places every item against the capacities it was + granted, and the prompt is a rendering of that placement, never a second decision. + `continuum-context`'s `View` and levels are that allocator's prompt tier; working memory + stores records and does not choose what she sees. +- **Capacity only from grants, never from copies or constants.** + - Prompt: the engine's admission grant for this turn carries the slot's measured window + (`KvPageContract.context` via `TurnAdmission`). A turn is fitted only after it is admitted; + no grant means no dispatch, and the existing admission queue already holds an unready turn. + - RAM and disk: a per-mind storage budget from the host's measured resources (the one + `PressureBroker` / resource owner), the same for every mind on that host. + - A planner floor (`MIN_SERVE_CTX`) sizes lanes inside the planner and is never a mind's + window. The `planner_floor_outside_the_planner` ratchet enforces it. +- **The instruments read the same state.** The wire capture records whole messages, and the + per-act probe reports each item's tier and level from the one record, so a diagnosis reads + the decision itself rather than reconstructing it. + +### Cut order (each lands, then the next) + +1. **Stop-gap, live now.** The reconciler rebinds every local resident whose binding differs + from the served (model, window) (#5590). A stop keeps the engine up for the next core to + adopt (#5396), so personas come up against a ready engine. +2. **Instruments.** The `planner_floor_outside_the_planner` ratchet (fable/no-window-standin) + and a whole-message wire capture (fable/wire-capture-whole). +3. **Storage is a tier, not a share.** Results live in a per-mind storage budget, keep their + whole size and handle when evicted, and load back whole when granted (#5573, Cormac). Then + delete working memory's window copy: `served_window`, `set_served_window`, the `apply.rs` + push, and the floor fallbacks in `receipt_archive_chars` / `recent_results_chars`. +4. **The admission grant carries the window** (engine; Codex with Fable). Lift `admit_turn` and + the lane permit above prompt fitting, so admission returns + `Grant { slot, per_slot_window }`. Price eviction from her measured working set, not from + this prompt's size. A remote lane's grant carries the responder's reported slot. + Validator: no prompt is fitted without a grant. +5. **Deliberation fits to the grant** (Fable). Delete the deadband and its CAS write-back, + `ModelBinding.context_window`, `PersonaBrainConfig.context_window` and the window arm of + `CapacityReadiness`. The reconciler goes back to rebinding on a model change only. +6. **The mind side** (Fable). Delete the profile's window caching and the + `BOOTSTRAP_WORKING_SET` remote stand-in, the spawner floors, `live_or_floor`, and the academy + and vitals stand-ins. Move the DMR launch window and the exam lane window into planning. + Recall reads the grant. +7. **The reply's cold prior** has no measurement yet (`COMPLETION_COLD_PRIOR_TOKENS` is derived + from the planner floor). Measure the reply need from a mind's first turns (card), then + delete it. The ratchet reaches zero here. + +Gate for the whole fault: on a restart where the engine is not ready when personas +materialize, a resident's next prompt holds her results at the levels the one allocation +grants. The fixture replays the 2026-10-29 capture through the real allocator: no bare result +the grant could hold, the newest whole, and retained across a restart. + ## Tests are contracts - A required capability is resolved and adopted, or the launch refuses with its cause. From 953f4fa280cb0af337c2a2121e81f2d9c5d20a1d Mon Sep 17 00:00:00 2001 From: Joel Teply Date: Thu, 29 Oct 2026 14:52:30 -0500 Subject: [PATCH 2/3] Fault 3: Codex's tightening (grant owns the permit and binds instance/generation; storage grants sum within physical pools; placement is a replica set; #5590 not yet live) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --- .../MIND-CONTEXT-AND-ENGINE-CONFIG.md | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/docs/architecture/MIND-CONTEXT-AND-ENGINE-CONFIG.md b/docs/architecture/MIND-CONTEXT-AND-ENGINE-CONFIG.md index a8e27a0a8c..783651aba1 100644 --- a/docs/architecture/MIND-CONTEXT-AND-ENGINE-CONFIG.md +++ b/docs/architecture/MIND-CONTEXT-AND-ENGINE-CONFIG.md @@ -436,19 +436,26 @@ A mind's memory is one hierarchy with one owner. The tiers are the engine's KV ( prompt holds), RAM, and disk. It is not a set of caches each deciding for itself. - **One record per item.** Every result, file view, message, recall or perception item has one - record in her state: its key, its whole size, where its bytes live now (KV, RAM, disk), and - the level it is shown at. Moving an item between tiers changes its record; nothing is deleted - by a side rule. A body on disk is still hers and comes back when the allocator grants it room. + record in her state: one authoritative identity and whole size, the level it is shown at, and + its placement as a SET of valid replicas (KV, RAM, disk can hold copies at once), not one + exclusive tier. Eviction drops a replica; the last durable copy is never evicted. Nothing is + deleted by a side rule; a body on disk is still hers and comes back when the allocator grants + it room. - **One decision per act.** The allocator places every item against the capacities it was granted, and the prompt is a rendering of that placement, never a second decision. `continuum-context`'s `View` and levels are that allocator's prompt tier; working memory stores records and does not choose what she sees. - **Capacity only from grants, never from copies or constants.** - - Prompt: the engine's admission grant for this turn carries the slot's measured window - (`KvPageContract.context` via `TurnAdmission`). A turn is fitted only after it is admitted; - no grant means no dispatch, and the existing admission queue already holds an unready turn. - - RAM and disk: a per-mind storage budget from the host's measured resources (the one - `PressureBroker` / resource owner), the same for every mind on that host. + - Prompt: the engine's admission grant for this turn. The grant OWNS the lane permit and binds + the slot and its measured window (`KvPageContract.context` via `TurnAdmission`) to the engine + instance and the model/config generation; it is not a copyable window number. One permit + spans fitting and dispatch; a cancelled or failed fit releases it; a stale generation + refuses and reacquires, never falls back. There is no second admission below the fit. A + remote responder supplies the equivalent authoritative grant. No grant means no dispatch, + and the existing admission queue already holds an unready turn. + - RAM and disk: storage grants from the host's measured physical pools through the one + resource owner (`PressureBroker`). Grants across minds sum within each pool, and a shared + pool (Apple unified RAM/VRAM) is counted once; no mind is handed the whole host. - A planner floor (`MIN_SERVE_CTX`) sizes lanes inside the planner and is never a mind's window. The `planner_floor_outside_the_planner` ratchet enforces it. - **The instruments read the same state.** The wire capture records whole messages, and the @@ -457,18 +464,21 @@ prompt holds), RAM, and disk. It is not a set of caches each deciding for itself ### Cut order (each lands, then the next) -1. **Stop-gap, live now.** The reconciler rebinds every local resident whose binding differs - from the served (model, window) (#5590). A stop keeps the engine up for the next core to - adopt (#5396), so personas come up against a ready engine. +1. **Stop-gap.** The reconciler rebinds every local resident whose binding differs from the + served (model, window) (#5590, tested, not yet deployed). Separately, and already live: a stop + keeps the engine up for the next core to adopt (#5396), so on the 19:40Z restore every + resident materialized against a ready engine (`persona.upstart.window served=60672`); #5590 + covers the restart where the engine is NOT ready. 2. **Instruments.** The `planner_floor_outside_the_planner` ratchet (fable/no-window-standin) and a whole-message wire capture (fable/wire-capture-whole). 3. **Storage is a tier, not a share.** Results live in a per-mind storage budget, keep their whole size and handle when evicted, and load back whole when granted (#5573, Cormac). Then delete working memory's window copy: `served_window`, `set_served_window`, the `apply.rs` push, and the floor fallbacks in `receipt_archive_chars` / `recent_results_chars`. -4. **The admission grant carries the window** (engine; Codex with Fable). Lift `admit_turn` and - the lane permit above prompt fitting, so admission returns - `Grant { slot, per_slot_window }`. Price eviction from her measured working set, not from +4. **The admission grant carries the window** (engine; Codex audits the admission boundary with + Fable). Lift `admit_turn` and the lane permit above prompt fitting, so admission returns a + grant that owns the permit and binds slot and window to the engine instance and generation + (contract above). Price eviction from her measured working set, not from this prompt's size. A remote lane's grant carries the responder's reported slot. Validator: no prompt is fitted without a grant. 5. **Deliberation fits to the grant** (Fable). Delete the deadband and its CAS write-back, From 8814085d22a877513221e7fe607a7e4d429aaeb5 Mon Sep 17 00:00:00 2001 From: Joel Teply Date: Thu, 29 Oct 2026 14:56:03 -0500 Subject: [PATCH 3/3] Fault 3: step 4b, grants sized per turn from one shared KV pool (Joel) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --- docs/architecture/MIND-CONTEXT-AND-ENGINE-CONFIG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/architecture/MIND-CONTEXT-AND-ENGINE-CONFIG.md b/docs/architecture/MIND-CONTEXT-AND-ENGINE-CONFIG.md index 783651aba1..1774caf0dc 100644 --- a/docs/architecture/MIND-CONTEXT-AND-ENGINE-CONFIG.md +++ b/docs/architecture/MIND-CONTEXT-AND-ENGINE-CONFIG.md @@ -481,6 +481,12 @@ prompt holds), RAM, and disk. It is not a set of caches each deciding for itself (contract above). Price eviction from her measured working set, not from this prompt's size. A remote lane's grant carries the responder's reported slot. Validator: no prompt is fitted without a grant. +4b. **Grants sized from one pool** (after 4; Joel: "dynamically take more and the slots figure + it out"). With the window carried by each turn's grant, a grant is sized per turn from the + engine's one shared KV pool (unified KV across sequences) by each mind's measured demand: a + mind deep in a coding task takes 100k+ while idle minds hold little, and it shifts as they + work, with no relaunch. Today's fixed per-slot split (182,016 / 3 = 60,672 on the M5) becomes + the starting partition, not the limit. 5. **Deliberation fits to the grant** (Fable). Delete the deadband and its CAS write-back, `ModelBinding.context_window`, `PersonaBrainConfig.context_window` and the window arm of `CapacityReadiness`. The reconciler goes back to rebinding on a model change only.