@thedecipherist/mdd 1.6.0 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,10 +31,18 @@ A completed audit exists from <date>.
31
31
 
32
32
  [F] Full audit — regenerate manifest from all source files
33
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>
34
+ [I] Incremental — manifest contains only files whose content changed since last audit
35
35
  Use when: applied fixes and want to verify them, or auditing only a new feature
36
36
  ```
37
37
 
38
+ For incremental scope, use git to detect truly changed files — not mtime, which is unreliable:
39
+ ```bash
40
+ git diff --name-only <last-audit-commit> # files changed since audit commit
41
+ git ls-files --others --exclude-standard # untracked new files
42
+ ```
43
+ If no audit commit is recorded, fall back to files modified after `audits/MANIFEST-<date>.md` mtime.
44
+ Store the current HEAD commit in the job folder (`job-commit.txt`) so future incremental audits have an exact reference point. Files modified and then reverted will NOT appear in the diff — correct behaviour.
45
+
38
46
  **Agent scaling:**
39
47
 
40
48
  | Files in scope | Agents |
@@ -224,6 +232,12 @@ Read ONLY `audits/notes-<date>.md` (NOT source code again). Produce `audits/repo
224
232
  5. Fix plan with effort estimates and affected files per finding
225
233
  6. Root Cause Analysis — for each cluster of findings, explain WHY the code writer made the mistake (not just what is wrong). Common root causes: "security module built in isolation without integration contracts," "immutability described in spec but not enforced at the code level," "MCP tool written without a threat model," "node type added after transformation function was written."
226
234
  7. Prevention Rules — derive concrete, actionable rules that would have prevented each finding cluster. Format: "When implementing X, always Y. Never Z. Reasoning: [which finding caused this]." These rules are proposed for addition to CLAUDE.md at the end of the audit.
235
+ 8. MDD Workflow Self-Improvement — for each finding, ask: "Could the MDD audit criteria, build phase requirements, or doc field definitions have caught or prevented this?" Only flag patterns that would recur across different projects — skip purely project-specific issues (business logic, naming, one-off mistakes). Classify each as:
236
+ - `[criteria-gap]` — not covered by current audit criteria; suggest exact wording for a new P1/P2/P3/P4 rule
237
+ - `[criteria-ambiguous]` — covered in criteria but wording too vague to reliably catch; suggest sharper wording or a concrete example
238
+ - `[build-gap]` — the build phase doc or test requirements should have forced something that would have prevented this; suggest the exact addition to mdd-build.md
239
+ - `[doc-field-gap]` — a new feature doc frontmatter field would have surfaced this earlier; suggest the field name and schema
240
+ For each item, name the exact MDD file and section that needs changing.
227
241
 
228
242
  **Integration contract cross-check (in addition to per-file analysis):**
229
243
  After per-file analysis is complete, read all `.mdd/docs/*.md` and:
@@ -266,11 +280,22 @@ Fix all now? (yes / review report first / fix only P1+P2)
266
280
 
267
281
  If user says yes (or selects a subset):
268
282
 
269
- **Fix loop:** Read the findings report. For each finding to fix:
270
- 1. Read the specific source files
283
+ **Fix loop:**
284
+
285
+ Detect test runner once from `package.json` scripts (look for `test:unit`, `test`, `vitest`, `jest`, `pytest`, `go test`). Identify the file-scope flag for that runner:
286
+ - Vitest / Jest: `pnpm test:unit -- <path/to/file.test.ts>`
287
+ - pytest: `pytest <path/to/test_file.py>`
288
+ - Go: `go test ./<package>/...`
289
+
290
+ For each finding to fix:
291
+ 1. Read the specific source file(s)
271
292
  2. Apply the fix
272
- 3. Write or update tests
273
- 4. Run tests after each fix group
293
+ 3. Write or update the corresponding test file(s)
294
+ 4. Run ONLY the test file(s) that cover the changed source — not the full suite.
295
+ Derive test path from source path by convention (e.g. `src/foo/bar.ts` → `tests/unit/foo/bar.test.ts`).
296
+ If the mapping is ambiguous, grep for imports of the changed file to find the right test.
297
+
298
+ After ALL findings are fixed: run the full test suite once as a regression check.
274
299
 
275
300
  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.
276
301
 
@@ -278,6 +303,70 @@ Report progress per finding. Update documentation `known_issues` to remove fixed
278
303
 
279
304
  ---
280
305
 
306
+ ### Phase A8 — MDD Self-Review
307
+
308
+ Runs at the end of every audit, after fixes (or immediately after A7 if user chose not to fix now).
309
+
310
+ **Step 1 — Extract self-improvement items**
311
+
312
+ Read the "MDD Workflow Self-Improvement" section from `audits/report-<date>.md`. If there are zero items, skip to Step 3 with a one-line note.
313
+
314
+ **Step 2 — Append to persistent learnings log**
315
+
316
+ Append to `.mdd/audits/mdd-learnings.md` (create if it does not exist):
317
+
318
+ ```markdown
319
+ ## <date> — <audit-scope> (<N> workflow items)
320
+
321
+ ### [<classification>] <short title>
322
+ - **Finding**: <what was found in the project>
323
+ - **Severity**: <P1/P2/P3/P4> — <N> instance(s)
324
+ - **Why MDD missed it**: <one sentence>
325
+ - **Suggested MDD change**: <exact rule wording or field name to add>
326
+ - **Affects**: `<mdd-file.md>` — <section name>
327
+ - **Status**: pending
328
+ ```
329
+
330
+ Classifications: `criteria-gap` | `criteria-ambiguous` | `build-gap` | `doc-field-gap`
331
+
332
+ Never overwrite existing entries. Each audit appends its own dated block. Entries with `Status: pending` are unactioned improvements waiting for a GitHub issue or patch.
333
+
334
+ **Step 3 — Present to user**
335
+
336
+ ```
337
+ 🔧 MDD Workflow Self-Review
338
+
339
+ <N> patterns found that MDD could prevent in future projects:
340
+
341
+ 1. [criteria-gap] <short title> — add P2 rule to mdd-audit.md
342
+ 2. [build-gap] <short title> — update Phase 3 docs in mdd-build.md
343
+ 3. [criteria-ambiguous] <short title> — sharpen P1 wording in mdd-audit.md
344
+ ...
345
+
346
+ Logged to: .mdd/audits/mdd-learnings.md
347
+
348
+ Open a GitHub issue for these improvements?
349
+ [Y] Yes — open issue at https://github.com/TheDecipherist/mdd/issues
350
+ [D] Draft — show me the issue text first
351
+ [N] No — skip for now
352
+ ```
353
+
354
+ **If user selects [Y] or [D]:**
355
+
356
+ Compose a GitHub issue with:
357
+ - **Title**: `Audit self-review: <N> workflow gaps found (<date>)`
358
+ - **Body**:
359
+ - One paragraph summary of the audit context (project type, scope)
360
+ - Numbered list of each improvement item with classification, the exact MDD file/section, and the suggested fix
361
+ - A "Proposed changes" section with ready-to-apply rule wording for each `criteria-gap` and `criteria-ambiguous` item
362
+
363
+ If [D]: display the draft and ask "Open this issue? (yes / edit / cancel)".
364
+ If [Y]: open the issue immediately using `gh issue create`.
365
+
366
+ After the issue is opened, update the `Status` field of each logged entry in `mdd-learnings.md` from `pending` to `issue: #<number>`.
367
+
368
+ ---
369
+
281
370
  ### Single-Feature Audit Mode
282
371
 
283
372
  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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thedecipherist/mdd",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "description": "MDD — Manual-Driven Development workflow for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {