mdkg 0.3.6 → 0.3.8

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 (68) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/CLI_COMMAND_MATRIX.md +132 -24
  3. package/README.md +80 -25
  4. package/dist/cli.js +193 -36
  5. package/dist/command-contract.json +882 -122
  6. package/dist/commands/bundle.js +2 -0
  7. package/dist/commands/capability.js +1 -0
  8. package/dist/commands/checkpoint.js +139 -1
  9. package/dist/commands/db.js +8 -0
  10. package/dist/commands/doctor.js +7 -7
  11. package/dist/commands/format.js +155 -0
  12. package/dist/commands/goal.js +60 -0
  13. package/dist/commands/graph.js +148 -0
  14. package/dist/commands/handoff.js +301 -0
  15. package/dist/commands/mcp.js +9 -0
  16. package/dist/commands/new.js +12 -3
  17. package/dist/commands/pack.js +3 -1
  18. package/dist/commands/query_output.js +2 -0
  19. package/dist/commands/show.js +8 -0
  20. package/dist/commands/spec.js +76 -17
  21. package/dist/commands/status.js +1 -0
  22. package/dist/commands/subgraph.js +7 -4
  23. package/dist/commands/task.js +2 -0
  24. package/dist/commands/upgrade.js +128 -3
  25. package/dist/commands/validate.js +268 -6
  26. package/dist/commands/work.js +176 -5
  27. package/dist/core/project_db_queue_contract.js +101 -0
  28. package/dist/graph/agent_file_types.js +59 -20
  29. package/dist/graph/capabilities_indexer.js +45 -3
  30. package/dist/graph/edges.js +15 -0
  31. package/dist/graph/frontmatter.js +4 -1
  32. package/dist/graph/indexer.js +13 -0
  33. package/dist/graph/node.js +12 -1
  34. package/dist/graph/sqlite_index.js +2 -0
  35. package/dist/graph/subgraphs.js +2 -0
  36. package/dist/graph/template_schema.js +37 -17
  37. package/dist/graph/validate_graph.js +16 -5
  38. package/dist/graph/visibility.js +6 -0
  39. package/dist/init/AGENT_START.md +9 -6
  40. package/dist/init/CLI_COMMAND_MATRIX.md +50 -16
  41. package/dist/init/README.md +26 -9
  42. package/dist/init/init-manifest.json +67 -12
  43. package/dist/init/templates/default/bug.md +2 -0
  44. package/dist/init/templates/default/chk.md +3 -0
  45. package/dist/init/templates/default/epic.md +2 -0
  46. package/dist/init/templates/default/feat.md +2 -0
  47. package/dist/init/templates/default/goal.md +3 -0
  48. package/dist/init/templates/default/manifest.md +45 -0
  49. package/dist/init/templates/default/spike.md +2 -0
  50. package/dist/init/templates/default/task.md +2 -0
  51. package/dist/init/templates/default/test.md +2 -0
  52. package/dist/init/templates/specs/agent.MANIFEST.md +80 -0
  53. package/dist/init/templates/specs/api.MANIFEST.md +33 -0
  54. package/dist/init/templates/specs/base.MANIFEST.md +120 -0
  55. package/dist/init/templates/specs/capability.MANIFEST.md +45 -0
  56. package/dist/init/templates/specs/integration.MANIFEST.md +25 -0
  57. package/dist/init/templates/specs/model.MANIFEST.md +21 -0
  58. package/dist/init/templates/specs/project.MANIFEST.md +39 -0
  59. package/dist/init/templates/specs/runtime-agent.MANIFEST.md +49 -0
  60. package/dist/init/templates/specs/runtime-image.MANIFEST.md +21 -0
  61. package/dist/init/templates/specs/tool.MANIFEST.md +25 -0
  62. package/dist/pack/export_json.js +20 -8
  63. package/dist/pack/export_md.js +15 -4
  64. package/dist/pack/export_xml.js +9 -4
  65. package/dist/pack/metrics.js +12 -4
  66. package/dist/pack/pack.js +9 -1
  67. package/dist/util/argparse.js +3 -0
  68. package/package.json +21 -3
package/CHANGELOG.md CHANGED
@@ -8,6 +8,99 @@ mdkg is pre-v1 public alpha software. Command, graph, cache, bundle, and DAL con
8
8
 
9
9
  ## Unreleased
10
10
 
11
+ ## 0.3.8 - 2026-06-25
12
+
13
+ ### Added
14
+
15
+ - Planned and began a warning-scale UX hardening lane for large multi-repo
16
+ mdkg orchestration runs.
17
+ - Added bounded validation warning summaries, summary-mode output, and a clean
18
+ JSON receipt artifact path for warning-heavy validation workflows.
19
+ - Added heading formatter summary-mode output for large recommended-heading
20
+ migration previews.
21
+ - Added a packed warning UX smoke to prepublish automation so high-volume
22
+ warning output regressions are caught before release.
23
+
24
+ ### Changed
25
+
26
+ - Renamed the reusable capability surface to canonical `MANIFEST.md`
27
+ terminology across scaffolds, help, command references, init assets, and
28
+ skills. `SPEC.md` and `mdkg spec ...` remain explicit legacy aliases for one
29
+ compatibility release, with manifest-first warnings and migration guidance.
30
+ - Improved strict doctor, subgraph, and handoff remediation guidance for
31
+ multi-repo operators.
32
+ - Updated repo-local skill guidance for child-first commit and root subgraph
33
+ refresh sequencing.
34
+
35
+ ## 0.3.7 - 2026-06-20
36
+
37
+ ### Added
38
+
39
+ - Added `context_refs` and `evidence_refs` as generic semantic reference
40
+ fields for mdkg work nodes, with indexing, validation, search/show output,
41
+ pack traversal, SQLite cache support, subgraph projection, and visibility
42
+ enforcement.
43
+ - Added `mdkg graph refs <id-or-qid> --json` to summarize inbound and outbound
44
+ scope, context, evidence, blocker, related, and structural references for
45
+ local graph nodes and read-only subgraph qids.
46
+ - Added richer checkpoint kinds for implementation milestones, test proof, goal
47
+ closeout, read-only audits, and handoffs. Generated checkpoint bodies now
48
+ include sections for evidence, validation, known warnings, changed surfaces,
49
+ boundaries, and follow-up references.
50
+ - Added `mdkg work validate [<id-or-qid>] --type ... --json` for focused
51
+ SPEC, WORK, WORK_ORDER, RECEIPT, FEEDBACK, DISPUTE, and PROPOSAL semantic
52
+ mirror diagnostics.
53
+ - Added validation warning categories plus `mdkg validate --changed-only` for
54
+ changed-file warning review while preserving full-graph error checking.
55
+ - Added `mdkg format --headings --dry-run|--apply --json` to preview or apply
56
+ recommended heading migrations for historical mdkg Markdown nodes.
57
+ - Added `mdkg db queue contract --json` as the public project DB queue adapter
58
+ contract covering payload hashing, dedupe, claim ordering, lease-owner
59
+ settlement, retry/dead-letter behavior, expired lease release, pause/resume,
60
+ snapshot policies, and stats semantics.
61
+ - Added `mdkg handoff create <id-or-qid>` for sanitized, copy-ready agent
62
+ handoff prompts built from pack context, goal state, latest checkpoints,
63
+ required checks, semantic refs, and raw-content warnings.
64
+ - Added packed temp-repo smokes for semantic refs, checkpoint templates,
65
+ handoffs, and the full integration UX flow.
66
+
67
+ ### Changed
68
+
69
+ - Completed goals now move the final `active_node` to `last_active_node` when
70
+ marked done or archived, so historical routing state is preserved without
71
+ leaving completed goals actionable.
72
+ - `mdkg goal next <done-goal> --json` now returns `node: null` without
73
+ misleading stale `active_node` warnings for achieved goals.
74
+ - Goal and pack workflows now distinguish executable `scope_refs` from
75
+ contextual and evidence references, reducing validation noise when goals cite
76
+ checkpoints, design evidence, prerequisite goals, or external proof refs.
77
+ - README, init assets, command matrix, generated command contract metadata,
78
+ help targets, and publish-readiness assertions now document the new semantic
79
+ refs, handoff, workflow validation, checkpoint, queue contract, and warning
80
+ migration surfaces.
81
+ - Upgrade behavior now migrates legacy achieved goals that still have
82
+ `active_node` into the new `last_active_node` shape.
83
+
84
+ ### Fixed
85
+
86
+ - Reduced false-positive operational friction for completed goals and
87
+ intentional contextual refs without weakening missing-reference or invalid
88
+ graph-edge validation.
89
+ - Strengthened cross-subgraph blocker diagnostics so read-only external graph
90
+ nodes are reported as planning context instead of locally actionable work.
91
+
92
+ ### Security
93
+
94
+ - Handoff generation omits raw node body content for nodes with obvious raw
95
+ prompt, payload, or secret markers and reports typed raw-marker warnings
96
+ instead.
97
+ - Workflow validation and checkpoint validation warn on obvious raw secret,
98
+ prompt, token, or payload markers without turning mdkg into a broad secret
99
+ scanner or blocking operator review.
100
+ - The public queue contract explicitly states that queue payloads should be
101
+ compact refs or redacted envelopes, not raw secrets, prompts, provider
102
+ payloads, or bulky runtime artifacts.
103
+
11
104
  ## 0.3.6 - 2026-06-17
12
105
 
13
106
  ### Added
@@ -1,7 +1,7 @@
1
1
  # CLI Command Matrix
2
2
 
3
- as_of: 2026-06-17
4
- package_version_in_source: 0.3.6
3
+ as_of: 2026-06-21
4
+ package_version_in_source: 0.3.8
5
5
  source: live help from `src/cli.ts`, runtime command handlers, and `dec-15`..`dec-18`
6
6
  status: canonical single-source command and flag reference for mdkg
7
7
 
@@ -12,6 +12,18 @@ This file is the one place humans and LLMs should check for the live mdkg comman
12
12
  Verification commands:
13
13
  - `npm run cli:snapshot`
14
14
  - `npm run cli:check`
15
+ - `npm run docs:check`
16
+ - `npm run smoke:mdkg-dev`
17
+ - `npm run smoke:mdkg-dev-docs`
18
+ - `npm run smoke:mdkg-dev-seo`
19
+ - `npm run smoke:demo-graph`
20
+
21
+ mdkg.dev launch-readiness surfaces in this repo:
22
+ - `mdkg-dev/` is the Astro static-site subproject.
23
+ - `docs/` is the Starlight docs subproject and repo-first documentation source plus generated command-reference output.
24
+ - `examples/` contains local mdkg demo/template graphs for agentic-coding and website-generation demos.
25
+ - `demo_agentic_coding:goal-1` and `template_mdkg_dev:goal-1` are private read-only subgraph qids after the root bundles are registered.
26
+ - Site/docs/demo assets are not npm runtime payload and must not imply production deploy, DNS change, analytics activation, or durable demo promotion.
15
27
 
16
28
  ## Teaching model
17
29
 
@@ -23,6 +35,7 @@ Primary commands:
23
35
  - `list`
24
36
  - `search`
25
37
  - `pack`
38
+ - `handoff`
26
39
  - `skill`
27
40
  - `capability`
28
41
  - `spec`
@@ -54,7 +67,8 @@ Advanced / maintenance commands:
54
67
  Skills are first-class and are accessed only through `mdkg skill ...`.
55
68
  Generic `list/show/search` do not expose skills.
56
69
  Capability cache discovery is read-only and accessed through `mdkg capability ...`.
57
- Optional reusable SPEC capability records are accessed through `mdkg spec ...`.
70
+ Reusable manifest capability records are accessed through `mdkg manifest ...`;
71
+ `mdkg spec ...` remains a one-compatibility-release legacy alias.
58
72
  Archive sidecars are accessed through `mdkg archive ...`.
59
73
  Full graph snapshot bundles are accessed through `mdkg bundle ...`.
60
74
  Whole-graph clone, fork, and same-repo template import workflows are accessed through `mdkg graph ...`.
@@ -155,22 +169,26 @@ Types:
155
169
  - `test`
156
170
 
157
171
  Agent workflow file types:
158
- - `spec`
172
+ - `manifest`
159
173
  - `work`
160
174
  - `work_order`
161
175
  - `receipt`
162
176
  - `feedback`
163
177
  - `dispute`
164
178
  - `proposal`
179
+ - `spec` is a legacy alias for `manifest` during the compatibility bridge and
180
+ emits `MANIFEST.md`.
165
181
 
166
182
  Agent workflow file type creation:
167
- - `mdkg new spec "<title>" [options] [--json]`
183
+ - `mdkg new manifest "<title>" [options] [--json]`
168
184
  - `mdkg new work "<title>" [options] [--json]`
169
185
  - `mdkg new work_order "<title>" [options] [--json]`
170
186
  - `mdkg new receipt "<title>" [options] [--json]`
171
187
  - `mdkg new feedback "<title>" [options] [--json]`
172
188
  - `mdkg new dispute "<title>" [options] [--json]`
173
189
  - `mdkg new proposal "<title>" [options] [--json]`
190
+ - `mdkg new spec "<title>" [options] [--json]` is a deprecated alias for
191
+ `mdkg new manifest` and creates `MANIFEST.md` with `type: manifest`.
174
192
 
175
193
  Goal node creation:
176
194
  - `mdkg new goal "<title>" [options] [--json]`
@@ -349,6 +367,10 @@ Allowed formats:
349
367
  - `toon`
350
368
  - `xml`
351
369
 
370
+ Allowed pack edges:
371
+ - `parent`, `epic`, `relates`, `blocked_by`, `blocks`, `prev`, `next`
372
+ - `context_refs` and `evidence_refs` for non-executable semantic references
373
+
352
374
  Profiles:
353
375
  - `standard`
354
376
  - `concise`
@@ -363,6 +385,26 @@ Visibility:
363
385
  - `--visibility internal` includes public/internal records and fails when included records reference private records
364
386
  - `--visibility private` records explicit private intent and may include all records
365
387
  - visibility filtering does not inspect or redact arbitrary Markdown body text
388
+ - `context_refs` and `evidence_refs` are indexed semantic refs, not executable goal queues; include them with `--edges context_refs,evidence_refs` when a handoff needs background or proof nodes
389
+
390
+ ### `mdkg handoff`
391
+
392
+ When to use:
393
+ - create a sanitized, copy-ready agent handoff prompt from graph context
394
+ - summarize goal/work state, included pack nodes, latest checkpoint, boundaries, required checks, and next actions
395
+
396
+ Usage:
397
+ - `mdkg handoff create <id-or-qid> [--ws <alias>] [--depth <n>] [--out <path>] [--json]`
398
+
399
+ Notes:
400
+ - uses pack traversal with `context_refs` and `evidence_refs`
401
+ - does not copy raw node bodies into the handoff
402
+ - reports raw secret, prompt, token, or payload marker warnings without including raw marker content
403
+ - `--out` must stay inside the repo root
404
+ - the command does not execute work, mutate graph nodes, or generate detailed node content
405
+
406
+ Receipts:
407
+ - `handoff-created`: `{ action, ok, mdkg_version, target, output_path, content_sha256, raw_marker_warning_count, raw_marker_warnings, latest_checkpoint_qid, included_qids, pack, content }`
366
408
 
367
409
  ### `mdkg skill`
368
410
 
@@ -489,7 +531,7 @@ Notes:
489
531
 
490
532
  When to use:
491
533
  - discover deterministic capability surfaces across enabled workspaces
492
- - query skills, `SPEC.md`, `WORK.md`, core docs, and design docs without loading the whole graph body set
534
+ - query skills, canonical `MANIFEST.md`, legacy `SPEC.md`, `WORK.md`, core docs, and design docs without loading the whole graph body set
493
535
 
494
536
  Usage:
495
537
  - `mdkg capability list [--kind <kind>] [--visibility <level>] [--json]`
@@ -514,17 +556,48 @@ Notes:
514
556
  - `capability resolve` ranks local and subgraph capabilities deterministically for orchestration planning
515
557
  - stale subgraphs remain visible with degraded ranking unless `--fresh-only` is supplied
516
558
  - records include deterministic source metadata such as workspace, visibility, kind, id/qid/slug, path, headings, refs, source hash, and `indexed_at`
517
- - SPEC and WORK capability records include read-only `linkage` arrays for related SPECs, work contracts, work orders, and receipts when those graph mirrors exist
559
+ - MANIFEST/SPEC and WORK capability records include read-only `linkage` arrays for related manifests, work contracts, work orders, and receipts when those graph mirrors exist
518
560
  - `.mdkg/index/capabilities.json` is rebuilt by `mdkg index` and by capability commands when stale
519
561
  - normal task, epic, feat, bug, test, spike, and checkpoint nodes are intentionally excluded
520
562
  - visibility is mdkg export metadata used by capability filters, `pack --visibility`, public bundle checks, validation, and doctor diagnostics; it is not secret scanning or body redaction
521
563
 
564
+ ### `mdkg manifest`
565
+
566
+ When to use:
567
+ - list reusable capability surfaces from canonical `MANIFEST.md` or legacy
568
+ `SPEC.md`
569
+ - show one manifest capability record by id, qid, path, or alias
570
+ - validate the graph while ensuring a named manifest capability exists
571
+
572
+ Usage:
573
+ - `mdkg manifest list [--json]`
574
+ - `mdkg manifest show <id-or-qid-or-alias> [--json]`
575
+ - `mdkg manifest validate [<id-or-qid-or-alias>] [--json]`
576
+
577
+ Flags:
578
+ - `--json`
579
+
580
+ Notes:
581
+ - `MANIFEST.md` is canonical and `SPEC.md` remains a legacy alias; repos with no
582
+ manifest/spec files remain valid
583
+ - manifest records are reusable-capability oriented, not documentation-only
584
+ planning notes
585
+ - `mdkg manifest validate` with no ref validates the graph and all
586
+ manifest/spec records
587
+ - `mdkg manifest validate <ref>` also checks that the target manifest reference
588
+ exists
589
+ - JSON records keep capability `kind: spec` for compatibility and include
590
+ manifest metadata describing canonical, legacy, or transitional source mode
591
+ - use `mdkg capability ...` for broader skill, MANIFEST/SPEC, WORK, core-doc,
592
+ and design-doc capability discovery
593
+
522
594
  ### `mdkg spec`
523
595
 
524
596
  When to use:
525
- - list optional `SPEC.md` reusable capability surfaces
526
- - show one SPEC capability record by id, qid, path, or alias
527
- - validate the graph while ensuring a named SPEC capability exists
597
+ - temporarily support existing scripts during the one-compatibility-release
598
+ bridge to `mdkg manifest ...`
599
+ - list, show, or validate the same MANIFEST/SPEC capability records with legacy
600
+ command labeling
528
601
 
529
602
  Usage:
530
603
  - `mdkg spec list [--json]`
@@ -535,11 +608,14 @@ Flags:
535
608
  - `--json`
536
609
 
537
610
  Notes:
538
- - `SPEC.md` is optional; repos with no SPEC files remain valid
539
- - SPEC records are reusable-capability oriented, not documentation-only planning notes
540
- - `mdkg spec validate` with no ref validates the graph and all optional SPEC records
541
- - `mdkg spec validate <ref>` also checks that the target SPEC reference exists
542
- - use `mdkg capability ...` for broader skill, SPEC, WORK, core-doc, and design-doc capability discovery
611
+ - `mdkg spec` is a legacy alias for `mdkg manifest` during the compatibility
612
+ bridge
613
+ - `mdkg spec validate` with no ref validates the graph and all manifest/spec
614
+ records
615
+ - `mdkg spec validate <ref>` also checks that the target manifest reference
616
+ exists
617
+ - JSON receipts keep `kind: spec` and add `canonical_kind: manifest`,
618
+ `legacy_alias: true`, and deprecation metadata
543
619
 
544
620
  ### `mdkg archive`
545
621
 
@@ -624,12 +700,14 @@ JSON receipts:
624
700
  When to use:
625
701
  - clone or fork a complete mdkg graph into a separate target directory while preserving IDs
626
702
  - import a template graph into the current repo with deterministic ID/link rewrites
703
+ - inspect inbound and outbound graph references across local and read-only subgraph qids
627
704
  - prepare selected-goal demo handoffs from reusable graph templates
628
705
 
629
706
  Usage:
630
707
  - `mdkg graph clone <source-bundle-or-mdkg-dir> --target <path> [--json]`
631
708
  - `mdkg graph fork <source-bundle-or-mdkg-dir> --target <path> [--start-goal <goal-id>] [--json]`
632
709
  - `mdkg graph import-template <source-bundle-or-mdkg-dir> [--start-goal <goal-id>] [--select-goal] [--id-prefix <prefix>] [--dry-run] [--apply] [--json]`
710
+ - `mdkg graph refs <id-or-qid> [--ws <alias>] [--json]`
633
711
 
634
712
  Flags:
635
713
  - `--target <path>`
@@ -638,6 +716,7 @@ Flags:
638
716
  - `--id-prefix <prefix>`
639
717
  - `--dry-run`
640
718
  - `--apply`
719
+ - `--ws <alias>`
641
720
  - `--json`
642
721
 
643
722
  Notes:
@@ -651,12 +730,14 @@ Notes:
651
730
  - colliding semantic template IDs require `--id-prefix`
652
731
  - `--select-goal` requires `--start-goal`; on apply it activates the imported start goal, pauses competing active root goals, validates, then writes selected-goal state
653
732
  - importing active template goals without `--select-goal` fails before writing when it would create multiple active root goals
733
+ - `graph refs` is read-only; it reports `scope_refs`, `context_refs`, `evidence_refs`, blockers, related refs, and structural inbound/outbound links
654
734
  - subgraphs remain read-only bundle projections for orchestration context; use `graph clone|fork|import-template` when authored graph state should be created
655
735
 
656
736
  JSON receipts:
657
737
  - `clone`: `{ action: "graph.clone", ok, mode, source, target, source_hash, preserved_ids, files_written, skipped_paths, index, validation, warnings }`
658
738
  - `fork`: `{ action: "graph.fork", ok, mode, source, target, source_hash, preserved_ids, files_written, skipped_paths, start_goal?, selected_goal?, index, validation, warnings }`
659
739
  - `import-template`: `{ action: "graph.import_template", ok, mode, source, source_hash, preserved_ids: false, rewritten_ids, rewritten_refs, planned_paths, files_written, skipped_paths, start_goal?, selected_goal?, activated_goal?, paused_goals, index?, validation?, warnings }`
740
+ - `refs`: `{ action: "graph.refs", ok, target, outgoing, incoming, warnings }`
660
741
 
661
742
  ### `mdkg subgraph`
662
743
 
@@ -745,19 +826,22 @@ Usage:
745
826
  - `mdkg work receipt verify <id-or-qid> [--json]`
746
827
  - `mdkg work receipt update <id-or-qid> [--receipt-status <status>] [--add-artifacts <...>] [--add-proof-refs <...>] [--add-attestation-refs <...>] [--add-evidence-hashes <sha256:...>] [--json]`
747
828
  - `mdkg work artifact add <order-or-receipt-id-or-qid> <file> [--id <archive.id>] [--kind source|artifact] [--json]`
829
+ - `mdkg work validate [<id-or-qid>] [--type <workflow-type>] [--json]`
830
+ - `mdkg work validate [<id-or-qid>] [--type manifest|spec|work|work_order|receipt|feedback|dispute|proposal] [--json]`
748
831
 
749
832
  Notes:
750
833
  - work commands mutate semantic mirror files only
751
834
  - production order, receipt, feedback, dispute, payment, ledger, marketplace inventory, fulfillment, and execution state remains canonical outside mdkg
752
835
  - do not store raw secrets, credentials, live payment state, ledger mutations, or canonical marketplace state in work mirrors
753
836
  - `artifact://...` refs identify external/runtime-managed artifacts; `archive://...` refs identify committed mdkg archive sidecars
754
- - `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
837
+ - `work trigger` accepts a `WORK.md` ref directly or a `MANIFEST.md` / legacy `SPEC.md` capability ref with exactly one resolvable work contract; it creates a submitted order mirror and never executes work
755
838
  - example: `mdkg work trigger work.example --id order.example-1 --requester user://example --json`
756
839
  - `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
757
840
  - `work order new` accepts URI-style requester/request/trigger refs, archive input refs, optional queue refs, and stable payload hashes
758
841
  - `work order status` is read-only and reports deterministic order state plus linked receipts
759
842
  - `work receipt new` accepts URI-style cost/proof/attestation refs, explicit redaction policy, and SHA-256 evidence/input/output hash refs
760
843
  - `work receipt verify` is read-only and reports linkage, evidence, archive ref, hash, outcome, and redaction-policy checks; invalid receipts print JSON before exiting nonzero
844
+ - `work validate` is read-only and reports typed diagnostics for MANIFEST.md, legacy SPEC.md, WORK.md, WORK_ORDER.md, RECEIPT.md, FEEDBACK.md, DISPUTE.md, and PROPOSAL.md mirrors; obvious raw secret, prompt, token, or payload markers are warnings, not hard failures
761
845
  - `work artifact add` calls `mdkg archive add`, then attaches the resulting `archive://...` ref to the target order or receipt
762
846
  - `work order update`, `work receipt update`, and `work artifact add` accept local ids or local qids; subgraph qids are read-only and must be changed in their source workspace
763
847
 
@@ -767,6 +851,7 @@ JSON receipts:
767
851
  - `order status`: `{ kind: "work_order_status", order, receipt_count, receipts }`
768
852
  - `receipt verify`: `{ kind: "work_receipt_verify", ok, receipt, work_order?, checks, errors, warnings }`
769
853
  - `artifact add`: `{ action: "artifact_registered", target, archive }`
854
+ - `validate` work-validate-receipt: `{ action: "work.validate", ok, type, target?, checked_count, nodes, warning_count, error_count, warnings, errors, diagnostics }`
770
855
 
771
856
  ### `mdkg goal`
772
857
 
@@ -799,7 +884,7 @@ Usage:
799
884
  - `mdkg goal archive <goal-id-or-qid> [--ws <alias>] [--json]`
800
885
 
801
886
  Behavior:
802
- - `goal show` reports goal condition, goal state, scope refs, active node, required skills, required checks, and source path.
887
+ - `goal show` reports goal condition, goal state, scope refs, active node, last active node, required skills, required checks, and source path.
803
888
  - `goal select` writes local ignored selected-goal state so `goal next` can omit the goal id.
804
889
  - `goal activate` makes one local root goal active, pauses competing local active goals in the same workspace, and writes selected-goal state.
805
890
  - `goal current` shows the selected goal or unique active goal fallback.
@@ -807,7 +892,7 @@ Behavior:
807
892
  - `goal next` is read-only and selects feature, task, bug, test, or spike work inside explicit `scope_refs`; epics are recursive containers, not executable returns.
808
893
  - `goal claim` mutates only `active_node` after the work item is confirmed inside the goal scope.
809
894
  - `goal evaluate` is report-only and never runs commands from `required_checks`.
810
- - `goal pause`, `goal resume`, and `goal done` update `goal_state`, compatible work status, and `updated`.
895
+ - `goal pause`, `goal resume`, and `goal done` update `goal_state`, compatible work status, and `updated`; done goals move any current `active_node` to `last_active_node` and no longer emit stale active-node routing warnings.
811
896
  - `goal archive` marks a superseded historical goal as `status: archived` and `goal_state: archived`; archived goals remain show/search/list readable but are excluded from active routing.
812
897
  - subgraph goal qids are read-only; update the source workspace instead.
813
898
 
@@ -832,7 +917,7 @@ When to use:
832
917
  Usage:
833
918
  - `mdkg task start <id-or-qid> [--ws <alias>] [--run-id <id>] [--note "<text>"] [--json]`
834
919
  - `mdkg task update <id-or-qid> [options] [--json]`
835
- - `mdkg task done <id-or-qid> [--checkpoint "<title>"] [options] [--json]`
920
+ - `mdkg task done <id-or-qid> [--checkpoint "<title>"] [--checkpoint-kind implementation|test-proof|goal-closeout|audit|handoff] [options] [--json]`
836
921
 
837
922
  #### `mdkg task start`
838
923
 
@@ -868,12 +953,13 @@ JSON receipt:
868
953
 
869
954
  Usage:
870
955
  - `mdkg task done <id-or-qid> [--ws <alias>] [--add-artifacts <a,...>] [--add-links <l,...>]`
871
- - ` [--add-refs <id,...>] [--checkpoint "<title>"] [--run-id <id>] [--note "<text>"] [--json]`
956
+ - ` [--add-refs <id,...>] [--checkpoint "<title>"] [--checkpoint-kind implementation|test-proof|goal-closeout|audit|handoff] [--run-id <id>] [--note "<text>"] [--json]`
872
957
 
873
958
  Behavior:
874
959
  - supports task-like `feat`, `task`, `bug`, `test`, and `spike` nodes
875
960
  - sets `status: done`
876
961
  - `--checkpoint` creates a related checkpoint
962
+ - `--checkpoint-kind` selects the evidence template for the related checkpoint
877
963
  - if `events.jsonl` is missing for the workspace, prints a short `stderr` reminder about `mdkg event enable`
878
964
 
879
965
  JSON receipt:
@@ -902,16 +988,25 @@ When to use:
902
988
  - run the repo trust gate before calling work done
903
989
 
904
990
  Usage:
905
- - `mdkg validate [--out <path>] [--quiet] [--json]`
991
+ - `mdkg validate [--out <path>] [--json-out <path>] [--quiet] [--changed-only] [--summary] [--limit <n>] [--json]`
992
+ - `--changed-only` filters warning presentation to changed `.mdkg` files while full graph errors still run
993
+ - `--summary` emits bounded warning samples for agent/CI logs; `--limit <n>` controls the sample size
994
+ - `--out <path>` writes the compatibility text report; `--json-out <path>` writes a clean full JSON receipt
995
+ - JSON receipts include `warning_summary` and `warning_diagnostics` with warning ids, categories, severity, paths, refs, and remediation text
906
996
 
907
997
  Flags:
908
998
  - `--out <path>`
999
+ - `--json-out <path>`
909
1000
  - `--quiet`
1001
+ - `--changed-only`
1002
+ - `--summary`
1003
+ - `--limit <n>`
910
1004
  - `--json`
911
1005
 
912
1006
  JSON receipt:
913
- - `{ action: "validated", ok, warning_count, error_count, warnings, errors, report_path }`
1007
+ - `{ action: "validated", ok, warning_count, error_count, warnings, warning_diagnostics, warning_summary, errors, report_path?, json_receipt_path? }`
914
1008
  - `report_path` is included only when `--out` is used.
1009
+ - `json_receipt_path` is included only when `--json-out` is used.
915
1010
 
916
1011
  Notes:
917
1012
  - validates nodes, graph integrity, skills, and event log contracts
@@ -959,11 +1054,12 @@ JSON receipt:
959
1054
  ### `mdkg checkpoint`
960
1055
 
961
1056
  Usage:
962
- - `mdkg checkpoint new <title> [--ws <alias>] [--json]`
1057
+ - `mdkg checkpoint new <title> [--kind implementation|test-proof|goal-closeout|audit|handoff] [--ws <alias>] [--json]`
963
1058
  - ` [--relates <id,id,...>] [--scope <id,id,...>] [--run-id <id>] [--note "<text>"]`
1059
+ - checkpoint kinds render bodies with command evidence, pass/fail status, known warnings, changed surfaces, boundaries, and follow-up refs
964
1060
 
965
1061
  JSON receipt:
966
- - `{ action: "created", checkpoint: { workspace, id, qid, path } }`
1062
+ - `{ action: "created", checkpoint: { workspace, id, qid, path, kind } }`
967
1063
 
968
1064
  ### `mdkg index`
969
1065
 
@@ -1003,6 +1099,7 @@ Usage:
1003
1099
  - `mdkg db queue list <queue> [--status ready|leased|acked|dead_letter|all] [--limit <n>] [--json]`
1004
1100
  - `mdkg db queue show <queue> <message-id> [--json]`
1005
1101
  - `mdkg db queue stats|list|show ... [--json]`
1102
+ - `mdkg db queue contract [--json]`
1006
1103
  - `mdkg db snapshot seal [--queue-policy drain|paused] [--json]`
1007
1104
  - `mdkg db snapshot verify [--json]`
1008
1105
  - `mdkg db snapshot status [--json]`
@@ -1023,6 +1120,10 @@ Boundaries:
1023
1120
  in the configured migration table
1024
1121
  - `mdkg db queue ...` exposes durable local delivery operations backed by
1025
1122
  node:sqlite; queue rows are delivery state, not canonical event history
1123
+ - `mdkg db queue contract --json` returns the public adapter contract covering
1124
+ canonical payload hashing, dedupe semantics, oldest-ready claim order,
1125
+ lease-owner checked settlement, retry/dead-letter behavior, release-expired,
1126
+ pause/resume, snapshot queue policy, stats, and boundary guidance
1026
1127
  - paused queues reject enqueue and claim, but ack/fail/dead-letter and
1027
1128
  release-expired remain available so leased work can settle
1028
1129
  - event tables are durable local history for project DB state transitions;
@@ -1064,6 +1165,13 @@ Usage:
1064
1165
 
1065
1166
  Usage:
1066
1167
  - `mdkg format`
1168
+ - `mdkg format --headings [--dry-run|--apply] [--summary] [--limit <n>] [--json]`
1169
+
1170
+ Notes:
1171
+ - default `mdkg format` normalizes frontmatter in place
1172
+ - `mdkg format --headings` defaults to dry-run and returns planned missing-heading additions
1173
+ - `--summary` emits bounded heading-change samples for agent/CI logs; `--limit <n>` controls the sample size
1174
+ - `mdkg format --headings --apply` appends missing recommended body headings and returns a migration receipt
1067
1175
 
1068
1176
  ### `mdkg status`
1069
1177