Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/en/customization/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Kimi Code CLI supports 13 lifecycle events:
| `SubagentStop` | When subagent ends | Agent name | `agent_name`, `response` |
| `PreCompact` | Before context compaction | Trigger reason | `trigger`, `token_count` |
| `PostCompact` | After context compaction | Trigger reason | `trigger`, `estimated_token_count` |
| `Notification` | When notification is delivered | Sink name | `sink`, `notification_type`, `title`, `body`, `severity` |
| `Notification` | When notification is delivered | Notification type | `sink`, `notification_type`, `title`, `body`, `severity` |

## Configuring Hooks

Expand All @@ -56,11 +56,11 @@ matcher = "WriteFile|StrReplaceFile"
command = ".kimi/hooks/protect-env.sh"
timeout = 10

# Desktop notification when approval needed
# Desktop notification when a background task finishes
[[hooks]]
event = "Notification"
matcher = "permission_prompt"
command = "osascript -e 'display notification \"Kimi needs attention\" with title \"Kimi CLI\"'"
matcher = "task[.]completed|task[.]failed"
command = "osascript -e 'display notification \"Kimi task finished\" with title \"Kimi CLI\"'"

# Verify tasks complete before stopping
[[hooks]]
Expand Down
8 changes: 4 additions & 4 deletions docs/zh/customization/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Kimi Code CLI 支持 13 种生命周期事件:
| `SubagentStop` | 子 Agent 结束时 | Agent 名称 | `agent_name`, `response` |
| `PreCompact` | 上下文压缩前 | 触发原因 | `trigger`, `token_count` |
| `PostCompact` | 上下文压缩后 | 触发原因 | `trigger`, `estimated_token_count` |
| `Notification` | 通知发送到 sink 时 | sink 名称 | `sink`, `notification_type`, `title`, `body`, `severity` |
| `Notification` | 通知发送到 sink 时 | 通知类型 | `sink`, `notification_type`, `title`, `body`, `severity` |

## 配置 Hooks

Expand All @@ -56,11 +56,11 @@ matcher = "WriteFile|StrReplaceFile"
command = ".kimi/hooks/protect-env.sh"
timeout = 10

# 需要审批时发送桌面通知
# 后台任务结束时发送桌面通知
[[hooks]]
event = "Notification"
matcher = "permission_prompt"
command = "osascript -e 'display notification \"Kimi needs attention\" with title \"Kimi CLI\"'"
matcher = "task[.]completed|task[.]failed"
command = "osascript -e 'display notification \"Kimi task finished\" with title \"Kimi CLI\"'"

# 会话结束前检查任务完成情况
[[hooks]]
Expand Down
2 changes: 1 addition & 1 deletion tests/hooks/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def test_config_roundtrip_toml():

[[hooks]]
event = "Notification"
matcher = "permission_prompt"
matcher = "task[.]completed|task[.]failed"
command = "notify-send Kimi"
timeout = 5
"""
Expand Down
Loading