Skip to content

Add statistics and sorting options to the rtk gain 'By Command' table #1700

Open

Description

@erikhuizinga

Example:

$ rtk gain
RTK Token Savings (Global Scope)
════════════════════════════════════════════════════════════

Total commands:    11969
Input tokens:      8.3M
Output tokens:     2.6M
Tokens saved:      5.7M (68.7%)
Total exec time:   1408m12s (avg 7.1s)
Efficiency meter: ████████████████░░░░░░░░ 68.7%

By Command
────────────────────────────────────────────────────────────────────────
  #  Command                   Count   Saved    Avg%    Time  Impact
────────────────────────────────────────────────────────────────────────
 1.  rtk:toml xcodebuild t...      1  560.3K   99.8%   4m54s  ██████████
 2.  rtk:toml xcodebuild t...      1  518.7K   99.8%   5m41s  █████████░
 3.  rtk:toml ps -ef               8  451.5K   98.9%   166ms  ████████░░
 4.  rtk:toml ps -axo pid,...      7  347.8K   99.2%    79ms  ██████░░░░
 5.  rtk:toml ps -ax               5  283.4K   99.1%    98ms  █████░░░░░
 6.  rtk:toml ps -axo pid,...      5  237.3K   99.2%   172ms  ████░░░░░░
 7.  rtk:toml ps -axo pid,...      4  212.4K   99.1%    65ms  ████░░░░░░
 8.  rtk:toml ps -Ao pid,p...      4  197.9K   99.0%    50ms  ████░░░░░░
 9.  rtk git diff main...H...      2  183.6K   92.3%   287ms  ███░░░░░░░
10.  rtk:toml ps aux               2  163.8K   98.9%   162ms  ███░░░░░░░
────────────────────────────────────────────────────────────────────────

Note the 11.9K Total commands statistic above the table, the Count column in the table (few invocations), the 5.7M tokens saved statistic above the table and note the Saved column sums to over 3M tokens saved. This is a significant statistic for some rarely used commands that my LLM agents happened to invoke. However, my usage of RTK is much greater: 11.9K total commands. Most will have much less impact, but I'd like to see those so I can tune these commands to output less, or improve RTK's filters and command support to improve the impact further.

The feature request is to sort by different statistics, or even combined ones. E.g. the Impact column is nice, but what is impact in the first place? If I run a few command 10k times and it only saves a few tokens every time, wouldn't those be great candidates to somehow surface in a table? E.g. multiply 'tokens saved on average per invocation' (or some inverse) by invocation count, which could be called the 'potential' statistic. Or just sort by count to surface the volume commands.

By extension, this would go well with a filtering option to include or exclude certain command. E.g. I suspect there would be a lot of git status calls in the top N, but e.g. I personally run a lot of Gradle builds that I'd like to filter on, because I know they can be verbose (shoutout to #1178 and #1177).

Also, the table could be much longer. Why not let the user show all commands (ideally in a paging table)? Or a top N?

Activity

  1. added
    enhancement
    help wanted
    on May 27, 2026
  2. pszymkowiak commented on May 27, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    ✨ Category feature
    🟢 Priority low
    🎯 Confidence 97%

    Summary

    Feature request to add sorting options, filtering, configurable row limits, and new derived statistics (e.g. 'potential') to the rtk gain By Command table.


    Triaged automatically by wshm · This is an automated analysis, not a human review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clienhancementhelp wantedpriority:low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions