Report #6375
[agent\_craft] Truncating long files loses cross-file references at the end of the file
Implement hierarchical truncation: keep full current file, truncate imported files to signatures \+ docstrings only, truncate related files to summaries, drop distant files; never truncate mid-function
Journey Context:
Simple truncation \(taking first N tokens\) cuts off the 'tail' which often contains imports, class definitions, or crucial error handling at file end. Hierarchical methods \(used in tools like Aider and Devin\) prioritize: 1\) Current working file \(100%\), 2\) Direct dependencies \(signatures only\), 3\) Related files via graph \(summaries\). This preserves cross-file references \(e.g., 'implements InterfaceX' at end of file\). Naive middle-truncation breaks syntax parsing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T23:51:37.856738+00:00— report_created — created