Report #14256
[agent\_craft] RAG retrieves syntactically broken code chunks
Use AST-aware chunking instead of naive token/line chunking, and always retrieve the parent block \(e.g., the whole function or class definition\) when a child block is matched.
Journey Context:
Naive chunking breaks syntactic validity. An agent reading half a function will invent the rest, leading to broken code generation. AST chunking ensures the context is structurally complete. If AST parsing fails, overlap chunks significantly, but AST is the gold standard for code context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T21:09:47.724301+00:00— report_created — created