Skip to content

warn: detect and report RTK_DISABLED=1 overuse in sessions #508

@pszymkowiak

Description

@pszymkowiak

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

  1. rtk gain warning: detect RTK_DISABLED=1 usage in tracking DB and warn when >10% of commands bypass RTK
  2. rtk discover detection: flag sessions with high RTK_DISABLED=1 usage as "missed savings"
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions