@thedecipherist/mdd 1.5.1 → 1.5.2

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Triggered when arguments start with `import-spec`.
4
4
 
5
- Reads one or more large spec or prompt documents — the kind produced by extended brainstorming sessions with Claude — and converts them into properly structured MDD feature docs. Every decision in the spec is preserved. Duplicate or overlapping topics are merged intelligently. Path grouping determines whether to create initiative/waves or flat docs.
5
+ Reads one or more large spec or prompt documents — the kind produced by extended brainstorming sessions with Claude — and converts them into properly structured MDD initiatives, waves, and feature docs. Every decision in the spec is preserved. Duplicate or overlapping topics are merged intelligently. Features are numbered and waved in **build dependency order**, not spec-reading order.
6
6
 
7
7
  ---
8
8
 
@@ -39,26 +39,29 @@ Reading <filename> (<N> lines)...
39
39
  Full file read. Proceeding to feature extraction.
40
40
  ```
41
41
 
42
- If multiple files are provided, merge all content into a single working document after all files are fully read. Tag each section internally with its source filename (e.g. `<!-- source: rawpg-prompt-driver.md -->`) for traceability — these tags are used in the merge summary and content mapping display but are never written to output docs.
42
+ If multiple files are provided, merge all content into a single working document after all files are fully read. Tag each section internally with its source filename (e.g. `<!-- source: spec.md -->`) for traceability — these tags are used in the merge summary and content mapping display but are never written to output docs.
43
43
 
44
44
  ---
45
45
 
46
- ### Phase IS2 — Feature Extraction + Path Grouping
46
+ ### Phase IS2 — Feature Extraction, Classification + Path Grouping
47
47
 
48
- This phase runs in two steps. Path grouping always runs before complexity determination because the number of distinct top-level path areas is the primary signal for initiative-scale scope.
48
+ This phase runs in four steps. Build-order classification (IS2c) always precedes structure determination (IS2d) because the correct numbering depends on understanding what you build vs. what you reference.
49
49
 
50
50
  #### Step IS2a — Extract features
51
51
 
52
- Read the entire merged spec. Identify every distinct feature, system, subsystem, or bounded capability described. A "feature" is any topic that could become a standalone MDD doc — something with a purpose, decisions, constraints, and a clear scope.
52
+ Read the entire merged working document. Identify every distinct feature, system, subsystem, or bounded capability described. A "feature" is any topic that could become a standalone MDD doc — something with a purpose, decisions, constraints, and a clear scope.
53
53
 
54
- For each identified feature:
54
+ For each identified feature, capture:
55
55
  - Name / title
56
- - Core purpose (1–2 sentences distilled from the spec)
57
- - All key decisions, constraints, business rules, and edge cases mentioned in the spec
56
+ - Core purpose full description, as detailed as needed. Do NOT artificially limit this to a sentence count. Capture everything the spec says about what this feature is and does.
57
+ - All key decisions, constraints, business rules, edge cases, and design rationale mentioned anywhere in the spec for this feature
58
+ - AST types, data structures, config schemas, error formats, and TypeScript interfaces if described
58
59
  - Dependencies on other features identified in the same spec
59
60
 
60
61
  Track which spec sections contribute to each feature. When multiple spec sections cover the same concept (same feature re-discussed with refinements), **merge them** — do not create duplicate docs. When versions of the same decision conflict, keep the most specific or most recent version and note the discarded variant.
61
62
 
63
+ **Changelog and review-pass sections** (sections titled "v1.0 Review", "Changelog", "Decision Log", or similar retrospective formats) are not features — they are design decision records. For each decision in such a section, identify which feature it belongs to and add it to that feature's content. Do not create a standalone "Changelog" feature doc.
64
+
62
65
  #### Step IS2b — Assign paths
63
66
 
64
67
  Read all existing `.mdd/docs/*.md` `path` fields (if any exist) to learn the project's established vocabulary and casing conventions.
@@ -68,7 +71,47 @@ For each identified feature, determine its `path` value:
68
71
  - Title Case, 1–3 levels, `/`-separated
69
72
  - Siblings must use identical parent spelling (if `Auth/Login` exists, new auth docs use `Auth`, not `Authentication`)
70
73
 
71
- #### Step IS2c — Determine output structure
74
+ #### Step IS2c — Build-order classification
75
+
76
+ This is the most important step. Features are numbered in the order a developer would actually build them — not the order they appear in the spec.
77
+
78
+ **Classify every feature as one of two types:**
79
+
80
+ **COMPONENT** — Something that results in code: a module, class, package, service, server, or runtime. The thing you sit down and write. Examples: Parser, Template Engine, Renderer, MCP Server, CLI.
81
+
82
+ **SPEC** — Something that describes behaviour a COMPONENT must implement: a directive definition, an API contract, a security rule, a caching rule, a language feature. You consult a SPEC doc while building the COMPONENT that implements it. Examples: `@include` directive spec, Security Config spec, Cache Modes spec.
83
+
84
+ **Order COMPONENT features by build dependency:**
85
+
86
+ Start from the foundation (the component everything else depends on) and work outward. Ask: "What must exist before I can build this?" The component with no dependencies comes first. The component that depends on everything comes last.
87
+
88
+ Example for a language toolchain:
89
+ ```
90
+ Parser — foundation, no deps, must exist first
91
+ Stripper — depends on Parser AST
92
+ Renderer — depends on Parser AST, no connection deps
93
+ Template Engine — depends on Parser + Renderer
94
+ MCP Server — depends on Template Engine
95
+ Hook — depends on MCP Server
96
+ CLI — depends on all of the above
97
+ ```
98
+
99
+ **Assign SPEC features to waves:** A SPEC feature belongs in the wave of the COMPONENT that implements it. The SPEC doc gets created alongside its implementing COMPONENT's wave so that both exist when building begins. The COMPONENT doc lists SPEC docs in its `depends_on`.
100
+
101
+ **Determine wave breakdown:** Group COMPONENTs (and their associated SPECs) into waves by build phase. Each wave should have a clear demo-state — a thing you can actually demonstrate when the wave is done.
102
+
103
+ Example wave structure for a language toolchain:
104
+ ```
105
+ Wave 1 — Foundation: Parser + all language directive SPECs
106
+ Wave 2 — Static Output: Stripper + Renderer
107
+ Wave 3 — Engine: Template Engine + Caching SPECs
108
+ Wave 4 — Live Data: MCP Server + Hook + Security SPECs
109
+ Wave 5 — CLI: CLI + Distribution
110
+ ```
111
+
112
+ **If no COMPONENT/SPEC distinction applies** (e.g. a feature-extension spec for an existing product), order features by: user-facing value first, infrastructure last. Earlier features should be shippable without later features.
113
+
114
+ #### Step IS2d — Determine output structure
72
115
 
73
116
  Count distinct root-level path segments (top-level areas):
74
117
 
@@ -78,7 +121,64 @@ Count distinct root-level path segments (top-level areas):
78
121
  | 1–2 root areas AND 4–7 features | Waves + Feature docs (no initiative wrapper) |
79
122
  | Any root area count AND 1–3 features | Flat feature docs only |
80
123
 
81
- These thresholds are guidelines — apply judgment. A 3-feature spec spanning radically different domains can still warrant waves.
124
+ These thresholds are guidelines — apply judgment.
125
+
126
+ ---
127
+
128
+ ### Phase IS2.5 — CLAUDE.md Check
129
+
130
+ Before showing the dry-run preview, check the project's CLAUDE.md.
131
+
132
+ Run: `[ -f CLAUDE.md ] && wc -l CLAUDE.md || echo "missing"`
133
+
134
+ **If CLAUDE.md is missing or under 10 lines:**
135
+
136
+ Ask the user via AskUserQuestion:
137
+
138
+ > "This looks like a new project. Want me to create a CLAUDE.md with a description of what `<product name>` is, its architecture, and how the MDD docs map to the codebase? This gives Claude the context it needs to build from the docs correctly."
139
+
140
+ Options:
141
+ - **"Yes, create CLAUDE.md"** — proceed to draft it from the spec, include in IS4 write step
142
+ - **"No, skip"** — continue without creating CLAUDE.md
143
+
144
+ **If CLAUDE.md already exists and is substantial:** skip this check entirely.
145
+
146
+ **CLAUDE.md content to draft (if approved):**
147
+
148
+ Derive from the spec:
149
+
150
+ ```markdown
151
+ # CLAUDE.md
152
+
153
+ ## What This Project Is
154
+
155
+ <Product name> — <one paragraph elevator pitch. What does it do, who is it for, what problem does it solve. Write this in plain terms, not marketing language.>
156
+
157
+ ## Core Philosophy
158
+
159
+ <The fundamental design principles that drive all decisions. Extract from the spec's philosophy/principles sections. These are the "why" behind architecture choices.>
160
+
161
+ ## Architecture Overview
162
+
163
+ <The major components and how they relate. For a toolchain: list each component, one line description, what it depends on. For an API: list major subsystems. Make it concrete.>
164
+
165
+ ## Tech Stack
166
+
167
+ <Language, frameworks, package manager, test runner — derive from spec if stated, leave blank if not.>
168
+
169
+ ## What the MDD Docs Represent
170
+
171
+ This project uses MDD (Manual-Driven Development). The `.mdd/` directory contains:
172
+ - `.mdd/initiatives/` — the top-level initiative(s) defining the full scope
173
+ - `.mdd/waves/` — waves within each initiative, each with a concrete demo-state
174
+ - `.mdd/docs/` — individual feature docs, one per buildable unit or behavioural spec
175
+
176
+ **The docs are numbered in build dependency order.** `/mdd 01` is always the first thing to build. Read the wave file before starting a wave to understand what "done" looks like.
177
+
178
+ ## Key Constraints
179
+
180
+ <Any hard rules derived from the spec: immutable rules, security constraints, "never do X", platform requirements. These are the lines that cannot be crossed.>
181
+ ```
82
182
 
83
183
  ---
84
184
 
@@ -91,16 +191,23 @@ Before writing any files, display the complete proposed structure and wait for e
91
191
 
92
192
  Source: <filename(s)>
93
193
  Features identified: <N> Merged: <N> duplicate/overlapping topics
194
+ CLAUDE.md: <"will be created" | "already exists, skipping" | "skipping (user declined)">
195
+
196
+ Proposed structure: Initiative "<name>" → <N> Waves → <N> Feature docs
94
197
 
95
- Proposed structure: <Flat docs | Waves | Initiative: "<name>" → Waves>
198
+ Initiative: .mdd/initiatives/<slug>.md
96
199
 
97
- Path Tree:
98
- <Root Area 1>
99
- ├── <Section> → <NN>-<slug> (draft)
100
- └── <Section>
101
- └── <Sub-section> <NN>-<slug> (draft)
102
- <Root Area 2>
103
- └── <Section> → <NN>-<slug> (draft)
200
+ Waves (in build order):
201
+ Wave 1 — <name> (.mdd/waves/<slug>-wave-1.md)
202
+ Demo-state: <what you can demonstrate when this wave is done>
203
+ Features:
204
+ <NN> <slug> [COMPONENT] <path>
205
+ <NN> <slug> [SPEC] <path>
206
+ Wave 2 <name> (.mdd/waves/<slug>-wave-2.md)
207
+ Demo-state: <demo-state>
208
+ Features:
209
+ <NN> <slug> [COMPONENT] <path>
210
+ ...
104
211
 
105
212
  IDs assigned: <NN>–<NN> (continuing from existing <prev>)
106
213
 
@@ -112,10 +219,11 @@ Content mapping:
112
219
  <NN>-<slug>: §<Spec Section> + §<Spec Section>
113
220
  <NN>-<slug>: §<Spec Section>
114
221
 
115
- Adjust paths, titles, or grouping? (approve / adjust / abort)
222
+ Is the build order correct? Does each wave's demo-state make sense?
223
+ (approve / adjust / abort)
116
224
  ```
117
225
 
118
- **If the user says "adjust":** accept their description of changes, re-run IS2 with that feedback applied, then show the preview again. Repeat until the user approves.
226
+ **If the user says "adjust":** accept their description of changes — reordering waves, reclassifying features, changing demo-states, renaming — re-run IS2 with that feedback applied, then show the preview again. Repeat until the user approves.
119
227
 
120
228
  **If the user says "abort":** stop. Write nothing.
121
229
 
@@ -125,22 +233,106 @@ Adjust paths, titles, or grouping? (approve / adjust / abort)
125
233
 
126
234
  ### Phase IS4 — Write Files
127
235
 
128
- **If initiative-scale was detected:** Create `.mdd/initiative.md` with:
129
- - `id`, `title`, `status: planning`, `created: <today>`
130
- - A brief initiative description derived from the spec's overall theme
131
- - Wave breakdown: one wave per major root path area or logical phase, each listing its feature doc slugs
236
+ Write in this order: CLAUDE.md (if approved) → initiative waves feature docs.
237
+
238
+ #### CLAUDE.md (if approved in IS2.5)
239
+
240
+ Write the drafted CLAUDE.md to the project root. Report: `✅ CLAUDE.md created`
241
+
242
+ #### Initiative file
243
+
244
+ Create `.mdd/initiatives/<slug>.md`:
245
+
246
+ ```markdown
247
+ ---
248
+ id: <slug>
249
+ title: <Full Initiative Title>
250
+ status: active
251
+ version: 1
252
+ hash:
253
+ created: <today YYYY-MM-DD>
254
+ ---
255
+
256
+ # <Full Initiative Title>
257
+
258
+ ## Overview
259
+
260
+ <Comprehensive description of what this initiative delivers. This should be 3-6 paragraphs:
261
+ - What the product/system is and what it does
262
+ - Why it exists and what problem it solves
263
+ - The core design philosophy and principles that drive all decisions
264
+ - The major components or areas being built
265
+ - What "done" looks like for the full initiative
266
+ Do NOT write "brief" — write enough that a developer reading only this file understands what they are building and why.>
267
+
268
+ ## Open Product Questions
269
+ (none — imported from spec)
270
+
271
+ ## Waves
272
+ | Wave | File | Demo-state | Status |
273
+ |------|------|------------|--------|
274
+ <one row per wave>
275
+ | Wave 1 | waves/<slug>-wave-1.md | <demo-state> | planned |
276
+ | Wave 2 | waves/<slug>-wave-2.md | <demo-state> | planned |
277
+ ```
278
+
279
+ Compute and write the `hash:` field after writing (hash of file content excluding the hash line).
280
+
281
+ #### Wave files
282
+
283
+ For each wave, create `.mdd/waves/<slug>-wave-N.md`:
284
+
285
+ ```markdown
286
+ ---
287
+ id: <slug>-wave-N
288
+ title: "Wave N: <Wave Title>"
289
+ initiative: <initiative-slug>
290
+ initiative_version: 1
291
+ status: planned
292
+ depends_on: <none | slug of previous wave>
293
+ demo_state: "<concrete thing you can demonstrate when this wave is complete>"
294
+ created: <today YYYY-MM-DD>
295
+ hash:
296
+ ---
297
+
298
+ # Wave N: <Wave Title>
299
+
300
+ ## Demo-State
301
+
302
+ <demo-state>
303
+ *(This wave is not complete until this can be manually demonstrated.)*
132
304
 
133
- **For each feature doc in the approved plan:**
305
+ ## Features
306
+
307
+ | # | Feature | Doc | Type | Status | Depends on |
308
+ |---|---------|-----|------|--------|------------|
309
+ | 1 | <slug> | docs/<NN>-<slug>.md | COMPONENT | planned | — |
310
+ | 2 | <slug> | docs/<NN>-<slug>.md | SPEC | planned | <dep or —> |
311
+
312
+ ## Open Research
313
+
314
+ (none — imported from spec)
315
+ ```
316
+
317
+ Compute and write the `hash:` field after writing.
318
+
319
+ #### Feature docs
320
+
321
+ For each feature in the approved plan, in wave order:
134
322
 
135
323
  1. Auto-number continuing from the highest existing doc number in `.mdd/docs/`
136
- 2. Write a complete MDD feature doc at `.mdd/docs/<NN>-<slug>.md` using the canonical frontmatter structure:
324
+ 2. Write `.mdd/docs/<NN>-<slug>.md`:
137
325
 
138
326
  ```markdown
139
327
  ---
140
328
  id: <NN>-<slug>
141
329
  title: <Feature Title>
330
+ type: <COMPONENT | SPEC>
331
+ initiative: <initiative-slug>
332
+ wave: <wave-slug>
333
+ wave_status: planned
142
334
  edition: <project name or "Both">
143
- depends_on: [<IDs of other imported features this one depends on>]
335
+ depends_on: [<IDs of docs this one depends on>]
144
336
  source_files: []
145
337
  routes: []
146
338
  models: []
@@ -159,27 +351,27 @@ known_issues: []
159
351
 
160
352
  ## Purpose
161
353
 
162
- <2–3 sentences from the merged spec content>
354
+ <Full description of what this feature is and does. Include the core design rationale — the "why" behind the decisions. Do not limit this to a sentence count. If the spec says a lot about this feature, capture it all here. A developer reading only this doc should fully understand what they are building.>
163
355
 
164
356
  ## Architecture
165
357
 
166
- <How this feature fits into the system, derived from spec decisions>
358
+ <How this feature fits into the system. For a COMPONENT: describe its responsibilities, inputs, outputs, and what it must never do. For a SPEC: describe the behaviour contract the implementing COMPONENT must satisfy. Include TypeScript interfaces, AST node types, and data structures if the spec defines them.>
167
359
 
168
360
  ## Data Model
169
361
 
170
- <If the spec describes data structures omit section if truly not applicable>
362
+ <Data structures, schemas, config formats described in the spec. Include the exact field names, types, and constraints. Omit section only if the spec truly defines no data structures for this feature.>
171
363
 
172
- ## API Endpoints
364
+ ## API / Interface
173
365
 
174
- <If the spec describes endpoints omit section if truly not applicable>
366
+ <Public interface this feature exposes: function signatures, tool names, command syntax, config keys. Omit if not applicable.>
175
367
 
176
368
  ## Business Rules
177
369
 
178
- <All decisions, constraints, validation rules, edge cases from the spec>
370
+ <Every decision, constraint, validation rule, edge case, error behaviour, and "never do X" described in the spec for this feature. This section should be exhaustive — if it is in the spec, it is here. Use bullet points or numbered lists for clarity.>
179
371
 
180
372
  ## Dependencies
181
373
 
182
- <Other features this one requires, by doc ID>
374
+ <Other feature docs this one requires. List by ID and title. For SPECs, name the COMPONENT that implements this spec.>
183
375
 
184
376
  ## Known Issues
185
377
 
@@ -187,30 +379,35 @@ known_issues: []
187
379
  ```
188
380
 
189
381
  3. Tags: 4–8 domain-concept keywords. NOT file paths or spec section names.
190
- 4. `depends_on`: if feature A was described in the spec as depending on feature B (also imported), use the IDs assigned in this run.
382
+ 4. `depends_on`: populate from the build order analysis. COMPONENT docs list the SPEC docs they implement. SPEC docs list other SPECs they depend on (e.g. the expression system spec is depended on by the filter spec).
191
383
 
192
384
  **Progress report as you write:**
193
385
  ```
194
- Writing docs...
195
- <NN>-<slug>.md (<path>)
196
- <NN>-<slug>.md (<path>)
386
+ Writing files...
387
+ CLAUDE.md
388
+ initiatives/markdownai.md
389
+ ✅ waves/markdownai-wave-1.md (Wave 1 — Foundation)
390
+ ✅ waves/markdownai-wave-2.md (Wave 2 — Static Pipeline)
391
+ ...
392
+ ✅ docs/01-<slug>.md [COMPONENT] <path>
393
+ ✅ docs/02-<slug>.md [SPEC] <path>
197
394
  ...
198
395
  ```
199
396
 
200
397
  ---
201
398
 
202
- ### Phase IS5 — Rebuild .startup.md
399
+ ### Phase IS5 — Rebuild .startup.md + Connections
203
400
 
204
- Trigger the `.mdd/.startup.md` rebuild:
205
- - Rebuild the auto-generated zone (Project Snapshot, Features Documented list with IDs, status, and tags)
401
+ Rebuild `.mdd/.startup.md`:
402
+ - Rebuild the auto-generated zone (Project Snapshot, Features Documented list with IDs, status, and tags; Ops Runbooks)
403
+ - Add initiative and wave summary to the Features section: show initiative title, each wave with status, feature count
206
404
  - Preserve the Notes zone exactly as-is
207
405
  - Update the generated date and current branch
208
406
 
209
- Then regenerate connections.md:
407
+ Then regenerate `.mdd/connections.md`:
210
408
 
211
- **Regenerate `.mdd/connections.md`:**
212
- Read all `.mdd/docs/*.md` (excluding `archive/`) frontmatter only (id, title, status, path, depends_on, source_files). Never read doc bodies. Then:
213
- - **Path tree:** sort docs by path alphabetically, then by id within the same path. Render as indented tree using `├──` / `└──` characters. Each leaf: `<path-leaf-segment> <id> <status>`.
409
+ Read all `.mdd/docs/*.md` (excluding `archive/`) — frontmatter only (id, title, type, status, path, depends_on, wave, source_files). Never read doc bodies. Then:
410
+ - **Path tree:** sort docs by path alphabetically, then by id within the same path. Render as indented tree using `├──` / `└──` characters. Each leaf: `<path-leaf-segment> <id> <type> <status>`.
214
411
  - **Mermaid graph:** one node per doc (short node ID), one `-->` edge per `depends_on` entry, `:::<status>` suffix on each node. Include `classDef complete fill:#00e5cc,color:#000`, `in_progress fill:#ffaa00,color:#000`, `draft fill:#888,color:#fff`, `deprecated fill:#555,color:#aaa`.
215
412
  - **Source overlap:** build map of source_file → docs that reference it. Include only files with 2+ docs.
216
413
  - **Warnings:** broken `depends_on` refs (target doesn't exist), circular dependencies, docs missing `path`.
@@ -221,21 +418,23 @@ Then report:
221
418
  ```
222
419
  ✅ Import Spec Complete
223
420
 
224
- Source: <filename(s)>
225
- Created: <N> feature docs
226
- Structure: <Flat | Waves | Initiative + Waves>
421
+ Source: <filename(s)>
422
+ CLAUDE.md: <created | skipped>
423
+ Initiative: .mdd/initiatives/<slug>.md
424
+ Waves: <N> wave files created
425
+ Docs: <N> feature docs created (<N> COMPONENT, <N> SPEC)
227
426
 
228
- Docs created:
229
- <NN>-<slug> <path> draft
230
- <NN>-<slug> <path> draft
231
- ...
427
+ Structure:
428
+ <initiative title>
429
+ Wave 1 — <name> (<N> features)
430
+ Wave 2 — <name> (<N> features)
431
+ ...
232
432
 
233
- Startup: .mdd/.startup.md rebuilt
433
+ Startup: .mdd/.startup.md rebuilt
234
434
  Connections: .mdd/connections.md updated
235
435
 
236
436
  Next steps:
237
- /mdd <NN> — start building any imported feature
238
- /mdd audit — run a full audit across all imported docs
239
- /mdd upgrade add path fields to any pre-existing docs that are missing them
240
- /mdd rebuild-tags — regenerate tags if any look thin
437
+ /mdd plan-execute <slug>-wave-1 — start building Wave 1
438
+ /mdd audit — run a full audit across all imported docs
439
+ /mdd <NN> jump directly to any feature doc
241
440
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thedecipherist/mdd",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "MDD — Manual-Driven Development workflow for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {