docs: add v0.4.0+ plugin format and hook usage spec - #39
Open
antianqi wants to merge 1 commit into
Open
Conversation
Document the mcode 0.4.0+ plugin layout that @minimax-ai/code@0.4.0+ adopts as the Claude Code compatible preferred form. Plugin authors migrating from the v0.3.x portable Agent Plugins 1.0 layout need a single reference that captures the manifest location, the inline `hooks` shape, the new `skills` field semantics, and the three failure modes that bit mcode-island during the upgrade (PR MiniMax-AI#38). Scope - New proposal `proposals/hooks-v0.4-spec.md` (324 lines) — the authoritative spec for the v0.4.0+ plugin format. Covers package shape, manifest schema, Skills layout (with the silent-drop warning for nested subdirectory paths that do not match the frontmatter `name`), inline Hooks (12 PascalCase events, matcher, timeout, per-handler shape), hook script conventions, migration from v0.3.x, five common pitfalls, test evidence, open questions, primary sources. Companion to the v0.3.x `proposals/hooks-detailed-spec.md` which it does not supersede for the 0.3.x runtime. - Update `docs/plugin-compatibility.md` to add a v0.4.0+ plugin format section, mark `io.minimax.mcode/hooks/hooks.json` as v0.3.x-only, and clarify that Hooks are accepted by mcode 0.4.0+ via the inline manifest field. The portable Agent Plugins 1.0 section is unchanged. - Update `CONTRIBUTING.md` step 2 to add a "Choose a runtime layout" subsection pointing new contributors at the two layouts and the cross-runtime dual-shipment recommendation. - New example `examples/hello-mcode-hooks-v04/` (6 files) — the v0.4.0+ counterpart of `examples/hello-mcode-hooks/`. Demonstrates a `.claude-plugin/plugin.json` manifest with three inline hook handlers, a top-level Skill, a byte-identical subdir Skill copy for the validator and the v0.3.x runtime, and a PowerShell observer script that records events to ${PLUGIN_DATA}/state.json via staging-file rename. Validation - `plugin.json` parses as valid JSON. - `record-event.ps1` parses clean under the PowerShell AST parser (`[System.Management.Automation.Language.Parser]::ParseFile`). - The two `SKILL.md` files are byte-identical (sha256 6502DF1DDACAFF116BB1E0328016D50994F170B8164C3BF8C9D7579653C17A31). - The top-level Skill frontmatter `name` matches the manifest `name` and the subdir name (`hello-mcode-hooks-v04`). - All paths use ${PLUGIN_ROOT} / ${PLUGIN_DATA}; no host-absolute literals, no C:\ or /Users/ or /home/ paths. - No network calls (no Invoke-WebRequest, Invoke-RestMethod, curl, wget, http://...). - No scaffold markers (no TODO, FIXME, XXX, TBD, REPLACE_ME). - Disclosure: no credentials, no network, no telemetry, no third-party services; repeated in README.md and both SKILL.md files per the hello-mcode-hooks convention. - Negative-injection self-audit: injecting a hard-coded `C:\Users\Administrator\...` path into `record-event.ps1` was caught by the path sweep; restoring the staging-file expression brought the file back to clean. Test evidence - The empirical A/B test that proves the silent-drop failure mode and the correct layout is the mcode-island v1.0.0 release (`proposal/mcode-island-0.4-hooks-rebuilt` branch, PR MiniMax-AI#38): `skills: ["./skills/mcode-island"]` -> no hook fire; `skills: ["./skills"]` + top-level `skills/SKILL.md` -> all 12 events fire. Verified on mcode 0.4.2 (Windows 11, PowerShell 5.1). - This PR does not change the validator (`scripts/validate.mjs`). The recommended cross-runtime dual-Skill layout (top-level + byte-identical subdir) is the validator-compatible workaround until the validator learns the top-level layout. Design compliance - No hard-coded host-absolute paths. - No credentials, no network, no telemetry, no third-party services in the example. - Atomic state writes via staging-file rename; UTF-8 without BOM. - 1 commit, 1 branch, 1 PR. No unrelated validator hardening or plugin changes. - File additions only (no removals, no renames), preserving the v0.3.x example and the v0.3.x spec unchanged.
antianqi
force-pushed
the
docs/v0.4-hook-and-plugin-format
branch
from
September 12, 2026 12:40
817eb16 to
9c34417
Compare
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.
What this PR adds
A single reference for Plugin authors who need to target the mcode 0.4.0+ plugin format. The v0.4.0+ runtime (
@minimax-ai/code@0.4.0, 2026-09-11) adopts the Claude Code compatible plugin shape: the manifest moves to.claude-plugin/plugin.json, Hooks are inlined on the manifest, and askillsfield replaces the implicitskills/<name>/SKILL.mddiscovery of the v0.3.x spec. Today there is no documentation of that layout in this repository; Plugin authors migrating from v0.3.x are forced to reverse-engineer the format from the runtime source.Scope
proposals/hooks-v0.4-spec.md(324 lines): package shape, manifest schema, Skills layout (with the silent-drop warning for nested subdirectory paths that do not match the frontmattername), inline Hooks (12 PascalCase events, matcher, timeout, per-handler shape), hook script conventions, migration from v0.3.x, five common pitfalls, test evidence, open questions, primary sources. Companion toproposals/hooks-detailed-spec.md; does not supersede it for the 0.3.x runtime.docs/plugin-compatibility.md: added a v0.4.0+ plugin format section, markedio.minimax.mcode/hooks/hooks.jsonas v0.3.x-only, and clarified that Hooks are accepted by mcode 0.4.0+ via the inline manifest field. Portable Agent Plugins 1.0 section unchanged.CONTRIBUTING.md: added a "Choose a runtime layout" subsection in step 2 pointing new contributors at the two layouts and the cross-runtime dual-shipment recommendation.examples/hello-mcode-hooks-v04/(6 files): the v0.4.0+ counterpart ofexamples/hello-mcode-hooks/. Demonstrates a.claude-plugin/plugin.jsonmanifest with three inline hook handlers, a top-level Skill, a byte-identical subdir Skill copy for the validator and the v0.3.x runtime, and a PowerShell observer script that records events to${PLUGIN_DATA}/state.jsonvia staging-file rename.Design compliance
${PLUGIN_ROOT}and${PLUGIN_DATA}.README.mdand bothSKILL.mdfiles.Test evidence
plugin.jsonparses as valid JSON.record-event.ps1parses clean under the PowerShell AST parser.SKILL.mdfiles are byte-identical (sha2566502DF1DDACAFF116BB1E0328016D50994F170B8164C3BF8C9D7579653C17A31).namematches the manifestnameand the subdir name (hello-mcode-hooks-v04).C:\,D:\,/Users/,/home/) is clean.Invoke-WebRequest,Invoke-RestMethod,curl,wget,http://,https://outside the docs comment) is clean.TODO,FIXME,XXX,TBD,REPLACE_ME,scaffold) is clean (the one existing match inCONTRIBUTING.mdis the original "Replace every scaffoldTODO." instruction, unchanged by this PR).C:\Users\Administrator\...\evil-staging.jsonintorecord-event.ps1was caught by the path sweep; restoring the staging-file expression brought the file back to clean.proposal/mcode-island-0.4-hooks-rebuiltbranch, PR feat(mcode-island)!: rewrite plugin manifest for mcode 0.4.0+ runtime (v1.0.0) #38):skills: ["./skills/mcode-island"]-> no hook fire;skills: ["./skills"]+ top-levelskills/SKILL.md-> all 12 events fire. Verified on mcode 0.4.2 (Windows 11, PowerShell 5.1).Open questions (also captured in the proposal)
skills/SKILL.mdlayout is acceptable for portable cross-runtime Plugins, or whether a separate per-Skill subdirectory is mandatory for Agent Plugins 1.0.hooks.timeoutunits (seconds vs milliseconds) for the inline shape; the current validator accepts both, but the portable shape should pin one.io.minimax.mcode/hooks/hooks.jsonis deprecated in 0.4.0+ or merely ignored. Empirical answer: "ignored"; policy answer proposed: "deprecated for new Plugins, retained for cross-runtime compatibility".Relationship to PR #38
PR #38 is the mcode-island v1.0.0 plugin rewrite that produced the empirical evidence this proposal documents. This PR is documentation only; it does not modify the mcode-island plugin, the validator, or any other hosted Plugin. Plugin authors who want to read about a working example of the v0.4.0+ format alongside the spec should follow the cross-links between this PR and PR #38.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.