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
package/CHANGELOG.md CHANGED
@@ -6,6 +6,75 @@ This project follows a pragmatic changelog style inspired by Keep a Changelog. V
6
6
 
7
7
  mdkg is pre-v1 public alpha software. Command, graph, cache, bundle, and DAL contracts may change quickly while the project converges on a stable v1 surface.
8
8
 
9
+ ## 0.3.0 - Unreleased
10
+
11
+ ### Added
12
+
13
+ - Added optional `SPEC.md` reusable capability records with strict validation
14
+ for supported `spec_kind` values and diagnostics that reject documentation-only
15
+ misuse while keeping repos without SPEC files valid.
16
+ - Added focused `mdkg spec list/show/validate` commands for optional SPEC
17
+ capability discovery alongside the broader `mdkg capability ...` surface.
18
+ - Added a dogfood mdkg CLI `SPEC.md` and linked `WORK.md` contract so the CLI's
19
+ graph, project DB, skill, and tool capabilities are discoverable through the
20
+ same capability index used by downstream repos.
21
+ - Added deterministic `mdkg work trigger`, `mdkg work order status`, and
22
+ `mdkg work receipt verify` helpers for creating submitted work-order mirrors,
23
+ reviewing order/receipt linkage, and validating receipt evidence without
24
+ executing work.
25
+ - Added optional `mdkg work trigger --enqueue <queue>` delivery bridging to the
26
+ public local project DB queue surface. The bridge requires an initialized,
27
+ migrated, verified DB and an explicitly created active queue, records
28
+ delivery refs, and still does not execute work.
29
+ - Added read-only SPEC/WORK capability linkage arrays for related specs, work
30
+ contracts, work orders, and receipts.
31
+ - Added packed `smoke:work-invocation` coverage for trigger-to-order-to-receipt
32
+ verification plus queue bridge delivery from an installed tarball.
33
+
34
+ ### Changed
35
+
36
+ - Hardened default SPEC, WORK, WORK_ORDER, and RECEIPT templates with capability
37
+ metadata, payload hashes, queue refs, evidence hashes, redaction policies, and
38
+ explicit semantic-mirror boundaries.
39
+ - Updated README, command matrix, help snapshots, init assets, and upgrade
40
+ smokes for optional SPEC adoption, work invocation helpers, queue bridge
41
+ behavior, capability linkage, and no-SPEC backward compatibility.
42
+ - Strengthened init and upgrade smokes so fresh workspaces can remain SPEC-free
43
+ while optional SPEC/WORK templates can be created and validated on demand.
44
+
45
+ ### Security
46
+
47
+ - Audited templates, docs, dogfood mirrors, and work invocation command paths for
48
+ no-secret and semantic-mirror boundaries before the 0.3.0 release metadata
49
+ bump. No raw secret, credential, payment, ledger, or canonical production
50
+ state values were identified.
51
+
52
+ ## 0.2.0 - 2026-06-06
53
+
54
+ Release numbering note: future project DB materializer/profile release planning
55
+ should follow `0.1.9 -> 0.2.0` rather than continuing the line as `0.1.10`
56
+ when the release represents a capability-track boundary.
57
+
58
+ ### Added
59
+
60
+ - Added public `mdkg db queue ...` commands for local project DB queue
61
+ create/pause/resume/enqueue/claim/ack/fail/dead-letter/release-expired/stats/list/show.
62
+ - Added `mdkg.project_db.queue_control.v1` / `005_mdkg_project_db_queue_control.sql`
63
+ for first-class queue active/paused state and migration backfill from existing
64
+ queue messages.
65
+ - Added queue-aware snapshot sealing policies: default `--queue-policy drain`
66
+ blocks ready/leased messages, while `--queue-policy paused` allows ready
67
+ messages only in paused queues and always blocks leased messages.
68
+ - Added packed CLI-only `smoke:db-queue-cli` coverage that exercises public
69
+ queue commands and pause/drain snapshot behavior from an installed tarball.
70
+
71
+ ### Changed
72
+
73
+ - Source release line now targets `0.2.0` for the next project DB
74
+ materializer/profile capability track.
75
+ - Project DB queue support is now public under `mdkg db queue`; event, reducer,
76
+ writer lease, and materializer command surfaces remain internal-only.
77
+
9
78
  ## 0.1.10 - 2026-06-05
10
79
 
11
80
  ### Added
package/README.md CHANGED
@@ -14,7 +14,7 @@ mdkg stays deliberately boring:
14
14
  - first-class rebuildable SQLite cache through built-in `node:sqlite`
15
15
  - no daemon, hosted index, or vector DB
16
16
 
17
- Current package version in source: `0.1.10`
17
+ Current package version in source: `0.2.0`
18
18
 
19
19
  mdkg is still pre-v1 public alpha software. The public package is usable, but graph, cache, bundle, and DAL contracts may continue to change quickly while the project converges on a stable v1 surface.
20
20
 
@@ -167,8 +167,16 @@ mdkg index
167
167
  mdkg capability list --kind skill --json
168
168
  mdkg capability search "image worker" --kind work --json
169
169
  mdkg capability show <id-or-qid-or-slug> --json
170
+ mdkg spec list --json
171
+ mdkg spec show <id-or-qid-or-alias> --json
170
172
  ```
171
173
 
174
+ `SPEC.md` is optional. Repos with no SPEC files still validate; when present,
175
+ SPEC records describe reusable capability surfaces rather than general planning
176
+ notes. `mdkg spec list/show/validate` is the focused SPEC command family, while
177
+ `mdkg capability ...` remains the broader read-only discovery surface for
178
+ skills, SPECs, WORK contracts, core docs, and design docs.
179
+
172
180
  Register source and artifact files as committed archive sidecars:
173
181
 
174
182
  ```bash
@@ -181,11 +189,20 @@ Create semantic mirror work contracts, orders, receipts, and artifacts:
181
189
 
182
190
  ```bash
183
191
  mdkg work contract new "generate image" --id work.generate-image --agent-id agent.image-worker --kind image_generation --inputs prompt:text:required --outputs image_url:url:required
184
- mdkg work order new "generate image request" --id order.generate-image-1 --work-id work.generate-image --requester user://example --input-refs archive://archive.key-input-doc
192
+ mdkg work trigger work.generate-image --id order.generate-image-1 --requester user://example
193
+ mdkg work order status order.generate-image-1 --json
185
194
  mdkg work receipt new "generate image receipt" --id receipt.generate-image-1 --work-order-id order.generate-image-1 --outcome success --receipt-status recorded
195
+ mdkg work receipt verify receipt.generate-image-1 --json
186
196
  mdkg work artifact add receipt.generate-image-1 ./outputs/image.png --id archive.generated-image --kind artifact
187
197
  ```
188
198
 
199
+ Create a manual order instead of a trigger-created order when you need to supply
200
+ input refs at order creation time:
201
+
202
+ ```bash
203
+ mdkg work order new "generate image request" --id order.generate-image-manual --work-id work.generate-image --requester user://example --input-refs archive://archive.key-input-doc
204
+ ```
205
+
189
206
  Receipt statuses are `recorded`, `verified`, `rejected`, and `superseded`.
190
207
  Update and artifact commands accept local ids or local qids; subgraph qids are read-only and must be changed in their source workspace.
191
208
 
@@ -254,6 +271,7 @@ These are the commands new users and agents should learn first:
254
271
  - `mdkg pack`
255
272
  - `mdkg skill`
256
273
  - `mdkg capability`
274
+ - `mdkg spec`
257
275
  - `mdkg archive`
258
276
  - `mdkg work`
259
277
  - `mdkg goal`
@@ -326,7 +344,7 @@ mdkg maintains `.mdkg/index/capabilities.json` as a derived access cache for det
326
344
 
327
345
  The capability cache is not the full graph and is not source of truth. Normal tasks, epics, bugs, tests, feats, and checkpoints remain in the standard graph index. Markdown remains authoritative; deleting the cache is recoverable with `mdkg index` or by running a capability command when auto-reindex is enabled.
328
346
 
329
- Capability records aggregate enabled registered workspaces and include deterministic source metadata such as `workspace`, `visibility`, `kind`, `id`, `qid`, `path`, headings, refs, source hash, and `indexed_at`. Workspace `visibility` also feeds mdkg's export safety checks for public/internal packs and public bundles. This is a CLI safety layer, not secret scanning, body redaction, or a replacement for private git hosting.
347
+ Capability records aggregate enabled registered workspaces and include deterministic source metadata such as `workspace`, `visibility`, `kind`, `id`, `qid`, `path`, headings, refs, source hash, and `indexed_at`. SPEC and WORK records also expose read-only `linkage` arrays when related work contracts, work orders, and receipts exist, so an orchestrator can discover a capability from reusable surface to invocation evidence without loading the full graph. Workspace `visibility` also feeds mdkg's export safety checks for public/internal packs and public bundles. This is a CLI safety layer, not secret scanning, body redaction, or a replacement for private git hosting.
330
348
 
331
349
  ## Index backends and parallel safety
332
350
 
@@ -349,23 +367,29 @@ Runtime DB files, WAL, SHM, journal, lock, and temp files are ignored by
349
367
  default. `mdkg db init` does not create an active runtime SQLite database.
350
368
  Run `mdkg db migrate` after init to create or update the active runtime
351
369
  SQLite database at the configured `db.runtime_path`; built-in migrations write
352
- mdkg-owned generic foundation tables, then the internal local node:sqlite queue
353
- foundation, then internal local event/receipt/reducer and writer lease/CAS
354
- foundations, and record migration order, checksums, and applied timestamps.
355
- Queue state is durable local delivery infrastructure, not canonical event
356
- history. Event rows are the durable local history for project DB state
357
- transitions, receipts provide audit/review artifacts, reducers gate writes,
358
- writer leases coordinate snapshot-hash compare-and-swap commits, and
359
- materializers run local queue-backed reducer passes. These capabilities are
360
- available only through internal helper modules in this release; there is no
361
- public `mdkg db queue`, `mdkg db event`, `mdkg db reducer`, `mdkg db lease`, or
370
+ mdkg-owned generic foundation tables, public local node:sqlite queue delivery
371
+ tables, internal local event/receipt/reducer tables, writer lease/CAS tables,
372
+ and queue control state, then record migration order, checksums, and applied
373
+ timestamps. Queue state is durable local delivery infrastructure, not canonical
374
+ event history. Use `mdkg db queue create|pause|resume|enqueue|claim|ack|fail|dead-letter|release-expired|stats|list|show`
375
+ to operate local project queues. Paused queues reject enqueue/claim while still
376
+ allowing ack/fail/dead-letter/release-expired so leased work can settle. Event
377
+ rows are durable local project DB history; receipts, reducers, writer leases,
378
+ and materializers remain internal helper surfaces in this release, with no
379
+ public `mdkg db event`, `mdkg db reducer`, `mdkg db lease`, or
362
380
  `mdkg db materializer` CLI yet.
381
+ `mdkg work trigger --enqueue <queue>` can bridge a submitted work order mirror
382
+ into an explicitly created active project DB queue; it writes local delivery
383
+ state only and never executes work.
363
384
  Use `mdkg db verify` for non-mutating health checks over config, layout,
364
385
  runtime SQLite integrity, migration metadata, and transient runtime files. Use
365
386
  `mdkg db stats` for deterministic table counts, DB size, migration state,
366
387
  receipt-file count, and state snapshot presence.
367
388
  Use `mdkg db snapshot seal` to create an explicit sealed checkpoint at
368
389
  `.mdkg/db/state/project.sqlite` with `.mdkg/db/state/project.manifest.json`.
390
+ The default queue policy is `--queue-policy drain`, which requires no ready or
391
+ leased queue messages. Use `--queue-policy paused` only when ready messages are
392
+ intentionally preserved in paused queues; leased messages always block sealing.
369
393
  Use `mdkg db snapshot verify` and `mdkg db snapshot status` for checkpoint
370
394
  health, and use `mdkg db snapshot dump` / `mdkg db snapshot diff` as
371
395
  deterministic review aids for SQLite snapshots instead of comparing raw binary
@@ -398,7 +422,7 @@ Use `mdkg new spec|work|work_order|receipt|feedback|dispute|proposal "<title>"`
398
422
 
399
423
  Relational templates contain editable placeholder refs. `spec` and `work` scaffold as validation-clean standalone docs; `work_order`, `receipt`, `feedback`, `dispute`, and `proposal` need real refs before strict `mdkg validate` passes.
400
424
 
401
- For executable or purchasable capability mirrors, prefer the lifecycle helpers under `mdkg work ...`. They create and update `WORK.md`, `WORK_ORDER.md`, and `RECEIPT.md` semantic mirror files only. Production order state, receipt state, feedback, disputes, payments, ledgers, marketplace inventory, fulfillment records, and execution state remain canonical outside mdkg, such as in Postgres or another application database. Do not store raw secrets, credentials, live payment state, ledger mutations, canonical marketplace state, or bulky raw payloads in these mirrors.
425
+ For executable or purchasable capability mirrors, prefer the lifecycle helpers under `mdkg work ...`. They create and update `WORK.md`, `WORK_ORDER.md`, and `RECEIPT.md` semantic mirror files only. `mdkg work trigger` creates a deterministic submitted `WORK_ORDER.md` from a WORK contract or a SPEC with exactly one resolvable work contract. `mdkg work order status` and `mdkg work receipt verify` are read-only review helpers for deterministic closeout. `mdkg work trigger --enqueue <queue>` optionally writes a local project DB queue delivery message after the queue has been explicitly created and is active; it still does not execute work. Production order state, receipt state, feedback, disputes, payments, ledgers, marketplace inventory, fulfillment records, and execution state remain canonical outside mdkg, such as in Postgres or another application database. Do not store raw secrets, credentials, live payment state, ledger mutations, canonical marketplace state, or bulky raw payloads in these mirrors.
402
426
 
403
427
  ## Archive sidecars
404
428
 
@@ -420,6 +444,7 @@ This release includes:
420
444
  - root-only published init seed config
421
445
  - skills indexing and search/show/list support
422
446
  - JSON capability cache for skills, `SPEC.md`, `WORK.md`, core docs, and design docs
447
+ - optional `mdkg spec list/show/validate` for reusable SPEC capability records
423
448
  - SQLite index backend for fresh workspaces using built-in `node:sqlite`
424
449
  - mutation locking and atomic writes for parallel mdkg calls
425
450
  - first-class `goal` nodes and `mdkg goal show/next/evaluate/pause/resume/done`
@@ -433,7 +458,7 @@ This release includes:
433
458
  - shared `AGENT_START.md` startup guidance
434
459
  - conservative `mdkg upgrade` with mode-aware init manifests
435
460
  - archive sidecars with deterministic ZIP caches
436
- - semantic mirror helpers under `mdkg work ...`
461
+ - semantic mirror helpers under `mdkg work ...`, including trigger/order status/receipt verification
437
462
  - explicit public/internal/private visibility enforcement for packs, bundles, archives, imports, validation, and doctor diagnostics
438
463
  - strict archive ZIP payload integrity checks during validation
439
464