Usamos cookies para mejorar tu experiencia en el sitio
CodeWorlds
Volver a colecciones
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