Repository navigation
Epoch view leaves room to grow at turnover (Atlas: shared prefix 3% to 89% on replay) - #5304
Conversation
…etween turnovers Serves the residents' minds directly (plan line 2, a mind's context as an append-only epoch; gate: live prefix reuse >= 80%). Cause, read on the M5's own probes (2026-10-22): at a turnover a source granted all it wants restarted whole, so the start filled its grant. Atlas in 11c1a7ac started at ~259k chars against 87.6k tokens granted with 1,902 tokens of room, appended ~9.4k chars (~3.2k tokens) per act, and turned over on every act (epochs 7..15, delib.view.sized); 3-11% of consecutive prompts shared. Fix, at the one owner (prompt/epoch.rs, `start_grants`, called by `fit_view`): the grounding blocks (above the lowest priority) start whole at their grant; the growing sources (conversation, results, thoughts) start at most half of what is left, and at most that less one act's appends (`View::appended_per_act`, converted at the claims' own chars-per-token). Derivation in the doc comment: holding the growing sources' re-prefill to one act's appends over the epoch's life gives reserve >= start, so the measured rate cancels; it binds only when one act appends more than half of what they may hold. The one allocator (`flex_allocate`) spends it: higher priorities ask for their whole grant as their minimum, the lowest shares the rest, oldest items collapse first. The turnover trigger is unchanged. Replay (continuum-context examples/replay.rs) now models the core: room turns are her conversation source, sources render in the core's order and priorities, the window is the recorded context_window less the reply runaway at the core's own chars/token, and both rules are replayed. Atlas 11c1a7ac: 6 turnovers -> 1, shared prefix mean 5% -> 75% (median 3% -> 89%), view prefill median 263,680 -> 26,611 chars per act. Aris 3be59578 (quiet): mean 59% -> 58%, median 85% -> 84%, 1 turnover each. Tests: two in tests/prompt_shaping/a_busy_room_keeps_its_prefix.rs (a sliding room turns over every act restarting whole, at most twice in 30 acts with the reserve; grounding stays whole and the newest turn whole at a turnover). continuum-core lib 6133 passed; continuum-context 13 passed; ratchets unchanged. Removed: the inline half-grant allocate closure in fit_view (15 lines); added start_grants (~65 lines with its derivation), 2 tests, replay model (+~170). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…d tokens) fit_view compared the view's raw token estimate with grants in charged tokens. A view near its grant passed, then the final fit (which converts its budget back to raw) cut the oldest 96-99 view messages from the front with no turnover: a head clip (Benchy, the M5, 2026-10-23, delib.fill.history_dropped). Charging the view through the same calibration makes an over-grant view turn over (a deliberate re-prefill with a growth reserve) instead. Measured after deploy (owner Fable): delib.fill.history_dropped no longer fires on view messages, and live prefix reuse on the M5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
… (charged tokens)" This reverts commit ae895ff.
|
I removed the unit-mismatch commit (ae895ff) from this PR. It failed |
|
Live receipt, M5, bb91bcf, 05:09–06:40Z. Prefix reuse on warm acts: 88–94%: Aiko 108,972/115,845; Aris 70,392/77,551 and 70,392/80,448. It was 0% before the deploy. Engine prefill on those warm acts was 133–251 s. Acts are still long because of slot waits of 812–2,084 s: every resident went cold at the restart, and each cold prefill of 100k+ tokens held a slot for 1,386–2,611 s. The remaining cost is admission and restart coldness, not the epoch view. |
This is plan line 2: a mind's context as an append-only epoch.
Problem. At a turnover,
fit_viewrestarted every fully granted source whole, so the new epoch had no headroom. In a busy room, the next act's appends pushed the view past its grant and it turned over again. Each new epoch starts at a different oldest turn, so the whole prefix changed every act.View::appended_per_actwas meant to provide this reserve, and the core never called it.Change. In
prompt/epoch.rs,fit_viewand the newstart_grants:min((A-G)/2, A-G-per_act), where A is the view's grant plus room and G is grounding.flex_allocatespends the start, collapsing the oldest items first. The newest turn is always kept whole.Replay validator.
continuum-context/examples/replay.rswas extended to model the window budget and the turnover rule, with the core's measured characters per token. Using the old rule, it reproduces Atlas's live 3% exactly.Tests. Two new tests:
Core: 6,133 passed. continuum-context: 13 passed. Ratchets are unchanged.
Not fixed here (follow-ups, owner Fable):
fit_viewmeasures raw tokens while the final fit measures calibrated ones, roughly 3.5% apart. The final fit then cuts the oldest 96–99 messages from the view's head (Benchy). That is a head clip, which goal 7 forbids.Live receipt: after deploy, a 15-minute read on the M5 of prefix reuse and act time. Owner Fable; this PR stays open until it is posted.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo