rtk-ai/rtk

Discover reports many missed savings

Open

#907 创建于 2026年3月29日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)Rust (48,085 star) (2,914 fork)batch import
documentationgood first issue

描述

Apologies if this is a beginners' mistake but I found no documentation about it...

When I run rtk discover it shows me many missed savings, even from "Commands RTK already handles". What does that mean exactly? If these commands are handled, then we do I not get the savings for these commands? Do I need to somehow update my configuration to do so? Is rtk init -g insufficient?

I also asked claude about this and it told me it might have something to do with its system prompt. Can anybody here tell me how to increase my savings?

CLAUDE output:

Still 290 missed commands in just the last day, even with the hook active. The hook is registered and working — so why isn't it catching these?

The answer: those aren't Bash tool calls from me. rtk discover scans all Claude Code sessions for this project, which includes commands from Glob, Grep, Read tools that internally invoke find, grep, cat — as well as commands from other Claude Code sessions or agents that may not go through the hook. The find (69) and grep -r (50) and cat (7) are likely from the dedicated tools (Glob, Grep, Read) which execute internally without going through the Bash tool hook.

The git diff (78) and gh api (42) are the real missed savings — those are genuine Bash calls. The git diff ones may come from the automatic git diff that runs during commit workflows, which is part of my system instructions (not prefixed with rtk). And gh api calls I should be prefixing with rtk but haven't consistently.

Summary: The hook is correctly installed and working. The bulk of "missed" commands fall into two buckets:

  1. Tool internals (find, grep, cat, ls) — these are from Glob/Grep/Read tools, not Bash calls the hook can intercept
  2. Unprefixed Bash calls (git diff, gh api) — genuine misses, mostly from system-prompted workflows (commit/PR creation) where the instructions say to run git diff directly

Full output of rtk discover:

$ rtk discover --since 7
RTK Discover -- Savings Opportunities
====================================================
Scanned: 75 sessions (last 7 days), 1962 Bash commands
Already using RTK: 214 commands (10%)

MISSED SAVINGS -- Commands RTK already handles
------------------------------------------------------------------------
Command                  Count    RTK Equivalent     Status        Est. Savings
gh api                      62    rtk gh             existing      ~48.8K tokens
git log                    266    rtk git            existing      ~44.9K tokens
grep -r                    152    rtk grep           existing      ~28.3K tokens
find /Users/eric/git/..    251    rtk find           existing      ~25.3K tokens
ls -la                     111    rtk ls             existing      ~4.7K tokens
curl -s                     14    rtk curl           existing      ~3.6K tokens
cat /private/tmp/clau..     24    rtk read           existing      ~1.6K tokens
diff /tmp/fair_d.txt         5    rtk diff           existing      ~1.2K tokens
mvn clean                    1    rtk mvn            existing      ~695 tokens
tree -L                      2    rtk tree           existing      ~166 tokens
------------------------------------------------------------------------
Total: 888 commands -> ~159.2K tokens saveable

贡献者指南