@thedecipherist/mdd 1.6.7 → 1.6.8

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.
@@ -25,6 +25,17 @@ Triggered when arguments start with `audit`.
25
25
  - If "manual": exit and let the user create docs per feature
26
26
  3. Resolve every source file referenced across all feature docs. Deduplicate (same file may appear in multiple feature docs).
27
27
 
28
+ **Feature doc cross-checks (run in Phase A1, before any agents are spawned):**
29
+
30
+ These checks require comparing feature docs to each other and to disk. They cannot be done by per-file agents and must be done here:
31
+
32
+ - For each feature, verify every path in `source_files` exists on disk. Missing files = P2 finding.
33
+ - For each feature with `depends_on` that includes a feature with `integration_contracts`: verify this feature's `satisfies_contracts` is not empty. Missing acknowledgment = P2 finding.
34
+ - For each feature with `satisfies_contracts` entries where `status: pending`: flag every pending entry as P1 — contract was documented but never wired.
35
+ - For each feature with `integration_contracts`: verify every listed `caller_feature` exists as a feature doc. Non-existent caller referenced = P3 finding.
36
+
37
+ Record all findings from this step in a dedicated `audits/doc-findings-<date>.md` file. These are merged into the final report in Phase A5 as a separate "Feature Doc Issues" section.
38
+
28
39
  **Incremental vs full (only when a previous completed audit exists):**
29
40
  ```
30
41
  A completed audit exists from <date>.
@@ -89,6 +100,32 @@ Main writes a shard file and config file for each agent into the job folder **be
89
100
 
90
101
  **`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.
91
102
 
103
+ **`integration-context.md`** — built once by main from all `.mdd/docs/*.md` files and written to the job folder. Every agent reads this at startup. Format:
104
+
105
+ ```markdown
106
+ # Integration Context
107
+ # Job: audit-<date>
108
+
109
+ ## Feature Source Files
110
+ <!-- Maps source files back to the feature that owns them -->
111
+ <feature-name>: src/foo.ts, src/bar.ts
112
+ <feature-name>: src/baz.ts
113
+
114
+ ## Integration Contracts
115
+ <!-- What each security/shared feature requires ALL callers to implement -->
116
+ ### <feature-name>
117
+ - Contract: <description of what caller must call/implement>
118
+ Caller features: <featureA>, <featureB>
119
+ Caller source files: src/a.ts, src/b.ts, src/c.ts
120
+
121
+ ## Satisfied Contracts
122
+ <!-- What each feature has acknowledged and wired -->
123
+ ### <feature-name>
124
+ - Satisfies: <other-feature> contract — status: <done|pending>
125
+ ```
126
+
127
+ If no feature has `integration_contracts`, write an empty file with `# No integration contracts defined`. This file is always created — agents must not fail if it is empty.
128
+
92
129
  **`agent-N-config.md`** format:
93
130
 
94
131
  ```markdown
@@ -99,9 +136,10 @@ You are Audit Agent <N> of <total>.
99
136
  Job: audit-<date>
100
137
 
101
138
  ## Paths (relative to project root)
102
- Shard file: .mdd/jobs/audit-<date>/shard-<N>.md
103
- Notes file: .mdd/jobs/audit-<date>/agent-<N>-notes.md
104
- Manifest: .mdd/jobs/audit-<date>/MANIFEST.md
139
+ Shard file: .mdd/jobs/audit-<date>/shard-<N>.md
140
+ Notes file: .mdd/jobs/audit-<date>/agent-<N>-notes.md
141
+ Manifest: .mdd/jobs/audit-<date>/MANIFEST.md
142
+ Integration context: .mdd/jobs/audit-<date>/integration-context.md
105
143
 
106
144
  ## Rules
107
145
  - Write findings to your notes file ONLY. Never touch another agent's file.
@@ -127,21 +165,20 @@ Manifest: .mdd/jobs/audit-<date>/MANIFEST.md
127
165
  - `console.log` in library code (should use logger)
128
166
  - File exceeds 300 lines
129
167
  - Function exceeds 50 lines
130
- - Feature's `source_files` lists a file that does not exist on disk
131
168
  - Transformation/substitution function handles some but not all AST/domain types (silent fallthrough for unhandled types)
132
169
  - MCP-exposed function accepts untrusted params with no explicit validation
133
170
 
134
171
  ### P3 Medium
135
172
  - TypeScript strict mode not enabled in tsconfig
136
173
  - Missing error handling at system/user-input boundaries
137
- - Feature has `depends_on` entries with `integration_contracts` but `satisfies_contracts` is empty
138
- - Security module's `integration_contracts` specifies a caller that has no `satisfies_contracts` entry
139
174
  - Missing test cases for documented business rules
140
175
  - CLI command missing any of the universal flags (--env, --cwd, --verbose, --strict, --silent) — check all commands against the CLI feature doc's universal flags requirement
141
176
  - `file.*` filesystem helpers or path-resolving functions accept arbitrary paths without confinement to a documented jailRoot
142
177
  - Silent error swallow: catch block returns empty/undefined without pushing to warnings array
143
178
  - Template/substitution function matches `{{varname}}` without spaces but not `{{ varname }}` with spaces — spec uses spaced form; use regex `\s*` not exact string
144
179
 
180
+ **Note:** Feature-doc cross-checks (source_files on disk, integration_contracts vs satisfies_contracts) are handled by main in Phase A1 — not by per-file agents. Do not duplicate those checks here.
181
+
145
182
  ### P4 Low
146
183
  - Code style inconsistencies
147
184
  - Dead code / unused imports
@@ -152,7 +189,8 @@ Manifest: .mdd/jobs/audit-<date>/MANIFEST.md
152
189
  2. Read shard-<N>.md to know your file list
153
190
  3. Read MANIFEST.md — find the first [ ] entry in Shard <N>
154
191
  4. Read the last 20 lines of agent-<N>-notes.md for continuity
155
- 5. Begin the per-file loop at that first [ ] entry
192
+ 5. Read integration-context.md — load this into working memory. Use it when checking P1 (integration contract not called at call site): cross-reference the source file's feature against the contracts defined for its dependencies.
193
+ 6. Begin the per-file loop at that first [ ] entry
156
194
  ```
157
195
 
158
196
  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.
@@ -171,7 +209,8 @@ STARTUP (run on every fresh start and after every context clear):
171
209
  2. Read shard-N.md
172
210
  3. Read MANIFEST.md — find first [ ] in own shard
173
211
  4. Read last 20 lines of agent-N-notes.md for continuity
174
- 5. Begin per-file loop
212
+ 5. Read integration-context.md — holds feature ownership map and all integration contracts
213
+ 6. Begin per-file loop
175
214
 
176
215
  PER-FILE LOOP:
177
216
  1. Mark file as [~] in MANIFEST.md ← write to disk first
@@ -216,7 +255,8 @@ Main merges all agent notes into the canonical output file:
216
255
  1. Read `MANIFEST.md` to get canonical file order
217
256
  2. For each file in manifest order, locate its `## <filepath>` section in the correct agent notes file
218
257
  3. Append to `audits/notes-<date>.md` in that order
219
- 4. Verify entry count in `audits/notes-<date>.md` matches manifest file count
258
+ 4. If `audits/doc-findings-<date>.md` exists and is non-empty, append its contents to `audits/notes-<date>.md` under a `## Feature Doc Issues` header
259
+ 5. Verify entry count in `audits/notes-<date>.md` matches manifest file count (doc findings are supplemental — they don't affect the per-file count)
220
260
 
221
261
  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.
222
262
 
@@ -240,14 +280,23 @@ Read ONLY `audits/notes-<date>.md` (NOT source code again). Produce `audits/repo
240
280
  - `[doc-field-gap]` — a new feature doc frontmatter field would have surfaced this earlier; suggest the field name and schema
241
281
  For each item, name the exact MDD file and section that needs changing.
242
282
 
243
- **Integration contract cross-check (in addition to per-file analysis):**
244
- After per-file analysis is complete, read all `.mdd/docs/*.md` and:
245
- - For each feature with `integration_contracts` entries: verify that every listed `caller_feature` has a matching `satisfies_contracts` entry referencing back to this feature
246
- - For each feature with `satisfies_contracts` entries still `status: pending`: flag as P1 — the wiring was documented but never implemented
247
- - For each feature doc where `satisfies_contracts` is empty but `depends_on` includes a feature with `integration_contracts`: flag as P2 — missing acknowledgment of mandatory contracts
248
- - For each source file flagged `[!]` where the finding is "security function not called at call site": cross-reference against `integration_contracts` of dependencies — these are contract violations, not just code quality issues
283
+ **Integration contract verification (proactive does not depend on what agents flagged):**
284
+
285
+ This step runs independently of agent findings. It uses `integration-context.md` from the job folder (already built in Phase A2) and re-reads specific source files as needed. The "Read ONLY notes" constraint applies to standard synthesis only — this step may re-read source files.
286
+
287
+ For each contract in `integration-context.md`:
288
+ 1. Identify all source files listed under "Caller source files" for that contract
289
+ 2. For each such source file, check `audits/notes-<date>.md` for that file's entry:
290
+ - If notes explicitly confirm the contract call is present: no action
291
+ - If notes flag a contract violation: include in Contract Violations section
292
+ - If notes say "No issues found" but the contract requires a specific function call: **re-read that source file now** and check whether the required call is actually present. Agents marked the file `[x]` without the contract context — verify independently.
293
+ 3. Report each confirmed gap as P1 ("contract call absent — agent lacked context to detect this")
294
+
295
+ Additionally read all `.mdd/docs/*.md` to catch any cases the Phase A1 doc cross-check might have missed (e.g., docs added after Phase A1 ran, or pending contracts that weren't flagged):
296
+ - Any `satisfies_contracts` with `status: pending` not already in doc-findings = P1
297
+ - Any `depends_on` with `integration_contracts` and empty `satisfies_contracts` not already in doc-findings = P2
249
298
 
250
- Report these as a separate "Contract Violations" section before the standard findings table.
299
+ Report all findings from this step as a "Contract Violations" section before the standard findings table.
251
300
 
252
301
  **Once `audits/report-<date>.md` is confirmed written and non-empty:**
253
302
  1. Copy `jobs/audit-<date>/MANIFEST.md` → `audits/MANIFEST-<date>.md`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thedecipherist/mdd",
3
- "version": "1.6.7",
3
+ "version": "1.6.8",
4
4
  "description": "MDD — Manual-Driven Development workflow for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {