Problem
Claude Code (and other AI agents) may learn to use RTK_DISABLED=1 as a workaround after encountering a single filtering issue, then over-generalize it to all commands — silently killing token savings.
Real example: in a session with 801 Bash commands, 243 (30%) used RTK_DISABLED=1 unnecessarily. This dropped the average savings from ~65-70% to 48.5%. Commands like gh pr list, gh pr view, cargo test, git log, and curl were all bypassed even though RTK handles them correctly.
Root cause
A past bug (#196) where gh --json output was corrupted led to a RTK_DISABLED=1 workaround. The bug was fixed in the rewrite logic (skip --json/--jq/--template), but the workaround persisted in agent memory and spread to unrelated commands.
Proposed solution
rtk gain warning: detect RTK_DISABLED=1 usage in tracking DB and warn when >10% of commands bypass RTK
rtk discover detection: flag sessions with high RTK_DISABLED=1 usage as "missed savings"
- Docs: add a note in CLAUDE.md that
RTK_DISABLED=1 should almost never be needed (the rewrite hook already skips --json/--jq/--template and unknown commands)
Impact
Could recover 15-20% savings for affected users with zero code change on their side.
Problem
Claude Code (and other AI agents) may learn to use
RTK_DISABLED=1as a workaround after encountering a single filtering issue, then over-generalize it to all commands — silently killing token savings.Real example: in a session with 801 Bash commands, 243 (30%) used
RTK_DISABLED=1unnecessarily. This dropped the average savings from ~65-70% to 48.5%. Commands likegh pr list,gh pr view,cargo test,git log, andcurlwere all bypassed even though RTK handles them correctly.Root cause
A past bug (#196) where
gh --jsonoutput was corrupted led to aRTK_DISABLED=1workaround. The bug was fixed in the rewrite logic (skip--json/--jq/--template), but the workaround persisted in agent memory and spread to unrelated commands.Proposed solution
rtk gainwarning: detectRTK_DISABLED=1usage in tracking DB and warn when >10% of commands bypass RTKrtk discoverdetection: flag sessions with highRTK_DISABLED=1usage as "missed savings"RTK_DISABLED=1should almost never be needed (the rewrite hook already skips--json/--jq/--templateand unknown commands)Impact
Could recover 15-20% savings for affected users with zero code change on their side.