mdkg 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +103 -15
  2. package/CLI_COMMAND_MATRIX.md +109 -2
  3. package/README.md +40 -2
  4. package/dist/cli.js +262 -2
  5. package/dist/command-contract.json +1902 -524
  6. package/dist/commands/archive.js +31 -14
  7. package/dist/commands/bundle.js +180 -44
  8. package/dist/commands/capability.js +1 -0
  9. package/dist/commands/checkpoint.js +6 -5
  10. package/dist/commands/event_support.js +16 -7
  11. package/dist/commands/fix.js +11 -8
  12. package/dist/commands/git.js +624 -0
  13. package/dist/commands/goal.js +23 -23
  14. package/dist/commands/graph.js +64 -10
  15. package/dist/commands/handoff.js +4 -2
  16. package/dist/commands/init.js +28 -23
  17. package/dist/commands/loop.js +1668 -0
  18. package/dist/commands/loop_descriptors.js +219 -0
  19. package/dist/commands/mcp.js +101 -11
  20. package/dist/commands/new.js +49 -3
  21. package/dist/commands/pack.js +14 -7
  22. package/dist/commands/search.js +10 -1
  23. package/dist/commands/skill.js +12 -9
  24. package/dist/commands/skill_mirror.js +39 -31
  25. package/dist/commands/subgraph.js +59 -26
  26. package/dist/commands/task.js +77 -4
  27. package/dist/commands/upgrade.js +13 -15
  28. package/dist/commands/validate.js +20 -7
  29. package/dist/commands/work.js +44 -26
  30. package/dist/commands/workspace.js +10 -4
  31. package/dist/core/config.js +45 -17
  32. package/dist/core/filesystem_authority.js +281 -0
  33. package/dist/core/project_db_events.js +4 -0
  34. package/dist/core/project_db_materializer.js +2 -0
  35. package/dist/core/project_db_migrations.js +238 -181
  36. package/dist/core/project_db_snapshot.js +64 -14
  37. package/dist/core/workspace_path.js +7 -0
  38. package/dist/graph/archive_integrity.js +1 -1
  39. package/dist/graph/capabilities_index_cache.js +4 -1
  40. package/dist/graph/frontmatter.js +38 -0
  41. package/dist/graph/goal_scope.js +4 -1
  42. package/dist/graph/index_cache.js +37 -7
  43. package/dist/graph/loop_bindings.js +39 -0
  44. package/dist/graph/node.js +209 -1
  45. package/dist/graph/node_body.js +52 -6
  46. package/dist/graph/skills_index_cache.js +41 -6
  47. package/dist/graph/skills_indexer.js +5 -2
  48. package/dist/graph/sqlite_index.js +118 -105
  49. package/dist/graph/subgraphs.js +142 -5
  50. package/dist/graph/validate_graph.js +109 -13
  51. package/dist/graph/workspace_files.js +39 -9
  52. package/dist/init/AGENT_START.md +16 -0
  53. package/dist/init/CLI_COMMAND_MATRIX.md +14 -0
  54. package/dist/init/config.json +7 -1
  55. package/dist/init/init-manifest.json +49 -4
  56. package/dist/init/skills/default/pursue-mdkg-loop/SKILL.md +150 -0
  57. package/dist/init/templates/default/loop.md +160 -0
  58. package/dist/init/templates/loops/backend-api-cli-bloat-audit.loop.md +117 -0
  59. package/dist/init/templates/loops/design-frontend-ux-audit.loop.md +117 -0
  60. package/dist/init/templates/loops/duplicate-code-and-linting-audit.loop.md +114 -0
  61. package/dist/init/templates/loops/security-audit.loop.md +140 -0
  62. package/dist/init/templates/loops/tech-stack-best-practices-audit.loop.md +116 -0
  63. package/dist/init/templates/loops/test-ci-skill-infrastructure-audit.loop.md +116 -0
  64. package/dist/init/templates/loops/user-story-audit-and-recommendations.loop.md +116 -0
  65. package/dist/pack/order.js +3 -1
  66. package/dist/pack/pack.js +139 -6
  67. package/dist/templates/loader.js +9 -3
  68. package/dist/util/argparse.js +5 -0
  69. package/dist/util/lock.js +10 -9
  70. package/dist/util/zip.js +163 -9
  71. package/package.json +8 -4
package/CHANGELOG.md CHANGED
@@ -8,6 +8,98 @@ mdkg is pre-v1 public alpha software. Command, graph, cache, bundle, and DAL con
8
8
 
9
9
  ## Unreleased
10
10
 
11
+ ## 0.5.0 - 2026-07-11
12
+
13
+ ### Added
14
+
15
+ - Added `loop` as a first-class mdkg work node for reusable, durable agentic
16
+ processes that can coordinate goals, tasks, tests, spikes, proposals,
17
+ decisions, checkpoints, receipts, evidence, and repeated attempts.
18
+ - Added the semantic `mdkg loop list`, `show`, `fork`, `plan`, `next`, and
19
+ `runs` command family, plus deterministic `mdkg new loop` guidance for raw
20
+ loops versus bundled templates.
21
+ - Added identity-bound loop readiness metadata for pre-run questions, action
22
+ approvals, evidence lanes, and paired decision/approval waivers.
23
+ - Added immutable template provenance, content hashes, stale-fork warnings,
24
+ default child materialization, and an explicit planning-only fork mode.
25
+ - Added seven bundled read-only or planning loop templates for security,
26
+ frontend design, backend/API/CLI design, tech-stack practices, duplication
27
+ and linting, test/CI/skill infrastructure, and user-story audits.
28
+ - Added the reusable `pursue-mdkg-loop` agent skill to keep authorized child
29
+ lanes moving, recover blockers through grounded spikes and proposals, and
30
+ close only against the loop definition of done.
31
+ - Added a gated mdkg.dev announcement and top-level Loops documentation with a
32
+ purpose-built read-only security audit walkthrough. Public promotion remains
33
+ controlled by the shared source release manifest.
34
+
35
+ ### Changed
36
+
37
+ - Integrated loops into parser/template validation, generic discovery,
38
+ SQLite/JSON indexes, search/show/list output, deterministic pack traversal,
39
+ generated help, command contracts, init assets, and upgrade fallback paths.
40
+ - Made loop fork dry-runs observational across JSON and SQLite backends: no ID
41
+ reservation, event write, index persistence, or graph/filesystem mutation.
42
+ - Made read-only loop commands use non-persisting index projections and made
43
+ `loop next` exhaust authorized nested work and blocker-recovery lanes before
44
+ reporting the whole loop blocked.
45
+ - Kept loop templates, scoped forks, and run-bearing state under one `loop`
46
+ node type; mdkg preserves orchestration state while the coding-agent harness
47
+ remains responsible for executing agents and tools.
48
+ - Added installed-package smoke coverage for every bundled loop template and a
49
+ public-repository release-readiness workflow across the minimum supported
50
+ Node version and current Node line.
51
+ - Cleaned mdkg.dev/docs public copy and demo proof surfaces while preserving
52
+ the existing quickstart-first product journey and Pre-v1 public-alpha scope.
53
+
54
+ ### Fixed
55
+
56
+ - Fixed readiness projection so unrelated decisions, approvals, evidence, and
57
+ waivers cannot satisfy a different question, action, or evidence lane.
58
+ - Fixed loop routing so one blocked child does not halt other authorized work,
59
+ and whole-loop blocking occurs only after useful work and recovery paths are
60
+ exhausted.
61
+ - Fixed stale-template handling to warn from recorded template identity and
62
+ content hash without silently rewriting scoped forks.
63
+
64
+ ### Security
65
+
66
+ - Hardened graph target writes against symlink containment escapes before any
67
+ destination mutation.
68
+ - Bounded ZIP entry count, compressed size, declared output, total output, and
69
+ expansion ratio before bundle or subgraph inflation.
70
+
71
+ ## 0.4.2 - 2026-07-05
72
+
73
+ ### Added
74
+
75
+ - Added the low-level `mdkg git` command family for Git-backed project
76
+ lifecycle primitives: `inspect`, `clone`, `fetch`, `closeout`,
77
+ `push-ready`, and approval-gated real `push` execution.
78
+ - Added Git source descriptors and accepted-revision evidence in command
79
+ receipts, including sanitized remote refs, branch, commit SHA, tree hash, and
80
+ the external-auth boundary.
81
+ - Added `mdkg git closeout` static JSON/Markdown receipts, plus sealed project
82
+ DB snapshot and deterministic dump evidence when SQLite project state
83
+ participated in the run.
84
+
85
+ ### Changed
86
+
87
+ - Made push readiness a high-bar preflight: explicit remote and branch,
88
+ credential-free remote config, clean worktree, passing mdkg validation, and a
89
+ valid DB snapshot when DB state participated.
90
+ - Documented Git auth as external to mdkg through system Git, credential
91
+ helpers, SSH, `gh`, CI/runtime env, or shell state; mdkg stores only refs,
92
+ hashes, policy names, and receipts.
93
+ - Deferred project-memory semantic query UX (`history`, `why`, and
94
+ `next-work`) to a separate CocoIndex-grounded design lane instead of shipping
95
+ it in the `0.4.2` Git lifecycle release.
96
+
97
+ ### Security
98
+
99
+ - Rejects embedded URL credentials for repository refs and push remotes, and
100
+ redacts any userinfo that appears in inspected remote URLs before writing
101
+ receipts or JSON output.
102
+
11
103
  ## 0.4.1 - 2026-07-04
12
104
 
13
105
  ### Added
@@ -31,33 +123,29 @@ mdkg is pre-v1 public alpha software. Command, graph, cache, bundle, and DAL con
31
123
  `resource_profile`, WORK `kind`, WORK_ORDER `artifact_policy`, RECEIPT
32
124
  `redaction_policy`, `receipt_kind`, `redaction_class`, and pack/bundle
33
125
  `--profile` flags.
34
- - Expanded release-readiness documentation and checks for `0.4.1` so the
35
- implementation can hand off to a separate approval-gated publish goal.
126
+ - Expanded documentation and validation checks for `0.4.1` so package readiness
127
+ can be verified before publication.
36
128
 
37
129
  ## 0.4.0 - 2026-06-27
38
130
 
39
131
  ### Added
40
132
 
41
- - Added the `0.4.0` public launch-readiness lane for mdkg.dev and
42
- docs.mdkg.dev with explicit source metadata, changelog, generated-doc,
43
- npm prepublish, npm postpublish, Vercel production, and Chrome live-validation
44
- blockers.
45
- - Added public release-note and docs coverage for the `0.4.0` launch surface,
46
- including per-release changelog cards, launch-track copy, and source-backed
47
- currentness requirements.
48
- - Added Vercel production currentness and Chrome postpublish validation as
49
- required evidence before mdkg.dev or docs.mdkg.dev can claim the `0.4.0`
50
- launch is live.
133
+ - Added public release cards and changelog detail pages for recent public-alpha
134
+ versions.
135
+ - Added docs coverage for config overlays, custom skill mirrors,
136
+ `COLLABORATION.md`, MANIFEST naming, and public-alpha customization guidance.
137
+ - Added mdkg.dev and docs.mdkg.dev copy updates that keep public claims bounded
138
+ to documented capabilities.
51
139
 
52
140
  ### Changed
53
141
 
54
- - Updated mdkg.dev and docs.mdkg.dev source copy for the `0.4.0` release target,
142
+ - Updated mdkg.dev and docs.mdkg.dev source copy for the `0.4.0` public alpha,
55
143
  including config overlays, custom skill mirrors, `COLLABORATION.md`,
56
- MANIFEST/SPEC compatibility, and Plan -> Work -> Evidence launch messaging.
144
+ MANIFEST/SPEC compatibility, and Plan -> Work -> Evidence messaging.
57
145
  - Updated public docs and examples to use the current `mdkg pack --profile
58
146
  concise` syntax instead of stale `--pack-profile concise` examples.
59
147
  - Aligned source-visible package references, generated release-note data, and
60
- generated CLI docs with the `0.4.0` release target.
148
+ generated CLI docs with `0.4.0`.
61
149
 
62
150
  ### Fixed
63
151
 
@@ -1,7 +1,7 @@
1
1
  # CLI Command Matrix
2
2
 
3
- as_of: 2026-07-03
4
- package_version_in_source: 0.4.1
3
+ as_of: 2026-07-11
4
+ package_version_in_source: 0.5.0
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
 
@@ -42,9 +42,11 @@ Primary commands:
42
42
  - `archive`
43
43
  - `bundle`
44
44
  - `graph`
45
+ - `git`
45
46
  - `subgraph`
46
47
  - `work`
47
48
  - `goal`
49
+ - `loop`
48
50
  - `task`
49
51
  - `next`
50
52
  - `validate`
@@ -72,10 +74,16 @@ Reusable manifest capability records are accessed through `mdkg manifest ...`;
72
74
  Archive sidecars are accessed through `mdkg archive ...`.
73
75
  Full graph snapshot bundles are accessed through `mdkg bundle ...`.
74
76
  Whole-graph clone, fork, and same-repo template import workflows are accessed through `mdkg graph ...`.
77
+ Low-level Git remote lifecycle primitives are accessed through `mdkg git ...`.
75
78
  Read-only child graph orchestration is accessed through `mdkg subgraph ...`.
76
79
  Work contract/order/receipt semantic mirrors are accessed through `mdkg work ...`.
77
80
  Recursive long-running objective contracts are accessed through `mdkg goal ...`.
81
+ Reusable process-state loops are accessed through `mdkg loop ...`; mdkg stores loop graph state while runtimes execute agents and tools.
78
82
  Fresh init workspaces default to the SQLite access cache backend; existing migrated configs stay on JSON until opted in.
83
+ Graph discovery enforces configurable `index.limits` for file count, per-file
84
+ bytes, total bytes, and directory depth before reading Markdown. ZIP, pack, and
85
+ local MCP surfaces apply additional fixed protocol-safe ceilings and return
86
+ deterministic errors when a request or graph exceeds them.
79
87
  Project application database foundation commands are accessed through `mdkg db ...`; `mdkg index` remains the compatibility shortcut for graph index rebuilds.
80
88
  Operator health summaries are accessed through read-only `mdkg status ...`; deeper diagnostics remain under `mdkg doctor ...`.
81
89
  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.
@@ -160,6 +168,7 @@ Types:
160
168
  - `dec`
161
169
  - `prop`
162
170
  - `goal`
171
+ - `loop`
163
172
  - `epic`
164
173
  - `feat`
165
174
  - `task`
@@ -193,6 +202,13 @@ Agent workflow file type creation:
193
202
  Goal node creation:
194
203
  - `mdkg new goal "<title>" [options] [--json]`
195
204
 
205
+ Loop node creation:
206
+ - `mdkg new loop "<title>" [options] [--json]`
207
+ - loops are durable declarative graph process state, not runtime execution jobs
208
+ - a loop may be a reusable template, scoped fork, or run-bearing loop through metadata and links
209
+ - loop metadata records mode, scope, lineage, materialization, child refs, evidence/run refs, definition of done, and blocker-continuation policy
210
+ - default seeded loops are read-only or planning-oriented audit/recommendation templates
211
+
196
212
  Spike node creation:
197
213
  - `mdkg new spike "<research question>" [options] [--json]`
198
214
  - spikes are actionable research/planning work nodes under `.mdkg/work/`
@@ -242,6 +258,7 @@ JSON receipt:
242
258
  Notes:
243
259
  - `--id` lets agent workflow files use semantic portable ids such as `agent.image-worker`, `work.generate-image`, or `proposal.review-loop-1`.
244
260
  - `goal` nodes capture recursive objective state and required checks, but normal `mdkg next` does not select them.
261
+ - `loop` nodes capture reusable process state, fork lineage, child refs, run/evidence refs, blocker-continuation policy, and a high-bar definition of done; runtime execution remains outside mdkg.
245
262
  - `spec` and `work` scaffold as validation-clean standalone docs. `work_order`, `receipt`, `feedback`, `dispute`, and `proposal` templates contain editable placeholder refs and need real graph or `skill.<slug>` refs before strict validation passes.
246
263
 
247
264
  ### `mdkg show`
@@ -746,6 +763,54 @@ JSON receipts:
746
763
  - `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 }`
747
764
  - `refs`: `{ action: "graph.refs", ok, target, outgoing, incoming, warnings }`
748
765
 
766
+ ### `mdkg git`
767
+
768
+ When to use:
769
+ - inspect the current Git-backed mdkg project and accepted revision evidence
770
+ - clone or fetch real Git remotes through the system Git CLI with external auth
771
+ - close out mdkg state to static receipts before an agent checkpoint commit
772
+ - prove push readiness before any approval-gated real remote push
773
+
774
+ Usage:
775
+ - `mdkg git inspect [--json]`
776
+ - `mdkg git clone <repository-ref> --target <path> [--branch <name>] [--json]`
777
+ - `mdkg git fetch [--remote <name>] [--branch <name>] [--json]`
778
+ - `mdkg git closeout [--queue-policy drain|paused] [--output <path>] [--json]`
779
+ - `mdkg git push-ready --remote <name> --branch <name> [--json]`
780
+ - `mdkg git push --remote <name> --branch <name> [--json]`
781
+ - `mdkg git push --remote <name> --branch <name> --stage-all --message <text> [--queue-policy drain|paused] [--json]`
782
+ - `mdkg git push --remote <name> --branch <name> [--stage-all --message <text>] [--json]`
783
+
784
+ Flags:
785
+ - `--target <path>`
786
+ - `--branch <name>`
787
+ - `--remote <name>`
788
+ - `--queue-policy drain|paused`
789
+ - `--output <path>`
790
+ - `--stage-all`
791
+ - `--message <text>`
792
+ - `--json`
793
+
794
+ Notes:
795
+ - `mdkg git` is a low-level lifecycle surface, not project-memory semantic search
796
+ - v1 uses the system Git CLI; authentication stays external through credential helpers, SSH, `gh`, CI/runtime env, or shell state
797
+ - mdkg rejects repository refs and push remotes with embedded URL credentials; inspected remotes with userinfo are redacted before receipts are printed
798
+ - `git inspect` is read-only and emits sanitized source descriptors plus accepted-revision hashes
799
+ - `git clone` writes only to an empty or absent contained `--target`; use `mdkg graph clone|fork` for bundle/template graph transport
800
+ - `git closeout` validates mdkg state and writes static JSON and Markdown receipts under `.mdkg/git/closeouts` by default
801
+ - when the project DB participated, `git closeout` also seals `.mdkg/db/state/project.sqlite` and writes a deterministic dump
802
+ - `git push-ready` is read-only and requires explicit remote and branch, clean worktree, passing mdkg validation, external-auth-safe remote config, and a valid DB snapshot when DB state participated
803
+ - `git push --stage-all` writes closeout evidence, stages all changes, commits with `--message`, reruns push-ready, then pushes `HEAD` to the explicit remote branch
804
+ - real `git push` should remain approval-gated by the calling runtime or human operator
805
+
806
+ JSON receipts:
807
+ - `inspect`: `{ action: "git.inspect", ok, root, inside_work_tree, branch, head_sha, tree_hash, remotes, status, source_descriptor, accepted_revision, warnings }`
808
+ - `clone`: `{ action: "git.clone", ok, repository_ref, target, branch, source_descriptor, accepted_revision, inspect, warnings }`
809
+ - `fetch`: `{ action: "git.fetch", ok, remote, branch, fetch_output, inspect, warnings }`
810
+ - `closeout`: `{ action: "git.closeout", ok, root, output_dir, generated_at, git, validation, db_participated, db_snapshot_status, db_snapshot_seal, db_snapshot_dump, static_receipts, warnings }`
811
+ - `push-ready`: `{ action: "git.push_ready", ok, root, remote, branch, remote_url, git, validation, db_snapshot_status, checks, warning_count, failure_count, warnings, errors }`
812
+ - `push`: `{ action: "git.push", ok, remote, branch, head_sha, pushed_ref, stage_all, closeout, commit, push_ready, push_output, warnings }`
813
+
749
814
  ### `mdkg subgraph`
750
815
 
751
816
  When to use:
@@ -917,6 +982,48 @@ JSON receipts:
917
982
  - `evaluate`: `{ action: "evaluated", goal, report_only, runs_scripts, checks, completion_evidence_present }`
918
983
  - `pause|resume|done|archive`: `{ action, goal }`
919
984
 
985
+ ### `mdkg loop`
986
+
987
+ When to use:
988
+ - inspect reusable loop templates and scoped loop nodes
989
+ - fork a reusable loop template for a concrete project scope
990
+ - inspect loop planning state, child refs, run refs, and evidence refs without executing agents
991
+
992
+ Usage:
993
+ - `mdkg loop list [--ws <alias>] [--json]`
994
+ - `mdkg loop show <loop-or-template> [--meta] [--ws <alias>] [--json]`
995
+ - `mdkg loop fork <template> --scope <scope> [--title <title>] [--materialization default_children|planning_only|manual] [--planning-only] [--no-children] [--dry-run] [--run-id <id>] [--ws <alias>] [--json]`
996
+ - `mdkg loop plan <loop> [--ws <alias>] [--json]`
997
+ - `mdkg loop next <loop> [--ws <alias>] [--json]`
998
+ - `mdkg loop runs <loop> [--ws <alias>] [--json]`
999
+ - `mdkg loop list [--ws <alias>] [--no-cache] [--no-reindex] [--json]`
1000
+ - `mdkg loop show <loop-or-template> [--meta] [--ws <alias>] [--no-cache] [--no-reindex] [--json]`
1001
+ - `mdkg loop fork <template> --scope <scope> [--title <title>] [--materialization <mode>] [--planning-only] [--no-children] [--dry-run] [--run-id <id>] [--ws <alias>] [--no-cache] [--no-reindex] [--json]`
1002
+ - `mdkg loop plan <loop> [--ws <alias>] [--no-cache] [--no-reindex] [--json]`
1003
+ - `mdkg loop next <loop> [--ws <alias>] [--no-cache] [--no-reindex] [--json]`
1004
+ - `mdkg loop runs <loop> [--ws <alias>] [--no-cache] [--no-reindex] [--json]`
1005
+
1006
+ Behavior:
1007
+ - `loop` is one first-class node type; template, scoped fork, and run-bearing behavior is represented through metadata and links, not separate node types.
1008
+ - seed templates resolve from `.mdkg/templates/loops/<name>.loop.md`.
1009
+ - `loop list` reports indexed loop nodes plus reusable seed templates.
1010
+ - `loop show` reports either an indexed loop node or a seed template body/frontmatter.
1011
+ - `loop fork` creates a scoped loop; default materialization creates linked spike/task/test child nodes, while `planning_only` or `--no-children` creates only the scoped loop shell.
1012
+ - `loop fork --dry-run` is observational: it writes no nodes, indexes, events, or SQLite reservations, and the next real fork reuses the previewed ids.
1013
+ - forked loops retain template identity and content hash; list/show/plan report current, stale, missing-template, or unknown provenance without rewriting forks.
1014
+ - `loop plan` reports readiness state, materialization state, child/run/output refs, evidence lanes, blockers, closeout readiness, and blocker-continuation guidance without executing agents.
1015
+ - `loop next` is read-only and routes to the next actionable child, readiness lane, or blocker recovery step without claiming work.
1016
+ - `loop runs` reports linked `run_refs` and graph `evidence_refs` without executing runtime jobs.
1017
+ - mdkg defines reusable process state and graph context; omni-room-runtime or other runtimes execute agents, tools, sandboxes, traces, and model routing.
1018
+
1019
+ JSON receipts:
1020
+ - `list`: `{ action: "listed", loops, templates, warnings }`
1021
+ - `show`: `{ action: "showed", loop, warnings }` or `{ action: "showed", template, warnings }`
1022
+ - `fork`: `{ action: "forked"|"planned", loop, template, materialization_mode, materialized_children, pending_materialization, blocker_continuation, warnings }`
1023
+ - `plan`: `{ action: "planned", loop, materialization_mode, child_refs, pending_materialization, readiness, blocker_continuation, warnings }`
1024
+ - `next`: `{ action: "selected", loop, selected, rationale, skipped, readiness, warnings }`
1025
+ - `runs`: `{ action: "listed", loop, run_refs, evidence_refs, warnings }`
1026
+
920
1027
  ### `mdkg task`
921
1028
 
922
1029
  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.4.1`
17
+ Current package version in source: `0.5.0`
18
18
 
19
19
  mdkg is still pre-v1 public alpha software. The public package is usable, but graph, cache, bundle, and DAL contracts may continue to change quickly while the project converges on a stable v1 surface.
20
20
 
@@ -242,6 +242,26 @@ Subgraph nodes are projected under the subgraph alias, for example `child_repo:t
242
242
 
243
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
244
 
245
+ Use low-level Git lifecycle receipts when an agent run needs to close out local
246
+ mdkg state and prove push readiness before an explicit remote update:
247
+
248
+ ```bash
249
+ mdkg git inspect --json
250
+ mdkg git clone git@github.com:org/repo.git --target worktrees/repo --branch main --json
251
+ mdkg git fetch --remote origin --branch main --json
252
+ mdkg git closeout --json
253
+ mdkg git push-ready --remote origin --branch main --json
254
+ mdkg git push --remote origin --branch main --stage-all --message "agent checkpoint" --json
255
+ ```
256
+
257
+ `mdkg git` uses the system Git CLI. Authentication stays external through SSH,
258
+ credential helpers, `gh`, CI/runtime environment, or shell state; mdkg rejects
259
+ embedded URL credentials and records only sanitized refs, hashes, policy names,
260
+ and receipts. `closeout` validates mdkg state before writing static JSON and
261
+ Markdown receipts, and when the project DB participated it also seals the
262
+ SQLite state and writes a deterministic dump. Treat real `mdkg git push` as an
263
+ approval-gated operation in agent runtimes.
264
+
245
265
  Launch a local read-only MCP server when an MCP-capable agent should inspect a
246
266
  specific mdkg graph without receiving mutation tools:
247
267
 
@@ -474,10 +494,12 @@ Current source behavior:
474
494
  - `mdkg skill sync` refreshes the product-specific mirrors from canonical `.mdkg/skills/`
475
495
  - mirrored skill folders are append-focused outputs; preserve unrelated existing folders and fail on same-slug collisions unless explicitly forced
476
496
 
477
- This repo now dogfoods three internal skills:
497
+ This repo now dogfoods mdkg-authored internal skills:
478
498
  - `author-mdkg-skill`
479
499
  - `select-work-and-ground-context`
480
500
  - `build-pack-and-execute-task`
501
+ - `pursue-mdkg-goal`
502
+ - `pursue-mdkg-loop`
481
503
  - `verify-close-and-checkpoint`
482
504
 
483
505
  Optional skill metadata with prefixes such as `ochatr_*` is treated as vendor extension data. Structured skill output exposes it under `extensions.ochatr` while keeping the top-level `ochatr` field as a compatibility alias introduced in 0.0.9. ochatr.ai is a pioneering adopter of this extension pattern, not the name of the base mdkg standard.
@@ -501,6 +523,13 @@ Fresh `mdkg init` workspaces default to `index.backend: sqlite`, which writes `.
501
523
 
502
524
  `mdkg index` still writes JSON compatibility caches (`global.json`, `skills.json`, `capabilities.json`, and subgraph projections when configured). In SQLite mode it also rebuilds the SQLite cache with nodes, edges, skills, capabilities, archive metadata, subgraphs, source hashes, and schema metadata. Deleting the SQLite file is recoverable with `mdkg index`.
503
525
 
526
+ Graph ingestion is bounded before Markdown bodies are read. New workspaces expose
527
+ `index.limits.max_files`, `max_file_bytes`, `max_total_bytes`, and `max_depth` in
528
+ `.mdkg/config.json`; older configs receive the same conservative defaults in
529
+ memory. Pack traversal and body reads are bounded before construction, ZIP input
530
+ is bounded before allocation and inflation, and the local read-only MCP server
531
+ rejects oversized lines, batches, nesting, bodies, tool payloads, and responses.
532
+
504
533
  Mutating commands use a workspace mutation lock plus atomic writes. SQLite mode additionally reserves numeric ids in a SQLite transaction before writing Markdown so parallel `mdkg new` and checkpoint calls avoid naming conflicts. Skipped ids after failed writes are acceptable because Markdown remains canonical.
505
534
 
506
535
  ## Project DB Layout
@@ -564,6 +593,14 @@ Use `mdkg goal claim [goal-id] <work-id>` to durably set `active_node` after cho
564
593
 
565
594
  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.
566
595
 
596
+ ## Loop nodes
597
+
598
+ Loop nodes are durable declarative process state for reusable agentic workflows. Use `mdkg new loop "<process>"` for a loop record, or `mdkg loop fork <template> --scope <scope>` to instantiate a seeded template for a concrete repo, folder, or goal.
599
+
600
+ `loop` is one first-class node type. A loop can act as a reusable template, scoped fork, or run-bearing loop through metadata and links; mdkg does not create separate `loop_template` or `loop_run` node types in this release. Loop metadata records mode, scope, lineage, materialization mode, child refs, run/evidence refs, definition of done, and blocker-continuation policy.
601
+
602
+ `mdkg loop list|show|plan|runs` inspect loop state without executing agents. `mdkg loop fork` creates graph state; by default it materializes linked spike/task/test child nodes, while `--planning-only` or `--no-children` creates only the scoped loop shell. mdkg defines reusable process state and graph context; omni-room-runtime or another runtime owns agent/tool execution, sandboxes, traces, and model routing.
603
+
567
604
  ## Research spikes
568
605
 
569
606
  Spikes are first-class actionable work nodes for research and planning. Use
@@ -630,6 +667,7 @@ This release includes:
630
667
  - SQLite index backend for fresh workspaces using built-in `node:sqlite`
631
668
  - mutation locking and atomic writes for parallel mdkg calls
632
669
  - first-class `goal` nodes and `mdkg goal show/next/evaluate/pause/resume/done`
670
+ - first-class `loop` nodes and `mdkg loop list/show/fork/plan/runs`
633
671
  - optional `skills: [...]` on work items
634
672
  - pack-time skill inclusion
635
673
  - latest-checkpoint resolver + index hint