Skip to content

A mind's reply reserve is her measured output tail; her reply writes into the window's physical room - #5485

Closed
joelteply wants to merge 2 commits into
canaryfrom
fable/reply-reserve-measured
Closed

joelteply wants to merge 2 commits into
canaryfrom
fable/reply-reserve-measured

Conversation

@joelteply

@joelteply joelteply commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Serves the minds by: giving each resident's own view the room that was held for a reply she never writes, so she keeps more of her own context. Plan goal 7 (one budget) and order-of-work line 2 (context as an epoch).

What changed

The reserve that sizes her view and the request's max_tokens were one number. An act forced both to ACT_OUTPUT_CAP = 12,288. They are now separate:

  • Reserve = max of her last 64 measured outputs × 5/4 (new working_set/reply_tail.rs, persisted in emission.json with #[serde(default)], so legacy files load as an empty ring). Before 3 turns the cold prior stands. reply_claim wants it, and view.rs no longer forces acts to the runaway bound. What no claim takes is her view's room to grow into.
  • max_tokens = the window's physical room after the prompt, minus one token, under the runaway bound (now only a loop guard), never below the reserve (DeliberationPromptView::reply_allowance).
  • A reply longer than the reserve writes into the room the window still has (mid-epoch) and joins the ring. At an epoch's tail a cut is the existing loud path: the emission records the cut answer at double, and the retry claims twice the pending peak.
  • An engine count larger than the estimate that overflows only the room past the reserve is re-quoted with her view whole (delib.reply.room_requoted, bounded by a strictly rising count). A refit after a real overflow makes room for the reserve only.
  • Docs: new section "The reply reserve" in docs/architecture/MIND-CONTEXT-AND-ENGINE-CONFIG.md.

Measured

Source: M5 prompt captures (~/.continuum/fixtures/prompt-captures), 24 h to 2026-10-26, 1,063 completions joined to their submitted rows. usage.outputTokens == timing.decodeTokens on 1,063 of 1,063 rows, so reasoning tokens are counted.

Resident (58,880 window) n p50 p90 p99 max
Aiko, act 265 238 756 1,184 1,426
Atlas, act 341 247 767 1,202 1,436
Benchy, act 101 336 730 1,112 1,114
Benchy, deliberation 83 258 760 1,526 1,526
All minds 1,063 268 766 1,202 1,526
  • 461 of 1,063 requests sent max_tokens = 12,288.
  • Truncation: 13 of 1,063 (1.2%) finished length, all at squeezed allowances of 266-1,240 and almost all inside reasoning. None came near 12,288.

Reserve rule, replayed (each reserve read only from that mind's earlier turns):

Rule How often a reply exceeds the reserve Reserve p50 / p90
ring 16, p90 × 1.25 (today's need) 7.8% 895 / 1,348
ring 64, max × 1.0 4.5% 1,164 / 1,436
ring 64, max × 1.25 (this PR) 2.1% 1,455 / 1,795
ring 64, max × 2 0.7% 2,328 / 2,872

The validator is the_tail_reserve_holds_the_measured_exceed_rate_on_the_m5_captures. It replays the committed fixture continuum-cognition/fixtures/reply-output-tokens-m5-2026-10-26.json (output counts only) and asserts at most 2.1%.

View room, before/after (from probe rows, corrected): at the 58,880 window, room for her view + history = window − framing_tokens − required_tokens − the reply's grant. framing_tokens (13,463) already includes the tool schemas: Benchy's system prompt is ~2.7k tokens and his 38 schemas ~10.3k. An earlier version of this body subtracted the tools a second time (~22.6k → ~33k); that was wrong. Over the 30 delib.window.flex rows at 58,880 (Aiko, Atlas, Benchy), the median is 30.3k → 40.8k (+10.5k, +35%): the 12,288 reserve replaced by each mind's max × 5/4 (1,783-1,908). On a squeezed row (large required input, reply granted < 12,288) the gain is smaller: Benchy at 23.6k required goes 16.8k → 19.9k. This counterfactual is computed from the probe's components; it is not a live read.

Prefill, measured with the S1 append-tail replay (#5482, --purpose "" --append-tail 173, her measured max × 5/4 in place of 12,288, captures at a 76,032 window):

Mind View, chars Turnovers Prefill, tokens s/request
Benchy (223 req) 205,590 -> 239,069 47 -> 42 2,002,175 -> 2,211,385 (+10.4%) 52 -> 57
Aiko (51 req) 200,180 -> 233,170 15 -> 10 632,749 -> 570,014 (−9.9%) 72 -> 65
Atlas (99 req) 205,131 -> 238,898 18 -> 15 754,369 -> 767,428 (+1.7%) 44 -> 45
Total +16% 80 -> 67 3.39M -> 3.55M (+4.7%)

Benefit, as measured: her view holds about 16% more context, with 16% fewer turnovers. Total prefill rises 4.7%, because there are fewer turnovers but each one is larger. This PR does not claim a speed gain. Speed has to come from cheaper turnovers.

Live read owed after deploy: delib.window.flex reserve/unallocated, delib.reply.room_requoted count, the length finish rate (baseline 1.2%), and acts/hour plus seconds per act at four residents. Owner: Fable, at the first deploy window after merge.

Validation (local, worktree build at 95e00ac; the follow-up commit is comment and doc text only)

  • cargo test -p continuum-cognition --lib --features continuum-engine/metal: 1,184 passed, 0 failed.
  • cargo test -p continuum-core --lib, mind_integration::registry::deliberation: 18 passed.
  • The full continuum-core lib run had 6 ipc::command_ingress::served_concurrently failures. They are unrelated (timing under parallel load) and pass when run alone.
  • Ratchets vs origin/canary: none rose. unjustified_unwraps 1937 -> 1936; underived_bounds held at 148 (the new constants carry derived-or-floor:).
  • oversized-edits.sh origin/canary: clean. Every touched file is under 1,000 lines (working_set.rs 935, contribute.rs 855, reply_reserve.rs 917).

Tests changed

  • reply_reserve.rs: the cap test now asserts the physical allowance. New: an_act_reserves_her_measured_tail_and_may_write_past_it (58,880 window).
  • capacity_and_wire.rs: the wire carries reply_allowance. New: an_overshooting_reply_room_is_requoted_never_paid_for_with_her_view.
  • turn_window.rs: the unmeasured turn reserves the cold prior and its request may reach the runaway bound. reply_claim takes the reserve.
  • window_feedback.rs: the refit fixtures overflow the prompt (not the elastic room), and the final request is checked against the last refusal's density.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…tes into the window's physical room

The plan reserved the act's runaway bound (12,288) for every reply on the M5's 58,880
window, while replies measured p99 1,202 and max 1,526 (24 h, reasoning included), so her
view got ~22k and turned over every 2-4 acts. The reserve that sizes her view and the
request's max_tokens are now separate:

- reserve = max of her last 64 measured outputs x 5/4 (working_set/reply_tail.rs,
  persisted with her emission record), cold prior before 3 turns; reply_claim wants it,
  and view.rs no longer forces acts to ACT_OUTPUT_CAP
- max_tokens = the window's physical room after the prompt, under the runaway bound
  (now only a loop guard), never below the reserve (DeliberationPromptView::reply_allowance)
- an engine count past the estimate that overflows only the room past the reserve is
  re-quoted with her view whole; a refit makes room for the reserve, never the allowance
- validator: replay of the M5's landed outputs asserts <= 2.1% of replies exceed the reserve

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ing the tools

The earlier ~22k subtracted the tool schemas on top of delib.window.flex's framing_tokens,
which already includes them. From 30 probe rows at the M5's 58,880 window: view + history
room median 30.3k with the 12,288 reserve, 40.8k with each mind's measured max x 5/4.
Comment and doc text only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@github-actions github-actions Bot added size: XL and removed size: L labels Oct 26, 2026
@joelteply

Copy link
Copy Markdown
Contributor Author

Rebases after #5564: #5564 deletes the fixed reply budget (SamplingProfile.max_new_tokens, default_response_tokens); this PR's measured reply tail is what should size the reply's claim in the one allocation.

@joelteply

Copy link
Copy Markdown
Contributor Author

Closed in the 2026-10-30 triage against the merged design (#5607): superseded by #5610 (reply claims her measured need, no runaway cap), and its fixed multiplier is an open-loop rule (HOW-A-MIND-GETS-WHAT-SHE-NEEDS R1). The output side continues as L1 in that design.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant