MoonshotAI / MoonshotAI/kimi-cli
Notification hook with matcher=permission_prompt never triggers
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 11.4k
- Forks
- 1.3k
- Avg merge
- 9h 47m
- Merged PRs (30d)
- 2
Description
Bug Description
The Notification hook with matcher = "permission_prompt" never triggers, even though the documentation explicitly lists this as an example use case.
Configuration Example
[[hooks]]
event = "Notification"
matcher = "permission_prompt"
command = 'powershell.exe -ExecutionPolicy Bypass -File "C:\Users\zhuzh\.kimi\hooks\windows-toast.ps1" -EventType Permission'
timeout = 10
Root Cause Analysis
-
Where
Notificationhooks are triggered:src/kimi_cli/soul/kimisoul.py:877-896, inside thedeliver_pending("llm")callback. Thematcher_valueisview.event.type(the notification's type field). -
Where
NotificationEvents are currently created: Only insrc/kimi_cli/background/manager.py:525, withtype = f"task.{terminal_reason}"(e.g.task.completed,task.failed). -
Where approval/permission requests live: The
ApprovalRuntimeinsrc/kimi_cli/approval_runtime/runtime.pyhandles permission prompts completely independently from theNotificationManager. It never publishes aNotificationEvent. -
Documentation inconsistency: Both
docs/zh/customization/hooks.md:59-63anddocs/en/customization/hooks.md:59-63documentmatcher = "permission_prompt"as a working example, but the code has no implementation for it.
Suggested Fix
Bind NotificationManager to ApprovalRuntime (e.g. in Runtime.__post_init__), and publish a NotificationEvent inside ApprovalRuntime.create_request() with:
category="system"type="permission_prompt"source_kind="approval"targets=["llm", "wire", "shell"]
This would allow the existing Notification hook pipeline to catch permission prompts and run user-configured commands (e.g. desktop toast notifications).
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
Read the Notification hook path in src/kimi_cli/soul/kimisoul.py:877-896, event creation in src/kimi_cli/background/manager.py:525, and approval handling in src/kimi_cli/approval_runtime/runtime.py. Trace Runtime.post_init and ApprovalRuntime.create_request(), then compare the documented examples in docs/en/customization/hooks.md and docs/zh/customization/hooks.md. Done means permission prompts publish a permission_prompt NotificationEvent that the existing matcher and hook pipeline can receive.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell, python
- Domain
- authorization, cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100