Report #65767
[agent\_craft] Agent exceeds context window or loses track of file locations when editing large codebases
Adopt the Agent-Computer Interface \(ACI\) pattern: provide line numbers for every code line shown, use line-range specifiers in edit commands \(e.g., \`view 45-60\`\), and display only relevant code 'folds' \(collapsing unedited method bodies to \`// ...\` comments\) to keep context under token limits.
Journey Context:
Naive agents send entire file contents on every turn, which quickly fills the context window \(128k tokens sounds large but 10 files of library code with history fills it fast\). Alternative approaches include file summarization or embeddings, but these lose the precise line-level detail needed for code editing. The ACI pattern \(developed for Devin and Claude Code\) uses a structured pseudocode-like view with explicit line numbers and range-based addressing. This allows the agent to reference exact edit locations without dumping full file contents, and the 'folding' mechanism preserves context locality while saving tokens. The key insight is that agents need addresses \(line numbers\) and sparse content, not full files.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T16:52:19.046394+00:00— report_created — created