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:
- Kontekst całego codebase - Cody indeksuje wszystkie repozytoria i rozumie relacje między plikami
- Code Graph - Zaawansowane indeksowanie kodu (definicje, referencje, zależności)
- Multi-repo support - Przeszukiwanie wielu repozytoriów jednocześnie
- Smart context retrieval - Automatyczne znajdowanie relevantnego kodu dla każdego pytania
- Enterprise-ready - Self-hosting, SSO, compliance, audit logs
- Unlimited autocomplete - Darmowe tab completion na Free tier
- Różne modele LLM - Wybór między Claude, GPT-4, Gemini
Cody vs GitHub Copilot
| Cecha | Cody | GitHub Copilot |
|---|---|---|
| Kontekst | Cał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 |
| Cena | Free + $9/mo Pro | $10-19/mo |
| Open Source | ✅ Tak (część) | ❌ Nie |
Instalacja
VS Code
# Z marketplace
code --install-extension sourcegraph.cody-ai
# Lub przez VS Code:
# 1. Extensions (Ctrl+Shift+X)
# 2. Szukaj "Cody AI"
# 3. InstallJetBrains (IntelliJ, PyCharm, WebStorm)
# 1. Settings → Plugins → Marketplace
# 2. Szukaj "Cody"
# 3. Install → Restart IDENeovim
-- W konfiguracji lazy.nvim
{
"sourcegraph/sg.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("sg").setup()
end
}Po instalacji
- Otwórz Cody sidebar (ikona Cody w pasku bocznym)
- Kliknij "Sign In"
- Zaloguj się przez GitHub, GitLab lub email
- Cody automatycznie zacznie indeksować twój projekt
Jak działa Cody?
Architektura Code Graph
┌─────────────────────────────────────────────────┐
│ 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
- Embeddings - Wektorowe reprezentacje kodu dla semantic search
- Code Intelligence - SCIP (Source Code Intelligence Protocol) dla:
- Definicji funkcji/klas/zmiennych
- Referencji i użyć
- Hierarchii typów
- Import/export relationships
- Graph relationships - Relacje między plikami i modułami
Główne funkcje
Chat z kontekstem codebase
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:
# 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ń:
/edit refactor to use TypeScript
/doc add documentation
/test write unit tests
/explain what does this do
/smell find code smells
/fix fix the errorsPrzykład /edit
// 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:
// Cody rozumie strukturę twojego projektu
// i sugeruje relevant code
import {
// Cody sugeruje: useAuth, useUser, useSession
// bazując na tym co jest używane w projekcieKonfiguracja autocomplete:
// settings.json (VS Code)
{
"cody.autocomplete.enabled": true,
"cody.autocomplete.advanced.provider": "fireworks",
"cody.autocomplete.advanced.model": "starcoder"
}Fixups (inline edit)
// 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?
- Embedding search - Semantyczne podobieństwo do pytania
- Keyword search - Dokładne dopasowania słów kluczowych
- Code graph - Definicje i referencje dla symboli
- Recent files - Ostatnio edytowane pliki
- Open files - Aktualnie otwarte pliki w IDE
Custom context
# 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 tRPCContext window management
// Ustawienia w VS Code
{
"cody.chat.contextWindow": 16000,
"cody.autocomplete.contextWindow": 4000
}Enterprise Features
Multi-repo code intelligence
Dla organizacji z wieloma repozytoriami:
# 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
{
"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 (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)
{
"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
// 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
{
// 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
Settings → Tools → Cody
- Enable Cody: ✓
- Chat Model: Claude 3.5 Sonnet
- Autocomplete: Enabled
- Custom Instructions: [your instructions]Ignorowanie plików
# .cody/ignore
node_modules/
dist/
build/
*.min.js
*.map
coverage/
.env*
secrets/Modele LLM
Dostępne modele
| Model | Użycie | Dostępność |
|---|---|---|
| Claude 3.5 Sonnet | Chat (domyślny) | Free + Pro |
| Claude 3 Opus | Chat (zaawansowany) | Pro |
| GPT-4 Turbo | Chat | Pro |
| Gemini 1.5 Pro | Chat | Pro |
| StarCoder | Autocomplete | Free + Pro |
| Claude Instant | Fast chat | Free + Pro |
Wybór modelu w chacie
# Użyj konkretnego modelu
/model claude-3-opus
How should I architect this microservice?
# Lub przez UI
# Kliknij dropdown przy input box i wybierz modelCustom models (Enterprise)
{
"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
@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 standardsOnboarding nowych deweloperów
@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
@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
@diff
Review this pull request for:
- Potential bugs
- Performance issues
- Security concerns
- Adherence to our coding standards from @CONTRIBUTING.mdDocumentation generation
@src/api/users/
Generate API documentation for all endpoints in this folder.
Include:
- Request/response schemas
- Authentication requirements
- Example curl commandsKeyboard shortcuts
VS Code
| Skrót | Akcja |
|---|---|
Alt+K | Otwórz Cody chat |
Alt+C | Nowy chat |
Alt+/ | Autocomplete trigger |
Opt+\ | Edit inline |
Cmd+Shift+C | Wyjaśnij zaznaczony kod |
Cmd+Shift+V | Wygeneruj testy |
JetBrains
| Skrót | Akcja |
|---|---|
Alt+C | Otwórz Cody |
Alt+K | Edit inline |
Ctrl+Shift+E | Explain code |
Ctrl+Shift+T | Generate tests |
Integracje
Git integration
# Cody automatycznie rozumie historię git
@git show me what changed in the last week
@git who worked on authentication recently?
@git explain this commitCI/CD integration
# .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: reviewSlack integration (Enterprise)
# W Slacku
/cody search how do we handle payments?
# Cody przeszukuje codebase i odpowiada w wątkuPorównanie z konkurencją
Cody vs Continue
| Cecha | Cody | Continue |
|---|---|---|
| Kontekst | Code graph + embeddings | Embeddings |
| Multi-repo | ✅ Natywne | ⚠️ Ręczna konfiguracja |
| Enterprise | ✅ Self-host + SSO | ⚠️ Self-host tylko |
| Cena | Free + $9/mo | Free (BYOK) |
| Open Source | Częściowo | Tak |
Cody vs Cursor
| Cecha | Cody | Cursor |
|---|---|---|
| IDE | VS Code + JetBrains | Własne IDE (fork VS Code) |
| Kontekst | Code graph | Embeddings |
| Multi-repo | ✅ Tak | ❌ Nie |
| Cena | Free + $9/mo | $20/mo |
Cody vs Amazon CodeWhisperer
| Cecha | Cody | CodeWhisperer |
|---|---|---|
| Kontekst | Cały codebase | Aktualny plik |
| Chat | ✅ Tak | ⚠️ Ograniczony |
| Security scans | ⚠️ Przez Sourcegraph | ✅ Natywne |
| AWS integration | ⚠️ Zewnętrzne | ✅ Natywne |
| Cena | Free + $9/mo | Free + $19/mo |
Rozwiązywanie problemów
Cody nie indeksuje projektu
# Sprawdź status indeksowania
# VS Code: View → Output → Cody
# Wymuś reindeksowanie
# Command Palette → "Cody: Refresh Local Embeddings"Słaba jakość kontekstu
- Upewnij się, że
.cody/ignorenie blokuje ważnych plików - Sprawdź czy embeddings są włączone
- Użyj explicit @ mentions dla ważnego kontekstu
Wolne autocomplete
{
"cody.autocomplete.advanced.provider": "fireworks",
"cody.autocomplete.advanced.timeout": 2000
}Problemy z autoryzacją
# Wyloguj i zaloguj ponownie
# Command Palette → "Cody: Sign Out"
# Następnie → "Cody: Sign In"Cennik
Plany Cody
| Plan | Cena | Autocomplete | Chat | Funkcje |
|---|---|---|---|---|
| Free | $0 | Unlimited | 20/dzień | Podstawowe |
| Pro | $9/mo | Unlimited | Unlimited | + Modele premium |
| Enterprise | Custom | Unlimited | Unlimited | + 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
- Używaj @ mentions - Podawaj konkretny kontekst
- Bądź konkretny - Opisuj dokładnie co chcesz osiągnąć
- Iteruj - Doprecyzowuj pytania w rozmowie
- Weryfikuj - Sprawdzaj wygenerowany kod
Efektywne przeszukiwanie codebase
# 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 (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:
- Entire codebase context - Cody indexes all repositories and understands relationships between files
- Code Graph - Advanced code indexing (definitions, references, dependencies)
- Multi-repo support - Search across multiple repositories simultaneously
- Smart context retrieval - Automatically finds relevant code for each query
- Enterprise-ready - Self-hosting, SSO, compliance, audit logs
- Unlimited autocomplete - Free tab completion on the Free tier
- Multiple LLM models - Choose between Claude, GPT-4, Gemini
Cody vs GitHub Copilot
| Feature | Cody | GitHub Copilot |
|---|---|---|
| Context | Entire 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 |
| Price | Free + $9/mo Pro | $10-19/mo |
| Open Source | ✅ Yes (partial) | ❌ No |
Installation
VS Code
# From marketplace
code --install-extension sourcegraph.cody-ai
# Or through VS Code:
# 1. Extensions (Ctrl+Shift+X)
# 2. Search "Cody AI"
# 3. InstallJetBrains (IntelliJ, PyCharm, WebStorm)
# 1. Settings → Plugins → Marketplace
# 2. Search "Cody"
# 3. Install → Restart IDENeovim
-- In lazy.nvim configuration
{
"sourcegraph/sg.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("sg").setup()
end
}After installation
- Open the Cody sidebar (Cody icon in the side panel)
- Click "Sign In"
- Log in via GitHub, GitLab, or email
- Cody will automatically start indexing your project
How does Cody work?
Code Graph architecture
┌─────────────────────────────────────────────────┐
│ 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
- Embeddings - Vector representations of code for semantic search
- Code Intelligence - SCIP (Source Code Intelligence Protocol) for:
- Function/class/variable definitions
- References and usages
- Type hierarchies
- Import/export relationships
- Graph relationships - Relationships between files and modules
Main features
Chat with codebase context
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:
# 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:
/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
// 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:
// Cody understands the structure of your project
// and suggests relevant code
import {
// Cody suggests: useAuth, useUser, useSession
// based on what is used in the projectAutocomplete configuration:
// settings.json (VS Code)
{
"cody.autocomplete.enabled": true,
"cody.autocomplete.advanced.provider": "fireworks",
"cody.autocomplete.advanced.model": "starcoder"
}Fixups (inline edit)
// 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?
- Embedding search - Semantic similarity to the question
- Keyword search - Exact keyword matches
- Code graph - Definitions and references for symbols
- Recent files - Recently edited files
- Open files - Currently open files in the IDE
Custom context
# 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 tRPCContext window management
// Settings in VS Code
{
"cody.chat.contextWindow": 16000,
"cody.autocomplete.contextWindow": 4000
}Enterprise features
Multi-repo code intelligence
For organizations with multiple repositories:
# 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 answerSourcegraph integration
// .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 (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)
{
"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
// 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
{
// 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
Settings → Tools → Cody
- Enable Cody: ✓
- Chat Model: Claude 3.5 Sonnet
- Autocomplete: Enabled
- Custom Instructions: [your instructions]Ignoring files
# .cody/ignore
node_modules/
dist/
build/
*.min.js
*.map
coverage/
.env*
secrets/LLM Models
Available models
| Model | Usage | Availability |
|---|---|---|
| Claude 3.5 Sonnet | Chat (default) | Free + Pro |
| Claude 3 Opus | Chat (advanced) | Pro |
| GPT-4 Turbo | Chat | Pro |
| Gemini 1.5 Pro | Chat | Pro |
| StarCoder | Autocomplete | Free + Pro |
| Claude Instant | Fast chat | Free + Pro |
Choosing a model in chat
# 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 modelCustom models (Enterprise)
{
"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
@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 standardsOnboarding new developers
@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
@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
@diff
Review this pull request for:
- Potential bugs
- Performance issues
- Security concerns
- Adherence to our coding standards from @CONTRIBUTING.mdDocumentation generation
@src/api/users/
Generate API documentation for all endpoints in this folder.
Include:
- Request/response schemas
- Authentication requirements
- Example curl commandsKeyboard shortcuts
VS Code
| Shortcut | Action |
|---|---|
Alt+K | Open Cody chat |
Alt+C | New chat |
Alt+/ | Autocomplete trigger |
Opt+\ | Edit inline |
Cmd+Shift+C | Explain selected code |
Cmd+Shift+V | Generate tests |
JetBrains
| Shortcut | Action |
|---|---|
Alt+C | Open Cody |
Alt+K | Edit inline |
Ctrl+Shift+E | Explain code |
Ctrl+Shift+T | Generate tests |
Integrations
Git integration
# Cody automatically understands git history
@git show me what changed in the last week
@git who worked on authentication recently?
@git explain this commitCI/CD integration
# .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: reviewSlack integration (Enterprise)
# In Slack
/cody search how do we handle payments?
# Cody searches the codebase and responds in the threadComparison with competitors
Cody vs Continue
| Feature | Cody | Continue |
|---|---|---|
| Context | Code graph + embeddings | Embeddings |
| Multi-repo | ✅ Native | ⚠️ Manual configuration |
| Enterprise | ✅ Self-host + SSO | ⚠️ Self-host only |
| Price | Free + $9/mo | Free (BYOK) |
| Open Source | Partial | Yes |
Cody vs Cursor
| Feature | Cody | Cursor |
|---|---|---|
| IDE | VS Code + JetBrains | Own IDE (VS Code fork) |
| Context | Code graph | Embeddings |
| Multi-repo | ✅ Yes | ❌ No |
| Price | Free + $9/mo | $20/mo |
Cody vs Amazon CodeWhisperer
| Feature | Cody | CodeWhisperer |
|---|---|---|
| Context | Entire codebase | Current file only |
| Chat | ✅ Yes | ⚠️ Limited |
| Security scans | ⚠️ Via Sourcegraph | ✅ Native |
| AWS integration | ⚠️ External | ✅ Native |
| Price | Free + $9/mo | Free + $19/mo |
Troubleshooting
Cody is not indexing the project
# Check indexing status
# VS Code: View → Output → Cody
# Force reindexing
# Command Palette → "Cody: Refresh Local Embeddings"Poor context quality
- Make sure
.cody/ignoreis not blocking important files - Check that embeddings are enabled
- Use explicit @ mentions for important context
Slow autocomplete
{
"cody.autocomplete.advanced.provider": "fireworks",
"cody.autocomplete.advanced.timeout": 2000
}Authorization issues
# Log out and log in again
# Command Palette → "Cody: Sign Out"
# Then → "Cody: Sign In"Pricing
Cody plans
| Plan | Price | Autocomplete | Chat | Features |
|---|---|---|---|---|
| Free | $0 | Unlimited | 20/day | Basic |
| Pro | $9/mo | Unlimited | Unlimited | + Premium models |
| Enterprise | Custom | Unlimited | Unlimited | + 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
- Use @ mentions - Provide specific context
- Be specific - Describe exactly what you want to achieve
- Iterate - Refine your questions in the conversation
- Verify - Review generated code
Efficient codebase searching
# 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 (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