Repository navigation
fix(shortcut): dispatch magic words only from the user's own prompt - #48
Merged
Merged
Conversation
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>
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.
What
shortcut-prompt.pymatched magic words in everyUserPromptSubmitpayload, 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 withafk modewhile 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:
afk modeAnother Claude session sent a message:/<agent-message>wrapper[Subagent hand-back]body<task-notification>[SYSTEM NOTIFICATION …]<agent-messagemid-sentence, plusbrief mebrief memake test: 4/4.Not verified
The exact
promptstring 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