Migrate from Sourcegraph
import { Aside, Tabs, TabItem } from ‘@astrojs/starlight/components’;
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 Forge.
What changes
Section titled “What changes”The biggest practical difference: Forge runs entirely locally. There’s no server to run, no Docker container to maintain, no cloud account required. The index lives in .forge/index/ inside your repo and is updated incrementally as files change.
Feature mapping:
| Sourcegraph | Forge equivalent |
|---|---|
| Code search (literal) | forge search <query> / forge_search |
| Code search (regex) | forge search <pattern> --regex / forge_search with regex |
| Structural search | forge pattern <ast-grep pattern> / forge_pattern_search |
| ”Find references” | forge_trace_dependents |
| ”Go to definition” | forge_search_symbols <symbol> |
| 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 — Forge is a read-only intelligence tool |
| Insights/metrics | forge stats, forge_architecture_map for structural metrics |
Step 1: Install Forge
Section titled “Step 1: Install Forge”curl -fsSL https://downloads.forge.ironpinelabs.com/releases/latest/forge-linux-x86_64 \ -o forgechmod +x forgesudo mv forge /usr/local/bin/forgeforge --versionSee Install Forge for all platforms and Gatekeeper handling on macOS.
Step 2: Index your repo
Section titled “Step 2: Index your repo”cd /path/to/your/repoforge index . --with-search --with-git--with-search enables full-text search (the Sourcegraph equivalent). --with-git adds git history to forge_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 Forge to your editor via MCP:
- Set Up Forge with Claude Code
- Set Up Forge with Cursor
- Set Up Forge with Zed
- Set Up Forge with VS Code + Continue
Once connected, you can ask your AI assistant to search and navigate using Forge tools directly.
Step 4: Replicate your searches
Section titled “Step 4: Replicate your searches”Literal search:
Sourcegraph: repo:^github\.com/myorg/myrepo$ checkout
Forge CLI:
forge search "checkout"Forge MCP (in editor):
Use forge_search with query="checkout"Regex search:
Sourcegraph: repo:^github\.com/myorg/myrepo$ /createPayment\(.*\)/
Forge CLI:
forge search "createPayment\(.*\)" --regexStructural search:
Sourcegraph structural: console.log(...)
Forge pattern (ast-grep syntax):
forge pattern "console.log($$$)" --language javascriptFind all references to a function:
Sourcegraph: “Find references” on a symbol in the UI
Forge MCP:
Use forge_trace_dependents on src/lib/payments.tsForge CLI:
# Find all files that import payments.tsforge health --show-dependents src/lib/payments.tsActivate a license (optional)
Section titled “Activate a license (optional)”Forge Community tier supports 1 repo and basic CLI tools — sufficient for personal projects. For multi-repo support and the full 21 MCP tools, activate a license:
forge activate <your-license-key>A 14-day free trial is available at forge.ironpinelabs.com. Card required upfront; no charge until day 15.
What Forge doesn’t have
Section titled “What Forge doesn’t have”Be aware of these gaps before migrating:
- Cross-repo search in a single query — Forge 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 — Forge has no browser interface. Results come through the CLI or your editor’s AI assistant.
- Batch changes — Forge 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. Forge searches the entire indexed tree. Add --include to scope results:
forge search "checkout" --include "src/**/*.ts"“Index not found” after indexing
Forge stores the index relative to the path passed to forge index. If you indexed /home/you/repos/myapp, start forge serve with the same path. Running forge serve . from a different working directory won’t find the index.