@thedecipherist/mdd 1.5.3 → 1.5.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.
@@ -8,6 +8,21 @@ Reads one or more large spec or prompt documents — the kind produced by extend
8
8
 
9
9
  ### Phase IS1 — Read Spec Files
10
10
 
11
+ **Stale job detection (runs first):** Check `.mdd/jobs/` for any existing `import-*/` folder.
12
+ - If found: read its `MANIFEST.md` and count written vs total files. Present to user:
13
+ ```
14
+ Found interrupted import job from <date>.
15
+ MANIFEST shows <done>/<total> files written.
16
+ Written: <list of [x] paths>
17
+ Remaining: <list of [ ] paths>
18
+
19
+ [R] Resume — skip already-written files, continue from where it left off
20
+ [D] Discard — delete job, start the full import from scratch
21
+ ```
22
+ - **Resume:** skip IS1–IS3, go directly to IS4 writing only the `[ ]` entries. IS5 runs normally after.
23
+ - **Discard:** delete the `import-<date>/` folder, proceed normally.
24
+ - If no stale job: proceed normally.
25
+
11
26
  Parse file path(s) from the arguments following `import-spec`. Multiple files may be space-separated or specified as a glob.
12
27
 
13
28
  For each file path:
@@ -72,45 +87,131 @@ For each identified feature, determine its `path` value:
72
87
  - Title Case, 1–3 levels, `/`-separated
73
88
  - Siblings must use identical parent spelling (if `Auth/Login` exists, new auth docs use `Auth`, not `Authentication`)
74
89
 
75
- #### Step IS2c — Build-order classification
90
+ #### Step IS2c — Project type detection + wave ordering
91
+
92
+ 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. The correct order depends entirely on what type of project is being built.
93
+
94
+ **Step 1 — Detect project type from the spec.**
95
+
96
+ Read the spec for these signals:
97
+
98
+ | Project type | Signals |
99
+ |---|---|
100
+ | **Language / Toolchain** | Has a Parser, AST, or grammar section. Describes directives, syntax, or a runtime. Has a CLI section. Describes an interpreter, compiler, or processing pipeline. |
101
+ | **Web API / Backend** | Describes endpoints, routes, REST, or GraphQL. Has auth/authorization sections. Describes DB models and migrations. |
102
+ | **Frontend / UI App** | Describes components, pages, or routing. Describes user interactions, forms, and layouts. Has a state management section. |
103
+ | **Library / SDK** | Describes a public API surface with exported types. Has integration or plugin sections. No server or UI sections. |
104
+ | **Extension / Plugin** | Spec is adding features to an existing product. Most features assume a host system already exists. |
105
+
106
+ If signals from multiple types appear, pick the dominant one and note the mix.
107
+
108
+ **Step 2 — Apply the wave ordering template for the detected type.**
109
+
110
+ **Language / Toolchain:**
111
+ ```
112
+ Wave 1 — Infrastructure Skeleton
113
+ Goal: a working program that can accept input and produce output, even if incomplete.
114
+ Build: Parser + AST types + core shared types + minimal CLI entry point
115
+ Demo-state: "can parse a source file and print the AST to stdout"
116
+
117
+ Wave 2 — First Shippable Artifact
118
+ Goal: the first thing an end user can actually use.
119
+ Build: Stripper / Renderer / Compiler — whatever produces the first real output
120
+ Demo-state: "can take a source file and produce correct output for the simplest case"
121
+
122
+ Wave 3 — Language Features
123
+ Goal: full language coverage. All directives, all syntax, all semantics.
124
+ Build: SPEC docs for every language feature + the Template Engine / Resolver that implements them
125
+ Demo-state: "all static features work correctly end to end"
126
+
127
+ Wave 4 — Dynamic / Live Features
128
+ Goal: features that require external connections (DB, HTTP, shell, AI client).
129
+ Build: MCP Server, Hook, live directive execution
130
+ Demo-state: "live data directives execute and return real results"
131
+
132
+ Wave 5 — Security, Hardening, Extras
133
+ Goal: production-safe. Sandboxed execution, audit logging, edge case handling.
134
+ Build: Security system, caching, graceful degradation
135
+ Demo-state: "untrusted documents are safe to run; audit log captures all executions"
136
+
137
+ Wave 6 — CLI, Distribution, Packaging
138
+ Goal: installable and usable by someone who has never seen the codebase.
139
+ Build: Full CLI, npm package, CI integration, documentation
140
+ Demo-state: "npm install -g, run against a real file, get correct output"
141
+ ```
142
+
143
+ **Web API / Backend:**
144
+ ```
145
+ Wave 1 — Project scaffold + DB + core models
146
+ Demo-state: "server starts, DB connects, migrations run"
147
+
148
+ Wave 2 — Auth
149
+ Demo-state: "can register, login, receive a JWT, access a protected route"
150
+
151
+ Wave 3 — Core endpoints
152
+ Demo-state: "core CRUD for the main resource works end to end"
76
153
 
77
- 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.
154
+ Wave 4Business logic features
155
+ Demo-state: "main product workflow works end to end"
78
156
 
79
- **Classify every feature as one of two types:**
157
+ Wave 5 Integrations, webhooks, external APIs
158
+ Demo-state: "third-party integrations work in staging"
80
159
 
81
- **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.
160
+ Wave 6 Admin, analytics, hardening
161
+ Demo-state: "production-ready: rate limiting, logging, admin panel live"
162
+ ```
163
+
164
+ **Frontend / UI App:**
165
+ ```
166
+ Wave 1 — Routing + layout shell
167
+ Demo-state: "app loads, all routes navigate without error"
82
168
 
83
- **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.
169
+ Wave 2 Auth + core state
170
+ Demo-state: "can log in and see the main dashboard"
84
171
 
85
- **Order COMPONENT features by build dependency:**
172
+ Wave 3 Core features
173
+ Demo-state: "primary user workflow works end to end"
86
174
 
87
- 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.
175
+ Wave 4 Secondary features + integrations
176
+ Demo-state: "all documented features work"
88
177
 
89
- Example for a language toolchain:
178
+ Wave 5 Polish, performance, accessibility
179
+ Demo-state: "passes lighthouse audit, all a11y checks green"
90
180
  ```
91
- Parser — foundation, no deps, must exist first
92
- Stripper — depends on Parser AST
93
- Renderer — depends on Parser AST, no connection deps
94
- Template Engine — depends on Parser + Renderer
95
- MCP Server — depends on Template Engine
96
- Hook — depends on MCP Server
97
- CLI — depends on all of the above
181
+
182
+ **Library / SDK:**
98
183
  ```
184
+ Wave 1 — Core types + core algorithm
185
+ Demo-state: "library installs, core function produces correct output"
186
+
187
+ Wave 2 — Full public API
188
+ Demo-state: "all documented methods work, test suite passes"
99
189
 
100
- **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`.
190
+ Wave 3 Extensions, plugins, advanced options
191
+ Demo-state: "extension points work, plugin example runs"
101
192
 
102
- **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.
193
+ Wave 4Distribution, docs, examples
194
+ Demo-state: "published to registry, README example runs from a fresh install"
195
+ ```
103
196
 
104
- Example wave structure for a language toolchain:
197
+ **Extension / Plugin:**
105
198
  ```
106
- Wave 1Foundation: Parser + all language directive SPECs
107
- Wave 2 — Static Output: Stripper + Renderer
108
- Wave 3 — Engine: Template Engine + Caching SPECs
109
- Wave 4 — Live Data: MCP Server + Hook + Security SPECs
110
- Wave 5 — CLI: CLI + Distribution
199
+ Order by user-facing value the most impactful feature first. Each wave should be independently usable without later waves. Infrastructure last.
111
200
  ```
112
201
 
113
- **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.
202
+ **Step 3 Classify every feature.**
203
+
204
+ With the wave structure determined, classify each feature:
205
+
206
+ **COMPONENT** — results in code files: a module, class, package, service, server, or runtime. The thing you sit down and write.
207
+
208
+ **SPEC** — describes behaviour a COMPONENT must implement: a directive definition, an API contract, a security rule, a protocol. You consult a SPEC while building the COMPONENT. SPEC docs belong in the same wave as their implementing COMPONENT.
209
+
210
+ **Step 4 — Assign features to waves.**
211
+
212
+ Place each feature in the wave where it logically gets built. Ask: "At which wave would a developer need this?" Not: "In which section does the spec describe it?"
213
+
214
+ SPEC docs and their implementing COMPONENT always go in the same wave. The COMPONENT `depends_on` the SPECs it implements.
114
215
 
115
216
  #### Step IS2d — Determine output structure
116
217
 
@@ -230,10 +331,48 @@ Is the build order correct? Does each wave's demo-state make sense?
230
331
 
231
332
  **Do not proceed to IS4 until the user explicitly approves.**
232
333
 
334
+ **After approval — create the job folder and MANIFEST before writing any file:**
335
+
336
+ Create `.mdd/jobs/import-<YYYY-MM-DD>/MANIFEST.md`:
337
+
338
+ ```markdown
339
+ # Import Spec Job Manifest
340
+ # Job: import-<YYYY-MM-DD>
341
+ # Source: <filename(s)>
342
+ # Started: <ISO timestamp>
343
+ # Files: <N total>
344
+ # Status: IN PROGRESS
345
+ #
346
+ # States: [ ] pending [~] writing [x] written [!] error
347
+
348
+ ## Files to create
349
+ [ ] .mdd/initiatives/<slug>.md
350
+ [ ] .mdd/waves/<slug>-wave-1.md
351
+ [ ] .mdd/waves/<slug>-wave-2.md
352
+ [ ] .mdd/docs/01-<slug>.md
353
+ [ ] .mdd/docs/02-<slug>.md
354
+ ...
355
+ ```
356
+
357
+ List every file that will be written in the order it will be written. Nothing proceeds until this file exists on disk.
358
+
233
359
  ---
234
360
 
235
361
  ### Phase IS4 — Write Files
236
362
 
363
+ **First — ensure the MDD directory structure exists.** Run these before writing any file:
364
+
365
+ ```bash
366
+ mkdir -p .mdd/initiatives
367
+ mkdir -p .mdd/waves
368
+ mkdir -p .mdd/docs
369
+ ```
370
+
371
+ These are the exact directories MDD uses. Do not write initiative or wave files anywhere else. Full paths on disk:
372
+ - Initiatives: `.mdd/initiatives/<slug>.md`
373
+ - Waves: `.mdd/waves/<slug>-wave-N.md`
374
+ - Feature docs: `.mdd/docs/<NN>-<slug>.md`
375
+
237
376
  Write in this order: CLAUDE.md (if approved) → initiative → waves → feature docs.
238
377
 
239
378
  #### CLAUDE.md (if approved in IS2.5)
@@ -319,6 +458,10 @@ Compute and write the `hash:` field after writing.
319
458
 
320
459
  #### Feature docs
321
460
 
461
+ **Critical framing — these are build instructions, not reference documentation.**
462
+
463
+ When a developer runs `/mdd NN`, Claude reads this doc and uses it to write code. That is the only reader that matters. Write every section as if answering the question: "What exactly do I build, and how do I know when it's done?" Not: "What does this feature do?" — a passive description is useless to a builder.
464
+
322
465
  For each feature in the approved plan, in wave order:
323
466
 
324
467
  1. Auto-number continuing from the highest existing doc number in `.mdd/docs/`
@@ -375,29 +518,37 @@ known_issues: []
375
518
 
376
519
  # <NN> — <Feature Title>
377
520
 
378
- ## Purpose
521
+ ## What to Build
379
522
 
380
- <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.>
523
+ <Answer: "What exactly am I being asked to create?" For a COMPONENT: name the files/modules to create, what they take as input, what they produce as output, and what they must never do. For a SPEC: describe the exact behaviour contract the implementing COMPONENT must satisfy — what inputs it must accept, what output it must produce, what errors it must raise. Be concrete. "A parser that reads .md files" is too vague. "A parser that reads a .md source file and produces an array of ASTNode objects, one per directive" is correct.>
381
524
 
382
525
  ## Architecture
383
526
 
384
- <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.>
527
+ <How this feature fits into the system and what it depends on. For a COMPONENT: its place in the pipeline, what calls it, what it calls, what it must never reach into directly. For a SPEC: which COMPONENT implements this spec and how. Include TypeScript interfaces, AST node types, and data structures exactly as defined in the spec copy them verbatim, do not paraphrase.>
528
+
529
+ ## Implementation Notes
530
+
531
+ <Key decisions Claude must follow when implementing this feature. This is not boilerplate — write only what is non-obvious or constraining. Examples: "use a single-pass regex scanner, not a recursive descent parser"; "never buffer the full file in memory"; "the AST must be immutable after construction". If the spec gives explicit implementation guidance, it belongs here.>
385
532
 
386
533
  ## Data Model
387
534
 
388
- <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.>
535
+ <Data structures, schemas, config formats. Include exact field names, types, nesting, and defaults. Copy JSON examples from the spec verbatim. Omit only if the spec truly defines no data structures for this feature.>
389
536
 
390
537
  ## API / Interface
391
538
 
392
- <Public interface this feature exposes: function signatures, tool names, command syntax, config keys. Omit if not applicable.>
539
+ <The exact public interface this feature exposes. Function signatures, exported types, CLI commands and flags, config keys, MCP tool names. Every option, every flag, every subcommand — do not omit rare or advanced ones. A developer should be able to write the module's index.ts exports from this section alone.>
393
540
 
394
541
  ## Business Rules
395
542
 
396
- <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.>
543
+ <Every constraint, validation rule, edge case, error behaviour, platform difference, and "always/never/only valid when" rule from the spec. Exhaustive. If it is in the spec for this feature, it is here. Use a numbered or bulleted list. Include exact error message formats and the conditions that trigger them.>
544
+
545
+ ## Acceptance Criteria
546
+
547
+ <How do you know this feature is done? Write concrete, verifiable statements. Each criterion should be something Claude can check with a test or a manual run. Examples: "mai strip input.md produces output with zero @ directives remaining"; "parsing a file with a circular @include chain throws CIRCULAR_REFERENCE_ERROR with the full chain in the message"; "all 11 content masking patterns fire correctly on the test fixtures".>
397
548
 
398
549
  ## Dependencies
399
550
 
400
- <Other feature docs this one requires. List by ID and title. For SPECs, name the COMPONENT that implements this spec.>
551
+ <Other feature docs this one requires, by ID and title. For SPECs, state which COMPONENT implements this spec.>
401
552
 
402
553
  ## Known Issues
403
554
 
@@ -407,16 +558,18 @@ known_issues: []
407
558
  3. Tags: 4–8 domain-concept keywords. NOT file paths or spec section names.
408
559
  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).
409
560
 
561
+ **For every file written:** mark it `[~]` in MANIFEST before writing, then `[x]` immediately after. If writing fails, mark `[!]` with a one-line error note. This ensures the MANIFEST is always an accurate snapshot of what exists on disk — a resume after interruption will never re-write a file that was already successfully written.
562
+
410
563
  **Progress report as you write:**
411
564
  ```
412
565
  Writing files...
413
566
  ✅ CLAUDE.md
414
- ✅ initiatives/markdownai.md
415
- ✅ waves/markdownai-wave-1.md (Wave 1 — Foundation)
416
- ✅ waves/markdownai-wave-2.md (Wave 2 — Static Pipeline)
567
+ .mdd/initiatives/<slug>.md
568
+ .mdd/waves/<slug>-wave-1.md (Wave 1 — <name>)
569
+ .mdd/waves/<slug>-wave-2.md (Wave 2 — <name>)
417
570
  ...
418
- ✅ docs/01-<slug>.md [COMPONENT] <path>
419
- ✅ docs/02-<slug>.md [SPEC] <path>
571
+ .mdd/docs/01-<slug>.md [COMPONENT] <path>
572
+ .mdd/docs/02-<slug>.md [SPEC] <path>
420
573
  ...
421
574
  ```
422
575
 
@@ -439,6 +592,8 @@ Read all `.mdd/docs/*.md` (excluding `archive/`) — frontmatter only (id, title
439
592
  - **Warnings:** broken `depends_on` refs (target doesn't exist), circular dependencies, docs missing `path`.
440
593
  - **Write** `.mdd/connections.md` with YAML frontmatter (`generated: <today>`, `doc_count: <N>`, `connection_count: <N>`, `overlap_count: <N>`) and four sections: Path Tree, Dependency Graph (Mermaid), Source File Overlap, Warnings.
441
594
 
595
+ **Clean up job folder:** Delete `.mdd/jobs/import-<date>/` entirely — the written files are the authoritative record.
596
+
442
597
  Then report:
443
598
 
444
599
  ```
@@ -458,6 +613,7 @@ Structure:
458
613
 
459
614
  Startup: .mdd/.startup.md rebuilt
460
615
  Connections: .mdd/connections.md updated
616
+ Job: .mdd/jobs/import-<date>/ deleted
461
617
 
462
618
  Next steps:
463
619
  /mdd plan-execute <slug>-wave-1 — start building Wave 1
@@ -210,14 +210,28 @@ DIRTY=$(git status --porcelain)
210
210
  Follow the same (a)/(b)/(c) logic as mdd-build.md Phase 0.
211
211
  - **Never proceed on main.** This is a hard block regardless of clean/dirty state.
212
212
 
213
- 1. Parse `<wave-slug>` — hard stop *"Wave does not exist"* if `waves/<wave-slug>.md` not found.
213
+ 1. Parse `<wave-slug>` — hard stop *"Wave does not exist"* if `.mdd/waves/<wave-slug>.md` not found.
214
214
  2. Read the wave doc.
215
215
  3. Derive and read the parent initiative — hard stop if not found.
216
216
  4. **Hash check:** verify both initiative and wave file hashes. Hard stop on any mismatch: *"File has been manually edited since last sync. Run `/mdd plan-sync` first."*
217
217
  5. **Depends-on gate:** if wave's `depends_on` is not `none`, verify that wave is `complete`. Hard stop if not.
218
- 6. **Feature ordering check (Gap 4):** build dependency graph of features within the wave. If any ordering violation found → hard stop, explain exact conflict, offer auto-reorder.
219
-
220
- ### Phase PE2 Interaction mode
218
+ 6. **Feature ordering check:** build dependency graph of features within the wave. If any ordering violation found → hard stop, explain exact conflict, offer auto-reorder.
219
+ 7. **Stale job detection:** Check `.mdd/jobs/` for any existing `wave-<wave-slug>/` folder.
220
+ - If found: read its `MANIFEST.md` and count entries by state (`[ ]`, `[~]`, `[x]`, `[!]`). Present to user:
221
+ ```
222
+ Found interrupted wave job from <date>.
223
+ MANIFEST shows <done>/<total> features complete.
224
+ Features done: <list of [x] slugs>
225
+ Remaining: <list of [ ] and [~] slugs>
226
+
227
+ [R] Resume — continue from where it left off
228
+ [D] Discard — delete job and start wave from scratch
229
+ ```
230
+ - **Resume:** skip PE2, skip to PE3 starting from the first `[ ]` or `[~]` entry. Features marked `[x]` are already complete — do not re-run them.
231
+ - **Discard:** delete the `wave-<wave-slug>/` folder, proceed to PE2 normally.
232
+ - If no stale job exists: proceed to PE2 normally.
233
+
234
+ ### Phase PE2 — Interaction mode + Job Setup
221
235
 
222
236
  Ask:
223
237
  ```
@@ -230,24 +244,51 @@ How do you want to run this wave?
230
244
 
231
245
  **Interactive:** full Phase 2 gate, Phase 5 plan confirmation, green gate iteration prompts on every feature.
232
246
 
247
+ **After the interaction mode is chosen — create the job folder and MANIFEST (nothing proceeds until this exists on disk):**
248
+
249
+ Create `.mdd/jobs/wave-<wave-slug>/MANIFEST.md`:
250
+
251
+ ```markdown
252
+ # Wave Job Manifest
253
+ # Job: wave-<wave-slug>
254
+ # Wave: .mdd/waves/<wave-slug>.md
255
+ # Initiative: <initiative-slug>
256
+ # Started: <ISO timestamp>
257
+ # Mode: <automated | interactive>
258
+ # Features: <N>
259
+ # Status: IN PROGRESS
260
+ #
261
+ # States: [ ] planned [~] in_progress [x] complete [!] error
262
+
263
+ ## Features (in build order)
264
+ [ ] <feature-slug-1> .mdd/docs/<NN>-<slug>.md
265
+ [ ] <feature-slug-2> .mdd/docs/<NN>-<slug>.md
266
+ [ ] <feature-slug-3> .mdd/docs/<NN>-<slug>.md
267
+ ```
268
+
269
+ List every feature from the wave's Features table in order. Features already marked `complete` in the wave doc get `[x]` from the start.
270
+
233
271
  ### Phase PE3 — Execute features
234
272
 
235
273
  For each feature in the wave's feature table, in dependency order, skipping `complete` features:
236
274
 
237
275
  1. Tell user: *"Starting Feature N: <feature-slug>"*
238
- 2. Flip `wave_status: active` for this feature in the wave doc immediately.
239
- 3. Update the wave doc's `Doc` column with the feature doc path (once created in MDD Phase 3).
240
- 4. Run full MDD Build Mode (Phases 1–7) for the feature, at the chosen interaction level.
276
+ 2. Mark the feature `[~]` in `MANIFEST.md` immediately (before any other work).
277
+ 3. Flip `wave_status: active` for this feature in the wave doc immediately.
278
+ 4. Update the wave doc's `Doc` column with the feature doc path (once created in MDD Phase 3).
279
+ 5. Run full MDD Build Mode (Phases 1–7) for the feature, at the chosen interaction level.
241
280
  - Feature doc is auto-numbered from `.mdd/docs/` and gets `initiative`, `wave`, `wave_status` fields added.
242
- 5. After Phase 7 verify: flip `wave_status: complete` in wave doc AND confirm `status: complete` is written to the feature doc frontmatter (Phase 7c should have done this — verify it, write it if missing).
243
- 6. Ask: *"Feature N done ✓. Start Feature N+1? (yes / pause here)"*
281
+ 6. After Phase 7 verify: flip `wave_status: complete` in wave doc AND confirm `status: complete` is written to the feature doc frontmatter (Phase 7c should have done this — verify it, write it if missing).
282
+ 7. Mark the feature `[x]` in `MANIFEST.md`. If an error occurred that prevented completion, mark `[!]` with a one-line note.
283
+ 8. Ask: *"Feature N done ✓. Start Feature N+1? (yes / pause here)"*
244
284
 
245
- **Resume behaviour (Gap 2):** if re-run on a partially complete wave, read each feature's `wave_status`. Skip `complete`. Resume at first `active` or `planned`. If `active` but no doc exists restart from Phase 1.
285
+ **Resume behaviour:** if re-run on a partially complete wave, stale job detection in PE1 handles resume. MANIFEST is the authoritative progress record it is always written before and after each feature so an interrupted session can pick up at the exact right point.
246
286
 
247
287
  ### Phase PE4 — Wave completion
248
288
 
249
289
  When all features are `complete`:
250
- 1. Show the demo-state: *"Wave complete. Demo-state: '<demo-state>'. Have you verified this?"*
290
+ 1. Update `MANIFEST.md` set `# Status: COMPLETE` in the header.
291
+ 2. Show the demo-state: *"Wave complete. Demo-state: '<demo-state>'. Have you verified this?"*
251
292
  2. User confirms → flip wave `status: complete` in both `waves/<slug>.md` AND the waves table in `initiatives/<slug>.md`.
252
293
  3. **Cascade status to feature docs** — for every feature listed in this wave, read its `.mdd/docs/<NN>-<slug>.md` and check `status:`. For any doc that is NOT already `complete` or `deprecated`, write:
253
294
  - `status: complete`
@@ -272,6 +313,8 @@ Read all `.mdd/docs/*.md` (excluding `archive/`) — frontmatter only (id, title
272
313
  - **Warnings:** broken `depends_on` refs (target doesn't exist), circular dependencies, docs missing `path`.
273
314
  - **Write** `.mdd/connections.md` with YAML frontmatter (`generated: <today>`, `doc_count: <N>`, `connection_count: <N>`, `overlap_count: <N>`) and four sections: Path Tree, Dependency Graph (Mermaid), Source File Overlap, Warnings.
274
315
 
316
+ **Clean up job folder:** Delete `.mdd/jobs/wave-<wave-slug>/` entirely. The wave doc and feature docs are the authoritative completion record — the job folder is ephemeral tracking only.
317
+
275
318
  ---
276
319
 
277
320
  ## PLAN-SYNC MODE — `/mdd plan-sync`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thedecipherist/mdd",
3
- "version": "1.5.3",
3
+ "version": "1.5.5",
4
4
  "description": "MDD — Manual-Driven Development workflow for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {