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
This is still reproducible on RTK 0.42.4 (Headroom 0.33.0) and has now corrupted the aggregate twice on the same workstation.
The second incident came from three grep -rn records in ~/.local/share/rtk/history.db:
Command scope
input_tokens
output_tokens
saved_tokens
scoped recursive grep under knowledge-bases/lightrag
49,616,821
13,267
49,603,554
grep -rn 'pyright|mypy|basedpyright' .
3,514,722,717
4,393
3,514,718,324
scoped recursive grep under knowledge-bases/lightrag
85,465,729
1,411
85,464,318
Together these three rows added 3,649,786,196 saved tokens. Headroom consequently reported:
RTK session savings: about 3.65B / 99.5%
all-layer savings: about 3.97B / 75.53%
After backing up the SQLite database and deleting only those exact rows, the same live /stats endpoint reported:
RTK session savings: 4.84M / 21.42%
all-layer savings: 323.45M / 20.04%
The earlier incident had the same signature: three recursive grep rows contributed 6,055,215,004 saved tokens. This therefore appears systematic rather than a one-off damaged row.
The problematic value appears to be the estimated unfiltered recursive grep output, including large ignored/generated content, rather than context actually delivered to the agent. A single broad grep can dominate lifetime and downstream dashboard totals indefinitely.
Activity
[-]`rtk gain` makes `grep` savings look much lower[/-][+]Need fix `grep` savings to much lower[/+]pszymkowiak commentedon Apr 12, 2026
🔍 Automated Triage
featuremediumSummary
Enhance
rtk gainreporting to surface tooling-path limitations (native Grep/Read/Glob bypassing hook) so low grep savings aren't misread as filter-quality problemsTriaged automatically by wshm · This is an automated analysis, not a human review.
realityjunky commentedon Aug 2, 2026
This is still reproducible on RTK
0.42.4(Headroom0.33.0) and has now corrupted the aggregate twice on the same workstation.The second incident came from three
grep -rnrecords in~/.local/share/rtk/history.db:input_tokensoutput_tokenssaved_tokensknowledge-bases/lightraggrep -rn 'pyright|mypy|basedpyright' .knowledge-bases/lightragTogether these three rows added
3,649,786,196saved tokens. Headroom consequently reported:3.65B/99.5%3.97B/75.53%After backing up the SQLite database and deleting only those exact rows, the same live
/statsendpoint reported:4.84M/21.42%323.45M/20.04%The earlier incident had the same signature: three recursive grep rows contributed
6,055,215,004saved tokens. This therefore appears systematic rather than a one-off damaged row.The problematic value appears to be the estimated unfiltered recursive grep output, including large ignored/generated content, rather than context actually delivered to the agent. A single broad grep can dominate lifetime and downstream dashboard totals indefinitely.
Suggested acceptance criteria:
rtk gainand downstream consumers can distinguish measured tokens from extrapolated/estimated raw-output savings.I can provide additional sanitized SQLite fingerprints if useful.