mdkg 0.1.10 → 0.3.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/README.md +40 -15
  3. package/dist/cli.js +293 -13
  4. package/dist/commands/capability.js +13 -8
  5. package/dist/commands/db.js +185 -1
  6. package/dist/commands/format.js +1 -1
  7. package/dist/commands/spec.js +101 -0
  8. package/dist/commands/work.js +569 -20
  9. package/dist/core/project_db_migrations.js +24 -0
  10. package/dist/core/project_db_queue.js +186 -0
  11. package/dist/core/project_db_snapshot.js +28 -3
  12. package/dist/graph/agent_file_types.js +95 -7
  13. package/dist/graph/capabilities_indexer.js +89 -2
  14. package/dist/graph/frontmatter.js +6 -0
  15. package/dist/graph/node.js +8 -2
  16. package/dist/init/AGENT_START.md +15 -9
  17. package/dist/init/CLI_COMMAND_MATRIX.md +33 -5
  18. package/dist/init/README.md +36 -11
  19. package/dist/init/init-manifest.json +64 -9
  20. package/dist/init/skills/default/verify-close-and-checkpoint/SKILL.md +8 -7
  21. package/dist/init/templates/default/receipt.md +12 -1
  22. package/dist/init/templates/default/spec.md +8 -6
  23. package/dist/init/templates/default/work.md +5 -1
  24. package/dist/init/templates/default/work_order.md +11 -0
  25. package/dist/init/templates/skills/base.SKILL.md +66 -0
  26. package/dist/init/templates/specs/agent.SPEC.md +80 -0
  27. package/dist/init/templates/specs/api.SPEC.md +33 -0
  28. package/dist/init/templates/specs/base.SPEC.md +120 -0
  29. package/dist/init/templates/specs/capability.SPEC.md +45 -0
  30. package/dist/init/templates/specs/integration.SPEC.md +25 -0
  31. package/dist/init/templates/specs/model.SPEC.md +21 -0
  32. package/dist/init/templates/specs/project.SPEC.md +39 -0
  33. package/dist/init/templates/specs/runtime-agent.SPEC.md +49 -0
  34. package/dist/init/templates/specs/runtime-image.SPEC.md +21 -0
  35. package/dist/init/templates/specs/tool.SPEC.md +25 -0
  36. package/dist/util/argparse.js +8 -0
  37. package/package.json +5 -2
@@ -226,14 +226,20 @@ function requireTemplateSchema(type, templateSchemas, filePath) {
226
226
  }
227
227
  return schema;
228
228
  }
229
+ const OPTIONAL_COMPAT_TEMPLATE_KEYS = {
230
+ spec: {
231
+ spec_kind: "scalar",
232
+ },
233
+ };
229
234
  function validateTemplateKeys(frontmatter, schema, filePath) {
230
235
  for (const key of Object.keys(frontmatter)) {
231
- if (!schema.allowedKeys.has(key)) {
236
+ if (!schema.allowedKeys.has(key) &&
237
+ OPTIONAL_COMPAT_TEMPLATE_KEYS[schema.type]?.[key] === undefined) {
232
238
  throw formatError(filePath, `unknown key: ${key}`);
233
239
  }
234
240
  }
235
241
  for (const [key, value] of Object.entries(frontmatter)) {
236
- const expected = schema.keyKinds[key];
242
+ const expected = schema.keyKinds[key] ?? OPTIONAL_COMPAT_TEMPLATE_KEYS[schema.type]?.[key];
237
243
  if (!expected) {
238
244
  continue;
239
245
  }
@@ -30,25 +30,28 @@ Agent operating prompt:
30
30
  - Record skill improvement candidates during normal goal execution; edit `SKILL.md` only when the active node is explicit skill-maintenance work.
31
31
  - Use `mdkg skill list`, `mdkg skill search`, and `mdkg skill show <slug>` for skill discovery.
32
32
  - Use `mdkg capability list/search/show` for deterministic skills, `SPEC.md`, `WORK.md`, core-doc, and design-doc capability discovery.
33
+ - Use `mdkg spec list/show/validate` for focused optional `SPEC.md` capability records.
33
34
  - Use `mdkg index` to refresh JSON compatibility caches and `.mdkg/index/mdkg.sqlite` when SQLite mode is enabled.
34
35
  - Treat `.mdkg/db` as project application state; use `mdkg db init` to create
35
36
  the generic scaffold and enable `db.enabled` without creating an active
36
37
  runtime SQLite database. Use `mdkg db migrate` after init to create or update
37
- the runtime SQLite database with mdkg-owned foundation plus internal local
38
- node:sqlite queue, event/receipt/reducer, and writer lease/CAS foundation
39
- migrations. Queue state is delivery infrastructure, not canonical event
40
- history. Event rows are durable local project DB history; receipts, reducers,
41
- writer leases, and materializers are internal local helper surfaces, and there
42
- is no public `mdkg db queue`, `mdkg db event`, `mdkg db reducer`,
43
- `mdkg db lease`, or `mdkg db materializer` CLI yet. Use `mdkg db verify` and `mdkg db stats` for
38
+ the runtime SQLite database with mdkg-owned foundation plus public local
39
+ node:sqlite queue delivery, internal event/receipt/reducer, writer lease/CAS,
40
+ and queue control migrations. Queue state is delivery infrastructure, not
41
+ canonical event history; use `mdkg db queue ...` to create, pause, enqueue,
42
+ claim, settle, inspect, and drain local queues. Event rows are durable local
43
+ project DB history; receipts, reducers, writer leases, and materializers are
44
+ internal local helper surfaces, with no public `mdkg db event`,
45
+ `mdkg db reducer`, `mdkg db lease`, or `mdkg db materializer` CLI yet. Use `mdkg db verify` and `mdkg db stats` for
44
46
  non-mutating health and summary receipts. Use `mdkg db snapshot seal` for
45
- explicit sealed checkpoints,
47
+ explicit sealed checkpoints; default queue policy is drain, and
48
+ `--queue-policy paused` is only for intentionally paused queues,
46
49
  `mdkg db snapshot verify/status` for checkpoint health, and
47
50
  `mdkg db snapshot dump/diff` for deterministic review aids. Keep
48
51
  `.mdkg/db/runtime/` and WAL/SHM/journal/lock/temp files ignored unless a
49
52
  sealed artifact policy explicitly says otherwise.
50
53
  - Use `mdkg archive add/list/show/verify/compress` for committed source and artifact sidecars under `.mdkg/archive`.
51
- - Use `mdkg work ...` helpers for semantic mirror contracts, work orders, receipts, and artifact registration.
54
+ - Use `mdkg work ...` helpers for semantic mirror contracts, deterministic triggers, work order status, receipt verification, and artifact registration.
52
55
  - Treat work contracts, orders, and receipts as committed semantic mirrors only; never store raw secrets, credentials, live payment state, ledger mutations, or canonical marketplace state in mdkg.
53
56
  - Use `artifact://...` for external/runtime-managed artifacts and `archive://...` for committed mdkg archive sidecars.
54
57
  - Use `mdkg bundle create/list/show/verify` for explicit full `.mdkg` graph snapshot bundles.
@@ -105,6 +108,9 @@ Capability discovery:
105
108
  - `mdkg capability list --kind skill --json`
106
109
  - `mdkg capability search "<query>" --kind spec --json`
107
110
  - `mdkg capability search "<query>" --kind work --json`
111
+ - `mdkg spec list --json`
112
+ - `mdkg spec show <id-or-qid-or-alias> --json`
113
+ - `mdkg spec validate <id-or-qid-or-alias> --json`
108
114
 
109
115
  Conventions:
110
116
  - `AGENTS.md` is the Codex/OpenAI-oriented wrapper doc.
@@ -6,6 +6,9 @@ Verify live help with:
6
6
  - `mdkg --help`
7
7
  - `mdkg help <command>`
8
8
 
9
+ Optional reusable SPEC capability records are accessed through `mdkg spec ...`.
10
+ Repos without SPEC files remain valid.
11
+
9
12
  Primary commands:
10
13
  - `mdkg init`
11
14
  - `mdkg upgrade [--dry-run] [--apply] [--json]`
@@ -16,6 +19,7 @@ Primary commands:
16
19
  - `mdkg pack`
17
20
  - `mdkg skill`
18
21
  - `mdkg capability`
22
+ - `mdkg spec`
19
23
  - `mdkg archive`
20
24
  - `mdkg bundle`
21
25
  - `mdkg work`
@@ -39,7 +43,8 @@ Project database commands:
39
43
  - `mdkg db migrate [--json]`
40
44
  - `mdkg db verify [--json]`
41
45
  - `mdkg db stats [--json]`
42
- - `mdkg db snapshot seal [--json]`
46
+ - `mdkg db queue create|pause|resume|enqueue|claim|ack|fail|dead-letter|release-expired|stats|list|show ... [--json]`
47
+ - `mdkg db snapshot seal [--queue-policy drain|paused] [--json]`
43
48
  - `mdkg db snapshot verify [--json]`
44
49
  - `mdkg db snapshot status [--json]`
45
50
  - `mdkg db snapshot dump [--snapshot <path>] [--output <path>] [--json]`
@@ -53,8 +58,10 @@ Project database commands:
53
58
  queue, event/receipt/reducer, and writer lease/CAS foundation migrations
54
59
  - `mdkg db migrate` records migration order, checksums, and applied timestamps
55
60
  in the configured migration table
56
- - queue tables are durable local delivery state, not canonical event history;
57
- there is no public `mdkg db queue` CLI yet
61
+ - `mdkg db queue ...` exposes durable local delivery operations backed by
62
+ node:sqlite; queue rows are delivery state, not canonical event history
63
+ - paused queues reject enqueue and claim, but ack/fail/dead-letter and
64
+ release-expired remain available so leased work can settle
58
65
  - event tables are durable local history for project DB state transitions;
59
66
  receipts, typed reducers, writer leases, and materializers remain internal
60
67
  helper surfaces in this release, with no public `mdkg db event`,
@@ -64,8 +71,10 @@ Project database commands:
64
71
  - `mdkg db stats` reports table counts, database size, migration state,
65
72
  transient runtime files, receipt-file count, and state snapshot presence
66
73
  - `mdkg db snapshot seal` writes an opt-in sealed checkpoint and manifest under
67
- `.mdkg/db/state`; `snapshot verify/status/dump/diff` inspect and review that
68
- checkpoint without treating raw binary diffs as human-readable truth
74
+ `.mdkg/db/state`; default `--queue-policy drain` requires no ready or leased
75
+ messages, while `--queue-policy paused` allows ready messages only in paused
76
+ queues. `snapshot verify/status/dump/diff` inspect and review that checkpoint
77
+ without treating raw binary diffs as human-readable truth
69
78
  - active `.mdkg/db/runtime/` files and `.mdkg/db` WAL/SHM/journal/lock/temp files are ignored by default
70
79
 
71
80
  Validation commands:
@@ -138,8 +147,19 @@ Capability discovery:
138
147
  - `mdkg capability resolve [query] [--requires <capability>] [--fresh-only] [--json]`
139
148
  - capability records are deterministic cache projections from Markdown
140
149
  - records include source hash, headings, refs, and `indexed_at`
150
+ - SPEC and WORK capability records include read-only `linkage` arrays for related SPECs, work contracts, work orders, and receipts when those graph mirrors exist
141
151
  - normal task, epic, feat, bug, test, and checkpoint nodes are intentionally excluded
142
152
 
153
+ Spec capability records:
154
+ - `mdkg spec list [--json]`
155
+ - `mdkg spec show <id-or-qid-or-alias> [--json]`
156
+ - `mdkg spec validate [<id-or-qid-or-alias>] [--json]`
157
+ - `SPEC.md` is optional; repos with no SPEC files still validate
158
+ - SPEC records describe reusable capability surfaces, not general planning notes
159
+ - `mdkg spec validate` with no ref validates the graph and all optional SPEC records
160
+ - `mdkg spec validate <ref>` also checks that the target SPEC reference exists
161
+ - `mdkg spec ...` is the focused SPEC command family; `mdkg capability ...` remains broader skill/spec/work/core/design discovery
162
+
143
163
  Archive sidecars:
144
164
  - `mdkg archive add <file> [--id <archive.id>] [--kind source|artifact] [--visibility private|internal|public] [--title <title>] [--refs <...>] [--relates <...>] [--json]`
145
165
  - `mdkg archive list [--kind source|artifact] [--visibility private|internal|public] [--ws <alias>] [--json]`
@@ -183,11 +203,19 @@ Subgraph orchestration:
183
203
 
184
204
  Work semantic mirrors:
185
205
  - `mdkg work contract new "<title>" --id <work.id> --agent-id <agent.id> --kind <kind> --inputs <...> --outputs <...> [--required-capabilities <...>] [--pricing-model <...>] [--json]`
206
+ - `mdkg work trigger <work-or-capability-ref> [--id <order.id>] [--title "<title>"] [--requester <ref>] [--enqueue <queue>] [--json]`
186
207
  - `mdkg work order new "<title>" --id <order.id> --work-id <work.id> --requester <ref> [--request-ref <ref>] [--input-refs <...>] [--requested-outputs <...>] [--json]`
208
+ - `mdkg work order status <id-or-qid> [--json]`
187
209
  - `mdkg work order update <id-or-qid> [--status <status>] [--add-input-refs <...>] [--add-artifacts <...>] [--json]`
188
210
  - `mdkg work receipt new "<title>" --id <receipt.id> --work-order-id <order.id> --outcome success|partial|failure [--receipt-status recorded|verified|rejected|superseded] [--json]`
211
+ - `mdkg work receipt verify <id-or-qid> [--json]`
189
212
  - `mdkg work receipt update <id-or-qid> [--receipt-status <status>] [--add-artifacts <...>] [--add-proof-refs <...>] [--add-attestation-refs <...>] [--json]`
190
213
  - `mdkg work artifact add <order-or-receipt-id-or-qid> <file> [--id <archive.id>] [--kind source|artifact] [--json]`
214
+ - `work trigger` accepts a `WORK.md` ref directly or a `SPEC.md` capability ref with exactly one resolvable work contract; it creates a submitted order mirror and never executes work
215
+ - example: `mdkg work trigger work.example --id order.example-1 --requester user://example --json`
216
+ - `work trigger --enqueue <queue>` requires a valid project DB plus an explicitly created active queue, creates a submitted order mirror, and enqueues a local delivery message without executing work
217
+ - `work order status` is read-only and reports deterministic order state plus linked receipts
218
+ - `work receipt verify` is read-only and reports linkage, evidence, archive ref, hash, outcome, and redaction-policy checks
191
219
  - work commands mutate mdkg semantic mirror files only; production order, receipt, feedback, dispute, payment, ledger, marketplace inventory, fulfillment, and execution state remains canonical outside mdkg
192
220
  - do not store raw secrets, credentials, live payment state, ledger mutations, or canonical marketplace state in work mirrors
193
221
  - `artifact://...` refs identify external/runtime-managed artifacts; `archive://...` refs identify committed mdkg archive sidecars
@@ -25,13 +25,14 @@ mdkg search "..."
25
25
  mdkg show <id>
26
26
  mdkg pack <id>
27
27
  mdkg capability search "..."
28
+ mdkg spec list --json
28
29
  mdkg archive list
29
30
  mdkg bundle create --profile private
30
31
  mdkg subgraph list --json
31
32
  mdkg validate
32
33
  ```
33
34
 
34
- This repo is already initialized. Use `mdkg upgrade` to preview safe scaffold updates, `mdkg new` to create work, `mdkg new goal "..."` plus `mdkg goal select/current/next/claim/evaluate` for recursive long-running objectives, `mdkg search`/`mdkg show` to inspect graph state, `mdkg capability ...` to inspect cached skill/spec/work/core/design capabilities, `mdkg capability resolve ...` to rank local and subgraph capabilities, `mdkg archive ...` to register source/artifact sidecars, `mdkg work ...` to create work contract/order/receipt semantic mirrors, `mdkg bundle ...` to create full graph snapshot bundles, `mdkg subgraph ...` to register read-only child graph planning views, `mdkg pack <id>` to build deterministic context, and `mdkg validate` before closeout.
35
+ This repo is already initialized. Use `mdkg upgrade` to preview safe scaffold updates, `mdkg new` to create work, `mdkg new goal "..."` plus `mdkg goal select/current/next/claim/evaluate` for recursive long-running objectives, `mdkg search`/`mdkg show` to inspect graph state, `mdkg capability ...` to inspect cached skill/spec/work/core/design capabilities, `mdkg spec ...` for focused optional SPEC records, `mdkg capability resolve ...` to rank local and subgraph capabilities, `mdkg archive ...` to register source/artifact sidecars, `mdkg work ...` to create work contract/order/receipt semantic mirrors and deterministic trigger/verification records, `mdkg bundle ...` to create full graph snapshot bundles, `mdkg subgraph ...` to register read-only child graph planning views, `mdkg pack <id>` to build deterministic context, and `mdkg validate` before closeout.
35
36
 
36
37
  Agent workflow docs can use semantic ids:
37
38
 
@@ -40,6 +41,12 @@ mdkg new spec "image worker" --id agent.image-worker
40
41
  mdkg new work "generate image" --id work.generate-image
41
42
  ```
42
43
 
44
+ `SPEC.md` is optional. Repos without SPEC files still validate. When present,
45
+ SPEC records describe reusable capability surfaces rather than general planning
46
+ notes. `mdkg spec list/show/validate` is the focused SPEC command family, while
47
+ `mdkg capability ...` remains the broader read-only discovery surface for
48
+ skills, SPECs, WORK contracts, core docs, and design docs.
49
+
43
50
  Read `AGENT_START.md` first when this repo includes it.
44
51
 
45
52
  ## Pack Profiles
@@ -75,17 +82,19 @@ Fresh mdkg workspaces default to `index.backend: sqlite`; `.mdkg/index/mdkg.sqli
75
82
  `.mdkg/index`. Run `mdkg db init` to create the generic scaffold, write
76
83
  `.mdkg/db/project-db.json`, and enable `db.enabled`; it does not create an
77
84
  active runtime SQLite database. Run `mdkg db migrate` after init to create or
78
- update the active runtime SQLite database with mdkg-owned foundation plus
79
- internal local node:sqlite queue, event/receipt/reducer, and writer lease/CAS
80
- foundation migrations. Queue state is delivery infrastructure, not canonical
81
- event history. Event rows are durable local project DB history; receipts,
82
- reducers, writer leases, and materializers are internal local helper surfaces,
83
- and there is no public `mdkg db queue`, `mdkg db event`, `mdkg db reducer`,
84
- `mdkg db lease`, or `mdkg db materializer` CLI yet. Use `mdkg db verify` for non-mutating health checks and
85
+ update the active runtime SQLite database with mdkg-owned foundation plus public
86
+ local node:sqlite queue delivery, internal event/receipt/reducer, writer
87
+ lease/CAS, and queue control migrations. Queue state is delivery
88
+ infrastructure, not canonical event history; use `mdkg db queue ...` to create,
89
+ pause, enqueue, claim, settle, inspect, and drain local queues. Event rows are
90
+ durable local project DB history; receipts, reducers, writer leases, and
91
+ materializers are internal local helper surfaces, with no public `mdkg db event`,
92
+ `mdkg db reducer`, `mdkg db lease`, or `mdkg db materializer` CLI yet. Use `mdkg db verify` for non-mutating health checks and
85
93
  `mdkg db stats` for table counts, DB size, migration state, and receipt-file
86
94
  counts. Use `mdkg db snapshot seal` to create an opt-in sealed checkpoint under
87
- `.mdkg/db/state`, then use `mdkg db snapshot verify/status` for integrity and
88
- freshness checks. Use `mdkg db snapshot dump/diff` as deterministic review aids
95
+ `.mdkg/db/state`; the default queue policy is drain, and
96
+ `--queue-policy paused` is only for intentionally paused queues. Then use
97
+ `mdkg db snapshot verify/status` for integrity and freshness checks. Use `mdkg db snapshot dump/diff` as deterministic review aids
89
98
  for SQLite snapshots. Keep active runtime DB files and transient
90
99
  WAL/SHM/journal, lock, and temp files ignored. Commit schema files, manifests,
91
100
  receipts, and sealed state snapshots only by explicit repo policy.
@@ -144,13 +153,29 @@ Use work lifecycle helpers for semantic mirrors only:
144
153
 
145
154
  ```bash
146
155
  mdkg work contract new "example capability" --id work.example --agent-id agent.example --kind example --inputs prompt:text:required --outputs result:text:required
147
- mdkg work order new "example request" --id order.example-1 --work-id work.example --requester user://example
156
+ mdkg work trigger work.example --id order.example-1 --requester user://example
157
+ mdkg work order status order.example-1 --json
148
158
  mdkg work receipt new "example receipt" --id receipt.example-1 --work-order-id order.example-1 --outcome success
159
+ mdkg work receipt verify receipt.example-1 --json
160
+ ```
161
+
162
+ Create a manual order instead of a trigger-created order when you need to supply
163
+ input refs at order creation time:
164
+
165
+ ```bash
166
+ mdkg work order new "example request" --id order.example-manual --work-id work.example --requester user://example --input-refs archive://archive.example
149
167
  ```
150
168
 
151
169
  Receipt statuses are `recorded`, `verified`, `rejected`, and `superseded`.
152
170
  Update and artifact commands accept local ids or local qids; subgraph qids are read-only and must be changed in their source workspace.
153
171
 
172
+ `mdkg work trigger` creates a deterministic submitted `WORK_ORDER.md` from a
173
+ WORK contract or a SPEC with exactly one resolvable work contract. `mdkg work
174
+ order status` and `mdkg work receipt verify` are read-only review helpers.
175
+ `mdkg work trigger --enqueue <queue>` optionally writes a local project DB queue
176
+ delivery message after the queue has been explicitly created and is active; it
177
+ still does not execute work.
178
+
154
179
  Production orders, receipts, feedback, disputes, payments, ledgers, marketplace inventory, fulfillment records, and execution state remain canonical outside mdkg. mdkg stores committed semantic mirrors and reviewable evidence. Do not store raw secrets, credentials, live payment state, ledger mutations, canonical marketplace state, or bulky raw payloads in these mirrors.
155
180
 
156
181
  Use `artifact://...` for external or runtime-managed artifact identities. Use `archive://...` only for committed mdkg archive sidecars.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema_version": 1,
3
3
  "tool": "mdkg",
4
- "mdkg_version": "0.1.10",
4
+ "mdkg_version": "0.3.0",
5
5
  "files": [
6
6
  {
7
7
  "path": ".mdkg/config.json",
@@ -61,7 +61,7 @@
61
61
  {
62
62
  "path": ".mdkg/README.md",
63
63
  "category": "mdkg_doc",
64
- "sha256": "0b5e7fa852aa71616ac108b2af3fb21b9ab66ee1ea69cb75539ba1df80be1072"
64
+ "sha256": "353aa7318974d4b3dbdf772ae5a3deb2d41b5d71ea5308d260aab8081121548b"
65
65
  },
66
66
  {
67
67
  "path": ".mdkg/skills/build-pack-and-execute-task/SKILL.md",
@@ -81,7 +81,7 @@
81
81
  {
82
82
  "path": ".mdkg/skills/verify-close-and-checkpoint/SKILL.md",
83
83
  "category": "default_skill",
84
- "sha256": "f85ffa4a139db10c3bc3203cde0e4f41603fbc7f3925e6fdaba821346ffa28b8"
84
+ "sha256": "3e4137b7b6a71f088dee79b5ee2f4743aefa3b43adae07337307db89a24416b6"
85
85
  },
86
86
  {
87
87
  "path": ".mdkg/templates/default/archive.md",
@@ -151,7 +151,7 @@
151
151
  {
152
152
  "path": ".mdkg/templates/default/receipt.md",
153
153
  "category": "template",
154
- "sha256": "f08753cc38e02d73a5df92df58c2d34b0d33749b298eeb31d81aa019c38d43dd"
154
+ "sha256": "516faf98abe421f154d162b18006c7875f1a0025ac4d35cc16df744c13548d9d"
155
155
  },
156
156
  {
157
157
  "path": ".mdkg/templates/default/rule.md",
@@ -161,7 +161,7 @@
161
161
  {
162
162
  "path": ".mdkg/templates/default/spec.md",
163
163
  "category": "template",
164
- "sha256": "e3e05d8d627c478d2757451f61b5a8fda8a75da9885a9261b2f8f5cb8a3a36dc"
164
+ "sha256": "8c96e0b6dafa65acb83a2d84519e05a7354896aec8991c148650e9ec58196c77"
165
165
  },
166
166
  {
167
167
  "path": ".mdkg/templates/default/task.md",
@@ -176,17 +176,72 @@
176
176
  {
177
177
  "path": ".mdkg/templates/default/work_order.md",
178
178
  "category": "template",
179
- "sha256": "6ee6007674f30f88153ce79ed67d8c736b4f0998ceb0c8314a3f2cf9c48ac88c"
179
+ "sha256": "5fe376413035f2afe406d13491a597f103a2fce29d137951fe55ae042a1082f5"
180
180
  },
181
181
  {
182
182
  "path": ".mdkg/templates/default/work.md",
183
183
  "category": "template",
184
- "sha256": "9d8b971ded7a587105fb8b14bb79f68b612fa6e1962cf06859bab82e2aee57c7"
184
+ "sha256": "cfc53d3be1d2c31576448d071a579bc3d5d2f6851755e29c20825f6b6764c0aa"
185
+ },
186
+ {
187
+ "path": ".mdkg/templates/skills/base.SKILL.md",
188
+ "category": "template",
189
+ "sha256": "08a1bd65297173a1dc9df95776775d406337a419d4bc51863593b6f28777ebdb"
190
+ },
191
+ {
192
+ "path": ".mdkg/templates/specs/agent.SPEC.md",
193
+ "category": "template",
194
+ "sha256": "dab10c0ed12aa10a752ee3bd61f263065644826eb950c71a9e3458673edb0ca5"
195
+ },
196
+ {
197
+ "path": ".mdkg/templates/specs/api.SPEC.md",
198
+ "category": "template",
199
+ "sha256": "aee86cadcca31a5a015d7e15ad7503c4aa30f2af0079ec03f857b82b3ecbae59"
200
+ },
201
+ {
202
+ "path": ".mdkg/templates/specs/base.SPEC.md",
203
+ "category": "template",
204
+ "sha256": "6d4171fac00c2f3d8f2a2ac746b8a47c59aaecebe224c3a0046dd6e6974a1d08"
205
+ },
206
+ {
207
+ "path": ".mdkg/templates/specs/capability.SPEC.md",
208
+ "category": "template",
209
+ "sha256": "68a91e8bbd80d1ff1972e4c31e29f26451d5a1be1d25d414170fdd670010066f"
210
+ },
211
+ {
212
+ "path": ".mdkg/templates/specs/integration.SPEC.md",
213
+ "category": "template",
214
+ "sha256": "e907ce6ebc1fa5a455e31e39036e3f8699dccb3d9e45288c8ea025eaec4ca4a2"
215
+ },
216
+ {
217
+ "path": ".mdkg/templates/specs/model.SPEC.md",
218
+ "category": "template",
219
+ "sha256": "56061a241819dfda4d3022c075f744cf6650f5f52c58cd15b0af9d1f613af4f2"
220
+ },
221
+ {
222
+ "path": ".mdkg/templates/specs/project.SPEC.md",
223
+ "category": "template",
224
+ "sha256": "386c41852cbb46e7a6ba583a7b0c4126262a56618d8e214aaa601b68d55818b9"
225
+ },
226
+ {
227
+ "path": ".mdkg/templates/specs/runtime-agent.SPEC.md",
228
+ "category": "template",
229
+ "sha256": "53af7c3e172f5ed1297f340aca0be5e53302613d2e6bb9145915067d7b0004c8"
230
+ },
231
+ {
232
+ "path": ".mdkg/templates/specs/runtime-image.SPEC.md",
233
+ "category": "template",
234
+ "sha256": "37416b045cd7733d1f5e1cc629ac9b6616024d5fa52f2bdcd90110267151e593"
235
+ },
236
+ {
237
+ "path": ".mdkg/templates/specs/tool.SPEC.md",
238
+ "category": "template",
239
+ "sha256": "05b827bbce4f721ea25beda62850688aff3db644aec65e71b9cf76cad8e5f46f"
185
240
  },
186
241
  {
187
242
  "path": "AGENT_START.md",
188
243
  "category": "startup_doc",
189
- "sha256": "1e9def4cf02de6eecd164cff7855829dc3632009a2aa801eccb67b89bad4a570"
244
+ "sha256": "cf58e37c72be2593f1d920520dbdc6e316182bfda5c49837443a8b18024504c7"
190
245
  },
191
246
  {
192
247
  "path": "AGENTS.md",
@@ -201,7 +256,7 @@
201
256
  {
202
257
  "path": "CLI_COMMAND_MATRIX.md",
203
258
  "category": "startup_doc",
204
- "sha256": "95bc386d88817ca597ae4f0fe4fa2d904843227a81147d606f54a32b93694c83"
259
+ "sha256": "48c1b7fbef3a01faf5ddf8bb232b19362b49ef2a371a7c38ae11302c8b3bccac"
205
260
  },
206
261
  {
207
262
  "path": "llms.txt",
@@ -46,13 +46,14 @@ Finish work with evidence, validation, and minimal memory drift.
46
46
  Use this local repo-only checklist before publishing mdkg:
47
47
 
48
48
  1. Confirm package intent and version in `package.json`, `package-lock.json`, `README.md`, `CLI_COMMAND_MATRIX.md`, and `CHANGELOG.md`.
49
- 2. Use a clean npm cache: `export NPM_CONFIG_CACHE=/private/tmp/mdkg-npm-cache`.
50
- 3. Run `npm ci`, `npm run build`, `node scripts/assert-publish-ready.js`, `npm run test`, `npm run cli:check`, `node dist/cli.js validate`, `npm run smoke:consumer`, `npm run smoke:matrix`, `npm run smoke:upgrade`, `npm run smoke:init`, `npm run smoke:capabilities`, `npm run smoke:archive-work`, `npm run smoke:bundle`, `npm run smoke:subgraph`, and `npm run smoke:visibility`.
51
- 4. Run `npm pack --dry-run --json` and confirm the tarball includes `dist/cli.js`, compiled folders, `dist/init/`, release docs, and `scripts/postinstall.js`.
52
- 5. Confirm registry state with `npm view mdkg version --registry=https://registry.npmjs.org/`.
53
- 6. Publish only after the registry still shows the previous version and npm auth is known to have write access.
54
- 7. If publishing fails with 2FA or token policy errors, do not commit; fix npm auth or package policy, then rerun publish.
55
- 8. After successful publish, verify `npm view mdkg version` and `npm view mdkg dist-tags`, then commit the release changes.
49
+ 2. Confirm release-line intent before bumping: when a change crosses a capability-track boundary, prefer the next minor release line over patch-style continuation. For the current project DB track, follow `0.1.9 -> 0.2.0` rather than naming the next planned source line `0.1.10`.
50
+ 3. Use a clean npm cache: `export NPM_CONFIG_CACHE=/private/tmp/mdkg-npm-cache`.
51
+ 4. Run `npm ci`, `npm run build`, `node scripts/assert-publish-ready.js`, `npm run test`, `npm run cli:check`, `node dist/cli.js validate`, `npm run smoke:consumer`, `npm run smoke:matrix`, `npm run smoke:upgrade`, `npm run smoke:init`, `npm run smoke:capabilities`, `npm run smoke:archive-work`, `npm run smoke:bundle`, `npm run smoke:subgraph`, and `npm run smoke:visibility`.
52
+ 5. Run `npm pack --dry-run --json` and confirm the tarball includes `dist/cli.js`, compiled folders, `dist/init/`, release docs, and `scripts/postinstall.js`.
53
+ 6. Confirm registry state with `npm view mdkg version --registry=https://registry.npmjs.org/`.
54
+ 7. Publish only after the registry still shows the previous version and npm auth is known to have write access.
55
+ 8. If publishing fails with 2FA or token policy errors, do not commit; fix npm auth or package policy, then rerun publish.
56
+ 9. After successful publish, verify `npm view mdkg version` and `npm view mdkg dist-tags`, then commit the release changes.
56
57
 
57
58
  ## Bundle-Aware Commit Gate
58
59
 
@@ -7,8 +7,10 @@ work_order_id: order.example
7
7
  receipt_status: recorded
8
8
  outcome: success
9
9
  cost_ref: cost.redacted
10
+ redaction_policy: refs_and_hashes_only
10
11
  proof_refs: []
11
12
  attestation_refs: []
13
+ evidence_hashes: []
12
14
  input_hashes: []
13
15
  output_hashes: []
14
16
  tags: []
@@ -38,7 +40,16 @@ archive sidecars.
38
40
 
39
41
  # Proof
40
42
 
41
- Record non-secret proof, attestation, and hash references.
43
+ Record non-secret proof, attestation, and hash references. `evidence_hashes`
44
+ can hash receipt evidence bundles or redacted proof summaries that are not
45
+ stored directly in this file.
46
+
47
+ # Redaction
48
+
49
+ `redaction_policy` records how this mirror avoids raw secrets and canonical
50
+ runtime state. Use refs, hashes, archive refs, artifact refs, and redacted
51
+ summaries instead of credentials, auth headers, live payment state, ledger
52
+ mutations, marketplace inventory, or production runtime state.
42
53
 
43
54
  # Notes
44
55
 
@@ -3,8 +3,9 @@ id: {{id}}
3
3
  type: spec
4
4
  title: {{title}}
5
5
  version: 0.1.0
6
- role: subagent
7
- runtime_mode: room_orchestrated
6
+ spec_kind: capability
7
+ role: tool_service
8
+ runtime_mode: tool_service
8
9
  work_contracts: []
9
10
  requested_capabilities: []
10
11
  skill_refs: []
@@ -13,7 +14,7 @@ model_refs: []
13
14
  wasm_component_refs: []
14
15
  runtime_image_refs: []
15
16
  subagent_refs: []
16
- resource_profile: builder
17
+ resource_profile: local_cli
17
18
  update_policy: manual
18
19
  tags: []
19
20
  owners: []
@@ -28,11 +29,11 @@ updated: {{updated}}
28
29
 
29
30
  # Purpose
30
31
 
31
- Define the agent, package, or runtime specification.
32
+ Define the reusable capability surface.
32
33
 
33
34
  # Runtime
34
35
 
35
- Describe role, runtime mode, resource profile, and update policy.
36
+ Describe the role, runtime mode, resource profile, and update policy.
36
37
 
37
38
  # Work Contracts
38
39
 
@@ -40,4 +41,5 @@ List related WORK.md contracts.
40
41
 
41
42
  # Capabilities
42
43
 
43
- List requested capabilities and relevant constraints.
44
+ List requested capabilities and the authority/resource constraints that govern
45
+ use.
@@ -6,7 +6,7 @@ version: 0.1.0
6
6
  agent_id: agent.example
7
7
  kind: generic
8
8
  pricing_model: quoted
9
- required_capabilities: []
9
+ required_capabilities: [capability.example]
10
10
  skill_refs: []
11
11
  tool_refs: []
12
12
  model_refs: []
@@ -31,6 +31,10 @@ updated: {{updated}}
31
31
 
32
32
  Describe the reusable capability contract.
33
33
 
34
+ Replace `capability.example` with at least one concrete required capability or
35
+ add an explicit dependency ref such as `skill_refs`, `tool_refs`, `model_refs`,
36
+ `wasm_component_refs`, `runtime_image_refs`, or `subagent_refs`.
37
+
34
38
  This file is a semantic mirror for discovery and review. Do not store raw
35
39
  secrets, credentials, live payment state, ledger mutations, marketplace
36
40
  inventory, or canonical execution state here.
@@ -8,7 +8,10 @@ work_version: 0.1.0
8
8
  requester: user.example
9
9
  order_status: submitted
10
10
  request_ref: request.example
11
+ trigger_ref: trigger.manual
12
+ payload_hash: sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
11
13
  input_refs: []
14
+ queue_refs: []
12
15
  requested_outputs: [result:text:required]
13
16
  constraint_refs: []
14
17
  artifact_policy: commit_sidecar_and_zip
@@ -27,6 +30,9 @@ updated: {{updated}}
27
30
 
28
31
  Capture the concrete request against a WORK.md version.
29
32
 
33
+ `payload_hash` should be the stable sha256 of the redacted trigger payload or
34
+ request mirror used to create this order.
35
+
30
36
  This file is a committed semantic mirror, not the canonical execution database.
31
37
  Do not store raw secrets, credentials, live payment state, ledger mutations,
32
38
  marketplace inventory, or bulky payloads here.
@@ -37,6 +43,11 @@ Record committed input references without secrets. Use `archive://...` for mdkg
37
43
  archive sidecars and `artifact://...` for external or runtime-managed artifact
38
44
  identities.
39
45
 
46
+ # Queue refs
47
+
48
+ Queue refs are optional delivery-state pointers. They are not canonical runtime
49
+ state.
50
+
40
51
  # Requested Outputs
41
52
 
42
53
  Document the output descriptors requested from the work contract.
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: {{skill_slug}}
3
+ description: {{description}}
4
+ tags: [stage:plan, writer:orchestrator]
5
+ version: 0.1.0
6
+ authors: [{{owner}}]
7
+ links: []
8
+ ---
9
+
10
+ # Purpose
11
+
12
+ Describe the repeatable workflow and the durable outcome this skill produces.
13
+
14
+ ## When To Use
15
+
16
+ - Trigger condition.
17
+
18
+ ## Inputs
19
+
20
+ - Required context or artifacts.
21
+
22
+ ## Outputs
23
+
24
+ - Result, patch, artifact, report, or handoff.
25
+
26
+ ## Required Capabilities
27
+
28
+ - Capability needed by the worker or orchestrator.
29
+
30
+ ## Resources Touched
31
+
32
+ - Files, repos, services, or mdkg nodes the skill may inspect or mutate.
33
+
34
+ ## Steps
35
+
36
+ 1. Ground in source and mdkg truth.
37
+ 2. Execute the smallest deterministic workflow.
38
+ 3. Record evidence.
39
+
40
+ ## Validation Checks
41
+
42
+ - Command or review gate.
43
+
44
+ ## Closeout Evidence
45
+
46
+ - Evidence required before work can be considered done.
47
+
48
+ ## Failure Modes
49
+
50
+ - Known blocker or ambiguity.
51
+
52
+ ## Safety Rules
53
+
54
+ - No secrets or unrelated broad mutation.
55
+
56
+ ## Related SPECs
57
+
58
+ - SPEC refs.
59
+
60
+ ## Projection Targets
61
+
62
+ - Runtime or agent config projections, if any.
63
+
64
+ ## Open Questions
65
+
66
+ - Question to resolve before implementation.