CORVUS: Context Optimization and Reduction Via Underlying Synchronization for LLM Coding Agents
TL;DR Highlight
Syncing file reads each turn cut input tokens 9–50% with comparable pass rates
Who Should Read
A backend developer building a coding agent who is struggling with high token costs and edits failing on stale file content
Core Mechanics
- Every file read leaves a snapshot
- Typical agents paste read_file output straight into the history.
- The snapshot is never updated even when the file changes later.
- Duplicate reads and stale content hurt
- With Claude Sonnet 4, 26% of file reads (834 of 3,207) were re-reads.
- Stale snapshots made edits fail by targeting text that no longer existed.
- Separate the read from its content
- sync_file registers the file and leaves only a "sync: path" marker in history.
- Before each cycle, the current contents are injected once at the end of the prompt.
- Only one fresh copy per file
- File contents live in a dedicated synced-context block, not scattered through history.
- Edits by the agent or a human show up in the next cycle.
- Cheaper, with similar pass rates
Evidence
- Sonnet 4.5 cost cut in half
- On SWE-PolyBench Verified, cost per instance fell from $5.27 to $2.62, down 50.28%.
- Cycles fell from 45.03 to 28.22, down 37.33% vs. baseline.
- Fewer input tokens and less latency
- Input tokens dropped 9–50% vs. baseline across models and benchmarks.
- Runtime dropped by up to 40% on Sonnet 4.5.
- Up to 86% fewer duplicate reads
- Duplicate reads fell 22–86% across all models vs. baseline.
- Pass rates comparable
- pass@1 was 19.20→20.07% (Sonnet 3.7), 25.83→24.61% (Sonnet 4), 28.10→29.49% (Sonnet 4.5), 20.07→21.12% (Qwen 480B).
How to Apply
- Measure your duplicate-read rate first
- Count how often your logs show the same path read twice or more today.
- If it is near the paper's 26%, syncing is worth trying.
- Replace read_file with sync_file
- Have the tool return only a "sync: path" marker and add the path to a set.
- Change only the read tool and leave other tools and prompts as they are.
- Inject fresh file contents every turn
- Re-read all registered files from disk right before each LLM call.
- Put one copy per file in a synced-context block at the end of the prompt.
- Keep your compression and verify pass@1
- If you already use summarization or observation masking, keep it and just add CORVUS.
- Run the same tasks and compare pass rate and cost to catch regressions.
Try It
# Paste into Claude Code, Claude, or ChatGPT (simplified version of the paper's method)
I want to convert my coding agent to the CORVUS approach. Propose changes with this structure.
1. Replace the read_file tool with sync_file(path). On call, add the path to a synced set and return only "sync: {path}".
2. Right before each LLM call, re-read every file in the synced set from disk and build a synced context block.
3. Compose the prompt as system message, tool schemas, message history, then synced context.
4. Make sure only one current copy of each file appears.
Target code:
{{agent loop code}}
Next, run the same 10 tasks before and after the change and compare input tokens, cycle count, and pass/fail in a table.Terminology
Related Papers
Same Simulation, Different Evidence: Where Retrieved Tool Output Costs LLM Agents Accuracy
Saving long tool output to files cut GPT-5.1 accuracy by 11.3 points; naming the authoritative file restored it.
Fake News, Real Crashes: Information Injection Attacks on LLM Financial Trading Agents
Fake headlines hijacked LLM trading agents 62% of the time versus 14% for prompt injection.
Harness Engineering 101: The LLM is the brain, the harness is the body
An agent is a loop managing a JSON array; 16 chapters build one from scratch
Harness2 by Google Research – Recursive Agent Harnessing
Recursively refining the harness with fixed model weights raised benchmark scores by up to 11.8 points.
Ousted Savannah police officer gave ICE agent husband access to Flock system
A police officer shared her Flock login with her ICE-agent husband; an audit found 983 searches and she was fired
Tmux and Claude Code: Sessions, Send-Keys, and the Ceiling
Running Claude Code agents in tmux works well, but limits appear around four agents.
Original Abstract (Expand)
LLM coding agents operate by constructing trajectories that accumulate reasoning, tool calls, and results to enable multi-step decision-making. However, the conventional append-only trajectory architecture found in practice tightly couples file-read actions with their observations, capturing snapshots that become permanently fixed in the chronological history. As files change through agent edits or concurrent human modifications, these snapshots become stale, causing reasoning errors and causing agents to redundantly re-read files, with each re-read appending yet another copy to the trajectory. To mitigate this, we propose CORVUS, a novel trajectory architecture that decouples file-read actions from their observations by maintaining a synchronized registry of relevant files and injecting only their current contents at each reasoning cycle. This structural change produces significantly lighter-weight trajectories that remain synchronized with the actual codebase state by construction, eliminating redundant file copies and stale snapshots that bloat conventional trajectories. We evaluated CORVUS on SWE- POLYBENCH_VERIFIED and SWE-BENCH PRO across four LLMs, achieving 9-50% reduction in average input tokens per task, 15-32% shorter final prompts, and up to 37% fewer reasoning cycles while maintaining comparable pass rates.