warn: emit stderr warning on RTK_DISABLED=1 (#508)#528
Open
ousamabenyounes wants to merge 2 commits intortk-ai:developfrom
Open
warn: emit stderr warning on RTK_DISABLED=1 (#508)#528ousamabenyounes wants to merge 2 commits intortk-ai:developfrom
ousamabenyounes wants to merge 2 commits intortk-ai:developfrom
Conversation
When the rewrite hook sees RTK_DISABLED=1, it now prints a warning to stderr before skipping the rewrite. This educates AI agents to stop overusing the bypass — a real session showed 30% of commands using RTK_DISABLED=1 unnecessarily, dropping savings from ~65% to 48%. The warning is on stderr (not stdout) so it doesn't affect command output or piping. The bypass still works exactly as before. Fixes rtk-ai#508 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verifies that `rtk rewrite "RTK_DISABLED=1 git status"` emits the warning on stderr, not just that rewrite_command returns None. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #508 — AI agents overuse
RTK_DISABLED=1after encountering a single filtering issue, silently killing token savings for the entire session.Real impact observed: 801 commands in a session, 243 (30%) used
RTK_DISABLED=1unnecessarily. Savings dropped from ~65% to 48%.Fix: When the rewrite hook detects
RTK_DISABLED=1, emit a warning on stderr:The agent sees this warning in real-time and learns to stop overusing the bypass.
Why this works
Before/After
Test plan
RTK_DISABLEDtests pass (return value unchanged)cargo fmt && cargo clippy && cargo testall greenvalidate-docs.shpassesGenerated with Claude Code