Overview
Analyzes Claude Code session files (JSONL format) to identify commands that could have used RTK but didn’t. Shows estimated token savings and suggests RTK alternatives.Syntax
Options
Filter by project path (substring match). If not specified and
--all is not used, defaults to current working directory.Scan all projects (no filtering by path)
Limit scan to sessions from last N days
Max commands per section in text output
Output format:
text- Human-readable reportjson- Machine-readable JSON
Session Discovery
RTK scans Claude Code session files:- Location:
~/.claude/sessions/*.jsonl(or OS-specific path) - Format: Newline-delimited JSON (JSONL)
- Filtering: By project path (encoded in session filename)
Command Classification
Supported Commands
Commands RTK can optimize, grouped by category: Git (59-80% savings)git status,git log,git diff,git showgit add,git commit,git push,git pullgit branch,git fetch,git stash,git worktree
cargo build,cargo check,cargo clippytsc,next build,pnpm build
cargo test,cargo nextestvitest run,playwright testpytest,go test
eslint,ruff check,pylint,mypyprettier --check,cargo clippy
pnpm list,pnpm outdated,pnpm installnpm run,pip list
ls,grep,find,cat/read
docker ps,docker images,docker logskubectl get,kubectl logs
curl,wget
Unsupported Commands
Commands not yet supported by RTK (feature requests welcome):- Custom scripts
- Uncommon build tools
- Database CLIs (non-psql)
- Vendor-specific tools
Ignored Commands
Automatically excluded from analysis:- Commands already using RTK (
rtk ...) - Text editors (
vim,nano,code) - Interactive shells (
bash,zsh) - CD operations (
cd ...)
Output Format
Text Report
JSON Format
RTK Status Indicators
✅ Existing - RTK already supports this command with optimized filter 🔄 Passthrough - RTK supports the base command but no specialized filter (0% savings, usage tracked) ❌ Not Supported - Command not recognized by RTK (feature request needed)Token Estimation
For each command, RTK estimates savings using:- Real output length (from session
tool_result.contentif available) - Category averages (fallback based on command type)
- Historical savings % (from category benchmarks)
Use Cases
Audit Current Workflow
Analyze All Projects
Recent Sessions Only
Specific Project
Export for Analysis
Privacy & Data
RTKdiscover only analyzes:
- Command names and arguments (from
Bashtool calls) - Output lengths (for token estimation)
- Session timestamps and project paths
- Message content (user/assistant text)
- File contents
- API responses
- Personal data
Exit Codes
0- Success1- Session directory not found or no sessions
Related Commands
rtk gain- View actual token savings from RTK usagertk init- Install RTK hook for automatic command rewritingrtk learn- Analyze error corrections in Claude Code history
