How to Connect Cody to Your Repo’s Context
Cody is Sourcegraph’s AI assistant, available in VS Code and JetBrains IDEs, and its distinguishing feature is codebase context: you can point it at a repository and ask questions across files. Used without context, it behaves like any chat assistant and guesses from the open file.
The gap between a vague answer and a useful one is usually whether the right three files were in context, not which model ran.
How do you add a repository for context?
Cody reads context from your local workspace and, on plans that include it, from indexed remote repositories. Register the repo in the Cody panel and wait for indexing on large codebases; on a mid-size service, expect a few minutes the first time.
If your organization hosts code in multiple providers, check which ones your plan indexes before you promise a team it can ask across all of them.
Which files should you include per question?
Start narrow. For a bug, include the failing function, its caller, and the test that covers it. Three files is a good default; twenty is noise that dilutes the answer.
Cody lets you add specific files to the chat context. Add by path, not by pasting contents, so the assistant sees the current version rather than a stale copy.
What prompts work with repo context?
Questions that name real symbols:
- “Where is
InvoiceCalculator.total_with_taxcalled, and does any caller pass a rate above 0.2?” - “Which tests cover the retry logic in the payments client?”
- “Show me the two other places that build a similar SQL query.”
Vague ones (“explain the payment flow”) get a tour of the top directory listing.
Give it a symbol name and it searches. Give it a feeling and it summarizes.
What are the limits
Indexing freshness matters. A repository indexed yesterday does not know about today’s branch. For local context, use the workspace, which is always current.
On large monorepos, indexing can take much longer and answers may cite code from a sibling package with a similar name. Verify the file path in any citation before applying a suggestion.
| Context source | Freshness | Coverage |
|---|---|---|
| Open file | Current | One file |
| Workspace | Current | Local repo |
| Indexed remote repo | Periodic | Organization-wide |
How does it differ from completion-first tools
Cody is answer-first: you ask and it explains with citations. If what you want is inline suggestions while typing, Codeium is the lighter fit. If you want an agent that edits files and runs commands with approval, Cline covers that.
Who should skip it
Solo projects that fit in one folder, where file selection is obvious. Teams whose code is not in a supported host and cannot be indexed. And anyone who needs guaranteed no-egress, where a local model setup such as Continue.dev is the safer route.
What does it cost
Free tier limits the number of chat messages and autocomplete suggestions per month; paid tiers add chat limits, larger context and organization-level indexing. Heavy chat users hit the free cap within a week, so test with your real question volume.
Quick Summary
- Cody answers with codebase context rather than the open file alone.
- Register the repo and let indexing finish; local workspace context is always current.
- Three relevant files beat twenty irrelevant ones.
- Name real symbols in prompts to get real searches.
- Indexed remote context refreshes periodically, so verify paths before trusting a citation.
