🔇 fix: remove PreToolUse hook to reduce noise#65
Conversation
PreToolUse fires on every tool invocation, causing excessive state transitions. UserPromptSubmit alone is sufficient to signal working state. Removed from all agent hooks (Claude, Codex, Droid), event registrations, and documentation. Amp-Thread-ID: https://ampcode.com/threads/T-019d876e-953d-74ae-aaa4-0d6842e143a6 Co-authored-by: Amp <amp@ampcode.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3c206bf970
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| private static let claudeEvents = ["UserPromptSubmit", "Stop", "Notification"] | ||
|
|
||
| /// Droid hook event names (same lifecycle events as Claude Code). | ||
| private static let droidEvents = ["UserPromptSubmit", "PreToolUse", "Stop", "Notification"] | ||
| private static let droidEvents = ["UserPromptSubmit", "Stop", "Notification"] |
There was a problem hiding this comment.
Keep removing legacy PreToolUse hooks during migration
Because claudeEvents/droidEvents drive both install and uninstall loops, dropping PreToolUse here means existing users who already have that hook registered will never be cleaned up. After upgrade, reinstalling still leaves the old PreToolUse entry active (so the noisy callback continues), and uninstalling deletes the script file but leaves a dangling PreToolUse command in ~/.claude/settings.json/~/.factory/settings.json, which can trigger hook execution errors on future tool invocations.
Useful? React with 👍 / 👎.
Summary
Remove
PreToolUsehook event from all agent hooks. It fires on every tool invocation, causing excessive state transitions and noise.UserPromptSubmitalone is sufficient to signal the working state.Changes
PreToolUsefrom case statements inmori-agent-hook.sh,mori-codex-hook.sh,mori-droid-hook.shPreToolUsefrom Claude and Droid event registrationsagent-hooks.mdandagent-hooks.zh-Hans.mdto reflect the change