[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.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗