mdkg 0.3.5 → 0.3.7
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.
- package/CHANGELOG.md +97 -2
- package/CLI_COMMAND_MATRIX.md +90 -10
- package/README.md +54 -7
- package/dist/cli.js +222 -13
- package/dist/command-contract.json +587 -19
- package/dist/commands/bundle.js +2 -0
- package/dist/commands/checkpoint.js +139 -1
- package/dist/commands/db.js +8 -0
- package/dist/commands/format.js +116 -0
- package/dist/commands/goal.js +60 -0
- package/dist/commands/graph.js +280 -10
- package/dist/commands/handoff.js +295 -0
- package/dist/commands/mcp.js +656 -0
- package/dist/commands/pack.js +3 -1
- package/dist/commands/query_output.js +2 -0
- package/dist/commands/show.js +8 -0
- package/dist/commands/status.js +1 -0
- package/dist/commands/task.js +2 -0
- package/dist/commands/upgrade.js +61 -0
- package/dist/commands/validate.js +162 -3
- package/dist/commands/work.js +164 -0
- package/dist/core/project_db_queue_contract.js +101 -0
- package/dist/graph/edges.js +15 -0
- package/dist/graph/frontmatter.js +4 -1
- package/dist/graph/indexer.js +8 -0
- package/dist/graph/node.js +12 -1
- package/dist/graph/sqlite_index.js +2 -0
- package/dist/graph/subgraphs.js +2 -0
- package/dist/graph/validate_graph.js +5 -0
- package/dist/graph/visibility.js +6 -0
- package/dist/init/AGENT_START.md +4 -1
- package/dist/init/CLI_COMMAND_MATRIX.md +36 -4
- package/dist/init/README.md +26 -3
- package/dist/init/init-manifest.json +12 -12
- package/dist/init/templates/default/bug.md +2 -0
- package/dist/init/templates/default/chk.md +3 -0
- package/dist/init/templates/default/epic.md +2 -0
- package/dist/init/templates/default/feat.md +2 -0
- package/dist/init/templates/default/goal.md +3 -0
- package/dist/init/templates/default/spike.md +2 -0
- package/dist/init/templates/default/task.md +2 -0
- package/dist/init/templates/default/test.md +2 -0
- package/dist/pack/export_json.js +20 -8
- package/dist/pack/export_md.js +15 -4
- package/dist/pack/export_xml.js +9 -4
- package/dist/pack/metrics.js +12 -4
- package/dist/pack/pack.js +9 -1
- package/dist/util/argparse.js +1 -0
- package/package.json +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -8,9 +8,104 @@ mdkg is pre-v1 public alpha software. Command, graph, cache, bundle, and DAL con
|
|
|
8
8
|
|
|
9
9
|
## Unreleased
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## 0.3.7 - 2026-06-20
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- Added `context_refs` and `evidence_refs` as generic semantic reference
|
|
16
|
+
fields for mdkg work nodes, with indexing, validation, search/show output,
|
|
17
|
+
pack traversal, SQLite cache support, subgraph projection, and visibility
|
|
18
|
+
enforcement.
|
|
19
|
+
- Added `mdkg graph refs <id-or-qid> --json` to summarize inbound and outbound
|
|
20
|
+
scope, context, evidence, blocker, related, and structural references for
|
|
21
|
+
local graph nodes and read-only subgraph qids.
|
|
22
|
+
- Added richer checkpoint kinds for implementation milestones, test proof, goal
|
|
23
|
+
closeout, read-only audits, and handoffs. Generated checkpoint bodies now
|
|
24
|
+
include sections for evidence, validation, known warnings, changed surfaces,
|
|
25
|
+
boundaries, and follow-up references.
|
|
26
|
+
- Added `mdkg work validate [<id-or-qid>] --type ... --json` for focused
|
|
27
|
+
SPEC, WORK, WORK_ORDER, RECEIPT, FEEDBACK, DISPUTE, and PROPOSAL semantic
|
|
28
|
+
mirror diagnostics.
|
|
29
|
+
- Added validation warning categories plus `mdkg validate --changed-only` for
|
|
30
|
+
changed-file warning review while preserving full-graph error checking.
|
|
31
|
+
- Added `mdkg format --headings --dry-run|--apply --json` to preview or apply
|
|
32
|
+
recommended heading migrations for historical mdkg Markdown nodes.
|
|
33
|
+
- Added `mdkg db queue contract --json` as the public project DB queue adapter
|
|
34
|
+
contract covering payload hashing, dedupe, claim ordering, lease-owner
|
|
35
|
+
settlement, retry/dead-letter behavior, expired lease release, pause/resume,
|
|
36
|
+
snapshot policies, and stats semantics.
|
|
37
|
+
- Added `mdkg handoff create <id-or-qid>` for sanitized, copy-ready agent
|
|
38
|
+
handoff prompts built from pack context, goal state, latest checkpoints,
|
|
39
|
+
required checks, semantic refs, and raw-content warnings.
|
|
40
|
+
- Added packed temp-repo smokes for semantic refs, checkpoint templates,
|
|
41
|
+
handoffs, and the full integration UX flow.
|
|
42
|
+
|
|
43
|
+
### Changed
|
|
44
|
+
|
|
45
|
+
- Completed goals now move the final `active_node` to `last_active_node` when
|
|
46
|
+
marked done or archived, so historical routing state is preserved without
|
|
47
|
+
leaving completed goals actionable.
|
|
48
|
+
- `mdkg goal next <done-goal> --json` now returns `node: null` without
|
|
49
|
+
misleading stale `active_node` warnings for achieved goals.
|
|
50
|
+
- Goal and pack workflows now distinguish executable `scope_refs` from
|
|
51
|
+
contextual and evidence references, reducing validation noise when goals cite
|
|
52
|
+
checkpoints, design evidence, prerequisite goals, or external proof refs.
|
|
53
|
+
- README, init assets, command matrix, generated command contract metadata,
|
|
54
|
+
help targets, and publish-readiness assertions now document the new semantic
|
|
55
|
+
refs, handoff, workflow validation, checkpoint, queue contract, and warning
|
|
56
|
+
migration surfaces.
|
|
57
|
+
- Upgrade behavior now migrates legacy achieved goals that still have
|
|
58
|
+
`active_node` into the new `last_active_node` shape.
|
|
59
|
+
|
|
60
|
+
### Fixed
|
|
61
|
+
|
|
62
|
+
- Reduced false-positive operational friction for completed goals and
|
|
63
|
+
intentional contextual refs without weakening missing-reference or invalid
|
|
64
|
+
graph-edge validation.
|
|
65
|
+
- Strengthened cross-subgraph blocker diagnostics so read-only external graph
|
|
66
|
+
nodes are reported as planning context instead of locally actionable work.
|
|
67
|
+
|
|
68
|
+
### Security
|
|
69
|
+
|
|
70
|
+
- Handoff generation omits raw node body content for nodes with obvious raw
|
|
71
|
+
prompt, payload, or secret markers and reports typed raw-marker warnings
|
|
72
|
+
instead.
|
|
73
|
+
- Workflow validation and checkpoint validation warn on obvious raw secret,
|
|
74
|
+
prompt, token, or payload markers without turning mdkg into a broad secret
|
|
75
|
+
scanner or blocking operator review.
|
|
76
|
+
- The public queue contract explicitly states that queue payloads should be
|
|
77
|
+
compact refs or redacted envelopes, not raw secrets, prompts, provider
|
|
78
|
+
payloads, or bulky runtime artifacts.
|
|
79
|
+
|
|
80
|
+
## 0.3.6 - 2026-06-17
|
|
81
|
+
|
|
82
|
+
### Added
|
|
83
|
+
|
|
84
|
+
- Added `mdkg mcp serve --stdio` as a local read-only MCP server for status,
|
|
85
|
+
workspace/subgraph discovery, search, show, bounded in-memory packs, goal
|
|
86
|
+
current/next, and validation.
|
|
87
|
+
- Added packed `smoke:mcp` coverage that installs mdkg from a tarball in a
|
|
88
|
+
temp prefix, launches the stdio server, exercises root and subgraph reads,
|
|
89
|
+
and proves mutation-shaped tool calls fail closed.
|
|
90
|
+
|
|
91
|
+
### Fixed
|
|
92
|
+
|
|
93
|
+
- Prepared `0.3.6` graph import hardening after the `0.3.5` publish:
|
|
94
|
+
`mdkg graph import-template --select-goal --apply` now activates the
|
|
95
|
+
rewritten imported start goal, pauses competing active root goals, validates,
|
|
96
|
+
and only then writes selected-goal state.
|
|
97
|
+
|
|
98
|
+
### Changed
|
|
99
|
+
|
|
100
|
+
- Extended graph import dry-run/apply receipts with activation and paused-goal
|
|
101
|
+
details, and made active template imports fail before writing when
|
|
102
|
+
`--select-goal` is omitted and multiple active root goals would result.
|
|
103
|
+
|
|
104
|
+
### Security
|
|
105
|
+
|
|
106
|
+
- The MCP server is stdio-only and exposes no task, goal activation, graph
|
|
107
|
+
import, queue, event, archive, format, SQL, shell, arbitrary file-read,
|
|
108
|
+
filesystem mutation, environment, or secret-access tools.
|
|
14
109
|
|
|
15
110
|
## 0.3.5 - 2026-06-17
|
|
16
111
|
|
package/CLI_COMMAND_MATRIX.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# CLI Command Matrix
|
|
2
2
|
|
|
3
3
|
as_of: 2026-06-17
|
|
4
|
-
package_version_in_source: 0.3.
|
|
4
|
+
package_version_in_source: 0.3.6
|
|
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
|
|
|
@@ -23,6 +23,7 @@ Primary commands:
|
|
|
23
23
|
- `list`
|
|
24
24
|
- `search`
|
|
25
25
|
- `pack`
|
|
26
|
+
- `handoff`
|
|
26
27
|
- `skill`
|
|
27
28
|
- `capability`
|
|
28
29
|
- `spec`
|
|
@@ -36,6 +37,7 @@ Primary commands:
|
|
|
36
37
|
- `next`
|
|
37
38
|
- `validate`
|
|
38
39
|
- `status`
|
|
40
|
+
- `mcp`
|
|
39
41
|
- `fix`
|
|
40
42
|
|
|
41
43
|
Advanced / maintenance commands:
|
|
@@ -64,6 +66,7 @@ Fresh init workspaces default to the SQLite access cache backend; existing migra
|
|
|
64
66
|
Project application database foundation commands are accessed through `mdkg db ...`; `mdkg index` remains the compatibility shortcut for graph index rebuilds.
|
|
65
67
|
Operator health summaries are accessed through read-only `mdkg status ...`; deeper diagnostics remain under `mdkg doctor ...`.
|
|
66
68
|
Repair planning is accessed through read-only `mdkg fix plan ...`; duplicate-ID graph repairs can be applied through `mdkg fix apply --family ids ...` or the convenience `mdkg fix ids --apply ...`. Index/cache and graph-reference findings remain plan/manual-review only.
|
|
69
|
+
Local MCP integration is accessed through `mdkg mcp serve --stdio`; it exposes read-only graph/status/workspace/search/show/pack/goal/validate tools only.
|
|
67
70
|
|
|
68
71
|
## Global usage
|
|
69
72
|
|
|
@@ -347,6 +350,10 @@ Allowed formats:
|
|
|
347
350
|
- `toon`
|
|
348
351
|
- `xml`
|
|
349
352
|
|
|
353
|
+
Allowed pack edges:
|
|
354
|
+
- `parent`, `epic`, `relates`, `blocked_by`, `blocks`, `prev`, `next`
|
|
355
|
+
- `context_refs` and `evidence_refs` for non-executable semantic references
|
|
356
|
+
|
|
350
357
|
Profiles:
|
|
351
358
|
- `standard`
|
|
352
359
|
- `concise`
|
|
@@ -361,6 +368,26 @@ Visibility:
|
|
|
361
368
|
- `--visibility internal` includes public/internal records and fails when included records reference private records
|
|
362
369
|
- `--visibility private` records explicit private intent and may include all records
|
|
363
370
|
- visibility filtering does not inspect or redact arbitrary Markdown body text
|
|
371
|
+
- `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
|
|
372
|
+
|
|
373
|
+
### `mdkg handoff`
|
|
374
|
+
|
|
375
|
+
When to use:
|
|
376
|
+
- create a sanitized, copy-ready agent handoff prompt from graph context
|
|
377
|
+
- summarize goal/work state, included pack nodes, latest checkpoint, boundaries, required checks, and next actions
|
|
378
|
+
|
|
379
|
+
Usage:
|
|
380
|
+
- `mdkg handoff create <id-or-qid> [--ws <alias>] [--depth <n>] [--out <path>] [--json]`
|
|
381
|
+
|
|
382
|
+
Notes:
|
|
383
|
+
- uses pack traversal with `context_refs` and `evidence_refs`
|
|
384
|
+
- does not copy raw node bodies into the handoff
|
|
385
|
+
- reports raw secret, prompt, token, or payload marker warnings without including raw marker content
|
|
386
|
+
- `--out` must stay inside the repo root
|
|
387
|
+
- the command does not execute work, mutate graph nodes, or generate detailed node content
|
|
388
|
+
|
|
389
|
+
Receipts:
|
|
390
|
+
- `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 }`
|
|
364
391
|
|
|
365
392
|
### `mdkg skill`
|
|
366
393
|
|
|
@@ -622,12 +649,14 @@ JSON receipts:
|
|
|
622
649
|
When to use:
|
|
623
650
|
- clone or fork a complete mdkg graph into a separate target directory while preserving IDs
|
|
624
651
|
- import a template graph into the current repo with deterministic ID/link rewrites
|
|
652
|
+
- inspect inbound and outbound graph references across local and read-only subgraph qids
|
|
625
653
|
- prepare selected-goal demo handoffs from reusable graph templates
|
|
626
654
|
|
|
627
655
|
Usage:
|
|
628
656
|
- `mdkg graph clone <source-bundle-or-mdkg-dir> --target <path> [--json]`
|
|
629
657
|
- `mdkg graph fork <source-bundle-or-mdkg-dir> --target <path> [--start-goal <goal-id>] [--json]`
|
|
630
658
|
- `mdkg graph import-template <source-bundle-or-mdkg-dir> [--start-goal <goal-id>] [--select-goal] [--id-prefix <prefix>] [--dry-run] [--apply] [--json]`
|
|
659
|
+
- `mdkg graph refs <id-or-qid> [--ws <alias>] [--json]`
|
|
631
660
|
|
|
632
661
|
Flags:
|
|
633
662
|
- `--target <path>`
|
|
@@ -636,6 +665,7 @@ Flags:
|
|
|
636
665
|
- `--id-prefix <prefix>`
|
|
637
666
|
- `--dry-run`
|
|
638
667
|
- `--apply`
|
|
668
|
+
- `--ws <alias>`
|
|
639
669
|
- `--json`
|
|
640
670
|
|
|
641
671
|
Notes:
|
|
@@ -647,13 +677,16 @@ Notes:
|
|
|
647
677
|
- `graph import-template` defaults to dry-run unless `--apply` is supplied
|
|
648
678
|
- same-repo template import rewrites canonical numeric IDs to the next unused ID by type prefix and rewrites structured refs plus safe body-local id/qid mentions
|
|
649
679
|
- colliding semantic template IDs require `--id-prefix`
|
|
650
|
-
- `--select-goal` requires `--start-goal
|
|
680
|
+
- `--select-goal` requires `--start-goal`; on apply it activates the imported start goal, pauses competing active root goals, validates, then writes selected-goal state
|
|
681
|
+
- importing active template goals without `--select-goal` fails before writing when it would create multiple active root goals
|
|
682
|
+
- `graph refs` is read-only; it reports `scope_refs`, `context_refs`, `evidence_refs`, blockers, related refs, and structural inbound/outbound links
|
|
651
683
|
- subgraphs remain read-only bundle projections for orchestration context; use `graph clone|fork|import-template` when authored graph state should be created
|
|
652
684
|
|
|
653
685
|
JSON receipts:
|
|
654
686
|
- `clone`: `{ action: "graph.clone", ok, mode, source, target, source_hash, preserved_ids, files_written, skipped_paths, index, validation, warnings }`
|
|
655
687
|
- `fork`: `{ action: "graph.fork", ok, mode, source, target, source_hash, preserved_ids, files_written, skipped_paths, start_goal?, selected_goal?, index, validation, warnings }`
|
|
656
|
-
- `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?, index?, validation?, warnings }`
|
|
688
|
+
- `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 }`
|
|
689
|
+
- `refs`: `{ action: "graph.refs", ok, target, outgoing, incoming, warnings }`
|
|
657
690
|
|
|
658
691
|
### `mdkg subgraph`
|
|
659
692
|
|
|
@@ -742,6 +775,8 @@ Usage:
|
|
|
742
775
|
- `mdkg work receipt verify <id-or-qid> [--json]`
|
|
743
776
|
- `mdkg work receipt update <id-or-qid> [--receipt-status <status>] [--add-artifacts <...>] [--add-proof-refs <...>] [--add-attestation-refs <...>] [--add-evidence-hashes <sha256:...>] [--json]`
|
|
744
777
|
- `mdkg work artifact add <order-or-receipt-id-or-qid> <file> [--id <archive.id>] [--kind source|artifact] [--json]`
|
|
778
|
+
- `mdkg work validate [<id-or-qid>] [--type <workflow-type>] [--json]`
|
|
779
|
+
- `mdkg work validate [<id-or-qid>] [--type spec|work|work_order|receipt|feedback|dispute|proposal] [--json]`
|
|
745
780
|
|
|
746
781
|
Notes:
|
|
747
782
|
- work commands mutate semantic mirror files only
|
|
@@ -755,6 +790,7 @@ Notes:
|
|
|
755
790
|
- `work order status` is read-only and reports deterministic order state plus linked receipts
|
|
756
791
|
- `work receipt new` accepts URI-style cost/proof/attestation refs, explicit redaction policy, and SHA-256 evidence/input/output hash refs
|
|
757
792
|
- `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
|
|
793
|
+
- `work validate` is read-only and reports typed diagnostics for 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
|
|
758
794
|
- `work artifact add` calls `mdkg archive add`, then attaches the resulting `archive://...` ref to the target order or receipt
|
|
759
795
|
- `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
|
|
760
796
|
|
|
@@ -764,6 +800,7 @@ JSON receipts:
|
|
|
764
800
|
- `order status`: `{ kind: "work_order_status", order, receipt_count, receipts }`
|
|
765
801
|
- `receipt verify`: `{ kind: "work_receipt_verify", ok, receipt, work_order?, checks, errors, warnings }`
|
|
766
802
|
- `artifact add`: `{ action: "artifact_registered", target, archive }`
|
|
803
|
+
- `validate` work-validate-receipt: `{ action: "work.validate", ok, type, target?, checked_count, nodes, warning_count, error_count, warnings, errors, diagnostics }`
|
|
767
804
|
|
|
768
805
|
### `mdkg goal`
|
|
769
806
|
|
|
@@ -796,7 +833,7 @@ Usage:
|
|
|
796
833
|
- `mdkg goal archive <goal-id-or-qid> [--ws <alias>] [--json]`
|
|
797
834
|
|
|
798
835
|
Behavior:
|
|
799
|
-
- `goal show` reports goal condition, goal state, scope refs, active node, required skills, required checks, and source path.
|
|
836
|
+
- `goal show` reports goal condition, goal state, scope refs, active node, last active node, required skills, required checks, and source path.
|
|
800
837
|
- `goal select` writes local ignored selected-goal state so `goal next` can omit the goal id.
|
|
801
838
|
- `goal activate` makes one local root goal active, pauses competing local active goals in the same workspace, and writes selected-goal state.
|
|
802
839
|
- `goal current` shows the selected goal or unique active goal fallback.
|
|
@@ -804,7 +841,7 @@ Behavior:
|
|
|
804
841
|
- `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.
|
|
805
842
|
- `goal claim` mutates only `active_node` after the work item is confirmed inside the goal scope.
|
|
806
843
|
- `goal evaluate` is report-only and never runs commands from `required_checks`.
|
|
807
|
-
- `goal pause`, `goal resume`, and `goal done` update `goal_state`, compatible work status, and `updated
|
|
844
|
+
- `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.
|
|
808
845
|
- `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.
|
|
809
846
|
- subgraph goal qids are read-only; update the source workspace instead.
|
|
810
847
|
|
|
@@ -829,7 +866,7 @@ When to use:
|
|
|
829
866
|
Usage:
|
|
830
867
|
- `mdkg task start <id-or-qid> [--ws <alias>] [--run-id <id>] [--note "<text>"] [--json]`
|
|
831
868
|
- `mdkg task update <id-or-qid> [options] [--json]`
|
|
832
|
-
- `mdkg task done <id-or-qid> [--checkpoint "<title>"] [options] [--json]`
|
|
869
|
+
- `mdkg task done <id-or-qid> [--checkpoint "<title>"] [--checkpoint-kind implementation|test-proof|goal-closeout|audit|handoff] [options] [--json]`
|
|
833
870
|
|
|
834
871
|
#### `mdkg task start`
|
|
835
872
|
|
|
@@ -865,12 +902,13 @@ JSON receipt:
|
|
|
865
902
|
|
|
866
903
|
Usage:
|
|
867
904
|
- `mdkg task done <id-or-qid> [--ws <alias>] [--add-artifacts <a,...>] [--add-links <l,...>]`
|
|
868
|
-
- ` [--add-refs <id,...>] [--checkpoint "<title>"] [--run-id <id>] [--note "<text>"] [--json]`
|
|
905
|
+
- ` [--add-refs <id,...>] [--checkpoint "<title>"] [--checkpoint-kind implementation|test-proof|goal-closeout|audit|handoff] [--run-id <id>] [--note "<text>"] [--json]`
|
|
869
906
|
|
|
870
907
|
Behavior:
|
|
871
908
|
- supports task-like `feat`, `task`, `bug`, `test`, and `spike` nodes
|
|
872
909
|
- sets `status: done`
|
|
873
910
|
- `--checkpoint` creates a related checkpoint
|
|
911
|
+
- `--checkpoint-kind` selects the evidence template for the related checkpoint
|
|
874
912
|
- if `events.jsonl` is missing for the workspace, prints a short `stderr` reminder about `mdkg event enable`
|
|
875
913
|
|
|
876
914
|
JSON receipt:
|
|
@@ -899,7 +937,9 @@ When to use:
|
|
|
899
937
|
- run the repo trust gate before calling work done
|
|
900
938
|
|
|
901
939
|
Usage:
|
|
902
|
-
- `mdkg validate [--out <path>] [--quiet] [--json]`
|
|
940
|
+
- `mdkg validate [--out <path>] [--quiet] [--changed-only] [--json]`
|
|
941
|
+
- `--changed-only` filters warning presentation to changed `.mdkg` files while full graph errors still run
|
|
942
|
+
- JSON receipts include `warning_diagnostics` with warning ids, categories, severity, paths, refs, and remediation text
|
|
903
943
|
|
|
904
944
|
Flags:
|
|
905
945
|
- `--out <path>`
|
|
@@ -956,11 +996,12 @@ JSON receipt:
|
|
|
956
996
|
### `mdkg checkpoint`
|
|
957
997
|
|
|
958
998
|
Usage:
|
|
959
|
-
- `mdkg checkpoint new <title> [--ws <alias>] [--json]`
|
|
999
|
+
- `mdkg checkpoint new <title> [--kind implementation|test-proof|goal-closeout|audit|handoff] [--ws <alias>] [--json]`
|
|
960
1000
|
- ` [--relates <id,id,...>] [--scope <id,id,...>] [--run-id <id>] [--note "<text>"]`
|
|
1001
|
+
- checkpoint kinds render bodies with command evidence, pass/fail status, known warnings, changed surfaces, boundaries, and follow-up refs
|
|
961
1002
|
|
|
962
1003
|
JSON receipt:
|
|
963
|
-
- `{ action: "created", checkpoint: { workspace, id, qid, path } }`
|
|
1004
|
+
- `{ action: "created", checkpoint: { workspace, id, qid, path, kind } }`
|
|
964
1005
|
|
|
965
1006
|
### `mdkg index`
|
|
966
1007
|
|
|
@@ -1000,6 +1041,7 @@ Usage:
|
|
|
1000
1041
|
- `mdkg db queue list <queue> [--status ready|leased|acked|dead_letter|all] [--limit <n>] [--json]`
|
|
1001
1042
|
- `mdkg db queue show <queue> <message-id> [--json]`
|
|
1002
1043
|
- `mdkg db queue stats|list|show ... [--json]`
|
|
1044
|
+
- `mdkg db queue contract [--json]`
|
|
1003
1045
|
- `mdkg db snapshot seal [--queue-policy drain|paused] [--json]`
|
|
1004
1046
|
- `mdkg db snapshot verify [--json]`
|
|
1005
1047
|
- `mdkg db snapshot status [--json]`
|
|
@@ -1020,6 +1062,10 @@ Boundaries:
|
|
|
1020
1062
|
in the configured migration table
|
|
1021
1063
|
- `mdkg db queue ...` exposes durable local delivery operations backed by
|
|
1022
1064
|
node:sqlite; queue rows are delivery state, not canonical event history
|
|
1065
|
+
- `mdkg db queue contract --json` returns the public adapter contract covering
|
|
1066
|
+
canonical payload hashing, dedupe semantics, oldest-ready claim order,
|
|
1067
|
+
lease-owner checked settlement, retry/dead-letter behavior, release-expired,
|
|
1068
|
+
pause/resume, snapshot queue policy, stats, and boundary guidance
|
|
1023
1069
|
- paused queues reject enqueue and claim, but ack/fail/dead-letter and
|
|
1024
1070
|
release-expired remain available so leased work can settle
|
|
1025
1071
|
- event tables are durable local history for project DB state transitions;
|
|
@@ -1061,6 +1107,12 @@ Usage:
|
|
|
1061
1107
|
|
|
1062
1108
|
Usage:
|
|
1063
1109
|
- `mdkg format`
|
|
1110
|
+
- `mdkg format --headings [--dry-run|--apply] [--json]`
|
|
1111
|
+
|
|
1112
|
+
Notes:
|
|
1113
|
+
- default `mdkg format` normalizes frontmatter in place
|
|
1114
|
+
- `mdkg format --headings` defaults to dry-run and returns planned missing-heading additions
|
|
1115
|
+
- `mdkg format --headings --apply` appends missing recommended body headings and returns a migration receipt
|
|
1064
1116
|
|
|
1065
1117
|
### `mdkg status`
|
|
1066
1118
|
|
|
@@ -1086,6 +1138,34 @@ JSON receipt shape:
|
|
|
1086
1138
|
- `generated` reports index, skills, capabilities, and subgraph cache existence/staleness
|
|
1087
1139
|
- `summary` includes machine-readable warning and error counts plus messages
|
|
1088
1140
|
|
|
1141
|
+
### `mdkg mcp`
|
|
1142
|
+
|
|
1143
|
+
Usage:
|
|
1144
|
+
- `mdkg mcp serve --stdio`
|
|
1145
|
+
|
|
1146
|
+
When to use:
|
|
1147
|
+
- expose one local mdkg root to an MCP-capable agent or orchestrator
|
|
1148
|
+
- let an external agent inspect mdkg status, workspace/subgraph aliases, search/show results, in-memory packs, goal current/next, and validation without shelling out to individual CLI commands
|
|
1149
|
+
|
|
1150
|
+
Flags:
|
|
1151
|
+
- `--stdio`
|
|
1152
|
+
- `--root`, `-r <path>`
|
|
1153
|
+
|
|
1154
|
+
Boundaries:
|
|
1155
|
+
- stdio is the only transport in this release; mdkg opens no HTTP listener
|
|
1156
|
+
- bind the server to one graph root with `--root <path>` when launching from outside the repo
|
|
1157
|
+
- tool calls are read-only and return MCP `structuredContent` plus text content
|
|
1158
|
+
- exposed tools: `mdkg_status`, `mdkg_workspace_list`, `mdkg_search`, `mdkg_show`, `mdkg_pack`, `mdkg_goal_current`, `mdkg_goal_next`, and `mdkg_validate`
|
|
1159
|
+
- `mdkg_pack` builds an in-memory bounded pack and does not write `.mdkg/pack`
|
|
1160
|
+
- no task, goal activation, graph import, queue, event, archive, format, SQL, shell, arbitrary file-read, filesystem mutation, environment, or secret-access tool is exposed
|
|
1161
|
+
- mutation allowlists and broader CLI parity are future design work, not part of this command surface
|
|
1162
|
+
- stdout is reserved for newline-delimited JSON-RPC MCP messages; diagnostics must stay off stdout
|
|
1163
|
+
|
|
1164
|
+
JSON-RPC receipt shapes:
|
|
1165
|
+
- initialize: `{ protocolVersion, capabilities: { tools }, serverInfo, instructions }`
|
|
1166
|
+
- `tools/list`: `{ tools: [{ name, title, description, inputSchema, annotations }] }`
|
|
1167
|
+
- `tools/call`: MCP tool result with `{ content, structuredContent, isError }`
|
|
1168
|
+
|
|
1089
1169
|
### `mdkg fix`
|
|
1090
1170
|
|
|
1091
1171
|
When to use:
|
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.3.
|
|
17
|
+
Current package version in source: `0.3.6`
|
|
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
|
|
|
@@ -29,9 +29,21 @@ The primary loop is:
|
|
|
29
29
|
4. build a deterministic pack
|
|
30
30
|
5. validate before closing the loop
|
|
31
31
|
|
|
32
|
-
If an agent is involved,
|
|
32
|
+
If an agent is involved, use `mdkg pack <id>` for deterministic context and
|
|
33
|
+
`mdkg handoff create <id-or-qid> --json` for a sanitized, copy-ready agent
|
|
34
|
+
handoff prompt. Handoffs summarize goal/work state, included pack nodes, latest
|
|
35
|
+
checkpoint, boundaries, required checks, next actions, and raw-content marker
|
|
36
|
+
warnings without copying raw node bodies into the prompt.
|
|
33
37
|
If a repo needs repeatable procedures, author them as first-class skills under `.mdkg/skills/`.
|
|
34
38
|
|
|
39
|
+
Work nodes can separate semantic background from executable scope with
|
|
40
|
+
`context_refs` and `evidence_refs`. Use `context_refs` for related plans,
|
|
41
|
+
external docs, subgraph qids, or URI references that explain why work exists.
|
|
42
|
+
Use `evidence_refs` for proof, audit, receipt, checkpoint, archive, or URI
|
|
43
|
+
references. These fields are indexed, validated, shown, and packable, but they
|
|
44
|
+
do not make referenced nodes actionable goal work; keep executable queues in
|
|
45
|
+
goal `scope_refs`.
|
|
46
|
+
|
|
35
47
|
## Install
|
|
36
48
|
|
|
37
49
|
```bash
|
|
@@ -136,6 +148,7 @@ Build deterministic context:
|
|
|
136
148
|
mdkg pack task-1
|
|
137
149
|
mdkg pack task-1 --profile concise --dry-run --stats
|
|
138
150
|
mdkg pack task-1 --visibility public --dry-run
|
|
151
|
+
mdkg pack task-1 --edges context_refs,evidence_refs --format json
|
|
139
152
|
```
|
|
140
153
|
|
|
141
154
|
Create a full `.mdkg` graph snapshot bundle for root or child orchestration:
|
|
@@ -167,9 +180,11 @@ mdkg graph import-template templates/website-template-mdkg --start-goal goal-1 -
|
|
|
167
180
|
```
|
|
168
181
|
|
|
169
182
|
`graph clone` and `graph fork` preserve IDs; `graph import-template` rewrites
|
|
170
|
-
canonical numeric IDs and internal links to avoid same-repo collisions.
|
|
171
|
-
|
|
172
|
-
|
|
183
|
+
canonical numeric IDs and internal links to avoid same-repo collisions. With
|
|
184
|
+
`--select-goal --apply`, import-template activates the rewritten imported start
|
|
185
|
+
goal, pauses competing active root goals, validates the graph, and then writes
|
|
186
|
+
selected-goal state. Subgraphs remain read-only planning views; use
|
|
187
|
+
`mdkg graph ...` when authored graph state should be created.
|
|
173
188
|
|
|
174
189
|
Register a child repo bundle as a read-only subgraph planning view:
|
|
175
190
|
|
|
@@ -206,10 +221,27 @@ Materialized trees are generated local state, ignored by graph indexing/search/v
|
|
|
206
221
|
|
|
207
222
|
Subgraph nodes are projected under the subgraph alias, for example `child_repo:task-1`. They are available to `list`, `search`, `show`, `pack`, capability discovery, and `capability resolve`, but remain read-only; mutate the child repo and sync its root-owned bundle snapshot to change subgraph content. Root-authored relationship and reference fields can point at configured subgraph qids such as `child_repo:work.example`; local ownership fields such as `epic`, `parent`, `prev`, and `next` stay local-only. Stale subgraphs warn during planning reads and fail `mdkg subgraph verify`. Public or internal subgraphs must be backed by public bundle profiles; private subgraphs stay private planning context.
|
|
208
223
|
|
|
224
|
+
Use `mdkg graph refs <id-or-qid> --json` to inspect inbound and outbound scope, context, evidence, blocker, related, and structural links for local or read-only subgraph qids without mutating either graph.
|
|
225
|
+
|
|
226
|
+
Launch a local read-only MCP server when an MCP-capable agent should inspect a
|
|
227
|
+
specific mdkg graph without receiving mutation tools:
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
mdkg mcp serve --stdio --root /path/to/repo
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
The MCP surface is stdio-only in this release. It exposes read-only tools for
|
|
234
|
+
status, workspace/subgraph listing, search, show, in-memory pack generation,
|
|
235
|
+
goal current/next, and validation. It does not expose task updates, goal
|
|
236
|
+
activation, graph import, queue, event, archive, format, SQL, shell, arbitrary
|
|
237
|
+
file reads, filesystem mutation, environment variables, or secret access.
|
|
238
|
+
Future mutation allowlists remain design work.
|
|
239
|
+
|
|
209
240
|
Validate before handoff or commit:
|
|
210
241
|
|
|
211
242
|
```bash
|
|
212
243
|
mdkg validate
|
|
244
|
+
mdkg handoff create <id-or-qid> --out .mdkg/handoffs/example.md
|
|
213
245
|
```
|
|
214
246
|
|
|
215
247
|
Discover cached capability surfaces:
|
|
@@ -264,8 +296,11 @@ Update structured task state and evidence while keeping body and narrative edits
|
|
|
264
296
|
mdkg task start task-1 --run-id run_local_1
|
|
265
297
|
mdkg task update task-1 --add-artifacts tests://unit.txt --add-tags release
|
|
266
298
|
mdkg task done task-1 --checkpoint "release readiness milestone"
|
|
299
|
+
mdkg task done task-1 --checkpoint "goal complete" --checkpoint-kind goal-closeout
|
|
267
300
|
```
|
|
268
301
|
|
|
302
|
+
Checkpoint kinds are `implementation`, `test-proof`, `goal-closeout`, `audit`, and `handoff`; generated checkpoint bodies include command evidence, pass/fail status, known warnings, changed surfaces, boundaries, and follow-up refs.
|
|
303
|
+
|
|
269
304
|
Ensure and append baseline event memory:
|
|
270
305
|
|
|
271
306
|
```bash
|
|
@@ -330,6 +365,7 @@ These are the commands new users and agents should learn first:
|
|
|
330
365
|
- `mdkg task`
|
|
331
366
|
- `mdkg validate`
|
|
332
367
|
- `mdkg status`
|
|
368
|
+
- `mdkg mcp`
|
|
333
369
|
- `mdkg fix`
|
|
334
370
|
|
|
335
371
|
Advanced / maintenance commands still exist, but they are not the first-run story:
|
|
@@ -342,6 +378,11 @@ Advanced / maintenance commands still exist, but they are not the first-run stor
|
|
|
342
378
|
- `mdkg fix plan --json`
|
|
343
379
|
- `mdkg workspace`
|
|
344
380
|
|
|
381
|
+
For large historical graphs, use `mdkg validate --changed-only --json` to keep
|
|
382
|
+
warning review focused on changed `.mdkg` files while full graph errors still
|
|
383
|
+
run. Use `mdkg format --headings --dry-run --json` to review missing recommended
|
|
384
|
+
heading additions before applying them with `--apply`.
|
|
385
|
+
|
|
345
386
|
## Operator health
|
|
346
387
|
|
|
347
388
|
Use `mdkg status --json` for a read-only operator summary before mutating a
|
|
@@ -461,6 +502,12 @@ rows are durable local project DB history; receipts, reducers, writer leases,
|
|
|
461
502
|
and materializers remain internal helper surfaces in this release, with no
|
|
462
503
|
public `mdkg db event`, `mdkg db reducer`, `mdkg db lease`, or
|
|
463
504
|
`mdkg db materializer` CLI yet.
|
|
505
|
+
`mdkg db queue contract --json` is the read-only public adapter contract for
|
|
506
|
+
downstream integrations. It documents canonical payload hashing, dedupe keys,
|
|
507
|
+
oldest-ready claim order, lease-owner checked ack/fail/dead-letter, retry
|
|
508
|
+
delay, expired lease reclaim, max-attempt dead-letter behavior, pause/resume,
|
|
509
|
+
snapshot queue policy, and stats without exposing raw SQL or making queue rows
|
|
510
|
+
canonical runtime history.
|
|
464
511
|
`mdkg work trigger --enqueue <queue>` can bridge a submitted work order mirror
|
|
465
512
|
into an explicitly created active project DB queue; it writes local delivery
|
|
466
513
|
state only and never executes work.
|
|
@@ -488,7 +535,7 @@ Goal nodes are durable recursive objective contracts. Use `mdkg new goal "<objec
|
|
|
488
535
|
|
|
489
536
|
`goal` is work-like but distinct from `task`: it can have status, priority, graph links, skills, explicit `scope_refs`, and structured goal fields, but normal `mdkg next` does not select goals. Use `mdkg goal activate <goal-id>` to make one local root goal active, pause competing local active goals, and select it for future `goal next` calls. Use `mdkg goal select <goal-id>` only when you want to change the local ignored selected-goal pointer without changing lifecycle state. `mdkg goal next <goal-id>` remains available for explicit selection. Epics organize goal scope recursively but are not returned as executable work.
|
|
490
537
|
|
|
491
|
-
Use `mdkg goal claim [goal-id] <work-id>` to durably set `active_node` after choosing the next scoped item. `goal next` is read-only. Use `mdkg goal pause|resume|done` to update goal state after review
|
|
538
|
+
Use `mdkg goal claim [goal-id] <work-id>` to durably set `active_node` after choosing the next scoped item. `goal next` is read-only. Use `mdkg goal pause|resume|done` to update goal state after review; closing a goal moves the final `active_node` to `last_active_node` so completed goals keep history without staying actionable. Use `mdkg goal archive` for superseded historical roadmap goals that should remain readable but non-actionable.
|
|
492
539
|
|
|
493
540
|
Required checks are stored as report-only guidance. Agents should run the checks themselves, record evidence in the goal or active work item, then use `mdkg goal evaluate` to summarize the current evidence state. During normal goal execution, skill improvements should be recorded as improvement candidates or proposal nodes; edit `SKILL.md` files only when the active node is explicit skill-maintenance work.
|
|
494
541
|
|
|
@@ -528,7 +575,7 @@ Use `mdkg new spec|work|work_order|receipt|feedback|dispute|proposal "<title>"`
|
|
|
528
575
|
|
|
529
576
|
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.
|
|
530
577
|
|
|
531
|
-
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.
|
|
578
|
+
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 validate [<id-or-qid>] [--type spec|work|work_order|receipt|feedback|dispute|proposal] --json` is a read-only focused validator for agent workflow mirrors; it returns typed diagnostics and warns on obvious raw secret, prompt, token, or payload markers. `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.
|
|
532
579
|
|
|
533
580
|
## Archive sidecars
|
|
534
581
|
|