Skip to main content
Cody is an AI coding assistant that uses the latest LLMs and your development context to help you understand, write, and fix code faster. It uses Sourcegraph’s advanced Search API to pull context from both local and remote codebases so that you can use context about APIs, symbols, and usage patterns from across your entire codebase. Cody connects seamlessly with code hosts like GitHub and GitLab, and integrates with editors including VS Code, JetBrains, and Visual Studio.

Core capabilities

Chat

Ask questions about your code, generate new code, and apply AI-suggested edits directly to your files. Cody uses your repository as context by default.

Auto-edit

Suggests code changes by analyzing cursor movements and recent edits. Can insert and delete text before and after the cursor position.

Autocomplete

Provides real-time single-line and multi-line code completions based on the code context around your cursor.

Prompts

Automate key tasks with premade and customizable prompts. Build any common query into a reusable prompt and share it with your team.

Debug code

Identify and fix errors faster. Cody can suggest fixes inline and explain bugs with full codebase context.

Context filters

Control which repositories Cody can access. Define include and exclude rules to manage context scope.

How context works

Context is what sets Cody apart from a generic LLM. When you ask Cody a question, it searches your codebase to retrieve the most relevant information before generating a response. Cody uses three methods to retrieve context:
  • Keyword search: Finds text matching your query, with automatic query rewriting to surface more relevant terms.
  • Sourcegraph Search: Uses the native Sourcegraph Search API to query your Sourcegraph instance (managed or self-hosted). Returns relevant documents from across your entire codebase.
  • Code graph: Analyzes code structure and how components are interconnected to find contextually related code.
By default, every new chat includes @-mention context chips for the currently open file and repository. You can edit, remove, or add context chips at any time.

Adding context with @-mentions

You can expand or narrow Cody’s context by adding @-mentions in chat:
Mention typeSyntaxDescription
File@filenameInclude the full contents of a file
File range@filepath:1-50Include a specific line range from a file
Symbol@#symbolNameInclude the definition of a function, class, or type
Repository@repoSearch a remote repository for context
Web URL@https://...Include content from a web page

Context scope by client

ClientSingle-repoMulti-repoLocal context
VS Code
JetBrains
Visual Studio
Cody Web
CLI

Supported clients

VS Code

Full-featured extension for Visual Studio Code. Recommended for most users.

JetBrains

Plugin for IntelliJ IDEA, PyCharm, GoLand, WebStorm, and other JetBrains IDEs.

Visual Studio

Extension for Visual Studio (experimental support).

Cody Web

Use Cody directly in the Sourcegraph web application without installing anything.

Cody CLI

Run Cody from the command line. Useful for ad-hoc exploration and scripting workflows.

Enterprise

Self-hosted or managed Sourcegraph Enterprise with Cody enabled for your organization.

Compatible with Sourcegraph products

Cody is integrated with the broader Sourcegraph platform:
  • Code Search: When you run a search query and open a file or repository, a Cody button takes you directly to a chat session with that code as context.
  • Batch Changes: Use Cody to help write and review batch change specs.
  • Code Navigation: Cody uses code graph data to surface more relevant context in its responses.

Data privacy and usage

Cody collects and uses data in the following ways:
  • Prompts and responses: Sourcegraph collects your prompts and responses to provide the service. For users on Sourcegraph.com, Sourcegraph may use your prompts and responses to improve the user experience but does not use any of your data to train models.
  • Usage data and feedback: Sourcegraph collects usage data and feedback to improve the user experience.
Read the Cody Usage and Privacy policy for full details on how your data is handled.

Get started

Quickstart

Install Cody for VS Code and run your first chat in minutes.

Capabilities

Explore the full set of Cody features in depth.

Clients

Installation guides for all supported editors and platforms.

Code Search

Learn how Cody and Code Search work together.

Build docs developers (and LLMs) love