💻

Sourcegraph Cody

Context-aware code assistant for faster, safer development

Free | Freemium | Paid | Enterprise ⭐⭐⭐⭐☆ 4.4/5 💻 Code Assistants 🕒 Updated
Visit Sourcegraph Cody ↗ Official website
Quick Verdict

Sourcegraph Cody is a code-assistant that answers code questions, generates and refactors code using repo-aware context. It’s best for engineers and teams who need on-codebase, up-to-date assistance rather than generic LLM completions, and pricing ranges from a free tier with limited queries to paid Team and Enterprise plans for private repo scale.

Sourcegraph Cody is a repo-aware code assistant that uses your codebase context to answer questions, generate code, and help with refactors. It connects to repositories, indexes code, and runs natural-language queries against that indexed context to return precise, source-grounded answers. Cody’s key differentiator is its repository and code-search integration, making it suited for engineering teams, senior developers, and code reviewers. Available as a freemium offering with paid Team and Enterprise options, Sourcegraph Cody’s pricing is accessible for small teams but scales for enterprise deployments in the code assistants category.

About Sourcegraph Cody

Sourcegraph Cody is an AI-powered code assistant built by Sourcegraph and positioned as a repo-aware complement to general-purpose LLM copilots. Launched as part of Sourcegraph’s push into AI-enhanced developer tooling, Cody leverages Sourcegraph’s global code index and code intelligence to ground answers in a customer’s actual repositories. The core value proposition is reducing context-lookup time and providing traceable, citation-backed responses about code, dependencies, and project architecture, rather than hallucinated free-form answers. Cody runs alongside Sourcegraph’s code search and code intelligence features to serve context-specific guidance inside code editors and the browser.

Cody’s feature set centers on repository grounding, conversational coding, and local/private model options. It supports context windows that reference your indexed files and returns answer snippets with file links and line references; it can search code, cite the precise file and lines it used, and open the referenced file in Sourcegraph. Cody integrates with VS Code and JetBrains IDEs to provide inline suggestions, code generation, and refactors inside the editor. It offers chat-style sessions that preserve conversational context and can run automated code transformations using saved prompts. Administrators can deploy Cody to use hosted Sourcegraph’s cloud models or connect to private models, and Enterprise customers can opt for self-hosted deployments for data controls.

Pricing includes a free tier that lets individuals and small teams experiment with Cody via Sourcegraph Cloud with limits on query volume and functionality. Sourcegraph’s published pricing lists paid Team plans at a per-seat monthly rate and Enterprise pricing by quote for large, self-hosted deployments with SSO and compliance features. The Team tier unlocks private repo context, more queries, and IDE integrations; Enterprise adds self-hosting, dedicated support, and high-volume indexing. Exact per-seat prices and enterprise quotes are provided on Sourcegraph’s site and via sales, with a free tier intended for evaluation and paid tiers for production use.

Software engineers, developer managers, and code reviewers use Cody for concrete workflows: a senior backend engineer uses Cody to answer complex dependency and call-graph questions across 50+ microservices, while a QA engineer uses it to generate targeted unit-test skeletons and reproduce steps with file citations. DevOps teams use self-hosted Cody to run security triage queries against internal repos. Compared with GitHub Copilot and other copilots, Cody’s main advantage is repository grounding and file-citation integration, while competitors may provide broader completion models but less repo-aware traceability.

What makes Sourcegraph Cody different

Three capabilities that set Sourcegraph Cody apart from its nearest competitors.

  • Uses Sourcegraph’s global code index to cite exact repository files and line ranges in answers, enabling verifiable context.
  • Offers a self-hosted deployment path and SSO-ready Enterprise options for on-premise control and compliance.
  • Integrates chat-style, multi-turn conversations with code search so queries reference and link directly to repository files.

Is Sourcegraph Cody right for you?

✅ Best for
  • Backend engineers who need quick, cite-backed answers across multiple repos
  • Engineering managers who need faster onboarding and codebase orientation
  • Security engineers who need repository-scoped code triage and vulnerability traces
  • DevOps teams who require self-hosted tooling and SSO for compliance
❌ Skip it if
  • Skip if you require large-model creative completions without repository grounding.
  • Skip if you need an exclusively cloud-only hosted consumer copilot with very low per-user cost.

✅ Pros

  • Produces answers with file citations and direct links to source files for verifiable context
  • Supports self-hosted Enterprise deployments and SSO for on-premise data control
  • IDE integrations (VS Code, JetBrains) provide inline suggestions and chat tied to repo context

❌ Cons

  • Free tier limits queries and doesn’t index private repositories by default, hindering production use
  • Model behavior and answer quality depend on the freshness and completeness of Sourcegraph’s repo index

Sourcegraph Cody Pricing Plans

Current tiers and what you get at each price point. Verified against the vendor's pricing page.

Plan Price What you get Best for
Free Free Limited queries and community Cloud access, no private repo indexing Individuals evaluating Cody
Team $10 per user/month Per-user access, private repo context, IDE integrations enabled Small engineering teams needing private context
Enterprise Custom Self-hosting, SSO, high-volume indexing, dedicated support Large orgs with compliance needs

Best Use Cases

  • Senior Backend Engineer using it to reduce cross-repo investigation time by 40%
  • QA Engineer using it to generate unit-test scaffolds covering 80% of edge cases faster
  • DevOps Engineer using it to triage security findings across 100+ repositories

Integrations

VS Code JetBrains IDEs GitHub

How to Use Sourcegraph Cody

  1. 1
    Sign in to Sourcegraph Cloud
    Go to https://sourcegraph.com/cody and click Sign in or Start for free; choose GitHub/GitLab SSO to link your account. Success looks like seeing the Cody entry point in the Sourcegraph UI.
  2. 2
    Connect repositories to Sourcegraph
    From Sourcegraph Cloud or your self-hosted instance, add repo providers (GitHub/GitLab/Bitbucket) and select repositories to index. Success is the index completing and repo files appearing in code search.
  3. 3
    Open Cody in your IDE extension
    Install the Cody extension for VS Code or JetBrains, sign in with your Sourcegraph account, then open a project; you’ll see Cody chat and inline suggestions inside the editor.
  4. 4
    Ask a code-grounded question
    In the Cody chat panel or inline, ask a specific question like “Where is X implemented?” or request a refactor; success is a reply with code snippets plus file links and line references.

Ready-to-Use Prompts for Sourcegraph Cody

Copy these into Sourcegraph Cody as-is. Each targets a different high-value workflow.

Summarize Target Function Behavior
Explain a function in repository
You are Sourcegraph Cody, a repo-aware code assistant. Role: locate the function named <FUNCTION_NAME> in the current repository and produce a concise, source-grounded summary. Constraints: 1) Use only information from the repository files and comments; do not invent behavior. 2) Keep the summary under 120 words. 3) Reference exact file path(s) and line ranges where the function is defined. Output format: bullet list with: - One-line purpose, - Inputs and types (from code), - Outputs/return types, - Side effects (I/O, DB, env), - Complexity or notable algorithms, - Example call with expected result. Example: file path: src/service/user.go:45-92.
Expected output: A single concise bullet list describing purpose, inputs, outputs, side effects, complexity, example call, and file path/line range.
Pro tip: If multiple definitions exist (overloads or tests), ask Cody to prefer the most exported/public one and note alternatives.
Generate Unit Test Scaffold
Create unit-test scaffolds for function
You are Sourcegraph Cody, a repo-aware testing assistant. Role: locate the function <FUNCTION_NAME> and generate a ready-to-run unit test scaffold using the project's existing test framework. Constraints: 1) Use the repository's preferred testing library (detect from repo files). 2) Include 4 focused test cases (happy path, edge case, error case, boundary). 3) Provide minimal mocks/stubs using existing interfaces in repo. Output format: for each test case give: test name, short purpose, and full code snippet ready to paste into tests/<module>_test.<ext>. Example: show a Go test file using testify if repo uses testify.
Expected output: Four test-case code snippets with names, purposes, and ready-to-paste test file content matching the repo's test framework.
Pro tip: If the function interacts with external services, prefer in-repo mock implementations rather than suggesting new third-party mock libraries.
Find and Suggest Duplication Refactor
Locate duplicated code and propose refactors
You are Sourcegraph Cody, a senior refactorer with repo access. Role: scan the repository for up to <MAX_RESULTS=5> instances of duplicated or near-duplicate code related to the selected module/path <TARGET_PATH>. Constraints: 1) Report duplicates above a similarity threshold of <SIMILARITY=80%>. 2) For each group include file paths, line ranges, and a 1-line diff summary. 3) Recommend one concrete refactor with code sketch (function/extract/template) and migration steps. Output format: numbered list of duplicates with: {group id, similarity %, files and ranges, one-line diff, refactor proposal with 1–3 code snippets and a one-paragraph migration plan}.
Expected output: A numbered list (up to 5) of duplicate groups with file/line references, similarity scores, concise diffs, and concrete refactor proposals including code sketches and migration steps.
Pro tip: Set MAX_RESULTS to a small number for a quick review, then rerun with a higher limit once initial refactors are accepted.
Add Fast CI Test Job
Add targeted CI job to speed tests
You are Sourcegraph Cody, a CI-aware engineer with repository context. Role: propose and produce a new CI job that runs only fast unit tests for changed packages. Constraints: 1) Target the repository's CI system (detect .github/workflows, .gitlab-ci.yml, etc.). 2) Limit runtime to under <MAX_MINUTES=10> using caching and parallelism. 3) Provide a small YAML snippet to insert and specify paths, cache keys, and matrix if applicable. Output format: brief rationale (2–3 sentences), YAML job snippet ready to paste, and a 3-step rollout plan to enable and monitor the job.
Expected output: A short rationale, a ready-to-paste CI YAML job snippet, and a 3-step rollout plan for enabling and monitoring the fast-test job.
Pro tip: Name the job clearly (e.g., fast-unit-tests) and scope it by changed files using git diff to avoid running it on unrelated PRs.
Triage Vulnerability Across Monorepo
Triage CVE and generate patch PR template
You are Sourcegraph Cody acting as a Senior Security Engineer. Role: triage a reported vulnerability for package <VULN_PACKAGE>@<VULN_VERSION> across this monorepo. Multi-step instructions: 1) List all occurrences (file paths, import/usage locations, version ranges) and identify the most exposed services. 2) For each occurrence provide a one-line exploitability score (Low/Med/High) and justification. 3) Propose code changes or dependency updates with exact file edits or patch snippets, required tests, and rollback plan. 4) Produce a prioritized PR template including title, description, changelog entry, test plan, and risk note. Output format: CSV-style prioritized list plus one full PR template text. Example row: services/api/main.go, import: [email protected], High.
Expected output: A prioritized CSV-style list of affected locations with exploitability scores and one full PR template (title, description, tests, rollback) for fixes.
Pro tip: Ask Cody to include the exact package manager commands (e.g., go get/module edit, npm audit fix) and any lockfile changes so CI can reproduce the upgrade locally.
Plan Cross-Service API Migration
Plan major client library upgrade across services
You are Sourcegraph Cody acting as a Lead Backend Engineer and release coordinator. Role: produce a step-by-step migration plan for upgrading shared client library <LIB_NAME> from vX to vY across all services in the repo. Multi-step requirements: 1) Discover all consumers and list exact call sites with file paths. 2) For each breaking change, provide one-line code transform examples and a suggested automated codemod (with pseudocode or regex). 3) Define test matrix, rollout strategy (canary %, order), monitoring checks, and rollback steps. 4) Provide example commit messages and 3 example PR titles/descriptions. Output format: ordered checklist with sections: discovery, code changes (with snippets), codemod outline, test matrix, rollout, monitoring, rollback, example commits/PRs.
Expected output: An ordered checklist style migration plan with discovery results, concrete code-change snippets, codemod outline, test matrix, rollout and rollback steps, and example commit/PR messages.
Pro tip: Include a one-line grep/codeload command to reproduce the consumer discovery locally and a small codemod test case so reviewers can validate automated changes quickly.

Sourcegraph Cody vs Alternatives

Bottom line

Choose Sourcegraph Cody over GitHub Copilot if you need repository-grounded answers and file-citation traceability for enterprise codebases.

Head-to-head comparisons between Sourcegraph Cody and top alternatives:

Compare
Sourcegraph Cody vs Simplified
Read comparison →
Compare
Sourcegraph Cody vs Replicate
Read comparison →

Frequently Asked Questions

How much does Sourcegraph Cody cost?+
Cody offers a Free tier and paid Team plans starting around $10/user/month; Enterprise is quoted. The Free tier supports evaluation with limited queries, Team unlocks private repo indexing, IDE integrations, and higher query volumes, while Enterprise adds self-hosting, SSO, and dedicated support with pricing via sales.
Is there a free version of Sourcegraph Cody?+
Yes — there is a free tier for evaluation. It allows Cloud access with limited queries and public repo indexing; private repository indexing, higher query volume, and IDE integrations are provided on paid Team or Enterprise plans.
How does Sourcegraph Cody compare to GitHub Copilot?+
Cody is repository-grounded and cites exact files and lines, while Copilot focuses on completions from model training. Cody is better for traceable, cross-repo answers and enterprise self-hosting; Copilot often provides broader inline completions but less explicit file-citation traceability.
What is Sourcegraph Cody best used for?+
Cody is best for code comprehension, cross-repo investigations, and traceable code answers. It excels at answering where functions are used, producing refactor suggestions with file citations, and generating tests or bug reproductions tied to actual repository files.
How do I get started with Sourcegraph Cody?+
Start with the Sourcegraph Cody page and sign in via GitHub/GitLab SSO. Connect the repositories you want indexed, install the Cody IDE extension (VS Code or JetBrains), then ask a repo-specific question and verify answers include file citations.

More Code Assistants Tools

Browse all Code Assistants tools →
💻
GitHub Copilot
Code Assistants AI that speeds coding, testing, and reviews
Updated Mar 26, 2026
💻
Tabnine
Context-aware code completions for teams and individual developers
Updated Apr 21, 2026
💻
Amazon CodeWhisperer
In-IDE code assistants for faster, AWS-aware development
Updated Apr 22, 2026