Developers maintaining microservices, distributed libraries, or modular enterprise applications frequently hit a frustrating ceiling: understanding a single function requires knowing how three different services, an internal SDK, and an infrastructure schema interact across separate repositories. In traditional IDE setups, answering cross-service questions means cloning gigabytes of code locally, setting up clunky multi-root workspaces, and watching local language servers and indexing daemons choke CPU and RAM.
Sourcegraph Cody takes a fundamentally different path. Because Cody is built directly on top of the Sourcegraph Code Intelligence platform, it shifts repository indexing, code graph resolution, and semantic search off your laptop and onto a centralized Sourcegraph instance. You can sit inside your primary local project and query up to 10 remote repositories simultaneously without checking out a single line of their code to your local disk.
At 365Finds, we view this server-first indexing architecture as Cody's most decisive commercial advantage over local-first coding assistants. Most IDE plugins treat your open editor folder as the entire universe; Sourcegraph Cody treats your local workspace as merely an active viewport into an entire enterprise codebase graph.
The Underlying Mechanism: Server-Side Indexing vs. Local Checkouts
To understand why local checkouts are unnecessary, consider how context resolution works under the hood:
[Local IDE (VS Code / JetBrains)]
│
│ Chat Query + "@remote-repo" Mention
▼
[Sourcegraph Instance (Server / Cloud)]
├── Centralized Code Index (Search API & SCIP Code Graph)
├── Vector Embeddings (Semantic Search)
└── Access Control & Context Filters (cody.contextFilters)
│
│ Ranked & Scoped Snippets Injected
▼
[LLM Provider (Claude / GPT-4o / Bedrock)]
│
▼
[Accurate Cross-Repository Answer returned to IDE]
- Centralized Code Indexing: Your company's Sourcegraph instance continuously mirrors and indexes repositories from code hosts like GitHub, GitLab, Bitbucket, or Perforce. It builds trigram search indices, precise symbol definitions (SCIP), and vector embeddings on the server side.
- Context API Retrieval: When you query a remote codebase in Cody Chat, Cody calls the Sourcegraph Search API over HTTPS. The server parses the query, fetches the relevant code slices across indexed remote branches, re-ranks the snippets, and injects them into the prompt payload.
- Zero Local Footprint: The remote code never lands in your local
.gitdirectory or workspace tree. Your IDE remains responsive, lightweight, and clutter-free.
Step-by-Step: Querying Remote Repositories in Cody
This remote context workflow is natively available to Cody Enterprise users connected to an active Sourcegraph instance. Here is how to execute multi-repository queries in daily engineering workflows.
1. Verify Extension Connection to Sourcegraph Enterprise
Make sure your Cody IDE extension (VS Code, JetBrains, or Visual Studio) is authenticated against your organization's Sourcegraph URL rather than sourcegraph.com public free tier:
- In VS Code, click the Cody icon in the activity bar.
- Check the status bar or Cody settings: your account should show active connection to
https://sourcegraph.yourcompany.com.
2. Add Remote Repositories via the @-Context Picker
In the Cody chat panel:
- Type
@in the chat input prompt, or click the@icon. - Select Remote Repositories from the popover menu.
- Search for the remote repository name (for example,
github.com/my-org/auth-serviceorinternal-tools/billing-api). - Press
Enterto attach it as a context chip. - Repeat the process to add additional repositories. Cody supports querying up to 10 repositories simultaneously in one prompt context.
3. Hone Context Precision with Directories and Symbols
While Cody allows searching an entire remote repository, stuffing broad repositories into prompt context forces re-rankers to guess what matters most. 365Finds strongly advises scoping queries to specific subdirectories, files, or symbols when investigating specific interfaces:
- Remote Directory:
@github.com/my-org/auth-service/src/middleware/ - Remote File & Line Range:
@github.com/my-org/billing-api/schema.prisma:1-80 - Specific Symbol: Type
@#followed by the function or interface name, such as@#ValidateSessionToken.
4. Running Multi-Repo Queries from the Command Line
If you use the Cody CLI for scripting, continuous integration, or terminal workflows, pass the --context-repo flag directly:
cody chat --context-repo github.com/my-org/billing-api \
--context-repo github.com/my-org/auth-service \
-m "How does auth-service validate JWTs generated by billing-api?"
Architectural Comparison: Local Clones vs. Cody Remote Context
| Dimension | Multi-Root Local Checkouts | Sourcegraph Cody Remote Context |
|---|---|---|
| Disk Footprint | Heavy; hundreds of megabytes or gigabytes per repo | Zero bytes on local disk; fully hosted |
| IDE Memory Overhead | High; multiple language servers run concurrently | Low; only the active local workspace is parsed locally |
| Cross-Repo Scope | Limited by local machine storage and RAM limits | Up to 10 repositories concurrently per chat prompt |
| Code Staleness | High; requires manual git pull across all folders | Low; automatically tracks latest indexed default branches |
| Permission Enforcement | Client-side; depends on developer clone access | Centralized; enforces Sourcegraph ACLs and regex filters |
| Best For | Active cross-repo code modifications and builds | Interface inspection, API consumption, tracing bugs |
Administrative Governance: Guarding Context with Filters
In enterprise environments, cross-repo AI queries must respect strict security boundaries. Sourcegraph allows site administrators to enforce repository inclusion and exclusion rules using cody.contextFilters in the site configuration.
{
"cody.contextFilters": {
"include": [
{
"repoNamePattern": "^github\\.com\\/my-org\\/(api|services|sdk)-.+"
}
],
"exclude": [
{
"repoNamePattern": "^github\\.com\\/my-org\\/(pci-vault|secret-store)$"
}
]
}
}
When an exclude rule matches a repository, Cody will refuse to fetch snippets from that codebase, preventing proprietary formulas or credentials from ever reaching external LLM endpoints.
365Finds Verdict and Trade-offs
365Finds finds Sourcegraph Cody's remote multi-repository querying indispensable for service-oriented and distributed architectures. Eliminating the need to clone downstream dependencies saves real time and keeps developer machines fast.
However, keep two boundary conditions in mind:
- License Requirement: This workflow requires Cody Enterprise connected to a self-hosted or managed Sourcegraph instance (version 5.4.0 or later). Free and Pro individual plans rely primarily on local workspace context and public web documentation.
- The 10-Repository Limit: Cody caps simultaneous remote context retrieval at 10 repositories. For mega-architectures spanning dozens of services, engineers must consciously pick the relevant microservice clusters rather than attempting to blanket-query an entire corporate catalog.