Token Trimming
GitAuto keeps as much conversation context as possible while staying under the model's 200K token limit. Rather than aggressively compacting or summarizing (which loses detail and causes the model to forget what it was doing), GitAuto only trims the oldest messages when necessary, preserves tool_use/tool_result pairs (never orphans one without the other), and always keeps the system message intact.
Why This Exists
When a model loses context, it forgets what files it read, what changes it already made, and what approach it was taking. It starts repeating work, making contradictory edits, or re-reading files it already processed. Aggressive summarization (like Claude Code's compact conversation) strips away details the model needs to stay coherent across a long session. GitAuto takes the opposite approach: keep everything, and only trim when the context window physically cannot fit more.
Why Models Exhaust Context Windows
Models have fixed context limits but no awareness of how full their context is. Each file read, tool call, and response adds tokens, but the model never thinks "I'm running low on context." It will keep reading files and generating code until the API rejects the request for exceeding the limit. Context management must happen at the application layer because the model has no self-monitoring capability.
How It Works
Before each API call, GitAuto calculates the total token count of all messages. If the count exceeds the usable budget, it removes only the oldest non-system messages - just enough to fit. When it encounters a tool_use message, it also removes the corresponding tool_result (and vice versa) to prevent the model from seeing an orphaned tool call without its response. The system message is never removed, ensuring the model always has the project context, coding standards, and instructions. The goal is maximum context retention, not minimum token usage.
Related Features
- Outdated Diff Removal - removes superseded diffs to free token space
- Stale File Replacement - replaces duplicate file reads with placeholders
Need Help?
Have questions or suggestions? We're here to help you get the most out of GitAuto.
Contact us with your questions or feedback!