Custom Claude hook without a version tag is reported as outdated; suppress_hook_warning does not cover it, and rtk init -g would remove it
Summary
A hand-written Claude Code hook kept at ~/.claude/hooks/rtk-rewrite.sh, registered in settings.json and delegating every decision to rtk rewrite, is reported as outdated by rtk gain:
[warn] Hook outdated — run `rtk init -g` to update
Three things combine:
hook_status()(src/hooks/init/claude.rs) takes the legacy-script path and reads# rtk-hook-version: Nin the first 5 lines. A custom script has no such tag, so it is version 0, which is belowCURRENT_HOOK_VERSION(4), so the hook is reported as outdated. The tag is not documented indocs/guide/getting-started/configuration.mdor in the hook docs.warn_hook_issues()(src/analytics/gain.rs) never suppresses the outdated arm.suppress_hook_warning = truein[hooks]andRTK_SUPPRESS_HOOK_WARNING=1both leave the line in place.- The advice does damage in this case.
rtk init -gremoves the legacyrtk-rewrite.shentry fromsettings.json("Removed legacy rtk-rewrite.sh entry from settings.json") and installsrtk hook claude. That drops whatever the custom script adds. Ours adds an exemption that keepsgitunwrapped inside worktree-isolated sessions, because the Claude Code isolation guard refusesrtk git .... A previousrtk initreplaced the script in the same way and every worktree session lostgit.
Related: #4512 (missing-hook arm, non-Claude harnesses). This issue is about the outdated arm and a custom Claude hook.
Reproduction
rtk 1.1.0 (Homebrew, macOS arm64).
# settings.json PreToolUse:Bash -> ~/.claude/hooks/rtk-rewrite.sh (custom script, no version tag)
printf '[hooks]\nsuppress_hook_warning = true\n' >> "$HOME/Library/Application Support/rtk/config.toml"
rtk gain | head -1 # [warn] Hook outdated
RTK_SUPPRESS_HOOK_WARNING=1 rtk gain | head -1 # [warn] Hook outdated
# add "# rtk-hook-version: 4" as line 2 of the script
rtk gain | head -1 # no warning
Request
Any one of these would close it:
- let
suppress_hook_warningcover the outdated arm too, or add a separate key for it; - document
# rtk-hook-version:as the contract for custom hooks; - for a legacy script whose body calls
rtk rewrite, say thatrtk init -gwill replace it, instead of only recommending it.
wshm · Automated triage by AI
🔍 Automated Triage
| 🐛 Category | bug |
| 🟠 Priority | high |
| 🎯 Confidence | 86% |
Summary
Custom Claude hooks without a version tag are falsely flagged outdated, suppress_hook_warning doesn't cover it, and rtk init -g's fix destroys custom hook logic — add a suppression key/fix and document the version tag contract.
📁 Relevant files
src/hooks/init/claude.rssrc/analytics/gain.rsdocs/guide/getting-started/configuration.md
Suggested Actions
- Make suppress_hook_warning / RTK_SUPPRESS_HOOK_WARNING also suppress the outdated arm in warn_hook_issues() (src/analyt…
- Document
# rtk-hook-version: Nas the required contract for custom hooks in configuration.md - Have rtk init -g warn before overwriting a custom script that delegates to
rtk rewrite, instead of silently replacing… - Cross-reference #4512 (missing-hook arm) and #4757 (CLAUDE_CONFIG_DIR outdated-never-clears) — related hook-status logic
Triaged automatically by wshm · This is an automated analysis, not a human review.