Repository navigation
Summarize long sessions earlier, at a token ceiling - #104
Merged
Merged
Conversation
With a large window, lcode only made room at 85% (about 220K tokens with 256K), far past where small models work well. compact_at (default 64K, at least 16K) makes room once the conversation reaches it, even when the window is larger; 0 keeps only the 85% rule. Summaries keep the user's latest requests word for word, /context shows where the session makes room, and lcode bench --compact-at compares ceilings. A conversation that was just summarized isn't summarized again until it grew by a quarter of the ceiling, so a summary close to the ceiling can't trigger one summary after another. Files whose only copy was removed to make room are named next to the current request, because models answered questions about them from memory instead of reading them again. Closes #95 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 10, 2026
Merged
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.
Closes #95.
In the dahua session the context reached about 84K tokens, with a large window and no summary. Past roughly 75K, Qwen3.6 35B looped, overlooked facts it had printed itself, and lost track of what it had tried. lcode only made room at 85% of the window, about 220K with 256K.
What changes
compact_at(default65536, at least 16K,0= off): lcode makes room once the conversation reaches it, even in a larger window: it prunes old tool output first, and summarizes only if that's not enough. The 85% rule stays. The bench gets--compact-at TOKENS./contextsays where the session makes room:makes room at 64K (compact_at).compact_at; a full window always does. A real test with a 6K ceiling summarized 4 times in a row before this guard: the model re-read the same file until the loop breaker stopped it. That's also why there's a 16K minimum.CHANGELOG.mdfrom memory, and got it wrong ("status secret, exit code 5, secret_limit"). With it, the model read the file again and answered correctly (0.26.0).--compact-atand the measurement), and the CHANGELOG.Measured (qwen3.6-35b, 128K window,
lcode bench --session --rounds 3, 24 tasks in one conversation)--compact-at 64k: the conversation peaks at ~40K)--compact-at 32kTests
compact_at./contextoutput.🤖 Generated with Claude Code