mdkg 0.1.3 → 0.1.5

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 (49) hide show
  1. package/CHANGELOG.md +45 -1
  2. package/README.md +34 -10
  3. package/dist/cli.js +354 -87
  4. package/dist/commands/bundle.js +7 -7
  5. package/dist/commands/capability.js +118 -4
  6. package/dist/commands/doctor.js +15 -15
  7. package/dist/commands/goal.js +548 -0
  8. package/dist/commands/index.js +1 -1
  9. package/dist/commands/init.js +1 -0
  10. package/dist/commands/list.js +1 -1
  11. package/dist/commands/new.js +7 -1
  12. package/dist/commands/next.js +1 -1
  13. package/dist/commands/node_card.js +1 -1
  14. package/dist/commands/pack.js +1 -1
  15. package/dist/commands/search.js +1 -1
  16. package/dist/commands/show.js +1 -1
  17. package/dist/commands/subgraph.js +312 -0
  18. package/dist/commands/task.js +1 -1
  19. package/dist/commands/upgrade.js +54 -7
  20. package/dist/commands/validate.js +39 -7
  21. package/dist/commands/work.js +1 -1
  22. package/dist/core/config.js +95 -39
  23. package/dist/graph/frontmatter.js +8 -0
  24. package/dist/graph/goal_scope.js +127 -0
  25. package/dist/graph/index_cache.js +12 -12
  26. package/dist/graph/indexer.js +1 -1
  27. package/dist/graph/node.js +80 -1
  28. package/dist/graph/reindex.js +6 -6
  29. package/dist/graph/sqlite_index.js +6 -6
  30. package/dist/graph/{bundle_imports.js → subgraphs.js} +214 -140
  31. package/dist/graph/validate_graph.js +41 -0
  32. package/dist/graph/visibility.js +3 -3
  33. package/dist/init/AGENT_START.md +17 -1
  34. package/dist/init/CLI_COMMAND_MATRIX.md +43 -7
  35. package/dist/init/README.md +9 -8
  36. package/dist/init/config.json +1 -1
  37. package/dist/init/core/rule-3-cli-contract.md +56 -23
  38. package/dist/init/core/rule-4-repo-safety-and-ignores.md +7 -2
  39. package/dist/init/core/rule-6-templates-and-schemas.md +10 -1
  40. package/dist/init/init-manifest.json +20 -10
  41. package/dist/init/skills/default/pursue-mdkg-goal/SKILL.md +68 -0
  42. package/dist/init/skills/default/select-work-and-ground-context/SKILL.md +9 -7
  43. package/dist/init/skills/default/verify-close-and-checkpoint/SKILL.md +11 -10
  44. package/dist/init/templates/default/goal.md +91 -0
  45. package/dist/pack/order.js +2 -1
  46. package/dist/pack/pack.js +17 -0
  47. package/dist/util/argparse.js +2 -0
  48. package/package.json +8 -6
  49. package/dist/commands/bundle_import.js +0 -255
package/CHANGELOG.md CHANGED
@@ -4,7 +4,51 @@ All notable changes to mdkg are documented here.
4
4
 
5
5
  This project follows a pragmatic changelog style inspired by Keep a Changelog. Versions use npm package versions.
6
6
 
7
- ## 0.1.3 - Unreleased
7
+ mdkg is pre-v1 public alpha software. Command, graph, cache, bundle, and DAL contracts may change quickly while the project converges on a stable v1 surface.
8
+
9
+ ## 0.1.5 - Unreleased
10
+
11
+ ### Added
12
+
13
+ - Added first-class `goal` nodes for recursive long-running objectives with `goal_state`, `goal_condition`, `active_node`, required skills, required checks, iteration limits, stop conditions, and completion evidence.
14
+ - Added `mdkg new goal "<title>"` and the `mdkg goal show/select/current/clear/next/claim/evaluate/pause/resume/done` command family.
15
+ - Added a bundled `goal.md` template so init, upgrade, and template fallback can support goal nodes.
16
+ - Added `scope_refs` for explicit goal ownership roots and recursive goal traversal through epics and features.
17
+ - Added the `pursue-mdkg-goal` skill for skill-guided recursive pursuit with evidence and controlled skill-improvement proposals.
18
+ - Added goal parser, creation, selected-goal, recursive next-selection, claim, pack, and report-only evaluation tests.
19
+
20
+ ### Changed
21
+
22
+ - Normal `mdkg next` continues to select concrete task, bug, test, and feature work; goal-scoped selection lives under `mdkg goal next`.
23
+ - `mdkg goal next` is read-only and may omit the goal id when a selected local goal exists; `mdkg goal claim` is the explicit mutating path for `active_node`.
24
+ - Goal required checks are report-only guidance in this release. Agents run commands themselves and record evidence back into mdkg.
25
+ - Skill self-improvement during goal execution is recorded as candidates or proposal work unless the active node is explicit skill-maintenance.
26
+
27
+ ## 0.1.4 - Unreleased
28
+
29
+ ### Added
30
+
31
+ - Added `mdkg subgraph add/list/show/rm/enable/disable/verify/refresh` as the public read-only child graph orchestration command family.
32
+ - Added `subgraphs` config with multi-source bundle transport, advisory visibility, read permissions, source metadata, and a default 60 minute freshness policy.
33
+ - Added `.mdkg/index/subgraphs.json` as the derived subgraph projection and health cache.
34
+ - Added `mdkg capability resolve [query] [--requires <capability>] [--fresh-only] [--json]` for deterministic local plus subgraph capability ranking.
35
+ - Added packed-package `smoke:subgraph` coverage for root, child, and grandchild orchestration flows.
36
+
37
+ ### Changed
38
+
39
+ - Replaced the public `mdkg bundle import ...` surface with `mdkg subgraph ...`; legacy calls now exit with migration guidance.
40
+ - `mdkg upgrade --apply` migrates legacy `bundle_imports` config into `subgraphs`.
41
+ - Read commands, `pack`, and capability discovery now project enabled child bundles as read-only subgraph qids such as `child_repo:work.example`.
42
+ - `mdkg index`, SQLite cache rebuilds, `doctor`, and `validate` now use subgraph naming and metadata instead of bundle-import naming.
43
+ - Stale subgraphs remain usable for planning reads with warnings, fail `mdkg subgraph verify`, and are excluded from `capability resolve --fresh-only`.
44
+ - Public/internal subgraphs require public bundle profiles and public bundle creation fails closed on private/internal subgraph references.
45
+
46
+ ### Fixed
47
+
48
+ - Mutation commands now reject subgraph qids with explicit guidance to update the source workspace for the owning subgraph.
49
+ - Seeded init docs, command matrix, and release skills now teach `subgraph` and `capability resolve` instead of onboarding users through `bundle import`.
50
+
51
+ ## 0.1.3 - 2026-05-20
8
52
 
9
53
  ### Added
10
54
 
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.1.3`
17
+ Current package version in source: `0.1.5`
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
 
@@ -77,6 +77,17 @@ Create a task:
77
77
  mdkg new task "bootstrap cli" --status todo --priority 1 --tags cli,build
78
78
  ```
79
79
 
80
+ Create a recursive goal for long-running agent work:
81
+
82
+ ```bash
83
+ mdkg new goal "reach prepublish readiness"
84
+ mdkg goal show goal-1 --json
85
+ mdkg goal next goal-1
86
+ mdkg goal evaluate goal-1 --json
87
+ ```
88
+
89
+ Goal nodes capture a measurable end condition, recursive loop state, required skills, required checks, and completion evidence. They guide agent harnesses through repeated graph-backed progress, while tasks, bugs, tests, and features remain the concrete executable work units. In this release `mdkg goal evaluate` is report-only: it lists required checks and evidence state, but does not execute scripts.
90
+
80
91
  Create an agent workflow document with a semantic portable id:
81
92
 
82
93
  ```bash
@@ -110,20 +121,21 @@ mdkg bundle verify .mdkg/bundles/private/all.mdkg.zip
110
121
  mdkg bundle list --json
111
122
  ```
112
123
 
113
- Bundles are explicit graph transport artifacts, separate from task context packs. Before a commit in repos that track archives or bundles, refresh compressed archive caches first, then create the private bundle so the committed graph state is self-consistent. Private bundles are the default and may be committed in private repos when configured. Public bundles require at least one selected workspace with `visibility: public` and include only public workspace content and public archive sidecars; bundle creation fails if public content points at private graph, archive, or imported bundle records.
124
+ Bundles are explicit graph transport artifacts, separate from task context packs. Before a commit in repos that track archives or bundles, refresh compressed archive caches first, then create the private bundle so the committed graph state is self-consistent. Private bundles are the default and may be committed in private repos when configured. Public bundles require at least one selected workspace with `visibility: public` and include only public workspace content and public archive sidecars; bundle creation fails if public content points at private graph, archive, or subgraph records.
114
125
 
115
- Import a child repo bundle as a read-only planning view:
126
+ Register a child repo bundle as a read-only subgraph planning view:
116
127
 
117
128
  ```bash
118
- mdkg bundle import add child_repo child-repo/.mdkg/bundles/private/all.mdkg.zip --source-path child-repo
119
- mdkg bundle import list --json
129
+ mdkg subgraph add child_repo child-repo/.mdkg/bundles/private/all.mdkg.zip --source-path child-repo
130
+ mdkg subgraph list --json
120
131
  mdkg search "child capability"
121
132
  mdkg show child_repo:work.example
122
133
  mdkg pack child_repo:work.example --dry-run --stats
123
- mdkg bundle import verify child_repo --json
134
+ mdkg capability resolve "child capability" --json
135
+ mdkg subgraph verify child_repo --json
124
136
  ```
125
137
 
126
- Imported bundle nodes are projected under the import alias, for example `child_repo:task-1`. They are available to `list`, `search`, `show`, `pack`, and capability discovery, but remain read-only; mutate the child repo and refresh its bundle to change imported content. Stale imports warn during planning reads and fail `mdkg bundle import verify`. Public or internal imports must be backed by public bundle profiles; private imports stay private planning context.
138
+ 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 refresh its bundle to change subgraph content. 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.
127
139
 
128
140
  Validate before handoff or commit:
129
141
 
@@ -158,7 +170,7 @@ mdkg work artifact add receipt.generate-image-1 ./outputs/image.png --id archive
158
170
  ```
159
171
 
160
172
  Receipt statuses are `recorded`, `verified`, `rejected`, and `superseded`.
161
- Update and artifact commands accept local ids or local qids; imported bundle qids are read-only and must be changed in their source workspace.
173
+ Update and artifact commands accept local ids or local qids; subgraph qids are read-only and must be changed in their source workspace.
162
174
 
163
175
  Update structured task state and evidence while keeping body and narrative edits in markdown:
164
176
 
@@ -206,7 +218,7 @@ mdkg lives under a hidden root directory:
206
218
  - `.mdkg/archive/` sidecar metadata plus deterministic compressed source/artifact caches
207
219
  - `.mdkg/bundles/` optional committed full graph snapshot bundles
208
220
  - `.mdkg/index/mdkg.sqlite` optional committed, rebuildable SQLite access cache
209
- - `.mdkg/index/imports.json` generated read-only bundle import cache
221
+ - `.mdkg/index/subgraphs.json` generated read-only subgraph projection cache
210
222
  - `.agents/skills/` Codex/OpenAI-facing mirrored skills
211
223
  - `.claude/skills/` Claude-facing mirrored skills
212
224
  - `.mdkg/index/*.json` generated JSON compatibility cache files
@@ -225,6 +237,7 @@ These are the commands new users and agents should learn first:
225
237
  - `mdkg capability`
226
238
  - `mdkg archive`
227
239
  - `mdkg work`
240
+ - `mdkg goal`
228
241
  - `mdkg task`
229
242
  - `mdkg validate`
230
243
 
@@ -300,10 +313,20 @@ Capability records aggregate enabled registered workspaces and include determini
300
313
 
301
314
  Fresh `mdkg init` workspaces default to `index.backend: sqlite`, which writes `.mdkg/index/mdkg.sqlite` as a rebuildable access cache using Node's built-in `node:sqlite`. Existing workspaces that are migrated from older configs default to `index.backend: json` until they opt in. Markdown files, archive sidecars, bundle manifests, and config remain source of truth in both modes.
302
315
 
303
- `mdkg index` still writes JSON compatibility caches (`global.json`, `skills.json`, `capabilities.json`, and import projections when configured). In SQLite mode it also rebuilds the SQLite cache with nodes, edges, skills, capabilities, archive metadata, bundle imports, source hashes, and schema metadata. Deleting the SQLite file is recoverable with `mdkg index`.
316
+ `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`.
304
317
 
305
318
  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.
306
319
 
320
+ ## Goal nodes
321
+
322
+ Goal nodes are durable recursive objective contracts. Use `mdkg new goal "<objective>"` when a human or agent needs to keep working across multiple concrete nodes until a measurable end condition is achieved.
323
+
324
+ `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 select <goal-id>` once, then `mdkg goal next` to choose the next local feature, task, bug, or test inside that goal. `mdkg goal next <goal-id>` remains available for explicit selection. Epics organize goal scope recursively but are not returned as executable work.
325
+
326
+ 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.
327
+
328
+ 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.
329
+
307
330
  ## Agent workflow files
308
331
 
309
332
  mdkg recognizes a small set of canonical agent workflow documents:
@@ -341,6 +364,7 @@ This release includes:
341
364
  - JSON capability cache for skills, `SPEC.md`, `WORK.md`, core docs, and design docs
342
365
  - SQLite index backend for fresh workspaces using built-in `node:sqlite`
343
366
  - mutation locking and atomic writes for parallel mdkg calls
367
+ - first-class `goal` nodes and `mdkg goal show/next/evaluate/pause/resume/done`
344
368
  - optional `skills: [...]` on work items
345
369
  - pack-time skill inclusion
346
370
  - latest-checkpoint resolver + index hint