TL;DR
Imagine trying to debug a codebase while only looking at printed screenshots of files you took twenty minutes ago—every time you edit a file, your printouts become obsolete, forcing you to print fresh copies that clutter your desk. That is essentially how standard LLM coding agents work today. CORVUS fixes this by replacing static file snapshots in the chat history with a live, auto-updating "synced workspace" at the end of the prompt, cutting token costs by up to half and speeding up execution without sacrificing accuracy.
What Problem Does This Paper Address?
Modern AI coding agents (like Claude Code or Cursor) operate in a loop: they think, call a tool (like reading a file or running a test), observe the output, and append everything to an ever-growing conversation log called a trajectory.
The catch? Code files are mutable, while an append-only chat history is immutable. When an agent reads app.py, the file's entire text is pasted into the history as a frozen snapshot. As the agent—or a human collaborator—edits that file, the historical snapshot goes stale. This creates two major headaches:
- Stale-context errors: The agent tries to edit lines based on an outdated snapshot, fails, and wastes turns diagnosing its own confusion.
- Duplicate file reads: To see the latest state (or because earlier reads got buried), the agent re-reads the file—26% of all file reads in one baseline were duplicates! Each re-read dumps another full copy into the prompt, driving up latency, cost, and context rot (where LLMs lose focus as prompts get bloated).
Existing fixes are mostly reactive—waiting until the prompt gets huge and then summarizing or truncating older turns. The authors ask: instead of cleaning up bloat after the fact, why let stale duplicates enter the history at all?
Methods
CORVUS makes one clean, proactive architectural change: it decouples the act of requesting a file from storing its contents.
Instead of a standard read_file tool that dumps hundreds of lines of code directly into the chronological chat log, CORVUS gives the agent a sync_file tool.
- Registration: Calling
sync_file("a.py")simply addsa.pyto a background registry (the synced file set) and leaves a tiny placeholder ("sync: a.py") in the chat history. - Context Synchronization: Right before each LLM reasoning step, a Context Sync phase fetches the fresh, current contents of every registered file directly from disk and appends them as a dedicated "Synced Context" block at the very end of the prompt.
By construction, the prompt contains at most one copy of any file, and it is guaranteed to reflect the exact current state of the repository.
Datasets
CORVUS is evaluated as an inference-time architecture (no model training involved) across 573 real-world software engineering tasks from two benchmarks extending SWE-bench:
- SWE-PolyBench_Verified (382 tasks): Expands beyond Python into Java, JavaScript, and TypeScript, covering bug fixes, feature additions, and refactoring.
- SWE-Bench Pro (191 sampled tasks): Targets complex, enterprise-grade tasks that take human engineers hours or days (averaging 107 lines changed across ~4 files). The authors specifically sampled tasks with above-average code changes to stress-test long-horizon context growth.
Key Insights and Ideas
- Treat mutable state as mutable: Chat histories are great for recording a timeline of actions, but terrible for storing mutable state like source code. Separating event history from workspace state eliminates an entire class of edit errors.
- Proactive beats—and boosts—reactive: Because CORVUS stops redundant snapshots upstream, it pairs naturally with downstream compression methods (like sliding windows, summarization, or observation masking). Combining them yields greater token savings than either approach alone.
- Agents naturally keep small working sets: Even without a way to close files, agents only synced ~3 to 8 files per task on average. Refreshing a handful of local files takes milliseconds—far cheaper than the LLM inference turns saved by avoiding failed edits.
Key Results
Tested across four state-of-the-art models (Claude Sonnet 3.7, 4, 4.5, and open-source Qwen3-Coder-480B), CORVUS consistently trimmed the fat while preserving task success (pass@1 showed no statistically significant differences):
- Fewer wasted steps: Duplicate file reads dropped by 22–86%, and total reasoning cycles fell by up to 37.3% (dropping from 45.0 to 28.2 cycles on Sonnet 4.5).
- Leaner prompts & lower bills: Final prompt lengths shrank by 15–32%, and total input tokens dropped by 9–50%, cutting per-task API costs by up to 50.3% ($5.27 down to $2.62 on Sonnet 4.5).
- Faster wall-clock runtime: End-to-end execution time improved across the board, up to 40% faster on Sonnet 4.5.
Limitations and Future Work
- No "close tab" button yet: Once synced, a file stays in context for the rest of the task. Adding a
desync_filetool or syncing only specific AST code blocks/functions could shrink prompts even further. - Friction with prefix caching: Standard LLM KV-caches rely on exact prompt prefixes. Because CORVUS places the Synced Context after the growing chat history, those file tokens shift position every turn, preventing prefix-cache hits on unchanged files. Emerging position-independent or modular caching schemes could unlock extra speedups here.
- Out-of-distribution trajectories: Today's LLMs are trained on conventional
read_filelogs; fine-tuning models specifically on synced-context trajectories could help them manage their working sets even more effectively.
Summary updated