feat: support hooks in plugins - #1127
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 555d67f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
Merged
7723qqq
pushed a commit
to 7723qqq/kimi-code
that referenced
this pull request
Jul 11, 2026
* feat(agent-core): support per-hook cwd and env in HookEngine * feat(agent-core): support hooks in plugin manifest and aggregate via PluginManager * feat(agent-core): merge plugin hooks into session hook engine * chore: add changeset for plugin hooks (cherry picked from commit 184acf5)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
No related issue. The plugin manifest currently lists
hooksas an unsupported runtime field and silently ignores it; this PR makes it a first-class capability.Problem
Plugins can bundle skills and MCP servers, but they cannot bundle hooks. An author who wants to ship automation that reacts to agent lifecycle events (for example
PreToolUse,UserPromptSubmit, orStop) has to ask every user to wire matchingconfig.tomlhooks by hand, and that configuration does not travel with the plugin.What changed
hooksarray inkimi.plugin.json, using the same shape asconfig.tomlhooks:{ event, matcher, command, timeout }.config.tomlhooks (config entries first). They run with the plugin root as the working directory, and the script can readKIMI_PLUGIN_ROOTandKIMI_CODE_HOMEfrom the environment.cwdandenvare runtime-only: they are not part of the manifest schema, and the existing strict schema rejects them, so a plugin cannot redirect its hooks outside its own directory.hookCountso listings can surface how many hooks a plugin declares.This follows the existing plugin-contribution pattern (skills, MCP servers, session-start) and reuses the current hook engine and config schema, so it adds the capability without introducing new runtime concepts.
Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.Plugin-author documentation for the new
hooksfield is not included yet and can follow in a separate docs PR.