claude-code - 💡(How to fix) Fix [FEATURE] Add turn_status field to Stop hook payload (done vs waiting_on_user) [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#49574Fetched 2026-04-17 08:37:16
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
labeled ×2

Root Cause

(question in the penultimate sentence) silently drop to the floor. False negatives mean I lose my train of thought because no reminder fires.

Code Example

{
  "session_id": "...",
  "transcript_path": "...",
  "stop_hook_active": false,
  "turn_status": "done"
}

---

TURN_STATUS=$(echo "$INPUT" | jq -r '.turn_status')
if [ "$TURN_STATUS" = "waiting_on_user" ]; then
  # write the nudge / surface the prompt / add to approval queue
fi
RAW_BUFFERClick to expand / collapse
  • I searched existing issues and didn't find a duplicate
  • This is a single feature request

Problem Statement

The Stop hook fires at every end-of-turn with the same payload (session_id, transcript_path, stop_hook_active) regardless of whether the assistant finished its work or is genuinely waiting for the user to respond. Hooks that want to react differently in those two cases — reminder/nudge systems, approval queues, "did Claude ask a question I missed?" notifications — have to parse the last assistant text themselves.

Text-based heuristics miss rhetorical questions, quoted questions, and asks phrased with unusual wording. LLM-based classifiers add 2+ seconds of latency per turn-end, which is prohibitive.

Concrete scenario: I built a nudge system that writes a reminder file when Claude finishes a turn waiting on user input. A daemon speaks that reminder aloud after 5 minutes of silence. The regex-based matcher in the hook only checks the final sentence, so responses like:

Want me to build X? Here is what it would do...

(question in the penultimate sentence) silently drop to the floor. False negatives mean I lose my train of thought because no reminder fires.

Proposed Solution

Add a turn_status field to the Stop hook payload:

{
  "session_id": "...",
  "transcript_path": "...",
  "stop_hook_active": false,
  "turn_status": "done"
}

With values "done" or "waiting_on_user". Claude already knows internally whether it ended the turn with a question/ask or a completion — this just exposes it to hooks.

Hook code becomes a one-liner:

TURN_STATUS=$(echo "$INPUT" | jq -r '.turn_status')
if [ "$TURN_STATUS" = "waiting_on_user" ]; then
  # write the nudge / surface the prompt / add to approval queue
fi

Alternative Solutions

  1. Regex-based last-text matching — brittle, misses edge cases (rhetorical questions, unusual phrasings, asks not in the final sentence).
  2. Send last assistant text to an LLM classifier (claude -p) — adds ~2 seconds per turn-end, costs capacity.
  3. Require the model to emit a special end-of-turn token — adds prompt burden, still requires parsing.

None work as well as a deterministic server-side flag.

Priority

Medium

Feature Category

Developer tools

Use Case Example

Escalating-nudge daemon: the assistant finishes a turn asking a question. After 5 minutes of silence the daemon speaks "First reminder…" with the last two sentences of context; at 10 minutes "Second reminder…"; at 15 minutes "Final reminder…". When the user responds, a UserPromptSubmit hook clears the reminder file. Without turn_status, the Stop hook has to classify intent from text. A single .turn_status == "waiting_on_user" check would eliminate all the guessing.

Additional Context

This blocks any hook that wants to react differently to "Claude is done" vs "Claude is asking you something" — approval queues, audit logs, reminder systems, focus-mode integrations, voice modes.

Environment

  • Claude Code Version: 2.1.112
  • Platform: Anthropic API (Max subscription)
  • Operating System: macOS 26.3.1 (arm64, Apple M2 Pro, 16 GB)
  • VS Code: 1.114.0
  • VS Code extension: anthropic.claude-code 2.1.112
  • Terminal/Shell: VS Code integrated terminal, zsh 5.9

extent analysis

TL;DR

Add a turn_status field to the Stop hook payload to accurately determine whether the assistant is waiting for user input or has finished its work.

Guidance

  • The proposed solution involves adding a turn_status field with values "done" or "waiting_on_user" to the Stop hook payload, allowing hooks to react differently based on the assistant's state.
  • This change would simplify the implementation of reminder systems, approval queues, and other features that rely on the assistant's turn status.
  • The turn_status field would provide a deterministic way to determine the assistant's state, eliminating the need for text-based heuristics or LLM-based classifiers.
  • Hooks can use the turn_status field to trigger specific actions, such as writing a reminder file or sending a notification, when the assistant is waiting for user input.

Example

TURN_STATUS=$(echo "$INPUT" | jq -r '.turn_status')
if [ "$TURN_STATUS" = "waiting_on_user" ]; then
  # write the nudge / surface the prompt / add to approval queue
fi

Notes

The proposed solution assumes that the Claude API can provide the turn_status field in the Stop hook payload. If this is not possible, alternative solutions, such as using a regex-based last-text matching or sending the last assistant text to an LLM classifier, may be necessary, although they have their own limitations.

Recommendation

Apply the proposed solution by adding the turn_status field to the Stop hook payload, as it provides a deterministic and efficient way to determine the assistant's state, allowing for more accurate and reliable implementation of features that rely on this information.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [FEATURE] Add turn_status field to Stop hook payload (done vs waiting_on_user) [1 participants]