RTK: Upstream Filtering
RTK (Rust Token Killer) intercepts command outputs before they enter Claude’s context. It is not a post-hoc summary, it is a filter that eliminates structurally redundant noise.
# Installationbrew install rtk-ai/tap/rtk# or: cargo install rtk
# Initialize in a project (sets up the hook automatically)rtk initMeasured Savings
| Command | Without RTK | With RTK | Reduction |
|---|---|---|---|
git log | 13,994 chars | 1,076 chars | 92% |
git status | 100 chars | 24 chars | 76% |
vitest run | ~50,000 chars | ~5,000 chars | 90% |
pnpm list | ~8,000 chars | ~2,400 chars | 70% |
A 30-minute session with 10-15 git commands drops from ~150K to ~41K tokens, a 72% reduction on that item alone.
Essential RTK Commands
rtk git status # Condensed gitrtk git log # Clean log outputrtk cargo test # Filtered Rust testsrtk vitest run # Condensed JS testsrtk gh pr view 123 # Optimized GitHub PRrtk gain # Savings dashboardCompact: Freeing Up Context
/compact summarizes the conversation history and frees roughly 40-50% of used context, without losing the thread of the session. Use it proactively at 70% usage, not as an emergency measure at 90%.
/compact # Summarize the current sessionThe difference from /clear: compact preserves session continuity, clear starts from scratch.
.claudeignore: Excluding Noise
node_modules/.next/dist/*.lockcoverage/Without this file, Claude may read thousands of irrelevant files during a global search, consuming context unnecessarily.
Efficient Prompt Rules
Target, don’t load:
- “Check the
loginfunction inauth.ts:45-60” rather than “Check auth.ts for issues” - Reference symbols (
calculateTotal) rather than entire files - Avoid pasting large JSON blobs or raw logs into the prompt
What consumes the most:
| Action | Estimated tokens |
|---|---|
| Reading a large file (2000 lines) | ~5K+ |
| MCP call (Serena, Context7) | ~2K per call |
| Long conversation without /compact | Accumulation |
| Tests with full unfiltered output | 3K-10K |
Combined Strategy
RTK reduces the cost of bash commands (preventive). /compact frees up context mid-session (curative). .claudeignore avoids unnecessary reads (structural). These three levers are complementary and apply in parallel.
Enter your email to read the full card and get the complete PDF bundle.
All content is free and open-source. We just ask for your email.