mdkg 0.0.2 → 0.0.4
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/README.md +171 -151
- package/dist/cli.js +920 -422
- package/dist/commands/checkpoint.js +17 -6
- package/dist/commands/doctor.js +156 -0
- package/dist/commands/event.js +46 -0
- package/dist/commands/event_support.js +146 -0
- package/dist/commands/format.js +6 -7
- package/dist/commands/index.js +10 -4
- package/dist/commands/init.js +202 -11
- package/dist/commands/list.js +18 -1
- package/dist/commands/new.js +30 -5
- package/dist/commands/pack.js +332 -10
- package/dist/commands/query_output.js +84 -0
- package/dist/commands/search.js +22 -5
- package/dist/commands/show.js +26 -11
- package/dist/commands/skill.js +359 -0
- package/dist/commands/skill_support.js +121 -0
- package/dist/commands/task.js +270 -0
- package/dist/commands/validate.js +104 -7
- package/dist/graph/edges.js +2 -2
- package/dist/graph/frontmatter.js +1 -0
- package/dist/graph/indexer.js +21 -0
- package/dist/graph/node.js +20 -4
- package/dist/graph/skills_index_cache.js +94 -0
- package/dist/graph/skills_indexer.js +160 -0
- package/dist/init/README.md +43 -0
- package/dist/init/core/rule-1-mdkg-conventions.md +9 -2
- package/dist/init/core/rule-3-cli-contract.md +73 -14
- package/dist/init/core/rule-4-repo-safety-and-ignores.md +9 -3
- package/dist/init/core/rule-6-templates-and-schemas.md +6 -2
- package/dist/init/skills/SKILL.md.example +41 -0
- package/dist/init/templates/default/bug.md +1 -0
- package/dist/init/templates/default/chk.md +1 -0
- package/dist/init/templates/default/epic.md +1 -0
- package/dist/init/templates/default/feat.md +1 -0
- package/dist/init/templates/default/task.md +1 -0
- package/dist/init/templates/default/test.md +1 -0
- package/dist/pack/budget.js +186 -0
- package/dist/pack/export_md.js +17 -1
- package/dist/pack/export_xml.js +15 -0
- package/dist/pack/metrics.js +66 -0
- package/dist/pack/pack.js +35 -0
- package/dist/pack/profile.js +222 -0
- package/dist/pack/stats.js +37 -0
- package/dist/templates/headings.js +34 -0
- package/dist/util/argparse.js +47 -1
- package/dist/util/filter.js +18 -0
- package/dist/util/id.js +23 -0
- package/dist/util/output.js +2 -2
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -1,224 +1,244 @@
|
|
|
1
|
-
# mdkg
|
|
1
|
+
# mdkg
|
|
2
2
|
|
|
3
|
-
mdkg is a
|
|
3
|
+
mdkg is a local-first CLI for turning structured Markdown into deterministic project memory.
|
|
4
4
|
|
|
5
|
-
It
|
|
6
|
-
-
|
|
7
|
-
- AI
|
|
5
|
+
It is built for:
|
|
6
|
+
- human builders who want project truth and task state in git
|
|
7
|
+
- AI agents that need deterministic context instead of ad-hoc file reading
|
|
8
|
+
- human + agent pairs who want one shared source of truth
|
|
8
9
|
|
|
9
|
-
mdkg
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
- works with npm / pnpm / bun
|
|
10
|
+
mdkg stays deliberately boring:
|
|
11
|
+
- repo-native under `.mdkg/`
|
|
12
|
+
- TypeScript + Node.js 18+
|
|
13
|
+
- zero runtime dependencies
|
|
14
|
+
- no sqlite, daemon, hosted index, or vector DB
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Current package version in this repo: `0.0.4`
|
|
17
|
+
Publish status: cut prepared, not yet published
|
|
17
18
|
|
|
18
|
-
##
|
|
19
|
+
## The product shape
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
mdkg has one core job: make repo knowledge cheap to retrieve and safe to reuse.
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
The primary loop is:
|
|
24
|
+
1. initialize the repo
|
|
25
|
+
2. create or select work
|
|
26
|
+
3. inspect the current truth
|
|
27
|
+
4. build a deterministic pack
|
|
28
|
+
5. validate before closing the loop
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## Repository structure
|
|
31
|
-
|
|
32
|
-
mdkg lives in a hidden directory at the repo root:
|
|
33
|
-
|
|
34
|
-
- `.mdkg/core/` — rules + “pinned” docs
|
|
35
|
-
- `.mdkg/design/` — decisions + architecture
|
|
36
|
-
- `.mdkg/work/` — epics/tasks/bugs/tests/checkpoints
|
|
37
|
-
- `.mdkg/templates/` — document templates used by `mdkg new`
|
|
38
|
-
- `.mdkg/index/` — generated cache (gitignored)
|
|
39
|
-
|
|
40
|
-
mdkg is root-only: you run commands from the repository root and mdkg indexes all registered workspaces without “discovering” nested repos.
|
|
41
|
-
|
|
42
|
-
---
|
|
30
|
+
If an agent is involved, the default handoff primitive is `mdkg pack <id>`.
|
|
31
|
+
If a repo needs repeatable procedures, author them as first-class skills under `.mdkg/skills/`.
|
|
43
32
|
|
|
44
33
|
## Install
|
|
45
34
|
|
|
46
|
-
Pre-release note: this project is being actively developed and dogfooded.
|
|
47
|
-
|
|
48
35
|
Once published:
|
|
49
|
-
- `npm i -g mdkg`
|
|
50
|
-
- `pnpm add -g mdkg`
|
|
51
|
-
- `bun add -g mdkg`
|
|
52
36
|
|
|
53
|
-
|
|
37
|
+
```bash
|
|
38
|
+
npm i -g mdkg
|
|
39
|
+
# or
|
|
40
|
+
pnpm add -g mdkg
|
|
41
|
+
# or
|
|
42
|
+
bun add -g mdkg
|
|
43
|
+
```
|
|
54
44
|
|
|
55
45
|
## Quickstart
|
|
56
46
|
|
|
57
|
-
|
|
47
|
+
Initialize mdkg in a repo:
|
|
58
48
|
|
|
59
49
|
```bash
|
|
60
|
-
mdkg init
|
|
50
|
+
mdkg init --llm
|
|
61
51
|
```
|
|
62
52
|
|
|
63
|
-
This creates `.mdkg/`
|
|
53
|
+
This is the generic OSS bootstrap path. It creates `.mdkg/` and updates `.gitignore` / `.npmignore` by default. Use `--no-update-ignores` to opt out.
|
|
64
54
|
|
|
65
|
-
|
|
55
|
+
Optional agent-ready scaffold:
|
|
66
56
|
|
|
67
57
|
```bash
|
|
68
|
-
mdkg
|
|
58
|
+
mdkg init --omni
|
|
69
59
|
```
|
|
70
60
|
|
|
71
|
-
|
|
61
|
+
This adds strict-node `SOUL.md` / `HUMAN.md`, a skills scaffold, seeded events JSONL, and core pin updates.
|
|
62
|
+
|
|
63
|
+
Create a task:
|
|
72
64
|
|
|
73
65
|
```bash
|
|
74
66
|
mdkg new task "bootstrap cli" --status todo --priority 1 --tags cli,build
|
|
75
67
|
```
|
|
76
68
|
|
|
77
|
-
|
|
69
|
+
Inspect the current truth:
|
|
78
70
|
|
|
79
71
|
```bash
|
|
80
72
|
mdkg search "pack"
|
|
81
|
-
mdkg list --type task --status todo
|
|
82
73
|
mdkg show task-1
|
|
74
|
+
mdkg next
|
|
83
75
|
```
|
|
84
76
|
|
|
85
|
-
|
|
77
|
+
Build deterministic context:
|
|
86
78
|
|
|
87
79
|
```bash
|
|
88
|
-
mdkg pack task-1
|
|
80
|
+
mdkg pack task-1
|
|
81
|
+
mdkg pack task-1 --profile concise --dry-run --stats
|
|
89
82
|
```
|
|
90
83
|
|
|
91
|
-
|
|
84
|
+
Validate before handoff or commit:
|
|
92
85
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
mdkg makes that context:
|
|
98
|
-
- easy to author
|
|
99
|
-
- easy to query
|
|
100
|
-
- easy to hand to an agent
|
|
101
|
-
- reproducible across runs and contributors
|
|
102
|
-
|
|
103
|
-
This is also intended to be a compatible building block for “life git”-style productivity systems (which may later add richer databases like SQLite/Postgres). mdkg stays minimal and local.
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
## Concepts
|
|
86
|
+
```bash
|
|
87
|
+
mdkg validate
|
|
88
|
+
```
|
|
108
89
|
|
|
109
|
-
|
|
90
|
+
Mutate a task-like node without manual markdown editing:
|
|
110
91
|
|
|
111
|
-
|
|
92
|
+
```bash
|
|
93
|
+
mdkg task start task-1 --run-id run_local_1
|
|
94
|
+
mdkg task update task-1 --add-artifacts tests://unit.txt --add-tags release
|
|
95
|
+
mdkg task done task-1 --checkpoint "release readiness milestone"
|
|
96
|
+
```
|
|
112
97
|
|
|
113
|
-
|
|
114
|
-
- `id` (unique per workspace; global uniqueness via qualified IDs)
|
|
115
|
-
- `type` (rule, prd, edd, dec, prop, epic, feat, task, bug, checkpoint, test)
|
|
116
|
-
- `title`
|
|
117
|
-
- `created` / `updated` (`YYYY-MM-DD`)
|
|
98
|
+
Enable and append baseline event memory:
|
|
118
99
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
100
|
+
```bash
|
|
101
|
+
mdkg event enable
|
|
102
|
+
mdkg event append --kind RUN_COMPLETED --status ok --refs task-1 --notes "manual closeout"
|
|
103
|
+
```
|
|
122
104
|
|
|
123
|
-
|
|
105
|
+
Create a first-class skill:
|
|
124
106
|
|
|
125
|
-
|
|
126
|
-
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
107
|
+
```bash
|
|
108
|
+
mdkg skill new release-readiness "release readiness audit" --description "use when preparing a release"
|
|
109
|
+
mdkg skill list
|
|
110
|
+
mdkg skill show release-readiness
|
|
111
|
+
mdkg skill validate release-readiness
|
|
112
|
+
```
|
|
130
113
|
|
|
131
|
-
|
|
114
|
+
## LLM-readable onboarding artifacts
|
|
132
115
|
|
|
133
|
-
|
|
134
|
-
- `
|
|
135
|
-
- `
|
|
136
|
-
- `
|
|
137
|
-
- `
|
|
116
|
+
The root docs below are the canonical fast-start set for humans and agents:
|
|
117
|
+
- [`llms.txt`](/Users/nicholasreames/Git/mdkg/llms.txt)
|
|
118
|
+
- [`AGENT_PROMPT_SNIPPET.md`](/Users/nicholasreames/Git/mdkg/AGENT_PROMPT_SNIPPET.md)
|
|
119
|
+
- [`PACK_EXAMPLES.md`](/Users/nicholasreames/Git/mdkg/PACK_EXAMPLES.md)
|
|
120
|
+
- [`MANUAL_BEHAVIOR_AUDIT.md`](/Users/nicholasreames/Git/mdkg/MANUAL_BEHAVIOR_AUDIT.md)
|
|
121
|
+
- [`CLI_COMMAND_MATRIX.md`](/Users/nicholasreames/Git/mdkg/CLI_COMMAND_MATRIX.md)
|
|
122
|
+
- [`COVERAGE_HARDENING_MATRIX.md`](/Users/nicholasreames/Git/mdkg/COVERAGE_HARDENING_MATRIX.md)
|
|
138
123
|
|
|
139
|
-
|
|
124
|
+
## Repository shape
|
|
140
125
|
|
|
141
|
-
|
|
126
|
+
mdkg lives under a hidden root directory:
|
|
127
|
+
- `.mdkg/core/` rules and pinned docs
|
|
128
|
+
- `.mdkg/design/` product, design, and decision docs
|
|
129
|
+
- `.mdkg/work/` tasks, bugs, tests, epics, checkpoints
|
|
130
|
+
- `.mdkg/templates/` templates used by `mdkg new`
|
|
131
|
+
- `.mdkg/skills/` Agent Skills packages
|
|
132
|
+
- `.mdkg/index/` generated cache files
|
|
142
133
|
|
|
143
|
-
|
|
134
|
+
## Primary commands
|
|
144
135
|
|
|
136
|
+
These are the commands new users and agents should learn first:
|
|
145
137
|
- `mdkg init`
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
138
|
+
- `mdkg new`
|
|
139
|
+
- `mdkg search`
|
|
140
|
+
- `mdkg show`
|
|
141
|
+
- `mdkg next`
|
|
142
|
+
- `mdkg pack`
|
|
143
|
+
- `mdkg skill`
|
|
144
|
+
- `mdkg task`
|
|
145
|
+
- `mdkg validate`
|
|
150
146
|
|
|
147
|
+
Advanced / maintenance commands still exist, but they are not the first-run story:
|
|
148
|
+
- `mdkg event`
|
|
149
|
+
- `mdkg checkpoint`
|
|
151
150
|
- `mdkg index`
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
- `mdkg show <id-or-qid>`
|
|
158
|
-
- `mdkg list [--type <type>] [--status <status>] [--ws <alias>] [--epic <id>] [--priority <n>]`
|
|
159
|
-
- `mdkg search "<query>"`
|
|
160
|
-
|
|
161
|
-
### Packs (agent context)
|
|
151
|
+
- `mdkg guide`
|
|
152
|
+
- `mdkg format`
|
|
153
|
+
- `mdkg doctor`
|
|
154
|
+
- `mdkg workspace`
|
|
162
155
|
|
|
163
|
-
|
|
156
|
+
## Skills
|
|
164
157
|
|
|
165
|
-
|
|
166
|
-
If `--out` is omitted, packs are written to `.mdkg/pack/pack_<kind>_<id>_<timestamp>.<ext>`.
|
|
158
|
+
mdkg supports Agent Skills as procedural memory.
|
|
167
159
|
|
|
168
|
-
|
|
160
|
+
Canonical layout:
|
|
169
161
|
|
|
170
|
-
```
|
|
171
|
-
mdkg
|
|
172
|
-
mdkg index
|
|
173
|
-
mdkg new task "..." --status todo --priority 1
|
|
174
|
-
mdkg list --status todo
|
|
175
|
-
mdkg pack <id> --verbose
|
|
176
|
-
mdkg validate
|
|
162
|
+
```text
|
|
163
|
+
.mdkg/skills/<slug>/SKILL.md
|
|
177
164
|
```
|
|
178
165
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
-
|
|
182
|
-
-
|
|
183
|
-
|
|
184
|
-
- `mdkg
|
|
185
|
-
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
- `mdkg
|
|
190
|
-
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
- `
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
166
|
+
Current source behavior:
|
|
167
|
+
- skills are indexed into `.mdkg/index/skills.json`
|
|
168
|
+
- skills have a focused command family:
|
|
169
|
+
- `mdkg skill new <slug> "<name>" --description "..."`
|
|
170
|
+
- `mdkg skill list`
|
|
171
|
+
- `mdkg skill search "<query>"`
|
|
172
|
+
- `mdkg skill show <slug>`
|
|
173
|
+
- `mdkg skill validate [<slug>]`
|
|
174
|
+
- machine-readable skill discovery is available through:
|
|
175
|
+
- `mdkg skill list --json`
|
|
176
|
+
- `mdkg skill search "<query>" --json`
|
|
177
|
+
- `mdkg skill show <slug> --json`
|
|
178
|
+
- work items may reference `skills: [slug,...]`
|
|
179
|
+
- packs may include skills with `--skills` and `--skills-depth`
|
|
180
|
+
- mdkg indexes and discovers skills but does not execute skill scripts
|
|
181
|
+
- `SKILL.md` is canonical
|
|
182
|
+
- `SKILLS.md` is tolerated on read for compatibility, but validation warns and canonical docs still use `SKILL.md`
|
|
183
|
+
- if both `SKILL.md` and `SKILLS.md` exist in one skill folder, validation fails
|
|
184
|
+
- `mdkg skill new` scaffolds `SKILL.md`, `references/`, `assets/`, and `scripts/` only when requested with `--with-scripts`
|
|
185
|
+
|
|
186
|
+
This repo now dogfoods three internal skills:
|
|
187
|
+
- `author-mdkg-skill`
|
|
188
|
+
- `select-work-and-ground-context`
|
|
189
|
+
- `build-pack-and-execute-task`
|
|
190
|
+
- `verify-close-and-checkpoint`
|
|
191
|
+
|
|
192
|
+
## Current direction
|
|
193
|
+
|
|
194
|
+
Current `0.0.4` release polish already includes:
|
|
195
|
+
- `init --omni`
|
|
196
|
+
- default ignore updates with `--no-update-ignores`
|
|
197
|
+
- skills indexing and search/show/list support
|
|
198
|
+
- optional `skills: [...]` on work items
|
|
199
|
+
- pack-time skill inclusion
|
|
200
|
+
- latest-checkpoint resolver + index hint
|
|
201
|
+
- events JSONL validation
|
|
202
|
+
|
|
203
|
+
Current `0.0.4` polish direction is:
|
|
204
|
+
- keep the OSS story generic around `init --llm`
|
|
205
|
+
- keep `pack <id>` at the center of the human/agent loop
|
|
206
|
+
- make task mutation and event logging guided instead of purely manual
|
|
207
|
+
- dogfood real skills inside the repo
|
|
208
|
+
- make skill authoring first-class through `mdkg skill`
|
|
209
|
+
- make `CLI_COMMAND_MATRIX.md` the single source of truth for the live CLI surface
|
|
210
|
+
- run manual behavior audits before enforcing stronger coverage thresholds
|
|
211
|
+
|
|
212
|
+
Design and decision records live in the internal graph under `.mdkg/design/`.
|
|
198
213
|
|
|
199
214
|
## Safety
|
|
200
215
|
|
|
201
|
-
mdkg is
|
|
202
|
-
- cache files live under `.mdkg/index/` and must be gitignored
|
|
203
|
-
- publishing should use a strict `package.json.files` whitelist
|
|
204
|
-
- `.mdkg/` content should never ship to production builds
|
|
216
|
+
mdkg is not a secret store.
|
|
205
217
|
|
|
206
|
-
|
|
218
|
+
Use these defaults:
|
|
219
|
+
- keep `.mdkg/index/` gitignored
|
|
220
|
+
- keep `.mdkg/pack/` gitignored
|
|
221
|
+
- keep `.mdkg/work/events/*.jsonl` gitignored unless you deliberately opt in
|
|
222
|
+
- do not ship `.mdkg/` into production builds or published packages
|
|
223
|
+
- if an external orchestrator is writing mdkg state, keep one durable writer per run and batch commits at end-of-run or checkpoint boundaries
|
|
224
|
+
- do not commit on every tool call
|
|
207
225
|
|
|
208
226
|
## Contributing
|
|
209
227
|
|
|
210
|
-
This repo dogfoods mdkg. The source of truth
|
|
211
|
-
-
|
|
212
|
-
-
|
|
213
|
-
- `.mdkg
|
|
214
|
-
|
|
215
|
-
Suggested workflow:
|
|
216
|
-
1) create or update a task in `.mdkg/work/`
|
|
217
|
-
2) run `mdkg validate`
|
|
218
|
-
3) generate a pack for the task and use it as agent context
|
|
228
|
+
This repo dogfoods mdkg itself. The behavior source of truth is the combination of:
|
|
229
|
+
- source under `src/`
|
|
230
|
+
- tests under `tests/`
|
|
231
|
+
- internal rules and design docs under `.mdkg/`
|
|
219
232
|
|
|
220
|
-
|
|
233
|
+
Suggested local loop:
|
|
234
|
+
1. create or select a work item
|
|
235
|
+
2. inspect truth with `search`, `show`, or `next`
|
|
236
|
+
3. build context with `pack <id>`
|
|
237
|
+
4. mutate task state with `mdkg task ...` when durable state changes
|
|
238
|
+
5. enable event logging if provenance should be captured in JSONL
|
|
239
|
+
6. implement and test
|
|
240
|
+
7. run `mdkg validate`
|
|
221
241
|
|
|
222
242
|
## License
|
|
223
243
|
|
|
224
|
-
MIT
|
|
244
|
+
MIT
|