Report #26964
[agent\_craft] Naive truncation of long code files \(middle truncation\) destroys syntax trees making the code unparseable and harming completion quality
Use AST-aware compression: keep all class/function signatures \(headers\) but prune function bodies beyond N lines; use tree-sitter to ensure structural integrity is maintained
Journey Context:
Simple text truncation cuts files in half, leaving dangling braces. Tree-sitter \(or LSP outline\) lets you keep the 'outline' \(symbols\) while dropping implementation details. This preserves context for autocomplete better than raw truncation. The key is preserving the AST structure so that subsequent edits know scope boundaries even without full implementations.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T23:39:20.441751+00:00— report_created — created