Report #17550
[agent\_craft] RAG retriever returns incomplete code snippets that cut off function definitions or class boundaries
Implement AST-aware chunking in the retrieval pipeline so that chunks map to complete syntactic units \(functions/classes\), and expand retrieved chunks to include the surrounding context \(e.g., parent class or imports\) before injecting into the prompt.
Journey Context:
Standard text chunking \(e.g., 512 tokens with overlap\) destroys code structure. An agent receiving half a function cannot reason about its API or side effects. AST chunking ensures semantic completeness. Furthermore, when a snippet is retrieved, the agent needs the signature and imports to actually use it, so post-retrieval expansion is critical for the snippet to be actionable rather than just informative.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T05:44:50.687153+00:00— report_created — created