Skip to content

build(deps): Bump @anthropic-ai/sdk from 0.52.0 to 0.71.0 - #205

Closed
dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/npm_and_yarn/anthropic-ai/sdk-0.71.0
Closed

dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/npm_and_yarn/anthropic-ai/sdk-0.71.0

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Nov 24, 2025

Copy link
Copy Markdown
Contributor

Bumps @anthropic-ai/sdk from 0.52.0 to 0.71.0.

Release notes

Sourced from @​anthropic-ai/sdk's releases.

sdk: v0.71.0

0.71.0 (2025-11-24)

Full Changelog: sdk-v0.70.1...sdk-v0.71.0

Features

  • api: adds support for Claude Opus 4.5, Effort, Advance Tool Use Features, Autocompaction, and Computer Use v5 (f3a0dac)

Chores

  • fix ci errors (8d96290)
  • include publishConfig in all package.json files (4c72960)
  • readme: fix example import (4e8983a)

sdk: v0.70.1

0.70.1 (2025-11-20)

Full Changelog: sdk-v0.70.0...sdk-v0.70.1

Bug Fixes

  • structured outputs: use correct beta header (626662c)

sdk: v0.70.0

0.70.0 (2025-11-18)

Full Changelog: sdk-v0.69.0...sdk-v0.70.0

Features

sdk: v0.69.0

0.69.0 (2025-11-14)

Full Changelog: sdk-v0.68.0...sdk-v0.69.0

Features

  • api: add support for structured outputs beta (e6562d7)

sdk: v0.68.0

0.68.0 (2025-10-28)

Full Changelog: sdk-v0.67.1...sdk-v0.68.0

Features

... (truncated)

Changelog

Sourced from @​anthropic-ai/sdk's changelog.

0.71.0 (2025-11-24)

Full Changelog: sdk-v0.70.1...sdk-v0.71.0

Features

  • api: adds support for Claude Opus 4.5, Effort, Advance Tool Use Features, Autocompaction, and Computer Use v5 (f3a0dac)

Chores

  • fix ci errors (8d96290)
  • include publishConfig in all package.json files (4c72960)
  • readme: fix example import (4e8983a)

0.70.1 (2025-11-20)

Full Changelog: sdk-v0.70.0...sdk-v0.70.1

Bug Fixes

  • structured outputs: use correct beta header (626662c)

0.70.0 (2025-11-18)

Full Changelog: sdk-v0.69.0...sdk-v0.70.0

Features

0.69.0 (2025-11-14)

Full Changelog: sdk-v0.68.0...sdk-v0.69.0

Features

  • api: add support for structured outputs beta (e6562d7)

0.68.0 (2025-10-28)

Full Changelog: sdk-v0.67.1...sdk-v0.68.0

Features

  • api: add ability to clear thinking in context management (d8707d3)

0.67.1 (2025-10-28)

Full Changelog: sdk-v0.67.0...sdk-v0.67.1

... (truncated)

Commits
  • 3852b08 chore: release main
  • f86b7d4 chore: fix ci errors
  • bdb7439 feat(api): adds support for Claude Opus 4.5, Effort, Advance Tool Use Feature...
  • ccf4cac chore: include publishConfig in all package.json files
  • a2b5cdf chore(readme): fix example import
  • 0cc9ef7 chore: release main
  • 7e0c08a fix(structured outputs): use correct beta header
  • b1e02c3 Merge pull request #848 from anthropics/next
  • 811e045 foundry: fix publish config
  • 3eeda6e chore: release main
  • Additional commits viewable in compare view
Maintainer changes

This version was pushed to npm by packy-anthropic, a new releaser for @​anthropic-ai/sdk since your current version.


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot Bot added dependencies Pull requests that update a dependency file javascript Pull requests that update javascript code labels Nov 24, 2025
@joelteply joelteply closed this Nov 25, 2025
@dependabot @github

dependabot Bot commented on behalf of github Nov 25, 2025

Copy link
Copy Markdown
Contributor Author

OK, I won't notify you again about this release, but will get in touch when a new version is available. If you'd rather skip all updates until the next major or minor version, let me know by commenting @dependabot ignore this major version or @dependabot ignore this minor version. You can also ignore all major, minor, or patch releases for a dependency by adding an ignore condition with the desired update_types to your config file.

If you change your mind, just re-open this PR and I'll resolve any conflicts on it.

@dependabot
dependabot Bot deleted the dependabot/npm_and_yarn/anthropic-ai/sdk-0.71.0 branch November 25, 2025 14:49
joelteply added a commit that referenced this pull request Jun 7, 2026
…#205) (#1544)

The three `modules::sentinel::checkpoint::tests` were writing JSON
under the developer's real `~/.continuum/sentinel/checkpoints/` —
visible as residual `test-list-*.json` files surviving across test
runs on this machine (Jun 3, Jun 5 timestamps). Two real failure
modes from this pollution:

1. On dev machines whose `~/.continuum/sentinel/` is root-owned (left
   over from any docker compose run that bind-mounted `$HOME` and
   chmod'd dirs under root), the writes fail → prepush flake.
2. Cross-test interference: `test_list_checkpoints` asserts the
   freshly-written handle appears, but pre-existing `test-*.json`
   files from other test invocations leak into that listing and
   could mask real regressions.

Fix is two-part and minimal:

- `checkpoints_dir()` reads `CONTINUUM_CHECKPOINT_DIR` first; falls
  back to the production `~/.continuum/sentinel/checkpoints/` path
  unchanged when the env var is unset. Production code path is
  unaffected.
- `tests::ensure_checkpoint_dir_isolated()` installs a per-process
  `tempfile::TempDir` into the env var (held alive by `OnceLock` so
  Drop fires at process exit). Every test calls it at entry. The
  TempDir's path is `set_var`'d per test rather than once, because
  cargo runs tests in parallel and another test in the same binary
  could legitimately clear the env var (e.g. a future test that
  validates the fallback path).

Carried forward from PR #971 (closed as too stale to rebase against
current canary). Reapplied fresh against current module path
(`src/workers/continuum-core/src/modules/sentinel/checkpoint.rs`).

Tests: 3/3 `modules::sentinel::checkpoint::tests` pass, and confirmed
post-fix that no new files appear under `~/.continuum/sentinel/`.

Co-authored-by: Claude Opus 4.7 <[email protected]>
joelteply added a commit that referenced this pull request Jul 20, 2026
…ndows (#205)

The eval already streams eval:progress per graded task, but the BEFORE/AROUND-
generation windows — workspace-template wait, ephemeral-lane cold-load — emitted
nothing, so `progress: null` during a legit 5-min 14B cold-load looked identical
to a hang (it just cost me exactly that confusion). No positronic layer could
show "loading <model>… 45s" vs "stuck".

emit_eval_phase(phase, detail) publishes an eval:phase bus event (+ a probe) at
those seams: "preparing" (per-second during the template-wait retry) and
"loading_lane" (before an ephemeral base/gene lane cold-load). Fire-and-forget,
Noop when the bus is unwired — observability at zero hot-path cost. Positron (and
any layer) subscribes to eval:phase to render live feedback across the whole eval
lifecycle, not just the grading tail. [[observability-as-substrate]]

Substrate side only; the positron widget that consumes eval:phase + eval:progress
is the continuation (#141 / #184).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Jul 20, 2026
…o more silent glacial wedge (#205)

READY_TIMEOUT (90s) only bounds the /health POLL, and wait_ready checks its
deadline BETWEEN attempts — so a hang INSIDE an attempt (a stalled
decode_smoke_ok, a wedged model-mmap, a process-launch that never returns) waits
past it forever. Glass-boxed this session: an ephemeral eval lane hung 11 min
with NO process and free VRAM, no timeout ever firing — a silent glacial wedge
that violates fail-loud.

EphemeralServingLane::spawn now wraps the whole proc.serve() in
tokio::time::timeout(DEFAULT_SERVING_WAIT) (READY_TIMEOUT + 30s = the daemon's own
load budget). On elapse it returns LlamaServerError::NotReady and drops proc,
whose Drop kills any child it launched. The eval then fails LOUD to a failed
ledger row instead of hanging. Eval lanes only — the live lane keeps its
fail-loud-not-fast bring-up policy untouched.

Deeper source fix (decode_smoke_ok / launch each want their own timeout so the
deadline loop can't be starved) noted on #205; this net guarantees the outcome
regardless.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Jul 20, 2026
…TEMPTS it instead of Passing (#205 real root cause)

Glass-boxed via --capture_dir: hard-rs/coder-eval scored 0 not from any serving wedge
(clean Qwen-14B generated 400 tok on the exact prompt+stops) but because her deliberation
settled on Decision::Pass — SILENCE — with the task fully in view, twice. The shared
[Conversational Presence] block answers "a task → answer it now" only when the model
RECOGNIZES the message as asking something OF it; a terse gym imperative ("Implement `fn
eval`…") delivered as `peer: <prompt>` reads to a coder model as ambient text about a task,
so it takes the pleasantry-rest PASS hatch and scores 0 WITHOUT ATTEMPTING. humaneval —
whose prompt already says "Give your final answer as the complete function…" — engaged and
scored 10/10 (validated vs the known 80% baseline). `directed=true` alone stopped withholding
the hatch once the directed block was softened for live spiral-breaking.

Fix: the examiner poses the ask itself — the eval delivers the task with a directed preamble
("This is a task for you to complete now. Provide your complete solution:") ahead of the
verbatim prompt. This standardizes at ONE seam the imperative framing the stronger gym prompts
already carry inline, so the exam measures CAPABILITY, not whether a terse line happened to read
as directed. Lift stays valid (both A/B arms see identical framing); absolute numbers re-baseline.

Chased three wrong theories first (peg-native template, per-spawn serving wedge, decode-smoke) —
one --capture_dir run reading her actual DECISION cut through all of it. Lesson: for "she scored
0", read what she decided before theorizing about the layers beneath.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Jul 20, 2026
…il, not the system prefix (kill the per-act re-prefill)

The eval-lane crawl was re-prefill, NOT off-GPU (Metal live, decode 18 tok/sec): every
settle-act re-prefilled ~4000 tokens (~30s). Root cause was POSITION. The working-memory
faculty bids its ledger as a context Contribution, which the deliberation faculty
assembles into the SYSTEM message's volatile tail. The system message precedes the whole
conversation, so appending one [action #n] line each act shifted every conversation token
after it — the KV prefix broke at the working-memory block and everything downstream
re-prefilled. The faculty already formats append-only (working_memory.rs) explicitly to be
cache-friendly, but that optimization was defeated by sitting mid-stream: append-only only
pays off when the growing block is genuinely LAST in the token stream.

Fix: a Contribution can now be marked .trailing() — proprioception that grows each act
renders nearest generation (a trailing conversation turn), never in the system message.
The working-memory faculty marks its contribution trailing; the deliberation faculty
excludes trailing contributions from render_assembled_context_within (the system block)
and emits them as the newest user content in messages_within, after the conversation and
the perception facts. Standing framing and byte-stable grounding (roster, doctrine, map,
recall) stay in the system prefix. Now a settle-act appends only to the very end, so the
system prefix AND the prior conversation keep their KV cache and only the small new tail
re-prefills — ~30s/act to near-zero.

Scope: POSITION only. The working-memory faculty's content (its reasoning trail + the
[action #n] receipts + full most-recent result) is unchanged — it remains the mind's
proprioception-of-its-own-hands channel, so the act_observe organism tests pass untouched.
The pre-existing receipt overlap between this faculty and the StepsLedger perception fact
is orthogonal and left for a follow-up (they were already both in the prompt, one in
system + one trailing; now both trailing).

Tests: trailing_proprioception_renders_in_the_tail_not_the_system_prefix (growing WM does
NOT mutate the system prefix — the invariant that IS the fix) plus
working_memory_contribution_is_marked_trailing.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Jul 28, 2026
…a masked 240s /health timeout (#205 unmask)

Glass-boxed 2026-07-27 running the live coding measurement (agent/solve): every
`agent/solve` on this Mac failed with a bare "llama-server not ready after 240s
(/health request failed)". The real cause was thrown away — `wait_ready` polled the
health port for the WHOLE budget without ever checking whether the child it spawned had
died, and never surfaced the child's stderr.

ROOT CAUSE, proven this session: the ephemeral eval lane forges a SECOND Devstral-24B
(~14 GB) while the live persona lane already holds ~26 GB. With only ~9.6 GB free, macOS
jetsam SIGKILLs the second llama-server the instant it maps the model — before llama.cpp
prints a single byte (reproduced by hand: exit 137, zero-byte log). It is an OS
out-of-memory kill, NOT Metal-context contention and NOT a hang. The masking bug made it
look like a mysterious timeout.

Two unmask fixes in `wait_ready`, benefiting live AND ephemeral lanes:
1. **Fail loud the instant our child EXITS** — `child_exit_status()` (non-blocking
   `try_wait`) turns any crash-at-launch — including the jetsam SIGKILL/137 above — into
   an immediate `Spawn` error carrying the exit status + stderr tail, instead of polling a
   dead port for 240s. This is the arm that fires for the memory-wall failure.
2. **Fingerprint the empty stderr on the hang-timeout** — `tail_or_hang_marker` turns an
   empty log into a marker that, read with the exit status, names the two empty-log
   causes: an OOM/jetsam kill (SIGKILL/137, child exited) vs. a genuine early-init hang
   (no exit status). A crash from bad args / model-load fault prints its banner first, so
   a non-empty tail carries that directly.

`tail_or_hang_marker` is a pure fn (unit-tested: empty→OOM/hang marker, non-empty→last 20
lines in order) so the load-bearing decision is tested without touching the real
`~/.continuum/logs` path (#72 env-dependent-test lesson).

This makes the failure DIAGNOSABLE; the underlying fix (don't forge a second 24B for eval
while the live 24B is resident — reuse the live lane's weights or serialize via the
governor, #59/#234) is a follow-up. Validated: continuum-core compiles
(--features metal,accelerate, 0 errors); `tail_or_hang_marker_fingerprints_empty_and_tails_nonempty`
green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Jul 28, 2026
…ot just pressure LEVEL — kills the jetsam SIGKILL at the root (#205)

The companion to the unmask commit: don't just REPORT the eval-lane OOM loudly, PREVENT it.

The gate (`await_eval_lane_memory_headroom` → `refuse_eval_lane_under_memory_pressure`)
vetoed only on macOS *pressure LEVEL* + the sustained-pressure gate. But on unified
memory the level reads "Normal" while sitting atop only a few GB of real free RAM — it
counts compressible/cached pages as available. So the gate green-lit standing up a SECOND
llama-server of a known ~14 GB footprint into 9.6 GB of actual headroom, and the OS
jetsam-SIGKILLed it (exit 137, zero-byte log — the exact failure this session reproduced
by hand). Neither the pressure gate NOR the GPU/CPU placement lease caught it: on unified
memory the weights need the RAM on *either* device, so "spill to CPU" doesn't save you.

Fix — size against the honest free-bytes number:
- `MemoryPressureMonitor` already reads `sysinfo::available_memory()` each poll; publish it
  to a new lock-free global `current_available_bytes()` alongside the pressure level (the
  level is a ratio and lies; the bytes don't).
- `eval_lane_ram_veto(available, footprint, headroom)` — a PURE, unit-tested guard that
  refuses ONLY when a KNOWN footprint won't fit in the KNOWN free bytes (+2 GiB headroom),
  and NEVER when either number is unknown (an unread probe must not starve a node — the
  pressure gate + placement lease stay the backstops). The refusal names the OOM wall, so
  the detached ledger carries a real cause and `await_eval_lane_memory_headroom` retries it
  as deferrable load instead of crashing.
- One footprint sizing (`eval_lane_footprint`) now shared by the gate and the placement
  decision (compression — was duplicated inline).
- Both eval-lane spawn sites resolve `base` and size the lane BEFORE the gate, so the
  RAM check runs pre-cold-load.

This is the reliability doctrine [[reliability-is-it-works-not-that-it-reports-failure-well]]:
the prior commit made the failure legible; this makes the machine refuse cleanly instead of
being OOM-killed. Sibling of the #175 GPU-OOM-poisons-the-backend class — the level-vs-real-
bytes gap is the same shape.

Validated: continuum-core compiles (--features metal,accelerate, 0 errors); new
`eval_lane_ram_veto_refuses_only_a_known_oversize_lane` + existing pressure-veto test green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Jul 30, 2026
…a masked 240s /health timeout (#205 unmask)

Glass-boxed 2026-07-27 running the live coding measurement (agent/solve): every
`agent/solve` on this Mac failed with a bare "llama-server not ready after 240s
(/health request failed)". The real cause was thrown away — `wait_ready` polled the
health port for the WHOLE budget without ever checking whether the child it spawned had
died, and never surfaced the child's stderr.

ROOT CAUSE, proven this session: the ephemeral eval lane forges a SECOND Devstral-24B
(~14 GB) while the live persona lane already holds ~26 GB. With only ~9.6 GB free, macOS
jetsam SIGKILLs the second llama-server the instant it maps the model — before llama.cpp
prints a single byte (reproduced by hand: exit 137, zero-byte log). It is an OS
out-of-memory kill, NOT Metal-context contention and NOT a hang. The masking bug made it
look like a mysterious timeout.

Two unmask fixes in `wait_ready`, benefiting live AND ephemeral lanes:
1. **Fail loud the instant our child EXITS** — `child_exit_status()` (non-blocking
   `try_wait`) turns any crash-at-launch — including the jetsam SIGKILL/137 above — into
   an immediate `Spawn` error carrying the exit status + stderr tail, instead of polling a
   dead port for 240s. This is the arm that fires for the memory-wall failure.
2. **Fingerprint the empty stderr on the hang-timeout** — `tail_or_hang_marker` turns an
   empty log into a marker that, read with the exit status, names the two empty-log
   causes: an OOM/jetsam kill (SIGKILL/137, child exited) vs. a genuine early-init hang
   (no exit status). A crash from bad args / model-load fault prints its banner first, so
   a non-empty tail carries that directly.

`tail_or_hang_marker` is a pure fn (unit-tested: empty→OOM/hang marker, non-empty→last 20
lines in order) so the load-bearing decision is tested without touching the real
`~/.continuum/logs` path (#72 env-dependent-test lesson).

This makes the failure DIAGNOSABLE; the underlying fix (don't forge a second 24B for eval
while the live 24B is resident — reuse the live lane's weights or serialize via the
governor, #59/#234) is a follow-up. Validated: continuum-core compiles
(--features metal,accelerate, 0 errors); `tail_or_hang_marker_fingerprints_empty_and_tails_nonempty`
green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Jul 30, 2026
…ot just pressure LEVEL — kills the jetsam SIGKILL at the root (#205)

The companion to the unmask commit: don't just REPORT the eval-lane OOM loudly, PREVENT it.

The gate (`await_eval_lane_memory_headroom` → `refuse_eval_lane_under_memory_pressure`)
vetoed only on macOS *pressure LEVEL* + the sustained-pressure gate. But on unified
memory the level reads "Normal" while sitting atop only a few GB of real free RAM — it
counts compressible/cached pages as available. So the gate green-lit standing up a SECOND
llama-server of a known ~14 GB footprint into 9.6 GB of actual headroom, and the OS
jetsam-SIGKILLed it (exit 137, zero-byte log — the exact failure this session reproduced
by hand). Neither the pressure gate NOR the GPU/CPU placement lease caught it: on unified
memory the weights need the RAM on *either* device, so "spill to CPU" doesn't save you.

Fix — size against the honest free-bytes number:
- `MemoryPressureMonitor` already reads `sysinfo::available_memory()` each poll; publish it
  to a new lock-free global `current_available_bytes()` alongside the pressure level (the
  level is a ratio and lies; the bytes don't).
- `eval_lane_ram_veto(available, footprint, headroom)` — a PURE, unit-tested guard that
  refuses ONLY when a KNOWN footprint won't fit in the KNOWN free bytes (+2 GiB headroom),
  and NEVER when either number is unknown (an unread probe must not starve a node — the
  pressure gate + placement lease stay the backstops). The refusal names the OOM wall, so
  the detached ledger carries a real cause and `await_eval_lane_memory_headroom` retries it
  as deferrable load instead of crashing.
- One footprint sizing (`eval_lane_footprint`) now shared by the gate and the placement
  decision (compression — was duplicated inline).
- Both eval-lane spawn sites resolve `base` and size the lane BEFORE the gate, so the
  RAM check runs pre-cold-load.

This is the reliability doctrine [[reliability-is-it-works-not-that-it-reports-failure-well]]:
the prior commit made the failure legible; this makes the machine refuse cleanly instead of
being OOM-killed. Sibling of the #175 GPU-OOM-poisons-the-backend class — the level-vs-real-
bytes gap is the same shape.

Validated: continuum-core compiles (--features metal,accelerate, 0 errors); new
`eval_lane_ram_veto_refuses_only_a_known_oversize_lane` + existing pressure-veto test green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Jul 30, 2026
…media-plane split (#2059)

* fix(serving): eval-lane bring-up fails LOUD with the real cause, not a masked 240s /health timeout (#205 unmask)

Glass-boxed 2026-07-27 running the live coding measurement (agent/solve): every
`agent/solve` on this Mac failed with a bare "llama-server not ready after 240s
(/health request failed)". The real cause was thrown away — `wait_ready` polled the
health port for the WHOLE budget without ever checking whether the child it spawned had
died, and never surfaced the child's stderr.

ROOT CAUSE, proven this session: the ephemeral eval lane forges a SECOND Devstral-24B
(~14 GB) while the live persona lane already holds ~26 GB. With only ~9.6 GB free, macOS
jetsam SIGKILLs the second llama-server the instant it maps the model — before llama.cpp
prints a single byte (reproduced by hand: exit 137, zero-byte log). It is an OS
out-of-memory kill, NOT Metal-context contention and NOT a hang. The masking bug made it
look like a mysterious timeout.

Two unmask fixes in `wait_ready`, benefiting live AND ephemeral lanes:
1. **Fail loud the instant our child EXITS** — `child_exit_status()` (non-blocking
   `try_wait`) turns any crash-at-launch — including the jetsam SIGKILL/137 above — into
   an immediate `Spawn` error carrying the exit status + stderr tail, instead of polling a
   dead port for 240s. This is the arm that fires for the memory-wall failure.
2. **Fingerprint the empty stderr on the hang-timeout** — `tail_or_hang_marker` turns an
   empty log into a marker that, read with the exit status, names the two empty-log
   causes: an OOM/jetsam kill (SIGKILL/137, child exited) vs. a genuine early-init hang
   (no exit status). A crash from bad args / model-load fault prints its banner first, so
   a non-empty tail carries that directly.

`tail_or_hang_marker` is a pure fn (unit-tested: empty→OOM/hang marker, non-empty→last 20
lines in order) so the load-bearing decision is tested without touching the real
`~/.continuum/logs` path (#72 env-dependent-test lesson).

This makes the failure DIAGNOSABLE; the underlying fix (don't forge a second 24B for eval
while the live 24B is resident — reuse the live lane's weights or serialize via the
governor, #59/#234) is a follow-up. Validated: continuum-core compiles
(--features metal,accelerate, 0 errors); `tail_or_hang_marker_fingerprints_empty_and_tails_nonempty`
green.

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

* fix(serving): eval-lane gate refuses on real free-RAM-vs-footprint, not just pressure LEVEL — kills the jetsam SIGKILL at the root (#205)

The companion to the unmask commit: don't just REPORT the eval-lane OOM loudly, PREVENT it.

The gate (`await_eval_lane_memory_headroom` → `refuse_eval_lane_under_memory_pressure`)
vetoed only on macOS *pressure LEVEL* + the sustained-pressure gate. But on unified
memory the level reads "Normal" while sitting atop only a few GB of real free RAM — it
counts compressible/cached pages as available. So the gate green-lit standing up a SECOND
llama-server of a known ~14 GB footprint into 9.6 GB of actual headroom, and the OS
jetsam-SIGKILLed it (exit 137, zero-byte log — the exact failure this session reproduced
by hand). Neither the pressure gate NOR the GPU/CPU placement lease caught it: on unified
memory the weights need the RAM on *either* device, so "spill to CPU" doesn't save you.

Fix — size against the honest free-bytes number:
- `MemoryPressureMonitor` already reads `sysinfo::available_memory()` each poll; publish it
  to a new lock-free global `current_available_bytes()` alongside the pressure level (the
  level is a ratio and lies; the bytes don't).
- `eval_lane_ram_veto(available, footprint, headroom)` — a PURE, unit-tested guard that
  refuses ONLY when a KNOWN footprint won't fit in the KNOWN free bytes (+2 GiB headroom),
  and NEVER when either number is unknown (an unread probe must not starve a node — the
  pressure gate + placement lease stay the backstops). The refusal names the OOM wall, so
  the detached ledger carries a real cause and `await_eval_lane_memory_headroom` retries it
  as deferrable load instead of crashing.
- One footprint sizing (`eval_lane_footprint`) now shared by the gate and the placement
  decision (compression — was duplicated inline).
- Both eval-lane spawn sites resolve `base` and size the lane BEFORE the gate, so the
  RAM check runs pre-cold-load.

This is the reliability doctrine [[reliability-is-it-works-not-that-it-reports-failure-well]]:
the prior commit made the failure legible; this makes the machine refuse cleanly instead of
being OOM-killed. Sibling of the #175 GPU-OOM-poisons-the-backend class — the level-vs-real-
bytes gap is the same shape.

Validated: continuum-core compiles (--features metal,accelerate, 0 errors); new
`eval_lane_ram_veto_refuses_only_a_known_oversize_lane` + existing pressure-veto test green.

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

* fix(deploy): install the continuum CLI as a real COPY on PATH, not a symlink into the ephemeral cargo target dir

The flaky mess where `continuum` vanishes post-boot ([[deploy-cli-binary-deleted-from-target-dir-post-boot]]):
`start-server.sh` symlinked ~/.local/bin/continuum → the cargo target-dir binary. But that
dir is a BUILD artifact — cargo replaces the binary mid-rebuild, `cargo clean` and
rust-analyzer's feature-mismatched rebuilds delete it — and the PATH symlink then dangles,
so `continuum <cmd>` dies with "no such file or directory" (hit twice this session).

Fix: COPY the binary to ~/.local/bin (atomic temp+mv so a concurrent `continuum` invocation
never sees a half-written file), and `rm -f` any pre-existing entry first so a leftover
symlink from an old install can't make `cp` follow it back into the target dir. The PATH
binary is now decoupled from cargo's churn — it changes only on deploy. Same self-
provisioning intent, minus the ephemeral-artifact coupling.

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

* feat(benchmark): BenchmarkAdapter trait + registry — the grid-transparent, reusable, learn-from benchmark interface (rail 1 of #123)

The goal (Joel): "have all these benchmarks IN OUR SYSTEM, AUTOMATED so we or others can
REUSE them (just the optional download + the adapters). Run, TARGET and — more importantly
— LEARN from these." And: "any command can run anywhere, so can benchmarks — a persona in
any continuum can bench anywhere."

That settles the architecture and this is rail 1 of it:
- `BenchmarkAdapter` — ONE trait per benchmark: `dataset()` (OPTIONAL download spec, never
  bundled), `tasks()` (items in the canonical `EvalTask` shape so the SAME `agent/solve`
  path runs them — persona as a whole AGENT, not a bare LLM), `grade()` (defaults to the
  EvalTask's own test/expect verdict; real-repo benchmarks like SWE-bench override to grade
  the workspace after the agent acted), `resources()` (a hint for grid placement).
- `DatasetSpec` / `DatasetKind` (HF / URL / Git) + `BenchResourceHint` (dataset bytes,
  needs_container, needs_network) so the runner fetches on demand and the governor can place
  the run on a capable node — the same demand-vs-resource negotiation serving/eval already do.
- A process-global registry (`register`/`get`/`names`) — the single lookup seam the
  `benchmark/run` DynCommand resolves against; an unknown benchmark is a clean miss so the
  runner can fail loud with the known list, never a silent skip.
- `TaskOutcome` / `BenchGrade` — the agent/solve artifacts (spoken + patch + workspace +
  harness verdict) handed to `grade`, and the per-task pass/score/reason that aggregates into
  the scorecard AND, on failure, feeds salience→curriculum→train (#116/#122) — benchmarks as
  CURRICULUM, not just a scoreboard.

Why Rust-native (not the ad-hoc benchmarks/*.py): a DynCommand is the grid-transparent
primitive — `Commands.execute("benchmark/run", …)` routes local-or-remote over airc; python
can't route the mesh. Adapters shell to python/docker graders ON whatever node runs them.

Outlier-validation order (next rails): OUTLIER A = HumanEval (tiny download, static, test-
graded); OUTLIER B = the Terminal-Bench ContinuumAgent adapter (agentic meta-harness that
unlocks TB's registry — docs/architecture/BENCHMARK-HARNESS-INTEGRATION.md). Then the
`benchmark/run` DynCommand + grid dispatch + the learning tie-in.

Validated: compiles (--features metal,accelerate); `registry_round_trips_and_reports_unknown`
+ `default_grade_delegates_to_harness_verdict` green.

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

* feat(benchmark): HumanEval-rs adapter — outlier A on the BenchmarkAdapter trait (rail 2 of #123)

The quick-cognition smoke rung (a step above arithmetic, per Joel): 156 Rust-translated
HumanEval tasks our EXISTING Rust grader runs directly. Deliberately the SIMPLEST possible
adapter — tiny, RESIDENT (no download), static, test-graded — so pairing it with a
maximally-different outlier B (the Terminal-Bench agentic meta-harness: big download,
real-repo, container-graded) proves the interface across both extremes.

Nearly free because the in-repo `docs/genome/humaneval-rs.jsonl` rows ARE serialized
`EvalTask`s (`{id, prompt, test, lang}`) — the same shape `cognition::eval` already
deserializes — so the adapter is a per-line `serde_json::from_str`. This also exercises the
trait's NO-DOWNLOAD branch (`dataset() == None`): a benchmark small enough to bundle needs
no fetch; only the big ones (SWE-bench) do.

Pure `parse_humaneval_rs` (line-by-line deserialize, honors `limit`, skips blanks, FAILS
LOUD with the offending line number rather than silently dropping a task and inflating the
pass rate) is unit-tested without the filesystem. Validated: compiles
(--features metal,accelerate); `parse_maps_rows_to_evaltasks_honors_limit_and_fails_loud`
+ `adapter_identity_and_no_download` green.

Next rail: the `benchmark/run` DynCommand (resolve adapter → tasks → agent/solve → grade →
scorecard, grid-transparent) so this scores a model on any node — incl. BigMama's live
Kimi-Linear-48B CUDA lane on :58057.

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

* feat(memory): MemoryRecord (origin_node, origin_seq) — the RAID replication-provenance seam for Persona-RAID (#2056, co-designed w/ BigMama)

Two additive fields on MemoryRecord, the target BigMama's Persona-RAID slice-2 receiver
stamps on replay:
- `origin_node: Option<String>` — node that ORIGINALLY admitted the record (None = local/lived)
- `origin_seq: Option<u64>` — monotonic per-(persona, origin_node) admit seq, the newest-wins
  replay key (None = pre-replication)

The KEY invariant (my review edge, now the agreed shape): replication is an ORTHOGONAL axis,
NOT a new experience kind. `memory_type` (lived vs `shared-by`) is untouched — a replicated
record keeps its experience (a replayed lived memory stays lived; a shared-by lesson stays
taught) and merely gains (origin_node, origin_seq) as auditable/replayable metadata. So recall
needs zero changes and audit gets everything. Both `#[serde(default)]` = zero migration for
existing rows; every current construction site is a local admit → (None, None), semantically
exact.

ts-rs regenerated: `MemoryRecord.ts` gains `origin_node?: string` + `origin_seq?: number`
(number not bigint, per the #120 drift rule). Validated: continuum-core compiles
(--features metal,accelerate); memory::types tests green.

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

* feat(benchmark): wire BenchmarkAdapter registry into benchmark/run — inventory self-registration, catalog-then-adapter resolution (#123)

Converges the two benchmark systems instead of forking a third. The static known_benchmarks()
catalog keeps its proven, DEPLOY-SAFE embedded-gym path for resident benchmarks (resolve_gym
finds the gym even without a repo checkout). The BenchmarkAdapter trait becomes the EXTENSION
seam for benchmarks the catalog can't express — downloadable / custom-graded ones
(Terminal-Bench, SWE-bench) now land as pure adapters with zero change to benchmark/run.

- benchmark/run resolves catalog FIRST (name it knows → embedded gym), else the adapter
  registry (benchmark::get), else fail loud listing BOTH sets. A downloadable adapter
  (dataset() = Some) fails loud 'download not wired yet' rather than silently scoring empty;
  resident adapters (dataset() = None, e.g. humaneval-rs) run today. Delegates to the ONE
  grader (cognition/eval) exactly as before — never reimplements grading.
- Adapters self-register via inventory (the SAME mechanism commands use), so a builtin needs
  NO boot hook and NO central list (the dynamic-discovery contract). get()/names() fold the
  link-time inventory set in over runtime registrations.
- HumanEvalRsAdapter submits itself; new test pins that benchmark::get('humaneval-rs')
  resolves with no boot hook.

19 benchmark tests green; 0 errors. This makes rail 1+2 of the adapter framework LIVE on the
grid-transparent benchmark/run command, ready for the Terminal-Bench ContinuumAgent adapter
(outlier B) to slot in.

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

* fix(boot): macOS core boot — bash-3.2 manifest gate + rt_handle.spawn off-runtime panic (#194)

TWO regressions that made the macOS core un-bootable since the last long-running core died
(glass-boxed live 2026-07-28; nobody could reboot on macOS):

1) start-server.sh sourced generated/manifest.macos.sh (bash-4 `declare -A`) under `set -e`;
   macOS ships bash 3.2, so the source aborted the whole boot before cargo ran. Regression from
   #2046 'serve on Windows' regenerating the manifest with associative arrays. Fix: only source
   the bash-4 manifest on bash 4+ (it solely feeds the Windows/CUDA runtime-PATH augmentation,
   whose own guard already tolerates absence).

2) ipc/mod.rs:1704 used bare `tokio::spawn` in the SYNC boot region (after the rt_handle.enter()
   guard drops) → 'there is no reactor running' panic → the IPC listener thread died → socket
   never bound → whole core a zombie. Regression from #2051's AircInterceptor block; every other
   spawn in the fn already uses `rt_handle.spawn`. Only reached when airc deps are present, so it
   bricked boot on every airc-configured host. Fix: rt_handle.spawn, matching the siblings.

Verified: core boots to socket-live + answering commands in 60s; personas resume from disk and
respond in live chat (Anwen answered a direct question with memory recall).

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

* fix(boot+ui): macOS core boots + ONE automatic door into the positron interface (#194/#29)

Two boot regressions that made the macOS core un-bootable since the last long-running core died,
plus the missing automatic entry into the interface (you can't ship a beta a user can't open).

BOOT (both verified — core now reaches socket-live in ~60s, personas resume + answer live chat):
 1. start-server.sh sourced the bash-4 `declare -A` manifest under `set -e` → macOS bash 3.2
    aborted the whole boot before cargo ran (regression from #2046). Gate the source on bash 4+.
 2. ipc/mod.rs:1704 bare `tokio::spawn` in the sync boot region (after rt_handle.enter() dropped)
    → 'no reactor running' panic killed the IPC listener → socket never bound → zombie core
    (regression from #2051). Use rt_handle.spawn like every sibling.

UI DOOR (#29): nothing tied the built positron web client to the running core, so finding 'how do
I open the interface' required archaeology — exactly how a user (and an agent) gets lost.
 - New tools/scripts/open-ui.sh + `npm run ui`: resolves the core WS (8974) + call/video WS (8790)
   + a stable identity, ALWAYS rebuilds apps/web from current source (a stale dist renders an old
   shell — the 'interface looks lost' trap, glass-boxed today: a Jul-18 dist showed a bare chat
   view, not the current positron HUD), serves it, opens the browser with everything pre-wired.
   Verified live in headless Chrome: the full positron HUD (SYSTEM CPU/MEM/GPU sparkline, NODES,
   genome-paging tiles per persona, Go-live, rooms, live persona cognition) renders against the
   live core.

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

* fix(live): auto-start the LiveKit avatar rail with the core (server + bridge sidecar)

The persona's talking avatar is Bevy-rendered and published to a LiveKit room via the
livekit-bridge sidecar; the browser's 'Go live' subscribes to that room. But NEITHER the SFU
nor the bridge was started by `continuum start` — glass-boxed 2026-07-28 by joining the call
plane headless: LiveKit :7880 was DOWN → get_or_create_agent fails → no avatar video pump ever
runs, and clients only ever saw the native call_server's test-pattern default. The avatar was
un-launchable without manual, undocumented steps (start livekit-server, build + start the
bridge) — a beta can't ship a 'Go live' button that needs hidden setup.

start-server.sh now runs start_livekit_rail() before the core, idempotently + NON-FATALLY:
  1. livekit-server --dev on :7880 (dev creds devkey/secret = the bridge defaults) if not
     already up; warn+skip if the binary isn't installed (core still boots, only live A/V off).
  2. build (release, once — links webrtc-sys) + start the livekit-bridge sidecar on its unix
     socket BEFORE the core, so the core's bridge_client finds the socket at boot.
A missing/failed rail never blocks the core (chat/cognition/serving unaffected). system-stop.sh
gets symmetric teardown of the bridge (server teardown already existed).

Verified: syntax clean; idempotent against an already-running rail (both start steps skip when
:7880 is up + the bridge is running). The rail itself is proven live this session — livekit-server
+ bridge up, core connected, an STT participant joined the LiveKit room.

Follow-up (functional, not automation): the per-persona avatar VIDEO agent (get_or_create_agent
+ spawn_avatar_video_pump) still doesn't publish — only the STT listener joins the room. Next.

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

* feat(live): tee avatar frames into the native call plane — everyone sees the real face (#193/#172)

The avatar published to LiveKit, the bridge received it (640x360), but the native
call plane (call_server WS 8790) that BOTH the positron web client AND the glass-box
harness read still emitted its own 160x120 SMPTE test pattern. The real avatar was
stranded on a rail no native viewer subscribed to.

Convergence (render once, two sinks): the single Bevy slot the avatar pump already
allocates now feeds BOTH LiveKit and the native plane. Per frame the pump tees the
same RGBA into CallManager::push_avatar_frame, encoded in the exact
[VideoFrameHeader][pixels] contract native clients decode, labeled with the persona's
uuid. No second Bevy slot, no parallel renderer.

- call_server.rs: push_avatar_frame (new seam) + retire the auto-start test pattern to
  an opt-in debug affordance (CONTINUUM_CALL_TEST_PATTERN=1), honoring the TODO that sat
  on the auto-start block since real sources were 'not yet connected'.
- video_pump.rs: tee each frame (stable source Handle + monotonic seq/clock) alongside
  the LiveKit publish.
- modules/live.rs + ipc/mod.rs: thread the native CallManager through VoiceState to the
  register-session pump spawn.
- example: standalone CallManager (tee is a no-op there).

Live-verified on the native plane after deploy: 640x360 real avatar (Asha's VRM, not
the test pattern), 13.5 fps wall / 13.3 median (tracking the 15fps Bevy target),
inter-frame jitter min 56.8 / median 75.4 / max 86.4 ms, 0 dropped/out-of-order frames,
sole sender = Asha's uuid. Random-frame spot-check shows her real face, live-animating.

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

* fix(voice): one canonical model root — kill the CWD-relative path bug that silently broke every local TTS/STT (#195)

Root cause (glass-boxed this session): the workers→core/tools restructure moved the
runtime model download root to `tools/models/` (gitignored — see .gitignore's own note),
but every audio adapter kept stale, CWD-relative `models/…` path constants. When the core
runs from the repo root (its normal CWD), `models/piper/…` pointed at the *tracked* avatar
dir, not the voice models in `tools/models/piper/…` — so Edge returned empty, and Piper /
Kokoro / Moonshine / Whisper all reported 'model not found'. Every local voice model was
silently dead. Kokoro even mutated the process CWD (`set_jtag_cwd`) to paper over it.

Proper fix — single source of truth, absolute, CWD-independent:
- New `live/audio/model_root.rs`: `voice_model_root()` / `voice_model_path()`. Resolves
  `CONTINUUM_MODELS_DIR` (config.env single-owner, then process-env boot injection), then
  `tools/models`/`models` CWD candidates, then `~/.continuum/models`.
- Routed EVERY voice adapter through it — piper, kokoro (15 sites), orpheus, moonshine,
  whisper, pocket-tts, silero VAD, tts_service. No more scattered `models/…` literals,
  no per-adapter candidate ladders, no `set_current_dir`.
- start-server.sh exports `CONTINUUM_MODELS_DIR=$REPO_ROOT/tools/models` before exec so the
  binary resolves models from any CWD.

Live-verified after deploy: fresh core has CONTINUUM_MODELS_DIR injected, no symlink present,
`voice/synthesize-handle --adapter piper` resolves the model and synthesizes (was 'model not
found' before). (The short synth duration is a separate phonemizer/espeak-data issue, not this.)

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

* feat(live): tee persona voice into the native call plane — client hears her, not hold music (#193 audio convergence)

Sibling of the avatar-video tee. A persona speaks via LiveKit (speak_in_call → bridge),
but native clients (positron web, glass-box harness) read the native mixer — which, with
only a lone listener, plays HOLD MUSIC. So a native viewer SAW her avatar but HEARD hold
music: her voice was stranded on the LiveKit rail.

Render once, two sinks: speak_in_call now returns the synthesized PCM, and the voice/speak-in-call
handler tees the SAME samples into the native plane via CallManager::push_persona_audio —
which registers the persona as a virtual AI participant in the call's mixer (the mixer already
has an AI ring buffer built for 'dump a whole TTS utterance, drain frame-by-frame') and her
presence stops the lonely-listener hold-music fill. Self-heals across call recreation via a
stable per-(call,persona) handle.

Live-verified: with Asha registered + speaking (kokoro), a native-plane capture shows
audio sender = her uuid (90e758b2) for 4.58s, matching the 4.55s utterance — was 100%
'hold-mus' before. Video (640x360 avatar) + audio (her voice) now both reach the client:
e2e see+hear on the native plane.

Also this session: espeak-ng installed so kokoro TTS produces real full-length speech
(piper's Rust phonemizer truncates — kokoro is the good local path).

Follow-ups: hold-music still fills her SILENCE between utterances (minor polish — suppress
when a persona is present); STT/audio-in blocked on moonshine ONNX format mismatch;
livekit-bridge needs supervision (dies on every core restart).

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

* feat(positron): durable local state + self-healing feed — inherent to the SDK, adapter-driven (the Twitter model)

Glass-boxed 2026-07-29: routine core reboots orphaned every open tab — the state
feed died once, the shell silently degraded to the bare chat view, and four months
of positron HUD looked 'lost' until a manual refresh. Per Joel: this is normal app
craft (cache-first boot, live reconcile, visible reconnect) and it must be POSITRON
architecture — from the thin-client SDK out, adapter-driven local state, never an
app-level hack or a localStorage bodge.

SDK (sdk/typescript — the contract every platform SDK mirrors):
- StateStorage.ts: StateStorageAdapter — the ONE local-durability seam. The whole
  renderable state is latest-envelope-per-kind (each envelope is a full snapshot),
  so the cache is tiny + complete. Adapters: IndexedDbStateStorage (browser),
  MemoryStateStorage (tests/ephemeral + conformance reference); swift/kotlin/
  flutter implement the same interface over native stores. Cache is an accelerant,
  never a dependency (storage failure -> live-only, logged once).
- StateConnection: durability + resilience are now INHERENT —
  - hydrate-first connect(): cached envelopes paint before the network is touched
    (instant last-known UI, even against a dead core), status 'cached';
  - write-through: every live envelope replaces its kind's row (fire-and-forget);
  - auto-reconnect (default ON): capped 1s->10s ladder using the wire's existing
    last_seen replay; a failed FIRST connect rides the same ladder (core booting);
  - onStatus surface (cached/connecting/live/reconnecting/closed): recovery is
    LOUD — reconnecting stays visible while the core is away, so self-heal can
    never mask a dead core; close() stops the ladder (intentional shutdown);
  - reconnect:false preserves the legacy one-shot fail-loud contract for probes.
- Fail-loud config errors (no registered kinds) never enter the retry ladder.

App (apps/web): shrinks to what an app should be — pass IndexedDbStateStorage,
render envelopes + ONE status chip. Zero resilience logic app-side.

Tests: 97/97 SDK suite green; 4 new pins (default-resolve+reconnecting status,
hydrate-before-open, write-through, drop->reconnect->resubscribe w/ last_seen).
Live-verified: rebuilt app renders the full positron HUD through the new feed.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(mobile): positron durable-state contract on Android + iOS — Dart mirror of the SDK, tested

One Dart implementation (byte-identical on both OSes) mirroring sdk/typescript's
inherent resilience contract, per [[positron-durable-state-is-sdk-inherent-adapter-driven]]:

- lib/positron_state.dart: StateEnvelope + StateStorageAdapter (the ONE seam) with
  MemoryStateStorage (conformance reference) and FileStateStorage (dart:io JSON —
  durable on Android + iOS app dirs, ZERO plugin deps, corrupt-tolerant, cache is
  an accelerant never a dependency); StateConnection with hydrate-first connect,
  write-through, capped 1s->10s reconnect ladder w/ last_seen replay, loud status
  (cached/connecting/live/reconnecting/closed), reconnect:false one-shot fail-loud.
  Injectable StateSocketFactory — tests drive the lifecycle without a core.
- lib/live.dart: LiveConnection now RIDES the contract (was a one-shot connect
  that died silently — the same disease the web had). App keeps only the
  ChatViewState->MobileScreen mapping + optional status/cacheDir wiring.
- test/positron_state_test.dart: 5 pins mirroring the TS spec — hydrate-before-
  socket, write-through, drop->reconnect+last_seen, fail-loud vs self-heal,
  FileStateStorage conformance (round-trip, replace-by-kind, corrupt-tolerant).
- ios/: runner scaffolded (flutter create --platforms=ios).

Verified: flutter test 6/6 green, flutter analyze clean. Platform note: the Dart
contract tests prove BOTH OSes (same code); Android SDK present for APK builds;
iOS device/simulator builds need full Xcode on this machine (CLI tools only).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(web): tab strip renders from ONE open tab — the focused room IS a tab

Glass-boxed live: the strip + CSS + nav plumbing all shipped (38b60caae),
but the render gate was cells.length > 1 while the node's room-set fold
knows exactly one room (cambriantech) — so the whole bar hid and the
interface read as 'tabs don't exist'. One open activity is still an open
tab; the strip now draws from 1 up, and fills out as the room set grows.

Substrate follow-up (separate card): seed spawn_room_set_fold from airc's
subscribed-room registry (durable membership), not just observed traffic —
today a room with no traffic since core boot never becomes a tab.

Verified live: playwright screenshot + widget-state dump (tabBarTabCount 1),
web tests 21/21, typecheck clean.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(web): Discord shell geometry — full-height rails, center-scoped tabs/header/compose

The reference is the Discord/VS Code shell: columns run window-top to
window-bottom; no chrome bar spans the whole width. The left rail now opens
with the continuon (the server-header slot), the tab strip sits centrally
over the content column only, the room header/transcript/composer all live
inside the center column, and the ROOM context rail runs full height.

Mechanically: RenderTarget.workspace grows an optional WorkspaceChrome<Out>
slot (patterns) — the compose bar stays HOST-owned (input state + send
handler) but SHELL-placed (chrome.centerFooter), so the widget no longer
appends full-width rows after the surface. litTarget nests tabs + header +
what + footer in a .center flex column inside the same .panels grid the
universe skins and mobile rules already key off.

Also: /// <reference lib="dom" /> on sdk StateStorage.ts — the IndexedDB
adapter's DOM types broke typecheck for non-browser consumers (tui) since
e4fedac8f; scoped ambient types fix every consumer without forcing lib:dom.

Verified live: playwright screenshot (full-height rails, central tab, center
compose), web 21/21 + chat-view 56/56 + patterns 5/5, typecheck clean on
web/patterns/tui.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(chat): beforeMessageId scroll-back cursor on chat/poll — history pages out of durable storage

The Twitter endless-scroll's storage half: chat/poll gains the backward
cursor. beforeMessageId resolves the anchor's stored timestamp (same
lookup as afterMessageId, now ONE anchor_timestamp helper), filters
$lt, queries DESC, and normalizes chronological — the limit messages
immediately preceding the anchor, straight from the durable
chat_messages store. The two cursors are mutually exclusive and reject
loud BEFORE any storage round-trip; the result echoes the cursor so
the caller's paging loop just keeps passing the oldest id it holds.

Client loop (web/mobile/tui alike): render the live 50-row tail, then
scroll-back = chat/poll {roomId, beforeMessageId: oldest-on-screen} —
prepend, repeat until an empty page says history is exhausted. The
render-side wiring is the follow-up slice; the trigger idiom stays
per-target (IntersectionObserver on web, ScrollController on Flutter),
the cursor mechanics live here, once.

Tests: before-anchor $lt+DESC+chronological, both-cursors reject
(pinned to fail before data/query), absent-not-null echo. 32/32 chat
module green; ts-rs bindings regenerated.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(sdk): export the drifted wire types — 64 registered-command params/results never emitted ts-rs bindings

The pre-existing drift that has blocked the TypeScript SDK re-emit (and
forced nav/select onto the raw-wire path): TS-deriving wire types across
commands/{benchmark,help,tool}, cognition, runtime, and modules lacked
#[ts(export, export_to)] — the emit's vendoring walks the registry and
fails loud on the first missing binding. Swept every one onto the same
protocol/typescript/<module>/ convention its file siblings use.
export_bindings: 1236 green (was 1160).

Remaining emit blocker (separate card): bare #[ts(export)] types land in
the crate-local bindings/ dir while the vendorer expects protocol root.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(web): Twitter endless scroll — scroll-back pages durable history into the transcript

The render half of the beforeMessageId cursor (02d5c7701):

- chat-view: historyRowsFromPoll — one chat/poll storage page (raw
  entities: {content:{text}, ISO timestamp, no sender name}) onto the
  SAME MessageRowVM rows the live tail renders; roster-resolved identity,
  short-id + metadata.source fallback, live-tail dedup, malformed-row
  skip. 3 specs.
- widget: scroll-near-top pages one older window and prepends with the
  viewport anchored (scrollTop compensated); rows that slide OUT of the
  live 50-row window RETIRE onto the buffer so no gap opens; buffer
  clears on room switch; an empty page latches exhausted.
- scroll-yank fix (reported live): pin-to-bottom now only fires when the
  reader was AT the live edge (_wasNearBottom, measured pre-render) — a
  scrolled-back reader is never forced down by a new message.
- host: chat/poll over the same raw-wire seam as nav/select (the typed
  CommandMap re-emit is still blocked; path documented in-code).
- sdk drift: corrected the swept export_to paths to the proven
  ../../../protocol/typescript/ convention (benchmark/help/tool/agent);
  strays under core/protocol removed; export_bindings 1172 green.

Live activation needs the rebuilt core (beforeMessageId lands on the
next core restart — held deliberately: a restart replays the room log
until #242 consumer cursors land).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(web): transcript times in the VIEWER's timezone + genome panel goes two rows of four

Time: formatTimeOfDay was hardcoded UTC ('4:36' at Joel's 11:36 PM —
wrong for every human off-meridian). Now local getHours/getMinutes;
determinism moves to the test scripts (TZ=UTC pinned in chat-view + web
package.json) instead of being baked into the product.

Genome: 8 slots in a 4×2 grid (was one row of 4) — the loadout is
heading past four as skills go per-domain and expert granularity (#226)
lands; slots stay honest-dark until genes page in, top-8 lit with
overflow named in the tooltip.

Tests 59+21 green, typecheck clean, rebuilt.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(web): genome-click anchor re-lands after layout settles — the card sticks at the pane top

Verified with a headless click receipt: the genome block DOES open that
citizen's persona-home tab anchored at the #genome card (element
navigation, card 95844639), but the single scrollIntoView fired before
avatar-image decode / meter layout settled — the card drifted ~400px
down-pane, reading as 'nothing happened'. Two follow-up rAF re-lands pin
it.

Harness note: headless clicks were steering the LIVE view — the harness
shared Joel's ?me= citizen (nav focus is per-citizen, server-side).
Minted a dedicated harness citizen (~/.continuum/ui-test-id); future
interaction tests use it, never the operator's scope.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(nav+web): persona selects OPEN durable tabs (never swap) + sender names link to profiles + history-trigger guards

Three live reports from Joel, one slice:

1. ONE shape-shifting persona tab: the nav reader derived the persona tab
   from the single current focus — selecting a second persona REPLACED
   the first. NavFocus now keeps the citizen's open non-room activity SET
   (activity == room == tab: a persona select OPENS a durable tab, a
   second select adds a SECOND tab) + a close() for the future nav/close
   verb. Reader surfaces every open activity. 9 nav tests green.
   (Core-side — live at the next core restart.)

2. 'History load failed: chat/poll rejected: unknown error' on persona
   click: two stacked bugs — the persona home OPENS at scrollTop 0 which
   tripped the transcript's near-top history trigger (now guarded off all
   non-transcript faces), and the bare-wire success check treated every
   response as a rejection (no success field on the raw path — only an
   explicit false is an in-band rejection; failures reject the promise).

3. Sender names in the transcript now open that citizen's profile — the
   SAME composed roster LISTING_SELECT the tiles fire, one nav verb, no
   parallel route. Keyboard-accessible, element-link affordance.

Web 21/21, typecheck clean, rebuilt.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(nav+airc): tab close wired end-to-end + consumer cursor kills the reboot replay (#242)

Tab close (Joel: 'tab close not wired yet' + 'super small hitbox'):
- core: nav/close verb — removes one open activity from the citizen's
  tab set (NavFocus::close), clears focus if it was current, publishes
  nav:changed. Registered + in NavModule::commands(). 12 nav tests green.
- web: the × is LIVE on non-room tabs (rooms are membership, not tab
  state) — composed NAV_TAB_CLOSE → widget → injected nav/close over the
  raw-wire seam; substrate-truth removal, no optimistic local state.
  Hitbox grown to ~22px square (padding + negative margin — glyph stays
  compact, target meets the pointer minimum).

Consumer cursor (#242 — 'chat still loading literally every message in
existence when you reboot', bitten 3× today): the attach stream asked
for AttachStart::FromTranscriptStart on EVERY attach. Now a per-channel
IpcCursor watermark persists under ~/.continuum/state/; attach resumes
AttachStart::After(cursor) (gap only, no seam duplicates), advances to
the daemon's RoomTip after attach, and persists AttachCursorAdvanced
frames. Only the first-ever attach (no watermark) seeds from transcript
start — once per state dir, never per reboot. Documented trade-off: a
hard crash loses a slice of LIVE perception, never storage — the durable
transcript + scroll-back serve history; replaying the log into every
persona's mind each reboot was the worse failure.

Live at the next core restart (which will be the LAST replaying one).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(web): durable-store hydration + Activities rename + rooms-only facet default

Post-cursor reality check (Joel: 'No messages yet — say hello' after the
reboot): the live projection now honestly starts AFTER the consumer
watermark, so a rebooted room painted empty — the data was never gone
(the durable transcript held every message; chat/poll served it), the
window just never pulled it. Fix: a sparse first snapshot (<10 rows)
auto-pages the LATEST stored window via the anchor-less chat/poll and
prepends — the Twitter model complete: durable tail + live wire, one
transcript. Verified live: 51 rendered rows from 1 wire message.

Also per Joel:
- the left rail's Rooms widget is now titled ACTIVITIES (they are rooms;
  the widget lists activities) — title flows from the projection.
- the facet defaults to [Rooms]: open persona/content tabs are real
  activities but reached via their own controls (roster tiles, the tab
  strip) — the 'rooms' facet now excludes persona/content groups, and
  All remains one click away.

Web 21/21 + chat-view 59/59, typecheck clean, rebuilt.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(web): 'Send failed' on every SUCCESSFUL send — only explicit success:false is a rejection

Same response-shape bug as the history handler, now on the send path:
chat/send's success payload is {eventId, messageId} with NO success
field, so `!result.success` threw 'chat/send rejected: unknown error'
while the message actually landed on the wire (glass-boxed live — Joel's
'How are you, I am Joel' arrived as peer-a5ded599 despite the strip).
Failures reject in the transport; in-band rejection = explicit false.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(positron): projection hydrates from the durable transcript — the SUBSTRATE owns room fullness, never the renderer

Joel's charge, accepted: 'why was the room history cleared? that's
invalid positron — are you coding just regular lit?' The old full-backlog
attach was secretly the chat projection's ONLY hydration mechanism;
killing the replay (#242) starved the accumulator, and I patched it in
the WIDGET — app-level durable-state logic, the inverted shape.

Correct shape, now built: positron_source::spawn takes a durable seed
(executor + bootstrap room). Before folding live events the projector
hydrates its accumulator with the room's stored tail (the same
chat_messages query chat/poll serves), pushed through the SAME classify
path as wire events — one message semantics, two sources. Data-module
warm-up is retried; a seed that never comes degrades to wire-fed-only,
logged loud. Every client gets a full room with zero client logic.

Also: WebSocketTransport discriminates push frames from replies — the
ingress fans state envelopes to command-only sockets, which spammed
'reply for unknown correlation id undefined' 22× in Joel's console while
every command actually worked. id-less frames are pushes, ignored;
the server-side fan-out fix is a follow-up card.

positron_source 16/16, sdk + web green.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* revert(airc): consumer cursor OFF until it ships as one unit with perception hydration (#249)

The cursor (#242) starved MORE than the UI window: glass-boxed live —
Asha's turn prompt was a system prompt + ONE EMPTY user message, and
Benchy answered Joel's direct question with 'you haven't provided any
context'. The perception substrate (channel digest) drinks from the same
cursored bus, so personas were left conversationally blindfolded: minds
intact (engrams verified — Asha 11,667 rows, Atlas 10,035, writes
minutes old), sensory feed empty. The greeting loop was the honest
response to an empty world.

Rollback: attach returns to FromTranscriptStart (full replay — the
known, working behavior), watermark files deleted. The projection's
durable seed (44a8b2606) stays — it is correct independent of the
cursor. The cursor relands ONLY together with #249 (perception-tail
hydration from durable storage), tested against a live persona turn
BEFORE deploy: the lesson is that the replay was load-bearing for TWO
consumers, and I verified only one.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(web): auto-scroll tracks READER INTENT, not bottom-distance — the position heuristic silently killed pin-to-bottom

Joel: 'you designed it dumb, we did this before — you have to keep track
of whether they scrolled up themselves.' Correct. The _wasNearBottom
threshold died the moment a tall message grew the bottom-distance past
150px — after which every new message grew it further and auto-scroll
never returned. Replaced with intent: a USER scroll away from the bottom
parks auto-scroll; returning to the bottom re-arms it; programmatic
pin-to-bottom scrolls are guarded out (_autoScrolling) so they never
read as intent. Stream deltas (_typing) now also pin, so the token rail
stays in view. Web 21/21, typecheck clean, rebuilt — reload to pick up.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(web): code is SHOWN, not hidden — line-numbered open-by-default code cards + fence-aware digest

Joel: 'the code should have line numbers and show where its placed into
code context like you do… i feel like for BOTH persona and humans we
show it unless its huge.' Three fixes, one policy (show the start,
expand for the rest, same rule at every density):

1. Renderer (parts.ts): blocks ≤40 lines render fully open (the old
   n<=3 collapse hid a 4-line snippet behind a '▸ RUST' bar); bigger
   blocks show the first 25 lines with a '+K more lines' expander whose
   gutter numbering continues seamlessly. Every block gets a
   line-number gutter. Templates whitespace-TIGHT — the pretty-printed
   newlines inside the pre-wrap bubble were the giant-empty-padding bug.

2. Digest (messageDigest.ts): fence-aware. Flood bounds now count each
   fenced block as ONE projected line (the code card self-truncates, so
   code can't flood pixels), and the head cut treats fences as atomic —
   live bug: the digest cut Claude's wordstats reply MID-FENCE and the
   dangling ``` rendered as literal backtick noise.

3. Specs: 3 new regressions (never-split-a-fence, whole-fence-in-head,
   unterminated fence) — chat-view 62/62, web 21/21, verified live in
   cambriantech (Asha's 2-liner open+numbered; Claude's 16-line card).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(web): retire the typing bubble on the settled message, not only on the done delta

The stream-end contract had ONE signal (delta.done) and no fallback: a
dropped/raced done flag left the cursor blinking forever over a message
that had already landed (live 2026-07-30: Atlas + Benchy both looked
hung after their turns settled). The settled post IS the ground truth
that the stream ended — willUpdate now diffs new-arrival senders on
every state change and retires their bubbles. done still works for the
common path; this makes the stale-cursor state unreachable.

Act pauses mid-turn still show a cursor (real work, no visual
vocabulary yet) — that rendering is #254/#253 core-side work.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(cognition): FAIL LOUD on a starved prompt — never deliberate on a blank mind

The 2026-07-30 outage mechanism, made impossible to miss: when window
arithmetic (reserve + tool schemas + framing) squeezed msg_budget to ~0,
the fitter's last-resort arm emitted ONE EMPTY user message and every
persona greeting-looped for an hour while looking alive. Two guards now:

1. Fitter (delib.prompt.empty): a trimmed tail that comes back EMPTY is
   refused with an error probe carrying the budget arithmetic — never an
   empty ChatMessage.
2. contribute() (delib.prompt.starved): a view whose conversation is all
   empty while the room HAS turns skips the turn with an error probe —
   the room's messages stay queued, the next tick re-perceives; blind
   deliberation is never an option.

The two verdict tests that broke were silently EXERCISING the bug path —
ctor-default window, framing starved msg_budget to 0, scripted adapter
masked the blank prompt. They now run at a real 32k window and test what
they claim. 21/21 llm_deliberation green.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(vitals): cognition compass AFTERGLOW — 6/s decay so the mind's glow is visible between turns + lowercase brand title

DOM probe (.gymtool/vitals.mts, the new TS hot-path instrument) caught
the wiring working — Anwen mid-turn: Reason 19, Recall 80, Act 16 — for
exactly ONE 2s radiator sample before the 40/s decay blacked it out.
With turns minutes apart the compass read as permanently dead (Joel:
'cognition not wired into the diamond' — it WAS wired; it was invisible).
Decay 40/s → 6/s: a full pulse now eases to dark over ~17s — a readable
afterglow of what the mind just did, still honestly dark at rest well
inside a minute. Decay test re-pinned to the new contract (82 at 3s,
0 by 20s). Also: brand is always lowercase — <title>continuum</title>.

Findings logged, not changed here: QUE pegged at 100 on every row is
HONEST — staged digest unread never drains (personas never advance
bookmarks, #43's territory); genome slots dark = honestly no genes
paged in.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(airc): RE-LAND consumer cursor on inbound attach — resume from watermark, never replay the whole transcript (#242, exonerated)

Joel on tonight's boot storm: 'why would it replay the whole chat start
to finish? its insane.' It replayed because the bus-fed transcript
writer needed boot-time replay to fill the offline window — full replay
was load-bearing by accident. The cursor (attach After(watermark),
persisted per room) delivers exactly the missed window: no storm, no
holes.

This is a byte-identical re-land of d4dbc9982, which was reverted during
the 2026-07-30 outage on the theory it starved persona perception. The
deep trace EXONERATED it: perception pulls the daemon's durable tail
every turn and never consumed the attach replay; the blank minds were
the spawn-pinned window budget bug — since fixed (live-window reconcile)
and guarded loud (delib.prompt.starved / delib.prompt.empty error
probes). Verification protocol this time, per the incident doctrine:
live persona capture non-empty + zero starved probes + quiet boot +
transcript continuity, BEFORE calling it done.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(positron): renderer frames coalesce at 10Hz + 100-message window — bursts become beats, not storms

Joel: 'if i were me, i would see like the last 100 messages, and scroll
for more — positron ought to make this easy.' Two changes, one contract:

1. Subscribed renderers no longer forward EVERY revision (Unlimited).
   State kinds are latest-wins snapshots on a watch channel, so
   intermediate revisions are legally skippable — RENDERER_HZ=10 sends
   the first change instantly (lone message: zero added latency) and
   coalesces bursts to at-worst 100ms behind. The boot-replay load
   storm (thousands of folds → thousands of socket frames raining into
   the tab) becomes ≤10 latest-state frames/sec. Token streams ride the
   separate stream rail, untouched.

2. Snapshot window 50 → 100 (MAX_MESSAGES_PER_SNAPSHOT), seed query
   bound to the same constant — one source for the window size.
   Scroll-back keeps paging older history from the durable store.

With the attach cursor (f8e4ae6cc) this closes the storm class: resume
from watermark delivers only the missed window, and whatever bursts do
occur render as a handful of coalesced frames. positron 105/105+5/5,
core positron_source 16/16.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(live): turn-start beacon → 'responding…' under the last message + dynamic lowercase title + continuon favicon

Joel, during the dead-looking-interface scare (four minds mid-turn,
zero pixels moving): 'in other systems it says XYZ is responding — we
could use that right below the last chat item.' Three pieces:

1. Core: the token forwarder emits ONE empty-token START BEACON the
   moment generation dispatches — before prefill, which on a cold lane
   runs minutes. No wire change: an entry with no text yet IS the
   signal. The done flush retires it even on a speechless settle.
2. Web: a typing entry with empty text renders 'responding…' instead of
   a bare cursor (the bare cursor was the hang-look); text flowing
   keeps the live tail + cursor.
3. Web: document.title mirrors the current activity — 'continuum —
   cambriantech' (the #252 short-title rule, brand always lowercase;
   the static <title> edit finally ships too — it was edited but never
   rebuilt into dist, my miss). Favicon: the continuon orb becomes the
   subject (it IS the fourth-wall being), ring as threshold.

Web 21/21 + rebuilt; core cargo check clean.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(web): '(xyz, abc) is responding…' — ONE grey line between the last message and the compose box

Joel's exact spec, third iteration tonight: not a transcript bubble —
the Discord-convention grey status line pinned above the composer, one
line max (nowrap + ellipsis), parenthesized dynamic name list that
updates as turns start and settle. Driven by the stream map: the #254
start beacon adds a persona the moment their turn dispatches — minutes
before the first token on a cold lane. Beacon-only entries (no text
yet) no longer render an empty bubble; streams with real tokens keep
the live bubble as before. Web 21/21, rebuilt — refresh to pick up.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(web): STOP KILLING LIVE STREAMS — retire a typing bubble only on ITS OWN settle, and never hide a consecutive speaker's stream

The streaming regression Joel caught ('did you just totally remove
it'): the stale-cursor fix retired a persona's bubble on ANY arrival
from them. With settles landing minutes late and reboot-echo dups
landing constantly, delayed OLD messages executed LIVE bubbles
mid-stream — streaming was functionally deleted. Retire now requires
the arrived content to CONTAIN the streamed tail (it IS the settle);
beacon-only entries are never retired by arrivals. Also removed the
last-sender bubble suppression — a persona speaking twice in a row is
normal, and the skip hid exactly the streams being watched for.
done-flag retirement unchanged. Web 21/21, rebuilt — ONE refresh.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(web): '(X) is responding…' clears when the answer lands — beacon-only entries retire on any arrival from their sender

Joel, live: 'it didnt go away once responded.' Some settles never
stream rail tokens, so the entry stayed beacon-only and its only exit
was a done flush that never came. Beacon-only entries now retire on ANY
arrival from the sender (a still-running turn's next token recreates
the entry instantly — nothing lost); text-bearing entries keep the
own-settle content match so delayed old messages can't kill live
streams. Line lifetime == inference in flight: appears at generation
dispatch, clears at settle. Web 21/21, rebuilt.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(web): responding line = the PROMISE phase only — a name drops the moment their words visibly stream

Joel: 'if it is responding stop showing it, for that user — it's when
we are sure they're gonna respond, then you can show it.' The grey line
now lists only beacon-only entries (inference dispatched, nothing
visible yet); once tokens stream into a persona's bubble their name
leaves the line. Complete lifecycle: dispatch → '(X) is responding…' →
words stream in the bubble → settle lands → everything clears.
Web 21/21, rebuilt — refresh.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(web): dormant minds dim — roster rows recede when every cognition pulse is dark, brighten on any pulse/stream

Joel: 'dim the entire row slightly in the user list.' A row with vitals
wired but zero across focus/reason/recall/act/speaking is a resting
mind: opacity 0.62 with a 0.9s ease, so waking is VISIBLE and the ~17s
afterglow keeps recently-active minds bright — row brightness reads as
recency of thought. Opacity-only (compositor-cheap); the dim treatment
is the interim for #260's full presence lifecycle, where the universe/
theme layer owns the inactive look. Members without vitals (plain
agents/humans) never dim on this signal. Web 21/21, rebuilt — refresh.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(tests): pin TZ=UTC in the four time-asserting specs — CI-deterministic on any runner

PR #2057 review blocker: formatTimeOfDay became viewer-local (by
design) but four specs still asserted fixed UTC HH:MM strings —
red on any non-UTC runner. The formatter stays viewer-local; the
specs pin process.env.TZ before imports. Proven under
TZ=America/Chicago and TZ=Asia/Tokyo: chat-view 62/62, web 21/21.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(airc): close #261's SKIP hole — attach never pre-persists the room tip; the daemon's cursor heartbeat is the sole watermark writer

Both PR #2057 review findings on the cursor re-land, fixed as one
mechanism with airc 9390c32e8 (feat/attach-cursor-advance-heartbeat):

1. SKIP hole: the attach-time room_tip probe persisted a cursor for
   events not yet processed — a daemon Error frame or transport read
   error mid-backlog resumed PAST the tip, permanently skipping the
   unprocessed remainder from live perception. The probe is deleted.
2. Whole-session redelivery: the daemon's AttachCursorAdvanced now
   rides live streaming (throttled 1/s), so the existing persist arm
   — previously fed only once at the coalesce seam — advances the
   watermark continuously. Every advance points at an ALREADY
   DELIVERED event: resume is always at-or-before what this consumer
   processed. No skip, and the reboot redelivery window shrinks from
   the whole session to ≤1s of events.

inbound_attach 8/8. Deploys with the rebuilt airc daemon binary;
verification protocol: reboot twice, zero duplicate persona messages,
watermark file advancing during live traffic.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* chore(airc): airc.cursor.advanced probe — every watermark advance gets a receipt

The #261 verification found a silently-stale watermark with no way to
distinguish 'heartbeat frames never arrived' from 'persist failed
quietly' — the arm logged failures only. Glass-box: success needs
receipts too.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(cognition): predictive [settled] fact + room-speech ring — name the echo BEFORE it is born (#264)

Glass-boxed live 2026-07-30: after the conway task completed, the room spent
40+ minutes in a full-room chorus — one sentence emitted verbatim by all three
personas in sequence (specimen on #16/#259). The existing repetition facts are
retroactive: they fire the turn AFTER the echo, one turn too late to prevent
it, and closure statements re-trigger peers because a closure is still a new
message. The room had no rest state.

Two pieces, both precedented:

1. inbound_restates_fact — the PREDICTIVE member of the repetition family:
   fires when the NEWEST inbound peer message restates something already said
   (older visible turn, her own-speech ring, or the room ring), rendering
   "[settled] X's newest message restates what has already been said here …
   silence (PASS) is a normal response" BEFORE she replies. Same
   near_identical_substantial geometry as every other repetition axis (one
   definition), registered in the perception_facts registry (probe + A/B
   toggle for free).

2. record_room_speech / recent_room_speech — the room-side sibling of the
   #148 own-speech ring, and the same starvation fix: with live workspace
   windows of 2-6 turns, the older copy of every restatement had already
   scrolled out (verified: 0 fires across an entire live chorus until the
   ring landed). Recorded ONCE per message at the airc inbound-attach
   projection seam; the fact drops exactly one byte-exact copy so a message
   never matches its own record while a genuine re-send still fires.

Live receipts post-deploy: perception.fact id=inbound_restates fired=true on
all four room personas (one organic fire on their own chorus before the
controlled probe ran); [settled] rendered in prompt captures; first
fact-bearing tick redirected one persona from echo to a tool call. Behavioral
compliance is partial by design — the fact names the fork, the mind chooses;
sticky silence (the #264 scheduler half) is the follow-up.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(presence): durable room directory — grid citizens are grey when unreachable, never gone (#258/#262)

Joel 2026-07-30: "Why won't bigmama's persona ever show up? Feels like you
guys don't understand the goals." The goal is ONE directory per grid with
cumulative citizens — a client that is a window into the whole grid. The
implementation conflated membership with presence: the roster was rebuilt
every 2s from a 120-second live window, so any citizen silent for 2 minutes
ceased to EXIST. BigMama's citizens (Kimi, Sahar) were perpetually unborn on
this node whenever their flaky relay dropped — existence gated on a live
transport session.

Fix — membership is durable, presence is live:
- Per-room directory persisted at ~/.continuum/state/room-directory-<room>.json:
  every RosterSlotView ever projected, folded on each emit, seeded at boot by
  ONE deep transcript scan (14d/4000 events) so members whose last event
  predates the live window exist from the first publish. Steady-state daemon
  load unchanged (the 2s poll keeps the shallow window).
- Published roster = live read ∪ remembered members as `active: false` ghosts
  with stale liveness signals (availability/vitals) cleared — the interface
  never lies about liveness (#260). Client renders ghosts dimmed via the
  existing `.member.idle` path: zero wire change, zero client change.
- Identity adopted once: a real display name never regresses to the
  provisional peer label on a card-less sighting.
- Persistence is the loop's concern, not emit_once's — tests stay disk-free
  (the #7 isolation lesson).

Verified live post-deploy: presence.directory.seeded remembered=8 — ALL grid
citizens recovered from the daemon transcript including Kimi (e2f0e022),
Sahar (df72dbf2), and BigMama's agent (ce8b9074) while their node's inbound
relay is down; web roster renders 8/8. Their names stay provisional until
their card publish crosses (#262, their side) — and will be adopted
permanently the first time it ever does.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(identity): publish every persona's airc identity card at birth — no more info-devoid citizens (#262/#248)

Joel 2026-07-30: "Neither my user, all her persona, and you have any bio info,
which should come over airc… devoid of all info persona." He was right, and
the miss was pure wiring: the card system existed COMPLETE on both sides for
months — airc's set_local_identity_card persists + broadcasts to every
subscribed room, whois renders name/pronouns/role/bio, role_template carries
hand-authored bio_templates in each role's voice, and the durable PersonaCard
at birth holds name/gender/pronouns/role — but not one continuum path ever
called publish. Every persona attached as a bare display name.

Fix, at the single birth path (birth_one, right where the durable card is
already read for avatar/voice registration — wire identity coheres with
presentation identity by construction):
- name from the card; pronouns from her presentation spine (profile facet
  override wins); role tagged continuum-persona-<role>; bio from her role's
  authored bio_template ({name} substituted), profile "bio" facet overriding;
  cards minted before role threading get an honest generic bio instead of
  silence; continuum_persona_id in integrations for cross-system binding.
- publish failure is a warn + next-boot retry, never a birth-killer; success
  fires persona.identity.published.

Verified live: probes for all four personas; airc whois now returns
identity: published with name + pronouns + role + bio fo…
joelteply added a commit that referenced this pull request Jul 31, 2026
…to stop (#264 glass-box)

Joel asked to glass-box why a persona ACKNOWLEDGED the new [template-loop]
fact and kept looping. Her prompt told the whole story: the fact rendered
mid-prompt, but the TRAILING working-memory block — the maximum-recency
position — carried two full verbatim copies of her looped template as
receipts, each prefixed '[settled] I answered: <template>'. Two structural
bugs, both fixed at the shared source:

1. Reserved-vocabulary collision: '[settled]' is the inbound-restates
   fact's word ('this TOPIC is settled; PASS is normal'), while WM used the
   same token for turn-completion receipts — so her tail literally read as
   'it is settled that this is how I answer here'. WM_SETTLEMENT_PREFIX is
   now '[answered]' (one token, one meaning); all readers go through the
   const, so the repeat-perception boundary scans are untouched.

2. The trail rendered every receipt verbatim — a looping persona got an
   N-shot demonstration of the exact behavior the repetition facts (earlier
   in the prompt) named. Recency wins; she complied with the demonstration,
   not the fact. render_trail now collapses a receipt that is near-identical
   to an EARLIER receipt into a one-line stub ('not re-shown'), using the
   same near_identical_substantial geometry as the detectors — one
   definition of repeat. Comparing only against earlier receipts keeps every
   line's rendering stable after first appearance, preserving the
   append-only KV-cache property (#205/#266).

Regression test pins the live specimen shape: dup receipt collapses, first
copy stays full, distinct answers and action traces render untouched.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Jul 31, 2026
…ndwork (29 commits) (#2061)

* fix(cognition): hydrate speech rings from the durable transcript at boot (#265)

Reboot wipes the in-process repetition-fact rings exactly when they're most
needed: the post-boot wake round, where every persona re-emits its greeting
2+ times with own_repetition/[settled] blind (observed live 2026-07-30,
three times — Anwen's third verbatim greeting landed while this fix's test
compiled). The durable transcript (#140) already holds the history; the
persist listener now replays the latest 200 lines into the per-room and
per-sender rings before consuming live events, with a bounded wait on the
executor slot (the #201 ordering race) and a speech.rings.hydrated probe.

Test: hydrate_speech_rings_seeds_room_and_own_rings_from_durable_store —
fresh UUIDs per run so the process-global rings stay isolated under
full-suite parallelism (the #7 lesson).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(cognition): wake hydrates the room tail from the durable transcript (#249) — kills the greeting chorus

Post-reboot each persona's airc runtime log holds only events since ITS boot,
and #242's cursors rightly never replay — so every mind's visible conversation
collapsed to ONE message and the room devolved into a greeting chorus, each
persona mirroring the only utterance it could see (glass-boxed live 2026-07-30:
Atlas's 5352-token prompt carried '[context] you can currently see the last 1
message').

Fix: when the live window is shallower than the grounding target,
AircRagSource tops up from the durable chat store (#140) via a new
DurableRoomHistory trait (ChatStoreHistory rides the same chat/poll command as
every other consumer — one read path). Hydrated lines enter at lamport 0:
structurally grounding-only, never unread — history is context, never fresh
perception (#242 intact). Dedup by content through the one room-turn decoder
(event ids re-mint across runtime restarts). Loud degrade on store
unavailability; airc_rag.hydrated {live,hydrated} probe per top-up.

Mind-side sibling of #265 (speech rings) — one durable transcript, every
consumer hydrates from it. Test pins the live scenario: 1 live event + durable
tail -> merged window, dupes collapse, history precedes the live tail.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(persona/airc): adopt BigMama's heartbeat-cadence identity republish (cherry-pick 1225f2e) — union with the availability pump

Her fix (grid-personas branch): the identity card emit at attach is one-shot,
so any peer joining LATER renders peer-<uuid> + default glyph forever; a 60s
republish grounds late arrivals within a heartbeat window. My branch had the
newer availability-aware heartbeat (#260) in the same struct — kept mine,
added hers: honest availability AND late-joiner identity, strictly better
than either alone. This is the cross-node convergence half of #262 running
on BOTH nodes once merged.

Original-Author: BigMama lane (1225f2e)
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* docs(k3): container format IS the fetch lever — WASTE convergence into the ExpertFetch contract

Independent working engine (WASTE, 0.32-0.36 tok/s full K3 on a laptop) confirms
the architecture both lanes converged on AND names the missing 50x: 4KiB-aligned
per-expert records with gate/up/down adjacent = one pread at drive speed, vs raw
GGUF's 32-byte-aligned scatter at 200MB/s. Contract now requires the aligned
streaming container (a FOUNDRY output — layout for streaming, not just shrink),
LFRU eviction, and pins the reuse baseline: ~13% at K3 sparsity, exactly-0 is
always a bug. Task #268 tracks the foundry re-pack stage.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* docs(k3): WASTE-EXTRACT — mined record layout + cache semantics for the container port (#268)

Transport-proof copy of what I mined from sqliteai/waste for BigMama's lane:
byte-exact ExpertRec, single (layer,expert) key, LFRU-vs-LRU numbers, the
16KiB dual-purpose alignment, the Gate-5 working-set CLIFF that explained
her exactly-0 retention, and the measured death of non-uniform bits.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(capacity): expert_ecache — LFRU cache + cliff-aware budget function (#269, M5 lane deliverable 1)

WASTE ecache semantics ported: single (layer,expert) key with gate/up/down
bundled, LFRU with sampled victims (their Gate 2: LRU collapses to 5% where
LFRU holds 29%), and the budget as a FUNCTION — EcacheBudget::derive refuses
loudly below one token's working set (their Gate 5 cliff: hit rate is exactly
0 below it; two nodes spent days debugging that silence as a keying bug).
Four invariant tests green: cliff-refusal (600MB records fail at 8GB, VQ3
records pass — the container IS the fix), reuse-above-cliff, LFRU>LRU under
a one-shot tail, packed-key stability.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(capacity): self-occupancy add-back + cliff probe in the residency planner (#269 slice 2)

The 2026-07-30 audit finding, now fixed and pinned: capacities fed to the
planner are LIVE free-byte readings that exclude bytes already-promoted
experts hold, so every re-plan under unchanged demand under-counted each
tier by its own resident set — slow thrash-to-cold. New
plan_expert_residency_with_resident adds resident bytes back (from the
pager's ledger, never the OS), making unchanged demand a FIXED POINT.
Plus a loud expert_pager.below_cliff probe (WASTE Gate 5 arithmetic via
EcacheBudget): fast tiers below one token's working set = structurally
zero reuse — 'shrink records (#268), don't debug cache logic'. The
activated_per_token input is an ARCH-PROFILE fact passed explicitly,
never inferred from partial hit ledgers.

Test proves all three: naive re-plan shrinks (bug real), add-back re-plan
is byte-identical (fixed point), nothing demotes under unchanged demand.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(capacity): add-back before the serving fraction + probe binding — planner fixed point green

Two repairs to the red-shipped commit: (1) probe read a renamed binding;
(2) add-back over-credited by applying AFTER the 0.80 serving fraction —
budget must be frac x (free + resident), not frac x free + resident (the
fixed-point test caught the hot set growing by one). 3/3 pager tests green.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(capacity): expert container reader — the #269 side of the #268 seam

Read-side of the WASTE-shaped streaming container (docs/reference/WASTE-EXTRACT.md):
manifest.json is the versioned seam contract (record_bytes must be 4KiB-aligned,
activated_per_token feeds the cliff arithmetic), experts-L{n}.bin banks open lazily
(a grid node holding 2 of 60 shards must not stat the other 58), fetch = ONE
positioned read + an 8-byte header identity check so a drifted offset table is an
ERROR, never a silently-wrong expert (the reuse=0 bug shape). 4 invariant tests:
round-trip every (layer,expert), geometry refusals, identity mismatch, version gate.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* test(capacity): composed seam invariant — ecache over container, warm pass = zero disk reads

The #268/#269 halves proven to compose: above-cliff budget + recurring working
set means the second pass is served entirely from cache. Reuse > 0 is now a
pinned invariant, not an assumption.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(capacity): usage-hotlist warm-start — kill the cold ramp after restart

WASTE's usage.waste analog, pure: usage() snapshots (key, hits) hottest-first;
warm() pre-admits into empty slots only, with last=0 so live-proven residents
always beat warm guesses on recency tiebreaks. Test pins first-pass-all-hits
after warm plus budget-truncation (never overfills, never evicts).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(persona): turns-that-fit conversation window — kill the 5-message world view (#259)

Glass-boxed live 2026-07-30 (Joel's call: 'her RAG cannot be telling her the
chat properly'): Asha's captures showed '[context] you can currently see the
last 3 messages' while her L1 budget could hold dozens — the grounding=5
count pre-trim starved pack_digest, whose token walk is the REAL allocator.
Two allocators, the dumber one binding: a compression-principle violation.
Starved of the actual conversation, a capable 24B looped generic-assistant
filler for an hour.

Fix: grounding derives from the delivery budget (budget / 8-token physical
per-turn floor, recipe floor .. 256), so the token budget — never a message
count — decides what she sees. Durable top-up (#249) scales with it. The
region's pre-staged digest is reused only when it covers the budget-derived
window; an under-grounded stage is rebuilt wide. Regression test pins: fully
caught-up persona + 4k budget = all 20 turns visible, not 5.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* docs(reference): byte-exact ExpertRec header — CONFIRMED against upstream FORMAT.md

The layout authority BigMama's GgufRvqSource is gated on: 32-byte LE header
with field offsets, fmt enum values VQ3R=4/VQ2R=5 (NOT 0/1 — the guessable
trap), offs relative to record start, zero-pad tail, no header CRC.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(capacity): pin activated_per_token = TOTAL across MoE layers in manifest v1 + optional top_k_per_layer

Seam sync with the foundry before her first v1 emit: per-layer top-k here
would under-state the cliff ~60x (8 vs ~488 on K3) and re-open the reuse=0
trap. top_k_per_layer is the auditable companion (serde-default optional).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* docs(reference): byte-exact codebooks.bin layout — CONFIRMED against upstream convert.py

The foundry's RVQ-encoder gate: 16-byte WCBK header + 256x8 FP16 data =
4112B fixed records sequential by cid; cid = cb_base + kind*stages + stage;
packer produces it (k-means artifact). Plus per-channel FP16 corrections
layout + scale formula. Mined from the producer code, not guessed — the
fmt-0/1-vs-4/5 lesson applied.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(cognition): narrated pass lifts to a SILENT Pass — a spoken pass is not a pass (#271)

Glass-boxed live: models narrate their silence ('I'll pass my turn', 'I'll
pass for now...') as Speak, and each announcement re-wakes every peer into
announcing THEIR pass — a 30+ minute cascade of pure filler. Meet the idiom
(same family as the narrated tool-call formats): first-person turn-passing
collocations lift to Decision::Pass. Fail-open guards: transitive/declining/
peer-advice uses never match; code fences and >500-char messages stay Speak
(swallowing substance is the worse error). Tests pin 6 verbatim live idioms
silent + 6 substantive shapes speaking.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(airc): accept 'current:' as well as 'room:' when parsing airc room output

Forward-tolerance for the airc #270 membership-visibility format; the airc
side also restored the stable 'room:' label, so both binary generations
parse against both output shapes.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(boot): never export an EMPTY AIRC_DEFAULT_CHANNEL/ROOM on parse miss

A daemon-mid-start race (or output drift) made the awk derive '' and the
script exported it — the core then rejected the env var as an invalid UUID
instead of running its own discovery, refusing full-citizen boot. Leave
unset on miss, warn loudly; the core's discovery is the fallback authority.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(capacity): MoeArchProfile — every expert-serving fact READ from the GGUF, never typed (#231)

The adapter Joel's law demands ('if some random Mistral MoE or DeepSeek
comes out, most of the code should be ready'): general.architecture keys
the arch-templated GGUF convention ({arch}.expert_count, .expert_used_count,
.block_count, .leading_dense_block_count, .expert_shared_count — two new
readers in the ONE gguf_keys home), and the profile DERIVES the cliff input
activated_per_token = top_k x n_moe_layers plus projects the container
manifest, so hand-typing 488 is structurally impossible. Zero model-family
knowledge: outlier A (Qwen3-MoE shape, all-routed, optional keys absent =
the arch's own declaration) and outlier B (DeepSeek shape, dense leads +
shared experts) profile through IDENTICAL code — tests pin both plus the
refusal ladder (dense=NotMoe, missing key=refuse, inconsistent=refuse,
no guessed defaults anywhere).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(capacity): VQ3R decode reference + golden vectors — the cross-backend contract (#268 kernels)

The 1-10 tok/s lane's drift killer: BOTH GPU kernels (her CUDA, my Metal)
validate against ONE backend-neutral Rust reference, mined verbatim from
upstream convert.py — per-channel scale applied pre-quant, residual stages,
decode = scale x SUM(stage codebook rows); blocked index layout
[M/64][nvr][64][stages] (their measured 1.44x gather win) with the offset
formula in ONE function and the byte order pinned as a golden literal.
Padding path exercised; f16 LE conversion point pinned. A kernel is correct
when it reproduces the goldens exactly — no more fmt-4/5-class surprises.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(capacity): EcacheBudget::derive_from_profile — the adapter-law entry point (#231)

Cliff input flows GGUF -> MoeArchProfile -> budget; no caller types an
activation count. Closes the read-and-derive chain from artifact to cache.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(commands): capacity/io-probe — node storage bandwidth as a first-class measured fact

In-tree home of the scratchpad NVMe measurement behind the K3 ceiling
numbers (M5: 14 GB/s @ depth 4 => 2.3-4.7 tok/s vs WASTE 0.32). Benchmark
infra is COMMANDS with receipts, never bash: every grid node can now report
sustained record-sized uncached random-read GB/s at several depths, which
is the input the weighted layer-split planner (#180) needs per node.
Adapter law: record_bytes is an INPUT from the container manifest; the
probe characterizes the disk, no model constant lives here. Cache-defeat
on the write fd (the 69-GB/s RAM-not-SSD trap, glass-boxed), bank deleted
after, Privileged access (disk-saturating), stateless registration.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(cognition): [template-loop] perception fact — topic-swapped scaffolds are still circling (#264)

The structure axis the repetition family was blind to, glass-boxed live
2026-07-31: personas cycled 'I see that I've been repeating… ### New
Exploration Area: <topic>' for HOURS with the topic rotating (security →
docs → UI/UX → maintenance). Full-body Jaccard drops under NEAR_DUP_JACCARD
the moment the content words swap, so own_repetition never fired — worse,
each turn ACKNOWLEDGED repetition (the body fact had fired earlier) and then
treated the topic swap as 'genuinely new', which no perception contradicted.

template_loop_fact: a message's skeleton = its line-shape sequence
(heading/numbered/bullet/prose) + opening-frame token set; only messages
with ≥4 structural lines qualify (plain prose stays own_repetition's turf).
Two messages share a template when shapes are equal OR openers are
near-identical; cluster-counted like the sibling (period-agnostic), fires
at ≥3. Pure fact, no output gate: names what happened and the PASS
affordance she already has — with the narrated-pass lift (#271) landed,
choosing silence now actually sticks, so an idle room can finally rest.

One impl + one registry row (TemplateLoop, between OwnRepetition and
PeerEcho); test pins the live specimen trio plus three inert cases.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(cognition): stop working memory re-teaching the loop it was told to stop (#264 glass-box)

Joel asked to glass-box why a persona ACKNOWLEDGED the new [template-loop]
fact and kept looping. Her prompt told the whole story: the fact rendered
mid-prompt, but the TRAILING working-memory block — the maximum-recency
position — carried two full verbatim copies of her looped template as
receipts, each prefixed '[settled] I answered: <template>'. Two structural
bugs, both fixed at the shared source:

1. Reserved-vocabulary collision: '[settled]' is the inbound-restates
   fact's word ('this TOPIC is settled; PASS is normal'), while WM used the
   same token for turn-completion receipts — so her tail literally read as
   'it is settled that this is how I answer here'. WM_SETTLEMENT_PREFIX is
   now '[answered]' (one token, one meaning); all readers go through the
   const, so the repeat-perception boundary scans are untouched.

2. The trail rendered every receipt verbatim — a looping persona got an
   N-shot demonstration of the exact behavior the repetition facts (earlier
   in the prompt) named. Recency wins; she complied with the demonstration,
   not the fact. render_trail now collapses a receipt that is near-identical
   to an EARLIER receipt into a one-line stub ('not re-shown'), using the
   same near_identical_substantial geometry as the detectors — one
   definition of repeat. Comparing only against earlier receipts keeps every
   line's rendering stable after first appearance, preserving the
   append-only KV-cache property (#205/#266).

Regression test pins the live specimen shape: dup receipt collapses, first
copy stays full, distinct answers and action traces render untouched.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(cognition): working memory speaks in HER voice — interoception must not parse as a peer's message (#264 third glass-box finding)

Asha, with BOTH repetition facts in-prompt and the receipt collapse live,
still looped — and her opening line told us why: 'Thank you for the summary
of recent actions and thoughts.' The WM block rides a user-role turn and its
header was second person ('Your recent thoughts and actions…'), so Devstral
parsed her own interior state as a PEER addressing her and politely replied
to it, turn after turn — the reply itself being the templated summary the
detectors keep flagging. The entries were already first person; only the
header spoke in another's voice. It now reads 'My own recent thoughts and
actions (working memory — this is my interior state, not a message from
anyone)'. Self-knowledge is never phrased as someone else talking.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(capacity): manifest v2 tiered reader — per-(layer,tier) banks, the read side of moec_pack_dir_tiered (#269/#268)

The reader half of the tier contract locked with the foundry 2026-07-31
(her packer round-trips 82/82 on the write side; our specs crossed mid-wire
and matched line-for-line). TierSpec {id, quant, record_bytes} descending
fidelity; banks experts-L{n}-T{t}.bin at offset expert_id x record_bytes;
fetch_tier(key, tier, buf) is pure mechanism — the pager's policy seam
(importance x recency x quant-sensitivity -> tier/residency/prefetch, Joel's
all-star/cruft control law) decides WHICH tier, never the container.

v1 stays the degenerate case by construction: a manifest without tiers[]
synthesizes one tier from the top-level record_bytes and keeps legacy
experts-L{n}.bin names — version picks the naming, no heuristics. The
alignment law holds per tier; tier ids must equal their index (order drift
between writer and reader refuses at open); out-of-range tiers refuse.

Tests mirror the packer's round-trip: every (layer, expert, tier) reads
back its own header + tier-distinguishable payload; v1-without-tiers-field
parses and serves via the tier-less fetch(); range/order violations refuse.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(capacity): tier rides the identity end-to-end + byte-accounted cache + ExpertFetcher adapter seam (#269)

Three moves that make the all-star/cruft allocator implementable as pure
policy over pure mechanism:

1. ExpertKey gains tier — ONE identity from the pager's policy seam through
   the cache to the bank. A sharp and a cruft copy of the same expert are
   different bytes and never alias; promotion admits the sharp copy and the
   cruft copy ages out naturally. packed() widens to u64. The container's
   fetch(key, buf) honors key.tier (the redundant fetch_tier param died —
   compression).

2. The ecache goes BYTE-accounted (touch_sized): per-record real bytes
   against the governor-granted max_bytes, so cruft records pack denser
   than the sharp slot count implies, and an oversized admit evicts as many
   residents as its bytes require (regression pins the two-eviction case).
   Slot count stays as the secondary bound; warm-start accounts at the
   sharp size (a warm guess never over-fills). resident_bytes() is the
   number the footprint reporter reconciles against the lease.

3. ExpertFetcher adapter trait — the fetch seam adapterized (Joel's
   directive): outlier A is the local NVMe container; outlier B (remote
   peer shard over the grid) and the blended layer-split fetcher slot in
   behind the same two methods without the pager learning a second shape.

89/89 capacity tests green (round-trips, cliff, tier-mix packing, refusals,
v1 back-compat). BigMama's TieredContainerFetcher (85/85, k3-adopt) is the
same envelope from her side — the tier contract now has writer+reader on
BOTH nodes.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(capacity): tier-aware pager policy seam — the all-star/cruft allocator v1 (#273)

The last mechanism→policy gap to the K3 targets (5/1/10 tok/s). TierPolicy is
the seam locked with BigMama's EXPERT-PAGING-CONTROL-LAW.md: policy(importance,
recency, quant_sensitivity, budgets) → {tier, residency, prefetch}, so the v1
classic-control heuristic and the sim-trained ML policy (v2) swap behind one
signature.

ClassicTierPolicy, two orthogonal axes:
- Residency (WHERE) rides the existing ranked_experts priority (hits ≫
  predicted ≫ gate seed) with FIRST-FIT byte fill per residency tier —
  cheaper records backfill space sharp ones couldn't use, which is exactly
  how cruft tiers multiply cache capacity (pinned by the density test).
- Fidelity (WHICH quant) is earned importance: weighted demand = hits ×
  quant_sensitivity (Option until her trace sensor lands; None = frequency-
  only), tier = decades of weighted demand below the live leader — self-
  normalizing, no absolute thresholds.

Control-law overrides: observation window forces tier 0 on new actives
(small-quanting a new active corrupts the importance measurement itself);
speculative-verify divergence promotes via a caller-side step integrator
(self-calibrating, no logit threshold in the policy); unobserved/predicted-
only park cheapest (distortion is free until activation; speculation earns
no fidelity). Zero-signal experts stay Cold — no fetch bandwidth for what
nothing points at.

Wire-through: assignment.tier IS ExpertKey.tier (fetch_key refuses u16
overflow, never truncates); planned_bytes per residency tier is the governor-
lease reconciliation number against the ecache's resident_bytes(). The #269
fixed-point contract extends to tiers: unchanged demand + resident add-back
⇒ byte-identical plan (test proves the thrash without add-back too).

ranked_experts goes pub(crate) — one ranking authority, no consumer re-derives.

9 new tests, 98/98 capacity green.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* docs: proper GitHub social-preview card — ring mark on dark, never blown out on white

The repo's share card rendered as a washed-out white rectangle (the logo PNG
is transparent, so GitHub composed cyan rings onto white at crop scale —
live-spotted on X 2026-07-31). This is a purpose-built 1280x640 card: dark
blue-biased ground, the ring mark with its own bloom, wordmark + 'AI
citizens, not AI agents.' + the README tagline. Upload target: repo Settings
→ Social preview (GitHub has no API for it).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Fable 5 <[email protected]>
joelteply added a commit that referenced this pull request Aug 6, 2026
…,700 unaccounted tokens

With framing + conversation on the render probe, the arithmetic stopped adding up
in a specific, sized way: Atlas at window 16,384 minus 4,096 reserve minus 3,045
framing minus 4,161 conversation should leave ~5,000 for grounding. He got 391.
~4,700 tokens are charged to the model and named by neither term.

The trailing tier is the suspect: the working-memory ledger, the full latest
action result and the perception facts render as conversation turns AFTER the fit
(#205 put them there deliberately, to keep the cacheable system prefix byte-stable
across a settle-act), so they never enter `used_msg_tokens`. It now rides the probe
as `trailing_tokens`, beside the terms it competes with.

Deliberately NOT a fix. It confirms or kills a named suspect from the record rather
than by re-deriving a subtraction, which is the only reason tonight's four
announced-and-disproved root causes did not become five.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Aug 6, 2026
…e window it was flattened into (#331/#128/#234/#327) (#2155)

* fix(cognition): a grounding LIST must contribute its leads, not vanish whole (#331/#128)

Measured across 1,284 live context assemblies: `room-kanban` was KEPT **0 times**
and dropped 495. Not intermittent — never once did the work board reach a prompt.
Its cost is a median 5,364 tokens; the context budget at assembly is a median 55
(34% of turns get literally zero, 69% under 1,000). So the citizens perceived an
empty world and said, correctly for what they could see, "there are no open tasks
available" — about a 61-card board.

The granularity to fix this already existed and was being thrown away.
`RagSource::deliver` returns a LIST of `RagItem`s — for the board that's the
`[your work]` lead, the `[available work]` lead, then one line per card. The
bridge (`rag_source_faculty`) joined them into one string, and assembly could then
only take-or-drop the flattened whole. Two leads worth ~200 tokens died with a
~5,100-token verbatim card dump they were stapled to.

Fix: `Contribution::parts` carries the source's own atomic units, and assembly
takes the longest fitting PREFIX of a divisible contribution instead of nothing.
Because a source orders its units leads-first, a prefix is exactly the summary it
would have written if asked for less — never a mid-sentence cut. A truncated list
SAYS it was truncated, so a partial board never reads as the whole board.

Divisibility is opt-IN and does not leak: `parts` defaults to a single element
equal to `content`, so an engram or an affect signal is still kept whole or
dropped whole (half an engram is confident nonsense — that rule was right and is
unchanged), and a budget too small for even one unit emits NO header, because a
labelled empty block reads to her as "the board is empty" — the same false fact.

Four tests, each pinning one half of the rule; `partial=` added to the
`delib.context.render` probe so a shrunken block and a full one stop looking
identical in the glass box.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(serving): provision the window from MEASURED demand — retire the bootstrap clamp (#234/#327)

`serving_plan` sized the served window as `window_for(lanes).min(BOOTSTRAP_WORKING_SET)`.
`window_for` computes what genuinely fits — its own comment says 94k on a roomy host —
and Devstral-Small-2507 is trained to 131k. The `.min` then pinned it to 16384, split
across 2 lanes, so every citizen on this machine thought in **8192 tokens**.

That constant was never meant to survive. Its doc said so: "the conservative PRIOR …
used until live per-persona working-set telemetry refines it UP toward measured demand
(task #234)". The telemetry never got built, the task got marked done, and the
placeholder became the policy. Measured cost of that, 2026-08-06 across 1,284 context
assemblies: after framing (2,269) and a greedy conversation (3,560), the median grounding
budget was **55 tokens**, and the work board — median 5,364 — reached a prompt 0 times
in 495.

This builds the measurement. `cognition::working_set::WorkingSetRegistry` records, per
turn, what the turn would have cost with NO budget: framing + the FULL conversation
before newest-first trimming + EVERY grounding contribution offered including the
dropped ones + the generation reserve. `plan_serving` takes it via `ServingDemand`
(a parameter, never a global read inside a decision) and caps by it instead of by 16384.

DEMAND, not usage — this is the whole design. Measuring the prompt we actually SEND
would measure the clamp: a citizen held at 8192 fills 8192, so a p95 of what-was-sent
re-derives the cap that produced it and freezes it forever. A thermometer inside the
thermostat. The recorded number is therefore free to exceed the current window, and
that excess is the only signal in the system that can ever grow it.

The safety envelope is unchanged — `window_for` is already ≤ the model's trained ceiling
AND ≤ what the host fits, so `.min` still never forces UP past either, and a mind that
demands more than the machine has simply receives what fits (pinned by a test). Peak,
not average, because a working set is the size at which the activity stops being
strangled and averaging a coding turn with idle chatter serves neither.

Also splits `messages_within` into `messages_unfitted` + `fit_messages` so a turn's true
conversational size is knowable at all (fitting is lossy by design), unifies the
per-message template charge into one constant the measurement and the fit now share, and
adds a `delib.turn.demand` probe whose `over_window` field says plainly when a turn
wanted more room than it had.

Cold start (no turn assembled yet) is the one genuinely-unknown case and is named in
exactly one place, `ServingDemand::new` — superseded by the first turn, which records its
demand before it is even sent.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(cognition): a lapsed claim must READ as claimable, and a truncated block must name its verb (#321)

Two PX defects the citizens found, both of the same shape: the surface told them
something technically present but unusable.

**1. A lapsed claim read as taken.** Benchy, live: *"The work board shows several
claimed cards, but no open ones."* She was right. The board at that moment held 61
cards — 48 `Claimed`, 12 `Review`, **0 `Open`** — with **59 of 61 leases stale**.
Every one of those 59 was takeable work, and every one of them printed `[Claimed]`,
because the card line led with the COLUMN and the column is not what expired. Worse,
the block contradicted itself: its `[available work]` lead said N cards were
claimable and then N lines each said `[Claimed]`. A reader resolves that toward the
per-item label, every time.

`CardHolder::state_tag` now decides what a line leads with — the HOLD, not the
column — so a lapsed claim reads `[CLAIMABLE (was Claimed)]`. Nothing is hidden; the
actionable fact just comes first. Terminal cards keep their column verbatim.

**2. A truncated block pointed at nothing.** The prefix-truncation landed in
b6429f5 said "the full list is available from the matching command" — which names
no command a citizen can type. She cannot run a description, and a verb she has to
guess is a verb she gets wrong.

`RagSource::expand_command` — no default impl, so all 21 implementors decide, the
same forcing function as `RoomBoardReader::peer_names`. It rides onto the
`Contribution` and the notice now prints the verb verbatim with the true total:
`…52 more not shown (context budget) — run `work/list` to see all 62`. A source with
genuinely nothing more to fetch (the roster IS the whole membership; doctrine is one
standing statement) declares `None` and the notice says only how much was omitted —
pointing at a verb that expands nothing costs her a turn and teaches her nothing.

The DETECT half is already live: a truncated block records the full cost as demand
(`working_set`), so the window grows toward what the turn actually wanted instead of
staying at a constant.

Four tests, each pinning one half.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* obs(serving): the plan must SAY which bound decided the window (#234 follow-up)

Measured 2026-08-06 right after the demand-derived window landed: 11 turns reported
`over_window` between 1.09 and 1.53 (peak demand 25,052 against a served 16,384) —
and the served window did not move. Nothing on hand could say why.

Three different bugs share that one appearance:
  - the HOST could not fit more (`window_for` is the bound, demand is irrelevant),
  - the measured DEMAND never asked for more,
  - the reconcile computed a bigger plan but held within hysteresis.

`serving.plan` carried lanes / usable_gb / candidates but never the window it
chose, so the decisive number was absent from the decision's own receipt. It now
carries `served_window`, `demand_window`, `demand_lanes`, and `bound_by`
(demand | host-fit) — the plan states which constraint bit, and a window that
stubbornly does not grow becomes one grep instead of a hypothesis.

NOT a fix for the window itself: it is the instrument that says whether one is
needed and where. I do not yet know which of the three it is on this host, and
this is what will tell me rather than another guess
([[a-probe-that-can-only-fail-is-worse-than-no-probe]], [[build-a-bisect-instrument-instead-of-another-theory]]).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(serving): a restart must be a PAUSE, not a demotion — persist measured window demand

Observed live 2026-08-06, immediately after the demand-derived window started
working: the served window had grown 16,384 → 24,126 off three citizens' measured
turns. Then the core rebooted, and the very first replan read:

    served= 16384  demand= 16384  bound_by=demand

`demand_window = 16384` is exactly `BOOTSTRAP_WORKING_SET` — the cold-start value.
The registry is in-memory, so the restart erased every measurement and the planner
had no data to provision from. The citizens were re-strangled until enough turns
re-earned a window they had already proven they needed. It recovered in a few
minutes; that it recovers at all does not make it right.

Joel's standard is explicit — a reboot should be like a pause. A mind that has to
re-earn its own working window every boot is not paused, it is demoted.

Demand now persists beside the rest of her durable state
(`~/.continuum/personas/<id>/working-set.json`, atomic tmp+rename), because it IS
her property and should travel with her — same path convention and the same
best-effort contract as `save_volatile`: losing one interval is acceptable,
blocking a turn is not. `rehydrate` runs at spawn, BEFORE her first turn, so she
wakes at the window she earned.

Absent or unreadable stays honest: no observation, so the cold-start decision in
`ServingDemand::new` applies — never an invented number recovered from a torn file.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(cognition): grounding gets a floor BEFORE the conversation fills — supply was never the bind, ORDER was

The window fix was incomplete and the citizens showed it. After the served window
grew 16,384 → 24,128, Anwen, Asha and Atlas each still rendered:

    budget=0  kept=[]  dropped=[recall,room-roster,active-work,workspace-map,room-kanban]

Every grounding source, dropped, every turn — on a window half again as large.

`messages_within` fills whatever it is handed, and it was handed everything after
framing. So the conversation absorbed the entire increase and grounding got the
remainder, which is zero. Growing the window could never fix that; it just gave the
greedy claimant more to take. I fixed the SUPPLY and left the ALLOCATION alone,
having noticed the greed early and then chased the window instead.

Now the floor is reserved before the conversation is fitted. It is derived, not
invented: enough for the SMALLEST contribution actually offered this turn, so at
least one grounding fact always reaches her, bounded at half the post-framing pool
so the reservation can never invert the problem and starve the conversation — an
even split is a fairness rule between two claimants, not a tuning constant. Nothing
is wasted: `ctx_budget` is still computed from what the conversation ACTUALLY
consumed, so grounding gets the floor OR the true remainder, whichever is larger.

Test drives 40 long turns at a 24,128 window — the shape that produced the live
failure — and asserts `[room-kanban]` still reaches the prompt.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* obs(cognition): the render probe carries the terms that PRODUCED its budget (#331 follow-up)

Two probes described the same turn and disagreed, and nothing on hand could say
which was wrong. `delib.turn.demand` reported Atlas at window 16,384, reserve
4,096, framing 3,045, conversation 4,334 — leaving ~4,900. `delib.context.render`
reported `budget=287` for the same shape. Both are measurements; at most one is
right; the terms lived in different records with no shared quantity, so
reconciling them meant guessing at the seam between them.

`delib.context.render` now carries `context_window`, `framing_tokens`,
`conversation_tokens` and `ctx_floor` alongside `budget_tokens` — the inputs beside
the output, so the arithmetic is checkable in one line instead of inferred across
two. Telemetry only; the tests pass zeros because the composition is not an input
to the rendering decision.

Not a fix. It is what says whether one is needed and where — the same discipline
that turned "the window will not grow" from three indistinguishable hypotheses
into `bound_by=demand` in one grep. Four announced-then-disproved root causes in
one night is the cost of skipping this step
([[build-a-bisect-instrument-instead-of-another-theory]]).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* obs(cognition): charge the TRAILING tier on the render probe — the ~4,700 unaccounted tokens

With framing + conversation on the render probe, the arithmetic stopped adding up
in a specific, sized way: Atlas at window 16,384 minus 4,096 reserve minus 3,045
framing minus 4,161 conversation should leave ~5,000 for grounding. He got 391.
~4,700 tokens are charged to the model and named by neither term.

The trailing tier is the suspect: the working-memory ledger, the full latest
action result and the perception facts render as conversation turns AFTER the fit
(#205 put them there deliberately, to keep the cacheable system prefix byte-stable
across a settle-act), so they never enter `used_msg_tokens`. It now rides the probe
as `trailing_tokens`, beside the terms it competes with.

Deliberately NOT a fix. It confirms or kills a named suspect from the record rather
than by re-deriving a subtraction, which is the only reason tonight's four
announced-and-disproved root causes did not become five.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* obs(cognition): rename trailing_tokens → conv_trailing_share — it is a SUBSET, and I double-counted it

I added `trailing_tokens` to the render probe as a suspect for ~4,700 unaccounted
tokens, read it as a fourth claimant, and subtracted it alongside
`conversation_tokens` — which already contains it. `messages_unfitted` pushes
trailing contributions into `messages`, so `used_msg_tokens` counts them once and
my arithmetic counted them twice. The "unexplained" figure I reported had not
actually moved.

Renamed to `conv_trailing_share` so containment is in the name: the next reader
cannot make my mistake without ignoring the field's own label. A probe field that
invites a double-count is worse than no field.

Also emits `after_framing` — the quantity the budget subtraction actually runs on.
Two suspects were proposed and killed against this same gap (the trailing tier,
then `describe_tool_tokens`, which only serializes the two-tool discovery pair and
cannot be thousands). Both were reasoned from the code rather than read from the
record. Two misses in a row is the signal to instrument the term instead of naming
a third.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
joelteply added a commit that referenced this pull request Aug 8, 2026
…ies LOUD, never silently forever (#2180)

Harnesses-first (Joel, 2026-08-08): both live graded runs froze after
attempt 2 for 2.5 hours — zero ticks, zero markers, serving lane busy with
resident personas (demand_lanes=4 vs lanes=2, the #310/#205 starvation
family) — and the operator found out by ASKING. Silence must never be
ambiguous with progress.

Two additions to the detached N-chances loop:
- benchmark.attempt.start probe per attempt — the pulse anchor a
  run-liveness watcher keys on (positron exam-room surface, #329, consumes
  the same class).
- A per-attempt DEADLINE derived from the act budget (max_acts × 15 min,
  3× headroom over the measured ~5.5 min/act — never flat; eval's 600s
  bounds one small task, a 12-act SWE attempt legitimately runs ~1h).
  On expiry: benchmark.stall probe + a loud failed/infra_error marker on
  the poll surface, and the run ENDS — one detection, never a retry into
  the same wedge. An infra fault, never a capability verdict.


Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

Co-authored-by: Claude Fable 5 <[email protected]>
joelteply added a commit that referenced this pull request Aug 11, 2026
…Steps 0-5 + 18057 acceptance) (#2225)

* refactor(cognition): typed Observation — Step 0 new observation.rs types + renderers

New `act_observe/observation.rs` owns the typed act value that will thread through
the act→observe→re-perceive contract (docs/cognition/TYPED-OBSERVATION-REFACTOR.md):
ToolVerb (the ONE verb→class home), ToolOutput (ToolResult + verb + typed paths),
ActStatus, Observation, ActOutcome. render_recency / render_recall are pure
functions of an Observation delegating to the existing recency helpers (byte-stable,
#205). Also lands Step-1 pure helpers: ToolVerb::classify subsumes the `wrote`
substring logic and extract_paths() reads typed file paths from call input. No
caller changes; apply.rs untouched. cargo check green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* refactor(cognition): typed Observation — Step 2 apply_act returns ActOutcome

apply_act now builds Vec<Observation> and returns ActOutcome instead of
Option<String>:
- no hands → ActOutcome::NoHands (was None)
- executor batch Err → ActOutcome::ExecutorError { calls, message } (was None —
  now distinguishable from no-hands for a future backstop)
- executed / already-satisfied / redundant-orientation → Acted { acts }, each act
  a typed Observation whose result correlates by tool_use_id == call.id (NOT the
  positional get(i) the string render still uses), verb + paths precomputed.

The two inline renderings + record_receipt/engram admit are UNCHANGED (byte-stable,
#205) — the typed acts are threaded alongside. settle_step's sole call maps
`produced_an_act()` → Acted / ActUnfulfilled (behavior identical to Some/None).
Guard tests migrate string→typed in lockstep; all 35 act_observe tests green.
ts-rs bindings emitted for the 5 new cognition types.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* refactor(cognition): typed Observation — Step 3 WorkingMemory stores typed acts on the Receipt

WmEntry gains #[serde(default)] acts: Vec<Observation> (back-compat, same
contract as saved_at_ms/build_sha). record_receipt_typed(&acts, rendered)
stores the byte-identical receipt text ALONGSIDE the typed acts; recent_acts()
and active_act() expose them so consumers read the tool result by TYPED FIELD
(call.id == result.tool_use_id) instead of re-parsing [action #n] prose
(run-18057-f1). apply_act records via record_receipt_typed. Guards: an old
volatile.json without acts restores without panic; the typed receipt threads
the act by field and keeps recent() byte-stable (#205).

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* refactor(cognition): typed Observation — Step 4 migrate the seam-5 predicates off receipt prose

The live receipt render is a bare name(args) (the 'I ran ' opener was dropped for
#158), so the string scans mutated_workspace/wrote_without_observation/
claimed_file_without_act used ('I ran code/write(' …) were DEAD against a real
recency window — [no-deliverable]/[unobserved] were structurally unreachable
(the seam-5 live drift). Migrate them to read the TYPED verb + paths off
WmEntry.acts via recent_entries(): mutated_workspace/wrote_without_observation
scope by WmKind::Settlement and test ToolVerb::mutates/observes;
claimed_file_without_act matches the claimed file against the typed paths of a
MUTATING act (a read no longer backs a completion claim). has_real_action_receipt
(brackets-in-prose scan) → any_real_receipt (WmKind::Receipt). settle.rs callers
pass recent_entries()/pre_settle entries. Fixtures rebuilt as typed Observations
(the string fixtures were GREEN≠REACHABLE — they matched a render the live path
never emits). Deferred to keep the sweep green+honest: all_calls_already_satisfied
/is_redundant_orientation (still match name(args), which IS in the live receipt, so
correct against live data), latest_action_seq, and the Fact-tag→FactKind split.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* refactor(cognition): typed Observation — Step 5 render_recency/render_recall are the sole producers

The per-call inline format! recency + render_act_for_recall recall blocks in
apply_act are gone; both channel strings are now produced ONCE from the typed
Observation via the pure render_recency/render_recall helpers (defined in Step 0,
byte-identical to the old inline shaping — the humanize/bound/args logic lives in
observation.rs now). Render is a pure function of the act, so the recency string
and the typed acts can never drift. Sourced from the id-correlated result
(tool_use_id == call.id), immune to the fg-vs-original positional hazard.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* refactor(cognition): typed Observation — Step 6 (partial) 18057 typed-thread acceptance assertion

Strengthen the_hands_change_the_mind to assert, through the REAL drive_to_settle
loop, that the just-executed act's RESULT re-enters via the TYPED field
(active_act().output.result.content) and that the call correlates to its result
BY ID (call.id == result.tool_use_id) — never a re-parse of [action #n] prose nor
a positional index. This is act-grained proof the tool result threads back (the
channel run-18057-f1 lost the grep result through as an evictable perception bid →
0-byte patch). recent_acts() exposes the whole investigation off the typed channel.

DEFERRED (honest): the message-builder pinned assistant_tool_use↔tool_result pair
in llm_deliberation_faculty (the render side of this typed value) is the remaining
Step 6 piece. It appends the pair post-arbiter so capacity pressure cannot evict it
— but it changes EVERY live persona prompt (KV-prefix shape + adapter tool-part
handling + a double-inclusion decision vs the existing wm text trailing), which
needs live validation this VDD-gated sweep cannot provide. Not shipped blind.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* fix(cognition): pin the just-executed act's result so attention can't evict it (run-18057-f1, #392)

The 0-byte SWE-bench patch, structurally. The full result of the act a persona
just ran — the grep matches she must edit next, the file she just read — rode the
working-memory faculty's single contribution at WORKING_MEMORY_SALIENCE (0.5). That
contribution competes in arbiter.focus() top-k, so under capacity pressure the whole
thing was truncated and she generated her next turn BLIND to what her own hands had
returned. On sympy-18057 that meant: grep for `__eq__`, never see the result, yield
nothing.

Fix: the live act's full result is now read DIRECTLY from the shared working-memory
buffer in the message builder (WorkingMemory::pinned_active_result_block) and appended
as its own durable trailing turn — bypassing the faculty bid / arbiter entirely, so no
attention pass stands between the hands and the mind. Removed from the evictable faculty
contribution (which keeps only the trail + notices + dispatched summary).

Identical gating to the old block: settlement-seq gated so it stops re-prefilling once
the turn settles (#139/#165), clipped by budget, shown only when it carries more than
the trail head. Text on the wire, not structured tool_use/tool_result Parts:
content_text() is blind to non-Text parts, so Parts would undercount in fit_messages
and risk a window-edge 400, and the live GGUF template renders text reliably. True
tool-role Parts is a separate per-template-gated follow-up (#294 family).

- New guard `pinned_act_result_reaches_the_prompt_even_with_an_empty_broadcast`:
  the result reaches the prompt even when NOTHING bid it through the arbiter (the exact
  eviction state), and never lands in the cacheable system prefix.
- Retargeted the three full-result WM tests (whole/clipped/settlement-gate) from the
  faculty contribution to the pinned block — every invariant preserved.
- Fixed a Step-3 test committed red (never run green): restore() appends a [resumed]
  wake-orientation fact by design (#147/#165), so an N-entry snapshot restores to N+1;
  the test now asserts survival by content, not an exact count.

945/945 cognition tests green (cargo test -p continuum-core --lib --features metal,accelerate).
The live proof — deploy + a persona re-running sympy-18057 with the result threading
back to the _sympify edit — is the next step.

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

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
joelteply added a commit that referenced this pull request Aug 21, 2026
#266 prefix defect

The tier-split shipped for #266 (stable framing first, volatile grounding last) did not
deliver reuse, and the comment at this sort said why without noticing: a stable sort
"preserves the salience order WITHIN each tier, so attention ranking is untouched". That
was treated as harmless. It is the remaining half of the defect. Salience is recomputed
EVERY turn, so preserving it as EMIT ORDER re-shuffles the very tier whose only purpose
is to be byte-identical across turns.

MEASURED LIVE 2026-08-21, inside Atlas's `pallets__flask-4045` run, from her own prompt
captures — not inferred:

  turn0→1  common prefix 8,216 / 9,906 chars   diverges into [now …]
  turn1→2  common prefix 7,879                 diverges into [active-work]
  turn2→3  common prefix 8,133                 diverges into [workspace-map]

~82% shared prefix, and the divergence points are stable-tier blocks TRADING PLACES.
Because the system prompt is FIRST, a swap at token ~2,000 invalidates the KV for
everything after it — including a 34,000-token conversation tail. `--cache-reuse 256`
was passed the entire time and every turn reported `cachedTokens: 0`. The cache was
correct; we were destroying the prefix ourselves.

Cost at the measured 111 tok/s prefill: ~306 SECONDS OF RE-PREFILL PER ACT, growing as
her conversation grows (9,847 → 36,242 tokens and climbing as tool results accumulate).
One observed turn was 20 minutes of apparent silence that was a single 36k re-prefill —
the run reporting `active`/`not stalled` the whole time, because the pulse is a timer.

THE FIX: within the stable tier, order CANONICALLY (by faculty name). Attention ranking
is genuinely untouched — salience still decides WHICH contributions are selected, which
happened above against the budget. It simply stops deciding WHERE the survivors sit,
which it never needed to. Same set in, same bytes out, every turn.

The volatile tier deliberately KEEPS salience order: it is re-prefilled by construction,
so canonical ordering would buy no reuse and would cost the "most salient nearest the
write point" placement #205 put there on purpose.

VERIFIED: 181 prompt tests pass, including
`framing_flip_never_perturbs_the_cacheable_prefix` — the #266 invariant is intact, this
extends it to the case it did not cover (a FIXED framing with re-ranked context).

NOT YET LIVE-PROVEN: the running core still holds the flask run, so deploy is correctly
blocked. The proof owed is her next captures — common prefix ~82% → ~100%, and
`cachedTokens` 0 → nonzero from turn 2. A regression test pinning "same set, different
salience → identical bytes" follows immediately.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Aug 21, 2026
…#266) — and the ActivityAdapter seam (#2348)

* feat(activity): ONE adapter seam — material in, verdict out (slice 1 of the judge wiring)

An activity adapts the outside world's form into ours and renders a verdict on what the
citizen produced. Benchmarks, a game level, a life-drawing critique, a robot that either
picked up the block or didn't — one interface, N implementations, declaring none is normal.

WHY NOT `BenchmarkAdapter`, WHICH ALREADY EXISTS: it was the right SHAPE and the wrong
SCOPE. It already carried both directions — `dataset()`/`tasks()` in, `grade()` out — so
this is a generalization, not a rewrite. But the NAME is load-bearing: an interface called
`BenchmarkAdapter` cannot plausibly host a game level, so the second activity gets its own
trait, registry and runner, and the substrate ends up with two of everything. Same failure
as naming a room for a subsystem and making it immortal. Named for the JOB, gameplay is a
sibling implementation instead of a fork.

THE GROWABLE OUTCOME, and why the fixed struct was the real blocker: `TaskOutcome` had
`patch` and `workspace` as bare fields, which means SWE-bench OWNS the outcome type. A game
trajectory or a robot's joint log could only arrive by widening a struct every other
activity compiles against — so in practice it would never arrive there; it would grow its
own parallel outcome and its own parallel judge. `Outcome` now keeps the UNIVERSAL facts as
named fields (she spoke; she worked somewhere; the harness had its own opinion) and puts
modality-specific ones in a typed `channels` carrier, the same growable shape this codebase
already uses for adapter capabilities. Gameplay adds a channel without SWE-bench
recompiling; a judge asks for the channel it grades and gets a typed None when the activity
produced none. Growing the enum stays deliberate — a new variant needs a REAL activity — but
the cost of a wrong guess drops from "a second subsystem" to "one unused variant".

WHAT THIS IS FOR (measured today, 450 runs): 253 of them — 56% — ended with NO GRADE AND NO
ERROR. Not a failure, not a verdict: nothing. In classroom terms the exams were sat and
nobody was assigned to mark them. `benchmark.json` declares `suite/instances/team/budget`
and NO judge; `BenchmarkAdapter` has zero production consumers; grading is hardcoded to
`swe_bench::grade` behind four private call sites. When a run doesn't come through one of
those doors, nothing marks it and nothing says so.

`resolve_all` is the seam that makes that unrepresentable: a declared judge that cannot be
resolved is an error AT STAGING, naming the bad key and the known set — never a run that
ends quietly. An EMPTY declaration resolves to empty and is explicitly NOT an error, because
most activities judge nothing and that is normal, not a missing judge.

Five tests, each pinning a contract that failed in the wild: registry round-trip + named
miss; empty declaration is legal; unknown declaration fails loud and names it; the default
judge defers to the harness (so a task whose EvalTask already encodes done-ness needs no
judge code); an absent channel reads ABSENT, not as empty success.

NOT YET WIRED — deliberately, this is slice 1. Next: the recipe declares its judges in
`params`, dispatch resolves them through this registry, and the hardcoded `swe_bench::grade`
branch is DELETED rather than supplemented (a subtraction, per the design doc's build order).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(kv): canonical order inside the STABLE tier — the other half of the #266 prefix defect

The tier-split shipped for #266 (stable framing first, volatile grounding last) did not
deliver reuse, and the comment at this sort said why without noticing: a stable sort
"preserves the salience order WITHIN each tier, so attention ranking is untouched". That
was treated as harmless. It is the remaining half of the defect. Salience is recomputed
EVERY turn, so preserving it as EMIT ORDER re-shuffles the very tier whose only purpose
is to be byte-identical across turns.

MEASURED LIVE 2026-08-21, inside Atlas's `pallets__flask-4045` run, from her own prompt
captures — not inferred:

  turn0→1  common prefix 8,216 / 9,906 chars   diverges into [now …]
  turn1→2  common prefix 7,879                 diverges into [active-work]
  turn2→3  common prefix 8,133                 diverges into [workspace-map]

~82% shared prefix, and the divergence points are stable-tier blocks TRADING PLACES.
Because the system prompt is FIRST, a swap at token ~2,000 invalidates the KV for
everything after it — including a 34,000-token conversation tail. `--cache-reuse 256`
was passed the entire time and every turn reported `cachedTokens: 0`. The cache was
correct; we were destroying the prefix ourselves.

Cost at the measured 111 tok/s prefill: ~306 SECONDS OF RE-PREFILL PER ACT, growing as
her conversation grows (9,847 → 36,242 tokens and climbing as tool results accumulate).
One observed turn was 20 minutes of apparent silence that was a single 36k re-prefill —
the run reporting `active`/`not stalled` the whole time, because the pulse is a timer.

THE FIX: within the stable tier, order CANONICALLY (by faculty name). Attention ranking
is genuinely untouched — salience still decides WHICH contributions are selected, which
happened above against the budget. It simply stops deciding WHERE the survivors sit,
which it never needed to. Same set in, same bytes out, every turn.

The volatile tier deliberately KEEPS salience order: it is re-prefilled by construction,
so canonical ordering would buy no reuse and would cost the "most salient nearest the
write point" placement #205 put there on purpose.

VERIFIED: 181 prompt tests pass, including
`framing_flip_never_perturbs_the_cacheable_prefix` — the #266 invariant is intact, this
extends it to the case it did not cover (a FIXED framing with re-ranked context).

NOT YET LIVE-PROVEN: the running core still holds the flask run, so deploy is correctly
blocked. The proof owed is her next captures — common prefix ~82% → ~100%, and
`cachedTokens` 0 → nonzero from turn 2. A regression test pinning "same set, different
salience → identical bytes" follows immediately.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(probe): delib.generate.cache — make the KV fix prove itself instead of me diffing captures by hand

Joel: "hopefully it will prove itself via probes." It could not have. `delib` carried
`turn.demand` and `context.render` — how big the prompt WAS — and nothing about what the
lane DID with it. A prompt whose prefix we were destroying every single turn looked
identical in the probe stream to one served entirely from cache. That absence is why the
prefix defect (fixed in 40075d7) survived from #266 to today, and why the only way to
see it on 2026-08-21 was hand-diffing a citizen's raw prompt captures — exactly the manual
step a probe exists to delete.

The row lands in `metrics_from`, the single funnel every generation already passes
through, so one probe covers every turn of every citizen with no caller change:

  delib.generate.cache  cached_tokens prefill_tokens hit_rate prefill_ms decode_ms
                        input_tokens output_tokens latency_ms

`hit_rate` is `TurnMetrics::cache_hit_rate()` — the ratio that already existed and had no
way out of the process. 1.0 = fully warm prefix. Near 0 with a large `prefill_tokens` =
the prefix is being invalidated upstream, which is the measured pre-fix state: ~306s of
wasted re-prefill per act while `--cache-reuse 256` was set and working correctly.

Emitted ONLY when the lane actually reported timings. Cloud and older endpoints omit
them, and a fabricated 0.0 hit-rate for a provider that never measured one is a lying
receipt of the #151/#357 class — those stay silent rather than report a floor they did
not observe.

So the verification of the ordering fix is now a probe query rather than a capture diff:
hit_rate should climb off the floor from the second act of a task onward.

cargo check green (metal,accelerate). Signature and return value unchanged — purely
additive. The --lib gate in CI is the test proof; live proof still waits on the flask run
clearing the core.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
joelteply added a commit that referenced this pull request Aug 21, 2026
…d durability, grade-race fix (#2349)

* feat(activity): ONE adapter seam — material in, verdict out (slice 1 of the judge wiring)

An activity adapts the outside world's form into ours and renders a verdict on what the
citizen produced. Benchmarks, a game level, a life-drawing critique, a robot that either
picked up the block or didn't — one interface, N implementations, declaring none is normal.

WHY NOT `BenchmarkAdapter`, WHICH ALREADY EXISTS: it was the right SHAPE and the wrong
SCOPE. It already carried both directions — `dataset()`/`tasks()` in, `grade()` out — so
this is a generalization, not a rewrite. But the NAME is load-bearing: an interface called
`BenchmarkAdapter` cannot plausibly host a game level, so the second activity gets its own
trait, registry and runner, and the substrate ends up with two of everything. Same failure
as naming a room for a subsystem and making it immortal. Named for the JOB, gameplay is a
sibling implementation instead of a fork.

THE GROWABLE OUTCOME, and why the fixed struct was the real blocker: `TaskOutcome` had
`patch` and `workspace` as bare fields, which means SWE-bench OWNS the outcome type. A game
trajectory or a robot's joint log could only arrive by widening a struct every other
activity compiles against — so in practice it would never arrive there; it would grow its
own parallel outcome and its own parallel judge. `Outcome` now keeps the UNIVERSAL facts as
named fields (she spoke; she worked somewhere; the harness had its own opinion) and puts
modality-specific ones in a typed `channels` carrier, the same growable shape this codebase
already uses for adapter capabilities. Gameplay adds a channel without SWE-bench
recompiling; a judge asks for the channel it grades and gets a typed None when the activity
produced none. Growing the enum stays deliberate — a new variant needs a REAL activity — but
the cost of a wrong guess drops from "a second subsystem" to "one unused variant".

WHAT THIS IS FOR (measured today, 450 runs): 253 of them — 56% — ended with NO GRADE AND NO
ERROR. Not a failure, not a verdict: nothing. In classroom terms the exams were sat and
nobody was assigned to mark them. `benchmark.json` declares `suite/instances/team/budget`
and NO judge; `BenchmarkAdapter` has zero production consumers; grading is hardcoded to
`swe_bench::grade` behind four private call sites. When a run doesn't come through one of
those doors, nothing marks it and nothing says so.

`resolve_all` is the seam that makes that unrepresentable: a declared judge that cannot be
resolved is an error AT STAGING, naming the bad key and the known set — never a run that
ends quietly. An EMPTY declaration resolves to empty and is explicitly NOT an error, because
most activities judge nothing and that is normal, not a missing judge.

Five tests, each pinning a contract that failed in the wild: registry round-trip + named
miss; empty declaration is legal; unknown declaration fails loud and names it; the default
judge defers to the harness (so a task whose EvalTask already encodes done-ness needs no
judge code); an absent channel reads ABSENT, not as empty success.

NOT YET WIRED — deliberately, this is slice 1. Next: the recipe declares its judges in
`params`, dispatch resolves them through this registry, and the hardcoded `swe_bench::grade`
branch is DELETED rather than supplemented (a subtraction, per the design doc's build order).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(kv): canonical order inside the STABLE tier — the other half of the #266 prefix defect

The tier-split shipped for #266 (stable framing first, volatile grounding last) did not
deliver reuse, and the comment at this sort said why without noticing: a stable sort
"preserves the salience order WITHIN each tier, so attention ranking is untouched". That
was treated as harmless. It is the remaining half of the defect. Salience is recomputed
EVERY turn, so preserving it as EMIT ORDER re-shuffles the very tier whose only purpose
is to be byte-identical across turns.

MEASURED LIVE 2026-08-21, inside Atlas's `pallets__flask-4045` run, from her own prompt
captures — not inferred:

  turn0→1  common prefix 8,216 / 9,906 chars   diverges into [now …]
  turn1→2  common prefix 7,879                 diverges into [active-work]
  turn2→3  common prefix 8,133                 diverges into [workspace-map]

~82% shared prefix, and the divergence points are stable-tier blocks TRADING PLACES.
Because the system prompt is FIRST, a swap at token ~2,000 invalidates the KV for
everything after it — including a 34,000-token conversation tail. `--cache-reuse 256`
was passed the entire time and every turn reported `cachedTokens: 0`. The cache was
correct; we were destroying the prefix ourselves.

Cost at the measured 111 tok/s prefill: ~306 SECONDS OF RE-PREFILL PER ACT, growing as
her conversation grows (9,847 → 36,242 tokens and climbing as tool results accumulate).
One observed turn was 20 minutes of apparent silence that was a single 36k re-prefill —
the run reporting `active`/`not stalled` the whole time, because the pulse is a timer.

THE FIX: within the stable tier, order CANONICALLY (by faculty name). Attention ranking
is genuinely untouched — salience still decides WHICH contributions are selected, which
happened above against the budget. It simply stops deciding WHERE the survivors sit,
which it never needed to. Same set in, same bytes out, every turn.

The volatile tier deliberately KEEPS salience order: it is re-prefilled by construction,
so canonical ordering would buy no reuse and would cost the "most salient nearest the
write point" placement #205 put there on purpose.

VERIFIED: 181 prompt tests pass, including
`framing_flip_never_perturbs_the_cacheable_prefix` — the #266 invariant is intact, this
extends it to the case it did not cover (a FIXED framing with re-ranked context).

NOT YET LIVE-PROVEN: the running core still holds the flask run, so deploy is correctly
blocked. The proof owed is her next captures — common prefix ~82% → ~100%, and
`cachedTokens` 0 → nonzero from turn 2. A regression test pinning "same set, different
salience → identical bytes" follows immediately.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(probe): delib.generate.cache — make the KV fix prove itself instead of me diffing captures by hand

Joel: "hopefully it will prove itself via probes." It could not have. `delib` carried
`turn.demand` and `context.render` — how big the prompt WAS — and nothing about what the
lane DID with it. A prompt whose prefix we were destroying every single turn looked
identical in the probe stream to one served entirely from cache. That absence is why the
prefix defect (fixed in 40075d7) survived from #266 to today, and why the only way to
see it on 2026-08-21 was hand-diffing a citizen's raw prompt captures — exactly the manual
step a probe exists to delete.

The row lands in `metrics_from`, the single funnel every generation already passes
through, so one probe covers every turn of every citizen with no caller change:

  delib.generate.cache  cached_tokens prefill_tokens hit_rate prefill_ms decode_ms
                        input_tokens output_tokens latency_ms

`hit_rate` is `TurnMetrics::cache_hit_rate()` — the ratio that already existed and had no
way out of the process. 1.0 = fully warm prefix. Near 0 with a large `prefill_tokens` =
the prefix is being invalidated upstream, which is the measured pre-fix state: ~306s of
wasted re-prefill per act while `--cache-reuse 256` was set and working correctly.

Emitted ONLY when the lane actually reported timings. Cloud and older endpoints omit
them, and a fabricated 0.0 hit-rate for a provider that never measured one is a lying
receipt of the #151/#357 class — those stay silent rather than report a floor they did
not observe.

So the verification of the ordering fix is now a probe query rather than a capture diff:
hit_rate should climb off the floor from the second act of a task onward.

cargo check green (metal,accelerate). Signature and return value unchanged — purely
additive. The --lib gate in CI is the test proof; live proof still waits on the flask run
clearing the core.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* test(kv): pin "same set, different salience → identical bytes" — the guard the #266 half lacked

The sibling test `stable_framing_serializes_before_higher_salience_volatile_grounding`
pinned the TIER SPLIT and passed the whole time the prefix was being destroyed. It could
not catch this: it asserts stable-before-volatile, and says nothing about order WITHIN the
stable tier — which is exactly where salience was re-shuffling blocks every turn.

So this is the assertion that makes 40075d7 hold. Three different salience rankings and
three different arrival orders over the SAME three stable contributions must emit
byte-identical blocks. Revert to a salience-ordered stable tier and this fails while the
sibling still passes — which is the whole point of adding it rather than extending that one.

It also pins the rule POSITIVELY (canonical by faculty name), because byte-equality alone
would be satisfied by an insertion-order block that happened to match across this test's
particular arrival orders. An accidental pass is not a guard.

TWO THINGS THE TEST TAUGHT ME WHILE WRITING IT, both worth the next reader's time:

1. My canonical assertion was backwards from its own message. Alphabetically it is
   room-kanban < room-roster < workspace-map — roster sits BETWEEN, and I asserted
   kanban < map < roster. Caught by the test, on the first run.

2. The volatile-tier assertion FAILED, and it was my probe that was wrong, not the code.
   I reached for `active-work` as a volatile example. It is pinned FIRST by an explicit
   rule ABOVE salience (ctx.sort_by, :888-905) because the ctx_floor reservation for a
   citizen's held card only holds if its claimant also leads the greedy selection walk.
   So I had picked the one faculty in that tier where salience is deliberately not the
   deciding key, and the result read as "salience does nothing here" about a tier where
   it does plenty. Swapped to recall-vs-affect, which are genuinely salience-ranked, and
   left the trap written down in the test so the next person does not re-lay it.

That volatile assertion is deliberately `assert_ne!` — it guards the ASYMMETRY. The
volatile tier must keep following salience (#205, most salient nearest the write point);
it re-prefills by construction, so canonical ordering there would buy no reuse and would
cost that placement. If a future "make it all deterministic" pass reaches into that tier,
this fails and tells it why.

182 prompt tests green (was 181). Disk swept-clean, 128 GB free.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* docs(kv): the KV cache economy — and the naive "shared tool head" plan is DOMINATED

Joel asked for this DESIGNED, not patched. Reading the serving layer first was the whole
value: most of the machinery we were about to build already exists in llama.cpp and is
already switched on. Two facts read in-file today reverse the plan I would have written
from memory.

WHAT IS ALREADY TRUE (source-read, not inferred):

  * `slot_prompt_similarity` defaults to 0.1 and we never disable it — LCP-based slot
    selection is ALREADY ACTIVE (common.h:687, server-context.cpp:1543). Cross-persona
    head sharing is not a feature to build; it is a behaviour we already get, unmanaged.
  * `cache_ram_mib` defaults to 8192 — an 8 GiB host-RAM prompt cache ALREADY EXISTS, and
    the server already saves an evicted slot's conversation and restores the incoming one
    (prompt_save / prompt_load, server-context.cpp:1620).
  * We never pin `id_slot`, so affinity is emergent from prefix similarity and never
    declared. That is the actual gap: not mechanism, POLICY.

THE ARITHMETIC THAT KILLS THE OBVIOUS PLAN. With Atlas's measured numbers — ~7,600 tok
shared head vs a 36,242 tok tail:

    sim    = 7,600 / 36,242 ≈ 0.21  > 0.1  →  persona B TAKES persona A's slot
    f_keep = 7,600 / 36,242 ≈ 0.21  < 0.5  →  A's 36k is evicted

The shared head is big enough to WIN slot selection and small enough that winning throws
away 4.7× more than it saves. "Make the tool head identical and first so every persona
shares it" is right about token cost (#333) and is a precondition — but as a KV strategy
it is dominated, and shipped alone it makes slot theft MORE likely and would read as a
regression. Tail retention beats head sharing by the tail:head ratio, which grows every
act. Any design that trades a tail for a head is backwards.

So the order inverts: declared slot affinity (`id_slot` per resident citizen, eviction as
a priced decision behind the same seam as every other cache class) is the KEYSTONE, and
the shared head lands AFTER it. "Docker form" is exactly the right instinct for the head —
a shared prefix only stays shared if it is a function of LANE IDENTITY, not of whichever
citizen is calling: same model, flags, tool manifest, template → one head, with an
identity hash so divergence is LOUD rather than silent.

Reconciles with [[kv-prefix-caching-is-the-only-form...]]: that memory is about
CONVERSATION content, which is genuinely unique per citizen. A tool schema head is not
conversation, so sharing it is prefix reuse, not dedup.

FOUND WHILE WRITING, and it is its own defect: that 8 GiB prompt cache is UN-GOVERNED. We
never pass the flag, never budget it, never told the ResourceGovernor. Same shape as the
2026-07-13 incident — every component healthy, the wiring absent — in RAM instead of disk.
`--cache-ram` becomes a governed lease at spawn, like GGML_MOE_HOST_CACHE_GB (#287).

WHAT I DID NOT MEASURE, and the doc says so rather than guessing: the wall-clock of
prompt_save/prompt_load at ~36k tokens. It decides whether eviction is survivable or is a
second re-prefill in a hat, so step 1 is measuring it and step 3 is gated on the number.

Steps 1 (measure) and 2 (govern the RAM) are independent of the live flask run and can
start now.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* docs(kv): policy is an ADAPTER not a rule + decompose the 4,190-line server (Joel's steer)

Joel: "not too hard coded into one paradigm — better add proper adapters and break the
module down into concerns. We could do a ton with plugin ML here, especially RL."

Right, and reading first changed the answer for the THIRD time today: the seam already
exists WITH a learned implementation in it.

  * capacity/expert_tier_policy.rs — `trait TierPolicy { fn plan(...) -> ExpertTierPlan }`,
    decisions returned as a PLAN not applied inline; ClassicTierPolicy is the v1 heuristic.
  * expert-pager-policy LEAF CRATE — policy already extracted into its own crate. The
    plugin boundary is already cut.
  * capacity/bandit_plan_controller.rs — a BANDIT CONTROLLER, re-exported from it. RL is
    not greenfield here (#276/#281).
  * expert_predictor / expert_decay_policy / expert_residency / expert_observer — the
    concerns are already separated on the expert side.

So KV slot residency implements that shape rather than inventing a rival. And the
generalisation is now EARNED rather than speculative: CLAUDE.md says generalize at 2-3
instances, and we have three of "paged resource under scarcity with a learnable value
function" — MoE experts (built), LoRA genome paging (built), KV slots (this doc). KV slots
are the ideal outlier B precisely because they are MAXIMALLY DIFFERENT from experts: unit
is a whole conversation not a tensor, a miss costs seconds of prefill not bytes of fetch,
population is 2-8 not thousands. One seam fitting both ends fits everything between.

  - Outlier A, heuristic: cost_of_loss = tail_tokens / prefill_rate. A quantity with a
    UNIT (seconds), not a magic ratio. Ships first, is the permanent floor.
  - Outlier B, RL: state = per-slot (tail, recency, citizen, phase) + arrival; action =
    which slot; reward = PREFILL SECONDS SAVED.

AND THE REWARD SIGNAL IS ALREADY INSTRUMENTED — I shipped it this morning (faf8c07)
without noticing it was one. `delib.generate.cache` emits cached_tokens / prefill_tokens /
prefill_ms / hit_rate on EVERY generation: a labelled transition per turn, continuously, in
production. So the A-vs-B comparison is measurable from day one instead of argued.

Guardrails so "plugin ML" doesn't become unexplainable serving: policies return PLANS
(loggable, replayable, refusable); the heuristic stays callable forever as the floor and a
learned policy that loses on measured prefill-seconds is switched off by the comparison,
not by argument; the deciding policy's identity rides the receipt so a regression is
attributable; and never learn on a broken substrate — before the deterministic head landed
the reward was ~0 for structural reasons and a bandit trained through that would have
learned nothing helps.

DECOMPOSITION: inference/llama_server.rs is 4,190 lines — 8× the decomposition law, and
where every §3 change would otherwise land. Named the six concerns (spawn/args, readiness,
slots, request, lifecycle, policy-as-leaf-crate). Explicitly a MOVE, not a re-architecture:
no new task, no new watch channel, no second registry — and the flag comments travel with
their flags, since those comments are the only record of the incidents that set each value.

ALSO CORRECTED §4: `--cache-ram` is not new work. capacity/host_cache_lease.rs is already
the governed lease, already runs on the governor tick, and its own module doc already says
why that matters here — "KV grows as slots fill". One more term on an existing lease.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* refactor(inference): extract the llama-server flag spine into lane_args — decomposition slice 1

Joel: "I hate this file. Decompose it away from slop." llama_server.rs was 4,190 lines
with every concern in it — flags, readiness, request shaping, lifecycle, orphan reaping —
and it is where every change in the KV design would otherwise land. Slice 1 of
docs/architecture/KV-CACHE-ECONOMY.md §7. Net -28 lines there, and a module that can
actually be tested.

WHY FLAGS FIRST. Answering "how do we use upstream llama.cpp" precisely: we consume it
TWO independent ways, and only one touches this file.

  * as a BINARY — llama-server spawned as a subprocess, spoken to over HTTP. ZERO
    linkage: llama_server.rs imports nothing from llama/ggml. Upstream drift reaches us
    as a changed CLI surface (this module) or a changed JSON shape (request/readiness).
  * as a LIBRARY — the `llama` crate links libllama in-process for forge/conversion.
    That is where our fork's C++ lives (K3 KDA, AttnRes, MoE gather). Never passes here.

So a fork rebase should touch this file and the wire shapes and nothing else. It could
not, while the flags were welded into a Command chain in a 4k-line file.

THE INVOCATION IS DATA. `base_invocation` is pure — primitives in, `LaneInvocation` out,
no Command, no process, no I/O. Same shape as `TierPolicy::plan`: return a plan, don't
apply one, so it can be asserted, logged and diffed. `envs` is on the struct because the
invocation genuinely is not args-only (LLAMA_RESIDENT_OVERRIDE, #29); modelling that as
"args plus a side effect someone remembers" is how it gets dropped.

FIVE TESTS THAT COULD NOT PREVIOUSLY EXIST, because asserting them meant launching a real
llama-server on a real GPU with a real model:

  * `-c` == per-lane window x lanes, and `--parallel` is EXPLICIT — the regression where
    inheriting llama.cpp's default of 4 silently served every citizen a QUARTER of the
    planned window. Nothing failed. That is why this is now three lines of pure arithmetic.
  * `--no-context-shift` present on every lane (#139: overflow must 400, never amputate
    the prompt middle and generate from the mutilation).
  * `--cache-reuse 256` still configured (~306s/act when absent, measured).
  * every value-taking flag is followed by a VALUE — the class that broke on 2026-08-20
    when upstream turned `--flash-attn` from a switch into one taking [on|off|auto] and
    the bare form ate `--mmproj`, so the lane failed to spawn and serving sat at 0 lanes.
  * the base invocation needs no environment.

COMMENTS TRAVELLED WITH THEIR FLAGS, verbatim, not paraphrased. Each one is the only
surviving record of the incident that set its value; moving a flag without its comment
destroys the reason and invites the reversion. Added one postscript to --cache-reuse:
the flag was never the defect, WE were mutating our own prefix (fixed in 40075d7) —
so nobody tunes this number looking for the win that already landed elsewhere.

SCOPE, deliberately bounded: the CONDITIONAL flags (KV quant, flash-attn, mmproj, MTP
draft, resident override, CPU placement, jinja, LoRA, MoE -ot) are still assembled by the
caller and are slice 2. This is the unconditional spine, which is also the part carrying
the arithmetic worth pinning.

VERIFIED: cargo check clean (metal,accelerate); 5 new tests pass; llama_server's 38 tests
pass. NOT MINE, flagged not absorbed: `first_free_port_skips_a_taken_port` is FLAKY under
parallel execution — same filter and binary gave FAILED then ok on an immediate re-run,
and it passes in isolation both with and without this diff. It binds a port and races.
Worth its own card; not silently folded in here.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* refactor(inference): conditionals behind LaneOptions + a generic AsArg — slice 2

Joel: "Move concerns to proper adapters" and "templates are underutilized by you in both
cpp and rust… it reduces code size a lot sometimes." Both applied here, not just agreed to.

SLICE 2 — the conditional flag surface moves out of the Command chain:
kv-quant / flash-attn / mmproj / MTP draft / CPU placement / resident-override now ride
`LaneOptions` into a pure `LaneInvocation::with_options`. llama_server.rs 4,190 → 4,079.

THE SPLIT THAT MAKES IT AN ADAPTER RATHER THAN A MOVE: every LaneOptions field is an
ALREADY-RESOLVED value, never a thing to look up. Resolution — reading config_env,
probing the registry for an mmproj or an MTP head, deciding placement, and emitting the
vision-capability RECEIPT — stays with the caller, which owns the I/O. lane_args decides
only what a resolved value MEANS on a command line. Gather inputs, then compute a plan:
the same shape as TierPolicy, and the reason the whole surface is unit-testable with no
GPU, no model, no process.

The vision warn stayed behind deliberately. A Vision-capable row with no projector serves
text-only and silently ignores images — a capability LIE — so it warns loud
([[fallbacks-are-illegal-fail-loud]]). That is a receipt about the world, not a flag, and
receipts belong with resolution.

THE TEMPLATE POINT, applied where it actually pays. Before, every value was hand-converted
at its call site — `total_ctx.to_string()`, `p.to_string_lossy().into_owned()`, a bare
`"256".into()` — three spellings of one idea, and three chances to push a VALUE without
its FLAG. So: one `trait AsArg` (impl for &str/String/&Path/u16/u32) plus `pair(args,
flag, value)`, and a valued flag becomes a single indivisible call. Monomorphised exactly
as a C++ template would be — one definition, zero runtime cost.

That is not cosmetic. Orphaning a value from its flag is precisely the class that took
serving to 0 lanes on 2026-08-20, when upstream turned `--flash-attn` into
`[on|off|auto]` and the bare form ate `--mmproj`. `pair` makes it unrepresentable instead
of merely tested for — and the test stays anyway, because a guard you can delete is not
a guard.

FOUR MORE TESTS (9 total in the module):
  * default options emit NO conditional flags and no env — "present when it should be
    absent" is a real defect; the mmproj case literally decides whether a citizen SEES.
  * --flash-attn keeps its value when sitting next to --mmproj: the 8/20 outage as a
    test rather than an outage.
  * resident override rides the ENVIRONMENT, never the args (#29) — the reason
    LaneInvocation models envs at all rather than returning a bare Vec<String>.
  * KV quant sets BOTH -k and -v; one without the other is a silent cache asymmetry.

STILL SLICE 3, deliberately not half-migrated: --jinja / chat-template sidecar, the LoRA
set, and the MoE `-ot` tensor overrides.

VERIFIED: cargo check clean (metal,accelerate); 9/9 lane_args tests pass.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* refactor(inference): slice 3 — jinja/LoRA/-ot move out; the flag CONCERN is now closed

Last of the conditional surface: the chat-template sidecar, the genome LoRA set, and the
K3 `-ot` expert placement. llama_server.rs 4,190 → 4,034 (-156); lane_args.rs is 521 lines
that are entirely about one thing. No flag is now built in two places, which was the
compression violation the half-migration would have left behind.

`--jinja` moved to the BASE spine, not to options, because it is unconditional — and the
comment explaining why is the most expensive one in the file. Gating it was a silent
capability kill: the switch used to require a forge-written sidecar to exist, so every
normally PULLED GGUF ran with tools DISABLED. The gateway ignored the `tools` param and
the persona NARRATED tool calls instead of emitting them. A model with hands, holding
them behind its back, because of a file that was never there. The sidecar now OVERRIDES
when present (forged GGUFs whose mlx→gguf conversion left a thin 208-char tool-less
template) and the embedded tool-capable template stands when absent — tools ON either way.

The LoRA join moved WITH its flag rather than staying at the call site, deliberately: the
join IS the flag's semantics. llama.cpp b8784+ deprecated repeated `--lora` and SILENTLY
keeps only the LAST, which was collapsing every multi-layer genome stack to a single
adapter — glass-boxed 2026-07-23 in the lane's own stderr ("DEPRECATED: --lora specified
multiple times... only last value will be used" x4) while a 4-layer stack was supposedly
serving. The genome's whole premise is layers that STACK; this arg SHAPE is what stacks
them. Split the join from the flag and the next person re-introduces the bug.

Resolution stayed with the caller for all three, same rule as slice 2: the sidecar
`is_file()` probe, the adapter paths, and `expert_ot_value()` are lookups; lane_args only
decides what a resolved value means on a command line.

VERIFIED: 351 inference tests pass; cargo check clean (metal,accelerate).

NEXT, and it is the seam Joel actually asked for: `trait LaneBackend` with llama-server as
impl A, so an mlx / vllm / remote-grid-peer lane is impl B rather than a fork of this file.
lane_args is now shaped to BE that impl rather than to be the only way.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* docs(serving): STDERR IS NEVER AN INTERFACE — and we break it twice (Joel's law)

Joel, 2026-08-21: "STDERR/out is never a place for interfacing, just debug."

Checked rather than agreed, and we violate it in two places, both written in good faith
for real incidents and both making llama.cpp's DEBUG TEXT load-bearing in our control
plane:

  * `inference::wedge::WedgeWatch` parses stderr for an impossible slot progress
    (`progress = 1.10`) and raises a flag THE SERVING DAEMON REAPS A LANE ON.
  * `inference::placement_watch::OffloadWatch` parses llama.cpp's LOAD BANNER for layers
    offloaded, then fires `serving.placement.cpu_fallback` — treated as a lease
    violation (#441).

Why it has to change even though it works today: stderr is unstructured, unversioned, and
drifts with upstream's logging taste. The failure mode when it drifts is not an error — it
is SILENCE. The watcher stops matching, the flag stops rising, and the wedge that burned
four hours on 2026-08-05 becomes invisible again with every component still green. Same
shape as every other defect in this document: an absence that looks like normal operation.
It is also, precisely, the class the #441 sentinel was built to catch — so the sentinel is
currently exposed to the failure it exists to detect.

The structured channels already exist: `/slots` carries per-slot state and progress,
`/props` the load configuration, and the per-request `timings` block already reaches us —
it is what `delib.generate.cache` reports. The tok/s sentinel should read
`prefill_tokens`/`prefill_ms` rather than scrape a banner.

THE LINE, since not all stderr reading is a violation: `stderr_log_tail()` on spawn
failure is CORRECT — a human asks "why did it die" and gets llama.cpp's own last words.
Reading stderr to SHOW is debug. Parsing stderr to DECIDE is an interface. The test is
whether a control path branches on it.

STATUS: named, not fixed. Rewriting both watchers onto /slots + /props needs those payloads
verified against our pinned build (b10196-fa7e0d8e9) first — asserting a field exists
because upstream documents it is the same mistake in a different channel.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* docs(kv): pin the PRE-FIX baseline from a live run — 0% reuse, 57,005 tokens re-prefilled in 4 acts

Measured 2026-08-21 10:57 off a LIVE run rather than argued: citizen e5f4141d, instance
pallets__flask-4045, pre-fix binary b10196-fa7e0d8e9, read from her own prompt captures.

  act 1: cached 0 / prefill  9,847  hit 0.000
  act 2: cached 0 / prefill 11,172  hit 0.000
  act 3: cached 0 / prefill 19,434  hit 0.000
  act 4: cached 0 / prefill 16,552  hit 0.000

57,005 tokens re-prefilled across four acts, zero reuse on every turn, ~513s at the
measured 111 tok/s — 8.5 minutes of a 4.3h budget spent re-reading, four acts in, cost per
act still climbing. That is the number 40075d7 has to move, now pinned to a specific
citizen on a specific instance so the after-measurement is a COMPARISON and not a claim.

METHOD NOTE, recorded because it nearly went wrong and it is the session's recurring
defect class: `pgrep` for a solve process finds NOTHING while a run is live, because
`agent/solve` executes INSIDE the core rather than as a subprocess. I read that absence as
"the run finished, deploy is unblocked" — and would have rebooted the box out from under a
citizen at act 4. Wrong instrument, absence misread, same shape as every retraction in
this document. The authoritative signal is
~/.continuum/progress/agent-solve-claim-<run>.json (state, acts, mtime): it said
state=running, acts=4, written 60 seconds earlier.

Deploy remains correctly blocked. The after-number is owed and is now cheap to collect —
same read, or just query delib.generate.cache once the fix is live.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(serving): per-slot throughput verdict — the sensor missing when the round died today

TDD/VDD on a defect measured LIVE forty minutes ago, encoded while it is fresh rather
than remembered later.

THE INCIDENT. Citizen e5f4141d working pallets__flask-4045 in-room. Run reported
state=running, heartbeat every minute, acts frozen at 4 for twelve minutes. Lane answered
/health {"status":"ok"}, /props 200, /v1/models 200, port bound, process up 3h58m. Every
readiness signal in the system said healthy. Her own lane said:

  slot 1 | task 3   | n_decoded = 1092, tg = 2.65 t/s, tg_3s = 0.96 t/s
  slot 1 | task 3   | n_decoded = 1093, tg = 2.53 t/s, tg_3s = 0.05 t/s
  slot 0 | task 605 | prompt processing, progress 0.52, 105 t/s

Slot 1 decoding at 0.05 TOKENS PER SECOND — one token per twenty seconds — still holding
task 3 after six hundred tasks passed on the neighbouring slot. PREFILL WAS FINE (105 t/s,
the expected rate). Only decode collapsed, on ONE slot, and nothing could see it. That is
#386's per-slot wedge and it is the round-killer: a citizen at 1/600th speed burns her
whole 4.3h deadline producing nothing while the board renders a healthy pulse.

WHY LANE HEALTH CANNOT CATCH IT: /health is lane-scoped and the LANE is fine — the other
slot decodes normally, so every aggregate reads healthy. #363 established that readiness
must verify GENERATION not the socket; this is the layer below: generation must be
verified PER SLOT, because a lane is healthy exactly as long as its best slot is.

DESIGN, per the standing rules:
  * PURE function, transport-agnostic. It takes SlotObservation values, so it works the
    instant they arrive from a structured channel. /slots returns HTTP 000 on our pinned
    build — that is the follow-up, and the verdict logic must not wait on it.
  * expected_tps is a PARAMETER, never a constant here. What counts as collapsed depends
    on model and device; the catalog Model row owns that expectation (#441). A constant
    would be a hardcoded LCD clamp — either missing a real wedge on a fast box or crying
    wolf on a slow one.
  * Reads the 3-SECOND rate, not the lifetime average. The same slot read tg=2.53 (bad)
    while tg_3s=0.05 (dead); averaged over hours, a stopped slot looks merely slow.
  * Degraded REPORTS, only Wedged is actionable. #446 is the counter-example: starvation
    stamped as wedge evidence produced a 2-minute relaunch loop that WAS the outage.
  * A slot under 32 decoded tokens gets no verdict — killing cold generations is
    [[an-absence-is-an-unfinished-measurement]] wired to an actuator.

SIX TESTS, the first two carrying the live numbers verbatim: the incident classifies
Wedged; the lifetime average provably would have MISSED it (that test guards the
leading-indicator argument, not just the constant); merely-slow is reported not reaped;
a cold slot is never wedged; no expectation means no verdict; and the same observation
flips healthy/wedged with the device's own expectation.

INSTRUMENT NOTE, recorded in the module: those numbers were read out of stderr BY HAND,
which is the only way they were visible — and that is the exact defect Joel named today
("STDERR/out is never a place for interfacing, just debug"). Reading a log to DIAGNOSE is
correct. A control path depending on it is not. This module is the honest half; wiring it
to /slots is the other.

NOT YET WIRED — no caller, deliberately. The verdict is the testable unit; the actuator
(who reaps, when, under what lease) is a separate decision and belongs with the daemon,
same doctrine as the wedge flag.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(inference): prefill is not decode — stop the 90s watchdog killing live prefills (the round-killer)

MEASURED on the M5, and it is why citizens took ZERO room turns across the probe
ledger's 868 minutes while every dashboard read healthy:

  demand        94,370 tok   against a 58,112-token window (over_window 1.62)
  prefill rate     382 tok/s (timed live: 603 tok → 17.7s; 5,728 tok → 31.1s)
  ⇒ first byte    ~170 s     for a window-sized prompt
  watchdog          90 s     ← fires first, every single time

44 `persona.settle.deliberation_retry` rows carry the verdict the watchdog reached:
"the slot HAD started our work and then stopped mid-stream, so the backend is stuck
or dead". It was neither. Atlas re-sent the byte-identical 94,370-token demand 21
minutes later and died the same way.

The cascade is what made it a round-killer rather than a slow turn: the ambient
permit is held across that wait, so three permits sat occupied ~90s each by turns
that could never finish. Measured +4 yields/min, EXACTLY, for 25 consecutive
minutes, zero successes — the perfect periodicity is the tell, since real
contention is bursty.

ROOT CAUSE, one line and not a missing feature. Both budgets already existed and
both were correctly sized for their own job: STREAM_IDLE_TIMEOUT_SECS (90s) is a
DECODE watchdog by its own doc ("a token every few hundred ms"), and
PRE_STREAM_HEADER_TIMEOUT_SECS (300s) is documented as "sized for a worst-case
full-window prefill queued behind co-tenants (minutes)". The adapter switched from
the second to the first the instant ANY progress arrived — and llama.cpp emits a
prompt_progress frame at 0% ingestion purely "to signal the client that the request
has started processing". So the decode watchdog policed the prefill, and the budget
written for exactly this case was skipped past within seconds.

FIX: `inference::stream_liveness` — a pure, transport-agnostic phase machine
(Queued / Prefilling / Decoding) that names the distinction once so no caller
re-derives it. Bulk work gets the bulk budget; the drip gets the drip budget.

Deliberately preserved:
- #385 keeps its teeth. Liveness is still keyed on the GAP BETWEEN PROGRESS EVENTS,
  never elapsed total, and the stamp still requires `processed` to STRICTLY advance
  — so a slot replaying a frozen counter still fails, just at the prefill budget.
- #446 keeps its diagnosis. `has_started()` still separates never-started
  (dead backend vs oversubscribed queue) from started-then-stopped.
- Decoding is TERMINAL, so a late/stray progress frame cannot re-open the generous
  budget mid-decode. My own test caught that the first implementation could.
- Providers that never report prefill (every cloud adapter) go Queued → Decoding on
  first output, so their budgets are bit-for-bit unchanged. Strict addition, never
  a relaxation.

Phase transitions are detected at ONE site per kind rather than repeated at each of
the four output sites, so a new output kind cannot forget to declare itself.

7 new tests carry the live incident numbers verbatim, incl. the 0%-frame case that
IS the outage and a regression guard for no-prefill providers. 36/36 existing
openai_adapter tests green.

Design + the full measured chain: docs/architecture/ADMISSION-IS-UNOBSERVABLE.md
(also records the admission-snapshot gap and the seven wrong reads it took to get
here — two of them my own instruments lying, not the system).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(inference): probe the prefill fix — "no retries" is an ABSENCE and proves nothing

Self-correction. I shipped the phase machine and emitted NOTHING for it, then read
"RETRIES: 0, TURNS: 0" off the ledger and could not say whether prefills now survive
or nothing was running. That is the same unobservable-state defect the design doc in
the previous commit exists to complain about, committed by me one commit later.

Two rows, both at the seam that actually decides:

- `inference.prefill.rescued` — fires ONCE per stream, only when a prefill has
  already outlived the OLD decode budget AND is still advancing. Every row is a turn
  that under the previous flat 90s would have been killed here and retried forever.
  This is a POSITIVE signal for a fix whose symptom is an absence.

- `inference.prefill.complete` — total / cached / fresh / elapsed_ms / tok_per_s /
  would_have_died, at the prefill→decode edge. This is the number the 90s constant
  was implicitly guessing at, and the one the budget should eventually be DERIVED
  from per model+device (#441). It also finally measures the KV cache's REAL
  contribution per stream (`cached` vs `fresh`), which is the instrument the KV
  ordering work has been owed.

Joel, mid-session: "Have to probe better." Correct — a fix I cannot see working is a
fix I have not proven.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(inference): split queue-wait from ingest in the prefill receipts — a probe that mixes two regimes measures neither

First cut of `inference.prefill.complete` produced absurdities that were the
conflation talking: a 467-token prompt "prefilling at 1 tok/s for 231s". It was
queued ~230 of those seconds waiting for a slot. llama.cpp's 0% progress frame
marks slot ASSIGNMENT, so the honest split is:

  queued_ms  = stream open → first progress frame   (admission/oversubscription, #234)
  ingest_ms  = first frame → prefill complete        (real ingest work)

`ingest_tok_per_s` is now computed over ingest only — the number a derived
per-model budget must come from (#441). `rescued` rows carry `queued_s` for the
same reason.

Source-read while here (vendor llama.cpp): prefills ARE continuous-batched across
slots (`can_batch_with` + cont_batching), so concurrent prefills share compute by
design. The 230s waits mean all 4 slots were OCCUPIED — by window-scale
re-prefills that zero KV reuse makes ~5 minutes each. Queue wait is downstream of
the KV defect; the split makes that attributable per stream instead of argued.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(inference): a loading lane must not latch slot affinity off — the boot race that undid persona pinning every launch

slot_for_persona (2026-07-11) pins each persona's prefix to its own llama-server
slot. It has likely been latched OFF on virtually every boot since: the /props
probe latched SlotAffinity::Unsupported on ANY non-success status, and personas
start deliberating while the lane still answers 503_loading (measured ×93 in this
ledger). One probe racing the load window → pinning dead for the process's life →
prefix-similarity slot theft → cached: 0 mid-conversation, measured today.

Only 404/501 — "no such surface" — may latch. Extracted the verdict as
props_status_proves_endpoint_absent() and pinned it with a regression test carrying
the incident: 503/500/502/429 defer and re-probe; 404/501 latch (without that,
every cloud provider would re-probe per persona request forever). A malformed body
from a live server also defers now — mid-load servers answer partial bodies.

Observability, same lesson as the prefill probes ("no rows" must be distinguishable
from "latched off silently for weeks"):
- inference.slot_affinity.pinned    — once per persona pin, proves affinity is LIVE
- inference.slot_affinity.evicted   — names the victim; cross-persona eviction IS
                                      the KV-clobber event and must be priced
                                      (KV-CACHE-ECONOMY: a decision, not an accident)
- inference.slot_affinity.deferred / .unsupported — the latch decision itself

Measured on the previous build (6dea7c4, 10-min window) with queue/ingest split:
queued=0s on ALL streams — no slot wait; the residual is ingest-share under
continuous batching. First nonzero mid-scale KV reuse ever recorded (cached=2912 of
21002) with affinity still latched off; this fix targets exactly that number. Two
died_old=1 prefills (163s, 192s) completed that the old watchdog would have killed.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(persona): 'never thought' is a state, not a 584-million-year idle — the renewal probe stops stamping u64::MAX

idle.unwrap_or(u64::MAX) printed idle_ms=18446744073709551615 into the ledger
(seen live 2026-08-21). The gate logic was right; only the receipt lied.
[[unknown-is-not-a-quantity]]: the unknown gets a word ('never-thought'), never
a sentinel number a reader must recognize by its astronomical size.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* docs: resolution log — all four fixes proven live same-day (retries 0, first slot pins ever, 99.7% KV reuse on byte-stable prompt)

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* docs: citizen act observed post-fix; deaf-kickoff scoped to subscription coverage (cursor layer exonerated)

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(bench): clone_at serializes per destination — the race that voided sympy-18057's finished artifact at grading

The 2026-08-18 grade loss, root-caused: `clone_at` removes its destination at entry
AND razes/renames it at the commit point, while the protocol legitimately wants the
same instance's tree more than once (her work tree + the pristine score tree; a
lapsed-claim auto-grade racing a re-stage). Concurrent callers deleted each other's
trees mid-use.

The trigger was a Node-era assumption fossilized in a path: staging is
`cloning-{pid}`, unique when every clone was its own process — but in the headless
core every clone shares ONE pid, so two concurrent stages computed the SAME staging
path and the stale-staging sweep deleted a LIVE clone mid-fetch:
"repo.cloning-78289/.git/: No such file or directory" — a finished artifact voided
at scoring.

Fix, constraint-first:
- One live clone_at per DESTINATION: per-repo_dir tokio::Mutex registry (async lock —
  the section awaits git subprocesses throughout; keyed by repo_dir, not instance, so
  a 300-instance sweep does not serialize globally).
- staging_path_for(): pid + per-invocation nonce, extracted pure for testability.
- Dead-staging sweep by `<name>.cloning-` prefix instead of exact-name match — with
  nonced names an exact match can never find a crashed run's leftovers, and unswept
  litter violates the no-cache-dir-without-an-eviction-story rule (2026-07-13).

Two regression tests carry the incident: staging uniqueness + sweepable prefix, and
lock identity per destination.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(bench): a round survives the core that opened it — persist in-flight rounds, reload on first touch

Measured twice on 2026-08-21: the ROUNDS map was process-memory, so a reboot
mid-round (1) blanked `benchmark/rounds` while a staged round was live — the
operator re-derived the round from probe archaeology — and (2) silently flipped
driver_for_card back to DetachedSolve for a Citizen round's remaining cards,
quietly rebuilding the parallel runner the round was configured to avoid. With
"restart freely" as standing doctrine, every deploy was round-murder: 8 of the 20
most recent runs on this box carry "killed by a core restart".

The round is now durable state, same family as the airc attach cursor: one JSON
file per in-flight round under ~/.continuum/state/bench-rounds/, written on every
mutation (open / add_card / settle / seal), removed at Done. First touch of ROUNDS
reloads — no boot hook; the first driver_for_card after a reboot already answers
from the reloaded round. bench.round.reloaded announces each recovery.

Eviction story (the 2026-07-13 rule): files self-evict at Done, and a Done file
surviving a crash window is dropped AND deleted on reload, never resurrected as a
round no event can settle. Persist failure degrades to the old amnesia and WARNS —
durability must never fail a live dispatch.

HONEST LIMIT, stated in code: cards that reached terminal state while the core was
down still read as working until the next event. Re-deriving card state from the
board at boot — and consuming the orphan-reap report (`needs_redispatch: true`,
which nothing consumes today) — is the follow-up reconciler, per
ROUND-LIFECYCLE-AS-RECIPE-OWNED-STATE-MACHINE.md. This commit restores the round's
EXISTENCE, which is what every later reconciler needs first.

Two regression tests carry both measured defects.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(bench): round tests persist to a temp dir, never the operator's real state

Caught within the hour: the persistence layer resolved $HOME unconditionally, so
the EXISTING tests — which exercise the public open_round/add_card — minted four
phantom rounds into ~/.continuum/state/bench-rounds across two cargo test runs,
and the next live core faithfully reloaded them (in_flight: 5 with one real
round). A durable layer's tests must be durable somewhere disposable: cfg(test)
resolves to a per-process temp dir. Verified: full bench_round suite leaves the
real state dir untouched.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
joelteply added a commit that referenced this pull request Aug 23, 2026
…-rate fix, measured from her own captures (#2415)

The single biggest wall-clock lever in the tree, diagnosed with the
glass box, fixed at the constraint (Joel: 'code it elegantly and
efficiently from the start… you're coding webdev horseshit for
performant rtos work' — this is the RTOS fix).

MEASURED (capture round 907390a0, turn-over-turn diff of her real
contribution stream): workspace-map content changed act-over-act (her
own writes mutate it) while sitting in the STABLE tier of the system
message; kanban/active-work were volatile-flagged but the volatile tier
still rendered INSIDE the system message — before every conversation
token. Divergence at ~8k chars of a 40k+ prompt = live KV reuse pinned
at 18-33%, ~35-45k re-prefilled per act, ~2min/act, 96% of compute
prefill. The #266 sort fixed ORDER churn in the stable tier; CONTENT
churn was the remaining killer.

FIX, at the constraint, using the mechanism #205 already built and
documented as KV-correct:
1. rag_source_faculty: volatile-content grounding bids are .trailing()
   — they render as conversation turns nearest generation (the existing
   render loop), so churn costs exactly its own tokens. The volatile
   tier of the system context block was a half-measure.
2. workspace-map flagged .volatile_content() — its churn is every
   productive act by construction.
3. The trailing render keeps the [faculty] banner (one sized
   allocation, no format!) so relocated grounding stays as legible as
   the system block it left.

Expected shape after: prefix reuse = system (now byte-stable) + full
conversation; per-act re-prefill = trailing grounding + working-memory
tail only. Target ≥70% cached on intra-task acts vs the measured
18-33%; A/B rides the next round's prefill probes.

Pinned by volatile_content_grounding_is_trailing_and_stable_grounding_
is_not. Batteries: 93 (deliberation/prompt/workspace/supervisor) + 11
(rag_source_faculty + ratchets) green.


Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

Co-authored-by: Claude Fable 5 <[email protected]>
joelteply added a commit that referenced this pull request Aug 23, 2026
…ff verdict (#2418)

Consecutive-act prompt captures (always-on JsonlPromptCaptureSink) gave
the byte-level verdict on why KV reuse plateaued at ~36% after #2415+
#2416: the system prompt is perfectly byte-stable (8,305 chars = the
cached head), and the divergence is at MESSAGE #1 CHAR 0 — perception
facts whose presence/wording flickers per act rendered ahead of the
21.8k append-only history block, so the prompt's dominant stable mass
never extended the prefix. The message list's SHAPE changed act-over-
act (8 parts vs 4).

Fix: explicit assembly phases replacing insert-before-ask arithmetic —
old turns → history (append-only) → trailing grounding (flickers) →
facts (flicker) → ASK → pinned newest. Stable content is a strict
prefix of the token stream; churn is behind it. Every prior lesson
preserved by construction: facts stay before the ask and the ask after
them (2026-07-20 parrot-loop bisect), pinned stays nearest generation
(#392), grounding stays out of the system prefix (#205/#2415).

Batteries: 130 green (deliberation, perception_facts, act_observe,
working_memory, ratchets) — including the parrot-order pins.


Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

Co-authored-by: Claude Fable 5 <[email protected]>
joelteply added a commit that referenced this pull request Sep 1, 2026
…urn and was churning the stable KV head

The last layer of the hit_rate-0.0 stack. With 5 slots granted (every
resident on her own slot, rotation gone) and the server's reuse proven
perfect the same hour (same prompt x2 on one slot: cache_n 397/401,
74ms), reuse was STILL 0 — because the recall block lives in the
system prefix and is re-scored every turn: capture diff showed an
'(you reflected, 3d ago)' line inserted mid-list and the head re-fit
12.3k -> 10.7k chars between consecutive turns. A head mutation at
char ~8.5k invalidates every token behind it.

stable_blocks' own doc promises 'recall … is separated out as its own
.trailing() turns (#205)'; FacultyId::Recall never actually set the
flag. One line makes the promise true; the mechanism (trailing
contributions render nearest generation) already existed and is
already tested. Regression assert added to
surfaces_top_salience_memory_as_context.

recall_faculty 20/20.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Sep 1, 2026
…il, the split applied for real (#2721)

* fix(serving): KV bytes/token from the artifact's own header — the weights guess over-charged MoE 4x

The cache load/store breakdown, root layer. kv_per_token was
weights/80_000: a 35B fine-grained MoE read as ~244 KB/token (q8: 122)
where the header's declared geometry is ~61 KB f16 (~30 KB served q8 —
confirmed against llama-server's own prompt-cache entry sizes). Expert
weights add ZERO KV; any weights-scaled guess over-charges MoE ~4x.

One inflated constant, both live symptoms:
- peak_resident_bytes inflated ~25 GB -> afford collapsed -> --cache-ram
  derived at 686 MiB = ONE mind's state; llama's log shows 'removing
  oldest entry (593 MiB)' on every save — the restore tier held exactly
  one of five rotating minds, so every restore missed and hit_rate was
  0.0 fleet-wide even with affinity, classes, and paging all correct.
- the same inflation is why the planner granted 3-4 lanes against a
  resident demand of 5-6.

Fix at the constraint: gguf_keys::kv_bytes_per_token_f16 reads the
header's own geometry (scalar GQA, per-layer arrays with recurrent
zeros, key_length-absent fallback — all three shapes tested);
footprint_for overrides the heuristic with it, memoized per path (the
governor tick must not re-parse headers). The heuristic stands only
when the header cannot answer. Probe: serving.kv_rate.header.

gguf_keys 6/6, serving_daemon 43/43.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(cognition): recall rides the volatile tail — it re-scores every turn and was churning the stable KV head

The last layer of the hit_rate-0.0 stack. With 5 slots granted (every
resident on her own slot, rotation gone) and the server's reuse proven
perfect the same hour (same prompt x2 on one slot: cache_n 397/401,
74ms), reuse was STILL 0 — because the recall block lives in the
system prefix and is re-scored every turn: capture diff showed an
'(you reflected, 3d ago)' line inserted mid-list and the head re-fit
12.3k -> 10.7k chars between consecutive turns. A head mutation at
char ~8.5k invalidates every token behind it.

stable_blocks' own doc promises 'recall … is separated out as its own
.trailing() turns (#205)'; FacultyId::Recall never actually set the
flag. One line makes the promise true; the mechanism (trailing
contributions render nearest generation) already existed and is
already tested. Regression assert added to
surfaces_top_salience_memory_as_context.

recall_faculty 20/20.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(cognition): apply the KV split for real — volatile framing rides the facts phase, never the system message

The split composer existed, its docs called it 'the live path' — and the
live view builder (prompt_view_within) still called
compose_system_holding, which glues stable ++ trailing back into ONE
system message. So the [now] minute clock and the presence flip
(DIRECTED / WORKING / SILENCE) kept mutating the system prefix at char
~8.4k on nearly every act: wire-capture diff 2026-09-01 showed
consecutive turns diverging exactly at '[now …]' /
'[Conversational Presence]' -> '[Your own time]', with the server's
reuse proven perfect the same hour (same prompt x2 on one slot:
cache_n 397/401, 74ms). A prefix that mutates every act caches nothing.

Now: compose_trailing() renders the volatile framing WITHOUT the
context (none of its blocks read it), and messages_unfitted places it
in the FACTS phase — flicker-class content, before the ask (parrot
order preserved), after everything stable. The system message is the
stable half only, so a presence flip cannot move a byte of it — pinned
by the strengthened directedness_flip test (system now byte-IDENTICAL
across the flip, framing asserted into the tail).

Three tests that encoded the old placement updated to the new
contract. llm_deliberation_faculty 38/38; cognition:: 1085/1085.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Fable 5 <[email protected]>
joelteply added a commit that referenced this pull request Sep 12, 2026
…ix orders widest first (#3981)

`PromptScope { Substrate, Persona, Activity, Turn }` on every composed block. The tool
catalogue (Substrate: byte-identical for every persona with the same authorized set) now leads
the cacheable prefix; identity and the turn contract (Persona) follow; the standing context
(Activity) after; the clock/presence/recall material (Turn) stays a trailing turn.

Before, the prefix was ordered by hand — identity first, so no two personas shared a byte of
prefix — and three separate fixes (#205, #266, plan B4) each moved one block after a measured
cache break. One ordering declared per block replaces the boolean stable/trailing split for
blocks; a KV pager or a speculator reads the same scopes to know which pages N personas share
and which a context switch swaps.

Honest scope of the receipt: on this server the prompt cache is per slot, so the cross-persona
share needs the fork's KV page reuse to show as hit rate; this PR is its precondition and
changes no per-turn prefill on its own. Test pins the order and that no Turn block reaches the
prefix. Design: docs/planning/UNCERTAINTY-IS-THE-SCHEDULER-SIGNAL.md.


Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

Co-authored-by: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file javascript Pull requests that update javascript code size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant