Sourcegraph Cody

⏱️ 2 min read 💻 AI Coding

What it is: Universal code search and AI assistant. Search across all repositories. Cody AI answers questions about your codebase.

How does universal code search across all repos work?

Sourcegraph connects to your code hosts (GitHub, GitLab, Bitbucket, Azure DevOps, Gerrit, Perforce, or a plain Git server), mirrors every repository you give it access to, and indexes each repo's default branch. A single query then runs against all of those repos at once, so you search the whole organization's code from one box instead of cloning and grepping repos one by one. Filters narrow the scope: repo: and file: take regular expressions, lang: limits by language, and type:commit or type:diff searches history instead of current code.

# Every Go file in the acme org that calls http.NewRequest
repo:^github\.com/acme/ file:\.go$ http.NewRequest

# Which repos still depend on a deprecated library?
file:go\.mod$ github.com/pkg/errors select:repo

# Recent commits that added or removed LegacyClient calls
type:diff repo:^github\.com/acme/ after:"2 weeks ago" LegacyClient

Search only reaches repos your instance is connected to, and results follow code host permissions when permission syncing is enabled. Commit and diff searches read git history rather than the index, so they are slower; scope them with repo: and after:. The main difference from GitHub's built-in code search is reach: GitHub searches only code hosted on GitHub, while Sourcegraph puts every connected host behind one query.

What It Does Best

Search at scale. Find code across thousands of repos. Regex, structural search, commit history. Google for your company's code.

Codebase understanding. Cody AI knows your entire codebase. Ask "where do we handle auth?" Get accurate answers with file references.

Code intelligence everywhere. Jump to definitions across repos. Find references in any codebase. Understand dependencies.

Key Features

Universal search: Search across GitHub, GitLab, Bitbucket

Cody AI assistant: Chat with your codebase

Code navigation: Go-to-definition across repositories

Batch changes: Make changes across multiple repos

Code insights: Track migrations and tech debt

Pricing

Free: Public code search across 1M+ open-source repos on sourcegraph.com (no private code)

Cody Free/Pro: Discontinued July 23, 2025; Cody is now Enterprise-only

Enterprise: From $16K/year minimum annual contract (private code search across your code hosts, AI features, SSO)

When to Use It

✅ Microservices architecture (many repos)

✅ Need to understand unfamiliar codebase

✅ Onboarding developers to large systems

✅ Tracking migrations across repos

✅ Want AI that understands your code

When NOT to Use It

❌ Single small repository (IDE search enough)

❌ Just want code completion (use Copilot)

❌ Solo developer with simple project

❌ Can't install third-party tools

Common Use Cases

Finding examples: "How did we implement OAuth elsewhere?"

Security audits: Find all uses of deprecated API

Refactoring: Change function across 50 microservices

Tech debt tracking: Monitor progress on migrations

Code review context: Understand changes in broader codebase

Sourcegraph vs Alternatives

vs GitHub search: Sourcegraph more powerful, works across platforms

vs grep/ripgrep: Sourcegraph has web UI, works remotely

vs Cursor: Sourcegraph for searching, Cursor for editing

Unique Strengths

Multi-repo intelligence: Understands code across repositories

Batch operations: Change code everywhere at once

Code insights: Track patterns and trends over time

Platform agnostic: Works with any code host

Bottom line: Essential for large organizations with many repositories. Cody AI makes it valuable even for smaller teams. Search alone worth it for microservices.

Visit Sourcegraph →

← Back to AI Coding Tools