Skip to content

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.

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:

SourcegraphForge equivalent
Code search (literal)forge search <query> / forge_search
Code search (regex)forge search <pattern> --regex / forge_search with regex
Structural searchforge pattern <ast-grep pattern> / forge_pattern_search
”Find references”forge_trace_dependents
”Go to definition”forge_search_symbols <symbol>
Cross-repo searchIndex each repo separately; search each with separate MCP server
Code navigation in browserUse with Claude Code, Cursor, or Zed for in-editor navigation
Batch changesNot available — Forge is a read-only intelligence tool
Insights/metricsforge stats, forge_architecture_map for structural metrics
Terminal window
curl -fsSL https://downloads.forge.ironpinelabs.com/releases/latest/forge-linux-x86_64 \
-o forge
chmod +x forge
sudo mv forge /usr/local/bin/forge
forge --version

See Install Forge for all platforms and Gatekeeper handling on macOS.

Terminal window
cd /path/to/your/repo
forge 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.

If you used Sourcegraph’s browser-based code navigation, the closest equivalent is connecting Forge to your editor via MCP:

Once connected, you can ask your AI assistant to search and navigate using Forge tools directly.

Literal search:

Sourcegraph: repo:^github\.com/myorg/myrepo$ checkout

Forge CLI:

Terminal window
forge search "checkout"

Forge MCP (in editor):

Use forge_search with query="checkout"

Regex search:

Sourcegraph: repo:^github\.com/myorg/myrepo$ /createPayment\(.*\)/

Forge CLI:

Terminal window
forge search "createPayment\(.*\)" --regex

Structural search:

Sourcegraph structural: console.log(...)

Forge pattern (ast-grep syntax):

Terminal window
forge pattern "console.log($$$)" --language javascript

Find all references to a function:

Sourcegraph: “Find references” on a symbol in the UI

Forge MCP:

Use forge_trace_dependents on src/lib/payments.ts

Forge CLI:

Terminal window
# Find all files that import payments.ts
forge health --show-dependents src/lib/payments.ts

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:

Terminal window
forge activate <your-license-key>

A 14-day free trial is available at forge.ironpinelabs.com. Card required upfront; no charge until day 15.

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.

Search returns too many results Sourcegraph defaulted to repo-scoped search. Forge searches the entire indexed tree. Add --include to scope results:

Terminal window
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.