# ADR-0011: Pattern-example RAG gated behind a validation spike **Status:** Accepted (2026-08-08) ## Context The pattern-example RAG pipeline — clone, chunk, embed, tag, search, refresh — is the largest single body of work in the design doc, and it rests on an unvalidated hypothesis: that semantically retrieved chunks from an example repository measurably improve an agent's output. Naive chunking of source code is known to produce poor retrieval, so doing it well requires AST-aware chunking via tree-sitter, which is most of the cost. ## Decision Insert **phase 5.5, a throwaway spike**, before committing to phase 6. Index one real example repo with naive chunking, run roughly ten realistic queries, and judge whether the retrieved chunks would actually have improved an agent's output. The spike code is discarded regardless of outcome. Phase 6 proceeds only if the spike passes. Its deliverable is a written go/no-go recommendation with the queries and retrieved chunks as evidence. ## Consequences - A large speculative build is de-risked for a few days of throwaway work. - If the spike fails, the `patterns:` section of the canonical document still exists — names, descriptions, and repository URLs — just without indexed, searchable example code. - If it passes, the spike's queries become the seed of phase 6's evaluation set. - Phase 6's size estimate stays honest rather than being quietly discovered mid-build.