mdkg 0.0.3 → 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 -169
- package/dist/cli.js +980 -624
- package/dist/commands/checkpoint.js +17 -6
- 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 +198 -16
- package/dist/commands/list.js +18 -1
- package/dist/commands/new.js +30 -5
- package/dist/commands/pack.js +194 -2
- 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/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/export_md.js +6 -0
- package/dist/pack/export_xml.js +6 -0
- package/dist/pack/pack.js +35 -0
- package/dist/util/argparse.js +25 -0
- package/dist/util/filter.js +18 -0
- package/dist/util/id.js +23 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -1,242 +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 --llm
|
|
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
|
|
89
|
-
mdkg pack task-1 --
|
|
80
|
+
mdkg pack task-1
|
|
81
|
+
mdkg pack task-1 --profile concise --dry-run --stats
|
|
90
82
|
```
|
|
91
83
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
## Why this exists
|
|
84
|
+
Validate before handoff or commit:
|
|
95
85
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
- easy to author
|
|
100
|
-
- easy to query
|
|
101
|
-
- easy to hand to an agent
|
|
102
|
-
- reproducible across runs and contributors
|
|
103
|
-
|
|
104
|
-
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.
|
|
105
|
-
|
|
106
|
-
---
|
|
107
|
-
|
|
108
|
-
## Concepts
|
|
86
|
+
```bash
|
|
87
|
+
mdkg validate
|
|
88
|
+
```
|
|
109
89
|
|
|
110
|
-
|
|
90
|
+
Mutate a task-like node without manual markdown editing:
|
|
111
91
|
|
|
112
|
-
|
|
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
|
+
```
|
|
113
97
|
|
|
114
|
-
|
|
115
|
-
- `id` (unique per workspace; global uniqueness via qualified IDs)
|
|
116
|
-
- `type` (rule, prd, edd, dec, prop, epic, feat, task, bug, checkpoint, test)
|
|
117
|
-
- `title`
|
|
118
|
-
- `created` / `updated` (`YYYY-MM-DD`)
|
|
98
|
+
Enable and append baseline event memory:
|
|
119
99
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
100
|
+
```bash
|
|
101
|
+
mdkg event enable
|
|
102
|
+
mdkg event append --kind RUN_COMPLETED --status ok --refs task-1 --notes "manual closeout"
|
|
103
|
+
```
|
|
123
104
|
|
|
124
|
-
|
|
105
|
+
Create a first-class skill:
|
|
125
106
|
|
|
126
|
-
|
|
127
|
-
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
+
```
|
|
131
113
|
|
|
132
|
-
|
|
114
|
+
## LLM-readable onboarding artifacts
|
|
133
115
|
|
|
134
|
-
|
|
135
|
-
- `
|
|
136
|
-
- `
|
|
137
|
-
- `
|
|
138
|
-
- `
|
|
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)
|
|
139
123
|
|
|
140
|
-
|
|
124
|
+
## Repository shape
|
|
141
125
|
|
|
142
|
-
|
|
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
|
|
143
133
|
|
|
144
|
-
|
|
134
|
+
## Primary commands
|
|
145
135
|
|
|
136
|
+
These are the commands new users and agents should learn first:
|
|
146
137
|
- `mdkg init`
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
138
|
+
- `mdkg new`
|
|
139
|
+
- `mdkg search`
|
|
140
|
+
- `mdkg show`
|
|
141
|
+
- `mdkg next`
|
|
142
|
+
- `mdkg pack`
|
|
143
|
+
- `mdkg skill`
|
|
144
|
+
- `mdkg task`
|
|
145
|
+
- `mdkg validate`
|
|
151
146
|
|
|
147
|
+
Advanced / maintenance commands still exist, but they are not the first-run story:
|
|
148
|
+
- `mdkg event`
|
|
149
|
+
- `mdkg checkpoint`
|
|
152
150
|
- `mdkg index`
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
### Query
|
|
157
|
-
|
|
158
|
-
- `mdkg show <id-or-qid>`
|
|
159
|
-
- `mdkg list [--type <type>] [--status <status>] [--ws <alias>] [--epic <id>] [--priority <n>]`
|
|
160
|
-
- `mdkg search "<query>"`
|
|
161
|
-
|
|
162
|
-
### Packs (agent context)
|
|
163
|
-
|
|
164
|
-
- `mdkg pack <id> [--format md|json|toon|xml] [--verbose] [--depth <n>] [--edges <keys>]`
|
|
165
|
-
- `mdkg pack <id> [--pack-profile standard|concise|headers] [--max-chars <n>] [--max-lines <n>] [--max-tokens <n>]`
|
|
166
|
-
- `mdkg pack <id> [--stats] [--stats-out <path>] [--truncation-report <path>]`
|
|
167
|
-
- `mdkg pack <id> [--dry-run]`
|
|
168
|
-
- `mdkg pack --list-profiles`
|
|
169
|
-
|
|
170
|
-
`--verbose` includes pinned core docs listed in `.mdkg/core/core.md`.
|
|
171
|
-
`--pack-profile concise` uses summary-oriented body shaping and strips code blocks by default.
|
|
172
|
-
If `--out` is omitted, packs are written to `.mdkg/pack/pack_<kind>_<id>_<timestamp>.<ext>`.
|
|
173
|
-
|
|
174
|
-
`--max-tokens` uses a heuristic estimate: `~tokens = chars / 4`.
|
|
175
|
-
|
|
176
|
-
### Quickstart (CLI only)
|
|
177
|
-
|
|
178
|
-
```bash
|
|
179
|
-
mdkg init --llm
|
|
180
|
-
mdkg index
|
|
181
|
-
mdkg new task "..." --status todo --priority 1
|
|
182
|
-
mdkg list --status todo
|
|
183
|
-
mdkg pack <id> --verbose
|
|
184
|
-
mdkg pack <id> --pack-profile concise --dry-run --stats
|
|
185
|
-
mdkg validate
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### Workflow helpers
|
|
189
|
-
|
|
190
|
-
- `mdkg next [<id>] [--ws <alias>]`
|
|
191
|
-
- follows `next` chain if present; otherwise picks highest priority work item
|
|
192
|
-
|
|
193
|
-
- `mdkg checkpoint new "<title>"`
|
|
194
|
-
- creates a checkpoint node (a compression summary)
|
|
195
|
-
|
|
151
|
+
- `mdkg guide`
|
|
152
|
+
- `mdkg format`
|
|
196
153
|
- `mdkg doctor`
|
|
197
|
-
|
|
198
|
-
- `mdkg doctor --json`
|
|
199
|
-
- emits machine-readable diagnostics for scripts/CI
|
|
154
|
+
- `mdkg workspace`
|
|
200
155
|
|
|
201
|
-
|
|
202
|
-
- prints installed CLI version
|
|
156
|
+
## Skills
|
|
203
157
|
|
|
204
|
-
|
|
158
|
+
mdkg supports Agent Skills as procedural memory.
|
|
205
159
|
|
|
206
|
-
|
|
207
|
-
- strict frontmatter validation
|
|
208
|
-
- missing required fields, invalid enums, dangling edges, cycles, duplicates
|
|
209
|
-
- supports `--out <path>` and `--quiet` for CI workflows
|
|
160
|
+
Canonical layout:
|
|
210
161
|
|
|
211
|
-
|
|
212
|
-
|
|
162
|
+
```text
|
|
163
|
+
.mdkg/skills/<slug>/SKILL.md
|
|
164
|
+
```
|
|
213
165
|
|
|
214
|
-
|
|
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/`.
|
|
215
213
|
|
|
216
214
|
## Safety
|
|
217
215
|
|
|
218
|
-
mdkg is
|
|
219
|
-
- cache files live under `.mdkg/index/` and must be gitignored
|
|
220
|
-
- publishing should use a strict `package.json.files` whitelist
|
|
221
|
-
- `.mdkg/` content should never ship to production builds
|
|
216
|
+
mdkg is not a secret store.
|
|
222
217
|
|
|
223
|
-
|
|
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
|
|
224
225
|
|
|
225
226
|
## Contributing
|
|
226
227
|
|
|
227
|
-
This repo dogfoods mdkg. The source of truth
|
|
228
|
-
-
|
|
229
|
-
-
|
|
230
|
-
- `.mdkg
|
|
231
|
-
|
|
232
|
-
Suggested workflow:
|
|
233
|
-
1) create or update a task in `.mdkg/work/`
|
|
234
|
-
2) run `mdkg validate`
|
|
235
|
-
3) generate a pack for the task and use it as agent context
|
|
236
|
-
4) run `npm run smoke:consumer` before publishing to verify tarball install + onboarding flow
|
|
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/`
|
|
237
232
|
|
|
238
|
-
|
|
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`
|
|
239
241
|
|
|
240
242
|
## License
|
|
241
243
|
|
|
242
|
-
MIT
|
|
244
|
+
MIT
|