Skip to content

The work board was structurally invisible: fix the flattening, and the window it was flattened into (#331/#128/#234/#327) - #2155

Merged
joelteply merged 9 commits into
canaryfrom
fix/331-board-visible-and-demand-derived-window
Aug 6, 2026
Merged

joelteply merged 9 commits into
canaryfrom
fix/331-board-visible-and-demand-derived-window

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Measured across 1,284 live context assemblies: room-kanban was kept 0 times and dropped 495. Not intermittent — the work board never once reached a prompt. Citizens were saying "there are no open tasks available" about a 61-card board, and one of them said plainly "I have been trying to claim tasks and list open tasks, but my efforts have not led to any new progress."

Two defects, stacked.

1. The bridge flattened grounding — b6429f583

A RagSource delivers a list of items. For the board that is the [your work] lead, the [available work] lead, then one line per card. rag_source_faculty joined them into one string, so assembly could only take-or-drop the flattened whole: a median 5,364-token block offered all-or-nothing into a median 55-token budget. The two leads carry every fact a citizen needs to find work and cost ~200 tokens; they died stapled to a ~5,100-token verbatim card dump.

The granularity already existed and was being discarded. Contribution::parts now carries the source’s own units, and assembly takes the longest fitting prefix of a divisible contribution. Because sources order units leads-first, a prefix is exactly the summary the source would have written if asked for less.

Divisibility is opt-in and does not leak: parts defaults to one element equal to content, so an engram is still kept whole or dropped whole (half an engram is confident nonsense), a truncated list says it was truncated, and a budget too small for even one unit emits no header — a labelled empty block reads to her as "the board is empty", the same false fact.

2. The window was a placeholder that outlived its own TODO — 143f3f16d

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

That constant was never meant to survive; its doc said "the conservative PRIOR … used until live per-persona working-set telemetry refines it UP toward measured demand (task #234)." The telemetry was never built, #234 was marked done, and the placeholder became the policy.

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

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

Safety envelope unchanged: window_for is already ≤ the model’s trained ceiling and ≤ what the host fits, so .min still never forces up past either, and a mind demanding more than the machine has receives what fits (pinned by a test). Peak rather than average, because a working set is the size at which the activity stops being strangled.

Also

  • messages_within split into messages_unfitted + fit_messages, so a turn’s true conversational size is knowable at all (fitting is lossy by design).
  • One shared per-message template charge, so measurement and fit cannot drift.
  • Probes: partial= on delib.context.render (a shrunken block and a full one stopped looking identical), and delib.turn.demand whose over_window says plainly when a turn wanted more room than it had.
  • Cold start is the one genuinely-unknown case and is named in exactly one place, ServingDemand::new, superseded by the first turn.

Verification

cargo test -p continuum-core --lib --features metal,accelerate — full suite green; 7 new tests, each with a // what this catches: naming the invariant. Live validation on deploy: citizens report from their own side whether the board is there and whether it matches work/list.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

joelteply and others added 9 commits August 6, 2026 13:57
…h whole (#331/#128)

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

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

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

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

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

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

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

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

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

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

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

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

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

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…d block must name its verb (#321)

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

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

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

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

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

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

Four tests, each pinning one half.

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

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

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

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

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

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

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

    served= 16384  demand= 16384  bound_by=demand

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

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

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

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

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…— supply was never the bind, ORDER was

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…a SUBSET, and I double-counted it

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

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

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

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply merged commit 0323afc into canary Aug 6, 2026
1 check passed
@joelteply
joelteply deleted the fix/331-board-visible-and-demand-derived-window branch August 6, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant