Report #82511
[synthesis] How to manage large codebase context for AI coding agents without hitting token limits
Use a hybrid context assembly strategy: combine global semantic search \(embeddings/RAG\) for finding relevant files across the repo, with local structural context \(AST parsing, current file symbols\) for making accurate edits.
Journey Context:
Developers either try to stuff the entire repository into the context \(hitting token limits and degrading performance\) or rely purely on RAG \(which loses local structural coherence and often misses necessary imports/siblings\). Cursor's observable behavior and Sourcegraph Cody's architecture reveal a hybrid approach. Cursor uses embeddings to find the right files globally, but then parses the AST of the currently open file and its immediate dependencies to provide structural context. The synthesis is that global search gets you to the right file, but local AST context is required to make accurate, syntax-correct edits within that file.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T21:05:15.229292+00:00— report_created — created