feat(session): fold compaction into a fat handoff file with a thin live spine - #1155
Merged
TheGreatAxios merged 6 commits intoSep 22, 2026
Conversation
…ve spine A fold writes the full structured record to one stable handoff file and keeps only a short spine plus an explicit pointer in the prompt. The completeness gate rejects folds that drop novel text, so the spine re-renders carried facts byte-identical and every fold overwrites the same latest key instead of chaining per-fold files.
Iterative folds dropped fold-1 paths when the next region was only the prior spine plus later turns, and a growing Evidence/Constraints line fail-closed the completeness gate. Union the previous fat file, scan tool_result evidence, and archive synthetic spines as user_message.
Prefix-collapse treated src/auth as a truncation of src/auth.ts. Scanning every ## heading let a model Summary overwrite schema, and empty constraint arrays won over carried spine facts via ??.
Production iterative folds merge full prior-file text, so prefix unique collapsed distinct constraints, decisions, and verification that only shared a string start.
An 80-char complete fact that prefixes a sibling was collapsing on the next fold because the cut detector used length alone.
Cuts are 83 chars; longer-string-wins replaced 81- and 82-char complete facts with the truncated spine fragment and dropped the last characters.
TheGreatAxios
force-pushed
the
cl-8744-compaction-fat-handoff-file-thin-live-spine-with-pointer
branch
from
September 22, 2026 15:11
096895c to
376098b
Compare
TheGreatAxios
deleted the
cl-8744-compaction-fat-handoff-file-thin-live-spine-with-pointer
branch
September 22, 2026 15:17
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.
Summary
Verification
bun run checkpasses (typecheck, lint, format, full test suite)bun test src/session/compaction-handoff.test.tspasses (12 tests)bun test src/context-compactor.test.ts tests/integration/compaction-baseline.test.tspasses (updated spine expectations)Fixes CL-8744