Repository navigation
perf(cognition): append-only history before churning grounding — tail order fix - #2416
Merged
joelteply merged 1 commit intoAug 23, 2026
Merged
Conversation
…g — the tail order the A/B demanded The #2415 A/B failed: 20-22% cached on 34-42k prefills, the old ceiling wearing a new hat. Monitor data named why — in eval turns the conversation barely grows; the prompt's bulk is the working-memory result history, and the first cut placed the churning trailing grounding (workspace-map/kanban) AHEAD of it, re-prefilling the whole append-only history on every grounding change. Order in the tail IS the fix: recent-results history (byte-stable, growing head) → churning trailing grounding → pinned newest result. The history block extends the reusable KV prefix act-over-act; churn now costs only itself + the pinned tail. (recent_results pop_front eviction rotates the head only once the window-derived cap fills — append-only for most of a task on a big lane.) Batteries: 94 green (deliberation, working_memory, rag_source_faculty, ratchets). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
enabled auto-merge (squash)
August 23, 2026 21:07
joelteply
deleted the
fix/append-only-history-before-churning-grounding
branch
August 23, 2026 21:19
joelteply
added a commit
that referenced
this pull request
Aug 23, 2026
…ff verdict (#2418) Consecutive-act prompt captures (always-on JsonlPromptCaptureSink) gave the byte-level verdict on why KV reuse plateaued at ~36% after #2415+ #2416: the system prompt is perfectly byte-stable (8,305 chars = the cached head), and the divergence is at MESSAGE #1 CHAR 0 — perception facts whose presence/wording flickers per act rendered ahead of the 21.8k append-only history block, so the prompt's dominant stable mass never extended the prefix. The message list's SHAPE changed act-over- act (8 parts vs 4). Fix: explicit assembly phases replacing insert-before-ask arithmetic — old turns → history (append-only) → trailing grounding (flickers) → facts (flicker) → ASK → pinned newest. Stable content is a strict prefix of the token stream; churn is behind it. Every prior lesson preserved by construction: facts stay before the ask and the ask after them (2026-07-20 parrot-loop bisect), pinned stays nearest generation (#392), grounding stays out of the system prefix (#205/#2415). Batteries: 130 green (deliberation, perception_facts, act_observe, working_memory, ratchets) — including the parrot-order pins. Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo Co-authored-by: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#2415's A/B failed at 20–22% cached: the churning trailing grounding rendered ahead of the append-only result history, re-prefilling it every act. New tail order: history → grounding → pinned newest. The history block now extends the KV prefix act-over-act. 94-test battery green; verdict rides the next round's prefill probes.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo