From 99cc3dac589d7e781f22dced9ac0290fdc18a248 Mon Sep 17 00:00:00 2001 From: Lourival Vieira Neto Date: Thu, 26 Nov 2026 20:20:10 -0300 Subject: [PATCH] hooks: a subagent's hand-back draws no question context on-prompt.sh skipped only a prompt that opens with ``. A subagent's hand-back is queued as a prompt too, opening with ``, and on 2026-11-26 one drew the `[question]` context, which told the turn that the maintainer had asked and that it changes nothing. The skip takes that opening as well. Closes #34 Co-Authored-By: Claude Opus 5.5 --- .agents/rules/checks.md | 5 +++-- .claude/hooks/on-prompt.sh | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.agents/rules/checks.md b/.agents/rules/checks.md index c0f216a..6d16a8a 100644 --- a/.agents/rules/checks.md +++ b/.agents/rules/checks.md @@ -379,8 +379,9 @@ indexes, one 75 bytes under the ceiling and one past it. `question.sh` reads a message the maintainer sends for a question, a question mark or an opening interrogative, and `.claude/hooks/on-prompt.sh`, run as the message arrives (`UserPromptSubmit`), tells -the turn that it answers and changes nothing, and reads no background task's notification, which reaches -the turn as a prompt the maintainer did not write: "what is left?" drew seven implement-issue workflows that +the turn that it answers and changes nothing, and reads no background task's notification and no +subagent's hand-back, ``, which reach the turn as prompts the maintainer did not +write: "what is left?" drew seven implement-issue workflows that had to be stopped, when it asked for the list. An order closed by a confirmation tag, "...; entendido?", is a question too, and the check reads it as one: #1865 asked it to read such a message as an order, and the maintainer closed it, since the tag asks whether the order was understood. diff --git a/.claude/hooks/on-prompt.sh b/.claude/hooks/on-prompt.sh index a11c04d..55e9d75 100644 --- a/.claude/hooks/on-prompt.sh +++ b/.claude/hooks/on-prompt.sh @@ -17,8 +17,8 @@ command -v jq > /dev/null || exit 0 prompt=$(mktemp) || exit 0 trap 'rm -f "$prompt"' EXIT printf '%s' "$input" | jq -r '.prompt // empty' > "$prompt" -# a background task's notification reaches the turn as a prompt, and the maintainer wrote none of it -grep -q '^' "$prompt" && exit 0 +# a background task's notification and a subagent's hand-back reach the turn as a prompt, and the maintainer wrote neither +grep -qE '^<(task-notification>|agent-message )' "$prompt" && exit 0 checks="$(dirname "$0")/../../tools/checks" ctx=