Skip to content

feat(cli): deliver session start and prompt hooks to kimi plugins - #1404

Merged
blafourcade merged 6 commits into
nextfrom
feat/kimi-plugin-hooks
Nov 26, 2026
Merged

blafourcade merged 6 commits into
nextfrom
feat/kimi-plugin-hooks

Conversation

@blafourcade

@blafourcade blafourcade commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Kimi plugins now receive the framework's hooks for the events a real logged-in capture showed firing: SessionStart and UserPromptSubmit.

  • Manifest: the Kimi build lists them inline in the plugin manifest's hooks field, using only event, matcher, command and timeout.
    • ${CLAUDE_PLUGIN_ROOT}/ becomes ./, because Kimi runs a plugin hook from the plugin root.
    • The unread hooks/hooks.json is left out of the tree. A descriptor field, manifestListsHooks, drives that.
  • Adapter: the Kimi adapter is generated from hooks-runtime/parts/.
  • One shared router: a single event router maps each event or warns that it is unmapped. Kimi, Kiro and Antigravity all use it, with an Object.hasOwn guard. hooks.json is parsed once per build.
  • Captures: the payloads are copied verbatim into scripts/__tests__/fixtures/hook-payloads/kimi-*.json (Kimi 0.42.0).

Limits, in docs/COMPATIBILITY.md:

  • UserPromptSubmit carries prompt as a list of text parts, not a string.
  • Whether SessionStart output reaches the model is unverified, because the probe account's model turns were refused (403, no Kimi Code subscription).
  • The tool events and Stop were never reached, so they are not delivered.

Each kept test is mutation-proven. Redundant mirror tests were deleted.

Supersedes #1344, whose Kimi work this takes over.

🤖 Generated with Claude Code

blafourcade and others added 6 commits November 26, 2026 13:04
Kimi reads a plugin's hooks from its manifest, so the plugin build lists the
SessionStart and UserPromptSubmit hooks inline, run from the plugin root, and
ships the scripts with a Kimi host adapter generated from the shared parts.
An event Kimi never fired in a capture is reported by the build. Refusing a
tool call and continuing a turn stay undelivered: no answer to either was
seen taking effect.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The hook merge and Kimi's manifest each mapped events to a tool's own and
reported the ones it never fires; both now go through routeEvents. The
events of a hooks file have one reader, and the plugin presence reads them
only when a manifest asks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…file out

The Kimi manifest is the one stage that reads the plugin's events: it lists
the hooks and reports each event Kimi never fires. The hook merge, Kimi and
Kiro share one router, which shapes each routed event itself.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… share one event router

Kimi's fact that its manifest lists the hooks moves into declareHooks, and
pluginTreeHooksArtifact derives the skipped hooks file from it. The wrapped
command merge maps an event through the shared router, the plugin hooks parse
is memoized, and the SessionStart limit is stated as unverified.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	cli/src/contexts/tools/domain/hooks/wrapped-command-hooks-merge.ts
@blafourcade
blafourcade marked this pull request as ready for review November 26, 2026 12:56
@blafourcade
blafourcade requested a review from a team as a code owner November 26, 2026 12:56
@blafourcade
blafourcade merged commit 994af93 into next Nov 26, 2026
4 checks passed
@blafourcade
blafourcade deleted the feat/kimi-plugin-hooks branch November 26, 2026 12:56
current = {
host: HOST,
event,
files: filesOf(event, writtenFiles(tool, input, cwd, raw.tool_response)),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants