Fix install.sh hook maintenance gaps - #137
Merged
Merged
Conversation
Every hook install run backed up ~/.claude/settings.json but never removed old backups, so they accumulated indefinitely (100 files, ~900K by the time this was noticed). Now keeps only the 5 most recent.
find hard-fails under rtk's reimplementation when passed -not or -exec, and bare git diff (without --stat) inconsistently strips its own diff/index/---/+++ headers depending on output size. Several skills (create-pr, commit, test-plan) read full diffs verbatim to write descriptions, so exclude both commands from the hook at the rtk config level instead of working around it in every skill.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two related fixes to how ai/install.sh manages Claude Code hooks.
Every hook install run backs up ~/.claude/settings.json but never removes old backups, so they pile up indefinitely. One machine had accumulated 100 of them going back to July 2025, about 900K of dead weight in ~/.claude. The install step now keeps only the 5 most recent backups after creating a new one.
Separately, rtk's Bash-rewrite hook (registered via
rtk hook claude) turns out to be unsafe for two commands several skills rely on.findhard-fails under rtk's reimplementation when passed-notor-exec. Baregit diff(without--stat) inconsistently strips its own diff/index/---/+++ headers depending on output size, sometimes returning a condensed summary instead of the real patch. create-pr, commit, and test-plan all read full diffs verbatim to write descriptions, so this excludes both commands from the hook via rtk's ownexclude_commandsconfig, applied idempotently on every install.Test plan
exclude_commandsvalue, and a missing config file entirely. Confirmed each behaves correctly (patches, no-ops, warns without clobbering, and bootstraps viartk config --create, respectively).sh -n.