a1673f7428
RTK was documented as delivering "60-90% token savings", which reads as a cost reduction. What RTK actually reduces is bash output bytes. Those are one contributor to input tokens, which are themselves only part of a bill that also counts output tokens, so the reduction dilutes at every step. - add docs/guide/resources/savings-explained.md as the canonical explainer: the savings chain, both estimators, and what RTK does not reduce - rescope the headline claim across README (7 languages), the guide, hook rules, agent definitions and module READMEs - relabel per-command tables as bash output reduction, keeping every figure - document that reported tokens are estimates: rtk gain uses bytes/4 (src/core/tracking.rs), filter tests use split_whitespace().count(). Neither is a real tokenizer, so ratios hold but absolute counts do not Remove figures that had no source: the $3/Mtok constant and its $36 example, the +/-10% tokenization accuracy claim, the 99.5% hook-install figure, the invented session tables in README and INSTALL, and the 30-50% parser range. CHANGELOG is untouched. Shipped release notes stay as a historical record.
Claude Code Hooks
Part of
hooks/— see alsosrc/hooks/for installation code
Specifics
- Shell-based
PreToolUsehook -- requiresjqfor JSON parsing - Returns
updatedInputJSON for transparent command rewrite (agent doesn't know RTK is involved) - Exits silently (exit 0) on any failure: jq missing, rtk missing, rtk too old (< 0.23.0), no match
- Version guard checks
rtk --versionagainst minimum 0.23.0 rtk-awareness.mdis a slim 10-line instructions file embedded into CLAUDE.md byrtk init
Testing
# Run the full test suite (60+ assertions)
bash hooks/test-rtk-rewrite.sh
# Test against a specific hook path
HOOK=/path/to/rtk-rewrite.sh bash hooks/test-rtk-rewrite.sh
# Enable audit logging during testing
RTK_HOOK_AUDIT=1 RTK_AUDIT_DIR=/tmp bash hooks/test-rtk-rewrite.sh