mdkg 0.0.8 → 0.1.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 (54) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/CONTRIBUTING.md +124 -0
  3. package/README.md +49 -14
  4. package/dist/cli.js +113 -32
  5. package/dist/commands/checkpoint.js +19 -2
  6. package/dist/commands/event.js +12 -0
  7. package/dist/commands/init.js +4 -0
  8. package/dist/commands/init_manifest.js +131 -0
  9. package/dist/commands/new.js +57 -21
  10. package/dist/commands/pack.js +14 -0
  11. package/dist/commands/query_output.js +2 -0
  12. package/dist/commands/search.js +8 -0
  13. package/dist/commands/show.js +7 -0
  14. package/dist/commands/skill.js +80 -12
  15. package/dist/commands/task.js +42 -12
  16. package/dist/commands/upgrade.js +286 -0
  17. package/dist/commands/validate.js +31 -3
  18. package/dist/commands/workspace.js +105 -13
  19. package/dist/core/config.js +217 -22
  20. package/dist/core/migrate.js +39 -5
  21. package/dist/core/version.js +31 -0
  22. package/dist/core/workspace_path.js +41 -0
  23. package/dist/graph/agent_file_types.js +392 -0
  24. package/dist/graph/edges.js +13 -10
  25. package/dist/graph/frontmatter.js +33 -0
  26. package/dist/graph/indexer.js +1 -0
  27. package/dist/graph/node.js +43 -16
  28. package/dist/graph/skills_indexer.js +14 -1
  29. package/dist/graph/template_schema.js +13 -126
  30. package/dist/graph/validate_graph.js +302 -2
  31. package/dist/init/AGENT_START.md +14 -2
  32. package/dist/init/CLI_COMMAND_MATRIX.md +49 -1
  33. package/dist/init/README.md +14 -0
  34. package/dist/init/core/rule-6-templates-and-schemas.md +1 -3
  35. package/dist/init/init-manifest.json +197 -0
  36. package/dist/init/legacy/v0.0.9-init-manifest.json +197 -0
  37. package/dist/init/skills/default/verify-close-and-checkpoint/SKILL.md +12 -11
  38. package/dist/init/templates/default/dispute.md +31 -0
  39. package/dist/init/templates/default/feedback.md +27 -0
  40. package/dist/init/templates/default/proposal.md +35 -0
  41. package/dist/init/templates/default/receipt.md +31 -0
  42. package/dist/init/templates/default/spec.md +43 -0
  43. package/dist/init/templates/default/work.md +44 -0
  44. package/dist/init/templates/default/work_order.md +32 -0
  45. package/dist/pack/export_json.js +3 -0
  46. package/dist/pack/export_md.js +9 -0
  47. package/dist/pack/export_xml.js +9 -0
  48. package/dist/pack/order.js +7 -0
  49. package/dist/pack/pack.js +1 -0
  50. package/dist/templates/loader.js +2 -2
  51. package/dist/util/argparse.js +2 -0
  52. package/dist/util/id.js +19 -0
  53. package/package.json +10 -2
  54. package/scripts/postinstall.js +89 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,71 @@
1
+ # Changelog
2
+
3
+ All notable changes to mdkg are documented here.
4
+
5
+ This project follows a pragmatic changelog style inspired by Keep a Changelog. Versions use npm package versions.
6
+
7
+ ## 0.1.0 - 2026-05-12
8
+
9
+ ### Added
10
+
11
+ - Added conservative `mdkg upgrade` for existing workspaces.
12
+ - Added `.mdkg/init-manifest.json` ownership tracking for managed init assets.
13
+ - Added v0.0.9 seed fingerprints so clean older workspaces can safely adopt current init docs, templates, and default skills.
14
+ - Added `npm run smoke:upgrade` for packed-package upgrade verification in temporary workspaces.
15
+
16
+ ### Changed
17
+
18
+ - `mdkg upgrade` defaults to dry-run; `mdkg upgrade --apply` is the only mutating upgrade path.
19
+ - Agent-enabled workspaces can receive safe managed default skill upgrades and mirror refreshes during upgrade.
20
+ - Publish readiness now checks packaged init manifests and runs upgrade smoke before publish.
21
+
22
+ ## 0.0.9 - 2026-05-12
23
+
24
+ ### Added
25
+
26
+ - Added generic agent workflow file support for `SPEC.md`, `WORK.md`, `WORK_ORDER.md`, `RECEIPT.md`, `FEEDBACK.md`, `DISPUTE.md`, and `PROPOSAL.md`.
27
+ - Added `mdkg new <agent-file-type> ... --id <portable-id>` for semantic ids such as `agent.image-worker` and `work.generate-image`.
28
+ - Added validation support for `pricing_model: included`.
29
+ - Added validation support for `proposal_kind: skill_update` targeting `skill.<slug>` refs.
30
+ - Added generic skill extension output under `extensions`, with `ochatr_*` metadata mapped to `extensions.ochatr`.
31
+ - Added a non-mutating npm `postinstall` hint that points users to `mdkg --help` and prints shell PATH guidance only when needed.
32
+ - Added `docs/agent-runtime-0.0.9-handoff.md` to document the runtime migration path from implementation-specific naming to generic agent workflow naming.
33
+ - Added `npm run smoke:matrix` to pack mdkg, install it into an isolated temporary npm prefix, and exercise the command matrix plus onboarding workflows from the packaged CLI.
34
+
35
+ ### Changed
36
+
37
+ - Renamed the remaining public Omni file-type surface to generic agent workflow language.
38
+ - Kept `mdkg init --omni` only as hidden migration guidance to `mdkg init --agent`.
39
+ - Updated README and command matrix version references to `0.0.9`.
40
+ - Removed stale prepublish wording and absolute local README links.
41
+ - Removed `AGENT_PROMPT_SNIPPET.md` and distilled its startup rules into `AGENT_START.md`, making `AGENT_START.md` the single first-hop agent onboarding doc.
42
+ - Treated ochatr.ai metadata as a vendor extension pattern rather than the base mdkg schema name.
43
+ - Added npm `prepack` and `prepublishOnly` guards so release commands fail if the built CLI or init assets are missing.
44
+ - Included `CHANGELOG.md` and `CONTRIBUTING.md` in the npm package because README links to them.
45
+
46
+ ### Fixed
47
+
48
+ - Fixed strict validation gaps for room-runtime-style skill proposals and included pricing.
49
+ - Fixed docs drift between published `0.0.8`, local source version, and the 0.0.9 release target.
50
+
51
+ ### Verification Status
52
+
53
+ - Passed: `npm ci` with `NPM_CONFIG_CACHE=/private/tmp/mdkg-npm-cache`.
54
+ - Passed: `npm run build`.
55
+ - Passed: `npm run test` with 306 tests.
56
+ - Passed: `npm run cli:check`.
57
+ - Passed: `node dist/cli.js validate`.
58
+ - Passed: `npm run smoke:consumer`.
59
+ - Passed: `npm run smoke:matrix`.
60
+ - Passed: `npm pack --dry-run --json`; tarball includes `dist/cli.js`, compiled command/core/graph/pack/template/util files, `dist/init/`, `CHANGELOG.md`, `CONTRIBUTING.md`, `README.md`, `LICENSE`, package metadata, and `scripts/postinstall.js`.
61
+ - Passed: `npm publish --dry-run`; `prepublishOnly` and `prepack` both completed successfully.
62
+ - Confirmed before publish: npm registry latest remains `mdkg@0.0.8`.
63
+
64
+ ## 0.0.8
65
+
66
+ - Published npm baseline before the 0.0.9 agent workflow release work.
67
+ - Does not include agent workflow file types, mutation JSON receipt expansion, workspace enable/disable, or postinstall guidance.
68
+
69
+ ## 0.0.7 and earlier
70
+
71
+ - Historical local and published release line for mdkg's initial CLI, graph, pack, skill, and agent-bootstrap work.
@@ -0,0 +1,124 @@
1
+ # Contributing to mdkg
2
+
3
+ mdkg is a local-first CLI for deterministic project memory. Contributions should preserve that shape: file-based, inspectable in git, deterministic when possible, and useful to both humans and agents.
4
+
5
+ ## Prompt Requests Before Pull Requests
6
+
7
+ The preferred contribution path is a Prompt Request: describe intent clearly enough that a maintainer, human contributor, or coding agent can turn it into a correct patch.
8
+
9
+ This is inspired by the OpenClaw creator's framing of Prompt Requests over Pull Requests. The point is not to reject code; it is to make user intent first-class. Many useful contributors know the workflow problem better than the codebase. mdkg should capture that intent before debating implementation details.
10
+
11
+ Use a Prompt Request when you want to propose:
12
+ - a new command or flag
13
+ - a docs or onboarding improvement
14
+ - a validation rule
15
+ - a workflow standard
16
+ - a bug report with expected behavior
17
+ - an agent-facing convention or template
18
+
19
+ A good Prompt Request includes:
20
+ - the goal in plain language
21
+ - the current behavior or gap
22
+ - the desired behavior
23
+ - one or two example commands or markdown snippets
24
+ - acceptance criteria
25
+ - any constraints, such as backwards compatibility or public naming
26
+
27
+ Code Pull Requests are still welcome when the implementation is clear, scoped, tested, and linked to the intent it serves.
28
+
29
+ ## Public Naming
30
+
31
+ mdkg's public standard language is generic agent workflow language.
32
+
33
+ Use:
34
+ - `agent workflow files`
35
+ - `agent workflow docs`
36
+ - `mdkg init --agent`
37
+ - `skill.<slug>` for skill proposal targets
38
+ - `extensions.<vendor>` for vendor extension metadata
39
+
40
+ Avoid new public API or docs language that makes mdkg look tied to one product or runtime. ochatr.ai is a pioneering adopter and may use `ochatr_*` extension metadata, but the base mdkg schema should stay vendor-neutral.
41
+
42
+ ## Development Loop
43
+
44
+ Install dependencies when npm is available:
45
+
46
+ ```bash
47
+ npm install
48
+ ```
49
+
50
+ Core checks:
51
+
52
+ ```bash
53
+ npm run build
54
+ npm run test
55
+ npm run cli:check
56
+ node dist/cli.js validate
57
+ ```
58
+
59
+ Release smoke checks:
60
+
61
+ ```bash
62
+ npm run smoke:consumer
63
+ npm pack --dry-run
64
+ ```
65
+
66
+ If the local toolchain is incomplete, document exactly what was blocked and run the checks that are still possible, such as:
67
+
68
+ ```bash
69
+ git diff --check
70
+ node --check scripts/postinstall.js
71
+ ```
72
+
73
+ ## Working in the mdkg Repo
74
+
75
+ This repo dogfoods mdkg. Before a substantial change:
76
+
77
+ 1. Read `AGENT_START.md`.
78
+ 2. Inspect relevant source and tests.
79
+ 3. Use `CLI_COMMAND_MATRIX.md` for the command surface.
80
+ 4. Keep source behavior and docs aligned.
81
+ 5. Add focused tests for new user-visible behavior.
82
+ 6. Run `mdkg validate` after building when possible.
83
+
84
+ Do not commit generated index or pack outputs. Keep `.mdkg/index/` and `.mdkg/pack/` ignored.
85
+
86
+ ## Change Requirements
87
+
88
+ Good patches are:
89
+ - small enough to review
90
+ - explicit about public interface changes
91
+ - covered by focused tests
92
+ - documented in `README.md`, `CLI_COMMAND_MATRIX.md`, or `CHANGELOG.md` when behavior changes
93
+ - careful with existing dirty worktree changes
94
+
95
+ For agent workflow files, update tests and fixtures when changing:
96
+ - accepted frontmatter fields
97
+ - validation rules
98
+ - `mdkg new` scaffolding
99
+ - pack/search/show output
100
+
101
+ For release work, update:
102
+ - `package.json`
103
+ - `package-lock.json`
104
+ - `README.md`
105
+ - `CLI_COMMAND_MATRIX.md`
106
+ - `CHANGELOG.md`
107
+ - init assets under `assets/init/` when generated starter docs change
108
+
109
+ ## Pull Request Guidance
110
+
111
+ When submitting code, include:
112
+ - linked Prompt Request or short intent statement
113
+ - summary of behavior changes
114
+ - tests run and any blocked checks
115
+ - docs updated or reason docs were not needed
116
+ - compatibility notes for existing mdkg repos
117
+
118
+ Do not include unrelated formatting churn or generated artifacts unless the change requires them.
119
+
120
+ ## Security and Secrets
121
+
122
+ Do not put secrets in mdkg nodes, packs, events, fixtures, or test outputs. mdkg is project memory, not a secret store.
123
+
124
+ Report security-sensitive issues privately until a safe disclosure path is established.
package/README.md CHANGED
@@ -13,7 +13,7 @@ mdkg stays deliberately boring:
13
13
  - zero runtime dependencies
14
14
  - no sqlite, daemon, hosted index, or vector DB
15
15
 
16
- Current package version in source: `0.0.6`
16
+ Current package version in source: `0.1.0`
17
17
 
18
18
  ## The product shape
19
19
 
@@ -31,8 +31,6 @@ If a repo needs repeatable procedures, author them as first-class skills under `
31
31
 
32
32
  ## Install
33
33
 
34
- Once published:
35
-
36
34
  ```bash
37
35
  npm i -g mdkg
38
36
  # or
@@ -59,12 +57,34 @@ mdkg init --agent
59
57
 
60
58
  This adds strict-node `SOUL.md` / `HUMAN.md`, seeds the three default mdkg usage skills, creates `events.jsonl`, updates the skill registry, adds core pin updates, and creates mirrored skill folders under `.agents/skills/` and `.claude/skills/`.
61
59
 
60
+ Preview safe scaffold upgrades in an existing mdkg workspace:
61
+
62
+ ```bash
63
+ mdkg upgrade
64
+ mdkg upgrade --json
65
+ ```
66
+
67
+ Apply only after reviewing the receipt:
68
+
69
+ ```bash
70
+ mdkg upgrade --apply
71
+ ```
72
+
73
+ Upgrade is intentionally conservative. It creates missing managed startup docs and updates unchanged mdkg seed assets, but preserves customized docs, templates, skills, and core files as reported conflicts. Agent-enabled workspaces also get safe default skill upgrades and skill mirror refreshes; non-agent workspaces do not gain skills, events, or mirrors implicitly.
74
+
62
75
  Create a task:
63
76
 
64
77
  ```bash
65
78
  mdkg new task "bootstrap cli" --status todo --priority 1 --tags cli,build
66
79
  ```
67
80
 
81
+ Create an agent workflow document with a semantic portable id:
82
+
83
+ ```bash
84
+ mdkg new spec "image worker" --id agent.image-worker
85
+ mdkg new work "generate image" --id work.generate-image
86
+ ```
87
+
68
88
  Inspect the current truth:
69
89
 
70
90
  ```bash
@@ -94,8 +114,6 @@ mdkg task update task-1 --add-artifacts tests://unit.txt --add-tags release
94
114
  mdkg task done task-1 --checkpoint "release readiness milestone"
95
115
  ```
96
116
 
97
- `mdkg task ...` remains limited to `task`, `bug`, and `test`, but `skills: [...]` is valid metadata on all work items (`epic`, `feat`, `task`, `bug`, `checkpoint`, `test`). mdkg-generated work items should validate and round-trip through the task mutators without manual frontmatter repair.
98
-
99
117
  Ensure and append baseline event memory:
100
118
 
101
119
  ```bash
@@ -115,13 +133,13 @@ mdkg skill validate release-readiness
115
133
  ## LLM-readable onboarding artifacts
116
134
 
117
135
  The root docs below are the canonical fast-start set for humans and agents:
118
- - [`AGENT_START.md`](/Users/nicholasreames/Git/mdkg/AGENT_START.md)
119
- - [`llms.txt`](/Users/nicholasreames/Git/mdkg/llms.txt)
120
- - [`AGENT_PROMPT_SNIPPET.md`](/Users/nicholasreames/Git/mdkg/AGENT_PROMPT_SNIPPET.md)
121
- - [`PACK_EXAMPLES.md`](/Users/nicholasreames/Git/mdkg/PACK_EXAMPLES.md)
122
- - [`MANUAL_BEHAVIOR_AUDIT.md`](/Users/nicholasreames/Git/mdkg/MANUAL_BEHAVIOR_AUDIT.md)
123
- - [`CLI_COMMAND_MATRIX.md`](/Users/nicholasreames/Git/mdkg/CLI_COMMAND_MATRIX.md)
124
- - [`COVERAGE_HARDENING_MATRIX.md`](/Users/nicholasreames/Git/mdkg/COVERAGE_HARDENING_MATRIX.md)
136
+ - [`AGENT_START.md`](AGENT_START.md)
137
+ - [`llms.txt`](llms.txt)
138
+ - [`PACK_EXAMPLES.md`](PACK_EXAMPLES.md)
139
+ - [`CLI_COMMAND_MATRIX.md`](CLI_COMMAND_MATRIX.md)
140
+ - [`COVERAGE_HARDENING_MATRIX.md`](COVERAGE_HARDENING_MATRIX.md)
141
+ - [`CHANGELOG.md`](CHANGELOG.md)
142
+ - [`CONTRIBUTING.md`](CONTRIBUTING.md)
125
143
 
126
144
  ## Repository shape
127
145
 
@@ -139,6 +157,7 @@ mdkg lives under a hidden root directory:
139
157
 
140
158
  These are the commands new users and agents should learn first:
141
159
  - `mdkg init`
160
+ - `mdkg upgrade`
142
161
  - `mdkg new`
143
162
  - `mdkg search`
144
163
  - `mdkg show`
@@ -186,7 +205,6 @@ Current source behavior:
186
205
  - `mdkg skill search "<query>" --xml|--toon|--md`
187
206
  - `mdkg skill show <slug> --xml|--toon|--md`
188
207
  - work items may reference `skills: [slug,...]`
189
- - `skills` is valid on all work items (`epic`, `feat`, `task`, `bug`, `checkpoint`, `test`)
190
208
  - packs may include skills with `--skills` and `--skills-depth`
191
209
  - mdkg indexes and discovers skills but does not execute skill scripts
192
210
  - `SKILL.md` is canonical
@@ -202,6 +220,21 @@ This repo now dogfoods three internal skills:
202
220
  - `build-pack-and-execute-task`
203
221
  - `verify-close-and-checkpoint`
204
222
 
223
+ 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.
224
+
225
+ ## Agent workflow files
226
+
227
+ mdkg recognizes a small set of canonical agent workflow documents:
228
+ - `SPEC.md` for agent, package, or runtime specifications
229
+ - `WORK.md` for reusable work contracts
230
+ - `WORK_ORDER.md` for concrete requests against work contracts
231
+ - `RECEIPT.md` for completed work output and artifacts
232
+ - `FEEDBACK.md`, `DISPUTE.md`, and `PROPOSAL.md` for review loops
233
+
234
+ Use `mdkg new spec|work|work_order|receipt|feedback|dispute|proposal "<title>"` to scaffold them. `--id <portable-id>` is available for these types when semantic ids such as `agent.image-worker` or `work.generate-image` are preferred.
235
+
236
+ Relational templates contain editable placeholder refs. `spec` and `work` scaffold as validation-clean standalone docs; `work_order`, `receipt`, `feedback`, `dispute`, and `proposal` need real refs before strict `mdkg validate` passes.
237
+
205
238
  ## Current direction
206
239
 
207
240
  This release includes:
@@ -214,6 +247,7 @@ This release includes:
214
247
  - latest-checkpoint resolver + index hint
215
248
  - events JSONL validation
216
249
  - XML / TOON / Markdown output for node and skill list/search/show
250
+ - agent workflow file types and semantic `mdkg new --id` support
217
251
  - product-specific skill mirrors for Codex/OpenAI and Claude
218
252
  - shared `AGENT_START.md` startup guidance
219
253
 
@@ -222,7 +256,6 @@ Current direction:
222
256
  - use `init --agent` for deeper AI-agent bootstrap
223
257
  - keep `pack <id>` at the center of the human/agent loop
224
258
  - use `mdkg task ...` for structured state changes and markdown edits for narrative/body content
225
- - keep validation strict and fix schema drift instead of papering over mdkg-generated inconsistencies
226
259
  - make event logging guided instead of purely manual
227
260
  - dogfood real skills inside the repo
228
261
  - make skill authoring first-class through `mdkg skill`
@@ -245,6 +278,8 @@ Use these defaults:
245
278
 
246
279
  ## Contributing
247
280
 
281
+ Start with [`CONTRIBUTING.md`](CONTRIBUTING.md). mdkg prefers Prompt Requests before Pull Requests: contributors can submit intent, workflows, prompts, and acceptance criteria without needing to write code first.
282
+
248
283
  This repo dogfoods mdkg itself. The behavior source of truth is the combination of:
249
284
  - source under `src/`
250
285
  - tests under `tests/`