-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
hookskimi-cliRelated to Kimi CLIRelated to Kimi CLIopportunityConcrete PR opportunityConcrete PR opportunity
Description
Target Project
Kimi CLI (MoonshotAI/kimi-cli)
Related Issue(s)
- Kimi #1313 — Feature Request: Add Hooks System
What
Implement a hooks system allowing users to run custom scripts at key lifecycle points:
- PreToolUse / PostToolUse (before/after tool execution)
- PreMessage / PostMessage (before/after sending to LLM)
- Notification (task completion, errors)
- Session lifecycle (start, resume, end)
Why
- Explicit user request in Kimi #1313
- Enables: desktop notifications, logging, safety checks, custom integrations
- Claude Code has hooks but with many bugs (#31469, #31440) — we can learn from their mistakes
Prior Art
Claude Code Hooks (Lessons Learned)
What works:
- JSON config in settings files
- Pattern matching on tool names
- Shell command execution with JSON context on stdin
What breaks (avoid these):
- Hooks not propagated to subagents (#31469)
- Non-deterministic execution order (#31440)
- No timeout on hook scripts (can hang the agent)
Implementation Plan
- Define hook points enum (PRE_TOOL, POST_TOOL, NOTIFICATION, etc.)
- Add hooks config in kimi config file (YAML/JSON)
- Hook runner: spawn subprocess with context on stdin, capture stdout
- Hook result handling: allow hooks to block/modify/log
- Add timeout per hook (default 10s)
- Propagate hooks to subagents
- Built-in hooks: desktop notification on task complete
Estimated Effort
Medium (1-2 weeks)
Status
- Research complete
- Implementation started
- PR submitted
- PR merged
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
hookskimi-cliRelated to Kimi CLIRelated to Kimi CLIopportunityConcrete PR opportunityConcrete PR opportunity