Use repository-native context for authoritative engineering decisions when version alignment, review history and reproducible citations matter. Use RAG to discover relevant material across large or unstructured corpora, but resolve binding answers back to current, inspectable records rather than treating semantic similarity as authority.

The systems answer different questions

Repository-native retrieval asks which reviewed records govern this code at this commit. RAG asks which chunks appear semantically relevant to a query. Both can help an agent, but only the first naturally aligns authority with source version and ordinary code review.

Where repository-native context wins

Typed records can expose lifecycle, scope and relationships without inferring them from text. Exact IDs make results reproducible and reviewable. Local operation also works in restricted or intermittent environments and avoids an external index becoming stale relative to the checkout.

  • Accepted versus proposed status must be explicit.
  • A citation must resolve to the same source a reviewer sees.
  • The relevant code and decision versions must travel together.
  • Empty results must remain honest and inspectable.

Where RAG remains valuable

Semantic retrieval is useful for broad discovery across incident reports, design documents, tickets and large documentation sets. It can surface vocabulary the user did not know and point toward candidate sources. The risk arises when a similar chunk is presented as a current decision without resolving its status and provenance.

Use a layered pattern

Let broad search discover candidate material, then query the repository record for binding decisions and stable citations. If no reviewed record exists, state that limitation and ask the team to decide. This combines recall with an explicit authority boundary.

Sources and further reading

  1. AWS retrieval-augmented generation guidance
  2. Git object model
  3. AsDecided Core quickstart