Cody by Sourcegraph — AI with Full Codebase Context
AI code assistant that understands your entire codebase. Chat, completions, edits, and deep search across repos. Enterprise-grade.
What it is
Cody is Sourcegraph's AI code assistant that differentiates itself by understanding your entire codebase, not just the open file. It uses Sourcegraph's code intelligence platform to build a semantic understanding of cross-file dependencies, function call chains, and project structure.
Cody is available as an extension for VS Code, JetBrains, Visual Studio, Neovim, and Emacs. It targets teams working on large codebases where generic AI assistants produce incomplete or incorrect answers because they lack project-wide context.
How it saves time or tokens
Most AI coding assistants only see the current file plus a few open tabs. When you ask about cross-file behavior (how a function is used across the codebase, what calls a specific API), they guess. Cody pulls relevant code from across your entire repository using Sourcegraph's indexing, giving the LLM the right context before it responds.
The token estimate for this workflow is approximately 1,453 tokens. By providing precise context rather than dumping entire files, Cody reduces both token usage and hallucination rates.
How to use
- Install the Cody extension:
# VS Code
code --install-extension sourcegraph.cody-ai
# Or search 'Cody' in the Extensions panel (Ctrl+Shift+X)
- Sign in with your Sourcegraph or GitHub account.
- Open any project. Cody automatically indexes your codebase and is ready for chat, completions, and inline edits.
Example
# In Cody chat within VS Code:
You: How is the `processPayment` function called across the codebase?
Cody: `processPayment` is called in 3 places:
1. `src/api/orders.ts:142` -- after order validation
2. `src/webhooks/stripe.ts:89` -- on payment intent confirmation
3. `tests/integration/payment.test.ts:45` -- test suite
The function accepts a PaymentIntent object and returns
a TransactionResult. The Stripe webhook path handles
retries via idempotency keys.
Cody also supports inline edits:
# Select code, press Ctrl+Shift+E, type instruction:
'Add error handling for the case where payment provider is unreachable'
Related on TokRepo
- AI Tools for Coding -- Compare Cody with other AI coding assistants
- AI Tools for Documentation -- Tools that help AI understand and generate code documentation
Common pitfalls
- Cody's full codebase context feature requires a Sourcegraph instance or Sourcegraph Cloud account. Without it, Cody falls back to local file context only.
- Enterprise self-hosted deployments need Sourcegraph running alongside Cody. The setup is more involved than a simple extension install.
- Free tier has usage limits on chat and completions. Check Sourcegraph's pricing page for current quota details.
Frequently Asked Questions
Copilot focuses on inline code completions using the current file and open tabs as context. Cody uses Sourcegraph's code graph to pull context from across your entire codebase, making it stronger for cross-file questions and large monorepos.
Yes. Cody works with any repository you have access to. For full codebase context, connect Cody to a Sourcegraph instance (cloud or self-hosted) that indexes your private repos.
Cody supports multiple LLM providers including Claude, GPT-4, and Gemini. Enterprise users can configure which models are available. The LLM handles generation while Sourcegraph handles context retrieval.
Cody has a free tier with limited chat and completion usage. Paid plans (Pro and Enterprise) increase quotas and add features like admin controls and SSO. Check sourcegraph.com for current pricing.
Yes. Cody has official support for VS Code, JetBrains IDEs, Visual Studio, Neovim, and Emacs. The Neovim plugin provides chat and completions with the same codebase context features.
Citations (3)
- Sourcegraph Cody— Cody uses Sourcegraph code intelligence for full codebase context
- Cody GitHub Repository— Available for VS Code, JetBrains, Visual Studio, Neovim, and Emacs
- Sourcegraph Docs— Supports Claude, GPT-4, and Gemini as LLM providers
Related on TokRepo
Source & Thanks
Created by Sourcegraph. Licensed under Apache-2.0.
Cody — Available on VS Code, JetBrains, Visual Studio, Neovim, Emacs
Thanks to Sourcegraph for building an AI assistant that truly understands codebases at scale.
Discussion
Related Assets
Conda — Cross-Platform Package and Environment Manager
Install, update, and manage packages and isolated environments for Python, R, C/C++, and hundreds of other languages from a single tool.
Sphinx — Python Documentation Generator
Generate professional documentation from reStructuredText and Markdown with cross-references, API autodoc, and multiple output formats.
Neutralinojs — Lightweight Cross-Platform Desktop Apps
Build desktop applications with HTML, CSS, and JavaScript using a tiny native runtime instead of bundling Chromium.