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.

Agent ready

Safe staging for this asset

This asset is staged first. The copied prompt tells the agent to inspect the staged files and ask before activating scripts, MCP config, or global config.

Stage only · 17/100Policy: stage
Agent surface
Any MCP/CLI agent
Kind
Mcp Config
Install
Stage only
Trust
Trust: Community
Entrypoint
Asset
Safe staging command
npx -y tokrepo@latest install bb158873-5e3a-4f74-be9b-5660b33303b9 --target codex

Stages files first; activation requires review of the staged README and plan.

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