@thedecipherist/mdd 1.3.9 → 1.5.0

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
@@ -4,7 +4,7 @@
4
4
 
5
5
  # MDD - Manual-Driven Development for Claude Code
6
6
 
7
- > **One command. Twenty-one modes. Complete feature lifecycle from documentation to verified deployment.**
7
+ > **One command. Twenty-four modes. Complete feature lifecycle from documentation to verified deployment.**
8
8
 
9
9
  <p align="center">
10
10
  <a href="https://thedecipherist.github.io/mdd">
@@ -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 21 Modes at a Glance](#all-21-modes-at-a-glance)
45
+ - [All 24 Modes at a Glance](#all-24-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,7 +236,7 @@ Every feature doc and ops runbook has a `tags:` field (4–8 domain-concept keyw
236
236
 
237
237
  ---
238
238
 
239
- ## All 22 Modes at a Glance
239
+ ## All 24 Modes at a Glance
240
240
 
241
241
  ```
242
242
  /mdd <feature description> Build Mode - Document, plan, and implement
@@ -245,10 +245,12 @@ Every feature doc and ops runbook has a `tags:` field (4–8 domain-concept keyw
245
245
  /mdd scan Detect features whose source files changed
246
246
  /mdd update <feature-id> Re-sync a feature doc after code changes
247
247
  /mdd rebuild-tags [--force] Generate tags for all docs and rebuild .startup.md
248
+ /mdd connect Rebuild the connections map from all docs
248
249
  /mdd note "text" Append a timestamped note to .mdd/.startup.md
249
250
  /mdd note list Print the Notes section
250
251
  /mdd note clear Wipe all notes (asks for confirmation)
251
252
  /mdd deprecate <feature-id> Archive a feature and flag all dependents
253
+ /mdd import-spec <file> [file...] Convert a spec doc into MDD feature docs
252
254
  /mdd reverse-engineer [path|feature-id] Generate MDD docs from existing source code
253
255
  /mdd graph Render the full cross-feature dependency map
254
256
  /mdd upgrade Batch-patch missing frontmatter across all docs
@@ -584,7 +586,7 @@ Notes are timestamped and survive session resets.
584
586
 
585
587
  ### `/mdd scan`
586
588
 
587
- Detects which features have drifted since their last MDD session. Uses a single Explore agent to run all git checks in parallel, then classifies each feature:
589
+ Detects which features have drifted since their last MDD session, and checks whether `connections.md` is stale. Uses a single Explore agent to run all git checks in parallel, then classifies each feature:
588
590
 
589
591
  | Classification | Meaning |
590
592
  |---|---|
@@ -624,6 +626,39 @@ Re-syncs a feature doc after its code has changed:
624
626
 
625
627
  ---
626
628
 
629
+ ## Import Spec Mode
630
+
631
+ ### `/mdd import-spec <file> [file...]`
632
+
633
+ Converts one or more large spec or prompt documents — the kind produced by extended brainstorming sessions — into properly structured MDD feature docs. Nothing from the original spec is lost.
634
+
635
+ ```bash
636
+ /mdd import-spec ~/specs/my-app-prompt.md
637
+ /mdd import-spec spec-v1.md spec-v2.md spec-notes.md
638
+ ```
639
+
640
+ **How it works:**
641
+
642
+ 1. **Read** — loads all spec files, merges content if multiple are provided
643
+ 2. **Extract + Group** — identifies distinct features and assigns each a `path` value (e.g. `Auth/Login`, `E-commerce/Cart`) before anything else
644
+ 3. **Auto-detect structure** — decides whether to create initiatives + waves + docs, waves + docs, or flat feature docs, based on path diversity and feature count:
645
+
646
+ | Signal | Output |
647
+ |--------|--------|
648
+ | 3+ distinct root path areas AND 8+ features | Initiative → Waves → Feature docs |
649
+ | 4–7 features in a coherent domain | Waves → Feature docs |
650
+ | 1–3 focused features | Flat feature docs only |
651
+
652
+ 4. **Dry-run preview** — shows the complete proposed tree (paths, slugs, titles, content mapping, merge summary) before writing a single file. You can adjust or abort.
653
+ 5. **Write docs** — creates all feature docs with full frontmatter, populated sections, tags, and `path` fields
654
+ 6. **Rebuild** — updates `.mdd/.startup.md` to reflect the new docs
655
+
656
+ **Content preservation:** Every decision, constraint, and edge case in the spec maps somewhere in the output. If something doesn't fit cleanly into a standard section, it goes into Business Rules or a Known Constraints note.
657
+
658
+ **Duplicate handling:** Specs often revisit the same topic multiple times. Import-spec detects overlapping sections semantically, merges them into the best doc, and shows you exactly what was merged and why in the dry-run summary.
659
+
660
+ ---
661
+
627
662
  ## Feature Lifecycle
628
663
 
629
664
  ### `/mdd deprecate <feature-id>`
@@ -677,9 +712,9 @@ Saved to `.mdd/audits/graph-<date>.md`.
677
712
 
678
713
  ### `/mdd upgrade`
679
714
 
680
- Batch-patches missing frontmatter fields (`last_synced`, `status`, `phase`) across all `.mdd/docs/*.md` files. Safe to run multiple times - already-present fields are never overwritten.
715
+ Batch-patches missing frontmatter fields (`last_synced`, `status`, `phase`, `tags`, `path`) across all `.mdd/docs/*.md` files. Safe to run multiple times already-present fields are never overwritten.
681
716
 
682
- Infers sensible defaults from git history, existing field values, and archive status. Shows a plan before writing anything.
717
+ Infers sensible defaults from git history, existing field values, and archive status. For the `path` field, Claude reads each doc's title and purpose to propose a value — always shows a plan for confirmation before writing. After upgrade, run `/mdd rebuild-tags` to populate any empty `tags` fields.
683
718
 
684
719
  ---
685
720
 
@@ -793,6 +828,7 @@ Every `.mdd/docs/<NN>-<feature-name>.md` file uses this YAML frontmatter:
793
828
  | `phase` | Last completed phase name |
794
829
  | `mdd_version` | Version of MDD that created/last updated this doc |
795
830
  | `tags` | 4–8 domain-concept keywords surfaced in `.startup.md` so Claude can detect when a prompt relates to this feature (e.g. `[auth, jwt, login, sessions]`) |
831
+ | `path` | Slash-delimited breadcrumb showing where this feature lives in the product (e.g. `Auth/Login`, `E-commerce/Cart/Checkout`). Used by dashboards and listing tools to group docs into a human-readable tree. Distinct from `depends_on` — this is for navigation, not build order. |
796
832
  | `known_issues` | Issues discovered during audits or implementation |
797
833
 
798
834
  **`depends_on` rules:**
@@ -800,6 +836,51 @@ Every `.mdd/docs/<NN>-<feature-name>.md` file uses this YAML frontmatter:
800
836
  - IDs must reference existing docs - `/mdd graph` detects broken references
801
837
  - Only add, never remove without discussion - removing breaks the dependency chain
802
838
 
839
+ **`path` rules:**
840
+ - Format: `Area/Section` or `Area/Section/Detail` — Title Case, slash-separated, 1–3 levels
841
+ - Use product vocabulary, not code paths: `Auth/Login` not `src/handlers/auth`
842
+ - Siblings must use identical parent spelling: if `Auth/Login` exists, new auth docs use `Auth` not `Authentication`
843
+ - Set automatically by Claude in Build Mode Phase 3 (inferred from context, confirmed by user if ambiguous)
844
+ - Missing `path` fields are detected by `/mdd scan` and batch-fixed by `/mdd upgrade`
845
+ - Dashboards and listing tools use `path` to group docs into a human-readable tree view
846
+
847
+ ---
848
+
849
+ ## Connections Map
850
+
851
+ Every MDD project maintains a committed `.mdd/connections.md` file — a pre-computed relationship map that gives Claude and the dashboard instant access to the full project graph without reading every doc.
852
+
853
+ ```bash
854
+ /mdd connect # regenerate manually at any time
855
+ ```
856
+
857
+ It contains three sections:
858
+
859
+ **Path Tree** — all feature docs grouped by their `path` field, sorted alphabetically, ready for dashboard rendering:
860
+ ```
861
+ Auth
862
+ ├── Login 02-auth-login complete
863
+ └── OAuth 03-oauth-google draft
864
+ E-commerce
865
+ └── Cart 07-cart in_progress
866
+ ```
867
+
868
+ **Dependency Graph** — a Mermaid diagram of all `depends_on` relationships with status-coded nodes:
869
+ ```mermaid
870
+ graph TD
871
+ A["07-cart"]:::in_progress --> B["02-auth-login"]:::complete
872
+ classDef complete fill:#00e5cc,color:#000
873
+ classDef in_progress fill:#ffaa00,color:#000
874
+ classDef draft fill:#888,color:#fff
875
+ ```
876
+
877
+ **Source File Overlap** — files referenced by 2+ docs (co-change risk):
878
+ ```
879
+ src/handlers/auth.ts → 02-auth-login, 03-oauth-google
880
+ ```
881
+
882
+ **Kept in sync automatically** — every MDD operation that creates, modifies, archives, or upgrades a doc regenerates `connections.md` as its final step. `/mdd status` and `/mdd scan` detect and flag staleness. The file is committed to git (not gitignored) so it's always available without re-running any command.
883
+
803
884
  ---
804
885
 
805
886
  ## The `.mdd/` Directory
@@ -827,7 +908,8 @@ All MDD artifacts live in one place:
827
908
  │ ├── shard-N.md
828
909
  │ ├── agent-N-config.md
829
910
  │ └── agent-N-notes.md
830
- └── .startup.md # Auto-generated session context (read by Claude on start)
911
+ ├── .startup.md # Auto-generated session context (read by Claude on start)
912
+ └── connections.md # Pre-computed relationship map (path tree + Mermaid graph)
831
913
  ```
832
914
 
833
915
  `.mdd/audits/` and `.mdd/jobs/` are automatically added to `.gitignore` on first run. Everything else in `.mdd/` is committed - it's your project's knowledge base.
@@ -192,6 +192,7 @@ status: draft
192
192
  phase: <last completed phase name, or "all" when fully built>
193
193
  mdd_version: <read from mdd.md frontmatter mdd_version field>
194
194
  tags: [<4-8 domain-concept keywords — systems touched, technology, feature names. NOT file paths>]
195
+ path: <Area/Section>
195
196
  known_issues: []
196
197
  ---
197
198
 
@@ -234,6 +235,8 @@ known_issues: []
234
235
 
235
236
  **Always set `last_synced` to today's date** when writing or updating a feature doc. This is what SCAN MODE uses to detect drift. Set `status: draft` for new docs; update to `in_progress` when implementation begins, `complete` when Phase 7 is done.
236
237
 
238
+ **Determine the `path` field** before writing the doc. Read the `path` values of all existing docs in `.mdd/docs/` to understand established product vocabulary and category names. Then ask: "What would a user navigate to in order to reach this feature?" — answer in their mental model of the product, not the code structure. Use 1–3 segments, Title Case, product vocabulary (e.g. `Auth/Login`, `E-commerce/Cart`, `Dashboard/Analytics`). Siblings must use identical parent spelling — if `Auth/Login` exists, use `Auth` not `Authentication`. If you can infer the path from context with confidence, set it and show the user. If genuinely ambiguous (feature could belong in 2+ places), ask: "Where does this feature live in the product? (e.g. `Auth/Login` or `Dashboard/Reports`)"
239
+
237
240
  **After writing the feature doc**, trigger the `.mdd/.startup.md` rebuild (same logic as in Status Mode — rebuild auto-generated zone, preserve Notes zone) so the Features list stays current.
238
241
 
239
242
  Show the completed doc to the user and ask: **"Does this accurately describe what you want to build? Anything to add or change?"**
@@ -607,7 +610,15 @@ where the agent patches the wrong thing because it accepted an external excuse t
607
610
  - `last_synced: <today>`
608
611
  - `mdd_version: <current from mdd.md frontmatter>`
609
612
 
610
- 2. Display the completion signal:
613
+ 2. **Regenerate `.mdd/connections.md`:**
614
+ Read all `.mdd/docs/*.md` (excluding `archive/`) — frontmatter only (id, title, status, path, depends_on, source_files). Never read doc bodies. Then:
615
+ - **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>`.
616
+ - **Mermaid graph:** one node per doc (short node ID), one `-->` edge per `depends_on` entry, `:::<status>` suffix on each node. Include `classDef` block for complete/in_progress/draft/deprecated.
617
+ - **Source overlap:** map source_file → docs that reference it. Include only files with 2+ docs.
618
+ - **Warnings:** broken `depends_on` refs, circular deps, docs missing `path`.
619
+ - **Write** `.mdd/connections.md` with YAML frontmatter (`generated: <today>`, `doc_count`, `connection_count`, `overlap_count`) and four sections: Path Tree, Dependency Graph, Source File Overlap, Warnings.
620
+
621
+ 3. Display the completion signal:
611
622
  ```
612
623
  ✅ MDD Complete: <Feature Name>
613
624
 
@@ -618,6 +629,7 @@ Blocks: <N>/<N> complete
618
629
  Tests: <N>/<N> passing
619
630
  Integration: verified (<feature type> — real environment)
620
631
  Typecheck: clean
632
+ Connections: .mdd/connections.md updated
621
633
 
622
634
  New patterns established: <any new rules worth adding to CLAUDE.md>
623
635
 
@@ -0,0 +1,216 @@
1
+ ## IMPORT SPEC MODE — `/mdd import-spec`
2
+
3
+ Triggered when arguments start with `import-spec`.
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.
6
+
7
+ ---
8
+
9
+ ### Phase IS1 — Read Spec Files
10
+
11
+ Parse file path(s) from the arguments following `import-spec`. Multiple files may be space-separated or specified as a glob.
12
+
13
+ For each file path:
14
+ 1. Verify the file exists. If a path does not exist, stop and report clearly: "File not found: `<path>`"
15
+ 2. Read the full content.
16
+
17
+ If multiple files are provided, merge all content into a single working document. 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.
18
+
19
+ ---
20
+
21
+ ### Phase IS2 — Feature Extraction + Path Grouping
22
+
23
+ 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.
24
+
25
+ #### Step IS2a — Extract features
26
+
27
+ 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.
28
+
29
+ For each identified feature:
30
+ - Name / title
31
+ - Core purpose (1–2 sentences distilled from the spec)
32
+ - All key decisions, constraints, business rules, and edge cases mentioned in the spec
33
+ - Dependencies on other features identified in the same spec
34
+
35
+ 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.
36
+
37
+ #### Step IS2b — Assign paths
38
+
39
+ Read all existing `.mdd/docs/*.md` `path` fields (if any exist) to learn the project's established vocabulary and casing conventions.
40
+
41
+ For each identified feature, determine its `path` value:
42
+ - Use the user's product vocabulary, not code module names
43
+ - Title Case, 1–3 levels, `/`-separated
44
+ - Siblings must use identical parent spelling (if `Auth/Login` exists, new auth docs use `Auth`, not `Authentication`)
45
+
46
+ #### Step IS2c — Determine output structure
47
+
48
+ Count distinct root-level path segments (top-level areas):
49
+
50
+ | Signal | Structure |
51
+ |--------|-----------|
52
+ | 3+ distinct root areas AND 8+ features | Initiative + Waves + Feature docs |
53
+ | 1–2 root areas AND 4–7 features | Waves + Feature docs (no initiative wrapper) |
54
+ | Any root area count AND 1–3 features | Flat feature docs only |
55
+
56
+ These thresholds are guidelines — apply judgment. A 3-feature spec spanning radically different domains can still warrant waves.
57
+
58
+ ---
59
+
60
+ ### Phase IS3 — Dry-Run Preview (mandatory gate)
61
+
62
+ Before writing any files, display the complete proposed structure and wait for explicit user approval.
63
+
64
+ ```
65
+ 📋 Import Spec — Dry Run
66
+
67
+ Source: <filename(s)>
68
+ Features identified: <N> Merged: <N> duplicate/overlapping topics
69
+
70
+ Proposed structure: <Flat docs | Waves | Initiative: "<name>" → Waves>
71
+
72
+ Path Tree:
73
+ <Root Area 1>
74
+ ├── <Section> → <NN>-<slug> (draft)
75
+ └── <Section>
76
+ └── <Sub-section> → <NN>-<slug> (draft)
77
+ <Root Area 2>
78
+ └── <Section> → <NN>-<slug> (draft)
79
+
80
+ IDs assigned: <NN>–<NN> (continuing from existing <prev>)
81
+
82
+ Merge summary:
83
+ "<path>" ← merged from: §<Spec Section A>, §<Spec Section B>
84
+ (one line per merged feature — omit if no merges)
85
+
86
+ Content mapping:
87
+ <NN>-<slug>: §<Spec Section> + §<Spec Section>
88
+ <NN>-<slug>: §<Spec Section>
89
+
90
+ Adjust paths, titles, or grouping? (approve / adjust / abort)
91
+ ```
92
+
93
+ **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.
94
+
95
+ **If the user says "abort":** stop. Write nothing.
96
+
97
+ **Do not proceed to IS4 until the user explicitly approves.**
98
+
99
+ ---
100
+
101
+ ### Phase IS4 — Write Files
102
+
103
+ **If initiative-scale was detected:** Create `.mdd/initiative.md` with:
104
+ - `id`, `title`, `status: planning`, `created: <today>`
105
+ - A brief initiative description derived from the spec's overall theme
106
+ - Wave breakdown: one wave per major root path area or logical phase, each listing its feature doc slugs
107
+
108
+ **For each feature doc in the approved plan:**
109
+
110
+ 1. Auto-number continuing from the highest existing doc number in `.mdd/docs/`
111
+ 2. Write a complete MDD feature doc at `.mdd/docs/<NN>-<slug>.md` using the canonical frontmatter structure:
112
+
113
+ ```markdown
114
+ ---
115
+ id: <NN>-<slug>
116
+ title: <Feature Title>
117
+ edition: <project name or "Both">
118
+ depends_on: [<IDs of other imported features this one depends on>]
119
+ source_files: []
120
+ routes: []
121
+ models: []
122
+ test_files: []
123
+ data_flow: greenfield
124
+ last_synced: <today YYYY-MM-DD>
125
+ status: draft
126
+ phase: documentation
127
+ mdd_version: <read from mdd.md frontmatter>
128
+ tags: [<4–8 domain-concept keywords>]
129
+ path: <Area/Section>
130
+ known_issues: []
131
+ ---
132
+
133
+ # <NN> — <Feature Title>
134
+
135
+ ## Purpose
136
+
137
+ <2–3 sentences from the merged spec content>
138
+
139
+ ## Architecture
140
+
141
+ <How this feature fits into the system, derived from spec decisions>
142
+
143
+ ## Data Model
144
+
145
+ <If the spec describes data structures — omit section if truly not applicable>
146
+
147
+ ## API Endpoints
148
+
149
+ <If the spec describes endpoints — omit section if truly not applicable>
150
+
151
+ ## Business Rules
152
+
153
+ <All decisions, constraints, validation rules, edge cases from the spec>
154
+
155
+ ## Dependencies
156
+
157
+ <Other features this one requires, by doc ID>
158
+
159
+ ## Known Issues
160
+
161
+ (none — imported from spec)
162
+ ```
163
+
164
+ 3. Tags: 4–8 domain-concept keywords. NOT file paths or spec section names.
165
+ 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.
166
+
167
+ **Progress report as you write:**
168
+ ```
169
+ Writing docs...
170
+ ✅ <NN>-<slug>.md (<path>)
171
+ ✅ <NN>-<slug>.md (<path>)
172
+ ...
173
+ ```
174
+
175
+ ---
176
+
177
+ ### Phase IS5 — Rebuild .startup.md
178
+
179
+ Trigger the `.mdd/.startup.md` rebuild:
180
+ - Rebuild the auto-generated zone (Project Snapshot, Features Documented list with IDs, status, and tags)
181
+ - Preserve the Notes zone exactly as-is
182
+ - Update the generated date and current branch
183
+
184
+ Then regenerate connections.md:
185
+
186
+ **Regenerate `.mdd/connections.md`:**
187
+ Read all `.mdd/docs/*.md` (excluding `archive/`) — frontmatter only (id, title, status, path, depends_on, source_files). Never read doc bodies. Then:
188
+ - **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>`.
189
+ - **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`.
190
+ - **Source overlap:** build map of source_file → docs that reference it. Include only files with 2+ docs.
191
+ - **Warnings:** broken `depends_on` refs (target doesn't exist), circular dependencies, docs missing `path`.
192
+ - **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.
193
+
194
+ Then report:
195
+
196
+ ```
197
+ ✅ Import Spec Complete
198
+
199
+ Source: <filename(s)>
200
+ Created: <N> feature docs
201
+ Structure: <Flat | Waves | Initiative + Waves>
202
+
203
+ Docs created:
204
+ <NN>-<slug> <path> draft
205
+ <NN>-<slug> <path> draft
206
+ ...
207
+
208
+ Startup: .mdd/.startup.md rebuilt
209
+ Connections: .mdd/connections.md updated
210
+
211
+ Next steps:
212
+ /mdd <NN> — start building any imported feature
213
+ /mdd audit — run a full audit across all imported docs
214
+ /mdd upgrade — add path fields to any pre-existing docs that are missing them
215
+ /mdd rebuild-tags — regenerate tags if any look thin
216
+ ```
@@ -181,7 +181,7 @@ Save the graph to `.mdd/audits/graph-<date>.md`.
181
181
 
182
182
  Triggered when arguments start with `upgrade`.
183
183
 
184
- Batch-patches missing frontmatter fields (`last_synced`, `status`, `phase`) across ALL `.mdd/docs/*.md` files without touching doc content. Safe to run multiple times — already-present fields are never overwritten.
184
+ Batch-patches missing frontmatter fields (`last_synced`, `status`, `phase`, `tags`, `path`) across ALL `.mdd/docs/*.md` files without touching doc content. Safe to run multiple times — already-present fields are never overwritten.
185
185
 
186
186
  **Use case:** projects that used MDD before these fields were introduced, or after importing docs from another project. Running `/mdd upgrade` converts all UNTRACKED docs to IN SYNC in one pass.
187
187
 
@@ -196,11 +196,11 @@ Batch-patches missing frontmatter fields (`last_synced`, `status`, `phase`) acro
196
196
  ```
197
197
  📋 Upgrade Inventory
198
198
 
199
- Doc | last_synced | status | phase | tags
200
- ─────────────────────────────────|─────────────|────────|───────|──────
201
- 01-project-scaffolding | ❌ missing | ❌ | ❌ | ❌
202
- 02-profile-system | ❌ missing | ✅ | ❌ | ✅
203
- 03-database-layer | ✅ present | ✅ | ✅ | ❌
199
+ Doc | last_synced | status | phase | tags | path
200
+ ─────────────────────────────────|─────────────|────────|───────|──────|──────
201
+ 01-project-scaffolding | ❌ missing | ❌ | ❌ | ❌ | ❌
202
+ 02-profile-system | ❌ missing | ✅ | ❌ | ✅ | ❌
203
+ 03-database-layer | ✅ present | ✅ | ✅ | ❌ | ✅
204
204
  ...
205
205
 
206
206
  Docs needing upgrade: <N> of <total>
@@ -209,6 +209,7 @@ Fields to add:
209
209
  status — <N> docs
210
210
  phase — <N> docs
211
211
  tags — <N> docs (run /mdd rebuild-tags after upgrade to populate)
212
+ path — <N> docs (Claude reads each doc's title + purpose to infer the value)
212
213
  ```
213
214
 
214
215
  4. If 0 docs need upgrade → report "All docs are up to date. Nothing to patch." and stop.
@@ -247,6 +248,17 @@ The goal is the date the doc was last meaningfully worked on. Try in order:
247
248
  3. If `status` resolved to `draft` → `documentation`
248
249
  4. If `status` resolved to `deprecated` → `deprecated`
249
250
 
251
+ **`path` inference:**
252
+
253
+ Unlike other fields, `path` cannot be inferred from git history or status — it requires reading the doc's content.
254
+
255
+ For each doc missing `path`:
256
+ 1. Read its `title` frontmatter field and `## Purpose` section body
257
+ 2. Read all other docs' existing `path` fields to understand the project's established vocabulary and casing conventions
258
+ 3. Propose a `path` value (`Area/Section`, Title Case, 1–3 levels) that reflects where this feature lives in the product — use product terminology, not code module names
259
+
260
+ **Do not silently write `path` values** — always include the proposed values in the Phase UP3 plan for user review. The user may adjust any proposed path before writing.
261
+
250
262
  ---
251
263
 
252
264
  ### Phase UP3 — Show Plan + Confirm
@@ -271,6 +283,7 @@ Present the inferred patches to the user before writing anything:
271
283
  + last_synced: 2026-01-17 (from git: last commit on this doc)
272
284
  + status: complete
273
285
  + phase: all
286
+ + path: Auth/Login (inferred from purpose: "handles user login flow")
274
287
 
275
288
  ... (<N> more)
276
289
 
@@ -311,11 +324,12 @@ status: <new> ← insert here if missing
311
324
  phase: <new> ← insert here if missing
312
325
  mdd_version: <new> ← insert here if missing
313
326
  tags: <new> ← insert here if missing (do not generate tags in upgrade — run /mdd rebuild-tags after)
327
+ path: <new> ← insert here if missing (value inferred from doc content in UP2, confirmed by user in UP3)
314
328
  known_issues: []
315
329
  ---
316
330
  ```
317
331
 
318
- Insert new fields **before** `known_issues` to keep the canonical order. **Do not attempt to generate tag values during upgrade** — tags require reading doc content to produce meaningful keywords. After running upgrade, run `/mdd rebuild-tags` to populate tags on any docs that need them.
332
+ Insert new fields **before** `known_issues` to keep the canonical order. **Do not attempt to generate tag values during upgrade** — tags require reading doc content to produce meaningful keywords; after running upgrade, run `/mdd rebuild-tags` to populate them. **For `path` values**: these ARE inferred by reading doc content during UP2 and confirmed in UP3 — write the user-confirmed values directly.
319
333
 
320
334
  Report progress as you go:
321
335
  ```
@@ -332,9 +346,16 @@ Patching...
332
346
 
333
347
  After all patches are applied:
334
348
 
335
- 1. Re-scan `.mdd/docs/*.md` — confirm 0 docs have missing `last_synced`
349
+ 1. Re-scan `.mdd/docs/*.md` — confirm 0 docs have missing `last_synced` or `path`
336
350
  2. Trigger the `.mdd/.startup.md` rebuild (same logic as Status Mode)
337
- 3. Report:
351
+ 3. **Regenerate `.mdd/connections.md`:**
352
+ Read all `.mdd/docs/*.md` (excluding `archive/`) — frontmatter only (id, title, status, path, depends_on, source_files). Never read doc bodies. Then:
353
+ - **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>`.
354
+ - **Mermaid graph:** one node per doc (short node ID), one `-->` edge per `depends_on` entry, `:::<status>` suffix on each node. Include `classDef` block for complete/in_progress/draft/deprecated.
355
+ - **Source overlap:** map source_file → docs that reference it. Include only files with 2+ docs.
356
+ - **Warnings:** broken `depends_on` refs, circular deps, docs missing `path`.
357
+ - **Write** `.mdd/connections.md` with YAML frontmatter (`generated: <today>`, `doc_count`, `connection_count`, `overlap_count`) and four sections: Path Tree, Dependency Graph, Source File Overlap, Warnings.
358
+ 4. Report:
338
359
 
339
360
  ```
340
361
  ✅ MDD Upgrade Complete
@@ -345,6 +366,7 @@ Fields added:
345
366
  status — <N> docs
346
367
  phase — <N> docs
347
368
  Docs skipped: <N> (all fields already present)
369
+ connections.md: updated (<N> docs, <N> edges)
348
370
 
349
371
  Run `/mdd scan` to see current drift status across all docs.
350
372
  ```
@@ -70,6 +70,15 @@ After collecting status, rebuild the auto-generated zone of `.mdd/.startup.md`:
70
70
  3. Write the rebuilt auto-generated section + `---` divider + preserved Notes section back to `.mdd/.startup.md`. Update `mdd_version` in the file's frontmatter to current.
71
71
  4. If no `.mdd/.startup.md` exists yet, create it fresh using the template with an empty Notes section, stamped with current `mdd_version`.
72
72
 
73
+ ### Check `.mdd/connections.md` Freshness
74
+
75
+ After rebuilding `.startup.md`, check connections.md:
76
+
77
+ 1. If `.mdd/connections.md` does not exist → report: `⚠️ connections.md missing — run /mdd connect to generate`
78
+ 2. Read `generated:` date from connections.md frontmatter. Find the most recent `last_synced` date across all docs.
79
+ - If `generated` < most recent `last_synced` → report: `⚠️ connections.md stale (generated: <X>, newest doc synced: <Y>) — run /mdd connect`
80
+ - If up to date → report: `✅ connections.md current (generated: <X>, <N> docs, <N> edges)`
81
+
73
82
  ---
74
83
 
75
84
  ## NOTE MODE — `/mdd note`
@@ -153,6 +162,7 @@ A classification table — one row per feature:
153
162
 
154
163
  **Classifications:**
155
164
  - **untracked** — `last_synced` missing from frontmatter
165
+ - **no-path** — `path` field missing from frontmatter (run `/mdd upgrade` to add)
156
166
  - **broken** — one or more `source_files` not found on disk
157
167
  - **drifted** — `last_synced` exists, files exist, commits found after `last_synced`
158
168
  - **in_sync** — `last_synced` exists, all files exist, no commits after `last_synced`
@@ -176,11 +186,14 @@ Generated: <YYYY-MM-DD>
176
186
  ❓ 09-integrations — untracked (no last_synced field)
177
187
 
178
188
  Summary: 1 in sync · 1 drifted · 1 broken · 1 untracked
189
+ Missing path: <N> docs — run /mdd upgrade to populate ← omit this line when N = 0
179
190
 
180
191
  Recommended actions:
181
192
  /mdd update 04 — re-sync content-builder doc with code
182
193
  /mdd update 07 — fix broken file reference
183
194
  /mdd update 09 — add last_synced by running update mode
195
+ /mdd upgrade — add path field to <N> docs missing it ← omit this line when there are no docs missing path
196
+ /mdd connect — rebuild connections.md if stale or missing
184
197
  ```
185
198
 
186
199
  **Initiative/wave drift check** (only shown if `.mdd/initiatives/` exists):
@@ -207,6 +220,13 @@ Ops Runbooks:
207
220
  ⚠️ rulecatch-dokploy — runbook edited 3 days ago but no runop since → run /mdd runop rulecatch-dokploy
208
221
  ```
209
222
 
223
+ **Connections map check:**
224
+
225
+ Check `.mdd/connections.md`:
226
+ - Missing → classify as `broken` and include in findings: `❌ connections.md — missing (run /mdd connect)`
227
+ - `generated:` older than most recent `last_synced` → classify as `drifted`: `⚠️ connections.md — stale (run /mdd connect)`
228
+ - Up to date → `✅ connections.md — current`
229
+
210
230
  Save the full report to `.mdd/audits/scan-<date>.md`.
211
231
 
212
232
  ---
@@ -266,6 +286,7 @@ After rewriting, update frontmatter:
266
286
  - `last_synced: <today's date>`
267
287
  - `status:` — ask the user if they want to update the status (e.g., draft → complete)
268
288
  - `phase:` — update to reflect current state
289
+ - `path:` — if the doc is missing a `path` field, offer to add it: "This doc is missing a `path` field. Where does this feature live in the product? (e.g. `Auth/Login`)" — if the user provides a value, write it between `tags` and `known_issues` in the frontmatter.
269
290
 
270
291
  ### Phase U6 — Regenerate test skeletons for new behaviors
271
292
 
@@ -283,6 +304,16 @@ New test skeletons: <N> appended to tests/unit/<feature-name>.test.ts
283
304
  Branch: <current branch>
284
305
  ```
285
306
 
307
+ After updating the doc, regenerate connections.md:
308
+
309
+ **Regenerate `.mdd/connections.md`:**
310
+ Read all `.mdd/docs/*.md` (excluding `archive/`) — frontmatter only (id, title, status, path, depends_on, source_files). Never read doc bodies. Then:
311
+ 1. **Path tree:** sort docs by path alphabetically, then by id within the same path. Render as an indented tree using `├──` / `└──` characters. Each leaf line: `<path-leaf-segment> <id> <status>`.
312
+ 2. **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`.
313
+ 3. **Source overlap:** build a map of source_file → docs that reference it. Include only files with 2+ docs.
314
+ 4. **Warnings:** flag broken `depends_on` references (target does not exist), circular dependencies, docs missing `path` field.
315
+ 5. **Write** `.mdd/connections.md` with YAML frontmatter (`generated: <today>`, `doc_count: <N>`, `connection_count: <N edges>`, `overlap_count: <N overlap files>`) followed by four sections: Path Tree, Dependency Graph (Mermaid), Source File Overlap, Warnings.
316
+
286
317
  ---
287
318
 
288
319
  ## DEPRECATE MODE — `/mdd deprecate <feature-id>`
@@ -327,6 +358,16 @@ If user says yes:
327
358
  5. Ask the user separately: "Delete source files? (yes / no)" and "Delete test files? (yes / no)" — never auto-delete.
328
359
  6. Rebuild `.mdd/.startup.md`.
329
360
 
361
+ Then regenerate connections.md:
362
+
363
+ **Regenerate `.mdd/connections.md`:**
364
+ Read all `.mdd/docs/*.md` (excluding `archive/`) — frontmatter only (id, title, status, path, depends_on, source_files). Never read doc bodies. Then:
365
+ 1. **Path tree:** sort docs by path alphabetically, then by id within the same path. Render as an indented tree using `├──` / `└──` characters. Each leaf line: `<path-leaf-segment> <id> <status>`.
366
+ 2. **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`.
367
+ 3. **Source overlap:** build a map of source_file → docs that reference it. Include only files with 2+ docs.
368
+ 4. **Warnings:** flag broken `depends_on` references (target does not exist), circular dependencies, docs missing `path` field.
369
+ 5. **Write** `.mdd/connections.md` with YAML frontmatter (`generated: <today>`, `doc_count: <N>`, `connection_count: <N edges>`, `overlap_count: <N overlap files>`) followed by four sections: Path Tree, Dependency Graph (Mermaid), Source File Overlap, Warnings.
370
+
330
371
  Report:
331
372
  ```
332
373
  ✅ Deprecated: <NN>-<feature-name>
@@ -385,6 +426,16 @@ For each doc missing `tags:` (or all docs if `--force`):
385
426
 
386
427
  Trigger the `.mdd/.startup.md` rebuild (same logic as Status Mode — rebuild auto-generated zone, preserve Notes zone). The rebuilt startup now reflects tags on every feature and ops line.
387
428
 
429
+ Then regenerate connections.md:
430
+
431
+ **Regenerate `.mdd/connections.md`:**
432
+ Read all `.mdd/docs/*.md` (excluding `archive/`) — frontmatter only (id, title, status, path, depends_on, source_files). Never read doc bodies. Then:
433
+ 1. **Path tree:** sort docs by path alphabetically, then by id within the same path. Render as an indented tree using `├──` / `└──` characters. Each leaf line: `<path-leaf-segment> <id> <status>`.
434
+ 2. **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`.
435
+ 3. **Source overlap:** build a map of source_file → docs that reference it. Include only files with 2+ docs.
436
+ 4. **Warnings:** flag broken `depends_on` references (target does not exist), circular dependencies, docs missing `path` field.
437
+ 5. **Write** `.mdd/connections.md` with YAML frontmatter (`generated: <today>`, `doc_count: <N>`, `connection_count: <N edges>`, `overlap_count: <N overlap files>`) followed by four sections: Path Tree, Dependency Graph (Mermaid), Source File Overlap, Warnings.
438
+
388
439
  ### Phase RT4 — Report
389
440
 
390
441
  ```
@@ -404,3 +455,27 @@ Run /mdd status to see the full updated startup snapshot.
404
455
  ```
405
456
 
406
457
  ---
458
+
459
+ ## CONNECT MODE — `/mdd connect`
460
+
461
+ Triggered when arguments start with `connect`. Performs a full rebuild of `.mdd/connections.md` unconditionally — no staleness check, always regenerates from scratch.
462
+
463
+ **Regenerate `.mdd/connections.md`:**
464
+ Read all `.mdd/docs/*.md` (excluding `archive/`) — frontmatter only (id, title, status, path, depends_on, source_files). Never read doc bodies. Then:
465
+ 1. **Path tree:** sort docs by path alphabetically, then by id within the same path. Render as an indented tree using `├──` / `└──` characters. Each leaf line: `<path-leaf-segment> <id> <status>`.
466
+ 2. **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`.
467
+ 3. **Source overlap:** build a map of source_file → docs that reference it. Include only files with 2+ docs.
468
+ 4. **Warnings:** flag broken `depends_on` references (target does not exist), circular dependencies, docs missing `path` field.
469
+ 5. **Write** `.mdd/connections.md` with YAML frontmatter (`generated: <today>`, `doc_count: <N>`, `connection_count: <N edges>`, `overlap_count: <N overlap files>`) followed by four sections: Path Tree, Dependency Graph (Mermaid), Source File Overlap, Warnings.
470
+
471
+ Report when done:
472
+ ```
473
+ 🔗 connections.md rebuilt
474
+
475
+ Docs: <N>
476
+ Dependency edges: <N>
477
+ Source overlaps: <N files referenced by 2+ docs>
478
+ Warnings: <N> (or "none")
479
+
480
+ ✅ .mdd/connections.md updated (<today>)
481
+ ```
@@ -262,6 +262,16 @@ When all features are `complete`:
262
262
  - `mdd_version: <current from mdd.md frontmatter>`
263
263
  6. Rebuild `.mdd/.startup.md`.
264
264
 
265
+ Then regenerate connections.md:
266
+
267
+ **Regenerate `.mdd/connections.md`:**
268
+ Read all `.mdd/docs/*.md` (excluding `archive/`) — frontmatter only (id, title, status, path, depends_on, source_files). Never read doc bodies. Then:
269
+ - **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>`.
270
+ - **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`.
271
+ - **Source overlap:** build map of source_file → docs that reference it. Include only files with 2+ docs.
272
+ - **Warnings:** broken `depends_on` refs (target doesn't exist), circular dependencies, docs missing `path`.
273
+ - **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
+
265
275
  ---
266
276
 
267
277
  ## PLAN-SYNC MODE — `/mdd plan-sync`
package/commands/mdd.md CHANGED
@@ -115,9 +115,12 @@ Use whichever path contains `mdd-audit.md`. Store it as `$MDD_DIR` and use it fo
115
115
  - If arguments start with `audit` →
116
116
  **Read `$MDD_DIR/mdd-audit.md` then follow its AUDIT MODE instructions.**
117
117
 
118
- - If arguments start with `status`, `note`, `scan`, `update`, `deprecate`, or `rebuild-tags` →
118
+ - If arguments start with `status`, `note`, `scan`, `update`, `deprecate`, `rebuild-tags`, or `connect`
119
119
  **Read `$MDD_DIR/mdd-manage.md` then follow the relevant mode instructions.**
120
120
 
121
+ - If arguments start with `import-spec` →
122
+ **Read `$MDD_DIR/mdd-import-spec.md` then follow its IMPORT SPEC MODE instructions.**
123
+
121
124
  - If arguments start with `reverse-engineer`, `reverse`, `graph`, or `upgrade` →
122
125
  **Read `$MDD_DIR/mdd-lifecycle.md` then follow the relevant mode instructions.**
123
126
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thedecipherist/mdd",
3
- "version": "1.3.9",
3
+ "version": "1.5.0",
4
4
  "description": "MDD — Manual-Driven Development workflow for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {