Cody is an AI code assistant that writes code and answers questions for you by reading your entire codebase and the code graph.

Cody uses a combination of Sourcegraph's code graph and Large Language Models (LLMs) to eliminate toil and keep human devs in flow. You can think of Cody as your coding assistant who has read through all the code in open source, all the questions on StackOverflow, and your own entire codebase, and is always there to answer questions you might have or suggest ways of doing something based on prior knowledge.

Get Cody

  • Sourcegraph Enterprise customers: Contact your Sourcegraph technical advisor or request enterprise access to use Cody on your existing Sourcegraph instance.
  • Everyone: Cody for open source code is available to all users with a account. If you don't yet have a account, you can create one for free.

There are currently two ways to experience Cody:

  • In Sourcegraph itself
  • In your editor

Cody is available as a VS Code extension and in the Sourcegraph web interface.


  • ๐Ÿค– Chatbot that knows your code: Writes code and answers questions with knowledge of your entire codebase, following your project's code conventions and architecture better than other AI code chatbots.
  • โœจ Fixup code: Interactively writes and refactors code for you, based on quick natural-language instructions.
  • ๐Ÿ“– Recipes: Generates unit tests, documentation, and more, with full codebase awareness.
  • ๐Ÿงช Experimental Completions: Get suggestions from Cody as you're coding.

๐Ÿค– Chatbot that knows your code

๐Ÿ“ฝ๏ธ Demo

You can chat with Cody in VS Code or in the Sourcegraph sidebar.

Examples of the kinds of questions Cody can handle:

  • How is our app's secret storage implemented on Linux?
  • Where is the CI config for the web integration tests?
  • Write a new GraphQL resolver for the AuditLog.
  • Why is the UserConnectionResolver giving an error unknown user, and how do I fix it?

Cody tells you which code files it read to generate its response. (If Cody gives a wrong answer, please share feedback so we can improve it.)

โœจ Fixup code

๐Ÿ“ฝ๏ธ Demo

In VS Code, just sprinkle your code with instructions in natural language, select the code, and run Cody: Fixup (Ctrl+Alt+//Ctrl+Opt+/). Cody will figure out what edits to make.

Examples of the kinds of fixup instructions Cody can handle:

  • "Factor out any common helper functions" (when multiple functions are selected)
  • "Use the imported CSS module's class names"
  • "Extract the list item to a separate React component"
  • "Handle errors better"
  • "Add helpful debug log statements"
  • "Make this work" (seriously, it often works--try it!)

๐Ÿ“– Recipes

In VS Code, select the recipes tab or right-click on a selection of code and choose one of the Ask Cody > ... recipes, such as:

  • Explain code
  • Generate unit test
  • Generate docstring
  • Improve variable names
  • Translate to different language
  • Summarize recent code changes
  • Detect code smells
  • Generate release notes


See Cody troubleshooting guide.