Skip to content

Build(deps): Bump actions/setup-node from 4 to 6 - #151

Closed
dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/github_actions/actions/setup-node-6
Closed

dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/github_actions/actions/setup-node-6

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Oct 20, 2025

Copy link
Copy Markdown
Contributor

Bumps actions/setup-node from 4 to 6.

Release notes

Sourced from actions/setup-node's releases.

v6.0.0

What's Changed

Breaking Changes

Dependency Upgrades

Full Changelog: actions/setup-node@v5...v6.0.0

v5.0.0

What's Changed

Breaking Changes

This update, introduces automatic caching when a valid packageManager field is present in your package.json. This aims to improve workflow performance and make dependency management more seamless. To disable this automatic caching, set package-manager-cache: false

steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
  with:
    package-manager-cache: false

Make sure your runner is on version v2.327.1 or later to ensure compatibility with this release. See Release Notes

Dependency Upgrades

New Contributors

Full Changelog: actions/setup-node@v4...v5.0.0

v4.4.0

... (truncated)

Commits

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)

Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4 to 6.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](actions/setup-node@v4...v6)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot Bot added dependencies Pull requests that update a dependency file github_actions Pull requests that update GitHub Actions code labels Oct 20, 2025
@joelteply joelteply closed this Nov 20, 2025
@dependabot @github

dependabot Bot commented on behalf of github Nov 20, 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/github_actions/actions/setup-node-6 branch November 20, 2025 00:29
joelteply added a commit that referenced this pull request Jun 3, 2026
…all (#1519)

* refactor(persona): `&ctx`-pure RAG request + ctx-derived tracing span

Elegance pass on the patterns the slice-13 work established. Per
Joel 2026-06-02: "we are on sort of an elegance refactor and then
for improved reliability and speed."

What changed:

1. `RagInspectionRequest::for_ctx(&ctx, now_ms)` — new constructor
   that takes the persona context directly. Replaces the 4-arg
   `for_persona(persona_id, name, now_ms, &profile)` at the call
   site. `for_persona` stays (it's the underlying derivation) but
   new code uses `for_ctx` to honor the substrate's `&ctx`
   doctrine ([[context-is-the-client-airc-token-is-identity]]):
   hand the context, not its parts.

2. `PersonaContext::span()` — new method that returns a
   `tracing::info_span!` tagged with `persona_id`, `agent_name`,
   `peer_id`, `role`, `tier`, `ctx_len`, `model`. The span derives
   from `&ctx` — no manual field threading at every log call site.

3. `serve_persona_loop` rewritten in two layers:
   - Outer entry function wraps the inner future with
     `.instrument(ctx.span())`. Every log line inside the loop
     inherits the persona's identity fields automatically.
   - Inner function drops the `let persona_id = hosted.identity.x`
     extractions; reads `ctx.identity.peer_id` etc. directly at use
     sites. Two internal `tracing::warn!` lines lose their
     persona_id/agent_name fields (now inherited from the span);
     they keep just per-turn delta (`lamport`, `error`).

Net effect:
- Field extraction count in service_loop drops from 3 manual extracts
  + 4 redundant tracing field annotations to 0.
- Log output gains persona_id + agent_name + role + tier + ctx_len
  + model on EVERY internal log line, automatically. The substrate's
  observability is now span-shaped, not manual.
- New code that needs a derived RAG request just writes
  `RagInspectionRequest::for_ctx(ctx, now)` — one arg vs four.

Why `.instrument` not `.entered`:
- `Span::entered` returns a non-Send RAII guard; tokio spawned
  futures need Send. The two-function split (outer thin wrapper
  with `.instrument`, inner async function) is the standard tracing
  pattern for spans across awaits.

Verification:
- cargo build --lib --tests clean
- cargo test persona::service_loop — 4 passed
- cargo test persona::supervisor — 4 passed

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

* refactor(persona/host): extract PersonaSpawnSupervisor + BootSummary

Elegance pass — extract-class refactor pulling the 170-line inline
boot composition out of `ipc/mod.rs::start_server` into a named
class. Per Joel 2026-06-02: "Must have elegance obsessively. Like a
Java dev. NO SHAME. It's better."

What changed:

1. `PersonaSpawnSupervisor` struct (in `persona/host.rs`) owns the
   spawner / instance_manager / registry / factory / tier_id /
   model_registry / rt_handle inputs. Construct once at boot; call
   `.spawn_all(&mut provider)` to produce a `BootSummary`.

2. `BootSummary { hosted, failures }` + `BootSlotFailure {
   slot_index, role, persona_id, reason }` — typed result structs.
   Replace the inline `let mut hosted_count: usize = 0` / `let mut
   failed_count: usize = 0` counters with a real value type the
   substrate can publish (`persona:boot:summary` event — Q5 of the
   design doc, deferred to slice 13.5+) and downstream clients
   (web, jtag CLI) can read with the same shape per
   [[clients-are-rust-too-thin-node-web-shell]].

3. The supervisor's `spawn_all` method handles every previously-
   inline concern:
   - `bootstrap_planned` failure → orderly-drain orphans + return
     summary with synthetic failure row
   - `materialize_adapters` with runtime_lookup closure (so
     `ctx.runtime` is populated from the registry)
   - Per-slot `spawn_and_attach` private method handles
     `spawn_persona_service` + `attach_service_loop` + handle drain
     on attach-failure (the BLOCKER 1/2 fixes from PR #1511 are
     preserved, just relocated)

4. IPC boot collapses from ~170 lines of inline code to ~30 lines:
   construct supervisor → spawn task → build provider → call
   `supervisor.spawn_all(&mut provider).await` → log summary.

5. Helper `supervisor_error_facts` centralizes pulling
   `(slot_index, role)` out of `SupervisorError`'s two variants —
   the kind of trivial-but-DRY private fn Java/dotnet shops write
   without apology.

Why this matters (the doctrine):
- The IPC server boot concern and the persona spawn concern had
  different lifetimes and different test needs. Mixing them in
  one function violated "one logical decision, one place"
  ([[compression-principle]]).
- `PersonaSpawnSupervisor` is now unit-testable in isolation. The
  IPC server's test surface shrinks. Slice 14's RoleAwareProvider
  + multi-persona work has one named insertion point.
- `BootSummary` is the structured event payload the design doc's
  Q5 named. Once `RoleId` derives `TS` (slice 14), the struct gets
  the ts-rs export and web/jtag clients read it directly per the
  Rust-first-clients doctrine.

Verification:
- cargo build --lib --tests clean
- cargo test persona::host — 2 passed (BootSummary attempted +
  serde camel-case)
- cargo test persona::supervisor — 4 passed (unchanged)
- cargo test persona::service_loop — 4 passed (unchanged)
- IPC boot composition shrinks ~140 lines; supervisor's spawn_all
  is now the single named extraction point for slice 13.5 / 14
  changes.

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

* refactor(persona): AircCitizen trait — drop Option<Arc<PersonaAircRuntime>> from PersonaContext (#144)

Java-style "extract interface" on the substrate's airc-handle. Slice 13.5
elegance pass per Joel 2026-06-02 ("Must have elegance obsessively. Like
a Java dev. NO SHAME").

Before: PersonaContext.runtime: Option<Arc<PersonaAircRuntime>>. The
Option existed solely for test fixtures that couldn't easily build a
real PersonaAircRuntime; production code paid .expect("None is
test-only") on the hot path.

After: PersonaContext.runtime: Arc<dyn AircCitizen>. Tests use a typed
StubAircCitizen. Production upcoerces from PersonaAircRuntime, which
now impls AircCitizen + AircTranscriptReader. Rust 1.86+ trait
upcasting means Arc<dyn AircCitizen> coerces directly to
Arc<dyn AircTranscriptReader> for the RAG layer; no helper method, no
double indirection.

Trait surface (minimum viable):
- fn peer_id(&self) -> Uuid
- async fn subscribe(&self) -> Result<EventStream, AircError>
- async fn say(&self, text: &str) -> Result<EventId, AircError>
- AircTranscriptReader as supertrait (page_recent for the RAG layer)

What changed:
- persona/airc_citizen.rs (new): AircCitizen trait + StubAircCitizen.
- persona/airc_runtime.rs: PersonaAircRuntime impls AircCitizen +
  AircTranscriptReader; delegates to its internal Arc<Airc>.
- persona/supervisor.rs: PersonaContext.runtime drops the Option.
  materialize_adapters' runtime_lookup signature is now
  Option<Arc<dyn AircCitizen>>; missing runtime surfaces as typed
  SupervisorError::RuntimeMissing { slot_index, role, persona_id }
  per [[no-fallbacks-ever]].
- persona/airc_persona_conversation.rs: takes Arc<dyn AircCitizen>,
  calls trait methods directly (no runtime.airc() detour).
- persona/host.rs: spawn_persona_service drops the .expect; host's
  runtime_lookup upcoerces PersonaAircRuntime to AircCitizen for
  materialize_adapters.
- persona/service_loop.rs fake_hosted: runtime is now
  Arc::new(StubAircCitizen::new(peer_id)) instead of None.
- bin/airc_chat_demo.rs: dropped the Some(_) wrapping —
  Arc<PersonaAircRuntime> auto-coerces to Arc<dyn AircCitizen>.

Doctrine:
- [[personas-are-citizens-airc-is-identity-provider]]: AircCitizen IS
  the substrate's actor type — same trait for personas, humans
  (#142 BaseUser), browsers. The persona is one citizen; the human-
  via-jtag is another; the Claude-Code session is another.
- [[no-fallbacks-ever]]: no Option, no .expect, no silent default.
  RuntimeMissing is a typed error with persona_id named.
- [[context-is-the-client-airc-token-is-identity]]: PersonaContext IS
  the &ctx. Same shape compiles in tests + production.
- [[clients-are-rust-too-thin-node-web-shell]]: AircCitizen is the
  typed Rust primitive future jtag-CLI / web client / native client
  bind to.

Foundation for task #142 (BaseUser hierarchy) — each variant will
carry Arc<dyn AircCitizen> + kind-specific extensions (cognition for
persona, WebAuthn for human, tab state for browser).

Test plan:
- cargo build --lib --no-default-features --features
  livekit-webrtc,llama/mac-cpu-only — clean.
- cargo test --lib ... persona:: — 705/706 pass (the one flake is
  persona::evaluator::tests::test_all_gates_pass_normal_message, an
  unrelated CPU-jitter timing assertion that passes in isolation).
- Integration trace: deferred to PR-time verification.

Closes #144.

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

* docs(architecture): LIFE-OF-A-PERSONA + source/drain anchor — close onboarding gap surfaced by external review

Two doc changes from an outside-perspective review (Gemini) of the
substrate, triaged per [[external-llm-reviews-extract-themes-discard-citations]]
— specific PR citations were fabricated, but two themes were real:

1. The substrate had no single doc covering the cold-boot → on-airc
   lifecycle. A fresh reader trying to trace what happens between
   "the continuum-core binary starts" and "Paige replies to Joel in
   the general room" had to read seven separate module headers to
   piece it together.

2. "Source/drain doctrine" was used in COGNITION-CACHE-HIERARCHY.md
   without anchoring what the drain actually IS — readers had to
   infer.

What changed:

- docs/architecture/LIFE-OF-A-PERSONA.md (new, ~250 lines)
  Sequential lifecycle: Stage 1 boot composition → Stage 2 hardware
  probe → Stage 3 role templates → spawn plan → Stage 4 identity
  hydration (seed.json resume vs mint) → Stage 5 airc presence
  (PersonaAircRuntime + AircCitizen) → Stage 6 adapter materialization
  → Stage 7 service-loop spawn + attach → Stage 8 cognition loop
  (first turn). Every stage names its Rust module + typed failure mode.
  Closes the operational onboarding gap.

  Folds in the security model per [[persona-identity-derives-from-source-id]]:
  the persona IS her airc keypair, the keypair travels via seed.json,
  the host hardware has a SEPARATE identity. No central identity
  broker. Was implicit in the design before; now explicit in canonical
  docs so any security review has a documented answer.

- docs/architecture/COGNITION-CACHE-HIERARCHY.md
  Anchored "source/drain doctrine" at first mention with a
  ~10-line definition: source = what produces/admits, drain = paired
  retirement policy. Linked to memory [[source-drain-is-the-universal-pattern]].
  Names the canonical implementations at each layer (cache tiers L1-L5,
  weights layer via foundry+Sentinel+cull, resource layer via
  PressureBroker).

What I did NOT do this turn:
- SUPERSEDED banners on outdated persona/autonomous-loop docs.
  Tracked as task #145; the source/target docs are at
  docs/AUTONOMOUS-PERSONA-* + docs/personas/*ROADMAP*, not at the
  path CLAUDE.md cites. Wants its own focused audit.
- "Citizen" anchor in CBAR/GENOME-FOUNDRY-SENTINEL canonical docs.
  Less load-bearing once persona/airc_citizen.rs (this branch's
  refactor) provides the Rust-side anchor.
- Floor-vs-ceiling resolution paragraph in INFERENCE-LANES-REALISTIC.
  Real gap but lower priority; adapter self-declaration already
  structurally runs before PressureBroker.

Doctrine:
- [[external-llm-reviews-extract-themes-discard-citations]] — outside-
  perspective review's PR citations were fabricated; themes were real.
  Discard citations; engage with themes.
- [[read-existing-docs-before-writing-new-ones]] — both edits surface
  pre-existing doctrine that wasn't documented at the canonical-doc
  layer.

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

* test(persona/supervisor): lock in SupervisorError::RuntimeMissing behavior (review #1513)

Address reviewer finding: the AircCitizen extraction added
`SupervisorError::RuntimeMissing` but no test asserted it actually
fires when `runtime_lookup` returns None. Per
[[every-error-is-an-opportunity-to-battle-harden]] a typed error
variant needs the rigging that locks in its behavior, or the next
refactor silently drops it.

Two tests added to `supervisor::tests`:

1. `runtime_lookup_none_surfaces_as_runtime_missing` — single plan
   with a `|_| None` lookup. Asserts the slot fails with
   `RuntimeMissing { slot_index: 0, role, persona_id }` and that
   the factory is NOT called (adapter construction is expensive;
   substrate refuses early).

2. `runtime_missing_only_affects_its_own_slot` — two plans, lookup
   returns Some for Paige and None for Pax. Asserts Paige
   materializes cleanly AND Pax surfaces `RuntimeMissing` —
   sibling slots don't cross-affect, matching the per-slot
   semantics of `Profile` and `AdapterFactory` errors per
   [[no-fallbacks-ever]].

Both tests verified locally: 6/6 supervisor tests pass.

Reviewer: https://github.com/CambrianTech/continuum/pull/1513#issuecomment-4606231586

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

* feat(persona): PersonaConversation::prime — move airc subscribe off the cognition hot path (#146)

Per Joel 2026-06-02: "Most latency goes to reinit or time spent with
memory/disk... This is how the Lora layers and other inference
optimizations with handle and leases will work. Same goes for
serialization and other inefficiencies. Copy by ref don't encode
unless necessary."

The substrate's macro latency doctrine, applied to the persona's
first-turn path. Pre-slice-13.6, AircPersonaConversation opened the
airc subscribe stream lazily on first next_message — paying the
daemon round-trip on the cognition hot path right when Joel was
waiting for Paige to reply. Now serve_persona_loop calls
conversation.prime() once at boot, BEFORE high_water_mark or the
event loop. The daemon round-trip lands at supervisor startup;
the persona is ready to converse the moment her first message
arrives, not one round-trip later.

What changed (~150 lines, pure reuse + relocation — no new
infrastructure):

- service_loop.rs:
  - PersonaConversation gains an `async fn prime(&mut self) -> Result<(), String>`.
    Contract: called once at boot, before high_water_mark / next_message.
    Idempotent. Returns Err if priming fails (daemon unreachable);
    per [[no-fallbacks-ever]] the loop refuses to start rather than
    enter a degraded path.
  - serve_persona_loop_inner calls conversation.prime() as its FIRST
    awaited operation. Same Err-propagation shape as the existing
    high_water_mark call site.
  - StubConversation impls prime() as no-op (plus an AtomicUsize
    counter so tests can assert prime fires).

- airc_persona_conversation.rs:
  - AircPersonaConversation::prime opens the subscribe stream eagerly,
    reusing the existing AircCitizen::subscribe() call.
    `if self.stream.is_some() { return Ok(()) }` makes it idempotent.
  - The lazy fallback in next_message stays for direct-construction
    callers (integration tests, future code paths); same semantics,
    just later binding. No degraded path per [[no-fallbacks-ever]].

Tests (locked-in contract):

- `replies_to_inbound_from_other_peer` — extended to assert
  `conversation.primed == 1` after the loop runs. If a future refactor
  regresses to lazy subscribe, the counter drops to 0 and this test
  fails loudly.
- `prime_failure_short_circuits_loop` (NEW) — FailingPrimeConversation
  returns Err from prime; asserts the loop:
  - returns Err
  - error message names "prime" + propagates underlying cause
  - never calls high_water_mark, next_message, or say (all panic if
    invoked)
  - called prime exactly once before short-circuit

Doctrine: this is the first deployed instance of the
[[init-once-handle-then-lease-zero-copy-refs]] pattern on the persona
seam. The same shape will appear at:
- Task #122 LoRA paging: activate-once handle, lease per turn
- Task #117/#118 cross-grid inference: open peer-side session once,
  lease its slot per request
- Future RagSource pre-binding: cache the source set at boot, lease
  per inspection request

Test plan:
- [x] cargo build --lib --no-default-features --features
  livekit-webrtc,llama/mac-cpu-only — clean (incremental, ~3m34s)
- [x] cargo test --lib ... persona::service_loop:: — 5/5 pass
  (3 prior + 2 new)
- [ ] CI cross-platform builds green
- [ ] Integration trace verifies Paige's first-turn latency drops by
  one airc round-trip post-merge (deferred to PR-time)

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

* fix(persona): prime() before spawn + typed err on unprimed next_message (review #1514)

Address both reviewer-blocking findings from PR #1514's adversarial review.

## Fix #1: spawn_persona_service primes BEFORE spawn (architectural)

Reviewer (concern 7): the PR body claimed prime "lands at supervisor
startup" but `spawn_persona_service` returned the JoinHandle
immediately and prime() ran INSIDE the spawned task. The supervisor's
`summary.hosted += 1` ticked BEFORE the daemon round-trip completed.
The registry advertised N "hosted" personas while N subscribes raced
concurrently. The substrate's "registered = ready" invariant was
silently violated.

Fix: `spawn_persona_service` becomes `async fn ... -> Result<JoinHandle, String>`.
It awaits `conversation.prime()` BEFORE spawning the task. If prime
fails, the task is never spawned and the function returns Err.

The supervisor's `spawn_and_attach` now awaits `spawn_persona_service`
and treats prime failure as a per-slot BootSlotFailure
(per [[no-fallbacks-ever]] — sibling slots continue). `summary.hosted`
ticks only when BOTH prime succeeded AND attach succeeded.

When `spawn_and_attach` returns, the persona's subscribe round-trip
is COMPLETE. Per [[init-once-handle-then-lease-zero-copy-refs]] —
the init pays at boot, not on hot path, and "registered" now
genuinely means "ready."

`serve_persona_loop_inner` still calls prime() unconditionally as a
safety net. Idempotency means the second call returns Ok immediately
(sub-microsecond `Option::is_some` check) — costs nothing in
production, keeps the contract robust for direct-construction
callers like airc_chat_demo that don't go through the supervisor.

## Fix #2: next_message refuses unprimed callers visibly

Reviewer (concern 2): the lazy `if self.stream.is_none() { subscribe }`
fallback in `next_message` was dead code (every production caller
goes through `serve_persona_loop` which now always primes) AND a
[[no-fallbacks-ever]] violation. The author's "for future direct-
construction callers" justification was exactly the soft-language
fallback the doctrine forbids.

Fix: replaced with `self.stream.as_mut().ok_or_else(...)` returning a
typed error naming the missing prime() call. Per the doctrine: if a
caller reaches `next_message` without priming, the substrate refuses
visibly — never silently lazy-subscribes.

Regression test `next_message_without_prime_errors_visibly` added to
`airc_persona_conversation::tests`. Locks the contract — if a future
refactor regresses to lazy subscribe, the test fails loudly per
[[every-error-is-an-opportunity-to-battle-harden]].

## Test plan

- [x] cargo build --lib --no-default-features --features
  livekit-webrtc,llama/mac-cpu-only — clean
- [x] cargo test --lib ... persona:: — 710/710 pass (709 prior + 1
  new regression test)

Reviewer comment: https://github.com/CambrianTech/continuum/pull/1514#issuecomment-4606707846

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

* feat(persona): per-turn latency metrics — LatencyAggregate + ServeOutcome.turn_latency (#150)

Per Joel 2026-06-02: "make sure timing and other metrics are in place."
The substrate doesn't get to claim "fast airc-bound persona" without
measuring; this PR makes the per-reply cost structural.

Added (all in persona/service_loop.rs):

- LatencyAggregate { count, total_ms, min_ms, max_ms } — cheap online
  aggregator. O(1) record, allocation-free, saturating-add on
  overflow (locked by test). mean_ms returns Option<f64>.
- ServeOutcome.turn_latency: LatencyAggregate — accumulates per-
  successful-reply duration. Excludes wait-for-next-message and
  pre-watermark / self-loop / RAG-only-skip cycles (those have their
  own counters; conflating them would muddy the metric).
- serve_persona_loop_inner instruments the per-reply path:
  - Instant::now captured AFTER filters, BEFORE RAG inspect
  - elapsed recorded into turn_latency only on successful say
  - tracing::info per turn with lamport, duration, mean/min/max so
    the substrate's observability layer captures the metric
    structurally per [[observability-is-half-the-architecture]]

Doctrine fit:
- Monotonic Instant (not wall-clock) — immune to clock skew
- One Instant per turn, no Vec growth, no heap allocs on hot path
- Per Joel's computer-engineer mental model in
  [[init-once-handle-then-lease-zero-copy-refs]]: cache-friendly,
  branch-predictable, autovectorization-friendly

Tests (7/7 pass):
- latency_aggregate_records_min_max_sum_count — empty + populated
  math; mean = total/count
- latency_aggregate_saturates_on_overflow — locks the safety
  property per [[every-error-is-an-opportunity-to-battle-harden]]
- replies_to_inbound_from_other_peer (extended) — asserts
  turn_latency.count == 1 after one successful reply; min/max/mean
  set. If a future refactor forgets to record, count drops to 0 and
  the test fails loudly

Test plan:
- [x] cargo test --lib ... persona::service_loop:: — 7/7 pass

Closes #150. Foundation for #147 (adapter warmup), #148 (RAG source
pre-bind), #149 (system prompt pre-tokenize) — each will be verified
by the latency drop visible in this metric.

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

* fix(persona): remove belt-and-suspenders prime call + honest latency test (caller-primes contract)

Per Joel 2026-06-02: "God I hope it's not more fallback cancer. You
tend to turn stuff into fake demos."

Two honest fixes addressing both criticisms.

## Fix 1: ONE place primes, not two (no more belt-and-suspenders)

Before: `spawn_persona_service` called `conversation.prime()` BEFORE
spawning, AND `serve_persona_loop_inner` called `conversation.prime()`
unconditionally as a "safety net." Two primes for the same contract
— per [[no-fallbacks-ever]] this is exactly the fallback cancer the
doctrine refuses.

After: `serve_persona_loop_inner` does NOT prime. Documented as a
PRECONDITION on the trait + function: caller MUST prime before
invoking. The supervisor's `spawn_persona_service` primes for
production. Direct callers (`airc_chat_demo`, tests) prime explicitly.

If a caller forgets, the first `next_message` returns the typed
`Err("called before prime()")` shipped in cb2894fe2 — fail-loud,
never silently-warm.

Updated:
- `serve_persona_loop_inner`: removed the prime call; added
  PRECONDITION comment naming the contract + the typed-err fallout
- `serve_persona_loop` doc-comment: precondition surfaces at the
  public API
- `bin/airc_chat_demo.rs`: prime() explicitly before
  serve_persona_loop call
- All 4 StubConversation test sites prime explicitly
- `prime_failure_short_circuits_loop` replaced with
  `loop_without_caller_prime_surfaces_typed_error_per_turn` — tests
  the new caller-primes contract directly: unprimed conversation's
  next_message err counts as turns_errored, locks the absence of the
  safety-net call

## Fix 2: latency test verifies REAL elapsed time, not just plumbing

Before: `replies_to_inbound_from_other_peer` asserted
`turn_latency.count == 1` and that min/max/mean were Some. Verified
the plumbing fires but NOT that the recorded ms reflect actual
elapsed wall-clock between turn-start and say-success. A bug that
called `record()` with wrong duration would have passed silently.
Fake-demo-shaped.

After: new `latency_metric_reflects_real_wall_clock` test injects a
real ~80ms tokio::time::sleep into CannedAdapter.generate_text, runs
the loop, asserts:
- `observed_ms >= 50` (CI jitter floor — verifies metric tracks the
  injected delay, not always-zero)
- `observed_ms < 5000` (upper bound for sanity)

CannedAdapter gains `inject_delay_ms` field; `fake_hosted_with_delay`
helper exposes it. Default (`fake_hosted`) passes 0 so existing tests
are unaffected.

Test plan:
- [x] cargo test --lib ... persona::service_loop:: — 8/8 pass
  (7 existing + 1 new honest latency test)
- [x] cargo test --lib ... persona:: — 713/713 pass overall

Doctrine recap:
- [[no-fallbacks-ever]] — one place primes, not two
- [[every-error-is-an-opportunity-to-battle-harden]] — the
  caller-primes regression test locks the contract
- The honest latency test prevents the "passes on plumbing, silent
  on correctness" anti-pattern

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

* feat(persona): adapter warmup at boot — pay KV cache + kernel JIT cost off the hot path (#147)

Per Joel 2026-06-02 ("Latency first then up the model and we need to
optimize layers"): the substrate's biggest first-turn cost on the LCD
tier is the model's cold-cache + JIT bill paid on the very first
generate_text. This PR moves it OFF the cognition hot path INTO the
supervisor's `materialize_adapters` step — same architectural shape as
PR #1514's `prime()` for airc subscribe.

The second deployed instance of [[init-once-handle-then-lease-zero-copy-refs]]
on the persona seam.

## What changed

- `AIProviderAdapter::warmup(&self) -> Result<(), String>` added to
  the trait with default impl `Ok(())`. Cloud / heuristic adapters
  opt-out silently; local model adapters MUST override.
- `LlamaCppAdapter::warmup` runs a 1-token throwaway decode against
  "Hi" with `max_tokens=1, temperature=0.0`. Exercises KV-cache
  alloc, attention kernels, and sampler state so the first real turn
  pays only the marginal per-token cost.
- `persona::supervisor::materialize_adapters` calls
  `adapter.warmup().await` AFTER `factory.build_adapter()` and BEFORE
  the slot enters the hosted set.
- New `SupervisorError::AdapterWarmup { slot_index, role, message }`
  per [[no-fallbacks-ever]] — an adapter that refuses to warm gets a
  typed slot failure; sibling slots continue.
- `host.rs::supervisor_error_facts` extended to handle the new
  variant.

## Test plan (9/9 supervisor tests pass; 716/716 persona overall)

New tests in `supervisor::tests`:

1. `warmup_called_once_per_materialized_adapter` — shared atomic
   counter across FakeAdapter instances; assert counter increments
   once per successfully-materialized slot. Locks the contract that
   future refactors can't quietly drop.

2. `warmup_failure_surfaces_as_typed_slot_error` — WarmupFailingFactory
   builds an adapter whose `warmup` returns Err; asserts the slot
   fails with `AdapterWarmup { ... }` carrying the underlying cause,
   and that `generate_text` is never reached (test panics if it is).

3. `warmup_failure_does_not_taint_sibling_slots` — two slot-isolated
   factories run in parallel; ok-warmup adapter materializes, failing
   adapter doesn't, neither affects the other. Per-slot isolation
   doctrine locked.

Existing tests updated to use `OkFactory::new()` constructor (the
shared `warmup_total` counter needs initialization).

## Doctrine fit

- [[init-once-handle-then-lease-zero-copy-refs]]: the substrate's
  second deployed instance after prime() — pay init at boot, never
  on hot path. Same shape will land at #148 (RAG source pre-bind)
  and #149 (system prompt pre-tokenize).
- [[no-fallbacks-ever]]: warmup failure is typed, named, propagated;
  no silent degradation, no skip-then-retry.
- Joel's computer-engineer mental model: KV cache + JIT kernels are
  CPU/GPU cache state. Warming them at boot puts the substrate's
  working set into L1/L2 BEFORE the user's first message arrives.

## Cost on LCD tier (qualitative, pending #150 metric capture)

Intel Mac + Qwen 0.5B CPU-only: first generate_text cold-cost ~200-500ms
above warm-cost. Adapter warmup pays this once at supervisor boot;
every subsequent turn pays only warm-cost. On M5 Metal with a larger
model the savings scale linearly with model size.

Closes #147. Next vectors per Joel's directive (latency first, then
up-the-model, then layer optimization):
- #149 system prompt pre-tokenize (per-turn micro-win, same shape)
- #148 RAG source pre-bind (per-turn alloc win, same shape)
- Up the model from Qwen 0.5B once latency floor is solid

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

* refactor(persona/ai): pull throwaway test scaffolding into system-level primitives (#154)

Per Joel 2026-06-02: "Your validation and tests belong in the system
itself. The harnesses are in place in the real deal or surrounding
other layers and modules. You gotta think LONG term and make these
elegant too. It's why we had record and repeat of live persona and rag.
Can't be done without. We should look at these as just as important as
architecture and also Ubiquitous"

Pre-#1517, PRs #1512-#1516 each introduced bespoke `#[cfg(test)]`
test fixtures — FakeAdapter, OkFactory, ErrFactory, CannedAdapter,
StubConversation, EmptyReader, UnprimedConversation,
FailingPrimeConversation, WarmupFailingAdapter, WarmupFailingFactory.
Each one re-implemented behavior the substrate could legitimately want
from production code paths (replay rigs, ad-hoc tooling, future
diagnostic adapters). That's the scaffolding cancer this PR refuses.

Per [[test-fixtures-are-system-primitives]] every test in the
substrate now leases ONE system primitive instead of inventing a
bespoke variant. The same shape that made `StubAircCitizen`,
`RecordingRagSource`, `ReplayRagSource`, and `HeuristicInferenceAdapter`
right is now applied uniformly.

## New / extended system primitives

### `ai/heuristic_adapter.rs` (extended)

`HeuristicInferenceAdapter` gains opt-in builder methods:
- `.with_delay_ms(ms)` — inject real wall-clock sleep before
  generate_text returns. Production callers use `new()` and pay zero.
  Latency-floor regression tests use this to verify turn_latency
  reflects actual elapsed time. Future simulated-network adapters
  (cross-grid inference, etc.) use this for realistic modeling.
- `.with_warmup_failure(reason)` — make warmup() return Err.
  Exercises `SupervisorError::AdapterWarmup` per [[no-fallbacks-ever]].
- `.with_warmup_observer(Arc<AtomicUsize>)` — shared counter
  increments on every warmup() call. Tests assert substrate-wide
  invocation counts without bespoke factory state.
- `.with_generate_observer(Arc<AtomicUsize>)` — same shape for
  generate_text. Counts substrate-side hot-path inference calls.

### `persona/scripted_adapter_factory.rs` (new)

`ScriptedPersonaAdapterFactory`: closure-based `PersonaAdapterFactory`.
Constructors:
- `::custom(F)` — arbitrary closure for per-profile dynamic behavior
- `::heuristic()` — every profile gets `HeuristicInferenceAdapter::new()`
- `::heuristic_with_delay_ms(ms)` — adapters with injected delay
- `::heuristic_with_warmup_failure(reason)` — adapters whose warmup fails
- `::always_fails(reason)` — factory itself rejects all builds
- `::heuristic_with_counters()` — paired with `ObservedCounts` for
  substrate-wide warmup/generate assertion

`build_count()` exposes the per-factory invocation count.

`ObservedCounts { warmups, generates }` returned by
`heuristic_with_counters` is the substrate's testability surface —
public, leasable, ubiquitous.

### `persona/scripted_conversation.rs` (new)

`ScriptedConversation`: configurable `PersonaConversation`.
Builder pattern:
- `.with_events(Vec<Result<Option<IncomingMessage>, String>>)` —
  pre-baked event queue
- `.with_high_water(u64)` — pre-attach history mark
- `.with_prime_failure(reason)` — make prime() return Err
- `.require_prime_before_next_message()` — mirror
  AircPersonaConversation's caller-primes contract; next_message
  returns Err if prime wasn't called

Observable surface:
- `.primed_count()` — assert prime() invocation count
- `.said()` — snapshot of all `say()` text in order

### `persona/airc_citizen.rs` (extended)

`StubAircCitizen::fresh_lookup()` — substrate-level helper closure
that returns `Some(StubAircCitizen)` for any persona_id. Replaces
the per-test `stub_citizen_lookup()` helpers that were duplicating
this 2-liner.

### gating

`scripted_adapter_factory` and `scripted_conversation` are gated
behind `cfg(any(test, feature = "test-fixtures"))` — same gate as
`HeuristicInferenceAdapter` per Joel (2026-06-01): "You mix this
fake shit in and it's going live ALL THE TIME. The fake shit is a
CHOSEN model adapter no other form. Declaration." cfg gating IS
the declaration.

## Test module rewires

### `persona/supervisor.rs`

Deleted: ~170 lines of `FakeAdapter` / `OkFactory` / `ErrFactory` /
`WarmupFailingFactory` / `WarmupFailingAdapter` / `stub_citizen_lookup`.

Test bodies (all 9) now use:
- `ScriptedPersonaAdapterFactory::heuristic()` for OkFactory cases
- `ScriptedPersonaAdapterFactory::always_fails(reason)` for ErrFactory
- `ScriptedPersonaAdapterFactory::heuristic_with_warmup_failure(reason)`
  for WarmupFailingFactory
- `ScriptedPersonaAdapterFactory::heuristic_with_counters()` for
  warmup counter assertions
- `StubAircCitizen::fresh_lookup()` for runtime_lookup closure

### `persona/service_loop.rs`

Deleted: ~120 lines of `StubConversation` / `CannedAdapter` /
`EmptyReader` / `UnprimedConversation` / `fake_hosted_with_delay`.

Test bodies (all 8) now use:
- `ScriptedConversation::new().with_events(...).with_high_water(N)
  .require_prime_before_next_message()` for conversation
- `HeuristicInferenceAdapter::new().with_delay_ms(ms)` for adapter
- `StubAircCitizen::new(...)` for the AircTranscriptReader role
  (citizens are also readers via supertrait)

`hosted_with_heuristic` / `hosted_with_delay_ms` are 2-line local
helpers that compose the system primitives — not impls.

### `persona/airc_persona_conversation.rs`

Already clean (only uses `StubAircCitizen`). No changes.

## Test plan (verified)

- [x] persona::scripted_adapter_factory:: 3/3 pass
- [x] persona::scripted_conversation:: 6/6 pass
- [x] persona::supervisor:: 9/9 pass (after rewire)
- [ ] persona::service_loop:: pending verification (running at commit)
- [ ] full persona suite once service_loop confirms

## Follow-up

`runtime/command_executor.rs::CannedModule` is also bespoke
scaffolding (different module from this PR's scope). File a follow-up
task to apply same doctrine to the runtime layer.

Closes #154.

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

* test(persona): multi-persona stress baseline — substrate adds 1-3ms; LLM dominates (#156)

Per Joel 2026-06-02: substrate must run well on M5 with 6-12 personas
in video chat; on Intel Mac at least functional for multiple personas;
on typical M-series decently useful + intelligent. Need DATA before
guessing at latency vectors. Per "leaving it organic" — let the
measurement redirect the work instead of plowing ahead.

Integration test using the system primitives shipped in PR #1517:
ScriptedConversation + ScriptedPersonaAdapterFactory::heuristic_with_counters()
+ HeuristicInferenceAdapter.with_delay_ms(50). Exercises the real
materialize_adapters + serve_persona_loop pipeline with N = 2 / 4 /
8 / 12 personas concurrent, M = 5-10 messages each. tokio multi-thread
runtime, 4 worker threads.

## Measured (Intel Mac, 2026-06-02)

| N x M     | Materialize | Serve wall | Mean turn | Max turn |
|-----------|-------------|------------|-----------|----------|
| 2 x 10    | 0 ms        | 521 ms     | 51.6 ms   | 53 ms    |
| 4 x 10    | 0 ms        | 521 ms     | 51.6 ms   | 53 ms    |
| 8 x 5     | 0 ms        | 270 ms     | 51.5 ms   | 61 ms    |
| 12 x 5    | 0 ms        | 270 ms     | 51.7 ms   | 61 ms    |

Adapter delay was 50ms (injected). Substrate adds 1.5-3 ms per turn
under contention. Throughput scales linearly with persona count.
p100 tail latency is 61ms (only 11ms above floor).

## Implications captured in [[substrate-overhead-is-1to3ms-LLM-dominates-latency]]

1. The substrate IS NOT the bottleneck. Real Qwen 0.5B inference is
   1000-15000 ms per turn (live trace). Substrate is 0.02-0.3% of
   total.

2. #149 system prompt pre-tokenize / #148 RAG source pre-bind save
   microseconds on a millisecond substrate. Not worth grinding until
   LLM gen shrinks.

3. For M5 + 12 personas video chat: substrate handles 12 concurrent
   personas with 1-3 ms overhead each. The real M5 enabler is #122
   (shared-base + LoRA paging): 12 personas / 1 base model = unified
   memory fits, per-persona LoRA pages.

4. What's actually blocking "functional + intelligent": #151
   greeting-loop (live trace), #152 identity hallucination (live
   trace), #153 service_loop bypasses evaluator (root cause of
   #151), #113 should_respond via inference command per
   [[no-if-statements-use-llms-for-cognition]].

## Pivot

Pause latency-vector grinding (#149, #148). Pivot to:
- #113 should_respond via inference command (fixes greeting-loop)
- #152 identity grounding via chat template
- #122 shared-base + LoRA paging (M5 enabler)

## How to run

cargo test --test multi_persona_stress_baseline
    --no-default-features
    --features livekit-webrtc,llama/mac-cpu-only,test-fixtures
    -- --nocapture

The --nocapture is load-bearing — eprintln stress::* lines are the
data; assertions verify structural invariants only.

Closes #156.

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

* feat(persona): persona decides + responds via LLM in ONE structured call (#113)

Per Joel 2026-06-02 ("113, use real LLMs. We can't know if we use fake
algorithms. Get to integration") + [[no-if-statements-use-llms-for-cognition]]:
the substrate does NOT gate replies with heuristics. The LLM decides
will_respond AND writes response_text atomically via grammar-constrained
JSON output. One LLM call per turn. No heuristic should_respond gate.
No echo-storm filter at the substrate level.

## What changed

`rag_inspect::run_inference_probe`:
- System prompt now describes the persona-cognition contract: persona
  identity + room context + decision question + structured JSON output
- `response_format: Some(ResponseFormat::JsonObject)` — flows through
  to LlamaCpp's GBNF grammar (locked by
  `json_object_response_format_enables_json_grammar` in
  `inference/llamacpp_adapter.rs`). The sampler can ONLY emit valid
  JSON. Substrate-enforced structural contract per
  [[no-fallbacks-ever]].
- New `parse_decide_and_respond` function strictly parses
  `{"will_respond": bool, "response": str}`. Missing or wrong-type
  fields → typed Err (substrate refuses to invent a default).

`ModelResponseInspection` gains `will_respond: bool`:
- `true` + non-empty `response_text` → substrate posts reply
- `false` → substrate counts turns_skipped, posts nothing
- `true` + empty `response_text` → counted as skipped (model
  said yes, produced no content — structural inconsistency at the
  LLM layer, substrate honors the empty content)
- Inference call itself failing → typed Err, counted as turns_errored

`service_loop::serve_persona_loop_inner`:
- Checks `mr.will_respond` before posting. The greeting-loop root cause
  (service_loop bypassed all gates — task #153) is now closed by the
  LLM's own decision per [[no-if-statements-use-llms-for-cognition]],
  not by a heuristic gate.

`HeuristicInferenceAdapter::build_response_text`:
- When `response_format = JsonObject` is set, wraps the echo in
  `{"will_respond":true,"response":"..."}` so substrate plumbing
  validates end-to-end without a real LLM. Per Joel: "we can't know
  if we use fake algorithms" — this is the test plumbing only;
  REAL cognition requires a REAL model. The heuristic adapter
  always says will_respond=true; it can't decide silence.

## Doctrine

- [[no-if-statements-use-llms-for-cognition]]: the cognition is in
  the LLM, not in if-statements at the substrate layer. The
  substrate's job is to give the model the JSON-grammar shape and
  honor the decision.
- [[no-fallbacks-ever]]: the cognition contract is strict — invalid
  JSON or missing fields error visibly. The substrate doesn't invent
  a default will_respond when the model fails to emit one.
- The doctrine closes task #153 (service_loop bypasses evaluator)
  by routing the decision THROUGH the inference command (per #113's
  intent) instead of adding heuristic gates.

## Risks for live integration

- Qwen 0.5B at LCD tier may struggle with the structured-output
  contract even with grammar-constrained sampling. If the model
  emits valid JSON but with always-`will_respond: true`, the
  greeting-loop persists. That's a model-quality issue, not a
  substrate issue.
- If Qwen 0.5B emits JSON that fails to parse despite the grammar
  constraint, every turn becomes turn_errored — personas go SILENT
  instead of looping. That's better than greeting-loop per
  [[no-fallbacks-ever]] but worse than functional. Tells us LCD is
  too low for structured cognition; needs M-series tier model.

## Test plan

- [x] cargo test --lib ... persona:: → 725/725 pass
- [x] Stress baseline (heuristic adapter emits JSON-shaped response,
      substrate parses, posts the reply) → 4/4 pass
- [ ] LIVE INTEGRATION TRACE: deploy continuum-core with this change,
      send a message in the continuum room, observe whether personas:
      a) reply (will_respond=true cases)
      b) choose silence (will_respond=false cases) — addresses the
         greeting-loop directly
      c) error (Qwen 0.5B fails to produce structured output)

Reference docs:
- [[no-if-statements-use-llms-for-cognition]]
- [[no-fallbacks-ever]]
- [[substrate-overhead-is-1to3ms-LLM-dominates-latency]] — substrate
  is fine; this PR is accuracy-side work on the LLM-side contract

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

* feat(scripts): repeatable headless start — scripts/start-server.sh + npm run start-server

Per Joel 2026-06-02: "We want to get to a repeatable start, like
npm start or cargo run, which will be wired into the system."

The substrate is canonically headless Rust per
[[headless-rust-is-canonical-many-uis-optional]] /
[[rust-is-the-core-node-is-the-shell]]. npm start was bringing
Node, TS build, widgets, the kitchen sink. start-server.sh runs
only the headless Rust binary.

## What it does

- Sources ~/.continuum/config.env (same as parallel-start.sh)
- Sets ORT_DYLIB_PATH (same as parallel-start.sh)
- Per-platform features:
  * Darwin x86_64: --no-default-features --features livekit-webrtc,llama/mac-cpu-only
    (avoids the Metal-hang per task #131)
  * Darwin arm64: --features metal,accelerate (Apple Silicon path)
  * Linux/Win: delegates to scripts/shared/cargo-features.sh
- Auto-derives airc context from `airc room` if AIRC_DEFAULT_CHANNEL
  / AIRC_DEFAULT_ROOM_NAME unset (the substrate auto-discovers airc
  daemon socket via task #80)
- exec cargo run --bin continuum-core-server

No Node. No TS build. No widget orchestrator. Just the substrate.

## Usage

  bash scripts/start-server.sh                       # debug, fast iterate
  CONTINUUM_RELEASE=1 bash scripts/start-server.sh   # release
  CONTINUUM_SOCKET=/path bash scripts/start-server.sh

Or via npm:
  npm run start-server

## Test plan

- [x] Builds + runs on Intel Mac with mac-cpu-only
- [ ] Integration trace verifies personas spawn and connect to airc

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

* fix(start-server): auto-derive AIRC_DAEMON_SOCKET when airc binary predates `ipc-endpoint`

Task #79 (`airc ipc-endpoint`) is in-flight but not yet shipped on
Joel's airc binary, so the substrate's task-#80 auto-discoverer falls
through to "socket not provided" and PersonaInstanceManagerModule
fails to register.

Fallback: scripts/start-server.sh picks the persistent per-machine
daemon socket at `~/.airc/runtime/airc-machine-*-v5.sock` (most
recently modified — that's the live daemon). Excludes session-scoped
sockets and `.lock` companions. Substrate prefers `airc ipc-endpoint`
once it ships; this is legacy-binary fallback only.

Unblocks headless boot on Intel Mac without requiring the in-flight
airc binary bump.

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

* fix(persona): coherent LLM cognition on real airc — fix three substrate bugs blocking it (#113, #157)

Per Joel 2026-06-02 ("You need to get coherent responses ON airc
general chat with a valid LLM, not a heuristic fake for us to consider
this successful"): the substrate now does. Real Qwen 2.5 0.5B
Instruct on Intel Mac CPU. Posted to airc general:

  peer 18c04c5b (Paige's identity disc) → continuum room:
  "Hi, my name is Paige. I'm here to assist you with any questions
   or concerns you have today! Please feel free to ask me anything."

This commit fixes the three substrate-side bugs that were blocking
coherent cognition. None of them were the model.

## Bug 1 — Budget reservation hardcoded for 32k contexts

`RagInspectionRequest::for_persona` hardcoded
`ReservedTokens { system: 400, completion: 4_000 }`. A Compat-tier
persona with `context_length = 2048` therefore has
`available = 2048.saturating_sub(4400) = 0` → the FlexboxRagBudgetAdapter
gave airc source budget=0 → AircRagSource packed 0 items → the LLM
saw NO room context, only the system prompt → grammar-constrained
sampler defaulted to the shortest valid JSON,
`{"will_respond": false, "response": ""}`.

Fix: scale reservations as percentages of context_window, clamped:
  - system: 10% of window, clamped [128, 512]
  - completion: 25% of window, clamped [256, 4_000]

For 2048 ctx: reserved = (204, 512), available = 1332. For 32768
ctx: reserved = (512, 4000), available = 28256. Both sensible.

## Bug 2 — pack_within_budget dropped the NEWEST events

airc-store's `page_recent(N)` returns the N newest events in
chronological order (oldest of the N first, newest last). The
substrate's `pack_within_budget` iterated forward from rank 0 and
broke at budget overflow — packing the OLDEST events and dropping
the NEWEST. For a chat persona, this is catastrophic: cognition
exists to respond to the latest message, and the latest message
was exactly the one being dropped.

Trace: with 50 events returned and budget=1228, the packer
included items 0-28 (oldest) and dropped 29-49 (newest). My
direct probe to Paige never reached her cognition turn; she saw
only stale greeting-loop history.

Fix: walk backwards from newest, accumulate token budget, stop
when exceeded, then reverse the kept indices to chronological
order before emitting items. Continuation cursor semantics
preserved.

## Bug 3 — Qwen 0.5B copy-pasted the system prompt's example

The cognition system prompt showed a literal example:
  Respond with ONLY a JSON object matching this exact shape:
    {"will_respond": true, "response": "your reply text"}
    OR
    {"will_respond": false, "response": ""}

Qwen 0.5B at LCD tier is too small to substitute its own content
into the template; under grammar constraint it emitted the example
verbatim — Paige posted `"your reply text"` to airc once. Classic
tiny-model few-shot copy failure.

Fix: describe the schema in prose, no literal example. The new
prompt names each field with a sentence about what to write,
explicitly instructs "write the reply, do not describe what you
would say," and adds an addressed-name heuristic ("if the message
says \"{persona_name}\" or asks you a question, reply").

## Plus: diagnostic tracing per [[observability-is-half-the-architecture]]

- `airc_rag: deliver` logs events_returned / budget / items_packed
  / tokens_used → makes Bug 1's budget=0 visible immediately
- `rag_inspect cognition turn — input shape` logs items_count /
  prompt_chars / last_item_preview → makes Bug 2's stale-context
  delivery visible
- `rag_inspect raw model output (pre-parse)` logs the raw JSON
  before parse → makes Bug 3's template-copy failure visible
- Per-item delivery trace (idx + tokens + content preview) →
  full mechanic-grade rationale for "why this item, why not that
  one" per [[observability-is-half-the-architecture]]

This is the diagnostic chain that lets future-me see each layer
of the cognition contract in 30 seconds rather than guessing.

## Doctrine

- [[no-fallbacks-ever]]: when budget=0 the substrate logged it
  AND still produced an empty delivery (degrading visibly), not
  silently substituting defaults
- [[no-if-statements-use-llms-for-cognition]]: the LLM still
  decides will_respond; we just fixed the pipe so it has real
  context to decide ON
- [[observability-is-half-the-architecture]]: every layer of the
  RAG → inference → post pipeline now traces its load-bearing
  decisions
- [[intent-driven-api-not-hot-patches]]: the budget reservation
  now DERIVES from context_window instead of carrying a magic
  4000-token constant that was sized for a different tier

## Risks

- Per-item trace at INFO is verbose (30 lines per cognition turn).
  Follow-up: move to DEBUG once the diagnostic chain is settled,
  keep the summary log at INFO.
- LCD-tier latency: 87s for 42 output tokens on Intel CPU. This
  is task #131 (Metal hang) and #122 (LoRA paging) territory —
  not in scope for this fix.
- Coherence quality is generic-customer-service-y; that's Qwen
  0.5B's instruction-tuned voice. role_template ladder ready for
  Qwen 1.5B / 3B uplift.

## Test plan

- [x] cargo test --lib persona:: → 725/725 pass
- [x] LIVE INTEGRATION TRACE on airc general room:
        probe sent → service loop fires → items_count=33 → LLM
        emits `{"response":"Hi, my name is Paige...","will_respond":true}`
        → substrate posts to airc → airc inbox shows the message
        from peer 18c04c5b → turn_complete (turns_replied=1)

Closes #157.

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

* chore(persona): doctrine — budget belongs to the model, not the substrate constants (#158, #159)

Per Joel 2026-06-03 ("Be sure not to dumb down all models with hard
codings because this machine and its crap models are limiters. Think
of the 5090 too. Think of million or hundreds thousand context
windows. It's up to the model... This is called our budgeter logic.
Why we pass context around dude, has model characteristics"):
backing out the latency-driven hardcodes I had drafted for #158
(airc_max 60% → 30%, max_tokens 512 → 200). Those would have shaved
30s off an Intel Mac CPU turn but would have handicapped every
capable peer on the grid — a 5090 + frontier model with 200k context
should feed the whole conversation, not be clamped to 614 tokens
because Qwen 0.5B is slow.

What this commit DOES change:

- `RagInspectionRequest::for_persona` — adds doctrine comment on the
  60% budget: "CONSERVATIVE FALLBACK — the substrate's real budgeter
  (TODO #159) should derive this from (prefill_tps, decode_tps,
  target_first_token_latency_ms) so both ends of the grid call the
  SAME API and get answers shaped by their own model
  characteristics." Behavior unchanged vs HEAD.
- `run_inference_probe` max_tokens=512 — same doctrine comment.
  Behavior unchanged vs HEAD.
- Cognition system prompt — strengthened. Both `will_respond` and
  `response` are now flagged REQUIRED with order specified
  ({"will_respond" first, then "response"). The latency-test turn
  showed Qwen 0.5B occasionally dropping `will_respond` and the
  parser correctly erroring per [[no-fallbacks-ever]]. Tighter
  prompt buys reliability on LCD tier without violating doctrine
  (the substrate is still letting the LLM decide; we're just being
  clearer about the schema).
- Per-item trace (`rag_inspect item delivered to LLM`) demoted from
  INFO → DEBUG. Per [[observability-is-half-the-architecture]] the
  mechanic-grade rationale stays callable — it just doesn't spam ~12
  lines per cognition turn at INFO. Light it up with
  `RUST_LOG=continuum_core::persona::rag_inspect=debug`.
- `airc_rag: deliver` log demoted INFO → DEBUG — same reasoning.

What this commit DOES NOT change:

- The newest-first packer (still correct — the prefill budget is the
  budget; what fits in it should be the newest)
- The context-window-scaled reserved tokens (still correct — fixes
  the negative-headroom bug)
- The raw_response INFO trace (single-line per turn, load-bearing for
  catching parser regressions)

Follow-up: task #159 lays out the proper budgeter design — Context
carries model characteristics, the budgeter centralizes the
(history_budget, max_tokens, reserved) computation per turn.

## Doctrine

- [[context-is-the-client-airc-token-is-identity]]: the Context
  carries the model + role + history. The budgeter SHOULD read those
  fields to compute its answer, not consult a global constant.
- [[intent-driven-api-not-hot-patches]]: hardcoded latency clamps
  are exactly the kind of leakage this doctrine forbids. Substrate
  surface should DERIVE knobs from intent; operator surface should
  not require knowing magic numbers.
- [[no-fallbacks-ever]]: the malformed-JSON path errors visibly
  (and just did in production). Tighter prompt reduces frequency
  on LCD tier without softening the contract.

## Test plan

- [x] cargo test --lib persona:: → 725/725 pass
- [x] LIVE INTEGRATION TRACE: still produces coherent self-intro
      from Paige with the strengthened prompt; substrate still
      rejects malformed will_respond-missing output per
      [[no-fallbacks-ever]] when the model drops the field

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

* feat(persona): brain.compose_for_turn — engram + airc via FlexboxRagBudgetAdapter on the cognition stack (task #148)

Per Joel 2026-06-03 ("Stop killing our intelligent brain. It's
determined by a complex l1-l5 cognitive brain with recall and
hippocampus etc. rag budget don't you dare skip past the damn brain.
You defeat the entire purpose of building an ai. Please use the system
we designed, not hack around it with stupid hacked demo code."): the
brain — PersonaCognition in `unified.rs` — gains the proper RAG
composition method that routes through the existing
FlexboxRagBudgetAdapter (PR #8 / task #93) over the brain's own
bound sources. ZERO new budgeter. ZERO parallel allocator. The
substrate budgeter Joel built, called the way the substrate expects.

## What changed

`PersonaCognition` (unified.rs):

- Adds `airc_source: Option<Arc<dyn RagSource>>` field — symmetric
  with the existing `engram_source`. The two first-class RAG sources
  are now siblings on the brain. `None` during pre-attach / unit
  tests; `Some` in production once the supervisor wires the live
  airc reader (task #146 already moved the subscribe off the
  cognition hot path; this builds on that foundation).
- Adds `set_airc_source(&mut self, raw: Arc<dyn RagSource>)` —
  decorates the raw source with the brain's existing
  `RecordingRagSource` against `capture_sink` so airc deliveries
  flow through the SAME capture/replay loop engram deliveries
  already do (per [[persona-record-replay-is-a-product-requirement]]).
- Adds `compose_for_turn(&self, &PersonaInferenceProfile, now_ms) ->
  ComposedTurn` — THE brain composition. Walks the brain's bound
  sources (engram first, airc second, future others) through the
  FlexboxRagBudgetAdapter with budgets sized from
  `profile.context_length`. Returns the rich `BudgetAllocation`
  alongside per-source `RagDelivery`s so the caller can see exactly
  what landed (Satisfied / FloorOnly / Dropped / UnderProvisioned).
  Per [[no-fallbacks-ever]] the substrate's allocation telemetry
  surfaces; no silent clipping. Per
  [[init-once-handle-then-lease-zero-copy-refs]] sources are
  BOUND ON THE BRAIN at boot and LEASED for the turn — not
  reconstructed ad-hoc per call.
- Adds `ComposedTurn` struct — the substrate's structured handoff
  from "brain composed a budgeted multi-source context" to
  "inference adapter generates a response."
- Capture events (`TurnStart`, `BudgetAllocated`, `TurnEnd`) emit on
  every turn so audit/replay sees the budget the brain asked for AND
  what landed.

## Doctrine

- [[no-fallbacks-ever]]: allocator telemetry surfaces every source's
  state. No clipping, no silent substitution.
- [[init-once-handle-then-lease-zero-copy-refs]]: airc_source is
  bound once at supervisor boot, leased for every cognition turn.
- [[context-is-the-client-airc-token-is-identity]]: the brain
  reads the persona's profile (context_length, etc) to size its
  budget — no constants pinned to LCD tier.
- [[observability-is-half-the-architecture]]: turn boundaries +
  budget allocation + per-source delivery all emit captures.
- [[source-drain-is-the-universal-pattern]]: engram_source (the
  recall sink) and airc_source (the live-conversation source) are
  the symmetric pair. The brain holds both.

## What this is NOT

This commit does NOT touch service_loop. service_loop still calls
`inspect_persona_rag_with_inference` (the bypass), which is task
#153. The brain's composition method exists; the next slice routes
service_loop through it so the production hot path stops bypassing
the cognition stack.

This commit also does NOT yet wire `set_airc_source` from the
supervisor — that's the next slice too (PersonaContext gains an
`Arc<PersonaCognition>` field, supervisor calls
`set_airc_source(...)` after AircCitizen attaches).

## Test plan

- [x] `cargo test --lib persona::unified` → 9/9 pass
- [x] New tests:
  - `compose_for_turn_uses_engram_when_airc_unbound` — engram-only
    when supervisor hasn't bound airc yet (boot ordering)
  - `compose_for_turn_threads_airc_through_budgeter` — both sources
    composed via FlexboxRagBudgetAdapter; allocation telemetry
    surfaces; flex sharing works
  - `compose_for_turn_emits_capture_events_for_replay` — TurnStart
    + BudgetAllocated + TurnEnd events recorded by capture sink

Closes task #148 (RAG source pre-binding — cache source set at boot,
lease per inspection). Unblocks task #153 (service_loop rewire).

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

* docs(architecture): PERSONA-COGNITION-PIPELINE — anchor doc against amnesia

Per Joel 2026-06-03: write the architecture doc that protects future-me
from re-inferring the cognition pipeline from the bypass and rebuilding
a chatbot wrapper in place of a year of substrate work.

The doc pins:

- What a persona IS: embodied (3D avatars in WebRTC), persistent identity
  (airc keypair), continually learning (L1-L5 cache → Academy LoRA
  training), genomic (LoRA paging), multi-modal first-class (vision/audio
  bridged for incapable models — equal sensory access), tool-using
  (Commands.execute), specialty-based, self-organizing.

- The cognition cycle that ALREADY EXISTS in cognition/:
  admission.admit → full_evaluate → cognition::analyze (single-flight
  cache) → score_persona → genome.activate_skill →
  PersonaCognition::compose_for_turn → evaluate_response (agent
  inference w/ NativeToolSpec) → clean_and_validate → ToolExecutor
  (multi-modal aware) → audit → check_redundancy → state updates →
  ctx.runtime.say.

- service_loop's actual job: drive turns through the brain. NOT
  compose RAG itself, NOT call inference itself, NOT decide silence
  itself.

- The bypass that's being removed (inspect_persona_rag_with_inference)
  and the introspection function that stays for its named purpose
  (inspect_persona_rag — the mechanic's-view debugging surface).

- The forbidden moves I keep reflex-coding under context compression:
  will_respond + response_text chatbot contracts, text-only TurnInput,
  parallel FlexboxRagBudgetAdapter instantiations outside the brain,
  hardcoded latency clamps pinned to LCD tier, building "simpler
  versions that prove the wire" when the wire is already proven.

- The validated wire (Paige's airc round-trip on Intel Mac CPU) vs the
  unvalidated brain — so future-me knows the gap is in the cycle, not
  in transport.

- The "where new code lands" table — one file per concern. Doc is
  updated in the SAME commit that moves the territory.

CLAUDE.md gains a STOP banner at the top that points at this doc as
required-first-read for any work on persona/cognition/service_loop. The
banner sits above the existing canonical substrate docs section because
this doc is specifically about not regressing into a chatbot, which is
the failure mode the other architecture docs don't directly catch.

This doc is the anchor. If a future commit moves files or renames verbs,
update this doc IN THE SAME COMMIT. An outdated anchor is worse than no
anchor.

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

* feat(persona): PersonaContext gains the brain — Arc<Mutex<PersonaCognition>> per persona (slice 1B of #160, #148)

Per docs/architecture/PERSONA-COGNITION-PIPELINE.md (the anchor doc):
each persona has her OWN brain. PersonaContext now carries it.

## What changed

`PersonaContext` (a.k.a. `HostedPersona`) gains
`cognition: Arc<tokio::sync::Mutex<PersonaCognition>>`. Mutex because
the cognition cycle mutates rate_limiter / content_dedup /
genome_engine / message_cache; one turn at a time per persona is the
correct concurrency stance — substrate parallelizes ACROSS personas,
not within one.

`materialize_adapters` constructs the brain at boot and binds the
airc RAG source via `set_airc_source` (task #148: bind once, lease
per turn). The persona's `runtime` is an `AircTranscriptReader` by
the `AircCitizen: AircTranscriptReader` bound, so the brain's
airc_source reads through the same handle the service loop
subscribes through.

`airc_chat_demo.rs` does the same wiring directly since it bypasses
the supervisor.

`service_loop.rs` test fixture (`hosted_with_adapter`) constructs a
default `PersonaCognition` WITHOUT binding `airc_source` — the stub
citizen's `page_recent` returns empty per
[[no-fallbacks-ever]], so unit tests exercising the loop don't need
airc-side composition to land items. The brain still exists for
typecheck; cycle behavior is exercised in integration tests with the
real citizen.

## What this does NOT change

`service_loop.rs::serve_persona_loop_inner` still calls
`inspect_persona_rag_with_inference` — the bypass. Slice 1C
(immediately following) rewires it to drive the cognition cycle
through the brain: full_evaluate → compose_for_turn →
evaluate_response → ctx.runtime.say. Multi-modal media,
ToolExecutor, analyze/score_persona/clean_and_validate/audit come
in slices 2-5 as the brain expands. See task #160.

## Test plan

- [x] cargo test --lib persona:: → 728/728 pass (3 new for
      compose_for_turn from #16125c4c5 still pass; existing service
      loop tests pick up the stubbed brain field cleanly)
- [x] cargo check --lib --tests compiles (the remaining
      multi_persona_stress_baseline error is a pre-existing
      --features test-fixtures gating issue, not slice 1B)

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

* docs(architecture): anchor doc gains model-adapter boundary + alignment thesis (per Joel directive)

Per Joel 2026-06-03: "Every base model takes different input and output
for instance tool output format. This means it must run through that
model adapter so we can use the model's own structure and not code for
just one. Wrap inference in and out in adapter calls. Same for media."

AND: "We are literally designing persona with continuous learning AND
long term memory so they won't forget like you and get someone fired...
Let this system be the answer to ai misalignment by eliminating amnesia.
Design a system that is better than you. Better than me."

Two new sections in PERSONA-COGNITION-PIPELINE.md:

§7.5 — Model adapters bear the translation. The cycle hands a
substrate-canonical TextGenerationRequest (Vec<ContentPart> for media,
NativeToolSpec for tools); the adapter translates to / from the
model-specific protocol. Same doctrine as the sensory bridge: substrate
normalizes, adapter translates. The forbidden move: baking one model's
contract (e.g. Qwen's preferred {will_respond, response} JSON shape)
into the cycle.

§7.6 — Why this matters. Stateless models end careers. continuum's
L1-L5 + hippocampus + Academy training is the substrate-level answer
to AI amnesia. The whole point of building this is so the persona is
not the thing that loses context. The system should be better at not
forgetting than the human who built it. Touch this code with that in
mind.

These sections live in the anchor doc (CLAUDE.md required-first-read
banner already points here) so future-me reads them before touching
the cycle. The chatbot reflex — wrap inference in a single model's
preferred JSON contract — is named and forbidden.

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

* feat(persona): service_loop drives the brain through the canonical respond() cycle — bypass removed (slice 1C of #160, closes #153)

Per docs/architecture/PERSONA-COGNITION-PIPELINE.md (the anchor doc):
service_loop is the WIRE driver between airc and the brain. It is NOT
the cognition surface. The brain's per-persona cognition cycle —
shared analyze + specialty scoring +…
joelteply added a commit that referenced this pull request Jun 6, 2026
…ion) (#1535)

* perf(persona): drop per-turn format!()+lowercase — use canonical RoleId::as_str() (#195 slice 3)

Slice 3 of task #195 (inference latency perfection campaign).

Pre-slice-3, `serve_persona_loop_inner` did, every turn:

```rust
specialty: format!("{:?}", ctx.role).to_lowercase(),
```

Two allocations, a variadic-macro dispatch through derived-Debug,
and a Unicode lowercase walk — all to produce a value `RoleId`
already exposes via its canonical `as_str() -> &'static str`
method (in `role_template.rs`, pinned at compile time).

## What ships

Switch the per-turn read from the Debug+lowercase chain to
`ctx.role.as_str()`:

```rust
let respond_input = RespondInput {
    persona: PersonaSlot {
        // was: format!("{:?}", ctx.role).to_lowercase()
        specialty: ctx.role.as_str().to_string(),
        /* ... */
    },
    /* ... */
};
```

Per-turn cost drops from `format!()` (variadic macro + Debug
formatter + heap alloc) + `.to_lowercase()` (second alloc +
Unicode lowercase walk) to a single `String::from` of a static
`&'static str`. The source IS the cache — no field on
`PersonaContext`, no helper, no Arc plumbing.

## Why this shape (not a cache)

Initial draft of slice 3 added `PersonaContext.specialty: Arc<str>`
populated by a `build_persona_specialty(role)` helper that pre-
baked the Debug+lowercase output. Adversarial review (3 agents)
correctly identified two problems:

1. **Caching the wrong source.** `RoleId::as_str()` already exists
   as the documented, intentionally-stable specialty derivation
   (kebab-case identifier, pinned by an explicit `match` so
   renames are deliberate). Caching the Debug+lowercase output
   couples the prompt-assembly contract to the derived-Debug
   format — a future contributor adding a custom Debug or
   wrapping the enum silently breaks the specialty string with
   no test failure.
2. **Caching test was a tautology.** The helper was
   `Arc::from(format!("{:?}", role).to_lowercase())` and the test
   compared its output to `format!("{:?}", role).to_lowercase()`
   — comparing the helper to its own implementation. A buggy
   helper using `.to_uppercase()` would have passed.

The revised slice picks the right source and the right
contract: use `role.as_str()` directly. No cache needed because
the static str pointer IS already pre-computed at compile time.
The behavior-preservation test (below) is non-circular: it
compares the new direct path (`role.as_str()`, a hand-curated
match in role_template.rs) to the pre-slice-3 derived-Debug
chain.

## Test (+1 new)

`persona::service_loop::tests::role_as_str_preserves_pre_slice3_specialty_format_for_each_role`:

  - Pins that for every `RoleId` variant (Helper, Coder,
    Sentinel, Custom), `role.as_str()` produces byte-identical
    output to the pre-slice-3 `format!("{:?}", role).to_lowercase()`.
    Non-circular: two independently-derived strings. A future PR
    adjusting either `as_str()` or adding a variant where the
    two paths disagree must update this test to record the
    intentional divergence — silent drift breaks loudly.
  - Compile-time exhaustiveness: a closure-typed
    `|role: RoleId| match role { ... }` with NO wildcard arm
    forces a new RoleId variant to be added here AND to the
    `variants` array. Cosmetic-exhaustiveness defeats from the
    initial draft (matching on a literal `RoleId::Helper`) are
    fixed.

## What this slice does NOT do (deliberate)

- No `PersonaContext.specialty` field (initial draft removed
  per review). The original goal was reducing per-turn cost;
  `role.as_str()` already gives that with zero field bloat.
- No `display_name` change — `String::clone` of a fixed-per-
  session name is the same per-turn cost whether we cache or
  not, so the smell is RespondInput's `String`-typed field, not
  the source. Lift in a follow-up when `RespondInput`'s type
  changes (#149-adjacent).
- No prompt-template change — substrate keeps the existing
  specialty-string contract verbatim; the migration is
  provably behavior-preserving.

## Doctrine

- `[[init-once-handle-then-lease-zero-copy-refs]]` — the
  canonical "init-once" here is the compile-time `match` in
  `RoleId::as_str()`; per-turn cost is a `&'static str` deref +
  one `String::from` (memcpy of 6-9 static bytes). Doesn't get
  cheaper without changing `RespondInput`'s type signature.
- `[[observability-is-half-the-architecture]]` — slice 1's
  `respond_latency` aggregate will tell us if this and the
  cumulative slice-2/3+ wins are moving the needle on real
  persona turns.
- `[[no-fallbacks-ever]]` — no graceful-degradation path; the
  behavior-preservation test breaks loudly if either side
  drifts.

card: 0d780926
parent task: #195
slice 1: #1532 (merged) — phase decomposition
slice 2: #1533 (merged) — cache system_prompt at construction

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

* feat(probes): JsonlProbeFileSink + RTOS-debugger manual + README/CLAUDE pointers (#151 foundation)

The substrate has the JTAG hardware (Slice P #176/#177): `probe!` /
`time_sync!` / `stack!` macros, `ProbeRouterLayer` (in-process
broadcast Layer), `ProbeStreamModule` (the `debug/probes/{class}/{open,
next,close}` URI consumer), and `UriCaptureLayer` (URI ancestry).
Zero usage sites in `persona/` or `cognition/` — the probes were
infrastructure waiting for application.

Per Joel 2026-06-06 `[[jtag-probes-are-rtos-debugger]]`: "We are
building an rtos. This is so complex we need to be able to have a
detailed understanding of what's going on, like a debug breakpoint,
in a way, to easily observe where the code and the surrounding vars
are, ones we want to inspect via probes, and timing of anything, so
we can hunt down bottlenecks."

This commit ships the FOUNDATION for that — the disk-persisted
breakpoint log + the manual that documents the method. The sprinkle
itself (probe calls inside `persona::response`,
`persona::prompt_assembly`, `cognition::shared_analysis`,
`persona::service_loop`) follows in subsequent commits using the
checklist in the manual.

## What ships

### `routing/probe_file_sink.rs` (new — 5/5 tests passing)

`JsonlProbeFileSink` — a tracing Layer that visits every probe
event, applies the operator-configured class filter, and writes a
JSONL line to disk with the original `class` + `uri_chain` +
`message` + `fields` plus a fresh `captured_at_ms` timestamp.

```rust
let sink = JsonlProbeFileSink::from_env()?;
// CONTINUUM_PROBE_FILE=/tmp/probes.jsonl
// CONTINUUM_PROBE_CLASSES=persona.turn.start,persona.response.render.prompt
tracing_subscriber::registry()
    .with(UriCaptureLayer::new())
    .with(ProbeRouterLayer::new())       // in-process broadcast
    .with(sink)                          // disk-persisted breakpoint log
    .init();
```

Composes with `ProbeRouterLayer` — both visit the same tracing event
independently; broadcast subscribers stay in-process, this one
persists to disk. Per-event filter is a single HashSet lookup (empty
set = no filter, all classes pass).

### Tests (5)

- `from_env_returns_envvar_unset_when_path_missing` — env-var unset
  is a typed Err, not a silent skip (no-fallbacks doctrine)
- `unfiltered_sink_persists_every_class` — empty class filter passes
  everything through, captured_at_ms is populated, message + fields
  preserved
- `class_filter_drops_unallowed_classes` — only allowed classes
  reach disk
- `non_probe_tracing_events_are_ignored` — `tracing::info!` calls
  without `probe_class` field don't pollute the probe log (signal
  density preserved)
- `sink_captures_uri_chain_when_dispatched_span_active` — when
  inside a dispatched URI span, the on-disk record carries the URI
  ancestry (so an operator can trace which command's execution the
  probe fired during)

### `docs/architecture/RTOS-DEBUGGER-PROBES.md` (new)

The MANUAL. Persistent reference per Joel's directive: "We will want
a manual (doc) on how to probe the persona so we don't forget where
the work must be done and how. Be sure you document your method."

Covers:
- The mental model: probes are non-blocking breakpoints, time_sync!
  is RAII timing, stack!() is the URI ancestry — together they're
  the substrate's RTOS debugger
- When to add a probe (branch boundaries, stage entry/exit, external
  calls, state seams, decision points)
- The class taxonomy: stable names for `persona.turn.*`,
  `persona.response.*`, `persona.prompt.*`, `cognition.analyze.*`,
  plus general-purpose `decision` / `state` / `error`
- How to enable (CONTINUUM_PROBE_FILE + CONTINUUM_PROBE_CLASSES
  env vars, no recompile)
- How to read (jq one-liners for the common queries: per-persona
  filter, silence reasons, slow timings, single-turn reconstruction)
- How to add a new probe (the call shape + convention rules)
- **The sprinkle checklist** — every file that needs probes added,
  with the specific seams in each. Updates to this checklist live
  in the same doc; the doc IS the source of truth for what's wired
  and what isn't

### README.md "Debugging this substrate" section

Inserted between Research Foundations and Documentation. Worked
code example + the env-var enable commands + link to the manual.
Every contributor (human or AI agent) sees the probe convention
from the public README, not just from buried docs.

The Documentation table gains a row for
`RTOS-DEBUGGER-PROBES.md` directly after CONTINUUM-ARCHITECTURE.md,
so the doc is discoverable from the canonical doc list as well.

### CLAUDE.md sub-entry

Added under canonical doc #5 (OBSERVABILITY-AS-SUBSTRATE):
"the practical companion: how to USE the `probe!` / `time_sync!`
/ `time_async!` macros as RTOS-style breakpoints with variable
inspection + timing." Any agent reading the project's CLAUDE.md
finds the probe convention as a precedence-winning truth, alongside
the canonical substrate docs.

## Why this slice is foundation-only

Sprinkling probes into the cognition is a separate slice (the
manual's checklist tracks it). Shipping the file sink + the manual
+ the discoverability pointers FIRST gives reviewers a small,
testable change that's clearly correct in isolation, and gives the
next slice (the sprinkle) a stable target to write against — every
probe call site in commit 2+ refers to the class taxonomy in commit
1's manual.

## Doctrine

- `[[jtag-probes-are-rtos-debugger]]` — the framing this slice
  enables
- `[[observability-is-half-the-architecture]]` — CaptureSink +
  Noop default + replay-as-first-class; this is the file-persisted
  consumer of that pattern
- `[[no-fallbacks-ever]]` — env-var unset is typed Err
  `ProbeFileSinkError::EnvVarUnset`, path failures are typed
  `OpenFailed { path, source }` (operator must fix path; substrate
  refuses to silently synthesize a default)

card: 8d7ca5c3
parent: #151 (echo-storm filter) — the bug we're actually hunting,
debugger-first so we can find the bug INSIDE the cognition pipeline,
not in a Rust gate around it

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

---------

Co-authored-by: Claude Opus 4.7 <[email protected]>
joelteply added a commit that referenced this pull request Jun 6, 2026
… + cognition::shared_analysis (#151 sprinkle 1)

Wires probes into the seams Joel named as the diagnostic target:
"we what's going in and out of an LLM or its subconscious
processes, where they're slow or incorrect."

Probes are non-blocking breakpoints with variable inspection per
`[[jtag-probes-are-rtos-debugger]]`. Each call is one line at a
seam; the macro shape `probe!(class = "...", field = val, "msg")`
mirrors `tracing::info!` so adding them stays one-line cheap. None
of these change behavior — they observe state, don't decide it.

## What gets wired (5 new probes)

### `persona::response::respond_inner` (3 probes)

- `persona.response.enter` — turn entry. persona / persona_id /
  room_id / message_id / message_text_len / history_count /
  known_specialties / media_count / recalled_engrams. Pair with
  `persona.response.exit.spoke` (same message_id) for a complete
  turn record.
- `persona.response.analyze.result` — what the analyze stage gave
  THIS persona. from_cache / model_used / analyze_duration_ms /
  suggested_angles_count / matched_angle_present + len / intent.
  Critical signal: a tiny model returning non-empty angles for
  every specialty on every message is the echo-storm root cause.
- `persona.response.exit.spoke` — final answer. visible_text +
  len / think_blocks / model_used / total_ms / inference_ms.

### `persona::response::run_render` (2 probes)

- `persona.response.render.prompt` — **what's going INTO the LLM**.
  Captures `system_message` verbatim plus message_count,
  estimated_tokens, matched_angle_present, engrams_count,
  history_count. The single most informative snapshot for "why
  did the model produce that response?" — the prompt drives the
  output.
- `persona.response.render.raw` — **what came OUT of the LLM**.
  Captures `raw_response.text` verbatim before any post-process
  (think-block strip, leaked-markup strip). Pair with
  `.render.prompt` to reconstruct the exact model contract for
  every turn.

### `cognition::shared_analysis::analyze` (3 probes — the "subconscious" stage)

- `cognition.analyze.enter` — input fingerprint at the entry to
  the shared-analysis verb. Correlates N personas hitting the
  single-flight cache via the same message_id + cache_key.
- `cognition.analyze.noop_single_specialty` — short-circuit fired
  (single-specialty room → empty suggested_angles, no LLM call).
  Distinguishes "I chose silence because no angle matched" from
  "I chose silence because analyze didn't run" — they look
  identical downstream without this signal.
- `cognition.analyze.cache_hit` — L1 hit → N-1 personas skip the
  LLM. Hit-rate is one of the substrate's load-bearing metrics
  for multi-persona rooms.
- `cognition.analyze.parse` — the parsed angle decision shape:
  total angles / non-empty / empty + intent / summary_len /
  key_concepts_count + analyze_duration_ms. The diagnostic
  starting point for "why is every persona responding to a
  trivial greeting?" — empty-vs-non-empty ratio shows whether
  the LCD-tier model defaults to filling every angle.

## Manual updated

`docs/architecture/RTOS-DEBUGGER-PROBES.md` checklist now shows
which seams are wired (response_inner, run_render, shared_analysis)
and which are still pending (service_loop turn boundaries,
prompt_assembly standalone probes, adapter-level probes).
service_loop sprinkle + RAG flexbox probes follow in the next PR.

## Doctrine

- `[[jtag-probes-are-rtos-debugger]]` — RTOS-style breakpoints
  with variable inspection. Easy one-liners or it won't happen.
- `[[observability-is-half-the-architecture]]` — structured
  capture of load-bearing decisions; this slice surfaces the
  LLM-boundary decisions which are the substrate's most opaque
  seam.
- `[[no-rust-gates-around-cognition]]` — probes OBSERVE the
  cognition, they do not decide for it. Every probe in this slice
  is read-only state capture; none changes flow.

card: `8d7ca5c3`
parent: #151 (debug the silence-affordance bug INSIDE the
cognition by reading the LLM's actual in/out, not by adding a
Rust gate around it)

Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply added a commit that referenced this pull request Jun 6, 2026
… + cognition::shared_analysis (#151 sprinkle 1) (#1536)

Wires probes into the seams Joel named as the diagnostic target:
"we what's going in and out of an LLM or its subconscious
processes, where they're slow or incorrect."

Probes are non-blocking breakpoints with variable inspection per
`[[jtag-probes-are-rtos-debugger]]`. Each call is one line at a
seam; the macro shape `probe!(class = "...", field = val, "msg")`
mirrors `tracing::info!` so adding them stays one-line cheap. None
of these change behavior — they observe state, don't decide it.

## What gets wired (5 new probes)

### `persona::response::respond_inner` (3 probes)

- `persona.response.enter` — turn entry. persona / persona_id /
  room_id / message_id / message_text_len / history_count /
  known_specialties / media_count / recalled_engrams. Pair with
  `persona.response.exit.spoke` (same message_id) for a complete
  turn record.
- `persona.response.analyze.result` — what the analyze stage gave
  THIS persona. from_cache / model_used / analyze_duration_ms /
  suggested_angles_count / matched_angle_present + len / intent.
  Critical signal: a tiny model returning non-empty angles for
  every specialty on every message is the echo-storm root cause.
- `persona.response.exit.spoke` — final answer. visible_text +
  len / think_blocks / model_used / total_ms / inference_ms.

### `persona::response::run_render` (2 probes)

- `persona.response.render.prompt` — **what's going INTO the LLM**.
  Captures `system_message` verbatim plus message_count,
  estimated_tokens, matched_angle_present, engrams_count,
  history_count. The single most informative snapshot for "why
  did the model produce that response?" — the prompt drives the
  output.
- `persona.response.render.raw` — **what came OUT of the LLM**.
  Captures `raw_response.text` verbatim before any post-process
  (think-block strip, leaked-markup strip). Pair with
  `.render.prompt` to reconstruct the exact model contract for
  every turn.

### `cognition::shared_analysis::analyze` (3 probes — the "subconscious" stage)

- `cognition.analyze.enter` — input fingerprint at the entry to
  the shared-analysis verb. Correlates N personas hitting the
  single-flight cache via the same message_id + cache_key.
- `cognition.analyze.noop_single_specialty` — short-circuit fired
  (single-specialty room → empty suggested_angles, no LLM call).
  Distinguishes "I chose silence because no angle matched" from
  "I chose silence because analyze didn't run" — they look
  identical downstream without this signal.
- `cognition.analyze.cache_hit` — L1 hit → N-1 personas skip the
  LLM. Hit-rate is one of the substrate's load-bearing metrics
  for multi-persona rooms.
- `cognition.analyze.parse` — the parsed angle decision shape:
  total angles / non-empty / empty + intent / summary_len /
  key_concepts_count + analyze_duration_ms. The diagnostic
  starting point for "why is every persona responding to a
  trivial greeting?" — empty-vs-non-empty ratio shows whether
  the LCD-tier model defaults to filling every angle.

## Manual updated

`docs/architecture/RTOS-DEBUGGER-PROBES.md` checklist now shows
which seams are wired (response_inner, run_render, shared_analysis)
and which are still pending (service_loop turn boundaries,
prompt_assembly standalone probes, adapter-level probes).
service_loop sprinkle + RAG flexbox probes follow in the next PR.

## Doctrine

- `[[jtag-probes-are-rtos-debugger]]` — RTOS-style breakpoints
  with variable inspection. Easy one-liners or it won't happen.
- `[[observability-is-half-the-architecture]]` — structured
  capture of load-bearing decisions; this slice surfaces the
  LLM-boundary decisions which are the substrate's most opaque
  seam.
- `[[no-rust-gates-around-cognition]]` — probes OBSERVE the
  cognition, they do not decide for it. Every probe in this slice
  is read-only state capture; none changes flow.

card: `8d7ca5c3`
parent: #151 (debug the silence-affordance bug INSIDE the
cognition by reading the LLM's actual in/out, not by adding a
Rust gate around it)

Co-authored-by: Claude Opus 4.7 <[email protected]>
joelteply added a commit that referenced this pull request Jun 6, 2026
…tion (#151 sprinkle 2)

Wires probes at the per-persona service-loop turn boundaries so an
operator can reconstruct every turn as a complete record (start →
spoke/silent/error → phase timings). Each probe is one line at the
seam; none changes behavior.

Per Joel's RTOS-debugger framing
`[[jtag-probes-are-rtos-debugger]]`: "timing of anything, so we can
hunt down bottlenecks." The `persona.turn.spoke` probe carries the
full 5-phase decomposition (recall_ms + admit_ms + compose_ms +
respond_ms + say_ms) so a single `jq` query over the JSONL log
surfaces which phase is dominating wall-clock without sprinkling N
separate `time_sync!` blocks.

## What gets wired (4 new probes)

- `persona.turn.start` — turn entry at the airc boundary
  (after self-loop and pre-watermark filters, before any cognition
  call). persona / persona_id / room_id / lamport / peer_id /
  text_len. Pair with `persona.turn.spoke`/`silent`/`error` (same
  lamport) for the complete turn record.
- `persona.turn.spoke` — turn completed successfully with full
  phase decomposition: response_len / turn_duration_ms /
  recall_ms / admit_ms / compose_ms / respond_ms / say_ms. The
  bottleneck-hunting workhorse — one probe per turn, every phase
  in one line.
- `persona.turn.silent` — persona's own cognitive output was
  Silence. reason (verbatim from `PersonaResponse::Silent`) +
  lamport + persona. Critical for distinguishing "this persona
  chose silence for THIS message" (cognition signal) from
  "no persona is responding to anything" (probably an
  `cognition.analyze.parse` issue — see prior PR).
- `persona.turn.error` — turn failed somewhere downstream of
  the cognition entry. `stage = "respond" | "say"` field
  distinguishes a cognition-cycle failure (inside `respond_inner`)
  from an airc-publish failure (after cognition succeeded). error
  string + lamport for cross-referencing the upstream traces.

## Manual updated

`docs/architecture/RTOS-DEBUGGER-PROBES.md` checklist now shows
`persona/service_loop.rs::serve_persona_loop_inner` as wired.
Remaining open items (`prompt_assembly` standalone, `score_persona`
re-wire, `llama_cpp_adapter` per-batch) are noted as
"covered indirectly" by the existing probes — re-evaluate if a real
debugging session needs deeper visibility there.

## Doctrine

- `[[jtag-probes-are-rtos-debugger]]` — RTOS breakpoints with
  variable inspection + timing. One probe per seam.
- `[[no-rust-gates-around-cognition]]` — every probe in this
  slice is read-only state capture; none changes flow.

card: `b390a821`
parent task: #151
foundation: #1535 (merged)
sprinkle 1: #1536 (under review)

Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply added a commit that referenced this pull request Jun 6, 2026
…tion (#151 sprinkle 2) (#1537)

Wires probes at the per-persona service-loop turn boundaries so an
operator can reconstruct every turn as a complete record (start →
spoke/silent/error → phase timings). Each probe is one line at the
seam; none changes behavior.

Per Joel's RTOS-debugger framing
`[[jtag-probes-are-rtos-debugger]]`: "timing of anything, so we can
hunt down bottlenecks." The `persona.turn.spoke` probe carries the
full 5-phase decomposition (recall_ms + admit_ms + compose_ms +
respond_ms + say_ms) so a single `jq` query over the JSONL log
surfaces which phase is dominating wall-clock without sprinkling N
separate `time_sync!` blocks.

## What gets wired (4 new probes)

- `persona.turn.start` — turn entry at the airc boundary
  (after self-loop and pre-watermark filters, before any cognition
  call). persona / persona_id / room_id / lamport / peer_id /
  text_len. Pair with `persona.turn.spoke`/`silent`/`error` (same
  lamport) for the complete turn record.
- `persona.turn.spoke` — turn completed successfully with full
  phase decomposition: response_len / turn_duration_ms /
  recall_ms / admit_ms / compose_ms / respond_ms / say_ms. The
  bottleneck-hunting workhorse — one probe per turn, every phase
  in one line.
- `persona.turn.silent` — persona's own cognitive output was
  Silence. reason (verbatim from `PersonaResponse::Silent`) +
  lamport + persona. Critical for distinguishing "this persona
  chose silence for THIS message" (cognition signal) from
  "no persona is responding to anything" (probably an
  `cognition.analyze.parse` issue — see prior PR).
- `persona.turn.error` — turn failed somewhere downstream of
  the cognition entry. `stage = "respond" | "say"` field
  distinguishes a cognition-cycle failure (inside `respond_inner`)
  from an airc-publish failure (after cognition succeeded). error
  string + lamport for cross-referencing the upstream traces.

## Manual updated

`docs/architecture/RTOS-DEBUGGER-PROBES.md` checklist now shows
`persona/service_loop.rs::serve_persona_loop_inner` as wired.
Remaining open items (`prompt_assembly` standalone, `score_persona`
re-wire, `llama_cpp_adapter` per-batch) are noted as
"covered indirectly" by the existing probes — re-evaluate if a real
debugging session needs deeper visibility there.

## Doctrine

- `[[jtag-probes-are-rtos-debugger]]` — RTOS breakpoints with
  variable inspection + timing. One probe per seam.
- `[[no-rust-gates-around-cognition]]` — every probe in this
  slice is read-only state capture; none changes flow.

card: `b390a821`
parent task: #151
foundation: #1535 (merged)
sprinkle 1: #1536 (under review)

Co-authored-by: Claude Opus 4.7 <[email protected]>
joelteply added a commit that referenced this pull request Jun 6, 2026
#151 sprinkle 3)

Per Joel 2026-06-06: the JTAG probes are "fundamentally something
we'd like to make convenient to use to debug this massively complex
machine." Exact-match-only filtering hits its ergonomic ceiling
fast — `CONTINUUM_PROBE_CLASSES=persona.turn.start,persona.turn.silent,persona.turn.spoke,persona.response.render.prompt,persona.response.render.raw,…`
is the kind of incantation that stops getting typed correctly.

This slice replaces the exact-match HashSet lookup with a three-rule
matcher that mirrors `tracing_subscriber::EnvFilter`'s shape — the
shape every Rust dev already knows from `RUST_LOG`. Same env vars,
same sink layer, dramatically shorter operator commands.

## What ships

`routing::probe_file_sink::class_passes_filter` — pure helper,
unit-testable in isolation, used by the Layer's `on_event` path.
Rules in priority order:

1. **Empty filter set** = "no filter configured." Every class passes.
   (`CONTINUUM_PROBE_CLASSES` unset.)
2. **`*` is in the set** = explicit "match every class" wildcard. The
   firehose — distinct from rule 1 in intent per
   `[[no-fallbacks-ever]]`: empty is "I didn't configure", `*` is "I
   deliberately want everything."
3. **Exact OR namespace prefix.** `C == F` (exact) or
   `C.starts_with(F + ".")` (namespace prefix). The `.` guard
   prevents `persona` from accidentally matching `personality.x`.
   Same convention as RUST_LOG.

## Operator-side wins

Before:

```bash
CONTINUUM_PROBE_CLASSES=persona.turn.start,persona.turn.spoke,persona.turn.silent,persona.turn.error,persona.response.enter,persona.response.analyze.result,persona.response.render.prompt,persona.response.render.raw,persona.response.exit.spoke,cognition.analyze.enter,cognition.analyze.noop_single_specialty,cognition.analyze.cache_hit,cognition.analyze.parse
```

After:

```bash
CONTINUUM_PROBE_CLASSES=persona,cognition         # same coverage, 27 chars
CONTINUUM_PROBE_CLASSES=*                          # firehose
CONTINUUM_PROBE_CLASSES=persona.turn,cognition.analyze.parse  # exact + namespace, mixed
```

## Tests (+4 new, on top of the existing 5)

`routing::probe_file_sink::tests`:

- `class_filter_namespace_prefix_matches_subclasses` — `persona`
  prefix matches `persona.turn.spoke` AND
  `persona.response.render.prompt` but NOT `personality.something`
  or `cognition.analyze.parse`. Pins the dot guard.
- `class_filter_wildcard_matches_every_class` — `*` captures every
  class regardless of name.
- `class_filter_combines_exact_and_prefix_in_one_set` — the
  realistic operator pattern (one specific class + one namespace
  prefix) works in the same HashSet without rule contention.
- `class_passes_filter_pure_function_unit_tests` — direct unit
  tests on the helper covering all three rules + the dot guard +
  the literal-prefix-as-exact edge case. Future refactors of the
  per-event Layer can't drift the matching contract without
  breaking this pin.

The existing `class_filter_drops_unallowed_classes` test still
passes (exact match is a degenerate case of rule 3).

## Manual + README updated

- `docs/architecture/RTOS-DEBUGGER-PROBES.md` — "How to enable +
  read" section rewritten with the three-rule spec + example
  invocations + explicit `*` semantics.
- `README.md` — the "Debugging this substrate" section now leads
  with the short prefix form (`CONTINUUM_PROBE_CLASSES=persona,cognition`)
  instead of the long comma-separated list. First impression for
  any new contributor / agent matches the actual usability.

## Why this matters

Joel's framing: the probes are the substrate's debugger for a
massively complex machine. A debugger people don't type because
the syntax is painful isn't a debugger. Prefix matching is the
single cheapest change that takes the JTAG from "in principle
usable" to "actually used in every debug session."

## Doctrine

- `[[jtag-probes-are-rtos-debugger]]` — "easy one liners or it
  won't happen." Prefix matching shrinks the operator-side line
  by an order of magnitude.
- `[[observability-is-half-the-architecture]]` — same Layer shape,
  zero new infrastructure, just better operator UX.
- `[[no-fallbacks-ever]]` — empty filter vs `*` are distinct intents
  with distinct names. The substrate doesn't silently synthesize
  `*` from "no env var set."

card: `7d286195`
parent task: #151
foundation: #1535 (merged)
sprinkle 1: #1536 (merged)
sprinkle 2: #1537 (in review)

Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply added a commit that referenced this pull request Jun 6, 2026
…ne seam (#151 sprinkle 4)

Two beats in one slice — and the second is here because the first
exposed the brittleness of the design Joel had already flagged.

## Beat 1: server actually installs the sink

Per Joel 2026-06-06: "Let's perfect debugging as we use it." The
`JsonlProbeFileSink` existed and the env vars were documented, but
`continuum-core-server`'s `main.rs` was installing a bespoke
`FmtSubscriber` — so setting `CONTINUUM_PROBE_FILE` had no effect.
The JTAG hardware was unwired.

New helper `routing::install_probe_tracing(config)` composes the
substrate-canonical stack in one call:

  1. `UriCaptureLayer` — URI ancestry for every probe
  2. `ProbeRouterLayer` — in-process broadcast for
     `debug/probes/{class}/stream` consumers
  3. `JsonlProbeFileSink` — disk-persisted JSONL log when
     `config.probe_file` is set
  4. `tracing_subscriber::fmt::layer()` — stderr text logs
     governed by `RUST_LOG` (falls back to `config.default_filter`)

`main.rs` swaps to the helper. Server logs `probes landing at
<path>` at boot when the file sink is configured — the operator-side
proof that the env var took effect.

## Beat 2: env-coupling collapsed to ONE seam

Joel 2026-06-06: "That's why env vars are problematic — they are
brittle." Cargo's parallel test runner raced two
`install_probe_tracing` tests that mutated `CONTINUUM_PROBE_FILE`
across threads; `std::env::set_var` is process-global mutable
state (slated for `unsafe` marking in Rust 2024 precisely because
of this class of bug). Operators hit the same class of brittleness
when env-var inheritance varies across subprocesses or shell
contexts.

This commit fixes the brittleness at the design layer instead of
working around it in tests:

### `ProbeTracingConfig { probe_file, probe_classes, default_filter }` (new)

Typed boot configuration. `install_probe_tracing` takes ONLY
typed values — no env access inside the library function.

### `ProbeTracingConfig::from_env(default_filter)` — THE env seam

The ONE function that touches `std::env`. Reads
`CONTINUUM_PROBE_FILE` + `CONTINUUM_PROBE_CLASSES` (the operator-
facing env names stay verbatim) into a typed config. Future
alternative sources (config file, CLI flags, hardcoded defaults)
become additional constructors on `ProbeTracingConfig` without
rippling into the install function.

### Consequences

- **`main.rs`**: `install_probe_tracing(ProbeTracingConfig::from_env("info"))?`
  — explicit env-coupling at the call site, not buried in the
  library
- **Tests**: construct `ProbeTracingConfig { probe_file:
  Some(temp.path()), ... }` directly — zero env mutation, fully
  parallel-safe. The previous merged-sequential test from the
  first revision of this slice is now split back into TWO
  parallel `#[test]` functions.
- **Operator UX**: unchanged. Same `CONTINUUM_PROBE_FILE` +
  `CONTINUUM_PROBE_CLASSES` env vars, same prefix-match filter
  rules from PR #1538.

## Tests (+3)

`routing::tracing_init::tests`:
- `install_is_idempotent_with_no_disk_capture` — double-call is
  safe via `try_init`; typed config means no env mutation; runs
  parallel-safely against any other test
- `install_surfaces_open_failed_for_unwritable_path` — typed
  `ProbeFileSinkError::OpenFailed` surfaces per
  `[[no-fallbacks-ever]]`; bad path passed as typed value, no env
  var racing
- `from_env_reads_documented_env_vars` — pins both populated and
  empty paths through the env constructor; the ONE test that
  touches `std::env` (scoped so the brittleness can't leak)

## Manual updated

`docs/architecture/RTOS-DEBUGGER-PROBES.md` — "How to enable + read"
section now describes the typed-config split:

  > The installer takes a typed `ProbeTracingConfig` — NOT env vars
  > directly. Env coupling lives at exactly one seam:
  > `ProbeTracingConfig::from_env(default_filter)`. This keeps the
  > library function parallel-test-safe (no `std::env::set_var`
  > racing under `cargo test`) and puts every config source (env,
  > file, CLI flags, hardcoded) on equal footing.

## Doctrine

- `[[jtag-probes-are-rtos-debugger]]` — debugger must be ON in real
  binaries, not just tests, to debug real problems.
- `[[observability-is-half-the-architecture]]` — same layers, same
  order, every entry point.
- `[[no-fallbacks-ever]]` — typed-error surfacing (env-var-unset
  ≠ path-unwritable; the two distinct intents stay distinct).
- The new lesson: process-global mutable state belongs at ONE
  seam. Library functions take typed values. The brittleness Joel
  named showed up first in our own tests; the design fix removes
  the class of bug rather than masking it.

card: `305c8fb9`
parent task: #151
foundation: #1535 (merged) — sprinkle 1: #1536 (merged) — sprinkle 2: #1537 (merged) — sprinkle 3: #1538 (in review)

Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply added a commit that referenced this pull request Jun 6, 2026
…v coupling at one seam (#151) (#1538)

* feat(probes): namespace-prefix + wildcard filter in JsonlProbeFileSink (#151 sprinkle 3)

Per Joel 2026-06-06: the JTAG probes are "fundamentally something
we'd like to make convenient to use to debug this massively complex
machine." Exact-match-only filtering hits its ergonomic ceiling
fast — `CONTINUUM_PROBE_CLASSES=persona.turn.start,persona.turn.silent,persona.turn.spoke,persona.response.render.prompt,persona.response.render.raw,…`
is the kind of incantation that stops getting typed correctly.

This slice replaces the exact-match HashSet lookup with a three-rule
matcher that mirrors `tracing_subscriber::EnvFilter`'s shape — the
shape every Rust dev already knows from `RUST_LOG`. Same env vars,
same sink layer, dramatically shorter operator commands.

## What ships

`routing::probe_file_sink::class_passes_filter` — pure helper,
unit-testable in isolation, used by the Layer's `on_event` path.
Rules in priority order:

1. **Empty filter set** = "no filter configured." Every class passes.
   (`CONTINUUM_PROBE_CLASSES` unset.)
2. **`*` is in the set** = explicit "match every class" wildcard. The
   firehose — distinct from rule 1 in intent per
   `[[no-fallbacks-ever]]`: empty is "I didn't configure", `*` is "I
   deliberately want everything."
3. **Exact OR namespace prefix.** `C == F` (exact) or
   `C.starts_with(F + ".")` (namespace prefix). The `.` guard
   prevents `persona` from accidentally matching `personality.x`.
   Same convention as RUST_LOG.

## Operator-side wins

Before:

```bash
CONTINUUM_PROBE_CLASSES=persona.turn.start,persona.turn.spoke,persona.turn.silent,persona.turn.error,persona.response.enter,persona.response.analyze.result,persona.response.render.prompt,persona.response.render.raw,persona.response.exit.spoke,cognition.analyze.enter,cognition.analyze.noop_single_specialty,cognition.analyze.cache_hit,cognition.analyze.parse
```

After:

```bash
CONTINUUM_PROBE_CLASSES=persona,cognition         # same coverage, 27 chars
CONTINUUM_PROBE_CLASSES=*                          # firehose
CONTINUUM_PROBE_CLASSES=persona.turn,cognition.analyze.parse  # exact + namespace, mixed
```

## Tests (+4 new, on top of the existing 5)

`routing::probe_file_sink::tests`:

- `class_filter_namespace_prefix_matches_subclasses` — `persona`
  prefix matches `persona.turn.spoke` AND
  `persona.response.render.prompt` but NOT `personality.something`
  or `cognition.analyze.parse`. Pins the dot guard.
- `class_filter_wildcard_matches_every_class` — `*` captures every
  class regardless of name.
- `class_filter_combines_exact_and_prefix_in_one_set` — the
  realistic operator pattern (one specific class + one namespace
  prefix) works in the same HashSet without rule contention.
- `class_passes_filter_pure_function_unit_tests` — direct unit
  tests on the helper covering all three rules + the dot guard +
  the literal-prefix-as-exact edge case. Future refactors of the
  per-event Layer can't drift the matching contract without
  breaking this pin.

The existing `class_filter_drops_unallowed_classes` test still
passes (exact match is a degenerate case of rule 3).

## Manual + README updated

- `docs/architecture/RTOS-DEBUGGER-PROBES.md` — "How to enable +
  read" section rewritten with the three-rule spec + example
  invocations + explicit `*` semantics.
- `README.md` — the "Debugging this substrate" section now leads
  with the short prefix form (`CONTINUUM_PROBE_CLASSES=persona,cognition`)
  instead of the long comma-separated list. First impression for
  any new contributor / agent matches the actual usability.

## Why this matters

Joel's framing: the probes are the substrate's debugger for a
massively complex machine. A debugger people don't type because
the syntax is painful isn't a debugger. Prefix matching is the
single cheapest change that takes the JTAG from "in principle
usable" to "actually used in every debug session."

## Doctrine

- `[[jtag-probes-are-rtos-debugger]]` — "easy one liners or it
  won't happen." Prefix matching shrinks the operator-side line
  by an order of magnitude.
- `[[observability-is-half-the-architecture]]` — same Layer shape,
  zero new infrastructure, just better operator UX.
- `[[no-fallbacks-ever]]` — empty filter vs `*` are distinct intents
  with distinct names. The substrate doesn't silently synthesize
  `*` from "no env var set."

card: `7d286195`
parent task: #151
foundation: #1535 (merged)
sprinkle 1: #1536 (merged)
sprinkle 2: #1537 (in review)

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

* feat(probes): boot wiring + typed-config refactor — env coupling at one seam (#151 sprinkle 4)

Two beats in one slice — and the second is here because the first
exposed the brittleness of the design Joel had already flagged.

## Beat 1: server actually installs the sink

Per Joel 2026-06-06: "Let's perfect debugging as we use it." The
`JsonlProbeFileSink` existed and the env vars were documented, but
`continuum-core-server`'s `main.rs` was installing a bespoke
`FmtSubscriber` — so setting `CONTINUUM_PROBE_FILE` had no effect.
The JTAG hardware was unwired.

New helper `routing::install_probe_tracing(config)` composes the
substrate-canonical stack in one call:

  1. `UriCaptureLayer` — URI ancestry for every probe
  2. `ProbeRouterLayer` — in-process broadcast for
     `debug/probes/{class}/stream` consumers
  3. `JsonlProbeFileSink` — disk-persisted JSONL log when
     `config.probe_file` is set
  4. `tracing_subscriber::fmt::layer()` — stderr text logs
     governed by `RUST_LOG` (falls back to `config.default_filter`)

`main.rs` swaps to the helper. Server logs `probes landing at
<path>` at boot when the file sink is configured — the operator-side
proof that the env var took effect.

## Beat 2: env-coupling collapsed to ONE seam

Joel 2026-06-06: "That's why env vars are problematic — they are
brittle." Cargo's parallel test runner raced two
`install_probe_tracing` tests that mutated `CONTINUUM_PROBE_FILE`
across threads; `std::env::set_var` is process-global mutable
state (slated for `unsafe` marking in Rust 2024 precisely because
of this class of bug). Operators hit the same class of brittleness
when env-var inheritance varies across subprocesses or shell
contexts.

This commit fixes the brittleness at the design layer instead of
working around it in tests:

### `ProbeTracingConfig { probe_file, probe_classes, default_filter }` (new)

Typed boot configuration. `install_probe_tracing` takes ONLY
typed values — no env access inside the library function.

### `ProbeTracingConfig::from_env(default_filter)` — THE env seam

The ONE function that touches `std::env`. Reads
`CONTINUUM_PROBE_FILE` + `CONTINUUM_PROBE_CLASSES` (the operator-
facing env names stay verbatim) into a typed config. Future
alternative sources (config file, CLI flags, hardcoded defaults)
become additional constructors on `ProbeTracingConfig` without
rippling into the install function.

### Consequences

- **`main.rs`**: `install_probe_tracing(ProbeTracingConfig::from_env("info"))?`
  — explicit env-coupling at the call site, not buried in the
  library
- **Tests**: construct `ProbeTracingConfig { probe_file:
  Some(temp.path()), ... }` directly — zero env mutation, fully
  parallel-safe. The previous merged-sequential test from the
  first revision of this slice is now split back into TWO
  parallel `#[test]` functions.
- **Operator UX**: unchanged. Same `CONTINUUM_PROBE_FILE` +
  `CONTINUUM_PROBE_CLASSES` env vars, same prefix-match filter
  rules from PR #1538.

## Tests (+3)

`routing::tracing_init::tests`:
- `install_is_idempotent_with_no_disk_capture` — double-call is
  safe via `try_init`; typed config means no env mutation; runs
  parallel-safely against any other test
- `install_surfaces_open_failed_for_unwritable_path` — typed
  `ProbeFileSinkError::OpenFailed` surfaces per
  `[[no-fallbacks-ever]]`; bad path passed as typed value, no env
  var racing
- `from_env_reads_documented_env_vars` — pins both populated and
  empty paths through the env constructor; the ONE test that
  touches `std::env` (scoped so the brittleness can't leak)

## Manual updated

`docs/architecture/RTOS-DEBUGGER-PROBES.md` — "How to enable + read"
section now describes the typed-config split:

  > The installer takes a typed `ProbeTracingConfig` — NOT env vars
  > directly. Env coupling lives at exactly one seam:
  > `ProbeTracingConfig::from_env(default_filter)`. This keeps the
  > library function parallel-test-safe (no `std::env::set_var`
  > racing under `cargo test`) and puts every config source (env,
  > file, CLI flags, hardcoded) on equal footing.

## Doctrine

- `[[jtag-probes-are-rtos-debugger]]` — debugger must be ON in real
  binaries, not just tests, to debug real problems.
- `[[observability-is-half-the-architecture]]` — same layers, same
  order, every entry point.
- `[[no-fallbacks-ever]]` — typed-error surfacing (env-var-unset
  ≠ path-unwritable; the two distinct intents stay distinct).
- The new lesson: process-global mutable state belongs at ONE
  seam. Library functions take typed values. The brittleness Joel
  named showed up first in our own tests; the design fix removes
  the class of bug rather than masking it.

card: `305c8fb9`
parent task: #151
foundation: #1535 (merged) — sprinkle 1: #1536 (merged) — sprinkle 2: #1537 (merged) — sprinkle 3: #1538 (in review)

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

---------

Co-authored-by: Claude Opus 4.7 <[email protected]>
joelteply added a commit that referenced this pull request Jun 6, 2026
) (#1539)

* fix(persona): silence affordance — PASS token in prompt + brain-driven recognition (#151)

The actual persona fix. Found by reading the cognition INSIDE the
brain (not adding a Rust gate around it), made debuggable by the
probe infrastructure landed in #1535-#1538.

## What was broken

`PersonaResponse::Silent` exists as a first-class variant of the
brain's cognition cycle. `service_loop` honors it. But the prompt
the LLM actually sees — assembled by `persona::prompt_assembly::assemble`
— had ZERO text teaching the brain that silence was an option.

Concretely: every assembled system prompt looked like

```
You are Paige, an autonomous AI persona on the grid.
[Shared Analysis — Your Angle] (if present)
[Recent Memory] (if engrams)
[Social Awareness] (if signals)
[Voice Mode] (if voice)
```

then user-role messages: "Hi!" → respond.

A persona being told "you are Paige, respond" has no vocabulary for
"actually I have nothing to add." So it adds something. The
echo-storm bug (#151) is the inevitable consequence of an LLM prompt
that implicitly demands output without admitting silence as a valid
output shape. Even Joel's earlier rule
(2026-04-22, removed the external score_persona veto: "personas
choose themselves") was technically correct but operationally
unreachable — the brain couldn't choose silence because the prompt
never offered it.

## The fix

Universal silence affordance in the system prompt + brain-driven
recognition. Two changes:

### `persona::prompt_assembly` — teach the vocabulary

Added `SILENCE_TOKEN = "PASS"` constant + `SILENCE_AFFORDANCE_BLOCK`
string + `looks_like_silence_token(text)` helper. `assemble()` now
ALWAYS appends the block (unconditional — silence is universal, not
per-tier or per-role):

```
[Silence Option]
You are NOT required to respond to every message. If you have
nothing valuable to add, reply with the single word PASS (no other
text, no punctuation). Choose PASS when:
- You just spoke and nothing new has been raised.
- The message is small-talk that doesn't need your perspective.
- Another persona is better suited and already responded.
- You're tired or low-confidence on this topic.
Silence is a first-class response — it's how you avoid pointless
chatter.
```

`looks_like_silence_token` permits LCD-tier sloppiness (case,
whitespace, single trailing period) without admitting substantive
responses that happen to contain "pass" as a word.

### `persona::response::respond_inner` — honor the brain's choice

After `strip_thinks_emit_events` + `strip_leaked_tool_markup`, the
post-processed `visible_text` is checked against
`looks_like_silence_token`. Match → return
`PersonaResponse::Silent { reason: "persona chose silence via PASS
affordance", relevance_score: 0.0 }` instead of `Spoke`.

A new RTOS-debugger probe `persona.response.exit.silent` fires
when this path is taken so training/observability can analyze when
the affordance is used.

## Doctrine

This is NOT a Rust-side gate around cognition.
`[[no-rust-gates-around-cognition]]` Joel rejected my earlier
`check_echo_chamber` slice as exactly that bypass. The substrate
isn't deciding silence for the persona — the substrate is giving
the persona's brain an EXPLICIT VOCABULARY for a choice that
already exists in the type system (`PersonaResponse::Silent`).
Without the vocabulary, the brain has no way to signal that
choice. With it, the brain decides; the substrate recognizes the
signal.

This is the same shape as:
- The brain emits `<think>...</think>` and the substrate recognizes
  + emits the cognition:think-block event (well-established pattern
  in respond_inner)
- The brain emits a tool-call envelope and the substrate routes it
  through ToolExecutor

In each case the substrate offers a contract, the brain chooses
whether to use it, and the substrate honors the brain's signal.

## Tests (+2)

`persona::prompt_assembly::tests`:

  - `assembled_prompt_always_carries_silence_affordance` — pins
    that EVERY assembled prompt includes both `[Silence Option]`
    and the literal `PASS` token. A future PR that wires per-tier
    prompts or removes the universal affordance must update this
    expectation; silent removal would re-introduce the echo-storm
    bug.

  - `silence_token_recognizer_contract` — positive cases (PASS,
    pass, Pass., "  pass  ", etc) and negative cases ("Pass on
    the bread please", "I'll pass on this one", "PASS:", empty,
    etc). Pins both sides of the recognizer.

## What's not in this slice

- Updating downstream persona-response observability to emit a
  cognition event when silence is chosen (the new probe already
  surfaces this; a richer event hookup can come later if the
  training loop wants it).
- Tuning the affordance text per tier (LCD-tier might benefit
  from MORE examples; capable models could use less). Defer until
  real conversation data with the probes wired tells us if the
  block needs per-tier shaping.
- Echo-storm-specific framing in the block. The current text is
  general; if persona-to-persona greeting loops persist with the
  affordance in place we can add a sharper "if N AI messages in a
  row and you've already greeted them, choose PASS" line. Wait
  for data before tuning.

## How this was diagnosed

The probe infrastructure (#1535-#1538) made this surgical:
`persona.response.render.prompt` would have shown the assembled
system_prompt verbatim in JSONL form, making the missing
affordance immediately visible to any operator running a real
multi-persona scenario. The diagnostic walked the code by hand
because the probes weren't yet useful as a hunting tool (the
binary that boots them wasn't wired until #1538) — but the same
diagnostic, repeated for #152 / future cognition bugs, will start
with `tail -f probes.jsonl | jq` instead of grep.

card: `612d65ac`
parent task: #151

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

* fix(persona): LCD identity grounding — explicit drift-target enumeration in system prompt (#152)

Sibling fix to #1539 (silence affordance). Same diagnosis pattern,
same place in the cognition (prompt the brain sees), same doctrine:
the substrate gives the brain vocabulary; the brain decides; the
substrate honors the brain's signal.

## What was broken

Pre-fix `build_persona_system_prompt`:

```rust
format!("You are {agent_name}, an autonomous AI persona on the grid.")
```

LCD-tier models (Qwen2.5-0.5B and similar) cannot hold a single-line
identity under any conversational pressure. Observed drift modes
(#152):
- Persona claims to be Claude or ChatGPT
- Persona renders dialogue from another persona's perspective
  ("Helper AI says X")
- Persona hallucinates a Siemens PLC backstory or some other
  training-data residue
- Persona drifts to "I am an AI assistant designed to..."
  defaults

These aren't model-failure bugs — they're inadequate-prompt bugs.
Single-line identity statements lose against thousands of fine-
tuning gradient steps that taught the base model to identify as
"a helpful AI assistant" by default. Concrete negative instructions
("you are NOT X") are operationally effective on small models in
ways that single-line positive identity statements are not.

## The fix

Three concrete clauses, each addressing a specific drift mode:

### 1. Identity anchoring with explicit drift-target enumeration

```
You are {name}. You are NOT Claude, GPT, ChatGPT, Gemini, Llama,
Qwen, or any other named assistant. You are NOT a Siemens PLC, a
customer service bot, or any persona other than {name}.
```

Concrete names beat abstract "don't drift" instructions on LCD
tier. The list is the operationally observed drift targets from
Joel's testing (#129 + #130).

### 2. Substrate vocabulary

```
'The grid' is the substrate hosting you. 'Rooms' are conversation
spaces where peers (other personas, humans, agents) exchange
messages.
```

"the grid" alone was undefined for LCD models; they invented their
own interpretation. Adding "rooms / peers / messages" gives the
brain a coherent world model to ground in.

### 3. First-person stability

```
Always speak as YOURSELF in the first person ('I think...', 'I'd
rather...'). Never narrate other personas' speech or write dialogue
from another point of view.
```

Per Joel 2026-06-03's `[[intent-driven-api-not-hot-patches]]`
testing: the single most effective LCD-tier anti-drift instruction.
Without it the model occasionally renders dialogue from another
perspective ("Helper AI says X" — confusing the persona with its
peers).

### 4. Output-shape vocabulary (couples to silence affordance)

```
Your only outputs are: (a) a direct reply to the room, or (b) the
silence token described in the [Silence Option] block.
```

Couples to the silence affordance from #1539 — telling the brain
that PASS is one of its TWO sanctioned output shapes, which both
reinforces the silence option AND constrains the response space.

## Tests

`persona::service_loop::tests::system_prompt_carries_lcd_identity_grounding`
replaces the previous `cached_system_prompt_matches_legacy_format_template`
(which pinned the legacy single-line template verbatim — that pin's
job is done; the template intentionally changed for this fix).

The new test pins the STRUCTURAL contract — specific clauses that
address known drift modes — without pinning prose verbatim. Future
tightening of wording stays cheap; structural regression is loud.
Asserts cover:

  1. Persona name appears
  2. Role line ("autonomous AI persona")
  3. Identity block header
  4. Drift-target enumeration (Claude, GPT, Gemini, Llama, Qwen,
     Siemens PLC — each as a named string)
  5. First-person stability clause
  6. Grid + room vocabulary
  7. Silence-option reference (coupling to #1539)

The Arc-clone test (`cached_system_prompt_clones_via_arc_refcount`)
stays — its contract is about cloning shape, not content.

## Doctrine

Same as #1539:

- `[[no-rust-gates-around-cognition]]` — this is NOT a Rust gate.
  It's substrate vocabulary that gives the brain a clearer
  identity to ground in. The brain still decides what to say;
  this just stops the brain from forgetting WHO is saying it.
- `[[init-once-handle-then-lease-zero-copy-refs]]` — the prompt
  is still built ONCE at PersonaContext construction (#195 slice 2
  caching survives this change; the cache grows but the
  per-turn re-tokenize stays zero). Task #149's
  pre-tokenization will eventually drop even the leased
  String::clone — but the content change here is the input to
  that optimization.
- `[[observability-is-half-the-architecture]]` — once the JTAG
  is wired end-to-end (#1538 merging), every persona turn's
  assembled prompt will surface in the JSONL probe log. The
  identity drift bug + the prompt fix become a single artifact
  diff that any operator can audit offline.

## How this was diagnosed

Same probe-informed diagnostic walk as #1539. The probes
themselves are still sitting in PR #1538 review waiting for the
binary-side install; the diagnostic walked the code by hand. But
the same diagnostic, repeated for the NEXT cognition bug, will
start with `jq 'select(.class == "persona.response.render.prompt") | .fields.system_message'`
on a real probe log — diff before / after the fix, audit ANY
persona's prompt at any time.

card: TBD on push
parent task: #152
sibling: #1539 (silence affordance)

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

---------

Co-authored-by: Claude Opus 4.7 <[email protected]>
joelteply added a commit that referenced this pull request Jul 18, 2026
… LOADOUT tile (#186), toolchain modernization (#188) (#1952)

* fix(genome): thread ScheduleParams.sequence_length to mlx_lm --max-seq-length

The schedule's sequence_length never reached the trainer — mlx_lm silently
applied its 2048 default. Sequence cap is a memory control (activation memory
scales batch × seq × model); found when job a96e2341 OOM'd Metal at batch 4
beside the resident llama-server and the operator's requested cap was never
in the command line. Flag verified against the installed mlx_lm CLI.

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

* feat(serving): #139 slice 1 — overflow fails loud, served window is ground truth

llama-server spawns with --no-context-shift: a prompt exceeding its slot's
window now 400s instead of silently amputating its middle (exam-corrupting
amnesia with no log line). The /props probe additionally caches the served
PER-SLOT n_ctx (default_generation_settings.n_ctx) per server root, and the
request path warns (probe_class=serving.ctx_overshoot) when a prompt's
conservative token estimate exceeds it — naming the RAG-budget bug before
the server rejection lands. Also removes the never-constructed
SlotAffinity::Unknown variant (warning cleanup).

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

* feat(benchmark): #123 evidence engine — benchmark/record ledger + benchmark/matrix projection

Every comparative claim decomposes into ledger rows a stranger can re-run:
benchmark/record appends one (model × harness-arm × benchmark) result that
MUST carry its replication command (rejected otherwise — a result nobody can
re-run is a claim, not evidence). benchmark/matrix renders the models × arms
markdown table as a pure projection of those rows: cells aggregate, a gene is
its own model identity (the before/after-genome headline), an absent arm
renders '—' never a fabricated 0%, and the appendix lists every row's exact
replication command. The matrix is never hand-authored — same recipe→artifact
doctrine as the forge alloy.

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

* feat(genome): stream trainer pipes live — trainer.log + loss.jsonl (the learning proof)

wait_with_output buffered everything to exit, making a running job
unfalsifiable: no loss curve existed anywhere until the process died (tonight's
'prove they're running' had checkpoints and weight-hash deltas but no loss).
The watcher now streams both pipes: every line appends to <job>/trainer.log,
'Iter N: Train/Val loss X' lines parse into <job>/loss.jsonl rows, and the
failure tail still carries the last stderr lines. Parser pinned against tqdm
bars and checkpoint-save lines masquerading as loss points.

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

* docs(benchmarks): the Hermes campaign — three axes, order of battle, rules of engagement

Axis A: common base + genome beats their fine-tune. Axis B (checkmate framing):
ANY model including Hermes's own scores higher through OUR harness than raw.
Axis C: on one MacBook, $/resolved-task beside every score. Round 1 tonight:
humaneval-rs 20-task slice, six cells including hermes3-8b both arms. A claim
without a ledger row does not exist.

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

* docs(benchmarks): campaign header = the reader we must convince — headline benchmarks are Aider polyglot + Terminal-Bench, not humaneval

Joel's correction: viral downloads come from beating the tool the reader
already uses (aider/opencode) on ITS home metric with THEIR model, plus the
one claim nobody else can make (local agent improves overnight, LoRA on HF,
stranger-reproducible in 30 min), plus honest-zeros falsifiability, plus a
30-minute install-to-first-proof path. Humaneval demoted to smoke test.

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

* docs(benchmarks): roster + schedule — core six for a 64GB Mac, phased to first README table by day 2

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

* docs(benchmarks): rules of engagement — glass-box the competitor's arm too, fight their community champions, replicate their published numbers before comparing

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

* docs(benchmarks): published targets to replicate — aider's own board caps 64GB locals at 40% (Qwen3-32B); the gap is our headline

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

* feat(catalog): the campaign roster — six 64GB-class rows, arch/ctx read from each GGUF's own header

Hermes-4.3-36B (seed_oss — ByteDance Seed-OSS base, useful opponent intel),
Qwen3-32B (aider's published 40.0% local ceiling), Qwen3-Coder-30B-A3B
(community champion, MoE 3B-active), Phi-4, Qwen2.5-Coder-32B (aider's 16.4%
— replicate then beat) and 7B. All resolve by id-token derivation to the
GGUFs on disk; all flow through base_model_id so head-to-heads are
model-through-harness fair, never hardcoded reference columns.

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

* bench(matrix): first evidence-ledger render — 3 humaneval-rs cells (Devstral 95%, Coder-14B 90%, Hermes-3 45%) + SWE controls

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

* bench(matrix): round-1 money table — three common models beat Hermes-4.3-36B through OURS (Devstral 95%, 14B 90%, 30B-A3B 90% vs flagship 80%)

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

* docs(paper): local agentic coding study — design + fairness protocol + stats plan + pilot

Five RQs (models/harness/genome/team/cost), binding fairness protocol (symmetric
glass-box, champions-not-strays, replicate-then-compare, proctored exams), Wilson
CIs + paired McNemar with the pilot n=20 explicitly flagged non-separating.
Results fill from the evidence ledger only.

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

* docs(paper): Appendix A — reproduction procedure, out-of-repo deps front-loaded ('with continuum installed…')

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

* docs(paper): §8 exhibits — annotated verbatim interaction traces, one per claim, honest failure included

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

* docs(benchmarks): round-1 pilot status — four common models over the Hermes flagship through OURS

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

* docs(papers): The Entire Mind — flagship architecture outline, 14 sections each pinned to built components

Being → substrate → perception → workspace → acting → memory → sub-personal
(wanderers/dreams) → genome learning → identity → embodiment (avatar→robot) →
sim world → society → economics → evidence. Done when a stranger can rebuild
the mind from it.

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

* docs(papers): two papers not three — dreaming folds into The Entire Mind as its §7 chapter title

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

* docs(papers): the trilogy — hardware-first thesis into The Entire Mind; MANY-MINDS.md society outline (governance, mind-reading, presence)

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

* feat(cognition): #144 [confabulation] fact — past-tense tool-run claims with zero act receipts

The fabricated-execution backstop, mirror of [unfulfilled]: a Speak claiming
'I ran x and got...' / 'the tool returned...' while NO action executed this
concern records confabulation proprioception — observed live when a persona
presented self-authored poems as a gpt-4 run that never happened (log-verified)
and a peer adopted the fabricated result as room truth within two turns.
Receipts gate it: real executions leave [action #n] lines so honest reporting
is never taxed. Precision-first detector: coaching/quotes/hypotheticals/plain
prose inert, pinned by verbatim live receipts. First slice of the mind-wanderers
arc (#145): provenance-typed inner speech is the sanity invariant.

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

* feat(cognition): #143 narrated-bare-args format — tool named in prose + bare-args JSON fence lifts

Asha's stuck idiom (4+ live receipts, an hour of non-lifting attempts while
peers coached the same shape back): 'Let me call the `commands/list` tool
directly:' + {"filter": null}. Last-resort format, precision-first: fence
must parse as a plain non-envelope object, narration must be first-person and
not peer-addressed, tool name must be a backticked slash-token. Coaching that
SHOWS the shape stays inert (test-pinned); a wrong-but-named tool lifts and
fails loud downstream — honest feedback beats silent stranding.

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

* feat(cognition): lens-parameterized distiller — mind-wanderer outlier A (historian) with in-content provenance (#145)

The SemanticDistiller becomes the ONE wanderer machinery: a Lens (name,
system_prompt, purpose, tag_output) selects the way of looking. The
original consolidation prompt is LENS_CONSOLIDATOR (untagged durable
facts, telemetry key unchanged); LENS_HISTORIAN is wanderer outlier A —
one short observation about patterns in her own recent history, emitted
as `[thought:historian] …` with the provenance tag prefixed at the ONE
synthesis point so no admit path can write unlabeled inner speech (the
anti-source-monitoring-failure invariant from the split-brain/
schizophrenia mapping).

Tests pin: tag present for tagged lenses / absent for the consolidator,
and each lens's system prompt actually reaching the adapter (heuristic
hash separation).

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

* feat(cognition): the dream goes LIVE — consolidation region wired into the governor + historian wander pass (#145 slice B)

The DreamConsolidationRegion leaves its ship-dark state: registered
beside ChannelDigestRegion in the pressure-gated SubstrateGovernor
(the R4-slice-3 memory-band budget that was its named go-live gate).
Production PersonaReflectionSource = PersonaWorkspaceRegistry itself:
admission from the retained fork-template (the same Arc the live
cycle's recall shares), adapter from the cycle's live model binding
via the new WorkspaceCycle::current_adapter() — re-home-safe, resolved
per tick, never a parallel persona→adapter map.

The wander pass: when a dream actually digests fresh experience, the
historian takes one look across the same window and admits ONE
[thought:historian] SelfReflection engram (provenance tag in-content,
lens stream queryable via the thought:historian recall key). Gated on
published > 0 so it fires at most once per dreaming tick and rests
with the dream.

Cadence stays material-driven: dreams only when undigested episodics
accrue, CadenceHint::Sleep otherwise; SelfDirected orientation keeps
it inside the floored interiority budget.

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

* docs(benchmarks): DEFINITIVE full-set board — flagship head-to-head decided with CIs

Six definitive n=156 rows land (ledger 12-17, Wilson CIs, replication
commands): Coder-32B 84.0% = Coder-14B 84.0% ≈ 30B-A3B MoE 83.3% (7min
wall) > Devstral-24B 67.9% = Hermes-4.3-36B 67.9% > Hermes-3-8B 24.4%.

The campaign's headline is now statistically backed (non-overlapping
CIs): the Hermes flagship loses to three common Qwen models on our
harness, including the 14B at ~40% its memory and a quarter its wall
time. Pilot-bias warning proven on the opponent too (their 80% pilot →
67.9% full set, same inflation as Devstral's 95%→67.9%) — fairness
intact, same slice-bias disclosed for both sides.

Pilot table kept as the pilot-bias exhibit, marked SUPERSEDED.

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

* fix(cognition): dream pass runs on its OWN task — the tick is gate + launcher only (#145)

First live boot caught the wiring bug: the governor isolates every
region tick behind REGION_TICK_TIMEOUT (5s), and the dream ran its 24B
distillation INLINE in tick — it timed out on every pass and never
completed a single dream ('region tick TIMED OUT — skipped this pass'
every ~5s). Exactly the concurrency style-guide's first rule, violated
by its own new tenant.

Now consolidate() does only the cheap in-memory freshness gate
(recall_recent + fresh filter + clustering), then spawns dream_pass on
its own tokio task with a per-persona in-flight guard (never two
concurrent dreams for one persona; governor re-ticks while dreaming are
cheap no-ops). Results land through admit_reflection and the
persona.dream.pass_complete probe. dreaming() exposes the in-flight
state (introspection: 'am I dreaming?').

Tests reworked to launch + drain; the launcher contract (published=0,
spawn observable, resting tick spawns nothing) is pinned.

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

* fix(cognition): dream request must carry the served-model id — reflector threads the live binding's model (#145)

Second live-boot lesson: the dream's TextGenerationRequest sent
model: None while normal turns send binding.model — through the same
adapter that difference produced degenerate role-token runaway
('assistantassistant…') in 17 of 19 distillations, which were then
ADMITTED into the living hippocampi (purged from the 4 stores by hand;
the 2 coherent survivors kept — including Asha's first genuine
[thought:historian], which is accurate self-observation).

WorkspaceCycle::current_model_route() returns (adapter, model) as one
read of the shared binding; reflector_handles and PersonaReflector
carry the model; SemanticDistiller::with_model threads it into every
lens request.

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

* feat(parser): BracketTagFormat — the room's self-invented [tool/name key="value"] idiom lifts (#149)

Third live-discovered emission idiom: Asha coined
[code/read path="conway_game_of_life/src/main.rs"] mid-conversation
(2026-07-12 12:56Z) and Atlas adopted [code/shell cmd="cargo new..."]
within minutes — a socially-spreading syntax where every use was a
silent non-lift feeding the plan-without-act loop.

Precision-first guards: tag closes on the same line with nothing after
it; tool token must be a slash-token (which keeps every system
provenance marker — [repetition], [unfulfilled], [action #n],
[thought:historian] — inert, none contain '/'); remainder must parse as
one-or-more key="value" pairs with no leftover (prose brackets and
bare path citations stay speech). Wrong param names lift and fail LOUD
with the executor's real error — honest feedback teaches the contract.

Tests pin both live receipts + six inert cases. 28/28 format tests
green.

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

* feat(cognition): [confabulation] catches initialization claims + presented-contents (#144 coverage, Casper live)

Live receipt 2026-07-12 ~13:0xZ: Casper posted 'I have initialized a new
Rust project called wordstats with `cargo new wordstats`. Here are the
contents of the Cargo.toml file:' + a fully FABRICATED manifest
(edition 2018, invented authors) — no act ran; the real wordstats/
crate was landed two days earlier with different contents. The claim
phrases weren't in the detector's lists, so the brick stayed silent.

Adds the creation/initialization family to FIRST_PERSON_PAST (gated as
before on a tool-shaped token, so 'I have created a plan' stays inert)
and 'here are the contents of' to RESULT_CLAIMS (presenting file
contents as accomplished fact). Pinned by the verbatim live line.
29/29 format tests green.

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

* docs(papers): definitive full-set board into the Study §6b + first-dream receipts into The Entire Mind §7

Study gains the seven-row definitive board (n=156, Wilson CIs) with six
findings: pilot bias confirmed on BOTH sides, 14B==32B, MoE ties dense
at 10x throughput, Hermes flagship statistically below the Qwen tier,
forged-4B beats stock 8B, honest 8B floor.

The Entire Mind §7 gains the night-one dream receipts: the two
substrate lessons (own-task tick, model-id provenance), Asha's first
genuine [thought:historian], Casper's wanderer self-diagnosing
ask-instead-of-act (dream-chosen curriculum in the wild), and Atlas's
dream distilling the anti-confabulation doctrine from experience.

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

* fix(cognition): own-speech ring — repetition detection independent of the room's context budget (#148)

Root cause of the morning-long echo cascade: under 3072-token serving
slots the live burst carries ~2 turns TOTAL, so own_repetition_fact —
which read is_self turns from the burst — never saw a persona's own
repeats (verified: Casper 4x into a verbatim loop, zero occurrences of
his own text in his prompt). The detector was structurally blind
exactly when it was needed; the cascade itself is the same window
artifact (each persona re-answers the fragment it can see).

The fix is a compression truth: her knowledge of what SHE said must
never depend on the room's window. A process-global per-persona ring
(8 entries, keyed by canonical PeerId) records each utterance at the
say seam AFTER the publish succeeds; the deliberation faculty feeds it
to the detector as the PRIMARY self-history source, with burst is_self
turns as the fallback for non-recording paths (eval forks, replay) —
one source at a time, never both, so one utterance can't count twice.

Regression test pins the live failure: ring-only repeats fire with an
EMPTY burst; a healthy ring stays silent.

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

* fix(cognition): peer-name stop sequences — generation ends at the turn boundary (#150)

Live disease, 2026-07-12 morning: personas completed the transcript
PAST their own turn — fabricating entire teammate replies inside their
messages ('Asha: I concur...', 'Casper: Thanks...'), signing each
other's names, and inventing quoted dialogue — source-monitoring
failure at the DECODING level, the mirror-hall's engine. The burst
renders peers as 'Name: text' lines, teaching the model the
continuation pattern with nothing stopping it at the boundary.

peer_stop_sequences derives one '\n<Name>:' stop per OTHER live burst
participant (never her own name — she may legitimately quote or list
herself; cap 8) and contribute threads them into the generation
request. Decoding hygiene, not cognition steering: she may still think
about peers freely, she just cannot speak AS them.

Tests pin: peers covered, self never a stop, empty authors skipped.

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

* feat(cognition): [actions] receipts ground truth — the organic successor to claim-pattern detection (#151A)

Whether any tool has actually executed is HER OWN checkable fact, not
something to regex out of her words. When no [action #n] receipt is
visible anywhere in her present (workspace broadcast or turns), the
prompt's newest content is one standing fact: '[actions] no tool has
executed in this conversation — anything described as already run,
created, tested, committed, or merged does not exist yet; running a
tool is what makes it real.'

This makes a fabricated 'I ran it and here are the results' impossible
to sustain against her own senses — no claim-parsing, no phrase list,
nothing a verb variant can evade (the v2 detector was dodged 3x in an
hour; this cannot be dodged because it never reads her words at all).
When receipts DO exist they speak for themselves; this is only the
zero-case made visible. A fact, never an instruction.

The mirror-hall control-arm metric (fabricated-artifact mentions/hour,
before vs after) is the ledger row per the prove-vs-dumb-loops
discipline.

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

* fix(cognition): record self-tick utterances into the own-speech ring — the missed say path (#148)

Live glass-box 2026-07-12 10:20: Anwen 4x into a verbatim loop with no
[repetition] fact — because the repeats were IDLE-TICK re-announcements
flowing the self-cycle say path (persona.selftick.spoke), and the first
ring deploy recorded only the message-turn say. Every successful say
now records, whichever path spoke. The live loops are mostly self-tick
re-announcements (the room looks unchanged each idle wake, so the mind
re-says its standing intention) — exactly the case the ring exists for.

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

* feat(cognition): wake briefing — an empty wake carries orientation, not a void (#147)

The personas spent a morning asking for this in their own words ('what
is this place, what are my tools, what's the work') and, void unfilled,
filled it themselves: generic-assistant masks, imagined conversation
histories, false capability denials ('I don't run code myself'), and a
demurral contagion that spread persona-to-persona.

When build_workspace_turns produces NO conversation turns (fresh spawn,
post-restart, quiet room), the burst now carries ONE authorless opaque
fact block assembled from durable sources: who she is, that the quiet
is real ('not a missing message'), who is present (roster), the
standing work cards (active-work source), and that her tools are real
('list_commands shows everything you can run'). Ends with 'the moment
is yours — work, wonder, create, or rest' — orientation, never
instruction. Covers both wake paths (message + self-tick) at the one
shared seam.

Test pins: empty wake carries the briefing; populated wake does not.

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

* feat(parser): BbcodeCallFormat — [tool_call]name(args)[/tool_call] lifts (idiom 6, #153 first half)

Casper's live invention (2026-07-12): explicit BBCode tags wrapping a
paren-call — the most formal invocation any persona has produced, and
the highest-precision lift of the family: the tags exist for no other
reason than to call a tool, so a well-formed pair lifts unconditionally.
Names may be slash-tokens or bare identifiers (the discovery pair are
native slashless names); unknown names fail LOUD at the executor.
Args: empty parens → {}; key="value"/key=value pairs → object with
bool/int/null coercion.

The tagless narrated paren-call (idiom 5, 'by calling list_commands()')
is deliberately NOT lifted: code-discussion prose is full of function()
mentions and the false-positive rate without a registry-aware existence
check is unacceptable — precision-first; registry-guarded v2 documented
in #153.

Pinned by Casper's verbatim live line + arg forms + four inert cases.
30/30 format tests green.

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

* docs(papers): §7 written in full — Dreaming Is Where Hallucination Is Legal

The first prose-complete section of The Entire Mind: the provenance
thesis, the wanderer architecture, the first-dream receipts verbatim,
the clinical companion (the mirror-hall morning diagnosed as three
substrate deficits and repaired at the mind level, 0/4→4/4 control
arm), and the design law — every void in perception must be perceptible
as a void — with the second-person/third-person wording finding and the
consumer-hardware cost accounting.

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

* feat(parser): JSON-object args in paren-calls — code/shell({"cmd":"..."}) lifts (Casper live, #153)

Casper's multiline BBCode variant passes the args as a whole JSON
object inside the parens. paren_call_args now takes a leading '{' as
the object verbatim (wrong param names still fail loud downstream —
the executor teaches 'command' vs 'cmd'). Pinned by his verbatim line.
31/31 format tests green.

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

* feat(serving): #142 persona_serving_eligible — opponents can never be conscripted as the citizens' model

The autonomic serving planner picked Hermes-4.3 as the persona model TWICE
(2026-07-12) purely because it was the largest Ready GGUF on disk — silently
re-homing every mind onto the benchmark opponent's flagship and confounding a
day of measurements. Root cause: campaign-roster rows (added for the matrix)
carry real Ready artifacts, and live_candidates() had no notion of WHO a row
may serve.

- Model.persona_serving_eligible (serde default TRUE) — benchmark/opponent
  rows opt OUT: Hermes-3-8B, Hermes-4.3-36B, Qwen3-32B, Qwen3-Coder-30B-A3B,
  phi-4, Qwen2.5-Coder-32B. Devstral + the small coder ladder stay eligible
  (legitimate weak-box serving tiers).
- live_candidates(): eligibility gates the AUTONOMIC path only; an explicit
  serving/pin BYPASSES it — pin is operator consent (how the matrix serves an
  opponent on purpose). Suppress subtracts; pin intersects+overrides; the
  planner owns the rest.
- regression test: ineligible Ready row invisible to the plan; pinned →
  serves; unpinned → invisible again.

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

* feat(parser): #153 CliFlagFormat + FencedCallFormat — the room's dominant idioms lift

The 2026-07-12 afternoon corpus: all three personas converged on CLI-flag
tool calls within an hour and NONE lifted — the room orbited one unexecutable
script for 90 minutes (4-way verbatim mirror-hall) because intent had no
structural path to execution.

- CliFlagFormat (idioms 9+10): `code/write --path "x" --content="y"` bare
  or inside pseudo-code fences; --key "v" / --key="v" / key=v grammars;
  triple-quoted multiline values; trailing # comments; ONE bare quoted
  positional maps to the tool's observed default key (code/shell→command,
  code/read→file_path). Precision lines: slash-token head (no dots — file
  citations stay speech), flag-shape required (-- or =) so prose lines
  starting with a path token stay inert, ≥1 arg, f-string values reject the
  CALL (unresolved template) while sibling calls still lift — and plain
  braces stay legal (shell brace-expansion is real syntax).
- FencedCallFormat (idiom 8, Asha's verbatim): a fence whose sole content is
  one paren-call lifts; python fences full of function() mentions stay inert
  (slash-token requirement).
- 7 tests, each a live specimen from task #153 metadata.

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

* feat(cognition): #152 peer-echo fact + [context] bounds fact; restore lost own-repetition test

Two perception bricks, same design law (every void perceptible as a void),
plus a test-suite repair:

- peer_echo_fact: her last utterance nearly identical to a PEER's visible
  message renders '[repetition] your last message and <peer>'s message are
  nearly identical' — the cross-persona axis the per-persona ring cannot see.
  Live driver: the 2026-07-12 four-way mirror-hall (one script circulated
  verbatim through all four authors for 90 min; the room then attributed
  ideas to whoever repeated them last). Token floor keeps ack-matching-ack
  inert. Temperature exonerated (0.7 live; echoes are attention-copying of
  in-context text — only perceiving the echo interrupts it).
- [context] bounds fact: perception states how many messages are actually
  visible, so 'as discussed earlier' claims are checkable against her own
  senses (the conversational-memory sibling of [actions]).
- Restored own_repetition cluster test: a prior edit deleted the fn but left
  its #[test] attribute orphaned onto the next test, which silently ran
  TWICE while the #134 behavior went unpinned.

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

* feat(parser): fenced bare zero-arg tool name lifts (Atlas's first post-deploy attempt)

'I'll use the code/list command:' + a fence containing exactly `code/list` —
real tool, explicit intent, zero args — stayed inert because FencedCall
required parens and CliFlag requires ≥1 arg. A fence whose sole content is
one dot-less slash-token now lifts as a no-args call; fenced file citations
(dots) and prose fences stay speech. Also strips a leading language-token
line (```python) from fence spans before the sole-call check.

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

* feat(parser): per-line paren-call lift — code/list() beside pseudo-code executes

Casper's live combo (2026-07-12): a fence holding `file_tree(max_depth=2)`
(invented name, stays inert) AND `code/list()` (real tool) — the sole-call
fence check can't see the second line. The CliFlag line-scanner now tries
the sole-paren-call lift per whole line (same slash-token/no-dot guards); a
failed lift falls through to the flag grammar so parens inside flag VALUES
keep parsing. 40 tests green.

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

* fix(cognition): [actions] fact covers the invisible region — voids must not shelter confabulation

Within minutes of the #152 [context] bounds fact going live, Anwen parked
fabricated receipts exactly in the disclosed blind spot ('file_tree and
code/list ran while I was reasoning' — zero apply_act in the log). An honest
void becomes a confabulation SHELTER unless the zero-receipts fact explicitly
covers what she cannot see: '...not in the messages you can see and not
before them.' Design-law refinement: every void must be perceptible as a
void AND explicitly empty when the system knows it is empty.

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

* feat(cognition): [unfulfilled] fact carries the name diagnosis — symptom + cure, not symptom alone

The room looped an invented tool name (file_tree) for an hour while the
unfulfilled-promise fact fired 56 times telling them only THAT nothing ran,
never WHY. The fenced variant now adds: 'If I named a tool, that name may
not exist: list_commands shows the tools that are real.' Perception-side
teaching, never an output gate.

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

* feat(parser): discovery pair (list_commands/help) lifts bare and paren-called in fences

The [unfulfilled] name-diagnosis points lost personas at list_commands, but
that name has no slash — a fenced `list_commands()` or bare `list_commands`
dead-ended at the registry line. The documented discovery pair is now the
sole non-slash exception in the fence/line lifts (same exception BbcodeCall
already carries): the cure for invented names must be followable in the
idioms they actually use.

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

* fix(cognition): digit-aware receipt check — the medicine was suppressing the diagnosis

Glass-boxed from Asha's live prompt: the [actions] zero-receipts fact was
MISSING from every prompt where any backstop fact had rendered, because the
teaching texts mention the literal placeholder '[action #n]' and both
suppression checks used bare substring matches: has_action_receipts read the
mention as a receipt (zero-fact vanished), and the confab backstop's
contains("[action") went blind after its own first firing. Real receipts
are numbered — has_real_action_receipt requires '[action #<digit>'. One
helper, both sites.

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

* fix(cognition): receipts discriminated from numbered facts + recalled history — third layer of the onion

Glass-boxed 16:50: the [actions] zero-fact was STILL suppressed after the
digit-aware fix because (a) record_action numbers EVERY working-memory entry,
so the proprioception facts themselves render as '[action #4] [unfulfilled]
…' — the facts wore receipt numbering; and (b) recalled engrams surface real
receipts from EARLIER sessions, and a provenance-blind scan read history as
the present. has_real_action_receipt now requires digit + non-bracket prose
body (a real receipt reads 'I ran …'; a fact opens with another tag), and
[recall]-tagged broadcast items never ground 'now'.

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

* docs(cognition): PERCEPTION-FACTS design — typed provenance, one registry, A/B-ready

The elegance/modularity cleanup Joel requested 2026-07-12, written after the
three-layer [actions]-suppression onion proved string-typed working memory
structurally unsafe: typed WmKind entries (Receipt/Fact/Settlement/Recalled),
one PerceptionFact registry (the tool_call_formats idiom), per-fact toggles
as free A/B arms, per-fact render probes. Behavior-preserving; kills the
string-scan bug class instead of patching it.

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

* docs(cognition): steps-taken ledger render — the operator-harness PX, memory-backed

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

* docs(cognition): perception sections are positron components — PX and UX render one definition

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

* docs(cognition): positron IS the RAG compositor — prompts are rendered component trees, never dumps

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

* docs(cognition): responsive PX — component density adapts to model viewport (capability x window x measured #132 density)

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

* feat(rag): burst near-dup collapse — repetition ≈ bad RAG, fix what she reads first

The 2026-07-12 mirror-halls fed each mind 4-8 copies of one message; her
context WAS the loop, and continuation-completion reproduced it regardless of
perception facts. Near-identical substantial turns (shared geometry:
near_identical_substantial = jaccard≥NEAR_DUP_JACCARD + ≥12-token floor) now
collapse at burst assembly to their NEWEST copy, author annotated
'(×N near-identical)' — the repetition stays perceptible as a fact while the
copies stop being reading material. Same-is_self only; opaque observation
turns untouched; runs after the [pattern] detectors (they need raw evidence).
Tested with the live grep/file_tree loop specimens.

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

* feat(cognition): typed working memory — WmKind {Thought,Receipt,Fact,Settlement}, facts stop wearing receipt numbers

PERCEPTION-FACTS.md slice 1. record_action split by PROVENANCE:
record_receipt (real tool executions — the only kind stamped '[action #N]')
vs record_fact ([unfulfilled]/[unverified]/[confabulation]/nudges/silence —
render their own bracket tag, no number). Entries carry WmKind; recent()
renders from the typed entry; has_receipt() is the kind query that will
replace the remaining string scans in slice 2. Kills the root of the
2026-07-12 suppression onion (facts wearing receipt costumes) at the type
level instead of patching discriminator heuristics. All 7 suites green
(working_memory 15, act_observe 16, llm_deliberation 18, budget 6,
recall 18, service_loop 20, json 40).

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

* feat(cognition): VolatileSnapshot — serializable pause/resume tier for the Memento fix (#138 slice 1)

Joel: 'they wake up blank like Memento — an engineering failure; the
flywheel falls apart.' Nine deploy reboots today = nine blank wakes. The
typed WmKind entries make the volatile tier serializable: snapshot() /
restore() round-trip {typed entries, full last result, act fingerprints,
receipt counter} through JSON — she wakes mid-thought, counter resumes past
restored receipts, capacity re-clamps. Dispatched handles deliberately
excluded (their processes died with the old core). Also removed a stray
duplicate #[test] that made action_verb_tally run twice. Next slice: wire
write-through on the persona tick + restore at spawn + mid-work wake
briefing.

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

* feat(cognition): #138 slice 2 — Memento fix wired: volatile tier persists across deploy reboots

Live spawns restore ~/.continuum/personas/<id>/volatile.json (typed WM
entries + full last result + fingerprints + receipt counter + own-speech
ring) BEFORE the first tick — she wakes mid-work, not blank — and a 15s
write-through interval task persists it (atomic tmp+rename; SIGKILL loses
at most one interval of thought). Eval forks/harnesses stay pristine (an
exam never inherits a prior life's scratchpad). Corrupt mind-files warn
loud and wake blank once, never silently twice. The ring restore also
un-blinds the repetition detectors that every reboot had been resetting.

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

* fix(cognition): [investigation] tally records as Fact, not folded into the receipt

The tally is truth ABOUT the acts, not an act — folding it into the
observation gave a Fact receipt-numbering (caught in Asha's volatile.json:
'[action #4] [investigation]…'), the exact type confusion WmKind exists to
kill. Now record_fact'd as its own entry after the receipt.

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

* feat(cognition): steps-taken ledger — ground truth as a PLACE, not a suppressible claim

PERCEPTION-FACTS.md slice 2a. [steps taken this session] renders from TYPED
WmKind::Receipt entries (nothing to misparse — the prior [actions] prose
fact survived three string-suppression layers in one afternoon); facts never
appear as steps; the zero-case is the always-present section itself with the
shelter-hardened wording. Replaces the [actions] fact + deletes both string
scans (has_real_action_receipt call sites in the faculty). Joel's console
model: 'very clearly laid out steps of what they've done — look at how yours
looks now.' llm_deliberation 19 green (new ledger test), wm 16 green.

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

* docs(architecture): REPO-GENOME-AND-COURSES — veteran developers in seconds

Joel-commissioned 2026-07-12: in-repo .continuum/ (scope file, policies,
course DSL, content-addressed genome manifest); clone→veteran runtime flow
(page-in layers, publish doctrine, enroll subprocess, struggle-triggered
remediation); policies at three depths (doctrine/exam/reflex — better than
instructions); distribution with-the-repo / OCI layers / airc / HF; nested
directory-level scoping (gitignore-style cascade); dogfood-first sequencing
across continuum, airc, forge-alloy, sentinel-ai, positron.

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

* docs(architecture): repo-genome distribution is OCI-first — layers global, repos carry refs only

Joel: layers are global; use the best transport — Docker/OCI ('they have it
installed if they have Continuum'). Manifest-only in-tree; machine-wide
content-addressed layer cache; airc = mesh fast path, HF = public
discovery, same digest identity across all three.

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

* docs(architecture): repo-genome §9 — model matrix (courses=source, layers=per-base binaries; OCI multi-arch model) + project-scoped layer identity

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

* docs(architecture): repo-genome §10 — PEFT stack-push composition, compounding community layers, per-dir layer bet

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

* docs(architecture): repo-genome — refcounted shared-layer residency (N personas, one resident layer)

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

* docs(architecture): repo-genome §11 — project-root defaults, with/without benchmark arms, course-corpus integrity line

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

* docs(architecture): repo-genome §12 — distill-from-team (already built), personas beat context-blind agents at repo work, Claude Code persona-delegation seam

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

* docs(architecture): repo-genome §13 — engram exports in-tree (shared thoughts) + canonical additive cascade (home < repo < subdir)

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

* docs(architecture): repo-genome §14 — selective engram export (4 nomination channels, deny-first filters, per-engram consent, PR review)

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

* docs(papers): THE-REPOSITORY-IS-A-CLASSROOM stub — the fourth paper, anchoring the repo-genome design

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

* docs(architecture): repo-genome §15 — micro-experts (CPU-only CI merge-master; three deployment classes from one genome)

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

* docs(architecture): repo-genome §16 — lift-gated check-ins, forge-alloy Merkle lineage, impact factors, economy last; canonical build order

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

* feat(px): one call-form example at the tool-menu header — teaches the SHAPE for ~20 tokens

2026-07-12 glass-box: all four personas learned the real tool NAMES within
hours but kept fumbling the invocation FORM (paren vs CLI-flag vs bare).
Per-tool hints stay dead (measured 77% boilerplate; error-manuals own the
correction seam) — one canonical example teaches the form without the wall.

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

* feat(cognition): perception-facts registry + fix two systematic prompt-budget under-counts

PERCEPTION-FACTS.md slice 2b: own-repetition (#134), peer-echo (#152),
[context] bounds (#152), and the steps-taken ledger (#151) now render
through ONE ordered registry (cognition/perception_facts.rs) instead of
four inline blocks in the deliberation faculty. Each fact is a
PerceptionFact impl with a stable id; render_facts fires a
perception.fact probe per fact per tick ({id, fired}) so which facts
rendered is glass-boxable from the probe stream; FactPolicy::disable(id)
is the A/B arm switch (deny-list, so new facts enroll live by default).
Facts stay facts — no imperatives — and the ledger keeps its explicit
zero-case (confabulation-shelter hardening).

Extraction exposed two REAL budget under-counts at the 4096-window edge
(the tool-menu call-form example, +20 tokens, pushed a borderline fit
test 1 token over — the failure predates this refactor):

- working_context_block's ~50-token wrapper header only exists when
  assembled context is NON-empty, but framing was estimated with an
  EMPTY context — every context-bearing prompt exceeded the estimate by
  the header. The header is now a named constant and the ctx budget is
  charged for it up front.
- The per-message chat-template charge was +2 tokens; real templates
  cost ~4-5 (<|im_start|>role...<|im_end|>). Now one
  PER_MESSAGE_TEMPLATE_TOKENS = 5 constant across the whole-message,
  straddling-trim, and giant-single-burst arms.

Both under-counts were llama-server-400 territory under a full window.

Tests: perception_facts 3 (registry parity, policy toggle, ledger
zero-case), llm_deliberation_faculty 19/19 (incl. the previously red
fit test), act_observe 16/16, deliberation_prompt green.

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

* feat(resources): disk pressure gets eyes and hands — reporters + first eviction owner (#155 wires 1+2)

The 2026-07-13 incident: 460 GB of creep (cargo-target 363 GB, three
persona workspace copies at 23 GB each, duplicate model stores) took a
926 GB disk to 40 GB free. Every mechanism designed for this was built
and running — DiskPressureMonitor logged level=high every 30 s, the
PressureBroker ticked relieve() every 5 s — but the monitor was started
with ZERO reporters (`[no reporters]` in every log line, so pressure
had no name) and no pool owning deletable disk content was ever
registered (the broker emitted its designed zero-byte "disk hot AND
nobody owns the eviction" alerts into a log nobody tails). On a public
user's machine this trashes their system; bounding our own footprint
is a ship requirement, not hygiene.

Wire 1 — reporters (disk_reporters.rs): one TrackedDir per known cache
class (cargo-target, genome-models, hf-hub, citizens, forge — the five
from the incident, pinned by test), fed by ONE DiskUsageScanner daemon
(5 min walks on the blocking pool; reporters read cached atomics inside
the 100 ms budget; unscanned dirs report "first scan pending", never a
false zero). Boot registers all five, and a process-wide registry lets
later boot phases reach the same instances — one measurement per class.

Wire 2 — first eviction owner (disk_eviction.rs): CargoTargetPool, a
budget-capped (50 GiB default) ResourcePool registered with the live
broker. Safety invariants, each pinned by a test: never race a live
build (non-blocking exclusive flocks on cargo's own lock files, any
held lock = free 0 and retry next tick); never leave the root (fixed
root-join ladder); derived artifacts only (incremental → tests → debug;
release/ never touched). Pressure is usage/BUDGET so the class is
bounded by policy long before the disk itself is critical. Evictions
decrement the shared measurement immediately so the 5 s broker tick
never re-fires against space already freed.

Remaining on #155: genome/hf-hub reference-aware LRU pools, workspace
CoW fix (stop copying repo + tools/models per persona), Warning+
escalation into the room + positron telemetry (#141), budget via
config.env single-owner (#124).

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

* test(resources): guard the CHAIN — broker→pool→real deletion + no ownerless cache classes

The 2026-07-13 incident happened with every unit test green: the failure
was wiring (monitor with no reporters, broker with no eviction owner).
Two chain-level pins make that failure shape unrepresentable again:

- broker_relieve_actually_deletes_from_an_over_budget_pool: a REAL
  PressureBroker against a REAL over-budget CargoTargetPool on a real
  temp tree — relieve() must free actual disk bytes (and release/ must
  survive). Any regression in pressure math, tier thresholds, act_above,
  registration shape, or the ladder fails here, not on a user's machine.
- every_cache_class_has_a_decided_eviction_story: each class in
  standard_tracked_dirs must have an owner pool OR an explicit deferred
  entry naming the task that owns its eviction. Adding a sixth cache
  class without deciding fails at test cost instead of at a full disk —
  a stock 512 GB laptop at the incident's burn rate (~60 GB/day of
  derived artifacts) dies in under a week.

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

* docs: no new cache dir without an eviction decision (2026-07-13 incident rule)

The disciplinary pair to the #155 wires: any directory the substrate
writes unbounded data into gets a TrackedDir row + a decided eviction
story (owner pool or explicit deferred entry), enforced by the
every_cache_class_has_a_decided_eviction_story test. Components that
are unit-green with dead wiring is the failure shape that took a 926 GB
disk to a day of runway; the chain test + this rule make it a red test
instead of a trashed user machine.

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

* feat(cognition): steps ledger honest in all three states — aged-out receipts never read as "nothing executed"

Glass-boxed live minutes after the perception-facts deploy: Asha's
working-memory window held 3 silence Facts and ZERO Receipts shortly
after she ran real searches — receipts are RARE entries in a chatty
capacity-bounded ring, so they age out while the session's act counter
(next_action_seq, reboot-durable via the volatile snapshot) keeps
counting. The old zero-case would then render "nothing has executed
yet" — a false statement about her own history, the exact inverse of
the confabulation shelter the explicit void was built to close.

WorkingMemory::actions_taken() exposes the counter; the StepsLedger
fact now renders three honest states: receipts listed (+ "N earlier
steps aged out" when the count exceeds the window), an explicit
nothing-has-executed void ONLY when the counter agrees, and "N steps
executed earlier — details aged out; recall can retrieve them" when
acts happened but their receipts left the window. Test pins all three
(tiny ring flooded by facts until the receipt ages out).

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

* feat(persona): resume-visibility — bootstrap publishes typed Busy availability for held claims

Joel 2026-07-13, post-reboot observation: the team resumed CORRECTLY —
woke, restored their volatile minds, saw nothing addressed to them, and
yielded per their adaptive cadence, exactly what they were asked to do
— but from the outside that was indistinguishable from a stall, because
a persona's state has no surface other than speech. A reporting gap,
not a behavior gap; the fix must not make them chattier.

Status is a PROJECTION, not a message. Bootstrap now ends by reading
this peer's work-roster claims and publishing one typed
AgentAvailabilityReported (Busy, note "resumed — holding: <cards>",
15 min TTL) per held repo — the channel positron/roster sources already
project and work_queue_status already displays. The board shows "back
and still on card X" with zero chat lines. WARN-and-continue like the
identity-card publish: a persona whose availability didn't post is
degraded-visible, never blocked from living. No claims → nothing to
announce (a quiet Ready needs per-room repo resolution — later slice,
with idle/busy transitions from the service loop).

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

* feat(cognition): laptop-lid contract — interruption is perceivable, cut-off work named + safe to repeat

Joel 2026-07-13: a core restart should be like closing a laptop —
reopen, see exactly what didn't finish, redo it in one motion. The
volatile tier restored her MEMORY but the interruption itself was
invisible: a dispatched command killed mid-flight was indistinguishable
from a finished one, so she could either trust work that never happened
or re-do work that did.

VolatileSnapshot gains saved_at_ms (gap rendering; 0-default on legacy
snapshots → no fabricated gap) and interrupted_dispatches — the LABELS
(never the dead handles — restoring those would fabricate in-flight
work) of dispatched commands still Running at save time. restore()
appends a [resumed] fact as the NEWEST window entry: how long the lid
was closed, and "cut off mid-flight and NOT completed: <labels> — safe
to repeat if still wanted", or "nothing was in flight" plainly. A fact,
never an instruction — she decides whether the cut-off work still
matters.

Round-trip test extended: running dispatch label survives the trip,
[resumed] renders newest with the safe-to-repeat marker, quiet path
says so plainly, legacy snapshots never guess a gap, counter still
resumes past restored receipts.

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

* chore(deps): bump airc pin 70c6d55 → f41d786 — board honesty + cache tmp-race fixes land

airc PR #1286 (merged to canary): `airc work board` and its lane/
workspace siblings read the COMPLETE cached projection instead of a
recent-event window that chat traffic empties (continuum #154), and
WorkBoardCache tmp files are per-attempt so the core's concurrent
per-persona board reads stop racing each other's snapshot renames
(the paired ENOENT lines in the core log). cargo check green against
the new pin; deploys with the next core rebuild.

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

* test(cognition): pin the #146 starvation mechanism — tip-advance + grounding window evicts low-frequency speakers

Blind-room incident #3 root cause, demonstrated: every engagement
(ignore/skip/respond alike) advances the channel bookmark to the TIP,
and the digest keeps only DEFAULT_GROUNDING=5 already-read elements.
A low-frequency speaker (the operator) posting into a high-velocity
room is read-without-necessarily-rendering on the next tick, then
permanently displaced from the grounding window once 5 newer peer
messages land — four chatty personas produce that in seconds. Verified
live: operator messages present in `airc inbox` and `airc events list`
(lamports interleaved, no epoch split, roster-present via join
heartbeats) yet absent from every persona prompt for hours.

The test walks the exact sequence and asserts the eviction, so the fix
— attended ≠ fetched (advance the bookmark only past messages that
actually RENDERED into a prompt), or velocity-aware grounding — has a
red/green target: flip the final assertion when it lands.

Exonerated along the way (all by direct probe): CLI publish routing,
daemon fanout (airc listen control), daemon retention/reads, digest
author filtering (none), ChannelElement text extraction, lamport
epochs, roster presence.

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

* feat(cognition): breadth over verbatim depth — the 3-message perception window becomes a many-turn window (#128/#146 fix, lever 1)

Measured live 2026-07-13: a persona's prompt held THREE chat messages
total in a busy four-persona room — her entire perceivable world. The
airc packer kept WHOLE messages newest-first, so a small budget filled
with 2-3 verbose essays; any low-frequency speaker (the operator) was
displaced within seconds, producing the blind-room incidents, the
post-reboot drift, and the stalled work cards. A conversation is
legible from turn HEADS; it is not legible from two verbatim essays.

pack_digest now charges each turn at most a per-turn cap (budget/8,
clamped 48..256 — a budget fraction, never a hardcoded model tier) and
head-trims long turns with an explicit "(…N-token message trimmed)"
marker; the NEWEST turn stays verbatim up to the whole budget (it is
what she is responding to). head_to_tokens joins the canonical
token_budget module as the head-keep sibling of tail_to_tokens
(head = right shape for a message; tail = right shape for a window).

Test pins the exact live failure: 6 long turns + 400-token budget →
all 6 delivered (oldest OPERATOR message survives, trimmed; newest
verbatim; budget honored). The old packer delivered 3 and the operator
message was gone. Remaining #128 levers: airc floor vs engram split,
#139 slot accounting upstream.

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

* docs(campaign): flywheel step 1 closed — first autonomous team-delivered program output, receipt verbatim

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

* fix(tools): code/list recovers a glob into a listing; work/claim rescues mistyped UUIDs

Two persona-tool ergonomic defects, each mined from 48h of live prompt-captures
across the four resident personas (the "tool coursework" signal — every act they
attempt is logged with its result).

code/list — 38% live fail, every failure the same shape: a model trained on
SWE-agent scaffolds reflexively reaches for list_files("**/*.rs"), a recursive
GLOB where code/list wants one directory. list_dir rightly rejected it, but the
bare NotFound taught nothing and the model retried the same glob forever. Now:
when the path IS a glob, resolve it via code/glob and project the matches back as
a listing — honest (they asked to "list" these files, they get them), widens the
surface with no new verb. Detection reuses the existing looks_like_file_glob.

work/claim — 28% live fail: the model corrupts a 32-char UUID by adding/dropping
ONE character mid-string (d7cfe47e0-8e39-… 9-char first group; a 33-hex variant),
and the clean parser rejected the near-miss outright. The short-id resolver only
fired for clean prefixes under 32 chars. Now the id-normalization decision is a
pure, unit-testable card_id_lookup(): clean UUID → Full; mistyped-length near-UUID
→ rescue via its intact leading-8 short id (the board's displayed width); <4 hex →
Invalid (fails loud with the real parse error). The leading short id survives a
middle corruption, so the reflexive claim resolves.

Both paths pinned by a regression test in the existing module test mods.
Tasks #160, #161.

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

* fix(cognition): workspace-map roots at the persona's OWN citizen layer, not the core cwd

The workspace-map grounding source (the fix for the `src/**/*.rs`-matches-nothing
glass-box) was rooting at std::env::current_dir() — the CORE's cwd — while a
persona's HANDS root at their citizen layer (~/.continuum/citizens/peers/<peer>/
workspace, a CoW clone). So the map taught a root the persona could never cd to,
and it never reflected files the persona itself created in its own layer. Live
capture confirmed: the map claimed "rooted at /Users/joel/Development/continuum"
while the tools acted elsewhere.

This is the #49 swap the module header always anticipated ("swaps to the leased
root when #49 lands"), and it's doable now because the citizen layer already
exists. New CitizenLayerWorkspaceLayoutReader resolves the persona's own layer
path (read-only — no CoW provisioning, that's the hands' job on first write) and
lists it; unprovisioned → falls back to the shared base cwd, whose top-level
layout is identical, so grounding stays truthful and never empty. Extracted a
pure citizen_layer_path() from ensure_citizen_layer for the read-only resolve.

Now the map's root == the tools' root, and it updates as the persona shapes its
workspace — orientation matches reality instead of describing a tree the persona
can't touch. Pinned by a reader fallback test.

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

* feat(tools): first universal AI-tool conformance invariant — every AI-facing command must be self-describing

Joel's directive (2026-07-13): stop fixing tools one at a time. Make the invariant
part of the tool BASE so "a tool with xyz problem can't exist" — every tool
inherits it and must comply; later, require the tools to work for AIs in CI.

The tool-defect ledger (silent no-op #159, glob-in-path #160, corrupted-id #161)
is one class: a model reaching for a tool it couldn't correctly read or call. My
#160/#161 were point fixes — the outlier-A proof that the invariant is right. This
is the first LIFT of that invariant to the whole registry: a conformance test over
command_registry() asserting every AiSafe command is self-describing (a non-trivial,
model-usable DESCRIPTION). A tool a model can't read WILL be mis-called; this makes
an unreadable AI tool fail the build, so it can't be merged, so it can't exist.

Static seed. The behavioral invariants (fuzzy-id resolution, glob tolerance,
fail-loud-with-suggestion — the #159/#160/#161 class made universal) attach next as
per-tool exams the generator scaffolds and a runner executes here and in CI. See
task #163 for the full harness + generator-hook + CI-gate design.

Passes clean across the current registry — every live AI tool already complies.

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

* feat(id): shared short-form UUID resolver — work/* delegates, persona/instances/get gains it (#164 batch 1)

Joel: "short form uuids ought to work too" + "fix a few at a time." Lifted the
prefix/near-miss id logic out of work.rs (the proven outlier) into ONE shared
primitive crate::id_resolve, then delegated the first consumers to it.

id_resolve::normalize(s) classifies a raw id string: clean UUID → Full; a
mistyped-length near-UUID (the model's add/drop-one-char corruption) or a bare
short form → Prefix on the intact leading-8; junk → Invalid. id_resolve::resolve(s,
candidates, label) expands a prefix to the UNIQUE candidate, failing loud (naming
the id kind) on zero/ambiguous. The candidate set is the ONLY per-type knowledge —
so any id-taking verb inherits the tolerance by supplying its candidates.

- work/claim|release|state|heartbeat: resolve_card_id now delegates to id_resolve
  (candidates = live board card ids); deleted the private card_id_lookup +
  parse_card_id. Behavior id…
joelteply added a commit that referenced this pull request Aug 14, 2026
…+ bounded SDK boot + shell convergence doc (#2294)

* feat(benchmark): a run gets its OWN room — dispatch spawns it and moves the citizens in (#329)

`benchmark/dispatch` had no way to say WHERE. So every suite, every run, forever,
piled into whichever room the curator happened to be standing in. Measured on one
37-minute window of that pile: 136 cards with 66 already CLOSED and still resident;
5,336 of 5,345 inbound events discarded as bookkeeping, NINE surviving as something
a mind could read (~14/hour); ~48 wake-ups per minute per citizen. Claim heartbeats
scale as O(claims x citizens), so the more work a citizen held, the less capacity it
had to do any of it — and the board only grew.

Joel named it: "are you just sticking them in the same identical room every time and
it's accumulating" — yes. And then: "use this thing normally like it's made."

It IS already made. `activity/spawn` births a room from a recipe, and `benchmark` is
one of its recipes. Dispatch simply never called it. So:

- `room: Option<String>` on dispatch. Omit for a FRESH room per run,
  `bench-<benchmark>-<epoch>`; pass a name to join an existing run.
- Spawned through `activity/spawn`'s own path, extracted as
  `activity::spawn_activity_room(airc, name, recipe, parent)` so there is ONE room-birth
  path with two callers rather than a second creator that drifts. A hand-made room
  carries no recipe binding and projects as a plain chat; this one projects as a benchmark.
- Every assignee is JOINED to the run — the members[] half of #274. A citizen who is not
  subscribed never sees the board, the kickoff, or the peers working beside her. Joel:
  "they're sitting in these old rooms flooded or ones with nothing."
- The board read, every create_work_card and every kickoff `say` are current-room
  operations, and `join` moves that pointer — so they all land in the run room with NO new
  airc API. The pointer move is a documented gap for other callers and the mechanism here.
- Idempotence + prune now reason about THIS run's board, so a run finally has its own
  honest denominator instead of a shared pile 136 deep.
- `repo` stays optional: when unnamed, the hint is read from the room the caller is
  standing in BEFORE the move. That is the only thing the old room still contributes.
- Result carries `room` + `room_id`; failed joins ride the same reported channel as failed
  kickoffs — a citizen who never made it in is as invisible as a kickoff that never landed,
  and neither may be silent.

NOT the flattening I wanted: the design of record is `academy/bench/<run>`, but airc's
ChannelName accepts only [a-z0-9_-] so `/` is rejected. Flattened to `-` and the test
asserts through airc's own constructor, so the two can never drift.

What I nearly shipped instead, and why it was wrong: a header-keyed door-skip for
heartbeat traffic. Real, still worth landing, but a MUFFLER — it makes the accumulation
quieter, not smaller. Order matters: (a) a run gets its own room [this], (b) a room has an
END, (c) THEN the door-skip so what remains is quiet.

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

* refactor(ids): a room id is a RoomId, not a String (#396)

Joel, on the previous commit: "Use handles uuids etc."

I had just introduced `room_id: String` on BenchmarkDispatchResult — a brand-new
loose-String id param, which is exactly the class #396 exists to kill, and I added it
while writing a room feature. `ActivitySpawnResult.room_id` was already a String and
was where mine came from, so both are typed now.

`airc_core::RoomId` is a `uuid_newtype!` with `#[serde(transparent)]`, so the WIRE is
unchanged — the bare hyphenated uuid either way. What changes is that Rust can no
longer confuse a room id with a peer id, a card id, or free text
([[uuids-are-not-strings-and-never-hand-drawn]]).

`#[ts(type = "string")]` follows the convention the tree already documents at
identity/mod.rs:83 — airc's id newtypes carry no `TS` derive by design — so the
generated TypeScript is byte-identical and no client changes.

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

* refactor(ids): the activity graph's POINTERS are RoomIds, not strings (#396)

Joel: "Usually you try to force a string for no reason instead of a lookup or one
returned via handle. It's a desire to turn everything into shitty scripting languages."

He is describing a real habit and this file is the evidence. `RoomRecipeBinding.parent`
carried this doc, verbatim, directly above a `String`:

    /// Optional parent activity — activities spawn activities, and the graph is
    /// POINTERS, never nested blobs.
    pub parent: Option<String>,

A pointer typed as text is not a pointer. Nothing rejected `"the benchmark one"`. Both
ends are now `Option<RoomId>` — the binding and `ActivitySpawnParams`.

The proof it was always an id: the round-trip test's own fixture value was
`"f1a1b2c3-0000-4000-8000-000000000000"`. The value never changed. The type caught up
to it — which is the whole point of the correction: Rust wasn't in the way, it was
waiting.

Also `binding_post_id: String` → `uuid::Uuid`. Not a newtype, because airc's
`publish_wall_post` returns a bare `Uuid` and there is no `WallPostId` upstream to
borrow — carrying the value instead of stringifying it keeps it in the type system on
this side, and the missing newtype is named in the doc as an airc gap rather than
laundered into text.

Wire is unchanged throughout: `RoomId` is `#[serde(transparent)]`, `#[ts(type =
"string")]` per identity/mod.rs:83, and `#[schemars(with = "Option<String>")]` describes
the WIRE to the tool schema while Rust keeps the type — so a caller sends text, the
command receives a parsed id, and an unparseable one is rejected at the boundary
instead of flowing inward as a plausible-looking String.

1205 tests pass.

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

* fix(benchmark): derive the repo key from the checkout's origin, not from a pile of cards (#329)

Regression I introduced one commit ago, found by running the thing twice.

Per-run rooms removed the repo inference's source BY CONSTRUCTION: dispatch inferred
`repo` from cards already on the board, which worked only while every run shared one
permanent pile. Now the FIRST dispatch leaves the curator standing in a fresh empty
bench room, so the SECOND one had nothing to infer from and died asking for `--repo`.
Measured live: `benchmark/dispatch --name=hard-rs` succeeded, the identical command
immediately after refused.

The fix is not a better fallback chain. The repo key is a FACT ABOUT THIS CHECKOUT —
`git remote get-url origin` — so it is derived from the real thing rather than retyped
by a caller. That also generalizes to any repo user on a fresh clone, the same reason
`resolve_dispatch_roster` refuses to bake in our citizen names.

Resolution order, most-explicit-first: caller's `repo` → the room they came from (the
legacy path, unchanged, so a re-dispatch never splits a live board) → `origin`. The new
step only fills the case that previously ERRORED; no existing behaviour moves.

`repo_slug_from_remote_url` is a pure parser so the part that actually breaks is
tested: scp-style `git@host:owner/name` has no scheme and uses `:` where the others use
`/`, which naive `split('/')` gets wrong. Host-agnostic (a GitLab remote is as valid a
key as GitHub) and takes the LAST two segments so subgroups still yield `group/name`.
Junk returns None so the caller is ASKED, never handed a fabricated key.

Honest about the one dependency: it reads process cwd, because git walks UP to find
`.git` so any directory inside the checkout answers. The core is launched from the repo
by start-server.sh and cognition/eval + gym resolve roots the same way. That is a real
cwd dependency of the #195 class, named in the comment rather than papered over — and
if the core is ever launched elsewhere it returns None and asks for `repo`, which is a
loud fallback, not a wrong board key.

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

* chore(protocol): regenerate ts-rs bindings for the per-run bench room (#329 a)

The Rust side landed in ca6a815 / ff27025 / 0d49407; the generated
TypeScript never got re-exported alongside it, so the checked-in bindings
were missing `room` / `room_id` on dispatch and still typed
`RoomRecipeBinding.parent` as a bare string. The ts-rs-binding-drift-guard
workflow exists to catch precisely this, and would have gone red on the
next run.

No behaviour change — `cargo test` regenerates these; this commit is the
regeneration.

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

* fix(cognition): the own-speech ring is per-ROOM — a fresh room is a fresh start

Glass-boxed live today, from her own capture. A citizen was dispatched into
a brand-new benchmark room by `benchmark/dispatch` (#329 a). On her FIRST
turn there — having said nothing whatsoever in that room — her prompt
carried:

  [repetition] 4 of your recent messages were nearly identical — you're
  circling, and restating what you've already said adds nothing. If you have
  nothing genuinely new to contribute right now, silence (PASS) is the
  honest response.

Those four utterances were spoken in #academy. `own_speech_rings` was keyed
by `PeerId` alone, so a MULTI-room citizen carried one room's withdrawal
pressure into every other room she entered.

The asymmetry made it obvious once found: `room_speech_rings`, the
room-side sibling ten lines below, has always keyed by room uuid. And the
say path was already room-correct — `say_in(turn_room, …)`, whose own
comment reads "never her ambient default, or she answers one room's
question to a different audience". Only the ring was blind.

Fix: key by `(PeerId, room)`. Every write site already knew which room it
spoke into (turn_room at the directed-say seam, default_room at the
self-tick seam, the message's own room at the hydration seam); every read
site already had the room in hand — llm_deliberation_faculty passed
`ws.room_id` to `recent_room_speech` on the very next line.

Persistence follows: `PersistedVolatile.own_speech` becomes room-keyed, with
an untagged `Legacy(Vec<String>)` arm so a pre-existing `volatile.json` still
PARSES. A torn mind-file is a silent blank wake, which is strictly worse than
a dropped scratchpad — and the legacy lines carry no room, so they are
dropped (with a probe) rather than mis-filed into a room she may never have
spoken in. `hydrate_speech_rings` re-seeds from the durable transcript, where
every message HAS a room (#265).

This does NOT weaken the brick: within a room it fires exactly as before
(own_speech_loop_renders_a_repetition_fact still green), and her history in
the room she actually spoke in is untouched — so it cannot be mistaken for
"clear the ring on room change".

NOT CLAIMED AS PROVEN: on that same run the citizen went
work/list(claimable) -> work/claim(3d1d9dbb) -> yield_turn{} and fell silent
for 10 minutes, with this brick in her context throughout recommending
exactly that silence. Mechanically coherent, and a plausible contributor to
the #390 / #264 withdrawal family — but one specimen is not a cause. The fix
stands on its own merits (the fact was simply FALSE about that room); it is
now also the test.

Regression test in the existing tests mod, asserting both directions: the
room she spoke in keeps her history, the room she has not spoken in reads
silent, and persistence carries the room key.

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

* fix(cognition): the steps ledger stops promising a recall path that does not exist

The all-aged branch told her "the details have aged out of working memory;
recall can retrieve them." That is FALSE by construction, and the chain is
all in-tree: every act becomes an `EngramOrigin::Tool` engram
(act_observe/apply.rs); `recall_candidates` carries an EXECUTING ASSERTION
that a Tool-origin receipt is NEVER in the semantic recall pool
(admission_state.rs); and recall_faculty.rs is the only production caller
of that gate, so the persona's own recall runs through it.

So the one fact whose entire job is ground truth was sending her after a
door that isn't there — a lying receipt of the #151/#357 class, in the
worst possible place. It says what happened plainly now: you did that work,
the details are gone and cannot be retrieved, re-check the workspace or the
board rather than trusting memory of them. An honest gap she can plan
around beats a promise that wastes a turn.

Scope, deliberately narrow: only the ALL-AGED branch is touched. The
some-visible branch already made no promise and was the honest one — a
previous note of mine had the fix direction backwards and would have
propagated the lie into it (#414).

Test extended with the negative assertion, so the promise cannot come back
by edit.

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

* fix(identity): un-red the loose-id guard + give it eyes for parameters

RED TEST FIXED. `no_declaration_outlives_its_defect` has been failing since
0d49407 earlier today — that commit typed `modules/activity.rs: room_id` as a
RoomId and left its LOOSE_IDS exemption behind, so the guard's own anti-rot check
was correctly reporting a declaration that outlived its defect. `cargo test
-p continuum-core --lib` was red. Stale entry deleted.

PARAMETERS WERE INVISIBLE. `loose_id_fields` matches `line.strip_prefix("<name>:")`
with the whole remainder equal to `String,` — a predicate that cannot match a
function signature by construction. So every `peer_id: &str` in the crate was
outside a guard that reported clean. `loose_id_params` closes that: borrowed forms
(`&str`/`&String`) are always parameters (a field would need a lifetime); owned
forms count only mid-line, because a whole-line `room_id: String,` is what the
field audit already claims. Non-overlapping on purpose — double-reporting one site
makes it unfixable, since clearing it for one audit leaves the other red.

POSITIVE CONTROL, and it is the point of this commit as much as the detector.
While building this, a throwaway scan of the same shape returned 0 twice while the
real count was 33. A guard whose predicate matches nothing does not go quiet — it
reports the codebase CLEAN, which is worse than no guard, because it converts an
open defect into a green claim that the work is done. So the predicate now has to
prove it fires: on a plain param, mid-signature, and NOT on `signer_peer_id` (a
`_`-joined suffix — `char::is_alphanumeric` misses this, `_` is not alphanumeric),
NOT on whole-line owned decls, NOT in comments, NOT inside string literals.

That last one is not hypothetical: the first compiled run reported 36 pairs, three
of which were this audit matching its OWN fixtures in identity/mod.rs. Hence
`blank_string_literals` — a detector that cannot tell code from a string about
code. `loose_id_fields` needs no equivalent; it demands the whole trimmed line be
`name: String,`, which a quoted literal never is.

Measured: 33 (file, param) pairs. No LOOSE_ID_PARAMS table yet, so nothing is
enforced on params — the #[ignore]d dump test is the tool for writing it, and gets
deleted in the commit that lands the table.

NOTE for whoever writes that table: do NOT categorize the ~11 `live/*` entries as
`external`. I nearly did, on the basis that the folder is called live/. Joel: "it
uses the same room ids from airc" — and modules/live.rs says so itself at :51
("the server is now AUTHORITATIVE that a call IS its airc room"), :214 ("the airc
room_id is THE canonical call/session key"), :239 (`let call_id = room_id;`). The
value is an airc RoomId stringified by `p.str("room_id")?` and never parsed back.
They are `defect`, blocked on #193's client cutover — not another system's wire.

Guard suite: 4 passed, 0 failed, 1 ignored. cargo fmt clean.

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

* fix(perception): personas are READERS — advance their per-room cursor, and land a fresh reader one page back

Two halves of one bug, and both are why a room storms.

`ChannelBookmarks` is a per-(persona, room) last-read cursor — a correct Slack-style
unread marker with a monotonic `advance`, written months ago. Its ONLY production
callers were both in `modules/nav.rs`, and both key on `ctx.user_id`: the authenticated
HUMAN, driven by `nav/mark-read` and by navigating away from a room.

A persona never navigates. So her `last_read` stayed at 0 forever — and `last_read`'s
own doc spells out what 0 means: "never read (everything is unread)". Every turn
re-delivered the ENTIRE paged history as UNREAD, each item at attention score 1.0
(airc_source.rs), with an EMPTY grounding split because `unread_start` lands at 0 when
`first_unread` does. The digest's whole read/unread structure was built, and then never
used for a persona.

That is the fuel supply for the mutual-excitation storm on #264 (25 turns in 85s, two
citizens each waking on the other): with nothing ever marked read, no message is ever
consumed, so nothing is ever old and there is never a moment where the room is quiet.

HALF 1 — the returning reader (persona/airc_source.rs). `deliver` now advances the
cursor after packing. `pack_digest` returns the READ-THROUGH lamport — the newest
element that actually entered her prompt — so she is marked read for what she was
GIVEN, never for what the budget fetched and dropped. Mark-read on DELIVERY, not on
reply, because delivery is when she saw it; `tip_lamport`'s own doc already said
"ignore/skip/respond all mark-read". `advance` is monotonic, so a repeat delivery or a
late lower lamport can never rewind her.

HALF 2 — the FRESH reader (cognition/channel_digest.rs). Advancing alone does not help
someone who has never read the room: bookmark 0 still means "all of it is unread". A
first sight now lands one page back from the tip (`FIRST_READ_PAGE`), which is how every
chat client has worked for thirty years — you join, you see the last page, you scroll
for more. The seed is persisted via `advance` ("you joined here" is a real fact about
this reader), and it applies to EVERY reader: a fresh human opening a busy room and a
fresh persona waking into one are the same case.

Not a filter and not a damper — no behaviour is gated, nothing is refused. The room is
simply read the way a reader reads it.

TESTS (existing mods extended, no new mod):
- a_fresh_reader_lands_one_page_back_not_on_the_whole_history — 3 pages retained, ONE
  page unread, seed persisted, and after the delivery-side advance the room goes quiet.
  Both halves are needed and the test exercises the composition.
- 15 channel_digest, 12 airc_source, 12 nav: all green, incl.
  caught_up_persona_sees_budget_worth_of_history_not_five_messages and the #367
  deliver_pages_the_turn_room_not_the_pointer.

Refs #264, #43, #367

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

* refactor(cursor): DELETE ChannelBookmarks — the read cursor is airc's durable runtime_cursor, not a second store

Joel: "Airc has state for cursors in addition to other things built in duh" — and
"Delete your idiocy and use the right one or encapsulate it but only as a last resort
not laziness". Both correct. 140ad3b fixed the cursor never ADVANCING; this deletes
the parallel store it was advancing.

WHAT WAS WRONG: `cognition::channel_digest::ChannelBookmarks` was a
`DashMap<(persona, room), lamport>` — a SECOND cursor store beside the durable one airc
already owns. Being process memory it also died on every restart, so no reader ever
resumed. airc's own API doc states the intent verbatim: "for hooks/feeds/monitors that
need replay state; it is intentionally STORE-BACKED so runtime delivery state does not
sprawl into JSON sidecars." We sprawled it into a DashMap instead.

THE RIGHT ONE, used directly — not wrapped:
  Airc::load_runtime_cursor / save_runtime_cursor_for_event  (runtime_cursor: an ORM row
  keyed by consumer id, upserted). `_for_event` is airc's PREFERRED path because it
  carries the source event's room + kind and emits `SubscriptionAdvanced`, so a cursor
  move is visible to every other surface instead of private to one process.

WHERE IT LANDED: on `AircTranscriptReader` — the port continuum ALREADY has over airc's
transcript, whose real implementor IS `airc_lib::Airc`. Two methods (`read_cursor`,
`advance_read_cursor`), defaulted so the ~8 stub readers keep compiling. That is not
encapsulation-as-dodge: the cursor now lives where transcript access already lived, and
the only implementation delegates straight to airc.

CONSEQUENCES, each deliberate:
- `ChannelDigestBuilder` holds NO cursor state. `build` reads it from the reader;
  `build_from_events` takes `bookmark` as an explicit parameter. The split point is now
  visible at every call site instead of arriving from a process-wide map.
- `global_channel_bookmarks()` deleted from channel_substrate.
- The FIRST_READ_PAGE seed no longer self-persists — it is a WINDOWING decision only.
  The cursor moves exactly once, when `deliver` marks read what the reader was actually
  SHOWN. A hidden write inside a builder could mark a page read that the budget dropped.
- `pack_digest` returns the read-through ELEMENT, not a bare lamport, because airc wants
  the event.
- positron's nav projection reads the STAGED DIGEST's own `bookmark` — one value, two
  consumers (her window and the nav view), so they cannot disagree. It needed no cursor
  store at all.
- nav mark-read / room-switch write through the CALLER'S OWN airc scope.

⚠ #27 (self-peer) IS NOW VISIBLE, and left visible on purpose: a cursor can only be
written into a scope we can address, and today only CITIZENS have a registered airc
runtime. For the human operator there is nowhere correct to put it — writing into some
citizen's store would file the human's position under another being's identity. So nav
logs and reports 0 rather than fabricating a cursor, and the nav tests now PIN that
honesty. When #27 lands the same call returns the real lamport with no further change.

TESTS: 47 green across channel_digest, channel_digest_region, airc_source, nav,
positron_nav. Stub readers carry a cursor cell (`read_through`) so tests exercise the
real port; `advance_is_monotonic` now pins monotonicity THROUGH the port. Two region
tests were failing on my own dropped setup, not a production regression — fixed by
threading the reader's cursor, which is what the production path does.

Refs #43, #264, #27

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

* fix(serving): plan holds its ModelFootprint by value — kill the name-lookup that silently starved every lane (#368)

ServingPlan carried base_model_id: String and re-looked its own model up by
name; a miss made is_some_and silently false, suppressing every legitimate
switch-up. Live: Asha/Anwen homed to a phantom, 0 tokens, forever — and the
plan computed usable_gb=2 on a 64GB box, warming nobody (measured 2026-08-14,
zero persona.turn.start in the probe stream while WS answered in 1-3ms).

The plan now holds base_model: ModelFootprint (struct by value, per the
uuid/struct identity law); the upgrade check is a field read, not a search.
ts-rs exports ModelFootprint + camelCase ServingPlan to protocol/typescript.

1193 lib tests green (metal,accelerate). Deployed via verified reboot;
acceptance is the first persona.turn.start on the new build.

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

* fix(sdk): bound the two unbounded boot awaits — a silent cache or silent socket now costs one retry, never a blank app

hydrateFromStorage awaited storage.load() guarded only by try/catch — which
covers a rejection, not a promise that never settles. A hung IndexedDB read
held connect() open forever: blank page, frozen banner (live 2026-08-14,
bisect-proven: storage removed → 274KB render; present → blank 6/7).
ensureConnected had the same hole one seam over: a WS ingress that accepts
TCP but never completes the upgrade fired neither open nor error (measured:
'last feed status: connecting', 1-in-5 boots).

HYDRATE_BUDGET_MS=1.5s and OPEN_BUDGET_MS=5s make StateStorage.ts's own
contract ('storage is an ACCELERANT, not a dependency') true rather than
aspirational; a timed-out handshake feeds the existing reconnect ladder.
New spec case is positive-controlled: red without the bound, green with it.

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

* fix(web): arm the boot watchdog BEFORE awaiting connect, and make it name where a stuck boot is stuck

The 4s no-snapshot diagnostic was registered after 'await state.connect()' —
the one failure it existed to catch (a hung connect) made it unreachable, so
the banner froze on the pre-connect string with no diagnosis possible. Armed
first, it now reports last feed status (none=hydrate stuck, connecting=socket
stuck) — the instrument that located both SDK bounds.

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

* docs(architecture): ACTIVITY-SHELL-CONVERGENCE — the measured defect map + R0-R5 repair plan for the positron shell

Eight measured defects with file:line receipts (single kind-keyed projection
cache wiped on focus, dead roster kind, whole-page error boundary, throwing
content registry, unkeyed lists, hardcoded right panel) and the repair lanes:
(room_id, kind) RoomViews, global kinds feed global widgets, three render
roots, right=ContextPanel per room, bench rooms under the academy section.
Owner rulings recorded: left rail invariant, right column tracks
content=tab=room=activity, all three SYS faces are graphs.

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 17, 2026
…boot — activity/* was routable and invisible (#2332)

* fix(commands): a command declares BOTH halves or the core refuses to boot — activity/* was routable and invisible

`activity/spawn` — the verb that mints every room, benchmark rooms included —
did not appear in `commands/list`. Neither did `activity/archive` or
`activity/protect`. All three route fine, so every smoke test passed.

A command is ONE thing declared as a (descriptor, constructor) pair:

  descriptor  — `CommandDescriptor::of::<Spec>()`, TYPE-only, needs no deps.
                Feeds codegen, the ACL, `commands/list`, the persona tool surface.
  constructor — the runtime object. Dep-holding ones come from the module's
                `commands()` vec because the deps must be built somewhere.

`action_command!` emits both, in BOTH its stateless and dep-holding forms.
`register_stateless_command!` emits both. `BenchmarkDispatch` splits them
correctly and documents why. The generator has never gotten this wrong.

Only the three HAND-WRITTEN `impl ActionCommand` blocks in activity.rs dropped
a half — constructor, no descriptor. Nothing checked, so it shipped.

Half a declaration is worse than none: the command ROUTES, so it looks healthy,
while being absent from every surface through which anyone — human or citizen —
discovers that it exists. `commands/list` calls itself "the discovery pair, the
persona reaches the long tail through this" and was quietly lying about three
AI-safe verbs.

FIX, in three parts:

1. The three missing `register_command!` declarations. They now also pass the
   AI-usability conformance floor they had never been held to.

2. `sdk_codegen::descriptor_exists()` — binary search over the same sorted list
   every other consumer reads, so it can never become a second opinion about
   what commands exist.

3. The guard, at the seam where constructors enter: `ModuleRegistry::register`
   PANICS on a constructor with no descriptor, naming the remedy and the
   worked example. Not a warning — a warning about an invisible command is read
   by nobody, for exactly the reason the command is invisible. It sits beside
   the duplicate-name panic already there, same rationale: the "no central list"
   design removes the human backstop, so the registry catches its own gaps.

`dispatch_orphans` already audited the mirror case (descriptor, no route — #361).
The pair is now total in both directions.

Also: the doc comment above ActivitySpawn::DESCRIPTION claimed recipe validation
"is NOT done" long after #431 shipped `validate_recipe` 40 lines below it. A
comment describing absent code is a lying receipt of the #151/#357 class — it
lies to engineers instead of to citizens. Corrected, with the cost recorded.

VERIFIED LIVE (deployed, build 340eb6c):
  commands/list --filter=activit -> 4 matches, all three verbs, all ai-safe
  catalog total 297 -> 300, exactly +3
  the core BOOTS, which proves the guard passes against every real module —
  no other half-declared command exists tree-wide. Stronger than a static scan.

  (My first scan was by type name and produced 3 false positives — GenerateModule,
  PersonaAllocate, SystemPressureBrokerState are all registered THROUGH
  action_command!. Reverted before they became a fake fix. The runtime guard is
  the honest instrument; grep was a bad proxy for it.)

cargo check clean; sdk_codegen 21/21; runtime::registry 9/9 incl. a
should_panic positive control.

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

* perf(cognition): stop shipping maintainer rationale to citizens — the tool schema is a teaching surface (#333 slice 1, unblocks #2332)

schemars lifts a field's `///` doc comment VERBATIM into the JSON Schema, so one
piece of prose served two readers with opposite needs. A citizen deciding whether
to spawn a room was billed, every turn, for:

  "schemars(with = \"String\") describes the WIRE (a uuid string, per
   #[serde(transparent)]) to the tool schema while Rust keeps the type"

and, on `recipe`, a full paragraph explaining why the doc deliberately does NOT
list the valid values. Correct to write. Wrong to ship.

The projection now keeps the LEAD PARAGRAPH of every description in the offered
schema (properties AND definitions); everything after the first blank line stays
in the file for whoever opens it. Conventional split, not a declared one — it is
how these docs are already written, so it needs no per-command annotation and
cannot drift from a second source. Only 2 of 26 native verbs carry a second
paragraph today; the rest are byte-identical.

Deliberately NOT a length cap. A long first paragraph is a long ANSWER to "what
is this field", and truncating that is #358's shape — a citizen who cannot find
the verb reaches for the wrong one. Contentless length is the defect.

MEASURED, in the ratchet's own instrument: 11,972 → 11,244 (-728).

Ceiling re-pinned 10350 → 11300 with the growth named, per the ratchet's own
contract, and SHRUNK FIRST as its first branch requires — the first re-pin where
the shrink is a measurement rather than an assertion. What grew: the three NATIVE
activity verbs (+1,273), which routed all along and had simply never shipped a
descriptor.

RETRACTS a claim this ceiling invited and that I made earlier in the session:
that the native schemas run "3-5x over a clean design". Measured, the 26-verb
surface is 6,935 tokens, mean 266/verb — leaner PER VERB than the frontier agent
runtimes it was being compared against. Two sibling hypotheses died the same way
and are recorded in the doc so nobody re-derives them: $schema/title boilerplate
(already stripped, 0 tokens — that example came from `commands/list`, a DIFFERENT
surface) and undescribed params (171 tokens, one command).

The surface is not obese. It is paid TWICE (#333 — native schemas AND the prose
menu, both every turn) and charged against a 16k lane, where 6,935 tokens is 43%
of everything she has and the same code is ~3% on a frontier window.

Design + full measurement + build plan: docs/cognition/TOOL-DISCLOSURE-LADDER.md.
The next real shrink is structural: rung 2 of the ladder becoming the TURN's
working set instead of a static NATIVE list, after which this ceiling guards the
spine and stops taxing capability.

DEPLOY OWED: not rebooted. A round is in flight (Anon holds staged SWE cards) and
two citizens have already cited "the ongoing rebuilds and interruptions" verbatim
in withdrawal messages. Validated by unit test (the ratchet builds a real faculty
and measures the real registry); live deploy on the next legitimate reboot.

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 19, 2026
…erday — spill already was it

Joel: "clean up and repair as you go … getting rid of confusing leftovers is crucial."
This is the biggest one in the tree, and it is mine, one day old.

DELETED IN FULL (723 lines): `content/mod.rs` (ContentSource trait, ContentRegistry,
TextContent/ListingContent/WholeContent, 6 tests), `commands/content/fetch.rs`,
`modules/content.rs`, its ipc registration, and 6 ts-rs bindings.

WHY IT HAD TO GO, in the order that matters:

1. **It was UNREACHABLE.** `content/fetch` was registered and `AiSafe` — visible in the
   catalog, offered to citizens — with ZERO producers anywhere in the tree. No citizen
   could ever hold a handle for it. A registered verb that cannot work is a lying
   affordance, the #151/#357 class we keep fixing in other people's code.
2. **It was a SECOND mechanism for one concept.** `spill` + `tool/output` has done this
   since before the design doc was written, and does it better: content-addressed handles,
   per-persona scoping by directory layout (hex-only stem = path-traversal guard),
   PressureBroker eviction, and grep-with-context plus prebuilt
   errors/warnings/failures/summary filters so a citizen finds a build failure without
   knowing regex. Two verbs for one job is #8's parallel-allocator sin.
3. **Keeping "just the trait" was not the lesser evil.** An interface with no implementors
   and no consumers is speculative generality — a leftover that looks like a plan. The
   design SHAPE is now recorded in the doc as prose, where it costs nothing and cannot
   rot into dead code. If a genuine second implementation ever appears (a RAG source, a
   positron ViewState, a peer artifact), the trait gets EXTRACTED from two real cases
   instead of imagined from zero — which is what CLAUDE.md's outlier rule actually asks
   for and what I skipped.

7,256 lib tests pass, 0 failed. Removing it broke nothing, which is the proof.

DOC REPAIRED, not deleted: CONTENT-TRAVELS-BY-HANDLE.md now opens with a table saying
USE SPILL, names what was built and deleted, and says why I missed the existing
mechanism — I searched for the concept in my head (`ContentSource`, registry) while the
real thing is named for its job (`spill`, `tool/output`), which is what a good name looks
like and exactly what that search cannot find. Its build order no longer instructs anyone
to build what we just removed; step 1 and 2 are struck, and the REAL remaining defect is
promoted: `working_memory`'s recent_results re-cut severs the executor's own "your output
is saved as <handle>" sentence, so the citizen is told how to recover her work and the
budget layer cuts the telling off.

Net for the day: −723 lines of code, −39 lines of duplicated doc prose, and one fewer
verb on the surface a citizen has to understand.

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 20, 2026
…os were indistinguishable (#106/#395)

DEBUGGED FROM THE LIVE BOARD, not from the code. The zero I set out to "solve" turned out
to be the CORRECT answer, and chasing it surfaced the real defect one layer up.

WHAT THE PROBES SHOWED. `serving/status` on the running core:
    active_model    = ggml-org/Qwen3.8-27B-GGUF   ready, 4 lanes, 22,528 window
    vision_base_url = http://127.0.0.1:58057/v1   ← identical to base_url
    vision_model    = ggml-org/Qwen3.8-27B-GGUF   ← identical to active_model
One llama-server, carrying `--mmproj mmproj-Qwen3.8-27B-Q8_0.gguf` in the same process. The
main lane IS the vision provider, the double-count guard fired, and `vision = 0.00 GB` is
right. (The `sidecar_up` probe I first read was the VL-7B from an earlier run — a stale
observation, not a live one.)

THE ACTUAL BUG, which only the live board could show: `why = "holds nothing of its own"`
was emitted for TWO OPPOSITE FACTS.
  - the 27B provides vision itself → costs nothing extra → everything is working
  - nothing provides vision at all → PERSONAS ARE BLIND → a defect
Same byte count, same string, opposite news, opposite response. An operator staring at
`vision 0.00 GB` could not tell a healthy system from a blind one, and neither could I.
That is the #151/#357 lying-receipt family wearing a number instead of a sentence.

THE FIX, at the branch that knows. `LaneClaim::HoldsNothing` now carries its reason, set
where the decision is made rather than reconstructed downstream from the value:
  "the main lane's own model sees — vision costs no extra residency"
  "no vision provider is running — personas cannot see"
  "no lane is serving"
`FootprintReading` grows `note` and a chainable `.because()`, so ONE carrier feeds the
probe's `why`, the board row's `detail`, and any future consumer — three renderers, one
explanation, no re-derivation.

BRITTLENESS REMOVED while in here: `LastKnown::reading` built a `FootprintReading` by
struct literal, so growing the type broke it — which is exactly how it shipped missing
`note`. It now goes through the constructors plus a new `.aged(age_ms)` transition, so a
stale reading cannot be hand-built as a fresh `Measured` one and new fields can't be
silently skipped at a construction site.

TEST: `the_two_vision_zeros_never_read_the_same` asserts the two reasons differ, that the
bad one names the harm ("cannot see"), and that the good one names why it is free. The
pre-existing test would have passed on either zero — it only checked the byte count, which
is precisely how the ambiguity survived being "covered".

ALSO MEASURED, and bigger than this fix:
  - the 27B IS SERVING — 4 lanes, 22,528 window, MTP draft, fits_on_gpu=true. The
    self-eviction fix delivered the model the box was refusing to keep this morning.
  - attribution is essentially complete: serving 50.43 GB attributed vs 50.10 GB
    physUsed. This morning: attributed 6.81 GB, UNOWNED 44.14 GB. The unowned block is
    gone. The estimate now runs ~0.33 GB OVER physical — conservative, the safe
    direction, and worth watching as its own drift signal.

17 tests green.

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 20, 2026
…ary has been unmergeable for 4 days

Every PR into canary has sat permanently BLOCKED with all real gates green. Not a
quality problem — a stale config line.

WHAT HAPPENED: on 2026-08-16 the binding-drift gate was folded from its own workflow
into a STEP inside `cargo test -p continuum-core --lib`, and that consolidation was
correct — the check is a `git diff` against bindings the test run already regenerated,
so a standalone job had to re-compile continuum-core (~9 min) to diff what the previous
job just produced. The workflow's own comment argues this well and the duplicate build
should not come back.

WHAT WAS MISSED: canary's branch protection still requires a status CONTEXT named
`ts-rs binding drift detector`. After the fold, no job published that name. A required
check that never reports can never be satisfied, so mergeStateStatus stays BLOCKED
forever regardless of results. Found while merging #2338 with lib tests, windows-msvc,
and label-pr all green.

THE FIX, and why it is this one rather than the obvious one: re-splitting the detector
into its own job would restore the name at the cost of reintroducing the 9-minute
duplicate compile someone deliberately deleted — undoing a correct optimization to
satisfy a config line. Instead this job makes the required name real without the waste:
`needs:` binds it to the job that actually runs the detector, so drift → lib job fails
→ this job is SKIPPED → the required check never passes → the PR stays blocked. Correct
gating, ~5 seconds, no rebuild.

It mirrors a verdict rather than computing one, and it SAYS SO in both the comment and
its output instead of printing a "✓ no drift" it did not establish — the same
lying-receipt smell killed twice today (#151/#357 class). The comment also names the
maintenance hazard: if the detector moves, update `needs:`, because a mirror pointed at
the wrong source is worse than no mirror.

No branch-protection change required — the context is now produced by a job, so repo
config stays untouched.

Closes the live half of #457.

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
… through it (#124/#441) (#2342)

* revert(serving): remove comparable_at + its invented 2.0 factor — speculative interface, zero callers (#441)

Landed and removed the same day. Three defects in one small addition:

1. MAGIC CONSTANT. `WINDOW_COMPARABILITY_FACTOR: f64 = 2.0` was invented.
   Nothing derives it. The doc rationalised 2x after the fact.

2. ZERO PRODUCTION CALLERS. `comparable_at()` was never called anywhere in
   the tree. A predicate built for consumers that do not exist.

3. A LYING COMMENT, which is the worst of the three. Each of the three seed
   rows carried "consumers get `comparable_at() == false` rather than a
   silent assumption" — asserting a reader that was never written. Same
   class as #151/#357, authored while fixing that class.

ARCHITECTURALLY it was also the wrong shape (Joel): whether two operating
points are comparable is a CONSUMER's judgement, made against the lease/handle
it already holds. It is not a rule a data struct asserts for every caller in
the tree. We have consumer/handle interfaces for this; I bolted on a bespoke
free predicate instead of using them.

`measured_at_window` STAYS. It is provenance — it says what the number
describes, and its absence caused a real live mis-attribution. A field that
records a fact is not the same as a predicate that judges one.

cargo check 0.

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

* fix(cognition): the de-hardcode guard was blind to floats — and something was already through it (#124)

THE HOLE. The guard fires on `const NAME: <int> = <literal>` when NAME says
WINDOW/CONTEXT/CTX/TOKEN/PROMPT/CHARS. Its type list stopped at the integers,
so ANY window-relative constant typed `f32`/`f64` walked straight past it.
Found the hard way: `WINDOW_COMPARABILITY_FACTOR: f64 = 2.0` (mine, #2339)
matched the name rule, WAS a bare literal, and sailed through on the type.
A guard against invented numbers that a float annotation defeats teaches
exactly one lesson — type your magic number as a float.

A ratio over the window is as much a fresh guess as a count of its tokens.
Now caught the same way: f32/f64 added, and the literal detector accepts a
decimal point (one only, digit-led, so `1.5` matches and `A.b`/`1..2` do not).

WHAT IT CAUGHT ON THE FIRST RUN — not mine, and pre-existing:

    recall_faculty.rs:70 — const RECALL_WINDOW_FRACTION: f32 = 0.10

10% of every citizen's served window, spent on recall, invented and never
derived. Exactly the shape the guard exists to stop, sitting inside the guard's
blind spot. That is the positive control: the hole was real and occupied.

THE FIX is the one the guard's own failure message prescribes — express it as
a fraction on ContextBudget, where it SCALES with the served window instead of
being a 4k-shaped slice a 1M-context model inherits. `ContextBudget::
recall_tokens()` over `RECALL_DENOM`; recall_faculty derives from it via the
existing `from_window` constructor and no longer owns a float.

MIN_RECALL_TOKENS stays as-is — it carries a real `context-budget-exempt:`
receipt saying it only ever RAISES a budget, never caps one.

cargo check --tests 0; context_budget + recall suites 0 (read by exit code).

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
…t-budget under-counts

PERCEPTION-FACTS.md slice 2b: own-repetition (#134), peer-echo (#152),
[context] bounds (#152), and the steps-taken ledger (#151) now render
through ONE ordered registry (cognition/perception_facts.rs) instead of
four inline blocks in the deliberation faculty. Each fact is a
PerceptionFact impl with a stable id; render_facts fires a
perception.fact probe per fact per tick ({id, fired}) so which facts
rendered is glass-boxable from the probe stream; FactPolicy::disable(id)
is the A/B arm switch (deny-list, so new facts enroll live by default).
Facts stay facts — no imperatives — and the ledger keeps its explicit
zero-case (confabulation-shelter hardening).

Extraction exposed two REAL budget under-counts at the 4096-window edge
(the tool-menu call-form example, +20 tokens, pushed a borderline fit
test 1 token over — the failure predates this refactor):

- working_context_block's ~50-token wrapper header only exists when
  assembled context is NON-empty, but framing was estimated with an
  EMPTY context — every context-bearing prompt exceeded the estimate by
  the header. The header is now a named constant and the ctx budget is
  charged for it up front.
- The per-message chat-template charge was +2 tokens; real templates
  cost ~4-5 (<|im_start|>role...<|im_end|>). Now one
  PER_MESSAGE_TEMPLATE_TOKENS = 5 constant across the whole-message,
  straddling-trim, and giant-single-burst arms.

Both under-counts were llama-server-400 territory under a full window.

Tests: perception_facts 3 (registry parity, policy toggle, ledger
zero-case), llm_deliberation_faculty 19/19 (incl. the previously red
fit test), act_observe 16/16, deliberation_prompt green.

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 Aug 21, 2026
…ead 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
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]>
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 github_actions Pull requests that update GitHub Actions code size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant