Sourcegraph Amp 1M Token Context: How to Manage and Extend It
Sourcegraph Amp (ampcode.com) is an AI coding assistant powered by Claude Sonnet 4 with 1M token context. This massive window is perfect for large codebases, but it is easy to fill. Amp shows you token usage in real time. This guide covers how Amp bills tokens, strategies to manage context efficiently, and how Token Limits MCP extends every session.
How Sourcegraph Amp bills token usage
Amp is powered by Claude Sonnet 4 (1M token context). Every request you make to Amp consumes tokens from your usage quota. Amp shows your token count in real time as you work, so you always know how much context you have left.
- ✓Context loaded: Every file you open or context you provide uses tokens
- ✓Conversations: Each message and response consumes tokens
- ✓Searches: Full-file search results load entire matches into context
- ✓Diff requests: Showing before/after code structures uses tokens
What 1M tokens means in practice
1M tokens ≈ 750k-1M words ≈ 100-200 large source files ≈ 8-12 hour conversation.
- ✓Small project (5-20 files): Takes 50k-200k tokens
- ✓Medium codebase (50-200 files): Takes 200k-500k tokens
- ✓Large codebase (500+ files): Takes 500k-1M tokens
- ✓Full day of conversations: 300k-500k tokens without compression
Why you might fill your 1M token window
- ✓Loading entire large files multiple times (source, tests, related modules)
- ✓Full-text search returning thousands of lines of results
- ✓Long conversations with many back-and-forth exchanges
- ✓Large diffs showing many files at once
Strategies to manage Amp context efficiently
- ✓Open only the files you need: Avoid loading the entire codebase
- ✓Use targeted searches: Search by pattern, not by keyword alone
- ✓Archive old conversations: Start fresh conversations instead of long threads
- ✓Focus on file snippets: Load specific functions, not whole modules
Token Limits MCP for Sourcegraph Amp
Token Limits provides compressed tools for file reads, searches, and diffs. When Amp loads a file through Token Limits, it uses 60-80% fewer tokens. A 50k-token file read drops to 10k-20k tokens.
- Install: npm install -g token-limits
- In Amp: Settings → Extensions → Add MCP Server
- Command: token-limits mcp-server
- Restart Amp
- All file reads and searches now use compressed tools
Real impact: Token savings with Amp + Token Limits
Loading a 100-file medium-sized codebase and working for 4 hours:
- ✓Without compression: 500k tokens (half your 1M window gone)
- ✓With Token Limits: 150k-200k tokens (plenty of context left)
- ✓Effective context: Amp feels like it has 2M-3M tokens instead of 1M
Stretch Amp's 1M tokens 3-5x with Token Limits MCP
Compress file reads and searches automatically. Load more files, run longer sessions, work with bigger codebases. Setup: 2 minutes.
FAQ
How can I see my token usage in Amp?
Amp displays your current context usage in real time in the interface. You will see a token counter as you add files or send messages.
What happens if I exceed 1M tokens?
Amp will likely truncate older messages or prevent new additions. You will see a notification that you have exceeded context. Clear some context or start a new session.
Does Amp have usage limits or billing tiers?
Amp is part of Sourcegraph's suite. Check ampcode.com for current pricing and usage limits.
Can I use Token Limits with other Sourcegraph tools?
Token Limits MCP works with any IDE or tool that supports MCP. You can use it alongside Cody or other Sourcegraph features.
Do I need an API key for Token Limits in Amp?
No. Token Limits runs locally on your machine. No API key needed for compression.