We use cookies to enhance your experience on the site
CodeWorlds
Back to collections
Guide24 min read

Cody AI

Cody is an AI code assistant from Sourcegraph with entire codebase context. Uses code graph for intelligent relevant code search. Understands project architecture and file relationships. Ideal for large enterprise projects.

Cody AI - Code Assistant z kontekstem caΕ‚ego codebase

Czym jest Cody?

Cody to AI code assistant stworzony przez Sourcegraph - firmΔ™ znanΔ… z pionierskiego narzΔ™dzia do przeszukiwania kodu w skali enterprise. GΕ‚Γ³wnΔ… supermocΔ… Cody jest zdolnoΕ›Δ‡ do rozumienia CAŁEGO twojego codebase, a nie tylko aktualnie otwartego pliku. Wykorzystuje technologiΔ™ code graph do indeksowania i wyszukiwania relevantnego kontekstu, co pozwala na znacznie bardziej precyzyjne odpowiedzi.

Sourcegraph został założony w 2013 roku i jest używany przez największe firmy technologiczne świata do przeszukiwania i nawigacji po milionach linii kodu. Cody wykorzystuje tę samą infrastrukturę, dodając warstwę AI, która rozumie kontekst i może odpowiadać na pytania, generować kod i pomagać w refaktoringu z pełną świadomością architektury projektu.

Dlaczego Cody?

Kluczowe zalety Cody:

  1. Kontekst caΕ‚ego codebase - Cody indeksuje wszystkie repozytoria i rozumie relacje miΔ™dzy plikami
  2. Code Graph - Zaawansowane indeksowanie kodu (definicje, referencje, zaleΕΌnoΕ›ci)
  3. Multi-repo support - Przeszukiwanie wielu repozytoriΓ³w jednoczeΕ›nie
  4. Smart context retrieval - Automatyczne znajdowanie relevantnego kodu dla kaΕΌdego pytania
  5. Enterprise-ready - Self-hosting, SSO, compliance, audit logs
  6. Unlimited autocomplete - Darmowe tab completion na Free tier
  7. RΓ³ΕΌne modele LLM - WybΓ³r miΔ™dzy Claude, GPT-4, Gemini

Cody vs GitHub Copilot

CechaCodyGitHub Copilot
KontekstCaΕ‚y codebase (code graph)Tylko aktualny plik + podobne
Code Searchβœ… Wbudowany (Sourcegraph)❌ Brak
Multi-repoβœ… Tak⚠️ Ograniczone
Self-hostingβœ… Tak (Enterprise)❌ Nie
Autocompleteβœ… Unlimited (Free)βœ… Unlimited
Chatβœ… 20/day Free, unlimited Proβœ… Unlimited
CenaFree + $9/mo Pro$10-19/mo
Open Sourceβœ… Tak (czΔ™Ε›Δ‡)❌ Nie

Instalacja

VS Code

Code
Bash
# Z marketplace
code --install-extension sourcegraph.cody-ai

# Lub przez VS Code:
# 1. Extensions (Ctrl+Shift+X)
# 2. Szukaj "Cody AI"
# 3. Install

JetBrains (IntelliJ, PyCharm, WebStorm)

Code
Bash
# 1. Settings β†’ Plugins β†’ Marketplace
# 2. Szukaj "Cody"
# 3. Install β†’ Restart IDE

Neovim

Code
LUA
-- W konfiguracji lazy.nvim
{
  "sourcegraph/sg.nvim",
  dependencies = { "nvim-lua/plenary.nvim" },
  config = function()
    require("sg").setup()
  end
}

Po instalacji

  1. OtwΓ³rz Cody sidebar (ikona Cody w pasku bocznym)
  2. Kliknij "Sign In"
  3. Zaloguj siΔ™ przez GitHub, GitLab lub email
  4. Cody automatycznie zacznie indeksować twój projekt

Jak dziaΕ‚a Cody?

Architektura Code Graph

Code
TEXT
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   User Query                     β”‚
β”‚     "How does authentication work here?"         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚
                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Context Retrieval                   β”‚
β”‚  1. Embeddings search (semantic similarity)      β”‚
β”‚  2. Code graph search (definitions, references)  β”‚
β”‚  3. Keyword search (traditional)                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚
                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Relevant Code                       β”‚
β”‚  - src/auth/middleware.ts                        β”‚
β”‚  - src/lib/session.ts                            β”‚
β”‚  - src/api/login.ts                              β”‚
β”‚  - src/types/auth.ts                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚
                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              LLM Response                        β”‚
β”‚  "Based on src/auth/middleware.ts and           β”‚
β”‚   src/lib/session.ts, your app uses JWT         β”‚
β”‚   tokens with refresh mechanism..."              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Typy indeksowania

  1. Embeddings - Wektorowe reprezentacje kodu dla semantic search
  2. Code Intelligence - SCIP (Source Code Intelligence Protocol) dla:
    • Definicji funkcji/klas/zmiennych
    • Referencji i uΕΌyΔ‡
    • Hierarchii typΓ³w
    • Import/export relationships
  3. Graph relationships - Relacje miΔ™dzy plikami i moduΕ‚ami

GΕ‚Γ³wne funkcje

Chat z kontekstem codebase

Code
TEXT
User: How do we handle authentication?

Cody:
[Automatycznie znajduje auth-related files]

Based on your codebase, authentication is handled as follows:

1. **Login Flow** (src/api/auth/login.ts:23)
   - Users submit credentials to /api/auth/login
   - Credentials are validated against the database

2. **Session Management** (src/lib/session.ts:45)
   - JWT tokens are generated with 24h expiry
   - Refresh tokens stored in httpOnly cookies

3. **Middleware** (src/middleware/auth.ts:12)
   - All protected routes go through authMiddleware
   - Token verification using jose library

Here's the key code from your middleware:
[pokazuje relevant code snippet]

@ Mentions

Cody obsΕ‚uguje specjalne @ mentions do precyzyjnego kontekstu:

Code
TEXT
# Plik
@src/api/users.ts explain this file

# Folder
@lib/ what utilities do we have?

# Symbol
@UserService where is this class used?

# Repo (dla multi-repo)
@repo:backend explain the API structure

# CaΕ‚y codebase
@codebase how is error handling done?

# Web (dokumentacja)
@web:https://react.dev/learn how do I use hooks?

Commands

Wbudowane komendy dla typowych zadaΕ„:

Code
TEXT
/edit refactor to use TypeScript
/doc add documentation
/test write unit tests
/explain what does this do
/smell find code smells
/fix fix the errors

PrzykΕ‚ad /edit

Code
TypeScript
// Zaznacz ten kod
function processUser(user) {
  if (user.name) {
    return user.name.toUpperCase()
  }
  return 'Unknown'
}

// Wpisz: /edit convert to TypeScript with proper types

// Cody generuje:
interface User {
  name?: string
  email?: string
}

function processUser(user: User): string {
  if (user.name) {
    return user.name.toUpperCase()
  }
  return 'Unknown'
}

Autocomplete

Inteligentne autocomplete z kontekstem projektu:

Code
TypeScript
// Cody rozumie strukturΔ™ twojego projektu
// i sugeruje relevant code

import {
// Cody sugeruje: useAuth, useUser, useSession
// bazujΔ…c na tym co jest uΕΌywane w projekcie

Konfiguracja autocomplete:

settings.json
JSON
// settings.json (VS Code)
{
  "cody.autocomplete.enabled": true,
  "cody.autocomplete.advanced.provider": "fireworks",
  "cody.autocomplete.advanced.model": "starcoder"
}

Fixups (inline edit)

Code
TypeScript
// Zaznacz problematyczny kod
const data = fetchData()
console.log(data.user.name)

// Cody (Cmd+K): "handle the null case"

// Wynik:
const data = fetchData()
if (data?.user?.name) {
  console.log(data.user.name)
} else {
  console.log('User data not available')
}

Context retrieval

Jak Cody wybiera kontekst?

  1. Embedding search - Semantyczne podobieΕ„stwo do pytania
  2. Keyword search - DokΕ‚adne dopasowania sΕ‚Γ³w kluczowych
  3. Code graph - Definicje i referencje dla symboli
  4. Recent files - Ostatnio edytowane pliki
  5. Open files - Aktualnie otwarte pliki w IDE

Custom context

Code
TEXT
# Dodaj konkretny plik
@src/config/database.ts

# Dodaj folder
@lib/utils/

# Dodaj zewnΔ™trznΔ… dokumentacjΔ™
@web:https://docs.prisma.io/concepts

# PoΕ‚Δ…cz rΓ³ΕΌne ΕΊrΓ³dΕ‚a
@src/api/ @web:https://trpc.io/docs explain how our API uses tRPC

Context window management

Code
JSON
// Ustawienia w VS Code
{
  "cody.chat.contextWindow": 16000,
  "cody.autocomplete.contextWindow": 4000
}

Enterprise Features

Multi-repo code intelligence

Dla organizacji z wieloma repozytoriami:

Code
TEXT
# Szukaj w wielu repozytoriach
@repo:frontend @repo:backend @repo:shared
How do we pass user data between frontend and backend?

# Cody przeszukuje wszystkie trzy repo
# i Ε‚Δ…czy kontekst w spΓ³jnΔ… odpowiedΕΊ

Sourcegraph integration

.sourcegraph/config.json
JSON
// .sourcegraph/config.json
{
  "repos": [
    "github.com/myorg/frontend",
    "github.com/myorg/backend",
    "github.com/myorg/shared-types"
  ],
  "codeIntelligence": {
    "languages": ["typescript", "python", "go"],
    "indexing": "precise"
  }
}

Self-hosting (Enterprise)

docker-compose.yml
YAML
# docker-compose.yml (simplified)
version: '3'
services:
  sourcegraph:
    image: sourcegraph/server:latest
    ports:
      - "7080:7080"
    volumes:
      - sg-data:/var/opt/sourcegraph
    environment:
      - CODY_ENABLED=true
      - LLM_PROVIDER=anthropic
      - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}

Custom Instructions (Enterprise)

Code
JSON
{
  "cody.chat.preInstruction": "Use TypeScript. Follow our coding standards from CONTRIBUTING.md. Always include error handling.",
  "cody.customHeaders": {
    "X-Org-ID": "my-organization"
  }
}

Access Control

Code
JSON
// Dla Enterprise - kontrola dostΔ™pu do repo
{
  "cody.permissions": {
    "allowedRepos": [
      "github.com/myorg/public-*",
      "github.com/myorg/frontend"
    ],
    "deniedRepos": [
      "github.com/myorg/secrets-*"
    ]
  }
}

Konfiguracja

VS Code settings

settings.json
JSON
// settings.json
{
  // WΕ‚Δ…cz/wyΕ‚Δ…cz funkcje
  "cody.autocomplete.enabled": true,
  "cody.chat.enabled": true,
  "cody.commandHints.enabled": true,

  // Model settings
  "cody.chat.model": "claude-3-5-sonnet",

  // Autocomplete settings
  "cody.autocomplete.advanced.provider": "fireworks",
  "cody.autocomplete.advanced.model": "starcoder-7b",

  // Context settings
  "cody.contextSelection": {
    "embeddings": true,
    "keyword": true,
    "codeGraph": true
  },

  // Experimental features
  "cody.experimental.foldingRanges": true,
  "cody.experimental.localEmbeddings": true
}

JetBrains settings

Code
TEXT
Settings β†’ Tools β†’ Cody

- Enable Cody: βœ“
- Chat Model: Claude 3.5 Sonnet
- Autocomplete: Enabled
- Custom Instructions: [your instructions]

Ignorowanie plikΓ³w

Code
GITIGNORE
# .cody/ignore
node_modules/
dist/
build/
*.min.js
*.map
coverage/
.env*
secrets/

Modele LLM

DostΔ™pne modele

ModelUΕΌycieDostΔ™pnoΕ›Δ‡
Claude 3.5 SonnetChat (domyΕ›lny)Free + Pro
Claude 3 OpusChat (zaawansowany)Pro
GPT-4 TurboChatPro
Gemini 1.5 ProChatPro
StarCoderAutocompleteFree + Pro
Claude InstantFast chatFree + Pro

WybΓ³r modelu w chacie

Code
TEXT
# UΕΌyj konkretnego modelu
/model claude-3-opus
How should I architect this microservice?

# Lub przez UI
# Kliknij dropdown przy input box i wybierz model

Custom models (Enterprise)

Code
JSON
{
  "cody.enterprise.models": [
    {
      "name": "internal-codegen",
      "endpoint": "https://internal-api.company.com/v1/completions",
      "type": "completion"
    },
    {
      "name": "claude-via-bedrock",
      "endpoint": "https://bedrock.us-east-1.amazonaws.com",
      "type": "chat"
    }
  ]
}

Przypadki uΕΌycia

Understanding legacy code

Code
TEXT
@src/legacy/old-api/
This code was written 5 years ago. Explain:
1. What it does
2. Why it might have been written this way
3. How I should refactor it for modern standards

Onboarding nowych deweloperΓ³w

Code
TEXT
@codebase
I'm new to this project. Give me an overview of:
1. The overall architecture
2. Key technologies used
3. How to run it locally
4. Where to start for making changes to [feature]

Cross-repo refactoring

Code
TEXT
@repo:api @repo:frontend @repo:mobile
We're changing the user authentication flow.
Show me all the places that need to be updated.

Code review assistance

Code
TEXT
@diff
Review this pull request for:
- Potential bugs
- Performance issues
- Security concerns
- Adherence to our coding standards from @CONTRIBUTING.md

Documentation generation

Code
TEXT
@src/api/users/
Generate API documentation for all endpoints in this folder.
Include:
- Request/response schemas
- Authentication requirements
- Example curl commands

Keyboard shortcuts

VS Code

SkrΓ³tAkcja
Alt+KOtwΓ³rz Cody chat
Alt+CNowy chat
Alt+/Autocomplete trigger
Opt+\Edit inline
Cmd+Shift+CWyjaΕ›nij zaznaczony kod
Cmd+Shift+VWygeneruj testy

JetBrains

SkrΓ³tAkcja
Alt+COtwΓ³rz Cody
Alt+KEdit inline
Ctrl+Shift+EExplain code
Ctrl+Shift+TGenerate tests

Integracje

Git integration

Code
TEXT
# Cody automatycznie rozumie historiΔ™ git
@git show me what changed in the last week
@git who worked on authentication recently?
@git explain this commit

CI/CD integration

.github/workflows/cody-review.yml
YAML
# .github/workflows/cody-review.yml
name: Cody PR Review
on: [pull_request]

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: sourcegraph/cody-action@v1
        with:
          token: ${{ secrets.SOURCEGRAPH_TOKEN }}
          action: review

Slack integration (Enterprise)

Code
TEXT
# W Slacku
/cody search how do we handle payments?

# Cody przeszukuje codebase i odpowiada w wΔ…tku

PorΓ³wnanie z konkurencjΔ…

Cody vs Continue

CechaCodyContinue
KontekstCode graph + embeddingsEmbeddings
Multi-repoβœ… Natywne⚠️ RΔ™czna konfiguracja
Enterpriseβœ… Self-host + SSO⚠️ Self-host tylko
CenaFree + $9/moFree (BYOK)
Open SourceCzΔ™Ε›ciowoTak

Cody vs Cursor

CechaCodyCursor
IDEVS Code + JetBrainsWΕ‚asne IDE (fork VS Code)
KontekstCode graphEmbeddings
Multi-repoβœ… Tak❌ Nie
CenaFree + $9/mo$20/mo

Cody vs Amazon CodeWhisperer

CechaCodyCodeWhisperer
KontekstCaΕ‚y codebaseAktualny plik
Chatβœ… Tak⚠️ Ograniczony
Security scans⚠️ Przez Sourcegraphβœ… Natywne
AWS integration⚠️ ZewnΔ™trzneβœ… Natywne
CenaFree + $9/moFree + $19/mo

RozwiΔ…zywanie problemΓ³w

Cody nie indeksuje projektu

Code
Bash
# SprawdΕΊ status indeksowania
# VS Code: View β†’ Output β†’ Cody

# WymuΕ› reindeksowanie
# Command Palette β†’ "Cody: Refresh Local Embeddings"

SΕ‚aba jakoΕ›Δ‡ kontekstu

  1. Upewnij siΔ™, ΕΌe .cody/ignore nie blokuje waΕΌnych plikΓ³w
  2. SprawdΕΊ czy embeddings sΔ… wΕ‚Δ…czone
  3. UΕΌyj explicit @ mentions dla waΕΌnego kontekstu

Wolne autocomplete

Code
JSON
{
  "cody.autocomplete.advanced.provider": "fireworks",
  "cody.autocomplete.advanced.timeout": 2000
}

Problemy z autoryzacjΔ…

Code
Bash
# Wyloguj i zaloguj ponownie
# Command Palette β†’ "Cody: Sign Out"
# NastΔ™pnie β†’ "Cody: Sign In"

Cennik

Plany Cody

PlanCenaAutocompleteChatFunkcje
Free$0Unlimited20/dzieΕ„Podstawowe
Pro$9/moUnlimitedUnlimited+ Modele premium
EnterpriseCustomUnlimitedUnlimited+ Self-host, SSO, Audit

Kluczowe rΓ³ΕΌnice

Free:

  • Unlimited autocomplete (gΕ‚Γ³wna wartoΕ›Δ‡!)
  • 20 chat messages/dzieΕ„
  • Claude 3.5 Sonnet (podstawowy)
  • Lokalny codebase context

Pro ($9/mo):

  • Unlimited chat
  • Wszystkie modele (Opus, GPT-4, Gemini)
  • Priority support
  • Advanced context options

Enterprise (custom):

  • Self-hosting opcja
  • Multi-repo na wΕ‚asnej infrastrukturze
  • SSO/SAML
  • Audit logs
  • Custom model deployment
  • Dedicated support

Best practices

Maksymalizacja jakoΕ›ci odpowiedzi

  1. UΕΌywaj @ mentions - Podawaj konkretny kontekst
  2. BΔ…dΕΊ konkretny - Opisuj dokΕ‚adnie co chcesz osiΔ…gnΔ…Δ‡
  3. Iteruj - Doprecyzowuj pytania w rozmowie
  4. Weryfikuj - Sprawdzaj wygenerowany kod

Efektywne przeszukiwanie codebase

Code
TEXT
# Zamiast ogΓ³lnego pytania:
"How does the app work?"

# Zadaj konkretne:
"@src/api @src/services How does the payment processing flow work from API endpoint to database?"

Konfiguracja dla zespoΕ‚u

.vscode/settings.json
JSON
// .vscode/settings.json (wspΓ³Ε‚dzielone)
{
  "cody.chat.preInstruction": "Follow our TypeScript coding standards. Use functional components with hooks. Include error handling."
}

FAQ - NajczΔ™Ε›ciej zadawane pytania

Czy Cody jest lepszy od Copilot?

Cody wyróżnia się kontekstem codebase i multi-repo search. Copilot może być lepszy dla prostych uzupełnień kodu. Dla dużych projektów i enterprise - Cody zazwyczaj daje lepsze rezultaty.

Czy Cody wysyΕ‚a mΓ³j kod na serwery?

  • Free/Pro: Tak, kod jest wysyΕ‚any do Sourcegraph dla embeddings i do providerΓ³w LLM dla odpowiedzi
  • Enterprise: MoΕΌesz self-hostowaΔ‡ caΕ‚oΕ›Δ‡ - kod nie opuszcza twojej infrastruktury

Jak Cody radzi sobie z duΕΌymi codebase?

Bardzo dobrze - to gΕ‚Γ³wna siΕ‚a Cody. Sourcegraph skaluje siΔ™ do milionΓ³w linii kodu. Code graph efektywnie indeksuje nawet ogromne repozytoria.

Czy mogę używać własnych modeli?

Na Enterprise - tak. Możesz podłączyć własne modele przez API lub użyć providerów jak AWS Bedrock.

Jak Cody porΓ³wnuje siΔ™ z Claude Code?

  • Cody: IDE extension, kontekst przez Sourcegraph, multi-repo
  • Claude Code: CLI tool, kontekst przez pliki, single repo focus
  • MoΕΌna uΕΌywaΔ‡ obu - Claude Code w terminalu, Cody w IDE

Cody AI - Code Assistant with full codebase context

What is Cody?

Cody is an AI code assistant created by Sourcegraph - a company known for its pioneering code search tool at enterprise scale. Cody's main superpower is the ability to understand your ENTIRE codebase, not just the currently open file. It uses code graph technology to index and search for relevant context, enabling much more precise answers.

Sourcegraph was founded in 2013 and is used by the largest technology companies in the world for searching and navigating millions of lines of code. Cody leverages the same infrastructure, adding an AI layer that understands context and can answer questions, generate code, and assist with refactoring with full awareness of the project architecture.

Why Cody?

Key advantages of Cody:

  1. Entire codebase context - Cody indexes all repositories and understands relationships between files
  2. Code Graph - Advanced code indexing (definitions, references, dependencies)
  3. Multi-repo support - Search across multiple repositories simultaneously
  4. Smart context retrieval - Automatically finds relevant code for each query
  5. Enterprise-ready - Self-hosting, SSO, compliance, audit logs
  6. Unlimited autocomplete - Free tab completion on the Free tier
  7. Multiple LLM models - Choose between Claude, GPT-4, Gemini

Cody vs GitHub Copilot

FeatureCodyGitHub Copilot
ContextEntire codebase (code graph)Only current file + similar
Code Searchβœ… Built-in (Sourcegraph)❌ None
Multi-repoβœ… Yes⚠️ Limited
Self-hostingβœ… Yes (Enterprise)❌ No
Autocompleteβœ… Unlimited (Free)βœ… Unlimited
Chatβœ… 20/day Free, unlimited Proβœ… Unlimited
PriceFree + $9/mo Pro$10-19/mo
Open Sourceβœ… Yes (partial)❌ No

Installation

VS Code

Code
Bash
# From marketplace
code --install-extension sourcegraph.cody-ai

# Or through VS Code:
# 1. Extensions (Ctrl+Shift+X)
# 2. Search "Cody AI"
# 3. Install

JetBrains (IntelliJ, PyCharm, WebStorm)

Code
Bash
# 1. Settings β†’ Plugins β†’ Marketplace
# 2. Search "Cody"
# 3. Install β†’ Restart IDE

Neovim

Code
LUA
-- In lazy.nvim configuration
{
  "sourcegraph/sg.nvim",
  dependencies = { "nvim-lua/plenary.nvim" },
  config = function()
    require("sg").setup()
  end
}

After installation

  1. Open the Cody sidebar (Cody icon in the side panel)
  2. Click "Sign In"
  3. Log in via GitHub, GitLab, or email
  4. Cody will automatically start indexing your project

How does Cody work?

Code Graph architecture

Code
TEXT
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   User Query                     β”‚
β”‚     "How does authentication work here?"         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚
                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Context Retrieval                   β”‚
β”‚  1. Embeddings search (semantic similarity)      β”‚
β”‚  2. Code graph search (definitions, references)  β”‚
β”‚  3. Keyword search (traditional)                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚
                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Relevant Code                       β”‚
β”‚  - src/auth/middleware.ts                        β”‚
β”‚  - src/lib/session.ts                            β”‚
β”‚  - src/api/login.ts                              β”‚
β”‚  - src/types/auth.ts                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚
                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              LLM Response                        β”‚
β”‚  "Based on src/auth/middleware.ts and           β”‚
β”‚   src/lib/session.ts, your app uses JWT         β”‚
β”‚   tokens with refresh mechanism..."              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Indexing types

  1. Embeddings - Vector representations of code for semantic search
  2. Code Intelligence - SCIP (Source Code Intelligence Protocol) for:
    • Function/class/variable definitions
    • References and usages
    • Type hierarchies
    • Import/export relationships
  3. Graph relationships - Relationships between files and modules

Main features

Chat with codebase context

Code
TEXT
User: How do we handle authentication?

Cody:
[Automatically finds auth-related files]

Based on your codebase, authentication is handled as follows:

1. **Login Flow** (src/api/auth/login.ts:23)
   - Users submit credentials to /api/auth/login
   - Credentials are validated against the database

2. **Session Management** (src/lib/session.ts:45)
   - JWT tokens are generated with 24h expiry
   - Refresh tokens stored in httpOnly cookies

3. **Middleware** (src/middleware/auth.ts:12)
   - All protected routes go through authMiddleware
   - Token verification using jose library

Here's the key code from your middleware:
[shows relevant code snippet]

@ Mentions

Cody supports special @ mentions for precise context:

Code
TEXT
# File
@src/api/users.ts explain this file

# Folder
@lib/ what utilities do we have?

# Symbol
@UserService where is this class used?

# Repo (for multi-repo)
@repo:backend explain the API structure

# Entire codebase
@codebase how is error handling done?

# Web (documentation)
@web:https://react.dev/learn how do I use hooks?

Commands

Built-in commands for common tasks:

Code
TEXT
/edit refactor to use TypeScript
/doc add documentation
/test write unit tests
/explain what does this do
/smell find code smells
/fix fix the errors

/edit example

Code
TypeScript
// Select this code
function processUser(user) {
  if (user.name) {
    return user.name.toUpperCase()
  }
  return 'Unknown'
}

// Type: /edit convert to TypeScript with proper types

// Cody generates:
interface User {
  name?: string
  email?: string
}

function processUser(user: User): string {
  if (user.name) {
    return user.name.toUpperCase()
  }
  return 'Unknown'
}

Autocomplete

Intelligent autocomplete with project context:

Code
TypeScript
// Cody understands the structure of your project
// and suggests relevant code

import {
// Cody suggests: useAuth, useUser, useSession
// based on what is used in the project

Autocomplete configuration:

settings.json
JSON
// settings.json (VS Code)
{
  "cody.autocomplete.enabled": true,
  "cody.autocomplete.advanced.provider": "fireworks",
  "cody.autocomplete.advanced.model": "starcoder"
}

Fixups (inline edit)

Code
TypeScript
// Select the problematic code
const data = fetchData()
console.log(data.user.name)

// Cody (Cmd+K): "handle the null case"

// Result:
const data = fetchData()
if (data?.user?.name) {
  console.log(data.user.name)
} else {
  console.log('User data not available')
}

Context retrieval

How does Cody select context?

  1. Embedding search - Semantic similarity to the question
  2. Keyword search - Exact keyword matches
  3. Code graph - Definitions and references for symbols
  4. Recent files - Recently edited files
  5. Open files - Currently open files in the IDE

Custom context

Code
TEXT
# Add a specific file
@src/config/database.ts

# Add a folder
@lib/utils/

# Add external documentation
@web:https://docs.prisma.io/concepts

# Combine different sources
@src/api/ @web:https://trpc.io/docs explain how our API uses tRPC

Context window management

Code
JSON
// Settings in VS Code
{
  "cody.chat.contextWindow": 16000,
  "cody.autocomplete.contextWindow": 4000
}

Enterprise features

Multi-repo code intelligence

For organizations with multiple repositories:

Code
TEXT
# Search across multiple repositories
@repo:frontend @repo:backend @repo:shared
How do we pass user data between frontend and backend?

# Cody searches all three repos
# and combines context into a coherent answer

Sourcegraph integration

.sourcegraph/config.json
JSON
// .sourcegraph/config.json
{
  "repos": [
    "github.com/myorg/frontend",
    "github.com/myorg/backend",
    "github.com/myorg/shared-types"
  ],
  "codeIntelligence": {
    "languages": ["typescript", "python", "go"],
    "indexing": "precise"
  }
}

Self-hosting (Enterprise)

docker-compose.yml
YAML
# docker-compose.yml (simplified)
version: '3'
services:
  sourcegraph:
    image: sourcegraph/server:latest
    ports:
      - "7080:7080"
    volumes:
      - sg-data:/var/opt/sourcegraph
    environment:
      - CODY_ENABLED=true
      - LLM_PROVIDER=anthropic
      - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}

Custom Instructions (Enterprise)

Code
JSON
{
  "cody.chat.preInstruction": "Use TypeScript. Follow our coding standards from CONTRIBUTING.md. Always include error handling.",
  "cody.customHeaders": {
    "X-Org-ID": "my-organization"
  }
}

Access Control

Code
JSON
// For Enterprise - repository access control
{
  "cody.permissions": {
    "allowedRepos": [
      "github.com/myorg/public-*",
      "github.com/myorg/frontend"
    ],
    "deniedRepos": [
      "github.com/myorg/secrets-*"
    ]
  }
}

Configuration

VS Code settings

settings.json
JSON
// settings.json
{
  // Enable/disable features
  "cody.autocomplete.enabled": true,
  "cody.chat.enabled": true,
  "cody.commandHints.enabled": true,

  // Model settings
  "cody.chat.model": "claude-3-5-sonnet",

  // Autocomplete settings
  "cody.autocomplete.advanced.provider": "fireworks",
  "cody.autocomplete.advanced.model": "starcoder-7b",

  // Context settings
  "cody.contextSelection": {
    "embeddings": true,
    "keyword": true,
    "codeGraph": true
  },

  // Experimental features
  "cody.experimental.foldingRanges": true,
  "cody.experimental.localEmbeddings": true
}

JetBrains settings

Code
TEXT
Settings β†’ Tools β†’ Cody

- Enable Cody: βœ“
- Chat Model: Claude 3.5 Sonnet
- Autocomplete: Enabled
- Custom Instructions: [your instructions]

Ignoring files

Code
GITIGNORE
# .cody/ignore
node_modules/
dist/
build/
*.min.js
*.map
coverage/
.env*
secrets/

LLM Models

Available models

ModelUsageAvailability
Claude 3.5 SonnetChat (default)Free + Pro
Claude 3 OpusChat (advanced)Pro
GPT-4 TurboChatPro
Gemini 1.5 ProChatPro
StarCoderAutocompleteFree + Pro
Claude InstantFast chatFree + Pro

Choosing a model in chat

Code
TEXT
# Use a specific model
/model claude-3-opus
How should I architect this microservice?

# Or through the UI
# Click the dropdown next to the input box and select a model

Custom models (Enterprise)

Code
JSON
{
  "cody.enterprise.models": [
    {
      "name": "internal-codegen",
      "endpoint": "https://internal-api.company.com/v1/completions",
      "type": "completion"
    },
    {
      "name": "claude-via-bedrock",
      "endpoint": "https://bedrock.us-east-1.amazonaws.com",
      "type": "chat"
    }
  ]
}

Use cases

Understanding legacy code

Code
TEXT
@src/legacy/old-api/
This code was written 5 years ago. Explain:
1. What it does
2. Why it might have been written this way
3. How I should refactor it for modern standards

Onboarding new developers

Code
TEXT
@codebase
I'm new to this project. Give me an overview of:
1. The overall architecture
2. Key technologies used
3. How to run it locally
4. Where to start for making changes to [feature]

Cross-repo refactoring

Code
TEXT
@repo:api @repo:frontend @repo:mobile
We're changing the user authentication flow.
Show me all the places that need to be updated.

Code review assistance

Code
TEXT
@diff
Review this pull request for:
- Potential bugs
- Performance issues
- Security concerns
- Adherence to our coding standards from @CONTRIBUTING.md

Documentation generation

Code
TEXT
@src/api/users/
Generate API documentation for all endpoints in this folder.
Include:
- Request/response schemas
- Authentication requirements
- Example curl commands

Keyboard shortcuts

VS Code

ShortcutAction
Alt+KOpen Cody chat
Alt+CNew chat
Alt+/Autocomplete trigger
Opt+\Edit inline
Cmd+Shift+CExplain selected code
Cmd+Shift+VGenerate tests

JetBrains

ShortcutAction
Alt+COpen Cody
Alt+KEdit inline
Ctrl+Shift+EExplain code
Ctrl+Shift+TGenerate tests

Integrations

Git integration

Code
TEXT
# Cody automatically understands git history
@git show me what changed in the last week
@git who worked on authentication recently?
@git explain this commit

CI/CD integration

.github/workflows/cody-review.yml
YAML
# .github/workflows/cody-review.yml
name: Cody PR Review
on: [pull_request]

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: sourcegraph/cody-action@v1
        with:
          token: ${{ secrets.SOURCEGRAPH_TOKEN }}
          action: review

Slack integration (Enterprise)

Code
TEXT
# In Slack
/cody search how do we handle payments?

# Cody searches the codebase and responds in the thread

Comparison with competitors

Cody vs Continue

FeatureCodyContinue
ContextCode graph + embeddingsEmbeddings
Multi-repoβœ… Native⚠️ Manual configuration
Enterpriseβœ… Self-host + SSO⚠️ Self-host only
PriceFree + $9/moFree (BYOK)
Open SourcePartialYes

Cody vs Cursor

FeatureCodyCursor
IDEVS Code + JetBrainsOwn IDE (VS Code fork)
ContextCode graphEmbeddings
Multi-repoβœ… Yes❌ No
PriceFree + $9/mo$20/mo

Cody vs Amazon CodeWhisperer

FeatureCodyCodeWhisperer
ContextEntire codebaseCurrent file only
Chatβœ… Yes⚠️ Limited
Security scans⚠️ Via Sourcegraphβœ… Native
AWS integration⚠️ Externalβœ… Native
PriceFree + $9/moFree + $19/mo

Troubleshooting

Cody is not indexing the project

Code
Bash
# Check indexing status
# VS Code: View β†’ Output β†’ Cody

# Force reindexing
# Command Palette β†’ "Cody: Refresh Local Embeddings"

Poor context quality

  1. Make sure .cody/ignore is not blocking important files
  2. Check that embeddings are enabled
  3. Use explicit @ mentions for important context

Slow autocomplete

Code
JSON
{
  "cody.autocomplete.advanced.provider": "fireworks",
  "cody.autocomplete.advanced.timeout": 2000
}

Authorization issues

Code
Bash
# Log out and log in again
# Command Palette β†’ "Cody: Sign Out"
# Then β†’ "Cody: Sign In"

Pricing

Cody plans

PlanPriceAutocompleteChatFeatures
Free$0Unlimited20/dayBasic
Pro$9/moUnlimitedUnlimited+ Premium models
EnterpriseCustomUnlimitedUnlimited+ Self-host, SSO, Audit

Key differences

Free:

  • Unlimited autocomplete (the main value!)
  • 20 chat messages/day
  • Claude 3.5 Sonnet (basic)
  • Local codebase context

Pro ($9/mo):

  • Unlimited chat
  • All models (Opus, GPT-4, Gemini)
  • Priority support
  • Advanced context options

Enterprise (custom):

  • Self-hosting option
  • Multi-repo on your own infrastructure
  • SSO/SAML
  • Audit logs
  • Custom model deployment
  • Dedicated support

Best practices

Maximizing answer quality

  1. Use @ mentions - Provide specific context
  2. Be specific - Describe exactly what you want to achieve
  3. Iterate - Refine your questions in the conversation
  4. Verify - Review generated code

Efficient codebase searching

Code
TEXT
# Instead of a general question:
"How does the app work?"

# Ask something specific:
"@src/api @src/services How does the payment processing flow work from API endpoint to database?"

Team configuration

.vscode/settings.json
JSON
// .vscode/settings.json (shared)
{
  "cody.chat.preInstruction": "Follow our TypeScript coding standards. Use functional components with hooks. Include error handling."
}

FAQ - Frequently asked questions

Is Cody better than Copilot?

Cody stands out with its codebase context and multi-repo search. Copilot may be better for simple code completions. For large projects and enterprise use - Cody typically delivers better results.

Does Cody send my code to servers?

  • Free/Pro: Yes, code is sent to Sourcegraph for embeddings and to LLM providers for responses
  • Enterprise: You can self-host everything - code never leaves your infrastructure

How does Cody handle large codebases?

Very well - this is Cody's main strength. Sourcegraph scales to millions of lines of code. The code graph efficiently indexes even enormous repositories.

Can I use my own models?

On Enterprise - yes. You can connect your own models via API or use providers like AWS Bedrock.

How does Cody compare to Claude Code?

  • Cody: IDE extension, context via Sourcegraph, multi-repo
  • Claude Code: CLI tool, context via files, single repo focus
  • You can use both - Claude Code in the terminal, Cody in the IDE