Stop Dumping Your Entire Codebase into AI Context: Write Decisions It Can Actually Retrieve
Teams adopting AI coding agents quickly hit a ceiling where context windows overflow with stale rules. A retrieval step that depends on well-structured source documents cuts token waste and lets agents justify answers with traceable references, which is the difference between a demo and a workflow you can audit.
Feeding every project rule to an AI agent on cold start burns tokens and buries relevant context. The fix is a retrieval-augmented generation pipeline that pulls only the decisions a task actually needs. But retrieval quality collapses if the underlying documents are just scattered conclusions. Two lightweight templates—BADR for business rules and FADR for technical choices—use a fixed Feature → Assessment → Decision → Rationale structure that makes each record independently understandable, naturally chunkable, and semantically dense enough for embedding models to match against varied queries. YAML frontmatter supplies machine-readable metadata for filtering, isolation, and traceability, so an agent can cite the exact source file and decision number instead of emitting an unverifiable claim. The directory convention is deliberately flat: one file per system per decision type, keeping the ingestion pipeline simple before any vector database enters the picture.
Most RAG advice jumps straight to vector databases and chunking strategies, but the real bottleneck is upstream: documents written as narrative prose produce garbage retrieval units no matter how good the embedding model is.
The BADR/FADR split mirrors a split that Western ADR (Architecture Decision Records) culture often neglects—business rules decay differently than technical ones and deserve their own lifecycle and retrieval path.
Requiring a stable decision number and source path in every retrieval result turns an AI agent from an oracle into an auditable tool, which matters more for compliance-heavy teams than any benchmark score.
The template's four sections act as a cheap semantic expansion trick: the same decision expressed four ways increases the chance an embedding model will match it against a user's rephrased question.