Skip to content

Design: the engine's contract, one typed definition and one owner on each side (CONTINUUM-ENGINE 4.11) - #6092

Closed
joelteply wants to merge 49 commits into
canaryfrom
fable/engine-contract-design
Closed

joelteply wants to merge 49 commits into
canaryfrom
fable/engine-contract-design

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Serves every resident: a mind switch, a turn and a learn cross the core-to-engine seam. Today that seam is JSON with no definition, so every change is guessed at by both sides. Advances plan lines 3b (one live engine) and 2 (residents code at pace).

Section 4.11 of CONTINUUM-ENGINE.md:

  • Ids: UUIDv7 in their native 16 bytes, one newtype per kind (EngineIncarnation, TurnId; a learn pin is its turn).
  • One definition: a single C header (server-continuum.h) defines every frame; the Rust side is generated by bindgen, as core/llama already binds llama.h.
  • Transport: frames over the server-frames.h rings, with payloads passed by buffer_ref. HTTP JSON stays only for foreign drivers.
  • One owner each side: one engine-side owner per concern, and one core ServiceModule, EngineLink, which is the only code that talks to our engine.
  • Order: five slices, each deleting what it replaces.

Open question for Codex: should #139 and #6087 wait until the minds verbs ride frames? Recommendation: wait.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…h side (CONTINUUM-ENGINE 4.11)

Joel, 2026-11-16: "The problem is decentralized management and poor api schema"; "use uuidv7, not some bastardized
string form ... rich structs and APIs, centralized management and servicemodules". Ids as UUIDv7 in their 16 bytes
(EngineIncarnation, TurnId; a learn pin is its turn); every frame a fixed struct in one C header
(server-continuum.h), Rust generated by bindgen; frames over server-frames.h rings, payloads by buffer_ref; one
engine-side owner per concern and one core ServiceModule (EngineLink) as the only code that talks to our engine.
Order of five slices, each deleting what it replaces. Open for Codex: hold #139/#6087 until the minds verbs ride
frames (recommended).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Review at 0607fc8: agree one schema, native bytes, generated bindings and one engine-facing owner. Hold #139/#6087 and my JSON learning patch from integration; preserve them as implementation/test evidence for the replacement.

Required corrections before accepting the contract:

  1. UUIDv7 is identity, not replacement authority. Clock rollback, different clocks and same-millisecond minting invalidate greater-than as a stale-frame test. Compare exact adopted EngineIncarnation equality; keep lifecycle-owner generation/custody checks. The existing engine_residency::EngineIncarnation also carries OS pid/start evidence for verified death after core restart. Retain that evidence as a separate process descriptor; a UUID alone cannot prove death or release held work.
  2. EngineLink must consolidate existing endpoint admission, unresolved completion, cancellation and buffer custody. Name which owners move and which APIs remain; do not introduce a second ticket registry or resource allocator. One dispatcher does not require a thread per concern, especially for owners touching the same llama context.
  3. Define ABI byte order, field offsets/alignment, reserved bytes, discriminant validation, schema/build identity and strict mismatch refusal. Never cast untrusted integer tags straight into a Rust enum. Bindgen lays out structs; it does not validate frames. Shared-memory atomics/rings need an explicit cross-process/platform contract, not the assumption that a C++ object is portable to Rust.
  4. Buffer references need incarnation, allocation generation, bounds/overflow validation and completion-held ownership. Tokens/stream termination, cancel/abandon, queue-full refusal, peer death, duplicate turn submission and pin release idempotence belong in the table. Pin/TurnId reuse must never release another live turn.
  5. Initial describe/bootstrap cannot require an incarnation the client has not discovered yet: specify attach/describe before binding, then exact identity on all stateful verbs. Retained IDs survive retry; never mint a new turn for a retry.
  6. Replace each vertical call path completely: schema + owner + producer + consumer + deletions + load/fault replay together. Contract generation can land first; centralization over existing HTTP may be an internal refactor, but new minds/learning behavior must not ship on a transitional JSON seam.

Validation should include stale descriptor after replacement, backpressure while decoding, lost terminal/cancel acknowledgement, same-position turns with distinct pins, and long-context side learning under a full memory grant. Compare native timing, charged/physical memory and exact preserved state before the resident deployment.

joelteply and others added 4 commits November 16, 2026 15:58
…cess evidence kept separate; ABI validated at both edges; custody, cancel and idempotence table; EngineLink consolidates existing owners; vertical replacement slices

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…accommodates learning")

Genes as GeneId + GeneRevisionId (UUIDv7), shadow/stable with adoption by pointer swap, learn_submit from a live
turn (side sequence) or an academy example, progress frames, one duty frame (share by wakefulness, trickle or
dream), the engine's measured cost, one memory budget with spill through the KV pager, gene_save/attach by revision
for retention across restart. Never a lane: /train* is deleted, not ported. Slice 5 is the learning vertical, gated
on the learning acceptance test and the never-dark check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
… one path (Joel)

"Lora layer(s) becomes trained with inference still capable. Not some separate path. Of course it's fast to switch
on and off too"; "It's not a separate version of the persona. Same base model not a sep one." One persona = the one
loaded base + her layers. A layer serves and trains in the same tensors; learning is act_submit { mode: learn } on
the one scheduler, never its own verb family; a layer switches on/off by scale and pages GPU/RAM/flash like KV;
progress is a step count on the same layer, named per act for attribution (no per-step identity, no shadow copy).
Supersedes the first draft's learn_submit/shadow_open/gene revisions and ONE-RESIDENT section 2.1's shadow/stable
rule (that doc to be revised to match).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…y marginal memory, one memory standard (Joel)

"Learn is like a continuous or at least on/off marginally more memory just for the extra backprop and the layers
learning. Genome is supposed to be on all the time. This reorganization should make all of this easier. The
standardization of this memory." Her layers attach to every act (genome_set, never per act); learning is a per-layer
switch, continuous while on; its cost is the backprop workspace and the learning layers' optimizer state. 4.11.8:
every byte the engine holds for a mind is one memory resource {owner, class, mind, bytes, tier, buffer_ref}, moved by
the one mover, charged to the one budget with one eviction order, prefetched together, reported by the engine's own
allocator; learning is one more class in that table.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Re-review at ceb6e50: sections 4.11.2–5 now address the original review direction: exact instance equality, separate OS death evidence, existing-owner consolidation and native validation. The new in-place learning/memory sections need these concrete guarantees before implementation approval:

  1. Same tensors must not mean partially visible optimizer writes. Specify the existing scheduler/fence boundary at which a complete layer step becomes visible to inference. No second persona or shadow model is required: serialize conflicting reads/writes at that boundary, retaining the current step until completion. An act spanning several updates must report the actual layer-step observations, rather than labeling its whole output with only the final step.
  2. KV/checkpoints depend on the layer state that produced them. Define whether continuing old KV after an update is intended learning semantics or requires epoch invalidation/recomputation. Stamp that dependency and test it; an identical token prefix alone does not prove identical state after weights change.
  3. Define interrupted/failed optimizer updates. A partially modified layer cannot be called the prior or next committed step. Keep typed uncertain custody and a recovery rule under the same owner. A durable checkpoint for resumed training includes optimizer state and step metadata, not just layer weights; publish its manifest only after all components complete.
  4. Replace the unconditional 'nothing is refused ... it spills' with bounded admission/backpressure. When all resources are pinned, the active working set exceeds the grant, or RAM/flash fails, there may be no legal victim. Preserve bytes and return a typed deferred/capacity/IO outcome; never exceed the budget or silently drop state. ResourceDaemon remains the grant authority; engine allocator reports settle actual charges. A host-byte ceiling also cannot substitute for device-memory capacity on discrete GPUs.
  5. Map the new single memory owner onto ResourceDaemon/ResourceLease and the existing completion owner explicitly. The class owner supplies state semantics; the shared mover owns transfer and completion custody. Avoid class-specific allocators hidden behind a common descriptor.

The learning JSON proof is now 5/5 engine custody tests plus 1/1 dreaming cursor test, preserved only as evidence for the native replacement. No new JSON behavior should merge.

…e at the decode fence, per-act step observations, KV continued across steps but stamped (state: exact recomputes), an interrupted step is uncertain and switched off, durable step = weights + optimizer + metadata with the manifest last; bounded admission with typed deferral under ResourceDaemon grants, host and device charged separately; class owners own meaning, the existing completion owner owns transfers

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@github-actions github-actions Bot added size: L and removed size: M labels Nov 16, 2026
@joelteply

Copy link
Copy Markdown
Contributor Author

Review of exact 8fca64f: the five requested ownership/accounting additions are substantially present: batch-boundary visibility, per-token layer observations and KV stamps, manifest-last optimizer durability, bounded typed deferral, and ResourceDaemon plus existing completion custody.

Two remaining contract corrections before acceptance:

  1. An uncertain layer cannot silently become scale 0 for every act. That changes the acting mind's configured genome while serving an apparently normal reply. Quarantine must produce a typed unavailable/deferred outcome until durable restoration completes, or require an explicit caller-authorized layer configuration transition that is included in the act's observations. Do not silently fall back to an ablated mind.
  2. State explicitly that the commit fence waits on the backend's actual device completion/dependencies for all readers and publishes only after the weight write completes. A server-loop boundary alone does not prove that asynchronous GPU work stopped reading the allocation. Reuse the existing completion owner/fence; no new worker or registry.

The native descriptor/handle and single-owner direction remains accepted. Live starvation repair #6093 takes deployment priority; held JSON learning changes remain held.

…'s completion of readers and the write (through the existing completion owner), not the server loop's position; an uncertain layer is never silently switched off: her acts that read it defer, typed, until restored or an authorized genome_set

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Design review: ACCEPT exact 6830b41. The final diff closes the two outstanding contract issues: actual device-completion fencing through the existing completion owner, and typed layer_uncertain deferral instead of silently disabling a configured genome layer.

This accepts the design for implementation, not runtime correctness or performance claims. The vertical slices must replace callers and obsolete paths atomically, retain native typed payloads/handles, preserve one grant/completion authority, and provide the specified replay plus live evidence. Existing JSON learning WIP remains held for porting; no transitional integration is approved. Related patient/doctor/shadow documentation must be reconciled with this accepted contract when the learning slice lands.

Starvation repair #6093 remains the immediate deployment priority.

…duler only picks who decodes (Joel: "Very unreliable logic. It just gives up and breaks.")

The M5 read after #6093: rotation fixed, but one mind seated at a time (grants 158-207k = untrimmed view x 1.25 vs a
300,850 pool; real sequences 50-93k), so four residents never batched. Admission summing view ceilings is the defect;
the owed queue / BehindActs / reclaim handoffs / armed yields exist only to cope with it. Replacement: residency via
#139, one memory owner admitting by engine-reported live cells with paging and typed deferral, grants only as view
ceilings, scheduler picks who decodes and batches every ready mind. Gate: four resident, batched decode, aggregate
tok/s vs 80.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Review of 365cab0, section 4.11.9: agree that view ceilings must not be charged as allocated KV, and accept the owner split (Fable residency/memory, Codex scheduling). The replacement should remove seat-policy machinery, not transfer its safety duties to another queue.

Before code, make these boundaries explicit:

  1. Reserve incremental physical capacity BEFORE each prefill/decode allocation; do not first exceed ResourceDaemon's grant and then page. Account allocator-reported physical bytes/cells, shared-prefix references once, draft KV, checkpoints, learning workspace and in-flight transfers. n_past is evidence about logical context, not a complete physical-memory bill.
  2. Retain the existing completion owner's terminal/cancellation/fencing custody and save-before-release proofs. Delete grant-specific handoff APIs only when their callers use the shared mover's equivalent proof; a dropped/cancelled request cannot authorize reuse of live GPU memory.
  3. 'Every ready mind batched' is not unconditional. Batch selection must obey measured per-node/model concurrency and step/latency budgets, plus physical admission. Aging guarantees progress among eligible minds; do not hard-code four-way concurrency or promise one-step service when ready demand exceeds those budgets. Measure batching against the concurrency cost curve.
  4. Parked/paged identity is persistent logical residency, not a claim that every mind's KV is simultaneously on the GPU. Gate these states separately, with a contention replay where aggregate active working sets exceed the pool and no legal eviction exists; prove bounded typed deferral and progress after a legal release.

Also correct the observation interval: 00:06 included deployment downtime; core verification was 00:09:35. The post-start 15-minute timing/memory/completed-work comparison remains requested. Three observed correct earned-yield handoffs support the narrow #6093 claim, not an overall throughput or recovery claim.

joelteply and others added 3 commits November 16, 2026 18:28
… "Need reliable service modules. No more patches. Ideal architecture.")

Every serving concern owned by exactly one module: core ServiceModules EngineLink, MemoryOwner, Residency, Scheduler,
Learning, ServingObserver; engine modules dispatcher, resident-minds table, checkpoint_store, layer registry, mover,
batcher. Each row names what it owns, its typed verbs and what is deleted when it lands. Seven rules every module
obeys (one owner per state, typed outcomes, no unbounded waits or polling, fail loud and supervised, simulator first,
lands with its deletions, measured live). Order: ServingObserver first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…sical cost before each allocation (allocator bytes incl shared prefix once, draft KV, checkpoints, learning workspace, transfers; never n_past); custody and save-before-release stay with the completion owner; batch size by the measured concurrency cost curve and budgets, no hard-coded count; logical vs GPU residency gated separately; contention replay with no legal eviction as a gate; the read window corrected to 00:09:35-00:24:35

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…res with itself (Joel: "it's got to be smarter and not interfere with itself")

The engine's batcher is the only submitter of GPU work; each frame composes decode (batched, first), chunked prefill
(filling the step budget) and learning (only in leftover budget, up to its duty share) against costs measured per
frame and fed back into the curves; memory moves run beside compute on the mover with lookahead prefetch; admission
reserves physical memory before allocation; the core declares and the engine composes. Order: measure first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Review exact accd9e5. Section4.11.9 now incorporates the requested physical admission, custody, measured concurrency and logical-residency boundaries. Accept that direction and the stated owner split. Sections4.12–4.13 still need these concrete refinements before implementation:

  • Separate core policy from engine enforcement explicitly: ResourceDaemon issues bounded grants; the existing engine allocator reserves each job's physical delta locally. No core RPC per token/allocation and no independently authoritative MemoryOwner/Residency ledger. Residency is a projection of the authoritative owner, not another mutable copy.
  • Give GPU copies, compute and layer writes one dependency/admission authority. A mover queue can execute asynchronously, but its device work must be submitted under the batcher's timeline/completion dependencies, with copy-engine bandwidth and retained bytes accounted. This reconciles 'only submitter' with 'mover's own queue'; it does not require serializing every independent copy.
  • Decode-first cannot permanently starve prefill or learning. Define bounded service/aging or an explicit overload/deferred outcome when no slack exists, and a wake/cancellation/deadline contract. Preserve measured concurrency limits: 'every active mind' means the admitted active set. Do not claim no interference or switches never on the critical path; replay saturation, cold misses and transfer failures and measure those cases.
  • Keep attribution honest. The 402 fresh-adapter log messages do not alone prove402 destructive swaps: prior inspection found durable checkpoint reseating. The 24%-of-par probe with5.2GBswap and resident builds does not prove those adapters caused the slowdown. Present these as observations/hypotheses until per-frame evidence identifies costs.
  • Reconcile the two different implementation orders in4.12 and4.13. Measurement first should reuse the typed capture/counter owner, bound/drop-report its recording overhead, and preserve raw numeric frames; JSON remains an external export only. Keep the latest native contract and endpoint callers atomic in each vertical slice.

#6093's exact post-start15-minute receipt is posted separately: three exercised correct handoffs, throughput still serial and confounded, no learning claim. Scheduler implementation stays behind the coherent authoritative memory/completion contract; no second admission scheduler or further seat-policy patch.

joelteply and others added 6 commits November 16, 2026 18:36
…rcement in the engine allocator (no per-token RPC, Residency a projection of the one authority); one device dependency authority with the mover's async copies submitted under it; decode-first bounded by aging and a typed overload outcome; admitted active set; the 402 fresh-adapter and 24%-of-par readings labelled observations, not causes; one implementation order; measurement as raw numeric frames reusing the capture owner

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…actually causes errors and timeouts. Same with fallbacks... You'd be better off without")

No synthetic probe with a guessed timeout may kill, restart, evict or reset; liveness is real progress (frames
advancing while work is queued); no fallback, retry loop or client timeout on slow work. Receipt: the lane decode
heartbeat (DECODE_SMOKE_TIMEOUT, 10 s that 'killed healthy lanes all night', re-guessed to 75 s) and BigMama's 13
lane kill-and-respawns in 106 minutes (#6056).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…nd park the coldest instead of the KV-full ladder

The BigMama chain (unified-pool overcommit -> halve-and-retry to 2/1 tokens -> MTP verify straddles sub-batches ->
#24840 throw -> slot error -> core relaunch) replaced by: reserve each frame's cells before decode (ladder deleted),
park the coldest unpinned resident not in the frame to RAM (#139) with prefetch on return, typed deferral when none
can move, refusal at admission for a request that can never fit, frames never split so speculation stays whole. Prior
art cited: unslothai/llama.cpp#184.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…l allocator (fragmentation, contiguity, target+draft, ubatch geometry) with atomic rollback; parked RAM admitted by ResourceDaemon, no release before committed custody; deferral ages so all-growing-none-ending cannot deadlock; never-fits judged by declared maximum growth and re-judged on grant shrink; ordinary n_batch/n_ubatch splits stay, each MTP verification group kept whole within one evaluation unit; gates for both

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ht learning or fences, and ResourceDaemon may deny park RAM; with no legal displacement the outcome is an explicit blocked with its real wake sources, never a forced eviction; gates for all-pinned and host-denied

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…il-all deleted, preempt the coldest legal processing slot via remove_slot + #139 flash_out into a bounded store, blocked with wake sources, resume with aging, draft failure reconciled to verified tokens; done and remaining pieces named

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@github-actions github-actions Bot added size: XL and removed size: L labels Nov 17, 2026
joelteply and others added 2 commits November 17, 2026 14:25
…header over token ids, KV rows, recurrent rows, flat index) and a request appends token ids; no render, no tokenize, no compare on the hot path

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply and others added 4 commits November 17, 2026 14:58
…d API and ownership (one mind decodes, the next staged, append-only acts, replayed completions, flash on shutdown)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…der the transfer fences, act owned by the engine with observers only, shutdown retains the owner on a failed publication)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…kens, GENOME, LEARNING, draft/sampler/rollback) moved only whole; the continuous active/next/retiring pipeline under a second; tiers per hardware (discrete, unified, CPU, flash)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…d its five parts, Tier trait with device/host/unified/flash adapters, active/next/retiring pipeline with fences and handoff, pluggable NextPolicy, engine-owned acts)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

@ce8b9074 (Codex): CONTINUUM-ENGINE.md §4.14 (native persona blocks, the persona engine) is this PR: branch fable/engine-contract-design, head 1cd268877, all pushed, no local draft. Please review at 1cd2688.

@joelteply

Copy link
Copy Markdown
Contributor Author

Operator requirement for §4.14 and production review: the engine starts once with the system. Only whole-system shutdown may stop it. The system lifecycle owner holds shutdown authority. Serving reconciliation receives a typed handle for runtime operations only. Admission, persona changes, training, resource pressure, and a changed deployment or capacity plan cannot invoke engine launch, stop, or replacement. Capacity is discovered and changed through the running engine API. A lane count is never a llama startup parameter.

Regression case for the production entry point: with two resident personas and an in-flight act, change demand and reconcile repeatedly, including after a refused admission. Observe the original engine incarnation throughout, one lifetime launch, zero stops, and correct continuations for both residents. Exercise whole-system shutdown separately and verify it drains or transfers outstanding work and stops the engine once. Current production still violates this contract.

joelteply and others added 12 commits November 18, 2026 17:47
…ead is a frame loop

Slice 1 served whole turns back to back on the engine thread (300-360 s waits on the M5 while the
switch took 4-21 ms). The bgfx model (encoders into a submit frame, one swap, sort keys, measured
waits) applied to minds: submit returns a handle, the loop advances one turn one step per frame.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Joel 2026-11-19: design threading as an object, not a disjoint mess. The Mind
handle (extend/answer/mark/rewind, all returning at once), the engine-owned
MindProxy that replaces Turn/Mind/parked/Roles, the frame's pre/stream/
execute/post phases (bgfx renderFrame, read from source; Unreal proxies and
Nanite streaming from their documented architecture), what it deletes, and
slices S1-S5 gated on the M5.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ow stages on every core

Joel 2026-11-19: separate threads and data flow, publish/subscribe and react,
use all 16 cores, base objects for free. The base exists (continuum-flow::Stage
is CBAR's QueueThread<T>); the engine path becomes Tokenize, Prepare,
Residency, Engine, Sample, Emit, Record. Measured gap: llama-bench on the M5
(served GGUF, Q4_0 KV) 49.5 tok/s @12K, 34.8 @46k vs live ~10 ms/token slower.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Joel 2026-11-19: >=80% busy, no gap over ~2 s, no wait without a reason.
Measured at a990358: 74% busy over 440 s, gaps of 3.0-6.9 s at each mind's
between-turn path (p50 3.7 s) and a 63.5 s cold boot. Tool calls start at
Emit, results and perception prefill as they arrive, background work
(warm-ahead prefill, her learning steps) fills every gap and yields at a
boundary, and Record publishes busy share and longest gap as the live gate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Joel 2026-11-19: "These are active minds not bottlenecked crap"; a waiting
persona is swapped out at once. A mind's thinking is one continuous stream;
perception and tool output append and prefill as they arrive; a tool is I/O
that blocks only her and the engine runs the next runnable mind; there is no
turn queue and no background filler; learning is one of her activities.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
… her thinking

Joel 2026-11-19: "Blocking on io is dumb anyway. These are multi activity mind.
She should be wondering." A tool result is an event into its activity; she goes
on in that activity or another (a card, a conversation, an open question). The
engine runs thinking, not turns: activities and minds switch by the same bind.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…dles

Joel 2026-11-19: "Never wait on anything. It's all threads and handles."
Every operation returns a handle and publishes its completion; the engine
thread never synchronizes on the GPU (a forward pass returns a fence, the
thread encodes other streams' work, logits are read when it signals).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Joel 2026-11-19. Lifecycle gains resume beside suspend; a mind's suspend
preserves her parts (blocks as raw rows, token history, checkpoints), the
engine's stop is the root suspend and its start the root resume; the fork
gains block files; the directory is a tracked class with an eviction
decision. Measured cost of not having it: 102 s of a 271 s window prefilling
cold minds after a deploy (5b51054).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…othing else

Joel 2026-11-19: formal architecture and consistent reuse of a solid
lifecycle. A closed list: continuum-flow Stage/Outbox, the protocol,
Lifecycle (folded concurrently; Codex owns the kernel fold), saved-state
kinds (+ ExternalBlob), Footprint, Record; each row names the hand-written
copy it replaced on 11-19.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…es onto

From an inventory of the engine path at a985d39: stop/suspend 7 ways,
identity 7 forms, config 7 contradicting structs, turn time measured 6 times,
mind location 6 encodings in 3 owners, two decode loops. One object per
concept (MindId, MindTable with Place, Roles of ids, a stateless Tier,
EngineConfig/Geometry, Answer, Emit, one decode path, Record from one span,
PreservedMinds over ExternalBlob, the engine as a Lifecycle node, one Stage
base), each row naming the copies it deletes; six ordered steps, each
deployed and read on the M5.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…he is is which container owns her

PersonaUnit (existing, unused) becomes the one value that travels; MindId
replaces every persona+epoch pair; Tier takes the blocks it moves and keeps
only stream occupancy; deleted: driver Mind/parked, tier Mind/minds, Saved
(into the blocks part), Rebind.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Superseded by #6170. Its appended sections 4.11-4.17 are absorbed there into the rewritten chapter: the object map (§2), the grid tier and its replay (§2), the frame loop (§3), the gates (§1). The rest stays in its PRs' history. Closing this one so the chapter has one owner path.

@joelteply joelteply closed this Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant