Microservice sprawl is often where developer AI tools quietly fall apart. Most AI coding assistants perform admirably inside a self-contained repository, but the moment a breaking change occurs in an upstream authentication library or an asynchronous event payload changes in an order service, their context window hits a hard wall. They cannot see beyond the root of the active local IDE workspace. Developers are left manually grep-searching across dozens of cloned repositories or relying on outdated architectural diagrams.
Sourcegraph Cody takes a fundamentally different route. Because it sits directly on top of Sourcegraph’s enterprise code graph and universal code search, Cody can pull contextual awareness from multiple repositories simultaneously. At 365Finds, we evaluate developer tools based on how they survive real-world distributed architectures, not clean toy projects.
This guide breaks down how to configure, query, and verify cross-service dependencies across multiple repositories using Sourcegraph Cody, while outlining the architectural guardrails necessary to avoid context noise and hallucinations.
1. Architectural Foundation: How Cody Queries Across Repositories
Standard AI coding assistants rely primarily on local text chunking and vector embeddings generated from whatever project directory you opened in VS Code or JetBrains. If service-b consumes a protobuf definition housed in proto-contracts, a local assistant simply guesses or hallucinates the contract.
Sourcegraph Cody solves this through two distinct backend capabilities:
- SCIP (Sourcegraph Code Intelligence Protocol): Sourcegraph indexes codebases using SCIP—an open, language-agnostic standard that replaces older LSIF implementations. Language-specific indexers (
scip-go,scip-typescript,scip-java,scip-python) analyze source trees at compile-time precision, emitting symbol identifiers for definitions, references, and implementations across package and repository boundaries. - Server-Side Universal Code Search: When Cody queries a codebase, it does not merely pass your question to a large language model. It executes targeted queries against Sourcegraph’s centralized search index, combining keyword search, structural AST search, and the SCIP symbol graph into the retrieval pipeline before synthesizing the LLM prompt.
+-----------------------------------------------------------+
| Cody Chat / IDE |
| Prompt: "@repo:org/orders @repo:org/billing trace RPC" |
+-----------------------------+-----------------------------+
|
v
+-----------------------------------------------------------+
| Sourcegraph Backend Server |
| - SCIP Cross-Repo Code Intelligence |
| - Universal Code Search Engine (Regex / AST / Symbols) |
| - Cody Context Filter (RE2 Access Policies) |
+-----------------------------+-----------------------------+
|
v
+-----------------------------------------------------------+
| External / Local LLM |
| (Claude 3.5 Sonnet / GPT-4o / Gateway) |
| Grounded Cross-Service Dependency Architecture |
+-----------------------------------------------------------+
This structural awareness means Cody understands when a TypeScript client in one repository calls a Go gRPC service in another, provided both repositories are indexed on your Sourcegraph instance.
2. Prerequisites and Repository Indexing Setup
Before asking Cody to trace cross-service interactions, verify that your Sourcegraph instance and local editor extensions meet these baseline requirements:
- Sourcegraph Instance: Sourcegraph 5.4.0 or higher (Sourcegraph Enterprise is required for remote multi-repo context and context filters).
- Editor Extension: Cody extension installed in VS Code (>= 1.20.0) or JetBrains (>= 6.0.0), connected to your enterprise Sourcegraph instance rather than Cody Free personal mode.
- SCIP Indexing Enabled: For precise symbol navigation across services, ensure that language indexers run in your CI/CD pipelines (or via Sourcegraph native auto-indexing). A text-only index allows basic keyword matching, but SCIP indexing is required for compiler-level cross-repo symbol resolution.
To upload SCIP indexes in CI/CD pipelines (e.g., GitHub Actions or GitLab CI):
# Example for a Go microservice
scip-go
src code-intel upload -f index.scip
# Example for a TypeScript service
scip-typescript index
src code-intel upload -f index.scip
3. Step-by-Step Workflow: Tracing Cross-Service Dependencies
Step 1: Scope Multi-Repository Context in Cody Chat
Do not ask general cross-service questions without specifying context. Cody allows you to explicitly anchor remote repositories using @-mentions in the chat window.
- Open the Cody Chat panel in VS Code or JetBrains.
- Type
@in the prompt input field. - Select Remote Repositories from the context dropdown menu.
- Search for and select the upstream producer repository (e.g.,
github.com/org/checkout-service). - Type
@again and select the shared schema or consumer repository (e.g.,github.com/org/payment-serviceandgithub.com/org/shared-proto).
Operational Note: Cody Enterprise currently allows up to 10 remote repositories to be linked simultaneously in a single chat context. In a microservices architecture with hundreds of services, you must strategically select the immediate blast-radius cluster (consumer, producer, shared contracts) rather than attempting to attach the entire fleet.
Step 2: Formulate Structured Dependency Queries
Vague queries like "how do these talk?" generate speculative prose. Instead, structure prompts around concrete integration mechanisms: contract schemas, RPC endpoints, and asynchronous event topics.
Scenario A: Tracing a gRPC / Protobuf Breaking Change
When modifying a field in a shared protocol definition:
@repo:github.com/org/shared-proto @repo:github.com/org/order-service @repo:github.com/org/fulfillment-service
We are planning to deprecate the `user_tier` field in `proto/order/v1/order.proto` and replace it with `membership_details.tier_code`.
1. Which RPC handlers in `order-service` populate this field?
2. Which client calls in `fulfillment-service` deserialize and depend on `user_tier`?
3. Provide the file paths and line numbers where breaking changes will occur if `user_tier` is removed.
Scenario B: Tracing REST API and HTTP Gateway Routing
When an API Gateway forwards traffic downstream to an internal service:
@repo:github.com/org/api-gateway @repo:github.com/org/user-profile-service
Trace the request path for `POST /v2/users/{id}/preferences`.
1. How does the gateway middleware authenticate and transform headers before forwarding to `user-profile-service`?
2. Where is the matching route handled in `user-profile-service`?
3. List any environment variables or service discovery URLs that bind these two services together.
Scenario C: Tracing Event Bus Topics (Kafka / RabbitMQ)
When services communicate asynchronously through message brokers:
@repo:github.com/org/billing-service @repo:github.com/org/notification-worker
Find the message schema published to the `billing.invoices.settled` topic in `billing-service`.
1. Show the publisher code and payload construction.
2. In `notification-worker`, locate the consumer group subscription for this topic.
3. Confirm if all fields emitted by the publisher are accounted for in the worker's deserializer struct.
Step 3: Verify Synthesis Against the Compiler Graph
Never trust LLM output blindly when auditing microservice blast radiuses. An AI assistant can easily confuse two endpoints with similar naming conventions.
Use Sourcegraph’s dual-interface verification:
- Check Cody’s Context Chips: In the Cody chat response, click on the Context pills displayed at the top of the message. Review which exact files and lines were retrieved. If Cody did not pull the client SDK or contract file, supply it manually using
@filename. - Jump to Definition / Find References: Right-click the symbol identified by Cody in your editor and choose Sourcegraph’s Find References. Verify that the cross-repository reference exists in the SCIP index. If SCIP confirms the link, Cody’s architectural narrative is grounded in real AST evidence.
4. Managing Noise and Compliance: Cody Context Filters
Allowing an AI model to query across all repositories creates two risks: leaking sensitive credentials or proprietary modules to external LLM providers, and polluting chat context with archived or deprecated microservices.
Sourcegraph Enterprise administrators should enforce Cody Context Filters (cody.contextFilters) in the site configuration using RE2 regular expressions:
{
"cody.contextFilters": {
"include": [
{
"repoNamePattern": "^github\\.com\\/acmecorp\\/(core-.*|shared-schemas|api-gateway)$"
}
],
"exclude": [
{
"repoNamePattern": ".*-deprecated$"
},
{
"repoNamePattern": "^github\\.com\\/acmecorp\\/(secrets-vault|pci-compliance)$"
}
]
}
}
- Security Guard: Any repository matching an
excludepattern is blocked at the Sourcegraph proxy layer; its source code will never be sent to the underlying LLM. - Accuracy Improvement: By filtering out legacy forks and deprecated services, Cody avoids citing stale dependencies that were decommissioned months ago.
5. Architectural Trade-offs: The 365Finds Verdict
At 365Finds, our assessment is straightforward: Sourcegraph Cody is one of the very few developer AI assistants capable of meaningful cross-repository reasoning. For microservice refactoring, cross-team API handoffs, and onboarding into polyglot architectures, its SCIP-backed code graph provides a substantial productivity advantage over single-repo competitors.
| Dimension | Sourcegraph Cody Multi-Repo | Single-Repo AI Assistants |
|---|---|---|
| Context Scope | Up to 10 indexed remote repositories | Active IDE workspace folder only |
| Code Intelligence | SCIP compiler-accurate symbol graph | Fuzzy text embeddings / heuristic search |
| Microservice Dependency Mapping | Native across contracts, SDKs, and calls | Requires manual copy-pasting or monorepo hacks |
| Enterprise Governance | Granular RE2 context inclusion/exclusion filters | Workspace-level ignore files (.cursorignore, etc.) |
| Licensing Requirement | Full remote multi-repo requires Enterprise | Standard Pro / Free tiers often support full local features |
Where Cody Has Blind Spots
Engineers must recognize Cody’s hard boundaries:
- Static vs. Runtime Telemetry: Cody analyzes static code topology. It cannot know if an endpoint is blocked by an ingress firewall, disabled by a LaunchDarkly feature flag, or routed dynamically via a service mesh (e.g., Istio Envoy filters) unless those configurations live directly in the indexed code repositories.
- Untyped Dynamic Payloads: If your microservices communicate via loosely typed JSON payloads across message queues without explicit schemas or TypeScript/Protobuf interfaces, Cody must fall back on keyword search heuristics rather than SCIP symbol maps.
- The 10-Repository Ceiling: In large enterprises running 300+ microservices, developers cannot ask Cody to "analyze the whole company." You must know enough about your target architecture to pick the relevant 5 to 10 repositories.
For static cross-service dependency tracing and contract audits, Sourcegraph Cody is a premier enterprise tool. Pair it with runtime distributed tracing (such as OpenTelemetry or Jaeger) to validate that what Cody traces in the code graph matches what actually executes in production.