@thedecipherist/mdd 1.0.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 +227 -0
- package/commands/mdd-audit.md +237 -0
- package/commands/mdd-build.md +678 -0
- package/commands/mdd-lifecycle.md +350 -0
- package/commands/mdd-manage.md +340 -0
- package/commands/mdd-ops.md +378 -0
- package/commands/mdd-plan.md +347 -0
- package/commands/mdd.md +152 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +27 -0
- package/dist/cli.js.map +1 -0
- package/dist/install.d.ts +7 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +91 -0
- package/dist/install.js.map +1 -0
- package/package.json +48 -0
package/README.md
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/mdd_hero.webp" alt="MDD — Manual-Driven Development for Claude Code" width="100%" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# MDD — Manual-Driven Development for Claude Code
|
|
6
|
+
|
|
7
|
+
> **One command. Twenty-one modes. Complete feature lifecycle from documentation to verified deployment.**
|
|
8
|
+
|
|
9
|
+
MDD turns Claude Code from a code generator into a structured development partner. Every feature starts with documentation. Every fix starts with an audit. No exceptions.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install -g @thedecipherist/mdd
|
|
13
|
+
mdd install
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Then in Claude Code:
|
|
17
|
+
```
|
|
18
|
+
/mdd add user authentication with JWT tokens
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Why MDD?
|
|
24
|
+
|
|
25
|
+
Most people prompt Claude Code like this: *"fix the bug in my auth system."* Claude reads 40 files, burns through context trying to understand your architecture, and produces something that technically compiles but misses the bigger picture.
|
|
26
|
+
|
|
27
|
+
MDD flips this. You write structured documentation first, then Claude reads **one doc** instead of 40 files. It gets the full picture in 200 tokens instead of 20,000.
|
|
28
|
+
|
|
29
|
+
**The workflow: Document → Audit → Fix → Verify**
|
|
30
|
+
|
|
31
|
+
| Phase | What happens |
|
|
32
|
+
|-------|-------------|
|
|
33
|
+
| 📋 Document | Write feature docs with YAML frontmatter in `.mdd/docs/` |
|
|
34
|
+
| 🔍 Audit | Read source code, write incremental notes to disk (survives compaction) |
|
|
35
|
+
| 📊 Analyze | Read notes only → produce severity-rated findings report |
|
|
36
|
+
| 🔧 Fix | Execute pre-planned fixes with tests |
|
|
37
|
+
| ✅ Verify | Tests pass, types check, documentation updated |
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install -g @thedecipherist/mdd
|
|
45
|
+
mdd install # copies Claude commands to ~/.claude/commands/
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
mdd update # update to latest version
|
|
50
|
+
mdd install --dir /custom/path # install to a custom directory
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
After running `mdd install`, the `/mdd` command is available in every Claude Code session globally — no per-project setup needed.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Usage
|
|
58
|
+
|
|
59
|
+
### Build a new feature
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
/mdd add user authentication with JWT tokens
|
|
63
|
+
/mdd build payment integration with Stripe
|
|
64
|
+
/mdd create admin dashboard for user management
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Claude interviews you about requirements, writes structured documentation, generates test skeletons (red gate), presents a block-by-block build plan, implements with a 5-iteration green gate loop, then verifies against the real runtime environment.
|
|
68
|
+
|
|
69
|
+
### Audit existing code
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
/mdd audit # full codebase audit
|
|
73
|
+
/mdd audit database # audit a specific section
|
|
74
|
+
/mdd audit authentication # audit just auth-related code
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Scales across parallel agents (1–8 depending on file count). Notes written to disk every file so findings survive context compaction. Produces a severity-rated report (P1 Critical → P4 Low) with effort estimates.
|
|
78
|
+
|
|
79
|
+
### Day-to-day operations
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
/mdd status # overview: docs, tests, audit state, drift
|
|
83
|
+
/mdd scan # detect features whose source files changed since last session
|
|
84
|
+
/mdd update 04 # re-sync a feature doc after code changes
|
|
85
|
+
/mdd note "switched to PostgreSQL" # append a timestamped note to session context
|
|
86
|
+
/mdd commands # show this reference table in Claude
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Feature lifecycle
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
/mdd reverse-engineer src/handlers/payments.ts # generate docs from undocumented code
|
|
93
|
+
/mdd graph # dependency map with broken/risky dep warnings
|
|
94
|
+
/mdd deprecate 03 # retire a feature cleanly, flag dependents
|
|
95
|
+
/mdd upgrade # batch-patch missing frontmatter across all docs
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Initiative & wave planning
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
/mdd plan-initiative "auth system" # create a multi-wave initiative
|
|
102
|
+
/mdd plan-wave auth-system "Auth Foundation" # plan a wave with a demo state
|
|
103
|
+
/mdd plan-execute auth-system-wave-1 # implement all features in a wave
|
|
104
|
+
/mdd plan-sync auth-system # re-stamp waves after initiative changes
|
|
105
|
+
/mdd plan-remove-feature auth-system-wave-1 auth-signup
|
|
106
|
+
/mdd plan-cancel-initiative auth-system
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Ops runbooks
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
/mdd ops deploy swarmk to dokploy # create a deployment runbook
|
|
113
|
+
/mdd ops list # list all runbooks (global + project)
|
|
114
|
+
/mdd runop swarmk-dokploy # execute: pre-flight → canary → primary → post-flight
|
|
115
|
+
/mdd update-op swarmk-dokploy # edit an existing runbook
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## What Gets Installed
|
|
121
|
+
|
|
122
|
+
`mdd install` copies 7 files to `~/.claude/commands/`:
|
|
123
|
+
|
|
124
|
+
| File | Contents | Lines |
|
|
125
|
+
|------|----------|-------|
|
|
126
|
+
| `mdd.md` | Router — Steps 0/0a/0b, mode dispatch, auto-branch | ~120 |
|
|
127
|
+
| `mdd-build.md` | BUILD MODE — Phases 0–7d (branch check, understand, data flow, docs, test skeletons, red gate, plan, implement, verify, commit) | ~680 |
|
|
128
|
+
| `mdd-audit.md` | AUDIT MODE — Phases A1–A7 (scope, agent config, parallel execution, convergence, merge, analyze, fix) | ~240 |
|
|
129
|
+
| `mdd-manage.md` | STATUS + NOTE + SCAN + UPDATE + DEPRECATE modes | ~340 |
|
|
130
|
+
| `mdd-lifecycle.md` | REVERSE-ENGINEER + GRAPH + UPGRADE modes | ~350 |
|
|
131
|
+
| `mdd-plan.md` | PLAN-INITIATIVE + PLAN-WAVE + PLAN-EXECUTE + PLAN-SYNC + PLAN-REMOVE-FEATURE + PLAN-CANCEL-INITIATIVE modes | ~350 |
|
|
132
|
+
| `mdd-ops.md` | OPS DOCUMENT + OPS EXECUTE + OPS UPDATE + OPS LIST + COMMANDS modes | ~380 |
|
|
133
|
+
|
|
134
|
+
The router loads only the mode file needed for each invocation — a `/mdd status` loads ~460 tokens instead of the full ~28,000. The full set is available but never loaded unnecessarily.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## The `.mdd/` Directory
|
|
139
|
+
|
|
140
|
+
All MDD artifacts live in a single dotfile directory:
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
.mdd/
|
|
144
|
+
├── docs/ # Feature documentation (one .md per feature)
|
|
145
|
+
│ ├── 01-<feature-name>.md # auto-numbered, YAML frontmatter
|
|
146
|
+
│ └── archive/ # Deprecated feature docs
|
|
147
|
+
├── initiatives/ # Initiative files (/mdd plan-initiative)
|
|
148
|
+
├── waves/ # Wave files (/mdd plan-wave)
|
|
149
|
+
├── ops/ # Ops runbooks (/mdd ops)
|
|
150
|
+
├── audits/ # Audit artifacts (gitignored)
|
|
151
|
+
│ ├── flow-<feature>-<date>.md # Data flow analysis (Phase 2)
|
|
152
|
+
│ ├── notes-<date>.md # Raw reading notes (Audit Phase A2)
|
|
153
|
+
│ ├── report-<date>.md # Severity-rated findings (Audit Phase A3)
|
|
154
|
+
│ ├── scan-<date>.md # Drift report (/mdd scan)
|
|
155
|
+
│ └── graph-<date>.md # Dependency graph (/mdd graph)
|
|
156
|
+
├── jobs/ # Active audit jobs (gitignored, auto-deleted)
|
|
157
|
+
└── .startup.md # Auto-generated session context
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
`.mdd/audits/` and `.mdd/jobs/` are automatically added to `.gitignore` on first run.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Build Mode in Detail
|
|
165
|
+
|
|
166
|
+
Build mode runs 7 phases with 3 mandatory gates:
|
|
167
|
+
|
|
168
|
+
**Pipeline:** Understand → Analyze → Document → Test Skeletons → **Red Gate** → Plan → Implement → **Green Gate** → Verify → **Integration Gate**
|
|
169
|
+
|
|
170
|
+
- **Phase 1** gathers context using 3 parallel Explore agents (rules, existing features, codebase structure)
|
|
171
|
+
- **Phase 2** is a mandatory Data Flow & Impact Analysis gate — traces every data value end-to-end before writing a line of docs; automatically skipped on greenfield projects
|
|
172
|
+
- **Red Gate** runs every test skeleton to confirm it actually fails before implementation begins
|
|
173
|
+
- Build plan uses commit-worthy blocks with runnable end-states, verification commands, and handoff contracts; independent blocks annotated for parallel execution
|
|
174
|
+
- **Green Gate** implements each block with a 5-iteration diagnosis-first loop — states root cause before each fix; stops at 5 and escalates rather than continuing blindly
|
|
175
|
+
- **Integration Gate** verifies real behavior (real HTTP calls, real DB, real browser) before marking complete
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Audit Mode in Detail
|
|
180
|
+
|
|
181
|
+
Audit mode scales with file count (1–8 parallel agents):
|
|
182
|
+
|
|
183
|
+
| Files in scope | Agents |
|
|
184
|
+
|---|---|
|
|
185
|
+
| < 10 | 1 (single-agent mode) |
|
|
186
|
+
| 10–25 | 2 |
|
|
187
|
+
| 26–50 | 3 |
|
|
188
|
+
| 51–100 | 5 |
|
|
189
|
+
| 100+ | 8 |
|
|
190
|
+
|
|
191
|
+
Each agent gets a shard of files and a config file. Agents clear context between every file — every file gets a full context window with maximum analysis budget. Notes are written to disk so findings survive compaction. The manifest tracks `[ ] pending → [~] in progress → [x] complete → [!] findings → [e] error` for every file.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## MDD Versioning
|
|
196
|
+
|
|
197
|
+
Every feature doc, wave, and initiative created by MDD is stamped with `mdd_version: N` in its frontmatter. `/mdd status` shows a breakdown of which docs are on which version. `mdd install` compares `mdd_version` between the installed and available versions before overwriting — no silent overwrites.
|
|
198
|
+
|
|
199
|
+
The current MDD version is `8` (bumped with each release to this package).
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Real Results: Self-Audit
|
|
204
|
+
|
|
205
|
+
The [Claude Code Mastery Starter Kit](https://github.com/TheDecipherist/claude-code-mastery-project-starter-kit) used MDD to audit itself:
|
|
206
|
+
|
|
207
|
+
| Audit Step | Time | Output |
|
|
208
|
+
|------------|------|--------|
|
|
209
|
+
| Create Docs (pre-audit) | ~25 min | 9 feature docs in `.mdd/docs/` |
|
|
210
|
+
| A2: Read + Notes | 9 min 51s | 57+ files read, 837 lines of notes |
|
|
211
|
+
| A3: Analyze | 2 min 39s | 298-line report, 20 findings |
|
|
212
|
+
| A5: Fix All | 10 min 53s | 17/20 fixed, 125 tests written |
|
|
213
|
+
| **Total** | **~48 min** | **20 findings, 125 tests from zero** |
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Companion Tools
|
|
218
|
+
|
|
219
|
+
- **[mdd-tui](https://github.com/TheDecipherist/mdd-tui)** — Terminal dashboard for browsing your `.mdd/` workspace (docs, audits, graph, ops runbooks) in a live TUI. Install: `npm install -g @thedecipherist/mdd-tui`
|
|
220
|
+
- **[Claude Code Mastery Starter Kit](https://github.com/TheDecipherist/claude-code-mastery-project-starter-kit)** — Full project scaffolding with hooks, rules, skills, and agents. MDD is one component of the kit.
|
|
221
|
+
- **[strictdb](https://www.npmjs.com/package/strictdb)** — Database wrapper with guardrails used across starter kit projects
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## License
|
|
226
|
+
|
|
227
|
+
MIT — [TheDecipherist](https://github.com/TheDecipherist)
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
## AUDIT MODE — `/mdd audit [section]`
|
|
2
|
+
|
|
3
|
+
Triggered when arguments start with `audit`.
|
|
4
|
+
|
|
5
|
+
### Phase A1 — Scope
|
|
6
|
+
|
|
7
|
+
**Stale job detection (runs first):** Check `.mdd/jobs/` for any existing `audit-*/` folder.
|
|
8
|
+
- If found: check whether a corresponding `audits/report-<date>.md` exists.
|
|
9
|
+
- If yes: job completed but cleanup failed — delete the stale jobs folder and proceed normally.
|
|
10
|
+
- If no: job was interrupted — read `MANIFEST.md` from the jobs folder and count complete vs total entries. Present to user:
|
|
11
|
+
```
|
|
12
|
+
Found interrupted audit from <date>.
|
|
13
|
+
MANIFEST shows <done>/<total> files complete.
|
|
14
|
+
|
|
15
|
+
[R] Resume — continue from where it left off
|
|
16
|
+
[D] Discard — delete and start fresh
|
|
17
|
+
```
|
|
18
|
+
- Resume: reuse the existing job folder, existing agent notes, pick up from the first `[ ]` in the manifest. Files already marked `[x]`, `[!]`, or `[e]` are never re-processed. Skip to Phase A3.
|
|
19
|
+
- Discard: delete the jobs folder, proceed normally.
|
|
20
|
+
|
|
21
|
+
**Scope resolution:**
|
|
22
|
+
1. **Read all `.mdd/docs/*.md` files** — build the feature map. Also read all `.mdd/ops/*.md` files — check for: missing mandatory sections, literal credential values (critical violation), stale `last_synced`, services with no `health_check` defined.
|
|
23
|
+
2. **If no `.mdd/` directory exists:** Create it with `docs/`, `audits/`, `ops/`, and `jobs/` subdirectories. Then tell the user: "No MDD documentation found. Run `/mdd` for each feature to create docs first, or I can scan the codebase and create them now. Which do you prefer?"
|
|
24
|
+
- If "scan": read all source files and generate documentation files (Phase 0)
|
|
25
|
+
- If "manual": exit and let the user create docs per feature
|
|
26
|
+
3. Resolve every source file referenced across all feature docs. Deduplicate (same file may appear in multiple feature docs).
|
|
27
|
+
|
|
28
|
+
**Incremental vs full (only when a previous completed audit exists):**
|
|
29
|
+
```
|
|
30
|
+
A completed audit exists from <date>.
|
|
31
|
+
|
|
32
|
+
[F] Full audit — regenerate manifest from all source files
|
|
33
|
+
Use when: significant new code added, want a clean baseline, or last audit was >2 weeks ago
|
|
34
|
+
[I] Incremental — manifest contains only files modified since <date>
|
|
35
|
+
Use when: applied fixes and want to verify them, or auditing only a new feature
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Agent scaling:**
|
|
39
|
+
|
|
40
|
+
| Files in scope | Agents |
|
|
41
|
+
|---|---|
|
|
42
|
+
| < 10 | 1 (Single-Feature Audit Mode — see below) |
|
|
43
|
+
| 10–25 | 2 |
|
|
44
|
+
| 26–50 | 3 |
|
|
45
|
+
| 51–100 | 5 |
|
|
46
|
+
| 100+ | 8 (default ceiling) |
|
|
47
|
+
|
|
48
|
+
Default ceiling is 8. Overridable via `MDD_MAX_AGENTS` environment variable. Values below 1 fall back to 1. The scale table still determines count within the ceiling — `MDD_MAX_AGENTS` only raises or lowers the cap.
|
|
49
|
+
|
|
50
|
+
**Shard sizing:** Balanced by estimated token load (file size), not raw file count. Main inspects file sizes before assigning and redistributes to keep shards roughly equal in estimated read cost.
|
|
51
|
+
|
|
52
|
+
**Create the job folder and write MANIFEST.md (nothing else proceeds until the manifest exists on disk):**
|
|
53
|
+
|
|
54
|
+
Create `.mdd/jobs/audit-<date>/` and write `MANIFEST.md`:
|
|
55
|
+
|
|
56
|
+
```markdown
|
|
57
|
+
# Audit Manifest
|
|
58
|
+
# Job: audit-<date>
|
|
59
|
+
# Generated: <ISO timestamp>
|
|
60
|
+
# Total files: <N>
|
|
61
|
+
# Agents: <N>
|
|
62
|
+
# Status: IN PROGRESS
|
|
63
|
+
#
|
|
64
|
+
# States: [ ] pending [~] in progress [x] complete [!] findings [e] error
|
|
65
|
+
|
|
66
|
+
## Shard 1 (Agent 1) — files 1-<N>
|
|
67
|
+
[ ] src/handlers/auth.ts
|
|
68
|
+
[ ] src/handlers/users.ts
|
|
69
|
+
...
|
|
70
|
+
|
|
71
|
+
## Shard 2 (Agent 2) — files <N+1>-<M>
|
|
72
|
+
[ ] src/handlers/billing.ts
|
|
73
|
+
...
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
### Phase A2 — Per-Agent Config Setup
|
|
79
|
+
|
|
80
|
+
Main writes a shard file and config file for each agent into the job folder **before spawning anything**.
|
|
81
|
+
|
|
82
|
+
**`shard-N.md`** — flat list of files assigned to this agent, extracted from the manifest. The agent uses this to know its scope without parsing the full manifest.
|
|
83
|
+
|
|
84
|
+
**`agent-N-config.md`** format:
|
|
85
|
+
|
|
86
|
+
```markdown
|
|
87
|
+
# Agent <N> Audit Config
|
|
88
|
+
|
|
89
|
+
## Identity
|
|
90
|
+
You are Audit Agent <N> of <total>.
|
|
91
|
+
Job: audit-<date>
|
|
92
|
+
|
|
93
|
+
## Paths (relative to project root)
|
|
94
|
+
Shard file: .mdd/jobs/audit-<date>/shard-<N>.md
|
|
95
|
+
Notes file: .mdd/jobs/audit-<date>/agent-<N>-notes.md
|
|
96
|
+
Manifest: .mdd/jobs/audit-<date>/MANIFEST.md
|
|
97
|
+
|
|
98
|
+
## Rules
|
|
99
|
+
- Write findings to your notes file ONLY. Never touch another agent's file.
|
|
100
|
+
- Mark each file in MANIFEST before clearing context.
|
|
101
|
+
- Clear context after every single file — no exceptions.
|
|
102
|
+
- On every startup (including post-clear): follow STARTUP SEQUENCE below.
|
|
103
|
+
|
|
104
|
+
## Startup Sequence
|
|
105
|
+
1. Read this config file
|
|
106
|
+
2. Read shard-<N>.md to know your file list
|
|
107
|
+
3. Read MANIFEST.md — find the first [ ] entry in Shard <N>
|
|
108
|
+
4. Read the last 20 lines of agent-<N>-notes.md for continuity
|
|
109
|
+
5. Begin the per-file loop at that first [ ] entry
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
This config file contains no source code or findings — only paths and instructions. It is the only thing an agent needs to resume correctly after a context clear.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### Phase A3 — Parallel Agent Execution
|
|
117
|
+
|
|
118
|
+
Main spawns all agents simultaneously. Each agent receives only the path to its config file.
|
|
119
|
+
|
|
120
|
+
**Per-file loop (each agent follows exactly):**
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
STARTUP (run on every fresh start and after every context clear):
|
|
124
|
+
1. Read agent-N-config.md
|
|
125
|
+
2. Read shard-N.md
|
|
126
|
+
3. Read MANIFEST.md — find first [ ] in own shard
|
|
127
|
+
4. Read last 20 lines of agent-N-notes.md for continuity
|
|
128
|
+
5. Begin per-file loop
|
|
129
|
+
|
|
130
|
+
PER-FILE LOOP:
|
|
131
|
+
1. Mark file as [~] in MANIFEST.md ← write to disk first
|
|
132
|
+
2. Read the source file fully
|
|
133
|
+
3. Analyze against audit criteria
|
|
134
|
+
4. Append to agent-N-notes.md:
|
|
135
|
+
## src/handlers/auth.ts
|
|
136
|
+
<findings, or "No issues found">
|
|
137
|
+
5. Mark file as [x] or [!] in MANIFEST.md ← [!] = has findings
|
|
138
|
+
6. Clear context ← every file, no exceptions
|
|
139
|
+
7. On restart: run STARTUP above
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Hard rules:**
|
|
143
|
+
- Write to own notes file ONLY — never another agent's file
|
|
144
|
+
- Checkpoint order: mark `[~]` → read → analyze → write notes → mark `[x]`/`[!]` → clear. Never clear before the final mark.
|
|
145
|
+
- If a file cannot be read (missing, binary, too large): mark `[e]` in manifest, append one-line error to notes, proceed to next file
|
|
146
|
+
- Skip any file already marked `[x]`, `[!]`, or `[e]` — never re-process
|
|
147
|
+
|
|
148
|
+
**Why clear after every file:** Every file gets a full, fresh context window with maximum analysis budget. The notes file and manifest are the memory — the analysis does not need to survive the clear.
|
|
149
|
+
|
|
150
|
+
**Why mark `[~]` before reading:** A stuck `[~]` is re-processed at convergence. Duplicate analysis is better than missing analysis.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
### Phase A4 — Convergence Check
|
|
155
|
+
|
|
156
|
+
After all agents signal completion, main reads `MANIFEST.md` and checks for any `[ ]` or `[~]` entries.
|
|
157
|
+
|
|
158
|
+
- **`[ ]` entries:** agent never reached this file — re-run that agent's shard for remaining files
|
|
159
|
+
- **`[~]` entries:** agent cleared between `[~]` mark and final mark — re-process that file
|
|
160
|
+
- **`[e]` entries:** main attempts to read the file itself; if still unreadable, it remains `[e]` and is flagged in the final report as unaudited with the reason
|
|
161
|
+
|
|
162
|
+
Audit does not advance to Phase A5 until every file is `[x]`, `[!]`, or `[e]`.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
### Phase A5 — Merge
|
|
167
|
+
|
|
168
|
+
Main merges all agent notes into the canonical output file:
|
|
169
|
+
|
|
170
|
+
1. Read `MANIFEST.md` to get canonical file order
|
|
171
|
+
2. For each file in manifest order, locate its `## <filepath>` section in the correct agent notes file
|
|
172
|
+
3. Append to `audits/notes-<date>.md` in that order
|
|
173
|
+
4. Verify entry count in `audits/notes-<date>.md` matches manifest file count
|
|
174
|
+
|
|
175
|
+
Merge is in manifest order, not agent completion order. The job folder is not touched during or after merge — all temp files remain until the report is confirmed in Phase A6.
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
### Phase A6 — Analyze
|
|
180
|
+
|
|
181
|
+
Read ONLY `audits/notes-<date>.md` (NOT source code again). Produce `audits/report-<date>.md` — include `mdd_version: <current from mdd.md frontmatter>` as the first line of frontmatter:
|
|
182
|
+
|
|
183
|
+
1. Executive summary
|
|
184
|
+
2. Feature completeness matrix
|
|
185
|
+
3. Findings by severity (P1 Critical / P2 High / P3 Medium / P4 Low)
|
|
186
|
+
4. Test coverage summary
|
|
187
|
+
5. Fix plan with effort estimates and affected files per finding
|
|
188
|
+
|
|
189
|
+
**Once `audits/report-<date>.md` is confirmed written and non-empty:**
|
|
190
|
+
1. Copy `jobs/audit-<date>/MANIFEST.md` → `audits/MANIFEST-<date>.md`
|
|
191
|
+
2. Delete entire `jobs/audit-<date>/` folder
|
|
192
|
+
|
|
193
|
+
The manifest is kept permanently in `audits/` — `[x]` vs `[!]` per file shows what had findings without parsing the full notes file.
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
### Phase A7 — Present Findings + Fix
|
|
198
|
+
|
|
199
|
+
Show the user:
|
|
200
|
+
```
|
|
201
|
+
🔍 MDD Audit Complete
|
|
202
|
+
|
|
203
|
+
Findings: <N> total (<N> P1 Critical, <N> P2 High, <N> P3 Medium, <N> P4 Low)
|
|
204
|
+
Report: .mdd/audits/report-<date>.md
|
|
205
|
+
MANIFEST: .mdd/audits/MANIFEST-<date>.md (<N> files with findings / <total> audited)
|
|
206
|
+
|
|
207
|
+
Top issues:
|
|
208
|
+
1. <most critical finding>
|
|
209
|
+
2. <second most critical>
|
|
210
|
+
3. <third most critical>
|
|
211
|
+
|
|
212
|
+
Estimated fix time: <N> hours (traditional) → <N> minutes (MDD)
|
|
213
|
+
|
|
214
|
+
Fix all now? (yes / review report first / fix only P1+P2)
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**After the report is written**, trigger the `.mdd/.startup.md` rebuild (same logic as in Status Mode — rebuild auto-generated zone, preserve Notes zone) so the Last Audit block reflects the new findings regardless of whether the user proceeds with fixes.
|
|
218
|
+
|
|
219
|
+
If user says yes (or selects a subset):
|
|
220
|
+
|
|
221
|
+
**Fix loop:** Read the findings report. For each finding to fix:
|
|
222
|
+
1. Read the specific source files
|
|
223
|
+
2. Apply the fix
|
|
224
|
+
3. Write or update tests
|
|
225
|
+
4. Run tests after each fix group
|
|
226
|
+
|
|
227
|
+
Report progress per finding. Update documentation `known_issues` to remove fixed items. Update `mdd_version` to current on every `.mdd/docs/*.md` file that is edited during fixes.
|
|
228
|
+
|
|
229
|
+
**After fixes are complete and results are written to `.mdd/audits/results-<date>.md`**, trigger the `.mdd/.startup.md` rebuild so the Last Audit block reflects the new numbers.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
### Single-Feature Audit Mode
|
|
234
|
+
|
|
235
|
+
When running `/mdd audit <section>` with fewer than 10 resolved files, skip the shard/config/agent system. Main conversation runs the per-file loop directly — context clear between each file, writing to a single `agent-1-notes.md` in the job folder. The job folder structure and completion sequence are otherwise identical.
|
|
236
|
+
|
|
237
|
+
---
|