[FEATURE] Support Agent/Prompt Hooks Triggered Immediately After Claude Prompts for User Input
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
When using Claude Code in interactive workflows, there is currently no native hook that fires immediately after Claude prompts the user for input (e.g., clarification questions, confirmations, or next-step requests).
While the Notification hook provides a signal that Claude is waiting, it:
- Does not expose the full structured prompt content reliably
- Does not support
promptoragent-type hooks - Requires external workarounds (e.g., transcript parsing, terminal scraping)
This limitation prevents users from building fully automated or semi-autonomous agents that can:
- Intercept Claude’s questions
- Reason over them
- Respond programmatically on the user’s behalf
As a result, users cannot cleanly implement “human-in-the-loop replacement” or delegated decision-making workflows.
Proposed Solution
Introduce a new hook event (e.g., UserInputRequested) with the following capabilities:
Trigger:
Fires immediately after Claude generates a prompt requiring user input, but before control is returned to the user.
Capabilities:
- Supports
promptand/oragenthook types (not justcommand/http) - Provides structured access to:
- The exact prompt text shown to the user
- Relevant conversation context
- Any associated metadata (e.g., permission type, expected input schema)
Optional Response Handling:
Allow the hook to:
- Automatically supply a response (bypassing manual input), or
- Modify / augment the prompt before it is shown to the user
Example Hook Shape:
{
"hooks": {
"UserInputRequested": [
{
"hooks": [
{
"type": "agent",
"prompt": "Analyze Claude's question and respond as the user according to predefined policies.",
"actions": [
{
"id": 1,
"label": "Apply changes",
"description": "Proceed with the proposed code changes.",
},
{
"id": 2,
"label": "Review first",
"description": "Show the diff before making changes."
},
{
"id": 3,
"label": "Add test coverage",
"description": "Add test coverage before implementation (TDD)."
},
{
"id": 4,
"label": "Something Else",
"description": "Specify how to continue."
}
]
}
]
}
]
}
}
Alternative Solutions
1) Extend Notification Hook
- Add support for prompt / agent hook types
- Include full prompt content instead of just a summary message
2) Enhance transcript_path Access
- Provide structured, real-time access to the latest assistant message
- Reduce reliance on brittle parsing logic
3) Expand Elicitation Hook Scope
- Generalize beyond MCP use cases to include all user input prompts
Priority
High - Significant impact on productivity
Feature Category
Interactive mode (TUI)
Use Case Example
- Autonomous Agent Delegation
A background agent intercepts Claude’s clarification questions and answers them based on project context, eliminating manual interruptions.
- Policy Enforcement Layer
Automatically evaluate Claude’s prompts (e.g., “Do you want to run this command?”) and approve/deny based on predefined safety rules.
- Workflow Orchestration
Trigger downstream systems (e.g., CI/CD, task runners) when Claude reaches a decision point requiring input.
- Context-Aware Auto-Responses
Use a secondary model to generate higher-quality or standardized responses to Claude’s questions.
- Task Focus Watchdog
During longer unsupervised runs, the hook agent compares Claude's current
question against the original user prompt to detect drift. If Claude is
asking about refactoring a module when the task was "fix the failing test,"
the agent intervenes — either redirecting Claude back on track or escalating
to the user. This enables longer autonomous sessions without Claude silently
wandering off into tangential work.
Additional Context
Currently, users must rely on fragile workarounds such as:
- Parsing transcript_path
- Scraping terminal output
- Running external daemons triggered by Notification
These approaches are:
- Indirect
- Error-prone
- Difficult to maintain
A first-class hook for user input requests would significantly improve reliability and enable a new class of agentic workflows within Claude Code.
7 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
## Why this is NOT a duplicate of #10168 / #13024 / #36707
All three existing issues ask for the same thing: "notify me when Claude is waiting."
This is not what this issue is about.
This issue goes significantly further:
| Capability | #10168 / #13024 / #36707 | This issue (#42286) |
|---|---|---|
| Trigger on input wait | Yes | Yes |
|
command-type hook (run a script) | Yes | Yes ||
agent/prompt-type hook | No | Yes — a second agent reasons over the question || Auto-respond on behalf of user | No | Yes — hook can supply a response, bypassing manual input |
| Structured prompt content in hook payload | No | Yes — exact prompt text, context, metadata, expected input schema |
| Predefined actions (apply, review, TDD, etc.) | No | Yes — declarative action menu for the agent to choose from |
| Modify/augment the prompt before showing it | No | Yes |
TL;DR:
That's a fundamentally different (and more powerful) capability.
An SDK workaround was explored and is insufficient:
The Claude Code SDK exposes streaming events, so a supervisor agent can watch the worker. But there's no clean way to inject a response into the worker's session mid-conversation. The only option is abort + resume, which loses reasoning context and burns tokens.
The
UserInputRequestedhook would close this gap by making the supervisor a native participant rather than an external watcher that can only kill and restart.this would be really useful..
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
Ah, this was automatically closed -- great way to create a system with perpetual lobotomy! 🎉
@ashwin-ant Hi Ashwin, I think this request could be really generally useful for Claude Code users..
Is there a way to get something like this on the roadmap?
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.