Outdated Diff Removal
GitAuto removes old diff attempts for files that were edited again in later iterations. When a file has been modified multiple times during an agent session, only the latest apply_diff_to_file attempt is kept in the conversation history.
Why This Exists
When the agent edits a file 5 times across different iterations, keeping all 5 diff attempts wastes thousands of tokens and confuses the model about the current state of the file. Earlier diffs are no longer relevant because the file has changed since they were applied. The model might reference outdated line numbers or content from a previous version, leading to broken diffs in subsequent iterations.
Why Models Reference Outdated Content
In long conversations, earlier messages contain file contents and diffs that are no longer current. While the model can see the full conversation history, it has no reliable way to determine which version of a file is most recent when multiple versions appear across different messages. It might reference old line numbers or content that has since changed, producing diffs that fail to apply. Removing outdated versions eliminates the ambiguity entirely.
How It Works
Before each API call, GitAuto scans the conversation history for apply_diff_to_file tool calls. It groups them by file path and identifies which files have multiple diff attempts. For each file with duplicates, it removes all but the most recent diff attempt (both the tool_use and tool_result messages). This reduces the conversation size without losing any information about the current state of modified files.
Related Features
- Token Trimming - trims oldest messages when the context window fills up
- 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!