rtk-ai / rtk-ai/rtk

rtk gain reports a missing hook on only one of its five views — never on the empty report, where it matters most

Open Beginner friendly
#4,035 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:cli bug good first issue priority:medium
Dominant language
Rust
Stars
81.1k
Forks
5.1k
Avg merge
4d 11h
Merged PRs (30d)
40

Description

Summary

rtk gain reports a missing or outdated hook on only one of its five invocations: the default view, and only when there is tracking data. --daily, --weekly, --monthly, --all and the empty report all stay silent.

The empty report is the worst case. With no hook installed nothing is tracked, so "no data" is usually caused by the missing hook — and that is exactly the run where the user is told nothing:

$ rtk gain
No tracking data yet.
Run some rtk commands to start tracking savings.

The advice never appears, because rtk gain is also exempt from the daily [rtk] /!\ No hook installed reminder — it is exempt on the grounds that it prints its own.

Cause

In src/analytics/gain.rs, the hook_check::status() block sits inside the default-view branch (if !daily && !weekly && !monthly && !all), which is itself after the summary.total_commands == 0 early return. Two gates, so four of five views and the empty report never reach it.

Reproduction

Measured with an isolated HOME holding a .claude directory and no hook registered, counting [warn] No hook installed lines:

invocation warnings
rtk gain (with data) 1
rtk gain --daily 0
rtk gain --weekly 0
rtk gain --all 0
rtk gain (empty database) 0

Expected

Every text view reports it, including the empty one. The JSON and CSV exports return before this point and should stay free of it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/analytics/gain.rs and trace the summary.total_commands == 0 early return and the hook_check::status() block inside the default-view branch. Check each text invocation listed in the reproduction, while preserving the early returns for JSON and CSV exports. Done means every text view, including an empty report, reports the missing or outdated hook.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
85/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.