Stale File Replacement
When a file has been read multiple times during an agent session, GitAuto replaces older read contents with a placeholder like "[file content previously read - use latest version]". Only the most recent read of each file is preserved in full.
Why This Exists
Reading the same 500-line file 3 times burns 1,500 lines of tokens in the conversation history. The agent only needs the current content of the file, not historical snapshots from earlier iterations. Each redundant copy wastes context window space that could be used for new file reads, tool calls, or the model's reasoning.
Why Models Don't Know Content Is Stale
When the same file appears multiple times in the conversation, the model sees both versions but has no reliable way to determine which is current. The model can reason about message ordering to some degree, but with 50+ messages and multiple file versions scattered throughout, it frequently picks the wrong one. Replacing older versions with a placeholder removes the ambiguity and forces the model to use the latest content.
How It Works
Before each API call, GitAuto scans the conversation for read_file tool results. It groups them by file path and identifies files that appear more than once. For each duplicate, it replaces the content of all but the most recent read with a short placeholder message. The tool_use/tool_result structure is preserved so the model still knows a read happened, but the bulk content is removed. This can save tens of thousands of tokens in sessions that repeatedly read the same files.
Related Features
- Outdated Diff Removal - similarly deduplicates diff attempts per file
- Token Trimming - removes oldest messages when the context window fills up
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!