claude-code - ✅(Solved) Fix [hookify] Add "ask" action type to prompt user for approval (maps to permissionDecision: "ask") [1 pull requests, 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#46996Fetched 2026-04-13 05:44:15
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
labeled ×2

Error Message

  • warn — shows message, allows operation
  • warn is too weak — the model can reason past it The warn action relies on the model's self-discipline to follow the warning message. As documented in issue #46991, the model can reason past warnings by deciding conversation context implies approval. The ask action would put the decision in the user's hands via a native Claude Code permission prompt, which the model cannot bypass.

Root Cause

The warn action relies on the model's self-discipline to follow the warning message. As documented in issue #46991, the model can reason past warnings by deciding conversation context implies approval. The ask action would put the decision in the user's hands via a native Claude Code permission prompt, which the model cannot bypass.

PR fix notes

PR #47490: feat(hookify): add ask action support

Description (problem / solution / changelog)

Summary

  • add action: ask support for hookify rules on PreToolUse
  • normalize action: confirm to the same approval flow for compatibility with the issue examples
  • fall back to a warning on non-PreToolUse hooks where native approval prompts are not available
  • document the new action and cover it with focused unittest coverage

Testing

  • python3 -m unittest discover -s plugins/hookify/tests -p 'test_*.py'

Closes #46996

Changed files

  • plugins/hookify/README.md (modified, +1/-0)
  • plugins/hookify/commands/help.md (modified, +1/-1)
  • plugins/hookify/commands/hookify.md (modified, +4/-2)
  • plugins/hookify/core/config_loader.py (modified, +15/-2)
  • plugins/hookify/core/rule_engine.py (modified, +16/-1)
  • plugins/hookify/skills/writing-rules/SKILL.md (modified, +1/-0)
  • plugins/hookify/tests/test_rule_engine.py (added, +95/-0)

Code Example

{
  "hookSpecificOutput": {
    "hookEventName": "PreToolUse",
    "permissionDecision": "ask"
  },
  "systemMessage": "<rule message>"
}

---

---
name: confirm-systemctl
enabled: true
event: bash
pattern: systemctl\s+(enable|disable|stop|start)\s+
action: ask
---

You are changing a systemd service state. Confirm this is approved.
RAW_BUFFERClick to expand / collapse

Feature request

The hookify plugin currently supports two action types:

  • warn — shows message, allows operation
  • block — hard deny, no override possible

Claude Code's native hook system supports a third permissionDecision value: "ask", which prompts the user to approve or deny the specific operation. Hookify should expose this as action: ask (or action: confirm).

Use case

I have a hookify rule that guards systemctl enable/disable/stop/start commands. These should require my explicit approval per-command, but:

  • warn is too weak — the model can reason past it
  • block is too strong — I can't approve legitimate operations without editing the rule file or running the command manually with !

What I need is: show me a prompt, I click approve or deny. That's exactly what permissionDecision: "ask" does natively.

Proposed change

In the hookify rule engine (core/rule_engine.py), when a matching rule has action: ask, return:

{
  "hookSpecificOutput": {
    "hookEventName": "PreToolUse",
    "permissionDecision": "ask"
  },
  "systemMessage": "<rule message>"
}

Rule file example

---
name: confirm-systemctl
enabled: true
event: bash
pattern: systemctl\s+(enable|disable|stop|start)\s+
action: ask
---

You are changing a systemd service state. Confirm this is approved.

Why this matters

The warn action relies on the model's self-discipline to follow the warning message. As documented in issue #46991, the model can reason past warnings by deciding conversation context implies approval. The ask action would put the decision in the user's hands via a native Claude Code permission prompt, which the model cannot bypass.

extent analysis

TL;DR

To implement the requested feature, modify the hookify rule engine to support an action: ask type that returns a permissionDecision: "ask" response, prompting the user for approval.

Guidance

  • Update the core/rule_engine.py file to handle the new action: ask type and return the proposed JSON response with permissionDecision: "ask".
  • Add support for the action: ask type in the hookify rule parser to correctly interpret the new action type in rule files.
  • Test the new feature with a sample rule file, such as the provided confirm-systemctl example, to ensure it behaves as expected.
  • Consider adding documentation and examples for the new action: ask type to help users understand its usage and benefits.

Example

# In core/rule_engine.py
if rule['action'] == 'ask':
    return {
        "hookSpecificOutput": {
            "hookEventName": "PreToolUse",
            "permissionDecision": "ask"
        },
        "systemMessage": rule['message']
    }

Notes

The implementation details may vary depending on the existing code structure and requirements of the hookify plugin. Additionally, it's essential to ensure that the new feature is properly tested and validated to avoid introducing any regressions or security vulnerabilities.

Recommendation

Apply workaround by modifying the core/rule_engine.py file to support the new action: ask type, as this will provide the desired functionality without requiring a full upgrade or rewrite of the existing codebase.

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