Skip to content

fix: discover doesn't match /usr/bin/grep as rtk grep equivalent #485

@FlorianBruniaux

Description

@FlorianBruniaux

Bug

rtk discover classifies /usr/bin/grep as an unhandled command instead of mapping it to rtk grep.

Reproduce

Run rtk discover on a session where Claude Code used /usr/bin/grep (full path). It appears in "TOP UNHANDLED COMMANDS" instead of "MISSED SAVINGS" with rtk grep as equivalent.

Real example

/usr/bin/grep    7    /usr/bin/grep -rni "twitch" /Users/chr..

Should be classified as:

/usr/bin/grep    7    rtk grep    existing    ~XXX tokens

Root cause

The discover classifier in src/discover/ likely matches on the command name only (grep), not on absolute paths (/usr/bin/grep, /bin/grep).

Fix

Normalize absolute binary paths before classification. Strip leading path components for well-known binaries:

  • /usr/bin/grepgrep
  • /bin/lsls
  • /usr/local/bin/gitgit

This affects any command called via full path in Claude Code bash tool calls.

Impact

7 occurrences missed in one session. Likely affects any user on macOS where Claude Code sometimes resolves to full paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions