Repository navigation
Chat memory: context meter, Compress button and auto-compress for long chats - #224
Merged
Merged
Conversation
…g chats - Track how full a chat's Claude session is (latest top-level message usage, the main model's context window), saved per chat (migration 100), mirrored for runner chats and pushed live during a run - Composer ring with a popover (tokens, share, auto threshold) and Compress now; a bar above the composer once the chat gets long; Compress on the too-long turn end - /compress is an alias of /compact (also offered in the slash menu); the compaction notice renders as a divider with before/after tokens - Settings: Compress long chats at 30-80% (default 50%), when nearly full or never, via CLAUDE_AUTOCOMPACT_PCT_OVERRIDE / DISABLE_AUTO_COMPACT; open to agents and the phone
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.
Long chats get slow and expensive, and today the only way out is typing
/compact(only mentioned in the "too long" error). This makes chat memory visible and compressing a one-click thing.What changes
/compressworks as an alias of/compact(runner rewrites it, the slash menu offers it, extra text is passed on as focus)./compactcommand card is hidden.CLAUDE_AUTOCOMPACT_PCT_OVERRIDE/DISABLE_AUTO_COMPACT; Claude Code usesmin(window × pct, its own threshold). Open tosettings_updateand the phone scope.How
StreamAccumulatortrackscontextTokens(input + cache read/write + output of the latest top-level message, the summary size aftercompact_boundary, cleared on/clear) andcontextWindow(frommodelUsageof the main model).conversations.context_tokens/context_window, exposed asConversation.context, written at the end of each stretch and live during a run (at most every 30 s and +2k tokens, right away after a compaction). Runner chats carry it inrunner_state.Checks
pnpm -r typecheckclean./compress keep the open tasksreaches Claude Code as/compact keep the open tasksand the context drops to the summary.context).-pmode:CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=1triggersstatus: compactingon the next turn.Screenshots (sandbox core with the fake Claude)
Saved locally in
~/.godmode/agents/godmode/workspace/godmode-bot/chat-compress/: s-bar.png, s-popover.png, s-after.png, s-after-dark.png, s-settings.png.