mdkg 0.3.6 → 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.
Files changed (48) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/CLI_COMMAND_MATRIX.md +56 -7
  3. package/README.md +33 -3
  4. package/dist/cli.js +132 -11
  5. package/dist/command-contract.json +431 -16
  6. package/dist/commands/bundle.js +2 -0
  7. package/dist/commands/checkpoint.js +139 -1
  8. package/dist/commands/db.js +8 -0
  9. package/dist/commands/format.js +116 -0
  10. package/dist/commands/goal.js +60 -0
  11. package/dist/commands/graph.js +148 -0
  12. package/dist/commands/handoff.js +295 -0
  13. package/dist/commands/mcp.js +9 -0
  14. package/dist/commands/pack.js +3 -1
  15. package/dist/commands/query_output.js +2 -0
  16. package/dist/commands/show.js +8 -0
  17. package/dist/commands/status.js +1 -0
  18. package/dist/commands/task.js +2 -0
  19. package/dist/commands/upgrade.js +61 -0
  20. package/dist/commands/validate.js +162 -3
  21. package/dist/commands/work.js +164 -0
  22. package/dist/core/project_db_queue_contract.js +101 -0
  23. package/dist/graph/edges.js +15 -0
  24. package/dist/graph/frontmatter.js +4 -1
  25. package/dist/graph/indexer.js +8 -0
  26. package/dist/graph/node.js +12 -1
  27. package/dist/graph/sqlite_index.js +2 -0
  28. package/dist/graph/subgraphs.js +2 -0
  29. package/dist/graph/validate_graph.js +5 -0
  30. package/dist/graph/visibility.js +6 -0
  31. package/dist/init/AGENT_START.md +4 -1
  32. package/dist/init/CLI_COMMAND_MATRIX.md +24 -3
  33. package/dist/init/README.md +17 -2
  34. package/dist/init/init-manifest.json +12 -12
  35. package/dist/init/templates/default/bug.md +2 -0
  36. package/dist/init/templates/default/chk.md +3 -0
  37. package/dist/init/templates/default/epic.md +2 -0
  38. package/dist/init/templates/default/feat.md +2 -0
  39. package/dist/init/templates/default/goal.md +3 -0
  40. package/dist/init/templates/default/spike.md +2 -0
  41. package/dist/init/templates/default/task.md +2 -0
  42. package/dist/init/templates/default/test.md +2 -0
  43. package/dist/pack/export_json.js +20 -8
  44. package/dist/pack/export_md.js +15 -4
  45. package/dist/pack/export_xml.js +9 -4
  46. package/dist/pack/metrics.js +12 -4
  47. package/dist/pack/pack.js +9 -1
  48. package/package.json +6 -2
@@ -19,6 +19,8 @@ function validateEdgeTargets(index, allowMissing, knownSkillSlugs, externalWorks
19
19
  ["relates", edges.relates],
20
20
  ["blocked_by", edges.blocked_by],
21
21
  ["blocks", edges.blocks],
22
+ ["context_refs", edges.context_refs ?? []],
23
+ ["evidence_refs", edges.evidence_refs ?? []],
22
24
  ];
23
25
  if (edges.epic) {
24
26
  edgeLists.push(["epic", [edges.epic]]);
@@ -34,6 +36,9 @@ function validateEdgeTargets(index, allowMissing, knownSkillSlugs, externalWorks
34
36
  }
35
37
  for (const [edgeKey, values] of edgeLists) {
36
38
  for (const value of values) {
39
+ if ((edgeKey === "context_refs" || edgeKey === "evidence_refs") && (0, refs_1.isUriRef)(value)) {
40
+ continue;
41
+ }
37
42
  const targetNode = nodes[value];
38
43
  if (targetNode &&
39
44
  ["epic", "parent", "prev", "next"].includes(edgeKey) &&
@@ -88,6 +88,12 @@ function collectNodeStringReferences(node) {
88
88
  for (const [index, value] of node.edges.blocks.entries()) {
89
89
  values.push({ field: `blocks[${index}]`, value });
90
90
  }
91
+ for (const [index, value] of (node.edges.context_refs ?? []).entries()) {
92
+ values.push({ field: `context_refs[${index}]`, value });
93
+ }
94
+ for (const [index, value] of (node.edges.evidence_refs ?? []).entries()) {
95
+ values.push({ field: `evidence_refs[${index}]`, value });
96
+ }
91
97
  for (const [index, value] of node.links.entries()) {
92
98
  values.push({ field: `links[${index}]`, value });
93
99
  }
@@ -39,7 +39,10 @@ Agent operating prompt:
39
39
  node:sqlite queue delivery, internal event/receipt/reducer, writer lease/CAS,
40
40
  and queue control migrations. Queue state is delivery infrastructure, not
41
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
42
+ claim, settle, inspect, and drain local queues. Use
43
+ `mdkg db queue contract --json` for the public adapter contract covering
44
+ payload hashing, dedupe, claim order, lease-owner settlement, retry,
45
+ dead-letter, release-expired, pause/resume, snapshot policy, and stats. Event rows are durable local
43
46
  project DB history; receipts, reducers, writer leases, and materializers are
44
47
  internal local helper surfaces, with no public `mdkg db event`,
45
48
  `mdkg db reducer`, `mdkg db lease`, or `mdkg db materializer` CLI yet. Use `mdkg db verify` and `mdkg db stats` for
@@ -17,6 +17,7 @@ Primary commands:
17
17
  - `mdkg list`
18
18
  - `mdkg search`
19
19
  - `mdkg pack`
20
+ - `mdkg handoff create <id-or-qid> [--ws <alias>] [--depth <n>] [--out <path>] [--json]`
20
21
  - `mdkg skill`
21
22
  - `mdkg capability`
22
23
  - `mdkg spec`
@@ -34,6 +35,14 @@ Primary commands:
34
35
  - `mdkg fix apply [--family ids] [--target <id-or-qid>] [--base-ref <ref>] [--json]`
35
36
  - `mdkg fix ids [--target <id-or-qid>] [--base-ref <ref>] [--apply] [--json]`
36
37
 
38
+ Semantic refs:
39
+ - work nodes may use `context_refs` for non-executable background and `evidence_refs` for proof/audit refs
40
+ - semantic refs may point at local ids, subgraph qids, or URI refs
41
+ - use `mdkg pack <id> --edges context_refs,evidence_refs` when a handoff should traverse semantic refs
42
+ - use `mdkg handoff create <id-or-qid> --json` for sanitized copy-ready agent handoff prompts
43
+ - handoffs summarize graph state, latest checkpoint, boundaries, required checks, next actions, and raw-marker warnings without copying raw node bodies
44
+ - executable goal queues still belong in goal `scope_refs`
45
+
37
46
  Operator health:
38
47
  - `mdkg status [--json]` is a read-only summary for scripts and agents
39
48
  - reports mdkg version/config, git state, graph/index freshness, selected-goal state, project DB verification summary, and generated cache status
@@ -71,6 +80,7 @@ Project database commands:
71
80
  - `mdkg db verify [--json]`
72
81
  - `mdkg db stats [--json]`
73
82
  - `mdkg db queue create|pause|resume|enqueue|claim|ack|fail|dead-letter|release-expired|stats|list|show ... [--json]`
83
+ - `mdkg db queue contract [--json]`
74
84
  - `mdkg db snapshot seal [--queue-policy drain|paused] [--json]`
75
85
  - `mdkg db snapshot verify [--json]`
76
86
  - `mdkg db snapshot status [--json]`
@@ -87,6 +97,9 @@ Project database commands:
87
97
  in the configured migration table
88
98
  - `mdkg db queue ...` exposes durable local delivery operations backed by
89
99
  node:sqlite; queue rows are delivery state, not canonical event history
100
+ - `mdkg db queue contract --json` returns the public adapter contract for
101
+ payload hashes, dedupe, claim order, lease-owner settlement, retries,
102
+ dead-letter, release-expired, pause/resume, snapshot policy, and stats
90
103
  - paused queues reject enqueue and claim, but ack/fail/dead-letter and
91
104
  release-expired remain available so leased work can settle
92
105
  - event tables are durable local history for project DB state transitions;
@@ -105,7 +118,9 @@ Project database commands:
105
118
  - active `.mdkg/db/runtime/` files and `.mdkg/db` WAL/SHM/journal/lock/temp files are ignored by default
106
119
 
107
120
  Validation commands:
108
- - `mdkg validate [--out <path>] [--quiet] [--json]`
121
+ - `mdkg validate [--out <path>] [--quiet] [--changed-only] [--json]`
122
+ - `--changed-only` filters warning presentation to changed `.mdkg` files while full graph errors still run
123
+ - JSON receipts include `warning_diagnostics` with warning ids, categories, severity, paths, refs, and remediation text
109
124
 
110
125
  Node creation commands:
111
126
  - `mdkg new <type> "<title>" [options] [--json]`
@@ -146,11 +161,12 @@ Event log commands:
146
161
  Task mutation commands:
147
162
  - `mdkg task start <id-or-qid> [--ws <alias>] [--run-id <id>] [--note "<text>"] [--json]`
148
163
  - `mdkg task update <id-or-qid> [options] [--json]`
149
- - `mdkg task done <id-or-qid> [--checkpoint "<title>"] [options] [--json]`
164
+ - `mdkg task done <id-or-qid> [--checkpoint "<title>"] [--checkpoint-kind implementation|test-proof|goal-closeout|audit|handoff] [options] [--json]`
150
165
  - task commands support task-like `feat`, `task`, `bug`, `test`, and `spike` nodes
151
166
 
152
167
  Checkpoint commands:
153
- - `mdkg checkpoint new <title> [--ws <alias>] [--json]`
168
+ - `mdkg checkpoint new <title> [--kind implementation|test-proof|goal-closeout|audit|handoff] [--ws <alias>] [--json]`
169
+ - checkpoint kinds render bodies with command evidence, pass/fail status, known warnings, changed surfaces, boundaries, and follow-up refs
154
170
 
155
171
  Agent bootstrap:
156
172
  - `mdkg init --agent`
@@ -220,6 +236,7 @@ Graph clone, fork, and template import:
220
236
  - `mdkg graph clone <source-bundle-or-mdkg-dir> --target <path> [--json]`
221
237
  - `mdkg graph fork <source-bundle-or-mdkg-dir> --target <path> [--start-goal <goal-id>] [--json]`
222
238
  - `mdkg graph import-template <source-bundle-or-mdkg-dir> [--start-goal <goal-id>] [--select-goal] [--id-prefix <prefix>] [--dry-run] [--apply] [--json]`
239
+ - `mdkg graph refs <id-or-qid> [--ws <alias>] [--json]`
223
240
  - `graph clone` and `graph fork` preserve IDs because the target is a separate graph namespace
224
241
  - clone/fork targets must be empty or absent and stay under the current mdkg root
225
242
  - live directory sources are never mutated; clone/fork refuses targets nested inside a live source directory
@@ -230,6 +247,7 @@ Graph clone, fork, and template import:
230
247
  - colliding semantic template IDs require `--id-prefix`
231
248
  - `--select-goal` requires `--start-goal`; on apply it activates the imported start goal, pauses competing active root goals, validates, then writes selected-goal state
232
249
  - importing active template goals without `--select-goal` fails before writing when it would create multiple active root goals
250
+ - `graph refs` is read-only and summarizes inbound/outbound scope, context, evidence, blocker, related, and structural refs across local and subgraph qids
233
251
  - subgraphs remain read-only bundle projections for orchestration context; use `graph clone|fork|import-template` when authored graph state should be created
234
252
 
235
253
  Subgraph orchestration:
@@ -263,11 +281,13 @@ Work semantic mirrors:
263
281
  - `mdkg work receipt verify <id-or-qid> [--json]`
264
282
  - `mdkg work receipt update <id-or-qid> [--receipt-status <status>] [--add-artifacts <...>] [--add-proof-refs <...>] [--add-attestation-refs <...>] [--json]`
265
283
  - `mdkg work artifact add <order-or-receipt-id-or-qid> <file> [--id <archive.id>] [--kind source|artifact] [--json]`
284
+ - `mdkg work validate [<id-or-qid>] [--type spec|work|work_order|receipt|feedback|dispute|proposal] [--json]`
266
285
  - `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
267
286
  - example: `mdkg work trigger work.example --id order.example-1 --requester user://example --json`
268
287
  - `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
269
288
  - `work order status` is read-only and reports deterministic order state plus linked receipts
270
289
  - `work receipt verify` is read-only and reports linkage, evidence, archive ref, hash, outcome, and redaction-policy checks
290
+ - `work validate` is read-only and reports typed diagnostics for agent workflow mirrors; obvious raw secret, prompt, token, or payload markers are warnings, not hard failures
271
291
  - 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
272
292
  - do not store raw secrets, credentials, live payment state, ledger mutations, or canonical marketplace state in work mirrors
273
293
  - `artifact://...` refs identify external/runtime-managed artifacts; `archive://...` refs identify committed mdkg archive sidecars
@@ -299,6 +319,7 @@ Goal nodes:
299
319
  - `goal activate` makes one local root goal active, pauses competing local active goals in the same workspace, and writes selected-goal state
300
320
  - `goal archive` marks a superseded historical goal archived so it remains readable but not actionable
301
321
  - `goal next` is read-only; use `goal claim` to set `active_node`
322
+ - `goal done` preserves the final actionable item as `last_active_node` and removes actionable `active_node`
302
323
  - `mdkg goal evaluate` is report-only and never runs commands from `required_checks`
303
324
  - skill improvements discovered during normal goal execution should be recorded as candidates or proposals unless the active node is skill-maintenance
304
325
 
@@ -25,6 +25,7 @@ mdkg new task "..." --status todo --priority 1
25
25
  mdkg search "..."
26
26
  mdkg show <id>
27
27
  mdkg pack <id>
28
+ mdkg handoff create <id-or-qid> --json
28
29
  mdkg capability search "..."
29
30
  mdkg spec list --json
30
31
  mdkg archive list
@@ -36,7 +37,14 @@ mdkg fix plan --json
36
37
  mdkg validate
37
38
  ```
38
39
 
39
- This repo is already initialized. Use `mdkg upgrade` to preview safe scaffold updates, `mdkg index` to create or refresh generated graph/skill/capability/subgraph and SQLite caches after init, `mdkg new` to create work, `mdkg new goal "..."` plus `mdkg goal activate/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 graph ...` to clone/fork/import authored graph templates, `mdkg subgraph ...` to register read-only child graph planning views, `mdkg pack <id>` to build deterministic context, and `mdkg validate` before closeout.
40
+ This repo is already initialized. Use `mdkg upgrade` to preview safe scaffold updates, `mdkg index` to create or refresh generated graph/skill/capability/subgraph and SQLite caches after init, `mdkg new` to create work, `mdkg new goal "..."` plus `mdkg goal activate/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 graph ...` to clone/fork/import authored graph templates, `mdkg subgraph ...` to register read-only child graph planning views, `mdkg pack <id>` to build deterministic context, `mdkg handoff create <id-or-qid> --json` to create a sanitized copy-ready agent handoff prompt, and `mdkg validate` before closeout.
41
+
42
+ `mdkg handoff create` summarizes goal/work state, included pack nodes, latest
43
+ checkpoint, boundaries, required checks, next actions, and raw-content marker
44
+ warnings without copying raw node bodies into the prompt. Use `--out` to write
45
+ the handoff artifact inside the repo root.
46
+
47
+ For large historical graphs, `mdkg validate --changed-only --json` keeps warning review focused on changed `.mdkg` files while full graph errors still run. `mdkg format --headings --dry-run --json` previews missing recommended heading additions before `--apply`.
40
48
 
41
49
  Use `mdkg status --json` for a read-only operator summary of Git, graph,
42
50
  selected-goal, project DB, and generated-cache health before mutating work. Use
@@ -124,7 +132,11 @@ infrastructure, not canonical event history; use `mdkg db queue ...` to create,
124
132
  pause, enqueue, claim, settle, inspect, and drain local queues. Event rows are
125
133
  durable local project DB history; receipts, reducers, writer leases, and
126
134
  materializers are internal local helper surfaces, with no public `mdkg db event`,
127
- `mdkg db reducer`, `mdkg db lease`, or `mdkg db materializer` CLI yet. Use `mdkg db verify` for non-mutating health checks and
135
+ `mdkg db reducer`, `mdkg db lease`, or `mdkg db materializer` CLI yet.
136
+ `mdkg db queue contract --json` returns the read-only public adapter contract
137
+ for canonical payload hashing, dedupe keys, oldest-ready claim order,
138
+ lease-owner checked settlement, retry/dead-letter behavior, release-expired,
139
+ pause/resume, snapshot queue policy, and stats. Use `mdkg db verify` for non-mutating health checks and
128
140
  `mdkg db stats` for table counts, DB size, migration state, and receipt-file
129
141
  counts. Use `mdkg db snapshot seal` to create an opt-in sealed checkpoint under
130
142
  `.mdkg/db/state`; the default queue policy is drain, and
@@ -235,6 +247,9 @@ Update and artifact commands accept local ids or local qids; subgraph qids are r
235
247
  `mdkg work trigger` creates a deterministic submitted `WORK_ORDER.md` from a
236
248
  WORK contract or a SPEC with exactly one resolvable work contract. `mdkg work
237
249
  order status` and `mdkg work receipt verify` are read-only review helpers.
250
+ `mdkg work validate [<id-or-qid>] [--type spec|work|work_order|receipt|feedback|dispute|proposal] --json`
251
+ is a read-only focused validator for agent workflow mirrors with typed diagnostics
252
+ and raw secret, prompt, token, or payload marker warnings.
238
253
  `mdkg work trigger --enqueue <queue>` optionally writes a local project DB queue
239
254
  delivery message after the queue has been explicitly created and is active; it
240
255
  still does not execute work.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema_version": 1,
3
3
  "tool": "mdkg",
4
- "mdkg_version": "0.3.6",
4
+ "mdkg_version": "0.3.7",
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": "cecb50528b70c0c4e32f8a052a668b5d87d6ac542818229efa848a6b1ac42d62"
64
+ "sha256": "5a03de7c4602936e6108b3e8f2916ead8320a4020c335ea9cfd083d59eabf083"
65
65
  },
66
66
  {
67
67
  "path": ".mdkg/skills/build-pack-and-execute-task/SKILL.md",
@@ -91,12 +91,12 @@
91
91
  {
92
92
  "path": ".mdkg/templates/default/bug.md",
93
93
  "category": "template",
94
- "sha256": "88e3f8d67aa3b2156be2006bd1c8139b7b16b46f2c05a4f4d840b3746a40f9c5"
94
+ "sha256": "27ed977c67030befccfc469d9db257fadc9ad5331963e259c489ba03754194cb"
95
95
  },
96
96
  {
97
97
  "path": ".mdkg/templates/default/chk.md",
98
98
  "category": "template",
99
- "sha256": "15f793e422009c76f8bda72c3609157acd7f03762d9c9bdb096c4aa2e2c3fb89"
99
+ "sha256": "9e32f46665fc7cc582c4695772f5d99799f574229e740fa8892c7b9e75324de9"
100
100
  },
101
101
  {
102
102
  "path": ".mdkg/templates/default/dec.md",
@@ -116,12 +116,12 @@
116
116
  {
117
117
  "path": ".mdkg/templates/default/epic.md",
118
118
  "category": "template",
119
- "sha256": "56697b69af027fe08c00866c0c0670f7d7e2a0857803bd4aabb99f4761311879"
119
+ "sha256": "0f515c046064771e3f9abaa3689634bfae3ffcf2ffe9825e8e3b7dc15c24fc50"
120
120
  },
121
121
  {
122
122
  "path": ".mdkg/templates/default/feat.md",
123
123
  "category": "template",
124
- "sha256": "99cfdd97b40b119cf899fd766d816c07b7daaafd8ec8e70e6c6de5c0d37f581c"
124
+ "sha256": "25c04ce41d8cf519d5c3009219eeed48f76c23600c6b7999264831aa92cefc4b"
125
125
  },
126
126
  {
127
127
  "path": ".mdkg/templates/default/feedback.md",
@@ -131,7 +131,7 @@
131
131
  {
132
132
  "path": ".mdkg/templates/default/goal.md",
133
133
  "category": "template",
134
- "sha256": "710252d8a2dc35be71661d6988007af127052fa8ad24b1fb00374c975ae117a2"
134
+ "sha256": "8f984580aefd02b34639fa7f5d2a834662656bbf2e12f14a285f5ae31aff74ce"
135
135
  },
136
136
  {
137
137
  "path": ".mdkg/templates/default/prd.md",
@@ -166,17 +166,17 @@
166
166
  {
167
167
  "path": ".mdkg/templates/default/spike.md",
168
168
  "category": "template",
169
- "sha256": "ac805dca7e6edcdad35e24b615dc7399cbae3bed676b9da57e24a393eb425245"
169
+ "sha256": "56e881fad20bd4fda8ae53cc78ce6f30f4dacd083f4eda40f9f2ba3723d52e0e"
170
170
  },
171
171
  {
172
172
  "path": ".mdkg/templates/default/task.md",
173
173
  "category": "template",
174
- "sha256": "f6385dd4f56f1c8df164ac3e79d82c5a3fde3f952dc9cdc78c0b8077caa62277"
174
+ "sha256": "2db6e56298b22e9da9121e2ac31f2fd68e370211218c5bcaae1014a9e63b7cde"
175
175
  },
176
176
  {
177
177
  "path": ".mdkg/templates/default/test.md",
178
178
  "category": "template",
179
- "sha256": "bdae53e5cb4bd77712da155bbcfc24409ced8162c977e6bc478a9d1e695ddef7"
179
+ "sha256": "59484d4cf397707d738ccbc2f788c08eab58d3d73f37591f7bde8f1533b828ce"
180
180
  },
181
181
  {
182
182
  "path": ".mdkg/templates/default/work_order.md",
@@ -246,7 +246,7 @@
246
246
  {
247
247
  "path": "AGENT_START.md",
248
248
  "category": "startup_doc",
249
- "sha256": "46e734b6eae92eb957c3e29fb4d206e4be3fd6d32dd00e888e01a0dc75979428"
249
+ "sha256": "d305f0e61c2401814bc51067c8129a3ad131c6217692038bc7ffad012c305451"
250
250
  },
251
251
  {
252
252
  "path": "AGENTS.md",
@@ -261,7 +261,7 @@
261
261
  {
262
262
  "path": "CLI_COMMAND_MATRIX.md",
263
263
  "category": "startup_doc",
264
- "sha256": "5321d82b594c1c0aa5574dcffbf21e5a1d3df89566b0f9acfc854fcaac3e13a7"
264
+ "sha256": "84de4e06dd4d6d2b316e17c37bebcec373f1a9500d7107c8dd0ce5ca15048b7d"
265
265
  },
266
266
  {
267
267
  "path": "llms.txt",
@@ -16,6 +16,8 @@ relates: []
16
16
  blocked_by: []
17
17
  blocks: []
18
18
  refs: []
19
+ context_refs: []
20
+ evidence_refs: []
19
21
  aliases: []
20
22
  skills: []
21
23
  created: {{created}}
@@ -2,6 +2,7 @@
2
2
  id: {{id}}
3
3
  type: checkpoint
4
4
  title: {{title}}
5
+ checkpoint_kind: {{checkpoint_kind}}
5
6
  status: {{status}}
6
7
  priority: {{priority}}
7
8
  epic: {{epic}}
@@ -16,6 +17,8 @@ relates: []
16
17
  blocked_by: []
17
18
  blocks: []
18
19
  refs: []
20
+ context_refs: []
21
+ evidence_refs: []
19
22
  aliases: []
20
23
  skills: []
21
24
  scope: []
@@ -12,6 +12,8 @@ relates: []
12
12
  blocked_by: []
13
13
  blocks: []
14
14
  refs: []
15
+ context_refs: []
16
+ evidence_refs: []
15
17
  aliases: []
16
18
  skills: []
17
19
  created: {{created}}
@@ -16,6 +16,8 @@ relates: []
16
16
  blocked_by: []
17
17
  blocks: []
18
18
  refs: []
19
+ context_refs: []
20
+ evidence_refs: []
19
21
  aliases: []
20
22
  skills: []
21
23
  created: {{created}}
@@ -8,6 +8,7 @@ goal_state: {{goal_state}}
8
8
  goal_condition: {{goal_condition}}
9
9
  scope_refs: []
10
10
  active_node: {{active_node}}
11
+ last_active_node: {{last_active_node}}
11
12
  required_skills: []
12
13
  required_checks: []
13
14
  max_iterations: {{max_iterations}}
@@ -24,6 +25,8 @@ relates: []
24
25
  blocked_by: []
25
26
  blocks: []
26
27
  refs: []
28
+ context_refs: []
29
+ evidence_refs: []
27
30
  aliases: []
28
31
  skills: []
29
32
  created: {{created}}
@@ -16,6 +16,8 @@ relates: []
16
16
  blocked_by: []
17
17
  blocks: []
18
18
  refs: []
19
+ context_refs: []
20
+ evidence_refs: []
19
21
  aliases: []
20
22
  skills: []
21
23
  created: {{created}}
@@ -16,6 +16,8 @@ relates: []
16
16
  blocked_by: []
17
17
  blocks: []
18
18
  refs: []
19
+ context_refs: []
20
+ evidence_refs: []
19
21
  aliases: []
20
22
  skills: []
21
23
  created: {{created}}
@@ -16,6 +16,8 @@ relates: []
16
16
  blocked_by: []
17
17
  blocks: []
18
18
  refs: []
19
+ context_refs: []
20
+ evidence_refs: []
19
21
  aliases: []
20
22
  skills: []
21
23
  cases: []
@@ -2,18 +2,30 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.exportJson = exportJson;
4
4
  function buildFrontmatter(node) {
5
+ const links = node.links ?? [];
6
+ const artifacts = node.artifacts ?? [];
7
+ const refs = node.refs ?? [];
8
+ const contextRefs = node.context_refs ?? [];
9
+ const evidenceRefs = node.evidence_refs ?? [];
10
+ const aliases = node.aliases ?? [];
5
11
  const frontmatter = {};
6
- if (node.links.length > 0) {
7
- frontmatter.links = node.links;
12
+ if (links.length > 0) {
13
+ frontmatter.links = links;
8
14
  }
9
- if (node.artifacts.length > 0) {
10
- frontmatter.artifacts = node.artifacts;
15
+ if (artifacts.length > 0) {
16
+ frontmatter.artifacts = artifacts;
11
17
  }
12
- if (node.refs.length > 0) {
13
- frontmatter.refs = node.refs;
18
+ if (refs.length > 0) {
19
+ frontmatter.refs = refs;
14
20
  }
15
- if (node.aliases.length > 0) {
16
- frontmatter.aliases = node.aliases;
21
+ if (contextRefs.length > 0) {
22
+ frontmatter.context_refs = contextRefs;
23
+ }
24
+ if (evidenceRefs.length > 0) {
25
+ frontmatter.evidence_refs = evidenceRefs;
26
+ }
27
+ if (aliases.length > 0) {
28
+ frontmatter.aliases = aliases;
17
29
  }
18
30
  for (const [key, value] of Object.entries(node.attributes ?? {})) {
19
31
  frontmatter[key] = value;
@@ -48,6 +48,11 @@ function renderHeader(meta, nodes) {
48
48
  return lines;
49
49
  }
50
50
  function renderNode(node) {
51
+ const links = node.links ?? [];
52
+ const artifacts = node.artifacts ?? [];
53
+ const refs = node.refs ?? [];
54
+ const contextRefs = node.context_refs ?? [];
55
+ const evidenceRefs = node.evidence_refs ?? [];
51
56
  const lines = [];
52
57
  lines.push(`## ${node.qid}`);
53
58
  lines.push(`qid: ${node.qid}`);
@@ -60,10 +65,16 @@ function renderNode(node) {
60
65
  lines.push(`priority: ${node.priority}`);
61
66
  }
62
67
  lines.push(`path: ${node.path}`);
63
- lines.push(formatList("links", node.links));
64
- lines.push(formatList("artifacts", node.artifacts));
65
- if (node.refs.length > 0) {
66
- lines.push(formatList("refs", node.refs));
68
+ lines.push(formatList("links", links));
69
+ lines.push(formatList("artifacts", artifacts));
70
+ if (refs.length > 0) {
71
+ lines.push(formatList("refs", refs));
72
+ }
73
+ if (contextRefs.length > 0) {
74
+ lines.push(formatList("context_refs", contextRefs));
75
+ }
76
+ if (evidenceRefs.length > 0) {
77
+ lines.push(formatList("evidence_refs", evidenceRefs));
67
78
  }
68
79
  for (const [key, value] of Object.entries(node.attributes ?? {})) {
69
80
  lines.push(formatAttribute(key, value));
@@ -21,6 +21,9 @@ function listItems(tag, itemTag, items, indent) {
21
21
  lines.push(`${indent}</${tag}>`);
22
22
  return lines;
23
23
  }
24
+ function listValues(items) {
25
+ return items ?? [];
26
+ }
24
27
  function attributeLines(key, value, indent) {
25
28
  if (Array.isArray(value)) {
26
29
  return listItems(key, "item", value, indent);
@@ -83,10 +86,12 @@ function exportXml(pack) {
83
86
  }
84
87
  lines.push(` <path>${escapeXml(node.path)}</path>`);
85
88
  lines.push(" <frontmatter>");
86
- lines.push(...listItems("links", "link", node.links, " "));
87
- lines.push(...listItems("artifacts", "artifact", node.artifacts, " "));
88
- lines.push(...listItems("refs", "ref", node.refs, " "));
89
- lines.push(...listItems("aliases", "alias", node.aliases, " "));
89
+ lines.push(...listItems("links", "link", listValues(node.links), " "));
90
+ lines.push(...listItems("artifacts", "artifact", listValues(node.artifacts), " "));
91
+ lines.push(...listItems("refs", "ref", listValues(node.refs), " "));
92
+ lines.push(...listItems("context_refs", "context_ref", listValues(node.context_refs), " "));
93
+ lines.push(...listItems("evidence_refs", "evidence_ref", listValues(node.evidence_refs), " "));
94
+ lines.push(...listItems("aliases", "alias", listValues(node.aliases), " "));
90
95
  for (const [key, value] of Object.entries(node.attributes ?? {})) {
91
96
  lines.push(...attributeLines(key, value, " "));
92
97
  }
@@ -18,6 +18,12 @@ function estimateTokensFromChars(chars) {
18
18
  return Math.ceil(chars / 4);
19
19
  }
20
20
  function renderNodeMetricsText(node) {
21
+ const links = node.links ?? [];
22
+ const artifacts = node.artifacts ?? [];
23
+ const refs = node.refs ?? [];
24
+ const contextRefs = node.context_refs ?? [];
25
+ const evidenceRefs = node.evidence_refs ?? [];
26
+ const aliases = node.aliases ?? [];
21
27
  const lines = [];
22
28
  lines.push(`qid: ${node.qid}`);
23
29
  lines.push(`id: ${node.id}`);
@@ -31,10 +37,12 @@ function renderNodeMetricsText(node) {
31
37
  lines.push(`priority: ${node.priority}`);
32
38
  }
33
39
  lines.push(`path: ${node.path}`);
34
- lines.push(`links: ${node.links.join(",")}`);
35
- lines.push(`artifacts: ${node.artifacts.join(",")}`);
36
- lines.push(`refs: ${node.refs.join(",")}`);
37
- lines.push(`aliases: ${node.aliases.join(",")}`);
40
+ lines.push(`links: ${links.join(",")}`);
41
+ lines.push(`artifacts: ${artifacts.join(",")}`);
42
+ lines.push(`refs: ${refs.join(",")}`);
43
+ lines.push(`context_refs: ${contextRefs.join(",")}`);
44
+ lines.push(`evidence_refs: ${evidenceRefs.join(",")}`);
45
+ lines.push(`aliases: ${aliases.join(",")}`);
38
46
  if (node.body.length > 0) {
39
47
  lines.push("");
40
48
  lines.push(node.body);
package/dist/pack/pack.js CHANGED
@@ -6,7 +6,7 @@ const node_body_1 = require("../graph/node_body");
6
6
  const qid_1 = require("../util/qid");
7
7
  const order_1 = require("./order");
8
8
  const verbose_core_1 = require("./verbose_core");
9
- const EDGE_KEYS = ["parent", "epic", "relates", "blocked_by", "blocks", "prev", "next"];
9
+ const EDGE_KEYS = ["parent", "epic", "relates", "blocked_by", "blocks", "prev", "next", "context_refs", "evidence_refs"];
10
10
  function normalizeEdgeList(edges) {
11
11
  const seen = new Set();
12
12
  const result = [];
@@ -59,6 +59,12 @@ function getNeighbors(index, qid, edges) {
59
59
  case "blocks":
60
60
  neighbors.push(...node.edges.blocks);
61
61
  break;
62
+ case "context_refs":
63
+ neighbors.push(...(node.edges.context_refs ?? []));
64
+ break;
65
+ case "evidence_refs":
66
+ neighbors.push(...(node.edges.evidence_refs ?? []));
67
+ break;
62
68
  default:
63
69
  break;
64
70
  }
@@ -113,6 +119,8 @@ function buildPackNode(root, index, qid) {
113
119
  links: node.links,
114
120
  artifacts: node.artifacts,
115
121
  refs: node.refs,
122
+ context_refs: node.edges.context_refs ?? [],
123
+ evidence_refs: node.edges.evidence_refs ?? [],
116
124
  aliases: node.aliases,
117
125
  attributes: node.attributes ?? {},
118
126
  ...(node.source ? { source: node.source } : {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mdkg",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "Markdown Knowledge Graph",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -32,6 +32,10 @@
32
32
  "smoke:command-docs": "npm run build && node scripts/smoke-command-docs.js",
33
33
  "smoke:spike": "npm run build && node scripts/smoke-spike.js",
34
34
  "smoke:goal-lifecycle": "npm run build && node scripts/smoke-goal-lifecycle.js",
35
+ "smoke:semantic-refs": "npm run build && node scripts/smoke-semantic-refs.js",
36
+ "smoke:checkpoint-templates": "npm run build && node scripts/smoke-checkpoint-templates.js",
37
+ "smoke:handoff": "npm run build && node scripts/smoke-handoff.js",
38
+ "smoke:integration-ux": "npm run build && node scripts/smoke-integration-ux.js",
35
39
  "smoke:bundle": "npm run build && node scripts/smoke-bundle.js",
36
40
  "smoke:graph-clone": "npm run build && node scripts/smoke-graph-clone.js",
37
41
  "smoke:mcp": "npm run build && node scripts/smoke-mcp.js",
@@ -44,7 +48,7 @@
44
48
  "cli:check": "npm run build && node scripts/cli_help_snapshot.js --check",
45
49
  "cli:contract": "npm run build && node scripts/generate-command-contract.js --check",
46
50
  "prepack": "npm run build && node scripts/assert-publish-ready.js",
47
- "prepublishOnly": "npm run test && npm run cli:check && npm run cli:contract && 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:db && npm run smoke:db-queue && npm run smoke:db-queue-cli && npm run smoke:db-events && npm run smoke:db-materializer && npm run smoke:db-snapshot && npm run smoke:archive-work && npm run smoke:work-invocation && npm run smoke:cli-ux-polish && npm run smoke:operator-health && npm run smoke:fix-plan && npm run smoke:branch-conflicts && npm run smoke:id-repair && npm run smoke:command-docs && npm run smoke:spike && npm run smoke:goal-lifecycle && npm run smoke:bundle && npm run smoke:graph-clone && npm run smoke:mcp && npm run smoke:subgraph && npm run smoke:visibility && npm run smoke:sqlite && npm run smoke:parallel && npm run smoke:goal && node scripts/assert-publish-ready.js",
51
+ "prepublishOnly": "npm run test && npm run cli:check && npm run cli:contract && 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:db && npm run smoke:db-queue && npm run smoke:db-queue-cli && npm run smoke:db-events && npm run smoke:db-materializer && npm run smoke:db-snapshot && npm run smoke:archive-work && npm run smoke:work-invocation && npm run smoke:cli-ux-polish && npm run smoke:operator-health && npm run smoke:fix-plan && npm run smoke:branch-conflicts && npm run smoke:id-repair && npm run smoke:command-docs && npm run smoke:spike && npm run smoke:goal-lifecycle && npm run smoke:semantic-refs && npm run smoke:checkpoint-templates && npm run smoke:handoff && npm run smoke:integration-ux && npm run smoke:bundle && npm run smoke:graph-clone && npm run smoke:mcp && npm run smoke:subgraph && npm run smoke:visibility && npm run smoke:sqlite && npm run smoke:parallel && npm run smoke:goal && node scripts/assert-publish-ready.js",
48
52
  "postinstall": "node scripts/postinstall.js",
49
53
  "smoke:subgraph": "npm run build && node scripts/smoke-subgraph.js"
50
54
  },