MoonshotAI / MoonshotAI/kimi-cli

docs: Hooks documentation example for desktop notification on approval is non-functional

Open Beginner friendly
#2,330 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
11.4k
Forks
1.3k
Avg merge
9h 47m
Merged PRs (30d)
2

Description

What version of Kimi Code CLI is running?
1.44.0

Which open platform/subscription were you using?
Kimi For Coding

Which model were you using?
Kimi-k2.6

What platform is your computer?
macOS

What issue are you seeing?

The official documentation at Hooks Configuration provides the following example:

# 需要审批时发送桌面通知
[[hooks]]
event = "Notification"
matcher = "permission_prompt"
command = "osascript -e 'display notification \"Kimi needs attention\" with title \"Kimi CLI\"'"

This configuration never triggers.

After reviewing the source code, the string permission_prompt has zero references in the entire src/kimi_cli codebase. The permission request (approval) flow is handled directly by the Approval class and ApprovalRuntime via the ACP wire path (ApprovalRequestrequest_permission). It does not create a NotificationEvent or call NotificationManager.publish().

Therefore, the Notification hook with matcher = "permission_prompt" can never match any event, leaving users who configure this per the documentation without any desktop notifications.

What steps can reproduce the bug?

  1. Add the documented configuration to ~/.kimi/config.toml:
[[hooks]]
event = "Notification"
matcher = "permission_prompt"
command = "osascript -e 'display notification \"Kimi needs attention\" with title \"Kimi CLI\"'"
  1. Start Kimi Code CLI (non-yolo mode)
  2. Trigger an operation requiring approval (e.g. Shell tool execution)
  3. Expect a desktop notification — but nothing is triggered

What is the expected behavior?

Either of the following:

  1. Short term: Update the documentation to remove or correct this non-functional example.
  2. Long term: Add a new hook event (e.g. ApprovalRequested) in src/kimi_cli/soul/approval.py request() so users can receive external notifications when approval is actually needed.

Additional information

  • The Notification hook trigger is in src/kimi_cli/soul/kimisoul.py, and only fires when notifications from NotificationManager are delivered to the llm sink. The matcher matches the notification's type field.
  • Currently the only source of Notification events is background task completion (task.completed, task.failed, etc.) in src/kimi_cli/background/manager.py.
  • As a workaround, users can use the PreToolUse hook with matchers like Shell|WriteFile|StrReplaceFile|TaskStop, but this is imprecise (it also fires in yolo/afk mode when no actual approval is requested).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Hooks Configuration page and compare its permission_prompt example with src/kimi_cli/soul/kimisoul.py, src/kimi_cli/soul/approval.py, and src/kimi_cli/background/manager.py. Confirm which hook events are actually emitted and whether the scope is to correct the documentation or pursue a new approval event; done means the published example reflects working behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.