React to events with a mod changedplugins/mods/events
Upstream edited this page at 28 Nov 2026 18:35 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 28 Nov 2026 18:37 UTC.
Upstream edited
Recorded here
Lines+2added
Lines−0removed
From line
282
where the diff opens
First seen
1 Oct 2026
this site's first read of the page
Recorded edits34to this page, all time
The whole hunk
from line 282, old and new numbered
/
from line 282
282282
283283When you send a prompt such as `open a PR for this change`, your message looks the same in the transcript, and Claude also reads a line such as `Current branch: feature/auth` after it. A prompt that doesn't mention a pull request goes through unchanged, and `git` doesn't run.
284284
285To change a `/command`'s arguments, return `next({ ...e, args: newArgs })` from a [`command.run`](https://code.claude.com/docs/en/plugins/mods/api#add-a-command) hook. After you add the `command.run` hook, have any `prompt.submit` hook that rewrites `text` skip the rewrite when `e.command` is set. `e.command` requires Claude Code v2.1.299 or later.
286
285287To stop a prompt, return `{ drop: 'the reason' }` without calling `next`. The text goes back into the user's prompt input, and they see `Prompt dropped by a hook:` followed by your reason, so address the reason to them. Don't rely on `drop` to stop every prompt. For example, a prompt goes through in these cases:
286288
287289* **Your hook returns a `drop` after its `next(e)` call let the prompt through**: the turn still runs, and the hook [fails](#handle-a-hook-that-fails) with a message that includes `a drop after its next() was answered`
No line in this hunk matches that.