claude-code - 💡(How to fix) Fix [FEATURE] PermissionRequest hook: allow setting custom description when returning permissionDecision: "ask" [2 comments, 2 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#53799Fetched 2026-04-28 06:47:02
View on GitHub
Comments
2
Participants
2
Timeline
5
Reactions
12
Timeline (top)
labeled ×3commented ×2

Fix Action

Fix / Workaround

  • No workaround — currently there's no way to customize the permission prompt copy from a hook.

Code Example

{ "permissionDecision": "ask" }

---

{
  "permissionDecision": "ask",
  "description": "This command matches the 'kubectl delete' guard. Confirm you intend to delete a live cluster resource."
}

---

Allow bash command?

  kubectl delete pod my-pod -n production

Hook: This command matches the 'kubectl delete' guard.
    Confirm you intend to delete a live cluster resource.

  [ Allow ]  [ Deny ]
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

When a PermissionRequest hook returns permissionDecision: "ask", the user sees the native Claude Code permission prompt — but the prompt only shows the tool name and input. The hook has no way to inject context explaining why it escalated this specific request for human approval.

This makes hooks that conditionally escalate feel opaque to the user. Example hook response:

{ "permissionDecision": "ask" }

The user sees a generic Allow bash command? dialog with no context about which hook matched or why it flagged the command. For hooks that guard a broad pattern (e.g., kubectl delete, systemctl stop, terraform apply -destroy), the raw tool input alone isn't enough for an informed decision.

Proposed Solution

Allow the hook response to include an optional description (or reason) field that gets surfaced in the permission prompt when permissionDecision: "ask":

{
  "permissionDecision": "ask",
  "description": "This command matches the 'kubectl delete' guard. Confirm you intend to delete a live cluster resource."
}

The permission prompt would display this description below the tool input — giving the user the hook author's context before approving or denying.

I prefer deterministic with my hook instead of auto mode, sorry about that 😅

Mockup:

Allow bash command?

  kubectl delete pod my-pod -n production

  ⚠ Hook: This command matches the 'kubectl delete' guard.
    Confirm you intend to delete a live cluster resource.

  [ Allow ]  [ Deny ]

Alternative Solutions

  • No workaround — currently there's no way to customize the permission prompt copy from a hook.

Use Case Example

  1. I have a PermissionRequest hook that matches any terraform apply command containing -destroy.
  2. The hook returns permissionDecision: "ask" so I must explicitly approve.
  3. Without description, I see a generic prompt — I have to read the raw command to understand what I'm approving.
  4. With description, the prompt immediately says: "Flagged by destroy-guard hook: this will permanently delete infrastructure. Approve only if you have reviewed the plan output."
  5. Especially useful in multi-hook setups where multiple rules can escalate and the user needs to know which rule fired.
<img width="445" height="205" alt="Image" src="https://github.com/user-attachments/assets/7ea37c8c-59ae-4ed8-9ab8-a527e3481cbe" />

I want to customize this message Destroy all terraform-managed infrastructure.

Additional Context

Priority: Medium — Would be very helpful
Feature Category: Configuration and settings

Related issues:

  • #46996 — hookify plugin requesting same ask action (third-party, but same root need)
  • #29782 — custom message on deny side

extent analysis

TL;DR

To address the issue, consider adding an optional description field to the hook response when permissionDecision is set to "ask", allowing for customized context to be displayed in the permission prompt.

Guidance

  • Review the proposed solution of adding a description field to the hook response to provide context for the user when permissionDecision is "ask".
  • Consider the example use case where a PermissionRequest hook matches any terraform apply command containing -destroy and returns permissionDecision: "ask", and how a description field could improve the user experience.
  • Evaluate the potential benefits of displaying the hook author's context in the permission prompt, such as increased transparency and informed decision-making.
  • Investigate related issues, such as #46996 and #29782, to understand the broader context and potential implications of implementing this feature.

Example

{
  "permissionDecision": "ask",
  "description": "This command matches the 'kubectl delete' guard. Confirm you intend to delete a live cluster resource."
}

Notes

The implementation of this feature may require changes to the hook response format and the permission prompt display logic. Additionally, consideration should be given to ensuring that the description field is properly sanitized and displayed to prevent potential security vulnerabilities.

Recommendation

Apply workaround by adding the proposed description field to the hook response, as it provides a clear and effective solution to the problem of lacking context in the permission prompt.

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] PermissionRequest hook: allow setting custom description when returning permissionDecision: "ask" [2 comments, 2 participants]