Commit 817eb16
committed
docs: add v0.4.0+ plugin format and hook usage spec
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 #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 #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.1 parent dda9e0b commit 817eb16
9 files changed
Lines changed: 780 additions & 3 deletions
File tree
- docs
- examples/hello-mcode-hooks-v04
- .claude-plugin
- io.minimax.mcode/hooks/scripts
- skills
- hello-mcode-hooks-v04
- proposals
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
31 | 50 | | |
32 | 51 | | |
33 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
4 | 20 | | |
5 | 21 | | |
6 | 22 | | |
| |||
51 | 67 | | |
52 | 68 | | |
53 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
54 | 129 | | |
55 | 130 | | |
56 | 131 | | |
57 | 132 | | |
58 | 133 | | |
59 | | - | |
| 134 | + | |
60 | 135 | | |
61 | | - | |
62 | 136 | | |
63 | 137 | | |
64 | 138 | | |
65 | 139 | | |
66 | 140 | | |
67 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
68 | 149 | | |
69 | 150 | | |
70 | 151 | | |
Lines changed: 73 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
0 commit comments