Skip to content

fix(shortcut): dispatch magic words only from the user's own prompt - #48

Merged
cmj0121 merged 1 commit into
mainfrom
fix/shortcut-agent-messages
Oct 6, 2026
Merged

cmj0121 merged 1 commit into
mainfrom
fix/shortcut-agent-messages

Conversation

@cmj0121

@cmj0121 cmj0121 commented Oct 6, 2026

Copy link
Copy Markdown
Owner

What

shortcut-prompt.py matched magic words in every UserPromptSubmit payload, including a subagent's hand-back report, a background-task notification and a cross-session message. A word that merely appeared in such text told the model to run a skill the user never asked for (seen twice with afk mode while building #45).

The hook now returns early when the prompt opens with one of the frames Claude Code puts on text the user did not type. Plugin and marketplace bumped to 3.2.1.

Verified

Piped payloads into the hook:

Prompt Result
user text containing afk mode dispatches
hand-back in its Another Claude session sent a message: / <agent-message> wrapper silent
bare [Subagent hand-back] body silent
<task-notification> silent
[SYSTEM NOTIFICATION …] silent
user text that mentions <agent-message mid-sentence, plus brief me dispatches brief me

make test: 4/4.

Not verified

The exact prompt string the hook receives for a hand-back was not captured live. The wrapper form is taken from how the session transcript records the message, and the bare body form is covered as well; a live run in a session with subagents is the remaining check.

Closes #47

🤖 Generated with Claude Code

A subagent's report, a background-task event and a message from
another session all reach UserPromptSubmit as a prompt. A magic word
in one was written by a model, yet the hook told the session to run
its skill: `afk mode` fired twice from reports about the afk skill.

Skip a prompt that opens with one of the frames Claude Code puts on
such text. Matching is on the opening only, so a user who mentions a
frame mid-sentence still gets their word dispatched.

Bump the plugin and the marketplace to 3.2.1.

Closes #47

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cmj0121
cmj0121 merged commit 7fb8b40 into main Oct 6, 2026
2 checks passed
@cmj0121
cmj0121 deleted the fix/shortcut-agent-messages branch October 6, 2026 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

shortcut hook fires on a subagent's report, not only on the user's prompt

1 participant