Skip to content

feat(session): fold compaction into a fat handoff file with a thin live spine - #1155

Merged
TheGreatAxios merged 6 commits into
mainfrom
cl-8744-compaction-fat-handoff-file-thin-live-spine-with-pointer
Sep 22, 2026
Merged

TheGreatAxios merged 6 commits into
mainfrom
cl-8744-compaction-fat-handoff-file-thin-live-spine-with-pointer

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • Each successful fold writes the full structured record (goal, constraints, decisions, files/commands, verification, dead ends, next actions) to one stable handoff file and keeps a short spine plus an explicit file pointer in the prompt.
  • Exact-required facts survive paraphrase: carried spine facts re-render byte-identical, file paths verify against the context index with evidence markers, and truncation-cut markers can never pair across lines.
  • Folds iterate on the latest archive entry instead of stacking per-fold summaries, and the handoff file is structured state rather than a tool-body dump.

Verification

  • bun run check passes (typecheck, lint, format, full test suite)
  • bun test src/session/compaction-handoff.test.ts passes (12 tests)
  • bun test src/context-compactor.test.ts tests/integration/compaction-baseline.test.ts passes (updated spine expectations)

Fixes CL-8744

@linear-code

linear-code Bot commented Sep 21, 2026

Copy link
Copy Markdown

CL-8744

…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
TheGreatAxios force-pushed the cl-8744-compaction-fat-handoff-file-thin-live-spine-with-pointer branch from 096895c to 376098b Compare September 22, 2026 15:11
@TheGreatAxios
TheGreatAxios merged commit 1e6f717 into main Sep 22, 2026
13 checks passed
@TheGreatAxios
TheGreatAxios deleted the cl-8744-compaction-fat-handoff-file-thin-live-spine-with-pointer branch September 22, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant