Add a new plugin, plugins/rtk, holding one hook primitive that a consumer deploys with apm install (Claude target: merged into .claude/settings.json, ownership recorded in .claude/apm-hooks.json). On a PreToolUse call with matcher Bash, it runs:
command -v rtk >/dev/null 2>&1&&exec rtk hook claude ||exit0
With rtk on PATH, the call is rewritten by rtk; without it, the hook exits 0 and the command runs as typed.
Why
Consumers that make rtk a required tool need its hook in the tracked project settings. A hand-written hook entry there is owned by nothing: since apm-cli 0.29.0, apm audit --ci compares only apm-owned hook entries, so it neither flags nor protects a hand-written one. Shipped as a primitive, apm owns the entry and the audit checks that it is present and unaltered. A separate plugin keeps it opt-in per repository and keeps plugins/git about git.
Notes
Executable primitive: consumers allow it with apm approve and commit the executables entry in their apm.yml; say so in the plugin README.
The guard is required: the hook must be harmless on a machine without rtk.
No rtk init of any kind in the plugin: a project-level rtk init writes a CLAUDE.md, and a global rtk init -g is the user's own choice.
Test with rtk present (a git status call is rewritten; rtk hook check or a live session) and absent (unchanged, exit 0). Say in the README what happens when the user also has a global rtk init -g hook: if the two double-wrap a command, document how to detect it (rtk init --show).
A consumer that hand-writes a byte-identical entry next to the deployed one gets "ambiguous duplicate APM-owned hook entry" from apm audit (read in apm-cli 0.36.1); mention it in the README.
rtk hook claude exists in rtk 0.42.4; state the minimum rtk version the hook was tested with.
## What
Add a new plugin, `plugins/rtk`, holding one hook primitive that a consumer deploys with `apm install` (Claude target: merged into `.claude/settings.json`, ownership recorded in `.claude/apm-hooks.json`). On a `PreToolUse` call with matcher `Bash`, it runs:
```sh
command -v rtk >/dev/null 2>&1 && exec rtk hook claude || exit 0
```
With `rtk` on `PATH`, the call is rewritten by `rtk`; without it, the hook exits 0 and the command runs as typed.
## Why
Consumers that make `rtk` a required tool need its hook in the tracked project settings. A hand-written hook entry there is owned by nothing: since apm-cli 0.29.0, `apm audit --ci` compares only apm-owned hook entries, so it neither flags nor protects a hand-written one. Shipped as a primitive, apm owns the entry and the audit checks that it is present and unaltered. A separate plugin keeps it opt-in per repository and keeps `plugins/git` about git.
## Notes
- Executable primitive: consumers allow it with `apm approve` and commit the `executables` entry in their `apm.yml`; say so in the plugin README.
- The guard is required: the hook must be harmless on a machine without `rtk`.
- No `rtk init` of any kind in the plugin: a project-level `rtk init` writes a `CLAUDE.md`, and a global `rtk init -g` is the user's own choice.
- Test with `rtk` present (a `git status` call is rewritten; `rtk hook check` or a live session) and absent (unchanged, exit 0). Say in the README what happens when the user also has a global `rtk init -g` hook: if the two double-wrap a command, document how to detect it (`rtk init --show`).
- A consumer that hand-writes a byte-identical entry next to the deployed one gets "ambiguous duplicate APM-owned hook entry" from `apm audit` (read in apm-cli 0.36.1); mention it in the README.
- `rtk hook claude` exists in `rtk` 0.42.4; state the minimum `rtk` version the hook was tested with.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What
Add a new plugin,
plugins/rtk, holding one hook primitive that a consumer deploys withapm install(Claude target: merged into.claude/settings.json, ownership recorded in.claude/apm-hooks.json). On aPreToolUsecall with matcherBash, it runs:With
rtkonPATH, the call is rewritten byrtk; without it, the hook exits 0 and the command runs as typed.Why
Consumers that make
rtka required tool need its hook in the tracked project settings. A hand-written hook entry there is owned by nothing: since apm-cli 0.29.0,apm audit --cicompares only apm-owned hook entries, so it neither flags nor protects a hand-written one. Shipped as a primitive, apm owns the entry and the audit checks that it is present and unaltered. A separate plugin keeps it opt-in per repository and keepsplugins/gitabout git.Notes
apm approveand commit theexecutablesentry in theirapm.yml; say so in the plugin README.rtk.rtk initof any kind in the plugin: a project-levelrtk initwrites aCLAUDE.md, and a globalrtk init -gis the user's own choice.rtkpresent (agit statuscall is rewritten;rtk hook checkor a live session) and absent (unchanged, exit 0). Say in the README what happens when the user also has a globalrtk init -ghook: if the two double-wrap a command, document how to detect it (rtk init --show).apm audit(read in apm-cli 0.36.1); mention it in the README.rtk hook claudeexists inrtk0.42.4; state the minimumrtkversion the hook was tested with.