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.
- package/CHANGELOG.md +93 -0
- package/CLI_COMMAND_MATRIX.md +132 -24
- package/README.md +80 -25
- package/dist/cli.js +193 -36
- package/dist/command-contract.json +882 -122
- package/dist/commands/bundle.js +2 -0
- package/dist/commands/capability.js +1 -0
- package/dist/commands/checkpoint.js +139 -1
- package/dist/commands/db.js +8 -0
- package/dist/commands/doctor.js +7 -7
- package/dist/commands/format.js +155 -0
- package/dist/commands/goal.js +60 -0
- package/dist/commands/graph.js +148 -0
- package/dist/commands/handoff.js +301 -0
- package/dist/commands/mcp.js +9 -0
- package/dist/commands/new.js +12 -3
- 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/spec.js +76 -17
- package/dist/commands/status.js +1 -0
- package/dist/commands/subgraph.js +7 -4
- package/dist/commands/task.js +2 -0
- package/dist/commands/upgrade.js +128 -3
- package/dist/commands/validate.js +268 -6
- package/dist/commands/work.js +176 -5
- package/dist/core/project_db_queue_contract.js +101 -0
- package/dist/graph/agent_file_types.js +59 -20
- package/dist/graph/capabilities_indexer.js +45 -3
- package/dist/graph/edges.js +15 -0
- package/dist/graph/frontmatter.js +4 -1
- package/dist/graph/indexer.js +13 -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/template_schema.js +37 -17
- package/dist/graph/validate_graph.js +16 -5
- package/dist/graph/visibility.js +6 -0
- package/dist/init/AGENT_START.md +9 -6
- package/dist/init/CLI_COMMAND_MATRIX.md +50 -16
- package/dist/init/README.md +26 -9
- package/dist/init/init-manifest.json +67 -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/manifest.md +45 -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/init/templates/specs/agent.MANIFEST.md +80 -0
- package/dist/init/templates/specs/api.MANIFEST.md +33 -0
- package/dist/init/templates/specs/base.MANIFEST.md +120 -0
- package/dist/init/templates/specs/capability.MANIFEST.md +45 -0
- package/dist/init/templates/specs/integration.MANIFEST.md +25 -0
- package/dist/init/templates/specs/model.MANIFEST.md +21 -0
- package/dist/init/templates/specs/project.MANIFEST.md +39 -0
- package/dist/init/templates/specs/runtime-agent.MANIFEST.md +49 -0
- package/dist/init/templates/specs/runtime-image.MANIFEST.md +21 -0
- package/dist/init/templates/specs/tool.MANIFEST.md +25 -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 +3 -0
- package/package.json +21 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# mdkg
|
|
2
2
|
|
|
3
|
-
mdkg is
|
|
3
|
+
Markdown Knowledge Graph (`mdkg`) is Git-native project memory for AI coding agents: structured Markdown, deterministic context packs, handoffs, checkpoints, and validation.
|
|
4
4
|
|
|
5
5
|
It is built for:
|
|
6
6
|
- human builders who want project truth and task state in git
|
|
@@ -14,10 +14,30 @@ 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.8`
|
|
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
|
|
|
21
|
+
## mdkg.dev launch workspace
|
|
22
|
+
|
|
23
|
+
This repo now owns the prelaunch mdkg.dev source layout:
|
|
24
|
+
|
|
25
|
+
- `mdkg-dev/` is the Astro static-site subproject for the canonical public site.
|
|
26
|
+
- `docs/` is the Starlight docs subproject and repo-first documentation source plus generated command-reference output.
|
|
27
|
+
- `examples/` contains local demo/template mdkg graphs for agentic coding and mdkg.dev website-generation demos.
|
|
28
|
+
|
|
29
|
+
These surfaces are intentionally excluded from the npm package payload. They are source and launch-readiness assets, not runtime CLI dependencies. The launch gates are local and deterministic:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm run docs:check
|
|
33
|
+
npm run smoke:mdkg-dev
|
|
34
|
+
npm run smoke:mdkg-dev-docs
|
|
35
|
+
npm run smoke:mdkg-dev-seo
|
|
36
|
+
npm run smoke:demo-graph
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The canonical site remains `mdkg.dev`. Demo graphs and preview deploys are separate from canonical SEO; durable `demo-N.mdkg.dev` promotion and any production deployment require explicit later approval.
|
|
40
|
+
|
|
21
41
|
## The product shape
|
|
22
42
|
|
|
23
43
|
mdkg has one core job: make repo knowledge cheap to retrieve and safe to reuse.
|
|
@@ -29,19 +49,30 @@ The primary loop is:
|
|
|
29
49
|
4. build a deterministic pack
|
|
30
50
|
5. validate before closing the loop
|
|
31
51
|
|
|
32
|
-
If an agent is involved,
|
|
52
|
+
If an agent is involved, use `mdkg pack <id>` for deterministic context and
|
|
53
|
+
`mdkg handoff create <id-or-qid> --json` for a sanitized, copy-ready agent
|
|
54
|
+
handoff prompt. Handoffs summarize goal/work state, included pack nodes, latest
|
|
55
|
+
checkpoint, boundaries, required checks, next actions, and raw-content marker
|
|
56
|
+
warnings without copying raw node bodies into the prompt.
|
|
33
57
|
If a repo needs repeatable procedures, author them as first-class skills under `.mdkg/skills/`.
|
|
34
58
|
|
|
59
|
+
Work nodes can separate semantic background from executable scope with
|
|
60
|
+
`context_refs` and `evidence_refs`. Use `context_refs` for related plans,
|
|
61
|
+
external docs, subgraph qids, or URI references that explain why work exists.
|
|
62
|
+
Use `evidence_refs` for proof, audit, receipt, checkpoint, archive, or URI
|
|
63
|
+
references. These fields are indexed, validated, shown, and packable, but they
|
|
64
|
+
do not make referenced nodes actionable goal work; keep executable queues in
|
|
65
|
+
goal `scope_refs`.
|
|
66
|
+
|
|
35
67
|
## Install
|
|
36
68
|
|
|
37
69
|
```bash
|
|
38
|
-
npm
|
|
39
|
-
|
|
40
|
-
pnpm add -g mdkg
|
|
41
|
-
# or
|
|
42
|
-
bun add -g mdkg
|
|
70
|
+
npm install -g mdkg
|
|
71
|
+
mdkg --version
|
|
43
72
|
```
|
|
44
73
|
|
|
74
|
+
The npm global install path is the canonical public-alpha path covered by release validation. One-off runners and other package managers may be useful in local tooling, but verify them before documenting them for a team.
|
|
75
|
+
|
|
45
76
|
## Quickstart
|
|
46
77
|
|
|
47
78
|
Initialize mdkg in a repo:
|
|
@@ -118,7 +149,7 @@ mdkg new task "author mdkg.dev launch planning skill" --parent spike-1 --status
|
|
|
118
149
|
Create an agent workflow document with a semantic portable id:
|
|
119
150
|
|
|
120
151
|
```bash
|
|
121
|
-
mdkg new
|
|
152
|
+
mdkg new manifest "image worker" --id agent.image-worker
|
|
122
153
|
mdkg new work "generate image" --id work.generate-image
|
|
123
154
|
```
|
|
124
155
|
|
|
@@ -136,6 +167,7 @@ Build deterministic context:
|
|
|
136
167
|
mdkg pack task-1
|
|
137
168
|
mdkg pack task-1 --profile concise --dry-run --stats
|
|
138
169
|
mdkg pack task-1 --visibility public --dry-run
|
|
170
|
+
mdkg pack task-1 --edges context_refs,evidence_refs --format json
|
|
139
171
|
```
|
|
140
172
|
|
|
141
173
|
Create a full `.mdkg` graph snapshot bundle for root or child orchestration:
|
|
@@ -208,6 +240,8 @@ Materialized trees are generated local state, ignored by graph indexing/search/v
|
|
|
208
240
|
|
|
209
241
|
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.
|
|
210
242
|
|
|
243
|
+
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.
|
|
244
|
+
|
|
211
245
|
Launch a local read-only MCP server when an MCP-capable agent should inspect a
|
|
212
246
|
specific mdkg graph without receiving mutation tools:
|
|
213
247
|
|
|
@@ -226,6 +260,7 @@ Validate before handoff or commit:
|
|
|
226
260
|
|
|
227
261
|
```bash
|
|
228
262
|
mdkg validate
|
|
263
|
+
mdkg handoff create <id-or-qid> --out .mdkg/handoffs/example.md
|
|
229
264
|
```
|
|
230
265
|
|
|
231
266
|
Discover cached capability surfaces:
|
|
@@ -235,15 +270,17 @@ mdkg index
|
|
|
235
270
|
mdkg capability list --kind skill --json
|
|
236
271
|
mdkg capability search "image worker" --kind work --json
|
|
237
272
|
mdkg capability show <id-or-qid-or-slug> --json
|
|
238
|
-
mdkg
|
|
239
|
-
mdkg
|
|
273
|
+
mdkg manifest list --json
|
|
274
|
+
mdkg manifest show <id-or-qid-or-alias> --json
|
|
240
275
|
```
|
|
241
276
|
|
|
242
|
-
`
|
|
243
|
-
|
|
244
|
-
notes. `
|
|
245
|
-
`mdkg
|
|
246
|
-
|
|
277
|
+
`MANIFEST.md` is optional. Repos with no manifest files still validate; when
|
|
278
|
+
present, manifest records describe reusable capability surfaces rather than
|
|
279
|
+
general planning notes. `SPEC.md` remains a legacy alias for one compatibility
|
|
280
|
+
release, and `mdkg spec list/show/validate` remains a deprecated alias for
|
|
281
|
+
`mdkg manifest list/show/validate`. `mdkg capability ...` remains the broader
|
|
282
|
+
read-only discovery surface for skills, manifests, WORK contracts, core docs,
|
|
283
|
+
and design docs.
|
|
247
284
|
|
|
248
285
|
Register source and artifact files as committed archive sidecars:
|
|
249
286
|
|
|
@@ -280,8 +317,11 @@ Update structured task state and evidence while keeping body and narrative edits
|
|
|
280
317
|
mdkg task start task-1 --run-id run_local_1
|
|
281
318
|
mdkg task update task-1 --add-artifacts tests://unit.txt --add-tags release
|
|
282
319
|
mdkg task done task-1 --checkpoint "release readiness milestone"
|
|
320
|
+
mdkg task done task-1 --checkpoint "goal complete" --checkpoint-kind goal-closeout
|
|
283
321
|
```
|
|
284
322
|
|
|
323
|
+
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.
|
|
324
|
+
|
|
285
325
|
Ensure and append baseline event memory:
|
|
286
326
|
|
|
287
327
|
```bash
|
|
@@ -359,6 +399,15 @@ Advanced / maintenance commands still exist, but they are not the first-run stor
|
|
|
359
399
|
- `mdkg fix plan --json`
|
|
360
400
|
- `mdkg workspace`
|
|
361
401
|
|
|
402
|
+
For large historical graphs, use `mdkg validate --changed-only --json` to keep
|
|
403
|
+
warning review focused on changed `.mdkg` files while full graph errors still
|
|
404
|
+
run. Use `mdkg validate --summary --json --limit 20` for bounded agent or CI
|
|
405
|
+
logs, and add `--json-out <path>` when a clean full JSON receipt should be
|
|
406
|
+
written as an artifact. Use
|
|
407
|
+
`mdkg format --headings --dry-run --summary --json --limit 20` to review missing
|
|
408
|
+
recommended heading additions with bounded output before applying them with
|
|
409
|
+
`--apply`.
|
|
410
|
+
|
|
362
411
|
## Operator health
|
|
363
412
|
|
|
364
413
|
Use `mdkg status --json` for a read-only operator summary before mutating a
|
|
@@ -437,14 +486,14 @@ Optional skill metadata with prefixes such as `ochatr_*` is treated as vendor ex
|
|
|
437
486
|
|
|
438
487
|
mdkg maintains `.mdkg/index/capabilities.json` as a derived access cache for deterministic capability surfaces:
|
|
439
488
|
- skills from `.mdkg/skills/**/SKILL.md`
|
|
440
|
-
- `SPEC.md`
|
|
489
|
+
- canonical `MANIFEST.md` and legacy `SPEC.md`
|
|
441
490
|
- `WORK.md`
|
|
442
491
|
- core docs
|
|
443
492
|
- design docs
|
|
444
493
|
|
|
445
494
|
The capability cache is not the full graph and is not source of truth. Normal tasks, epics, bugs, tests, feats, and checkpoints remain in the standard graph index. Markdown remains authoritative; deleting the cache is recoverable with `mdkg index` or by running a capability command when auto-reindex is enabled.
|
|
446
495
|
|
|
447
|
-
Capability records aggregate enabled registered workspaces and include deterministic source metadata such as `workspace`, `visibility`, `kind`, `id`, `qid`, `path`, headings, refs, source hash, and `indexed_at`. SPEC and WORK records also expose read-only `linkage` arrays when related work contracts, work orders, and receipts exist, so an orchestrator can discover a capability from reusable surface to invocation evidence without loading the full graph. Workspace `visibility` also feeds mdkg's export safety checks for public/internal packs and public bundles. This is a CLI safety layer, not secret scanning, body redaction, or a replacement for private git hosting.
|
|
496
|
+
Capability records aggregate enabled registered workspaces and include deterministic source metadata such as `workspace`, `visibility`, `kind`, `id`, `qid`, `path`, headings, refs, source hash, and `indexed_at`. MANIFEST/SPEC and WORK records also expose read-only `linkage` arrays when related work contracts, work orders, and receipts exist, so an orchestrator can discover a capability from reusable surface to invocation evidence without loading the full graph. Workspace `visibility` also feeds mdkg's export safety checks for public/internal packs and public bundles. This is a CLI safety layer, not secret scanning, body redaction, or a replacement for private git hosting.
|
|
448
497
|
|
|
449
498
|
## Index backends and parallel safety
|
|
450
499
|
|
|
@@ -478,6 +527,12 @@ rows are durable local project DB history; receipts, reducers, writer leases,
|
|
|
478
527
|
and materializers remain internal helper surfaces in this release, with no
|
|
479
528
|
public `mdkg db event`, `mdkg db reducer`, `mdkg db lease`, or
|
|
480
529
|
`mdkg db materializer` CLI yet.
|
|
530
|
+
`mdkg db queue contract --json` is the read-only public adapter contract for
|
|
531
|
+
downstream integrations. It documents canonical payload hashing, dedupe keys,
|
|
532
|
+
oldest-ready claim order, lease-owner checked ack/fail/dead-letter, retry
|
|
533
|
+
delay, expired lease reclaim, max-attempt dead-letter behavior, pause/resume,
|
|
534
|
+
snapshot queue policy, and stats without exposing raw SQL or making queue rows
|
|
535
|
+
canonical runtime history.
|
|
481
536
|
`mdkg work trigger --enqueue <queue>` can bridge a submitted work order mirror
|
|
482
537
|
into an explicitly created active project DB queue; it writes local delivery
|
|
483
538
|
state only and never executes work.
|
|
@@ -505,7 +560,7 @@ Goal nodes are durable recursive objective contracts. Use `mdkg new goal "<objec
|
|
|
505
560
|
|
|
506
561
|
`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.
|
|
507
562
|
|
|
508
|
-
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
|
|
563
|
+
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.
|
|
509
564
|
|
|
510
565
|
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.
|
|
511
566
|
|
|
@@ -535,17 +590,17 @@ or agents can intentionally create the next nodes with normal mdkg commands.
|
|
|
535
590
|
## Agent workflow files
|
|
536
591
|
|
|
537
592
|
mdkg recognizes a small set of canonical agent workflow documents:
|
|
538
|
-
- `
|
|
593
|
+
- `MANIFEST.md` for agent, package, or runtime capability manifests
|
|
539
594
|
- `WORK.md` for reusable work contracts
|
|
540
595
|
- `WORK_ORDER.md` for concrete requests against work contracts
|
|
541
596
|
- `RECEIPT.md` for completed work output and artifacts
|
|
542
597
|
- `FEEDBACK.md`, `DISPUTE.md`, and `PROPOSAL.md` for review loops
|
|
543
598
|
|
|
544
|
-
Use `mdkg new
|
|
599
|
+
Use `mdkg new manifest|work|work_order|receipt|feedback|dispute|proposal "<title>"` to scaffold them. `mdkg new spec` remains a deprecated alias that emits `MANIFEST.md` during the compatibility bridge. `--id <portable-id>` is available for these types when semantic ids such as `agent.image-worker` or `work.generate-image` are preferred.
|
|
545
600
|
|
|
546
|
-
Relational templates contain editable placeholder refs. `
|
|
601
|
+
Relational templates contain editable placeholder refs. `manifest` and `work` scaffold as validation-clean standalone docs; `work_order`, `receipt`, `feedback`, `dispute`, and `proposal` need real refs before strict `mdkg validate` passes.
|
|
547
602
|
|
|
548
|
-
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
|
|
603
|
+
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 MANIFEST with exactly one resolvable work contract; legacy SPEC refs remain supported during the compatibility bridge. `mdkg work order status` and `mdkg work receipt verify` are read-only review helpers for deterministic closeout. `mdkg work validate [<id-or-qid>] [--type manifest|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.
|
|
549
604
|
|
|
550
605
|
## Archive sidecars
|
|
551
606
|
|
|
@@ -566,8 +621,8 @@ This release includes:
|
|
|
566
621
|
- default ignore updates with `--no-update-ignores` for generated JSON index/temp/lock files, `.mdkg/pack/`, and raw archive source copies
|
|
567
622
|
- root-only published init seed config
|
|
568
623
|
- skills indexing and search/show/list support
|
|
569
|
-
- JSON capability cache for skills, `SPEC.md`, `WORK.md`, core docs, and design docs
|
|
570
|
-
- optional `mdkg
|
|
624
|
+
- JSON capability cache for skills, `MANIFEST.md` / legacy `SPEC.md`, `WORK.md`, core docs, and design docs
|
|
625
|
+
- optional `mdkg manifest list/show/validate` for reusable manifest capability records, with `mdkg spec ...` retained as a legacy alias for one compatibility release
|
|
571
626
|
- SQLite index backend for fresh workspaces using built-in `node:sqlite`
|
|
572
627
|
- mutation locking and atomic writes for parallel mdkg calls
|
|
573
628
|
- first-class `goal` nodes and `mdkg goal show/next/evaluate/pause/resume/done`
|