Most AI coding assistants suffer from severe single-repository tunnel vision. You open an IDE, load a local directory, and the assistant sees that folder and nothing else. If your engineering organization runs 80 microservices, a dozen shared SDKs, and separate repositories for data schemas, that local scope is an immediate dead end.
At 365Finds, we evaluate developer tools based on how they survive messy corporate reality rather than pristine demo repositories. Sourcegraph Cody handles multi-repository codebases differently because it was built on top of an established enterprise code search engine and semantic graph, rather than merely slapping local vector embeddings over an editor buffer.
Getting cross-repository context out of Sourcegraph Cody requires specific infrastructure, deliberate prompt scoping, and an understanding of its hard boundaries. Here is how engineering teams can configure and use Sourcegraph Cody across distributed repositories, along with the operational trade-offs to expect.
Why Vector RAG Fails Across Repositories (And How Cody Bypasses It)
Standard IDE assistants typically rely on local file chunking and approximate nearest neighbor (ANN) vector searches. In a multi-repo ecosystem, this approach collapses quickly:
- Local footprint: Developers cannot reasonably clone 50 active repositories onto an M-series MacBook or cloud workstation just to satisfy an AI assistant's file watcher.
- Semantic disconnection: Vector embeddings capture lexical similarity, but they do not understand syntax-level dependencies. If an authentication middleware in repository
auth-servicecalls a token validator incore-security-sdk, vector distance will rarely surface the exact function interface.
Sourcegraph Cody addresses this through a multi-tiered context retrieval engine powered by Sourcegraph’s central indexing:
- Keyword and Trigram Search: Sourcegraph’s search engine queries indexed codebases across code hosts (GitHub, GitLab, Bitbucket) in milliseconds.
- SCIP (Session Code Intelligence Protocol) & Code Graph: Instead of treating code as plain text snippets, Sourcegraph builds structural graphs linking symbol definitions, references, callers, and implementations across repository boundaries.
- Targeted Context Injection: When Cody queries an LLM (such as Claude 3.5 Sonnet or GPT-4o), it injects precise, server-retrieved code snippets from the target repositories directly into the context window.
This architecture gives 365Finds a clear reason to recommend Sourcegraph Cody for distributed architectures over pure local assistants: the intelligence lives where your code already lives.
Prerequisites: The Enterprise Tier Requirement
The first reality check engineering leads need to understand: true multi-repository context with remote codebases is an enterprise feature.
| Tier | Context Scope | Multi-Repo Remote Access |
|---|---|---|
| Cody Free / Pro | Open editor tabs; local workspace files; basic local embeddings | Not supported (limited to the currently cloned local directory) |
| Cody Enterprise | Organization-wide repositories; remote @-mentions; SCIP Code Graph; context filters | Supported across all indexed code hosts (up to 10 repos per chat thread) |
If you are running the individual Cody Pro plan, you cannot query remote microservices hosted on your company's private GitHub or GitLab. Multi-repo capabilities depend directly on a Sourcegraph Enterprise instance (either self-hosted or Sourcegraph Cloud single-tenant) that has indexed your code hosts.
Step-by-Step: Setting Up Cross-Repo Context in Daily Workflows
1. Ensure Repositories and SCIP Indexers Are Configured
Before developers touch their editors, the Sourcegraph Enterprise administrator must ensure target repositories are fully cloned and indexed on the server instance.
For precise cross-repository symbol navigation (such as jumping from an API consumer to its definition in another repo), configure precise code intelligence using SCIP indexers in your CI/CD pipelines:
# Example SCIP indexing in CI for TypeScript/JavaScript
scip-typescript index --infer-tsconfig
src code-intel upload -f index.scip
If SCIP indexes are not uploaded, Cody still functions using Sourcegraph's keyword and search-based heuristics, but its ability to resolve exact cross-repo call signatures drops noticeably.
2. Connect Your IDE Extension
Install the official Sourcegraph Cody extension in VS Code, JetBrains IDEs (IntelliJ, PyCharm, WebStorm), or Visual Studio.
- Open extension settings.
- Under Sourcegraph: Server URL, point to your organization's instance (e.g.,
https://sourcegraph.company.com). - Authenticate using your enterprise Access Token.
3. Target Remote Repositories with @-mentions in Chat
In daily development, developers do not need Cody guessing across hundreds of unrelated repositories simultaneously. Instead, you explicitly scope your context inside the chat panel using the @ symbol:
- Open the Cody chat panel (
Cmd+LorCtrl+L). - Type
@in the prompt input field. - Select Remote Repositories from the context picker.
- Search and select the relevant companion repositories (e.g.,
github.com/org/payments-apiandgithub.com/org/billing-sdk). - You can repeat this to attach up to 10 remote repositories within a single chat session.
Beyond whole repositories, 365Finds recommends using directory-level targeting for large codebases. Typing @ allows you to select specific remote directories (e.g., github.com/org/mono-repo/packages/auth) to keep the LLM context concentrated on pertinent files rather than diluting token space with unrelated submodules.
4. Admin Governance: Restricting Exposure with Context Filters
In an enterprise environment, not every developer or prompt should pull context from every repository. Sourcegraph Enterprise (version 5.4.0 and above) supports cody.contextFilters in the site configuration JSON. This lets platform teams define RE2 regular expressions to govern context extraction:
{
"cody.contextFilters": {
"include": [
{
"repoNamePattern": "^github\\.com\\/acme-corp\\/(services|sdks)\\/.+"
}
],
"exclude": [
{
"repoNamePattern": "^github\\.com\\/acme-corp\\/compliance-vault$"
},
{
"repoNamePattern": "^github\\.com\\/acme-corp\\/legacy-monolith.*"
}
]
}
}
When configured, Cody will refuse to retrieve snippets from excluded repositories even if a developer explicitly attempts to @-mention them in chat, safeguarding sensitive credentials, compliance boundaries, and intellectual property.
High-Value Multi-Repo Scenarios
365Finds has analyzed three practical scenarios where Sourcegraph Cody's multi-repo capabilities deliver clear, measurable time savings:
1. Tracing Breaking Schema Changes Across Microservices
Suppose you are updating an event payload in order-service and need to know how downstream listeners handle deserialization. Instead of cloning five consumer repositories, you open order-service, @-mention the downstream repositories, and prompt:
"How does
@github.com/org/fulfillment-serviceconsume theOrderCreatedKafka event defined in our current schema, and will removing thelegacy_tracking_idfield break its ingestion pipeline?"
Cody pulls the consumer's event handler files and pinpointed struct mappings into context, highlighting the exact lines where legacy_tracking_id is parsed.
2. Consuming Internal SDKs Without Leaving the Editor
Internal SDK documentation is notoriously out of date. When writing a client integration in a new service, you can @-mention the internal SDK repository and prompt:
"Show me an idiomatic initialization of the client in
@github.com/org/telemetry-sdkusing mutual TLS and exponential backoff."
Cody retrieves the actual implementation and unit test patterns from the SDK repo rather than inventing a hallucinated API.
3. Engineering Onboarding Across Distributed Codebases
A newly hired developer working on a billing service can query architectural boundaries across repositories:
"Where is customer tier authorization validated between this repo and
@github.com/org/auth-service?"
The assistant traces the RPC call or HTTP middleware boundary, saving hours of manual Slack queries to senior engineers.
The Operational Gotchas to Consider
365Finds insists on highlighting the limitations that marketing materials gloss over:
- The 10-Repository Hard Limit: You cannot point Cody at your entire company catalog of 1,200 repositories in one sweep. The 10-repo cap per chat thread means developers must already have a working mental model of which repositories might interact.
- Index Latency: If an upstream repository pushed a critical contract change 10 minutes ago and Sourcegraph has not re-indexed that branch, Cody will generate code against stale interfaces.
- Autocomplete Isolation: Real-time inline code completion (tab completion) primarily relies on local buffer context and immediate imports. Multi-repo remote context functions predominantly in the interactive Chat and Command interface, not in millisecond-level autocomplete keystrokes.
Sourcegraph Cody provides one of the few genuinely functional bridges across repository boundaries in modern enterprise software development. For teams already invested in a microservice ecosystem and a Sourcegraph Enterprise deployment, learning to systematically target remote repositories via @-mentions transforms the assistant from a simple local code generator into an active distributed architecture navigator.