Report #6192
[agent\_craft] Agent exceeds context window in long-horizon tasks because it retains full file contents and tool output history indefinitely
Adopt hierarchical memory management: use repo-map \(file outlines and signatures\) for structural context; fetch full file contents only when editing; compress completed sub-tasks into episodic summaries; evict raw tool outputs, keeping only derived state
Journey Context:
File contents are token-dense \(average 0.75 tokens per byte\) and mostly boilerplate; retaining full text for every file seen quickly exhausts the context window, forcing truncation of recent, critical instructions. Repo-maps \(generated via tree-sitter\) provide 10x token efficiency by storing only symbol definitions and call graphs. For long-horizon control flow, treating raw history as sacred leads to attention dilution; episodic compression preserves the 'what was done' and 'result' while discarding the 'how' \(intermediate tool noise\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T23:20:16.875762+00:00— report_created — created