Migrate from Sourcegraph
Sourcegraph discontinued the individual/indie tier in July 2025. If you were using Sourcegraph for code search and navigation on a self-hosted or cloud account, this guide walks through replicating that workflow with Canopy.
What changes
Section titled “What changes”The biggest practical difference: Canopy runs entirely locally. There’s no server to run, no Docker container to maintain, no cloud account required. The index lives in .canopy/index/ inside your repo and is updated incrementally as files change.
Feature mapping:
| Sourcegraph | Canopy equivalent |
|---|---|
| Code search (literal) | canopy search <query> / canopy_search |
| Code search (regex) | Use canopy pattern for AST-aware structural matching, or pipe canopy search output to grep -E '<pattern>' for regex post-filtering. The CLI does not currently expose a --regex flag. |
| Structural search | canopy pattern <ast-grep pattern> / canopy_pattern_search |
| ”Find references” | canopy_trace_dependents (MCP tool — no CLI peer) |
| “Go to definition” | canopy_search_symbols <symbol> (MCP tool — no CLI peer) |
| Cross-repo search | Index each repo separately; search each with separate MCP server |
| Code navigation in browser | Use with Claude Code, Cursor, or Zed for in-editor navigation |
| Batch changes | Not available — Canopy is a read-only intelligence tool |
| Insights/metrics | canopy status for index counts; canopy_architecture_map (MCP) for structural metrics |
Step 1: Install Canopy
Section titled “Step 1: Install Canopy”curl -fsSL $CANOPY_DOWNLOAD_URL/releases/latest/canopy-linux-x86_64 \ -o canopychmod +x canopysudo mv canopy /usr/local/bin/canopycanopy --versionSee Install Canopy for all platforms and Gatekeeper handling on macOS.
Step 2: Index your repo
Section titled “Step 2: Index your repo”cd /path/to/your/repocanopy index . --with-search --with-git--with-search enables full-text search (the Sourcegraph equivalent). --with-git adds git history to canopy_prepare results.
For large repos (>10K files), indexing takes 30–120 seconds. Subsequent incremental runs are much faster — typically under 5 seconds.
Step 3: Connect to your editor
Section titled “Step 3: Connect to your editor”If you used Sourcegraph’s browser-based code navigation, the closest equivalent is connecting Canopy to your editor via MCP:
- Set Up Canopy with Claude Code
- Set Up Canopy with Cursor
- Set Up Canopy with Zed
- Set Up Canopy with VS Code + Continue
Once connected, you can ask your AI assistant to search and navigate using Canopy tools directly.
Step 4: Replicate your searches
Section titled “Step 4: Replicate your searches”Literal search:
Sourcegraph: repo:^github\.com/myorg/myrepo$ checkout
Canopy CLI:
canopy search "checkout"Canopy MCP (in editor):
Use canopy_search with query="checkout"Regex search:
Sourcegraph: repo:^github\.com/myorg/myrepo$ /createPayment\(.*\)/
Canopy doesn’t expose a --regex flag on canopy search. For pattern-based matching, prefer canopy pattern (ast-grep over the AST — handles all the semantically-equivalent forms regex would have to enumerate). For raw regex over indexed text, pipe through grep -E:
canopy search "createPayment" | grep -E "createPayment\(.*\)"For function-call shape matching that’s more robust than regex:
canopy pattern "createPayment($$$)" --language typescriptStructural search:
Sourcegraph structural: console.log(...)
Canopy pattern (ast-grep syntax):
canopy pattern "console.log($$$)" --language javascriptFind all references to a function:
Sourcegraph: “Find references” on a symbol in the UI
Canopy MCP:
Use canopy_trace_dependents on src/lib/payments.tsThere is no CLI peer for “find references” — canopy_trace_dependents is exposed only through MCP. From the editor, ask your AI assistant to call it; from the shell, the closest read-only check is grepping import statements:
# Approximate: list files that import the module by string match.# Misses re-export chains and dynamic imports — use canopy_trace_dependents# from your editor for the structural answer.canopy search "from '../lib/payments'"Activate a license (optional)
Section titled “Activate a license (optional)”Canopy Community tier supports 1 repo and basic CLI tools — sufficient for personal projects. For multi-repo support and the full 31 MCP tools, activate a license:
canopy activate <your-license-key>A 14-day free trial is available at canopy.gulfshieldtech.com. Card required upfront; no charge until day 15.
What Canopy doesn’t have
Section titled “What Canopy doesn’t have”Be aware of these gaps before migrating:
- Cross-repo search in a single query — Canopy indexes each repo separately. You can’t search across 50 repos with one query the way Sourcegraph Enterprise supported. Workaround: use a monorepo index if your repos are related.
- Web UI — Canopy has no browser interface. Results come through the CLI or your editor’s AI assistant.
- Batch changes — Canopy is a read-only intelligence tool. It doesn’t write code.
- Saved searches / code monitors — No persistent search subscriptions. Run searches on demand or in CI.
Common pitfalls
Section titled “Common pitfalls”Search returns too many results
Sourcegraph defaulted to repo-scoped search. Canopy searches the entire indexed tree. Use --language to filter by language and --limit to cap the result count — there is no --include glob flag on the CLI:
canopy search "checkout" --language typescript --limit 20For path-prefix scoping, canopy_search (the MCP tool) accepts path_prefix=src/ — call it from your editor when you need that filter.
“Index not found” after indexing
Canopy stores the index relative to the path passed to canopy index. If you indexed /home/you/repos/myapp, start canopy serve with the same path. Running canopy serve . from a different working directory won’t find the index.