musubi-cli 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,77 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "musubi.schema.json",
4
+ "title": "musubi.json",
5
+ "description": "The musubi declaration next to a skill's SKILL.md: the content the skill provides and the content it follows.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["musubi"],
9
+ "properties": {
10
+ "$schema": {
11
+ "type": "string",
12
+ "description": "Where editors find this schema."
13
+ },
14
+ "musubi": {
15
+ "const": "2026-11-19",
16
+ "description": "The date of the musubi definition this file follows."
17
+ },
18
+ "provides": {
19
+ "type": "object",
20
+ "description": "Content this skill provides, by name.",
21
+ "propertyNames": { "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
22
+ "additionalProperties": { "$ref": "#/$defs/provided" }
23
+ },
24
+ "follows": {
25
+ "type": "object",
26
+ "description": "Content this skill follows, by <skill>/<content>.",
27
+ "propertyNames": { "pattern": "^[a-z0-9]+(-[a-z0-9]+)*/[a-z0-9]+(-[a-z0-9]+)*$" },
28
+ "additionalProperties": { "$ref": "#/$defs/followed" }
29
+ }
30
+ },
31
+ "$defs": {
32
+ "provided": {
33
+ "type": "object",
34
+ "additionalProperties": false,
35
+ "required": ["version", "file"],
36
+ "properties": {
37
+ "version": {
38
+ "type": "string",
39
+ "description": "MAJOR.MINOR.PATCH. Raise MAJOR when a following skill can break.",
40
+ "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
41
+ },
42
+ "file": {
43
+ "type": "string",
44
+ "minLength": 1,
45
+ "description": "The content file, relative to the skill folder."
46
+ },
47
+ "check": {
48
+ "type": "string",
49
+ "pattern": "\\.json$",
50
+ "description": "A JSON rules file, relative to the skill folder, that musubi check applies to the examples of following skills."
51
+ }
52
+ }
53
+ },
54
+ "followed": {
55
+ "type": "object",
56
+ "additionalProperties": false,
57
+ "required": ["version", "integrity"],
58
+ "properties": {
59
+ "version": {
60
+ "type": "string",
61
+ "description": "The versions this skill accepts: ^X.Y.Z, ~X.Y.Z, or X.Y.Z.",
62
+ "pattern": "^[\\^~]?(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
63
+ },
64
+ "integrity": {
65
+ "type": "string",
66
+ "description": "The fingerprint of the content at the last check.",
67
+ "pattern": "^sha256-[A-Za-z0-9+/]{43}=$"
68
+ },
69
+ "examples": {
70
+ "type": "array",
71
+ "description": "Files of this skill that the provider's check is applied to.",
72
+ "items": { "type": "string", "minLength": 1 }
73
+ }
74
+ }
75
+ }
76
+ }
77
+ }
@@ -0,0 +1,242 @@
1
+ # musubiの定義
2
+
3
+ 定義の版は`2026-11-19`。
4
+
5
+ musubiは、エージェントのスキルが出す中身 (文書の書式や書き方の決まりなど) を、その中身に従うスキルと結ぶ。
6
+ 出す側のスキルは中身を名前と版で宣言し、使う側のスキルはその中身に従うと宣言する。
7
+ エージェントは`SKILL.md`を読むどのエージェントでも同じ仕方で中身を読み込み、中身が変わると従うスキルを確かめ直す。
8
+ 正の定義は英語の[musubi.md](musubi.md)で、この文書はその日本語の訳である。
9
+
10
+ ## 全体の形
11
+
12
+ musubiに加わるスキルは、`SKILL.md`をAgent Skillsが決める形のまま持ち、その横に`musubi.json`を1つ足す。
13
+
14
+ | file | 書く人 | 持つ物 |
15
+ |---|---|---|
16
+ | `SKILL.md` | スキルを書く人 | Agent Skillsの頭の欄と本文 (変えない)。本文がエージェントに、どの中身を読むかを伝える |
17
+ | `musubi.json` | スキルを書く人か`musubi add` | スキルが出す中身と、従う中身 |
18
+ | 中身のfile | 出す側 | 書式、書き方の決まりなど、使う側が従う文 |
19
+ | 検査のfile | 出す側 | `musubi check`が使う側の例に回すJSONの決まり |
20
+
21
+ ```text
22
+ skills/
23
+ ├── design-doc/ 出す側のスキル
24
+ │ ├── SKILL.md 出す中身ごとにfileを名指す
25
+ │ ├── musubi.json "provides": design 1.0.0
26
+ │ ├── formats/design.md 中身
27
+ │ └── checks/design.json 検査の決まり
28
+ └── api-design/ 使う側のスキル
29
+ ├── SKILL.md design-doc/design を指す3行
30
+ ├── musubi.json "follows": design-doc/design ^1.0.0 と指紋
31
+ └── examples/orders-api.md 検査を回す例
32
+ ```
33
+
34
+ ここで使う語は[GLOSSARY.ja.md](../GLOSSARY.ja.md)が定める。
35
+
36
+ ## 出す側の宣言
37
+
38
+ 出す側のスキルは、出す中身を`musubi.json`の`provides`に並べる。
39
+
40
+ ```json
41
+ {
42
+ "$schema": "../../../schema/2026-11-19/musubi.schema.json",
43
+ "musubi": "2026-11-19",
44
+ "provides": {
45
+ "design": { "version": "1.0.0", "file": "formats/design.md", "check": "checks/design.json" }
46
+ }
47
+ }
48
+ ```
49
+
50
+ | 欄 | 要るか | 意味 |
51
+ |---|---|---|
52
+ | `$schema` | 任意 | 編集の画面がJSON Schemaを見つける所 (`schema/<日付>/musubi.schema.json`) |
53
+ | `musubi` | 要る | このfileが従う定義の版 |
54
+ | `provides.<名前>` | 中身ごとに1つ要る | 中身の名前。小文字の語を`-`でつなぐ |
55
+ | `provides.<名前>.version` | 要る | 中身の版 (`MAJOR.MINOR.PATCH`) |
56
+ | `provides.<名前>.file` | 要る | 中身のfile。スキルのフォルダからの相対path |
57
+ | `provides.<名前>.check` | 任意 | JSONの決まりのfile。スキルのフォルダからの相対pathで、検査の決まりの節が形を決める |
58
+
59
+ 中身はfile 1つと、任意で付ける検査1つの組で、`design-doc/design`のように`<スキル名>/<名前>`で呼ぶ。
60
+ 中身ごとに版を持つので、1つを変えてもほかの中身の版は変わらない。
61
+ pathはスキルのフォルダの中に留める。
62
+ `musubi check`は絶対pathと、フォルダの外へ出るpathを拒む。
63
+ エージェントは出す側の`SKILL.md`の本文を読んでfileを見つけるので、出す側の本文は中身ごとにfileを名指す (判断の記録[0002](../docs/adr/0002-agents-open-the-provider-by-name.ja.md))。
64
+ `SKILL.md`がAgent Skillsの検査を通り続けるよう、宣言は頭の欄でなく別の`musubi.json`に書く (判断の記録[0001](../docs/adr/0001-declarations-in-musubi-json.ja.md))。
65
+
66
+ ## 使う側の宣言
67
+
68
+ 使う側のスキルは、従う中身を`musubi.json`の`follows`に並べる。
69
+
70
+ ```json
71
+ {
72
+ "musubi": "2026-11-19",
73
+ "follows": {
74
+ "design-doc/design": {
75
+ "version": "^1.0.0",
76
+ "integrity": "sha256-yNSwpBT+xXEV5bGBqedpHmjWIHVi+JaAnRATAJ0s7wM=",
77
+ "examples": ["examples/orders-api.md"]
78
+ }
79
+ }
80
+ }
81
+ ```
82
+
83
+ | 欄 | 要るか | 意味 |
84
+ |---|---|---|
85
+ | `follows.<スキル>/<中身>` | 中身ごとに1つ要る | 従う中身 |
86
+ | `follows.<名前>.version` | 要る | 使う側が従える版。版と指紋の節が形を決める |
87
+ | `follows.<名前>.integrity` | 要る | 最後に確かめた時の中身の指紋 |
88
+ | `follows.<名前>.examples` | 任意 | 出す側の検査を回す、使う側のfile |
89
+
90
+ 使う側の`SKILL.md`の本文は、従う中身ごとに次の3行を持つ。
91
+ 3行は`musubi add`が出す。
92
+
93
+ ```text
94
+ Write in the `design` format of the `design-doc` skill: open the `design-doc` skill by name and read the file it names for `design`.
95
+ If the `musubi` command is available, run `musubi check` before reading, and stop if it fails.
96
+ If the `design-doc` skill is not installed, do not start: tell the user that `design-doc` is missing and how to install it, then stop.
97
+ ```
98
+
99
+ 中身のfileが命令のscriptの時は、1行目が書式として読む代わりに回すことを伝える。
100
+ scriptかどうかは、大文字と小文字を問わず拡張子`.py`、`.sh`、`.bash`、`.js`、`.mjs`、`.cjs`、`.ts`で見分ける。
101
+
102
+ ```text
103
+ Run the `verify` of the `design-doc` skill: open the `design-doc` skill by name and run the file it names for `verify`.
104
+ ```
105
+
106
+ 使う側は、従う中身に自分の節を足せる。
107
+ 出す側の検査が求める物を外すことと、名前を変えることはできない。
108
+ 1つのスキルが中身を出し、同時に別の中身に従ってもよい。
109
+ 出す側の書式が共通の書き方の決まりに従う形がこれに当たる。
110
+
111
+ ## 見つけ方と読み込み方
112
+
113
+ エージェントは`SKILL.md`の本文を読んで中身を読み込み、スキルを使う間に`musubi.json`は読まない。
114
+ そのため、musubiを知らないエージェントも、命令を持つエージェントと同じ仕方で中身を読み込む。
115
+
116
+ 1. エージェントは、ほかのスキルと同じように使う側の`SKILL.md`を読む。
117
+ 2. 本文が出す側のスキルと中身を名指す。エージェントは入っているスキルから出す側のスキルを名前で開き、その本文がその中身に名指すfileを読む。
118
+ 3. エージェントはそのfileだけを丸ごと読み、出す側のほかの中身は読まない。
119
+ 4. 出す側のスキルが入っていない時、エージェントは書き始めず、足りないスキルとその入れ方を人に伝えて止まる。
120
+
121
+ Claude Code、Codex、GitHub Copilot CLI、Gemini CLIはどれも入っているスキルを名前で並べるので、スキルがどこに入っていても名前で開ける。
122
+ 別々のpluginから入った2つのスキルは隣り合わないので、スキルのフォルダどうしの相対pathは使わない。
123
+
124
+ `musubi check`と`musubi graph`は、命令に渡したフォルダからスキルを読む。
125
+ フォルダを渡さない時は、今のフォルダとhomeのフォルダの`.claude/skills`、`.agents/skills`、`.github/skills`、`.gemini/skills`を読む。
126
+ そのどれかの直下に在り、`SKILL.md`を持つフォルダがスキルで、名前はフォルダの名前である。
127
+ 同じ名前のスキルが2つのフォルダに在る時は、上の順で先のフォルダの物を使い、`musubi check`がもう1つを知らせる。
128
+
129
+ エージェントは中身のfileを丸ごと読むので、`musubi check`は500行を超える中身を知らせる。
130
+ 500行はAgent Skillsが`SKILL.md`に勧める長さである。
131
+ そのような中身も拒まず、長い中身は出す側が複数の中身に分ける。
132
+
133
+ ## 版と指紋
134
+
135
+ 中身の版は`MAJOR.MINOR.PATCH`で表す。
136
+
137
+ | 中身か検査の変更 | 上げる数 |
138
+ |---|---|
139
+ | 使う側が壊れうる変更。要る節や列を外すか名前を変える、検査を厳しくする | `MAJOR` |
140
+ | 使う側が使ってよい物を足す変更。任意の節を足すなど | `MINOR` |
141
+ | どの使う側も通ったままの、言い回しの変更 | `PATCH` |
142
+
143
+ 使う側は、従える版を次の3つの形のどれかで書き、npmと同じ仕方で読む。
144
+
145
+ | 形 | 従える版 | 例 |
146
+ |---|---|---|
147
+ | `^X.Y.Z` | `X.Y.Z`から次の`MAJOR`の手前まで。`0.Y.Z`は次の`MINOR`の手前まで | `^1.2.0`は`1.9.4`に従い、`2.0.0`には従わない |
148
+ | `~X.Y.Z` | `X.Y.Z`から次の`MINOR`の手前まで | `~1.2.0`は`1.2.7`に従い、`1.3.0`には従わない |
149
+ | `X.Y.Z` | `X.Y.Z`だけ | `1.2.0` |
150
+
151
+ 指紋は、使う側が最後に何と照らして確かめたかを残す。
152
+ エージェントは出す側の`SKILL.md`と中身のfileを読み、検査は使う側が通るかを決めるので、指紋はこの3つのfileを含める。
153
+
154
+ ```text
155
+ for each path in [SKILL.md, <file>, <check, when present>]:
156
+ hash.update(path + "\n" + byte length in decimal + "\n")
157
+ hash.update(the file's bytes)
158
+ hash.update("\n")
159
+ integrity = "sha256-" + base64(sha256 digest)
160
+ ```
161
+
162
+ pathは出す側のスキルのフォルダからの相対で、区切りに`/`を使う。
163
+ 版の範囲と指紋は`musubi.json`に並べて書き、lockfileは持たない (判断の記録[0003](../docs/adr/0003-range-and-fingerprint-without-a-lockfile.ja.md))。
164
+
165
+ 定義そのものの版は日付で表す。
166
+ `musubi.json`と検査のfileは、従う日付を`musubi`の欄に書く。
167
+ `musubi check`は知っている日付を全て読み、ほかの日付を拒む。
168
+ 知っている日付は`schema/`の下のフォルダである。
169
+
170
+ ## 確かめ直し方
171
+
172
+ 使う側は、スキルを入れた後と、スキルを更新した後と、`musubi`の命令が在る時はエージェントが中身を読む前に確かめ直す。
173
+
174
+ `musubi check`は次の時に、fileと行を名指して拒む。
175
+
176
+ - `musubi.json`がJSONとして読めない、定義の知らない欄を持つ、知らない定義の版を名指す
177
+ - 版が`MAJOR.MINOR.PATCH`でない、範囲が3つの形のどれでもない
178
+ - file、検査、例のpathがスキルのフォルダの外へ出るか、無いfileを名指す
179
+ - 検査がJSONの決まりのfileでない
180
+ - 使う側が、入っていないスキルか、そのスキルが出していない中身に従う
181
+ - 出す側の版が使う側の範囲の外に在る
182
+ - 指紋が合わない。最後に確かめた後に中身が変わったことを表す
183
+ - 例が出す側の検査の決まりに合わない
184
+ - スキルどうしが輪になって従う (`alpha -> beta -> alpha`など)
185
+
186
+ 輪にならない限り、どの深さの従い方も許す。
187
+ 指紋が合わない時、その中身はまだ受け入れていないので、`musubi check`はその出す側の検査を回さない。
188
+ `musubi check --update`は変わった中身に検査を回し、全ての例が通った時だけ指紋を書き換える。
189
+ 1つでも落ちた時は、指紋を元のまま残す。
190
+ `--update`を付けない`musubi check`はfileを書かない。
191
+
192
+ | 終わり方 | 意味 |
193
+ |---|---|
194
+ | `0` | 全ての宣言と例が通った。知らせを出すことがある |
195
+ | `1` | 1つ以上の問題が在り、`<file>:<行>: <文>`の形で出した |
196
+ | `2` | 命令の呼び方が違う |
197
+
198
+ ## 検査の決まり
199
+
200
+ 検査のfileは、定義の版と決まりの一覧を持つJSONである。
201
+ `musubi check`は決まりを読み、使う側が名指した例それぞれに回す。
202
+ 出す側のcodeは走らせない (判断の記録[0004](../docs/adr/0004-checks-are-json-rules.ja.md))。
203
+
204
+ ```json
205
+ {
206
+ "musubi": "2026-11-19",
207
+ "rules": [
208
+ { "kind": "headings", "headings": ["## Purpose and scope", "## Decisions", "## Open decisions"] },
209
+ { "kind": "forbid", "text": ["Fill in:"] },
210
+ { "kind": "table-columns", "heading": "## Decisions", "columns": ["Option", "Chosen", "Why"] }
211
+ ]
212
+ }
213
+ ```
214
+
215
+ | 種類 | 欄 | 例が通る時 |
216
+ |---|---|---|
217
+ | `headings` | `headings` (見出しの行) | 全ての見出しの行がこの順で在る。間にほかの見出しが在ってよい |
218
+ | `forbid` | `text` (文の断片) | どの行もその文を含まない |
219
+ | `table-columns` | `heading`、`columns` | 見出しの下の最初の表が全ての列を持つ。ほかの列が在ってよい |
220
+
221
+ 決まりは、囲んだcodeの区画の中の行を読み飛ばす。
222
+ 各決まりは求める物だけを探すので、使う側が足した節は通る。
223
+ 新しい種類の決まりは、新しい定義の版で足す。
224
+
225
+ ## 既にある仕組みとの関係
226
+
227
+ | 仕組み | やること | musubiとの関係 |
228
+ |---|---|---|
229
+ | スキルを入れる道具 (APM、npx skills、skillpmなど) | スキルとその依存を入れ、版を固定する | スキルの入手先はこの道具が持つ。`musubi.json`はスキルと中身と版だけを書くので、入手先は1か所に書く |
230
+ | Claude Codeのpluginの`dependencies` | pluginが頼るpluginを入れる | 入れる道具と同じ。この欄を持たないエージェントでは、使う側の本文の止まる1行に頼る |
231
+ | Agent Skills | `SKILL.md`とスキルのフォルダを決める | `SKILL.md`は変えず、`musubi.json`はフォルダの中の1つのfileに留まる。musubiは本物のスキルで動いた後に、Agent Skillsへ提案する |
232
+ | Agent Skillsの依存のfileとlockfileの提案 | スキルが頼るスキルを宣言する | どのスキルを入れるかを書く。musubiは、そのスキルのどの中身にどの版で従うかを書き、確かめ直す |
233
+
234
+ ## musubiの命令
235
+
236
+ 命令はNode.js 22.18以降で動き、実行時の依存を持たない。
237
+
238
+ | 命令 | やること |
239
+ |---|---|
240
+ | `musubi check [<フォルダ>...] [--update]` | フォルダの全ての`musubi.json`を、確かめ直し方の節のとおりに確かめる |
241
+ | `musubi add <スキル>/<中身> [<フォルダ>...]` | 使う側のフォルダで回す。`musubi.json`に範囲`^<今の版>`と指紋を書き、既に在る欄を残し、`SKILL.md`に置く3行を出す |
242
+ | `musubi graph [<フォルダ>...] [--out <file>]` | スキルごとの箱と、従う中身への矢印を描いたHTMLを1枚書く |
package/spec/musubi.md ADDED
@@ -0,0 +1,233 @@
1
+ # The musubi definition
2
+
3
+ Definition version `2026-11-19`.
4
+
5
+ musubi binds the content one agent skill provides, such as a document format or writing rules, to the skills that follow it.
6
+ A skill declares that content under a name and a version, another skill declares that it follows it, agents load it the same way in every agent that reads `SKILL.md`, and the skills that follow it are checked again when it changes.
7
+ This English text is the normative definition; [musubi.ja.md](musubi.ja.md) is its Japanese translation.
8
+
9
+ ## Overview
10
+
11
+ A skill that takes part keeps its `SKILL.md` as Agent Skills defines it and adds one file, `musubi.json`, next to it.
12
+
13
+ | File | Written by | Holds |
14
+ |---|---|---|
15
+ | `SKILL.md` | The skill's author | The Agent Skills frontmatter and body, unchanged. The body tells agents which content to read |
16
+ | `musubi.json` | The author, or `musubi add` | The content the skill provides and the content it follows |
17
+ | A content file | The provider | A format, writing rules, or any other text that consumers follow |
18
+ | A check file | The provider | JSON rules that `musubi check` applies to the consumers' examples |
19
+
20
+ ```text
21
+ skills/
22
+ ├── design-doc/ provider skill
23
+ │ ├── SKILL.md names the file of each content it provides
24
+ │ ├── musubi.json "provides": design 1.0.0
25
+ │ ├── formats/design.md the content
26
+ │ └── checks/design.json the check rules
27
+ └── api-design/ consumer skill
28
+ ├── SKILL.md three lines that point at design-doc/design
29
+ ├── musubi.json "follows": design-doc/design ^1.0.0 and its fingerprint
30
+ └── examples/orders-api.md an example the check is applied to
31
+ ```
32
+
33
+ [GLOSSARY.md](../GLOSSARY.md) defines the terms used here.
34
+
35
+ ## Provider declaration
36
+
37
+ A provider skill lists its content under `provides` in `musubi.json`.
38
+
39
+ ```json
40
+ {
41
+ "$schema": "../../../schema/2026-11-19/musubi.schema.json",
42
+ "musubi": "2026-11-19",
43
+ "provides": {
44
+ "design": { "version": "1.0.0", "file": "formats/design.md", "check": "checks/design.json" }
45
+ }
46
+ }
47
+ ```
48
+
49
+ | Field | Required | Meaning |
50
+ |---|---|---|
51
+ | `$schema` | No | Where editors find the JSON Schema, `schema/<date>/musubi.schema.json` |
52
+ | `musubi` | Yes | The definition version the file follows |
53
+ | `provides.<name>` | Yes, one per content | The content name: lowercase words joined by `-` |
54
+ | `provides.<name>.version` | Yes | The content's version, `MAJOR.MINOR.PATCH` |
55
+ | `provides.<name>.file` | Yes | The content file, relative to the skill folder |
56
+ | `provides.<name>.check` | No | A JSON rules file, relative to the skill folder, described in Check rules |
57
+
58
+ Each content is one file with at most one check, and it is named `<skill>/<name>`, such as `design-doc/design`.
59
+ Each content has its own version, so changing one does not change the version of the others.
60
+ Paths stay inside the skill folder; `musubi check` refuses absolute paths and paths that leave it.
61
+ The provider's `SKILL.md` body names the file of each content, because agents find the file by reading that body (decision record [0002](../docs/adr/0002-agents-open-the-provider-by-name.md)).
62
+ `musubi.json` is a separate file, not a frontmatter field, so that `SKILL.md` keeps passing the Agent Skills checks (decision record [0001](../docs/adr/0001-declarations-in-musubi-json.md)).
63
+
64
+ ## Consumer declaration
65
+
66
+ A consumer skill lists the content it follows under `follows` in `musubi.json`.
67
+
68
+ ```json
69
+ {
70
+ "musubi": "2026-11-19",
71
+ "follows": {
72
+ "design-doc/design": {
73
+ "version": "^1.0.0",
74
+ "integrity": "sha256-yNSwpBT+xXEV5bGBqedpHmjWIHVi+JaAnRATAJ0s7wM=",
75
+ "examples": ["examples/orders-api.md"]
76
+ }
77
+ }
78
+ }
79
+ ```
80
+
81
+ | Field | Required | Meaning |
82
+ |---|---|---|
83
+ | `follows.<skill>/<content>` | Yes, one per content | The content followed |
84
+ | `follows.<ref>.version` | Yes | The versions the consumer accepts, described in Versions and fingerprints |
85
+ | `follows.<ref>.integrity` | Yes | The fingerprint of the content at the last check |
86
+ | `follows.<ref>.examples` | No | Files of the consumer that the provider's check is applied to |
87
+
88
+ The consumer's `SKILL.md` body carries three lines for each content it follows, which `musubi add` prints.
89
+
90
+ ```text
91
+ Write in the `design` format of the `design-doc` skill: open the `design-doc` skill by name and read the file it names for `design`.
92
+ If the `musubi` command is available, run `musubi check` before reading, and stop if it fails.
93
+ If the `design-doc` skill is not installed, do not start: tell the user that `design-doc` is missing and how to install it, then stop.
94
+ ```
95
+
96
+ When the content's file is a script, told apart by the extensions `.py`, `.sh`, `.bash`, `.js`, `.mjs`, `.cjs`, and `.ts` in any case, the first line tells the agent to run it instead of reading it as a format.
97
+
98
+ ```text
99
+ Run the `verify` of the `design-doc` skill: open the `design-doc` skill by name and run the file it names for `verify`.
100
+ ```
101
+
102
+ A consumer may add its own sections to the content it follows.
103
+ It may not remove or rename what the provider's check requires.
104
+ A skill may both provide content and follow content; a provider's format may follow shared writing rules, for example.
105
+
106
+ ## Discovery and loading
107
+
108
+ Agents load content by reading `SKILL.md` bodies, and never read `musubi.json` while they use a skill.
109
+ An agent that knows nothing of musubi therefore loads content the same way as one that has the command.
110
+
111
+ 1. The agent reads the consumer's `SKILL.md`, as it does for any skill.
112
+ 2. The body names the provider skill and the content. The agent opens the provider skill by name from the skills it has installed and reads the file that the provider's body names for that content.
113
+ 3. The agent reads only that file, whole. It does not read the provider's other content.
114
+ 4. When the provider skill is not installed, the agent does not start; it tells the user which skill is missing and how to install it, and stops.
115
+
116
+ Claude Code, Codex, GitHub Copilot CLI, and Gemini CLI each list installed skills by name, so opening a skill by name works wherever the skill is installed.
117
+ Relative paths between skill folders are not used, because two skills from different plugins are not installed side by side.
118
+
119
+ `musubi check` and `musubi graph` read skills from the folders named on the command line.
120
+ Without folders they read `.claude/skills`, `.agents/skills`, `.github/skills`, and `.gemini/skills` in the current folder and in the home folder.
121
+ A skill is a folder directly inside one of them that holds `SKILL.md`, and its name is the folder name.
122
+ When two folders hold a skill of the same name, the first folder in that order wins and `musubi check` warns about the other.
123
+
124
+ Agents read a content file whole, so `musubi check` warns when one is over 500 lines, the length Agent Skills suggests for `SKILL.md`.
125
+ It does not refuse such content; a provider splits a long content into several.
126
+
127
+ ## Versions and fingerprints
128
+
129
+ A content version is `MAJOR.MINOR.PATCH`.
130
+
131
+ | Change to the content or its check | Raise |
132
+ |---|---|
133
+ | A consumer can break: a required section or column is removed or renamed, or the check becomes stricter | `MAJOR` |
134
+ | Something is added that consumers may use, such as an optional section | `MINOR` |
135
+ | Wording changes that keep every consumer valid | `PATCH` |
136
+
137
+ A consumer writes the versions it accepts in one of three forms, read the way npm reads them.
138
+
139
+ | Form | Accepts | Example |
140
+ |---|---|---|
141
+ | `^X.Y.Z` | From `X.Y.Z` up to the next `MAJOR`; for `0.Y.Z`, up to the next `MINOR` | `^1.2.0` accepts `1.9.4`, not `2.0.0` |
142
+ | `~X.Y.Z` | From `X.Y.Z` up to the next `MINOR` | `~1.2.0` accepts `1.2.7`, not `1.3.0` |
143
+ | `X.Y.Z` | Only `X.Y.Z` | `1.2.0` |
144
+
145
+ The fingerprint records exactly what the consumer was last checked against.
146
+ It covers the provider's `SKILL.md`, the content file, and the check file, because an agent reads the first two and the check decides whether the consumer passes.
147
+
148
+ ```text
149
+ for each path in [SKILL.md, <file>, <check, when present>]:
150
+ hash.update(path + "\n" + byte length in decimal + "\n")
151
+ hash.update(the file's bytes)
152
+ hash.update("\n")
153
+ integrity = "sha256-" + base64(sha256 digest)
154
+ ```
155
+
156
+ Paths are relative to the provider's skill folder and use `/`.
157
+ The range and the fingerprint sit together in `musubi.json`; there is no lockfile (decision record [0003](../docs/adr/0003-range-and-fingerprint-without-a-lockfile.md)).
158
+
159
+ The definition itself is versioned by date.
160
+ Each `musubi.json` and each check file names the date it follows in `musubi`, and `musubi check` reads every date it knows and refuses the others.
161
+ The dates it knows are the folders under `schema/`.
162
+
163
+ ## Re-checking
164
+
165
+ A consumer is checked again after a skill is installed, after a skill is updated, and, when the `musubi` command is available, before an agent reads the content.
166
+
167
+ `musubi check` refuses, naming the file and the line, when:
168
+
169
+ - `musubi.json` is not valid JSON, has a field the definition does not know, or names a definition version it does not know
170
+ - a version is not `MAJOR.MINOR.PATCH`, or a range is not one of the three forms
171
+ - a file, check, or example path leaves the skill folder or names a missing file
172
+ - a check is not a JSON rules file
173
+ - a consumer follows a skill that is not installed, or a content that skill does not provide
174
+ - the provider's version is outside the consumer's range
175
+ - the fingerprint does not match, which means the content changed after the last check
176
+ - an example breaks a rule of the provider's check
177
+ - skills follow each other in a cycle, such as `alpha -> beta -> alpha`
178
+
179
+ Chains of any depth are allowed as long as they do not form a cycle.
180
+ When a fingerprint does not match, `musubi check` does not apply that provider's check, because its content has not been accepted.
181
+ `musubi check --update` applies the check to the changed content and rewrites the fingerprint only when every example passes; when one fails, the fingerprint stays as it was.
182
+ `musubi check` without `--update` never writes a file.
183
+
184
+ | Exit status | Meaning |
185
+ |---|---|
186
+ | `0` | Every declaration and example passed; warnings may be printed |
187
+ | `1` | At least one problem, printed as `<file>:<line>: <message>` |
188
+ | `2` | The command was called the wrong way |
189
+
190
+ ## Check rules
191
+
192
+ A check file is JSON with the definition version and a list of rules.
193
+ `musubi check` reads the rules and applies them to each example the consumer names; it never runs provider code (decision record [0004](../docs/adr/0004-checks-are-json-rules.md)).
194
+
195
+ ```json
196
+ {
197
+ "musubi": "2026-11-19",
198
+ "rules": [
199
+ { "kind": "headings", "headings": ["## Purpose and scope", "## Decisions", "## Open decisions"] },
200
+ { "kind": "forbid", "text": ["Fill in:"] },
201
+ { "kind": "table-columns", "heading": "## Decisions", "columns": ["Option", "Chosen", "Why"] }
202
+ ]
203
+ }
204
+ ```
205
+
206
+ | Kind | Fields | An example passes when |
207
+ |---|---|---|
208
+ | `headings` | `headings`: heading lines | Every heading line appears, in this order. Other headings may come between them |
209
+ | `forbid` | `text`: pieces of text | No line contains any of the text |
210
+ | `table-columns` | `heading`, `columns` | The first table under the heading has every column. It may have more |
211
+
212
+ Rules skip lines inside fenced code blocks.
213
+ A consumer's added sections pass, because each rule looks only for what it requires.
214
+ A new kind of rule is added by a new definition version.
215
+
216
+ ## Relation to existing systems
217
+
218
+ | System | What it does | How musubi relates |
219
+ |---|---|---|
220
+ | Skill installers (APM, npx skills, skillpm, and others) | Install skills and their dependencies, and lock versions | They own where a skill comes from. `musubi.json` names only the skill, the content, and the version, so the source is written once |
221
+ | Claude Code plugin `dependencies` | Install the plugins a plugin depends on | Same as installers. Agents without such a field rely on the stop line in the consumer's body |
222
+ | Agent Skills | Defines `SKILL.md` and the skill folder | `SKILL.md` is unchanged and `musubi.json` is one more file in the folder. musubi is to be proposed to Agent Skills once it runs on real skills |
223
+ | Agent Skills proposals for dependency files and lockfiles | Declare which skills a skill needs | They say which skill to install. musubi says which content of it a skill follows, at which version, and checks it again |
224
+
225
+ ## The musubi command
226
+
227
+ The command needs Node.js 22.18 or later and has no runtime dependencies.
228
+
229
+ | Command | Does |
230
+ |---|---|
231
+ | `musubi check [<folder>...] [--update]` | Checks every `musubi.json` in the folders, as described in Re-checking |
232
+ | `musubi add <skill>/<content> [<folder>...]` | Run in a consumer's folder: writes the range `^<current version>` and the fingerprint into its `musubi.json`, keeps the fields already there, and prints the three lines for its `SKILL.md` |
233
+ | `musubi graph [<folder>...] [--out <file>]` | Writes one HTML page that draws each skill and an arrow to each content it follows |