[FEATURE] Support Agent/Prompt Hooks Triggered Immediately After Claude Prompts for User Input

Status Closed — not planned
Maintainer reply None cached
Activity 7 comments · opened Apr 1, 2026 · closed Jun 12, 2026

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 prompt or agent-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 prompt and/or agent hook types (not just command/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

  1. Autonomous Agent Delegation

A background agent intercepts Claude’s clarification questions and answers them based on project context, eliminating manual interruptions.

  1. 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.

  1. Workflow Orchestration

Trigger downstream systems (e.g., CI/CD, task runners) when Claude reaches a decision point requiring input.

  1. Context-Aware Auto-Responses

Use a secondary model to generate higher-quality or standardized responses to Claude’s questions.

  1. 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.

View original on GitHub ↗

7 Comments

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/10168
  2. https://github.com/anthropics/claude-code/issues/13024
  3. https://github.com/anthropics/claude-code/issues/36707

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

tilo · 5 months ago

## 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:

  • The existing issues are about passive notification.
  • This issue is about active delegation — letting an agent intercept, reason over, and respond to Claude's questions.

That's a fundamentally different (and more powerful) capability.

tilo · 4 months ago

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 UserInputRequested hook would close this gap by making the supervisor a native participant rather than an external watcher that can only kill and restart.

tilo · 3 months ago

this would be really useful..

github-actions[bot] · 2 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

tilo · 2 months ago

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?

github-actions[bot] · 3 days ago

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.