You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
discover undercounts RTK adoption when commands are rewritten via PreToolUse hook #1643
The PreToolUse rtk-rewrite.sh hook (used in Claude Code setups per the project's RTK.md) transparently rewrites raw commands before execution — e.g. grep -n → rtk grep -n, ls -la → rtk ls -la.
However, rtk discover still counts the pre-rewrite form as "missed savings", which inflates the missed-savings figure even when the hook is actively rewriting every invocation.
Repro
Enable the rewrite hook (PreToolUse → rtk-rewrite.sh)
Run a normal session — every grep -n, ls -la, tail -n etc. is rewritten transparently
rtk discover -a -s 1
Observed: report shows ~40K tokens of "missed savings" attributed to commands like grep -n, ls -la, tail -n, despite the hook handling them.
Suggested fix
Detect hook-rewritten invocations so adoption rate reflects actual RTK usage, not the user's typed form. Possible markers:
Env var set by the rewrite hook (e.g. RTK_REWRITTEN=1)
Parent process / argv inspection in the rewrite path
Sentinel comment/argument injected by the hook
Without this, rtk discover over-reports opportunity and under-reports adoption — making the metric unusable for tracking real RTK uptake.
Activity
pszymkowiak commentedon Apr 30, 2026
Closing as duplicate of #2036. See the original issue for updates.