Skip to content

perf(cognition): message order monotone in stability — the byte-diff fix - #2418

Merged
joelteply merged 1 commit into
canaryfrom
fix/message-order-monotone-in-stability
Aug 23, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/message-order-monotone-in-stability

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

The prompt-capture byte-diff found it: system is byte-stable (8,305 chars = exactly the cached head), and divergence is at message #1, char 0 — flickering perception facts render ahead of the 21.8k append-only history, so the stable mass never caches and reuse plateaus at ~36%.

Fix: explicit assembly phases — old turns → history → grounding → facts → ask → pinned. Stable content is a strict prefix; churn behind it; parrot-fix and #392 orders preserved by construction. 130-test battery green.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…ff verdict

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.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply enabled auto-merge (squash) August 23, 2026 21:57
@joelteply
joelteply merged commit 1360845 into canary Aug 23, 2026
5 checks passed
@joelteply
joelteply deleted the fix/message-order-monotone-in-stability branch August 23, 2026 22:09
@joelteply
joelteply restored the fix/message-order-monotone-in-stability branch August 23, 2026 23:07
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