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
{{ message }}
Repository navigation
scope: standardise rewrite_command output prefix ( vs ) #62
The hook caller is the consumer of this string. If a hook tries to exec rtk git status literally, it would fail (no rtk binary). Either:
(a) The hook does NOT exec the rewrite output directly (uses a different translation)
(b) Users have rtk symlinked or aliased to contextcrawler
(c) There's a latent execution bug nobody's hit yet
Investigation needed
Trace what consumes rewrite_command output end-to-end (hooks::hook_cmd?, the Claude Code hook script?)
Determine whether the rtk prefix is intentional protocol (e.g. the hook script substitutes the binary) or accidental.
If accidental: change rewrite_command to output contextcrawler X + update the ~169 test assertions. Likely also touches tracking::track() callers that store the same string in the DB (which would invalidate historical analytics).
If intentional: document why with a comment block in src/discover/registry.rs.
Why filed separately
Branding sweep #62 is bounded to user-visible STRING content (help text, error prefixes, init messages). The rewrite-output prefix is a CORRECTNESS/PROTOCOL question affecting hook execution semantics, plus would force a destructive change to historical SQLite tracking labels in history.db. Deserves its own scope + plan.
Empirically verified the hook substitutes the broken command:
$ echo '{"tool_input":{"command":"git status"}}' | bash hooks/claude/rtk-rewrite.sh
{"hookSpecificOutput":{
"hookEventName":"PreToolUse",
"permissionDecision":"allow",
"permissionDecisionReason":"ContextCrawler auto-rewrite",
"updatedInput":{"command":"rtk git status"}
}}
$ which rtk
rtk not found
Claude Code's updatedInput.command becomes rtk git status and there is no rtk binary on PATH. The user has not seen errors only because most of the session's traffic goes through codex (which uses contextcrawler ... directly per the AGENTS.md template post-PR #54) and never invokes the rewrite path.
Any raw-command Claude Code user with our hook installed would hit "rtk: command not found" on every rewrite-attempted command.
Fix scope (refined)
Single change in src/discover/registry.rs: replace the literal "rtk " prefix used to build rewritten command strings with "contextcrawler ". Touches:
The internal rewrite_command builder (the "rtk X" literals at lines 487, 758, 608, 623, 794, 2944, 2957)
~169 test assertion strings (Some("rtk git status") etc. — bulk-rewrite via sed/python)
The rtk_cmd SQLite column NAME stays (it's a column identifier, not a value — preserves historical analytics)
The VALUES going INTO rtk_cmd change from "rtk git status" to "contextcrawler git status" (historical rows keep their rtk X label; new rows record under the new label — dashboard will show both bucketed separately for a transition period, eventually the rtk-prefixed bucket ages out)
Migration note for the dashboard
contextcrawler gain aggregates by command label. After the change:
Old rows aggregated as "rtk git" (legacy bucket)
New rows aggregated as "contextcrawler git" / displayed as just "git"
The dashboard's bucket-stripping logic in analytics/gain.rs probably already strips the rtk prefix for display — would need to also strip contextcrawler for the new rows to land in the same bucket.
Recommended sequence
This PR: change rewrite_command output + bulk-fix the ~169 tests
Follow-up: update analytics/gain.rs bucket-stripping to also recognise contextcrawler prefix so old + new rows merge
Optionally: write a one-shot migration contextcrawler migrate-tracking-labels that rewrites legacy rtk X labels in the SQLite DB to contextcrawler X so the transition is clean
Severity: medium-high for any user running the Claude Code hook with raw commands. Worth doing soon.
Activity
thehoff commentedon May 18, 2026
Live confirmation (2026-05-18 session)
Empirically verified the hook substitutes the broken command:
Claude Code's
updatedInput.commandbecomesrtk git statusand there is nortkbinary on PATH. The user has not seen errors only because most of the session's traffic goes through codex (which usescontextcrawler ...directly per the AGENTS.md template post-PR #54) and never invokes the rewrite path.Any raw-command Claude Code user with our hook installed would hit "rtk: command not found" on every rewrite-attempted command.
Fix scope (refined)
Single change in
src/discover/registry.rs: replace the literal"rtk "prefix used to build rewritten command strings with"contextcrawler ". Touches:rewrite_commandbuilder (the"rtk X"literals at lines 487, 758, 608, 623, 794, 2944, 2957)Some("rtk git status")etc. — bulk-rewrite via sed/python)rtk_cmdSQLite column NAME stays (it's a column identifier, not a value — preserves historical analytics)rtk_cmdchange from"rtk git status"to"contextcrawler git status"(historical rows keep theirrtk Xlabel; new rows record under the new label — dashboard will show both bucketed separately for a transition period, eventually the rtk-prefixed bucket ages out)Migration note for the dashboard
contextcrawler gainaggregates by command label. After the change:The dashboard's bucket-stripping logic in
analytics/gain.rsprobably already strips thertkprefix for display — would need to also stripcontextcrawlerfor the new rows to land in the same bucket.Recommended sequence
rewrite_commandoutput + bulk-fix the ~169 testsanalytics/gain.rsbucket-stripping to also recognisecontextcrawlerprefix so old + new rows mergecontextcrawler migrate-tracking-labelsthat rewrites legacyrtk Xlabels in the SQLite DB tocontextcrawler Xso the transition is cleanSeverity: medium-high for any user running the Claude Code hook with raw commands. Worth doing soon.
Merge pull request #72 from thehoff/fix/rewrite-command-prefix-62
Merge pull request #73 from thehoff/release/v0.1.9
fix(branding): comprehensive sweep round 3 (clap help docs + find err…
fix(rewrite): migrate rewrite_command output prefix from `rtk X` to `…
chore(release): v0.1.9