warn: emit stderr warning on RTK_DISABLED=1 (#508)#528
Merged
FlorianBruniaux merged 2 commits intortk-ai:developfrom Mar 31, 2026
Merged
warn: emit stderr warning on RTK_DISABLED=1 (#508)#528FlorianBruniaux merged 2 commits intortk-ai:developfrom
FlorianBruniaux merged 2 commits intortk-ai:developfrom
Conversation
93d0c31 to
a47f485
Compare
Contributor
|
Hey We are cleaning up the codebase and improving the project structure for better onboarding. As part of this effort, PR #826 reorganizes No logic changes — only file moves and import path updates. What you need to doRebase your branch on git fetch origin && git rebase origin/developGit detects renames automatically. If you get import conflicts, update the paths: use crate::git; // now: use crate::cmds::git::git;
use crate::tracking; // now: use crate::core::tracking;
use crate::config; // now: use crate::core::config;
use crate::init; // now: use crate::hooks::init;
use crate::gain; // now: use crate::analytics::gain;Need help rebasing? Tag @aeppling |
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> Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.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> Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.com>
a47f485 to
4ce95a3
Compare
Contributor
Author
|
Rebased on |
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