MoonshotAI / MoonshotAI/kimi-cli
Approval prompts should trigger a hook event
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 11.4k
- Forks
- 1.3k
- Avg merge
- 9h 47m
- Merged PRs (30d)
- 2
Description
What feature would you like to see?
Feature Request: Approval prompts should trigger a hook event
What version of Kimi Code CLI is running?
kimi, version 1.12.0
Which open platform/subscription were you using?
Kimi For Coding
What platform is your computer?
macOS 15.4 (Darwin 24.4.0 arm64)
What issue are you seeing?
When the CLI shows an approval prompt (e.g., "Approve / Reject / Approve for session" before executing a Shell command), no hook event is fired. This makes it impossible to configure audio reminders or other automations for approval prompts via ~/.kimi/config.toml hooks.
Current behavior
The approval prompt modal is rendered internally by the UI layer (_activate_prompt_approval_modal) and does not trigger any of the existing hook events (PreToolUse, Notification, etc.).
I have verified this by checking all 13 supported hook events:
PreToolUseis fired before the approval prompt appears, withmatcher_valueset to the tool name (e.g.,Shell), not the approval itself.Notificationis not fired for approval prompts (thepermission_promptmatcher never matches).- No other event covers this interaction.
Expected behavior
Approval prompts should expose a hook event so users can configure reactions (e.g., play a sound, send a system notification) when human confirmation is required.
Suggested implementation
Option A: Re-use PreToolUse with a special matcher_value (e.g., approval:Shell) when an approval is pending.
Option B: Fire a new dedicated event, e.g.:
[[hooks]]
event = "ApprovalPrompt"
command = "osascript -e 'beep'"
matcher = "Shell|WriteFile|StrReplaceFile"
timeout = 5
Option C: Re-use Notification with type = "permission_prompt" so the existing Notification + matcher = "permission_prompt" configuration actually works.
Use case
I rely on audio hooks (play-sound.sh) to alert me when the CLI needs attention. Currently:
AskUserQuestiontriggersPreToolUse→ I hear "选项" ✅- Approval prompts are silent → I miss them if I look away from the terminal ❌
This is especially problematic during long-running tasks where I step away from the keyboard.
Additional information
My current hooks config:
[[hooks]]
event = "PreToolUse"
command = "bash /Users/sen/.kimi/hooks/play-sound.sh"
matcher = "AskUserQuestion"
timeout = 10
[[hooks]]
event = "Notification"
command = "bash /Users/sen/.kimi/hooks/play-sound.sh"
matcher = "permission_prompt"
timeout = 10
The Notification + permission_prompt hook was my attempt to cover approval prompts, but it never triggers because approval prompts do not emit Notification events with type = "permission_prompt".
Additional information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the UI layer's _activate_prompt_approval_modal and trace how the existing hook events are dispatched and matched from ~/.kimi/config.toml. Resolve whether approval prompts should reuse PreToolUse or Notification, or introduce a new event, then verify that a configured hook runs when an approval prompt appears.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100