@thedecipherist/mdd 1.6.4 → 1.6.6

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 CHANGED
@@ -42,7 +42,7 @@ Then in Claude Code:
42
42
  - [How It Works](#how-it-works)
43
43
  - [Installation](#installation)
44
44
  - [Quick Start](#quick-start)
45
- - [All 24 Modes at a Glance](#all-24-modes-at-a-glance)
45
+ - [All 25 Modes at a Glance](#all-25-modes-at-a-glance)
46
46
  - [Build Mode - Feature Development](#build-mode--feature-development)
47
47
  - [Audit Mode - Code Review](#audit-mode--code-review)
48
48
  - [Status & Notes](#status--notes)
@@ -236,10 +236,11 @@ Every feature doc and ops runbook has a `tags:` field (4–8 domain-concept keyw
236
236
 
237
237
  ---
238
238
 
239
- ## All 24 Modes at a Glance
239
+ ## All 25 Modes at a Glance
240
240
 
241
241
  ```
242
242
  /mdd <feature description> Build Mode - Document, plan, and implement
243
+ /mdd manual [--force] Manual Mode - Generate a print-ready user manual
243
244
  /mdd audit [section] Audit Mode - Scan code for violations and drift
244
245
  /mdd status Overview: docs, tests, audit state, initiatives
245
246
  /mdd scan Detect features whose source files changed
@@ -659,6 +660,38 @@ Converts one or more large spec or prompt documents — the kind produced by ext
659
660
 
660
661
  ---
661
662
 
663
+ ## Manual Mode
664
+
665
+ ### `/mdd manual [--force]`
666
+
667
+ Generates a comprehensive, print-ready user manual at `.mdd/manual/manual.md` from all MDD feature docs and ops runbooks. Uses content hashes so only changed sections are regenerated — running it repeatedly is fast.
668
+
669
+ ```bash
670
+ /mdd manual # incremental — only regenerate changed sections
671
+ /mdd manual --force # regenerate everything from scratch
672
+ ```
673
+
674
+ **What it produces:**
675
+
676
+ A single `manual.md` file with:
677
+ - **Table of Contents** — auto-generated with anchor links
678
+ - **Project Overview** — synthesized from `.mdd/.startup.md` and `README.md`
679
+ - **Feature sections** — one per MDD feature doc, written in plain English for a non-technical reader. Each section includes: what it does, how to use it, commands, API endpoints, configuration options, and examples.
680
+ - **Operations chapter** — runbooks from `.mdd/ops/` formatted as step-by-step procedures
681
+ - **Command Reference** — aggregated table of all CLI commands across all features
682
+ - **API Reference** — aggregated table of all HTTP endpoints (omitted if none)
683
+ - **Configuration** — aggregated table of all env vars and options (omitted if none)
684
+
685
+ **How the hash check works:**
686
+
687
+ On each run, MDD computes SHA256 of every doc file and compares against `.mdd/manual/.hashes.json`. Sections backed by unchanged docs are left as-is. Only changed, new, or deleted docs trigger section regeneration. `--force` bypasses this and rebuilds everything.
688
+
689
+ **Designed for publishing:** The output is clean markdown with no internal file paths, no jargon without definition, active voice, and real examples. Export to PDF, paste into a blog post, or use as source material for docs sites.
690
+
691
+ **Handles deletions:** If a feature doc is removed between runs, its section is cleanly removed from `manual.md` and its hash entry is dropped.
692
+
693
+ ---
694
+
662
695
  ## Feature Lifecycle
663
696
 
664
697
  ### `/mdd deprecate <feature-id>`
@@ -0,0 +1,441 @@
1
+ ## MANUAL MODE — `/mdd manual [--force]`
2
+
3
+ Triggered when arguments start with `manual`.
4
+
5
+ Generates a comprehensive, print-ready user manual at `.mdd/manual/manual.md` from all
6
+ MDD feature docs and ops runbooks. Uses content hashes to detect what changed since the
7
+ last run — only stale sections are regenerated.
8
+
9
+ Sections are written to disk **immediately after each generation batch completes** — never
10
+ held in memory until the end. This means compaction mid-run loses at most one batch of
11
+ sections, and the next run can resume from the saved state.
12
+
13
+ ---
14
+
15
+ ### Phase M1 — Scope & Hash Check
16
+
17
+ **Step 1 — Guard against empty projects**
18
+
19
+ Check `.mdd/docs/`. If it contains zero `.md` files:
20
+ ```
21
+ ⚠️ No feature docs found.
22
+ Run /mdd <feature> to create your first doc, then re-run /mdd manual.
23
+ ```
24
+ Stop here.
25
+
26
+ **Step 2 — Load stored hashes**
27
+
28
+ Read `.mdd/manual/.hashes.json` if it exists. If absent, treat every doc as new (full
29
+ generation run).
30
+
31
+ Stored hash format:
32
+ ```json
33
+ {
34
+ "docs/01-auth.md": "sha256hex",
35
+ "ops/deploy.md": "sha256hex",
36
+ "_generated": "2026-05-16T20:00:00Z",
37
+ "_manual_version": 1
38
+ }
39
+ ```
40
+
41
+ **Step 3 — Compute current hashes**
42
+
43
+ For every file in `.mdd/docs/*.md` and `.mdd/ops/*.md`, compute SHA256 of file contents:
44
+ ```bash
45
+ sha256sum .mdd/docs/*.md .mdd/ops/*.md 2>/dev/null
46
+ ```
47
+
48
+ **Step 4 — Classify each doc**
49
+
50
+ Compare current vs stored hashes:
51
+ - `unchanged` — hash matches stored value → skip section regeneration
52
+ - `changed` — hash differs → regenerate section
53
+ - `new` — no stored hash → generate section
54
+ - `deleted` — stored hash exists but file no longer present → remove section
55
+
56
+ If `--force` was passed: treat every doc as `changed` regardless of hashes.
57
+
58
+ **Step 5 — Report scope**
59
+
60
+ ```
61
+ 📖 MDD Manual Generator
62
+
63
+ Docs in scope: <N> feature docs, <N> ops runbooks
64
+ ✓ unchanged <N> (skipping)
65
+ ~ changed <N> (regenerating)
66
+ + new <N> (generating)
67
+ - deleted <N> (removing)
68
+
69
+ Output: .mdd/manual/manual.md
70
+ ```
71
+
72
+ If all docs are `unchanged` and `manual.md` already exists:
73
+ ```
74
+ ✓ Manual is up to date. No changes needed.
75
+ Run with --force to regenerate everything.
76
+ ```
77
+ Stop here.
78
+
79
+ ---
80
+
81
+ ### Phase M2 — Skeleton Init (before generating any sections)
82
+
83
+ Before generating any sections, ensure `manual.md` is in a writable state on disk.
84
+ This protects against compaction — each section written to disk is durable.
85
+
86
+ **Step 1 — Ensure output directory exists**
87
+ ```bash
88
+ mkdir -p .mdd/manual
89
+ ```
90
+
91
+ **Step 2 — Load existing manual or build skeleton**
92
+
93
+ Read `.mdd/manual/manual.md` if it exists. Identify the preface: everything before the
94
+ first `<!-- mdd-section: -->` marker. If the file is new, generate a default preface
95
+ (see Phase M3 Step 2 below for the preface format) and write the skeleton immediately:
96
+
97
+ ```markdown
98
+ # <Project Name> — User Manual
99
+
100
+ > <tagline>
101
+
102
+ **Version:** <version>
103
+ **Generated:** <date>
104
+
105
+ <overview paragraphs>
106
+
107
+ ---
108
+
109
+ ## Table of Contents
110
+ <!-- toc -->
111
+ (regenerated on completion)
112
+ <!-- /toc -->
113
+
114
+ ---
115
+
116
+ ## Overview
117
+
118
+ <overview content>
119
+
120
+ ---
121
+
122
+ ## Features
123
+
124
+ (sections generating — re-run /mdd manual if interrupted)
125
+
126
+ ---
127
+
128
+ ## Operations
129
+
130
+ (sections generating — re-run /mdd manual if interrupted)
131
+
132
+ ---
133
+
134
+ ## Command Reference
135
+
136
+ (regenerated on completion)
137
+
138
+ ---
139
+ ```
140
+
141
+ Write this skeleton to `.mdd/manual/manual.md` now, before any agents are launched.
142
+ This ensures the file exists on disk even if compaction occurs mid-generation.
143
+
144
+ **Step 3 — Remove deleted sections**
145
+
146
+ For each doc classified as `deleted`: find and remove the entire
147
+ `<!-- mdd-section: <id> -->` … `<!-- /mdd-section: <id> -->` block (including
148
+ surrounding blank lines) from the current manual.md on disk. Write the file after
149
+ each removal.
150
+
151
+ ---
152
+
153
+ ### Phase M3 — Section Generation (incremental, batch-by-batch)
154
+
155
+ For each `changed` or `new` doc, generate a user-friendly manual section. The section
156
+ must be readable by someone who has never seen the source code — focus on WHAT the
157
+ feature does and HOW to use it, not implementation details.
158
+
159
+ **Section structure per feature doc:**
160
+
161
+ ```markdown
162
+ <!-- mdd-section: <doc-id> -->
163
+ ### <Feature Title>
164
+
165
+ <2-3 sentence plain-English description of what this feature does and the problem it solves.>
166
+
167
+ #### What It Does
168
+ <Paragraph explaining the feature from a user perspective. No code internals.>
169
+
170
+ #### How To Use It
171
+ <Step-by-step user instructions. Include command syntax, options, examples.>
172
+
173
+ #### Commands
174
+ <If the feature has CLI commands — table with command, description, flags.>
175
+ | Command | Description | Flags |
176
+ |---------|-------------|-------|
177
+ | `mdd <cmd>` | … | `--flag` |
178
+
179
+ #### API Endpoints
180
+ <If the feature exposes HTTP endpoints — table with method, path, description.>
181
+ | Method | Path | Description | Auth |
182
+ |--------|------|-------------|------|
183
+
184
+ #### Configuration
185
+ <If the feature has configurable options — env vars, settings, flags.>
186
+ | Option | Type | Default | Description |
187
+ |--------|------|---------|-------------|
188
+
189
+ #### Examples
190
+ <1-3 concrete usage examples. Real commands, real output snippets.>
191
+
192
+ <!-- /mdd-section: <doc-id> -->
193
+ ```
194
+
195
+ For ops runbooks, use a condensed format:
196
+
197
+ ```markdown
198
+ <!-- mdd-section: ops/<slug> -->
199
+ ### <Runbook Title>
200
+
201
+ <Purpose of this runbook.>
202
+
203
+ #### When To Use
204
+ <Triggers or conditions that call for this runbook.>
205
+
206
+ #### Steps
207
+ <Numbered list of the procedure.>
208
+
209
+ <!-- /mdd-section: ops/<slug> -->
210
+ ```
211
+
212
+ **Parallelism and incremental writing — CRITICAL:**
213
+
214
+ - **1–4 changed docs** → generate sequentially in main conversation. After EACH section
215
+ is generated, immediately patch it into `manual.md` on disk (see patching rules below)
216
+ before generating the next section.
217
+
218
+ - **5+ changed docs** → split into batches of up to 8. For each batch:
219
+ 1. Launch one `general-purpose` agent per doc in the batch (all agents in the batch
220
+ run concurrently). Each agent receives: the full doc content, the section structure
221
+ template above, and the output section id.
222
+ 2. **Wait for ALL agents in this batch to complete.**
223
+ 3. Immediately patch ALL returned sections into `manual.md` on disk (one Write call
224
+ per section, or one Write call with all sections patched at once).
225
+ 4. Report progress: ` ✓ Batch <N>/<total> written to disk (<M> sections)`
226
+ 5. Then launch the next batch.
227
+
228
+ **Never hold results across batches.** Each batch's sections must be on disk before
229
+ the next batch starts. Compaction mid-batch loses at most 8 sections; those will be
230
+ regenerated on the next `/mdd manual` run (their hashes won't be in `.hashes.json`
231
+ since that's only written at the very end).
232
+
233
+ **Section patching rules (applied after each batch or each sequential section):**
234
+
235
+ For each returned section:
236
+ - Find the `<!-- mdd-section: <id> -->` … `<!-- /mdd-section: <id> -->` block in the
237
+ current `manual.md`.
238
+ - If found: replace the entire block with the new section.
239
+ - If not found (new doc): append the section after the last `<!-- /mdd-section: -->` tag
240
+ in the Features chapter (or Operations chapter for ops runbooks). If neither marker
241
+ exists yet, append after the `## Features` or `## Operations` heading.
242
+ - Write `manual.md` to disk after each patch.
243
+
244
+ **Reading source files during generation:**
245
+ When the feature doc lists `source_files`, read those files briefly to verify the section
246
+ accurately reflects what is implemented — do not invent capabilities not present in code.
247
+ If source files don't exist yet (draft feature), note the section as "(planned)" in the
248
+ section header.
249
+
250
+ ---
251
+
252
+ ### Phase M4 — Final Assembly
253
+
254
+ After all sections are on disk, perform final assembly passes on `manual.md`.
255
+
256
+ **Step 1 — Rebuild aggregated reference sections**
257
+
258
+ Scan every `<!-- mdd-section: -->` block in the current `manual.md` for:
259
+
260
+ **Command Reference** — find all `#### Commands` tables. Merge into one master table,
261
+ sorted alphabetically by command. Include a "Feature" column. Replace the existing
262
+ `## Command Reference` section (or append if missing).
263
+
264
+ **API Reference** — find all `#### API Endpoints` tables. Merge into one master table,
265
+ sorted by path. Include a "Feature" column. Replace the existing `## API Reference`
266
+ section (or append if missing). Omit this section entirely if no API endpoints were found.
267
+
268
+ **Configuration** — find all `#### Configuration` tables. Merge into one master table,
269
+ grouped by feature. Replace the existing `## Configuration` section (or append if
270
+ missing). Omit this section entirely if no configuration options were found.
271
+
272
+ **Step 2 — Regenerate TOC**
273
+
274
+ Scan the assembled document for all `##` and `###` headings. Build a markdown TOC with
275
+ anchor links. Replace the `<!-- toc -->` … `<!-- /toc -->` block (between
276
+ `## Table of Contents` and the next `---` divider) with the new TOC.
277
+
278
+ **Step 3 — Final document structure**
279
+
280
+ The assembled `manual.md` must follow this order:
281
+
282
+ ```markdown
283
+ # <Project Name> — User Manual ← preface (preserved or generated)
284
+ > <tagline>
285
+
286
+ **Version:** … **Generated:** …
287
+
288
+ <overview paragraphs>
289
+
290
+ ---
291
+
292
+ ## Table of Contents ← always regenerated
293
+ <!-- toc -->
294
+ 1. [Overview](#overview)
295
+ 2. [Features](#features)
296
+ - [Feature Name](#feature-name)
297
+ ...
298
+ 3. [Operations](#operations) ← omit if no ops runbooks
299
+ 4. [Command Reference](#command-reference)
300
+ 5. [API Reference](#api-reference) ← omit if no API endpoints found
301
+ 6. [Configuration](#configuration) ← omit if no config options found
302
+ <!-- /toc -->
303
+
304
+ ---
305
+
306
+ ## Overview ← static or regenerated from .startup.md
307
+
308
+ ---
309
+
310
+ ## Features
311
+
312
+ <!-- mdd-section: 01-... -->
313
+ ...
314
+ <!-- /mdd-section: 01-... -->
315
+
316
+ <!-- mdd-section: 02-... -->
317
+ ...
318
+
319
+ ---
320
+
321
+ ## Operations ← only if .mdd/ops/ has any files
322
+
323
+ <!-- mdd-section: ops/... -->
324
+ ...
325
+
326
+ ---
327
+
328
+ ## Command Reference
329
+ | Command | Description | Flags | Feature |
330
+
331
+ ---
332
+
333
+ ## API Reference
334
+ | Method | Path | Description | Auth | Feature |
335
+
336
+ ---
337
+
338
+ ## Configuration
339
+ | Option | Type | Default | Description | Feature |
340
+ ```
341
+
342
+ **Step 2 — Build/update preface** (if generating for the first time)
343
+
344
+ If the preface was newly generated in Phase M2, ensure it uses this content:
345
+
346
+ Read `.mdd/.startup.md` for: project name, stack, tagline. Read `package.json` (if
347
+ present) for version. Read `README.md` introduction (first 3 paragraphs, if present).
348
+
349
+ ```markdown
350
+ # <Project Name> — User Manual
351
+
352
+ > <tagline or one-sentence description>
353
+
354
+ **Version:** <version from package.json, or "—">
355
+ **Generated:** <date>
356
+
357
+ <2-3 paragraph project overview synthesized from README and .startup.md>
358
+
359
+ ---
360
+ ```
361
+
362
+ Write the final assembled `manual.md` to disk.
363
+
364
+ ---
365
+
366
+ ### Phase M5 — Write Hashes & Report
367
+
368
+ **Step 1 — Update hash store**
369
+
370
+ Write `.mdd/manual/.hashes.json` with:
371
+ - One entry per doc that now exists on disk (use the current hash)
372
+ - Remove entries for deleted docs
373
+ - Update `_generated` to current ISO timestamp
374
+ - Set `_manual_version: 1` (or increment if already set)
375
+
376
+ **Only write this file after manual.md is fully complete.** The hash file is the
377
+ completion marker — if `.hashes.json` is missing or stale, the next run will know
378
+ to regenerate all sections.
379
+
380
+ **Step 2 — Report**
381
+
382
+ ```
383
+ ✅ Manual generated
384
+
385
+ Output: .mdd/manual/manual.md
386
+ Sections: <N> features, <N> ops runbooks
387
+ Generated: <N> new sections
388
+ Updated: <N> changed sections
389
+ Removed: <N> deleted sections
390
+ Unchanged: <N> sections (skipped)
391
+
392
+ Hashes: .mdd/manual/.hashes.json updated
393
+
394
+ Tip: manual.md is print-ready markdown. Open in any markdown viewer,
395
+ export to PDF, or use as source material for blog posts and docs.
396
+ ```
397
+
398
+ **Step 3 — Gitignore check**
399
+
400
+ Check whether `.mdd/manual/` is in `.gitignore`. If not, suggest:
401
+ ```
402
+ 💡 .mdd/manual/ is not gitignored. Add it if you prefer not to commit the
403
+ generated manual (it can be regenerated at any time with /mdd manual).
404
+ ```
405
+
406
+ ---
407
+
408
+ ### Flags
409
+
410
+ | Flag | Effect |
411
+ |------|--------|
412
+ | `--force` | Bypass hash check — regenerate all sections |
413
+ | (none) | Default — only regenerate changed/new sections |
414
+
415
+ ---
416
+
417
+ ### Notes on Quality
418
+
419
+ When generating each section, the goal is a document a non-technical user or executive
420
+ can read and understand. Rules for section writers:
421
+
422
+ - **No internal file paths** in body text (they belong in the feature doc, not the manual)
423
+ - **No jargon without definition** — if a term needs explanation, add it
424
+ - **Active voice** — "The auth system validates your token" not "Tokens are validated"
425
+ - **One idea per paragraph** — keep paragraphs to 3–5 sentences
426
+ - **Examples are mandatory** for any command or API endpoint listed
427
+ - **Planned features** are clearly marked `(planned — not yet implemented)`
428
+
429
+ ### Recovery from Interrupted Runs
430
+
431
+ If `/mdd manual` was interrupted mid-generation (context compaction, session end, etc.):
432
+
433
+ 1. Re-run `/mdd manual`. The hash check will find that `.hashes.json` is missing or
434
+ incomplete (since it's only written at the very end in Phase M5).
435
+ 2. Sections already written to `manual.md` (from completed batches) will be detected as
436
+ present — but since their hashes aren't in `.hashes.json`, they'll be classified as
437
+ `new` and regenerated.
438
+ 3. The regenerated sections will simply replace what was already there. No data is lost.
439
+
440
+ To skip regenerating sections that look complete, a user can run `--force` after manually
441
+ verifying the manual looks correct, then let Phase M5 write the hash file to seal the run.
package/commands/mdd.md CHANGED
@@ -3,7 +3,7 @@ description: "MDD workflow — Document → Audit → Fix → Verify. Build feat
3
3
  scope: project
4
4
  argument-hint: "<feature-description> or audit [section]"
5
5
  allowed-tools: Read, Write, Edit, Grep, Glob, Bash, AskUserQuestion, Agent
6
- mdd_version: 10
6
+ mdd_version: 11
7
7
  ---
8
8
 
9
9
  # MDD — Manual-Driven Development Workflow
@@ -130,6 +130,9 @@ Use whichever path contains `mdd-audit.md`. Store it as `$MDD_DIR` and use it fo
130
130
  - If arguments start with `ops`, `runop`, `update-op`, or `commands` →
131
131
  **Read `$MDD_DIR/mdd-ops.md` then follow the relevant OPS/COMMANDS mode instructions.**
132
132
 
133
+ - If arguments start with `manual` →
134
+ **Read `$MDD_DIR/mdd-manual.md` then follow MANUAL MODE instructions.**
135
+
133
136
  - If arguments are empty → ask the user what they want to do (build a feature, run an audit, check status, etc.)
134
137
 
135
138
  - Otherwise → **Read `$MDD_DIR/mdd-build.md` then follow BUILD MODE instructions.**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thedecipherist/mdd",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "description": "MDD — Manual-Driven Development workflow for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {