CLI ToolsMay 7, 2026·5 min read

Amp by Sourcegraph — Whole-Repo AI Coding Agent

Sourcegraph's Amp reads the entire repo's symbol graph before editing. Symbol-aware retrieval, no hallucinated imports, type-respecting refactors.

Intro

Amp is Sourcegraph's AI coding agent that reads the whole repo before it edits. Where Cursor and Claude Code rely on per-file context windows, Amp queries Sourcegraph's pre-indexed code graph — symbol references, type hierarchies, dependency maps — to ground every edit. Best for: monorepo refactors and codebases too large for any single context window. Works with: terminal CLI + VS Code extension + Sourcegraph web. Setup time: 5 minutes (Sourcegraph account + API token).


What Amp does differently

Most AI coding tools approximate "see the whole codebase" by stuffing files into the context window. Amp doesn't approximate — Sourcegraph already indexes your repo (symbols, references, types, history) and Amp queries that index.

Concretely:

  • When you ask "rename getUser to fetchUser everywhere", Amp uses symbol references, not text search. No false positives in comments or strings.
  • When you ask "where is this called", Amp returns actual call sites from the graph, not regex matches.
  • When you ask for a refactor, Amp reads the type hierarchy first and proposes changes that respect interfaces and overrides.

CLI usage

# Install
brew install sourcegraph/amp/amp

# Authenticate (opens browser)
amp auth login

# Run a task in the current repo
amp "Refactor the User type to add a 'plan' field. Update all call sites."

# Run on a specific Sourcegraph-indexed repo (no need to clone)
amp --repo github.com/sourcegraph/sourcegraph "List all uses of the deprecated AuthService"

Connect Amp to Claude Code or Cursor

Amp ships an MCP server. Add to your MCP config:

{
  "mcpServers": {
    "sourcegraph": {
      "command": "amp",
      "args": ["mcp"],
      "env": { "SRC_ACCESS_TOKEN": "your-token" }
    }
  }
}

Now Claude Code / Cursor / Codex CLI can call sourcegraph_search, sourcegraph_symbol_references, sourcegraph_blame — using your repo graph as a tool.

When to choose Amp over Cursor / Claude Code

  • Your codebase is >1M LOC and doesn't fit any context window
  • You need refactors that respect actual symbol references, not regex
  • You want consistent answers across teammates (everyone queries the same indexed graph)

FAQ

Q: Is Amp free? A: Sourcegraph offers a free tier with limited indexed repos. Pro plans (and the Amp coding agent itself) are subscription-based. Pricing on sourcegraph.com/pricing.

Q: Does Amp work without a Sourcegraph account? A: No — Amp queries the Sourcegraph code graph, which requires Sourcegraph to index your repo. For single-repo work without indexing, Cursor or Claude Code is simpler.

Q: Can I use Amp on private repos? A: Yes. Sourcegraph self-hosted and Sourcegraph Cloud both support private repos. Amp authenticates via SRC_ACCESS_TOKEN scoped to repos you have access to.


Quick Use

  1. Sign up at sourcegraph.com (free tier available)
  2. Install: brew install sourcegraph/amp/amp
  3. amp auth login, then amp "<your task>" in any indexed repo

Intro

Amp is Sourcegraph's AI coding agent that reads the whole repo before it edits. Where Cursor and Claude Code rely on per-file context windows, Amp queries Sourcegraph's pre-indexed code graph — symbol references, type hierarchies, dependency maps — to ground every edit. Best for: monorepo refactors and codebases too large for any single context window. Works with: terminal CLI + VS Code extension + Sourcegraph web. Setup time: 5 minutes (Sourcegraph account + API token).


What Amp does differently

Most AI coding tools approximate "see the whole codebase" by stuffing files into the context window. Amp doesn't approximate — Sourcegraph already indexes your repo (symbols, references, types, history) and Amp queries that index.

Concretely:

  • When you ask "rename getUser to fetchUser everywhere", Amp uses symbol references, not text search. No false positives in comments or strings.
  • When you ask "where is this called", Amp returns actual call sites from the graph, not regex matches.
  • When you ask for a refactor, Amp reads the type hierarchy first and proposes changes that respect interfaces and overrides.

CLI usage

# Install
brew install sourcegraph/amp/amp

# Authenticate (opens browser)
amp auth login

# Run a task in the current repo
amp "Refactor the User type to add a 'plan' field. Update all call sites."

# Run on a specific Sourcegraph-indexed repo (no need to clone)
amp --repo github.com/sourcegraph/sourcegraph "List all uses of the deprecated AuthService"

Connect Amp to Claude Code or Cursor

Amp ships an MCP server. Add to your MCP config:

{
  "mcpServers": {
    "sourcegraph": {
      "command": "amp",
      "args": ["mcp"],
      "env": { "SRC_ACCESS_TOKEN": "your-token" }
    }
  }
}

Now Claude Code / Cursor / Codex CLI can call sourcegraph_search, sourcegraph_symbol_references, sourcegraph_blame — using your repo graph as a tool.

When to choose Amp over Cursor / Claude Code

  • Your codebase is >1M LOC and doesn't fit any context window
  • You need refactors that respect actual symbol references, not regex
  • You want consistent answers across teammates (everyone queries the same indexed graph)

FAQ

Q: Is Amp free? A: Sourcegraph offers a free tier with limited indexed repos. Pro plans (and the Amp coding agent itself) are subscription-based. Pricing on sourcegraph.com/pricing.

Q: Does Amp work without a Sourcegraph account? A: No — Amp queries the Sourcegraph code graph, which requires Sourcegraph to index your repo. For single-repo work without indexing, Cursor or Claude Code is simpler.

Q: Can I use Amp on private repos? A: Yes. Sourcegraph self-hosted and Sourcegraph Cloud both support private repos. Amp authenticates via SRC_ACCESS_TOKEN scoped to repos you have access to.


Source & Thanks

Built by Sourcegraph. Commercial product with free tier.

sourcegraph/amp — Sourcegraph code graph required

🙏

Source & Thanks

Built by Sourcegraph. Commercial product with free tier.

sourcegraph/amp — Sourcegraph code graph required

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets