mirror of
https://github.com/instructkr/claude-code.git
synced 2026-04-03 22:48:49 +03:00
Auto compaction was keying off cumulative usage and re-summarizing from the front of the session, which made long chats shed continuity after the first compaction. The runtime now compacts against the current turn's prompt pressure and preserves prior compacted context as retained summary state instead of treating it like disposable history. Constraint: Existing /compact behavior and saved-session resume flow had to keep working without schema changes Rejected: Keep using cumulative input tokens | caused repeat compaction after every subsequent turn once the threshold was crossed Rejected: Re-summarize prior compacted system messages as ordinary history | degraded continuity and could drop earlier context Confidence: high Scope-risk: moderate Reversibility: clean Directive: Preserve compacted-summary boundaries when extending compaction again; do not fold prior compacted context back into raw-message removal Tested: cargo fmt --check; cargo clippy -p runtime -p commands --tests -- -D warnings; cargo test -p runtime; cargo test -p commands Not-tested: End-to-end interactive CLI auto-compaction against a live Anthropic session