@massu/core 0.4.2 → 0.6.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 +40 -0
- package/agents/massu-architecture-reviewer.md +104 -0
- package/agents/massu-blast-radius-analyzer.md +84 -0
- package/agents/massu-competitive-scorer.md +126 -0
- package/agents/massu-help-sync.md +73 -0
- package/agents/massu-migration-writer.md +94 -0
- package/agents/massu-output-scorer.md +87 -0
- package/agents/massu-pattern-reviewer.md +84 -0
- package/agents/massu-plan-auditor.md +170 -0
- package/agents/massu-schema-sync-verifier.md +70 -0
- package/agents/massu-security-reviewer.md +98 -0
- package/agents/massu-ux-reviewer.md +106 -0
- package/commands/_shared-preamble.md +53 -23
- package/commands/_shared-references/auto-learning-protocol.md +71 -0
- package/commands/_shared-references/blast-radius-protocol.md +76 -0
- package/commands/_shared-references/security-pre-screen.md +64 -0
- package/commands/_shared-references/test-first-protocol.md +87 -0
- package/commands/_shared-references/verification-table.md +52 -0
- package/commands/massu-article-review.md +343 -0
- package/commands/massu-autoresearch/references/eval-runner.md +84 -0
- package/commands/massu-autoresearch/references/safety-rails.md +125 -0
- package/commands/massu-autoresearch/references/scoring-protocol.md +151 -0
- package/commands/massu-autoresearch.md +258 -0
- package/commands/massu-batch.md +44 -12
- package/commands/massu-bearings.md +42 -8
- package/commands/massu-checkpoint.md +588 -0
- package/commands/massu-ci-fix.md +2 -2
- package/commands/massu-command-health.md +132 -0
- package/commands/massu-command-improve.md +232 -0
- package/commands/massu-commit.md +205 -44
- package/commands/massu-create-plan.md +239 -57
- package/commands/massu-data/references/common-queries.md +79 -0
- package/commands/massu-data/references/table-guide.md +50 -0
- package/commands/massu-data.md +66 -0
- package/commands/massu-dead-code.md +29 -34
- package/commands/massu-debug/references/auto-learning.md +61 -0
- package/commands/massu-debug/references/codegraph-tracing.md +80 -0
- package/commands/massu-debug/references/common-shortcuts.md +98 -0
- package/commands/massu-debug/references/investigation-phases.md +294 -0
- package/commands/massu-debug/references/report-format.md +107 -0
- package/commands/massu-debug.md +105 -386
- package/commands/massu-docs.md +1 -1
- package/commands/massu-full-audit.md +61 -0
- package/commands/massu-gap-enhancement-analyzer.md +276 -16
- package/commands/massu-golden-path/references/approval-points.md +216 -0
- package/commands/massu-golden-path/references/competitive-mode.md +273 -0
- package/commands/massu-golden-path/references/error-handling.md +121 -0
- package/commands/massu-golden-path/references/phase-0-requirements.md +53 -0
- package/commands/massu-golden-path/references/phase-1-plan-creation.md +168 -0
- package/commands/massu-golden-path/references/phase-2-implementation.md +397 -0
- package/commands/massu-golden-path/references/phase-2.5-gap-analyzer.md +156 -0
- package/commands/massu-golden-path/references/phase-3-simplify.md +40 -0
- package/commands/massu-golden-path/references/phase-4-commit.md +94 -0
- package/commands/massu-golden-path/references/phase-5-push.md +116 -0
- package/commands/massu-golden-path/references/phase-5.5-production-verify.md +170 -0
- package/commands/massu-golden-path/references/phase-6-completion.md +113 -0
- package/commands/massu-golden-path/references/qa-evaluator-spec.md +137 -0
- package/commands/massu-golden-path/references/sprint-contract-protocol.md +117 -0
- package/commands/massu-golden-path/references/vr-visual-calibration.md +73 -0
- package/commands/massu-golden-path.md +114 -848
- package/commands/massu-guide.md +72 -69
- package/commands/massu-hooks.md +27 -12
- package/commands/massu-hotfix.md +221 -144
- package/commands/massu-incident.md +49 -20
- package/commands/massu-infra-audit.md +187 -0
- package/commands/massu-learning-audit.md +211 -0
- package/commands/massu-loop/references/auto-learning.md +49 -0
- package/commands/massu-loop/references/checkpoint-audit.md +40 -0
- package/commands/massu-loop/references/guardrails.md +17 -0
- package/commands/massu-loop/references/iteration-structure.md +115 -0
- package/commands/massu-loop/references/loop-controller.md +188 -0
- package/commands/massu-loop/references/plan-extraction.md +78 -0
- package/commands/massu-loop/references/vr-plan-spec.md +140 -0
- package/commands/massu-loop-playwright.md +9 -9
- package/commands/massu-loop.md +115 -670
- package/commands/massu-new-pattern.md +423 -0
- package/commands/massu-perf.md +422 -0
- package/commands/massu-plan-audit.md +1 -1
- package/commands/massu-plan.md +389 -122
- package/commands/massu-production-verify.md +433 -0
- package/commands/massu-push.md +62 -378
- package/commands/massu-recap.md +29 -3
- package/commands/massu-rollback.md +613 -0
- package/commands/massu-scaffold-hook.md +2 -4
- package/commands/massu-scaffold-page.md +2 -3
- package/commands/massu-scaffold-router.md +1 -2
- package/commands/massu-security.md +619 -0
- package/commands/massu-simplify.md +115 -85
- package/commands/massu-squirrels.md +2 -2
- package/commands/massu-tdd.md +38 -22
- package/commands/massu-test.md +3 -3
- package/commands/massu-type-mismatch-audit.md +469 -0
- package/commands/massu-ui-audit.md +587 -0
- package/commands/massu-verify-playwright.md +287 -32
- package/commands/massu-verify.md +150 -46
- package/dist/cli.js +1451 -1047
- package/dist/hooks/post-tool-use.js +75 -6
- package/dist/hooks/user-prompt.js +16 -0
- package/package.json +6 -2
- package/patterns/build-patterns.md +302 -0
- package/patterns/component-patterns.md +246 -0
- package/patterns/display-patterns.md +185 -0
- package/patterns/form-patterns.md +890 -0
- package/patterns/integration-testing-checklist.md +445 -0
- package/patterns/security-patterns.md +219 -0
- package/patterns/testing-patterns.md +569 -0
- package/patterns/tool-routing.md +81 -0
- package/patterns/ui-patterns.md +371 -0
- package/protocols/plan-implementation.md +267 -0
- package/protocols/recovery.md +225 -0
- package/protocols/verification.md +404 -0
- package/reference/command-taxonomy.md +178 -0
- package/reference/cr-rules-reference.md +76 -0
- package/reference/hook-execution-order.md +148 -0
- package/reference/lessons-learned.md +175 -0
- package/reference/patterns-quickref.md +208 -0
- package/reference/standards.md +135 -0
- package/reference/subagents-reference.md +17 -0
- package/reference/vr-verification-reference.md +867 -0
- package/src/commands/init.ts +27 -0
- package/src/commands/install-commands.ts +149 -53
- package/src/hooks/post-tool-use.ts +17 -0
- package/src/hooks/user-prompt.ts +21 -0
- package/src/memory-file-ingest.ts +127 -0
- package/src/memory-tools.ts +34 -1
package/commands/massu-plan.md
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: massu-plan
|
|
3
|
-
description:
|
|
3
|
+
description: "When user wants to audit an existing plan for gaps -- 'audit this plan', 'review the plan', or references a plan file that needs verification"
|
|
4
4
|
allowed-tools: Bash(*), Read(*), Write(*), Edit(*), Grep(*), Glob(*), Task(*)
|
|
5
5
|
---
|
|
6
6
|
name: massu-plan
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
# Massu Plan: Continuous Verification Audit Loop (ZERO-GAP STANDARD)
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
**Shared rules**: Read `.claude/commands/_shared-preamble.md` before proceeding. CR-9, CR-12 enforced.
|
|
11
|
+
|
|
12
|
+
---
|
|
11
13
|
|
|
12
14
|
## Workflow Position
|
|
13
15
|
|
|
@@ -20,13 +22,14 @@ name: massu-plan
|
|
|
20
22
|
|
|
21
23
|
---
|
|
22
24
|
|
|
23
|
-
##
|
|
25
|
+
## THIS IS A PLAN-AUDIT COMMAND, NOT AN IMPLEMENTATION COMMAND
|
|
24
26
|
|
|
25
27
|
**THIS COMMAND AUDITS AND IMPROVES PLAN DOCUMENTS. IT DOES NOT IMPLEMENT CODE.**
|
|
26
28
|
|
|
27
|
-
### FORBIDDEN Actions
|
|
29
|
+
### FORBIDDEN Actions
|
|
28
30
|
- Writing code to source files (Edit/Write to packages/)
|
|
29
31
|
- Creating modules, tools, or hooks
|
|
32
|
+
- Making database changes
|
|
30
33
|
- Implementing any plan items
|
|
31
34
|
|
|
32
35
|
### ALLOWED Actions
|
|
@@ -37,19 +40,21 @@ name: massu-plan
|
|
|
37
40
|
- **STOP AND WAIT** for explicit user approval
|
|
38
41
|
|
|
39
42
|
### AFTER AUDIT COMPLETE: MANDATORY WAIT
|
|
40
|
-
|
|
41
|
-
**After the audit loop completes with zero gaps, you MUST:**
|
|
42
43
|
1. **Present the plan** to the user
|
|
43
44
|
2. **STOP completely** - Do not start implementation
|
|
44
|
-
3. **WAIT** for explicit user instruction
|
|
45
|
+
3. **WAIT** for explicit user instruction (e.g., "run /massu-loop")
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
| Command | Purpose | Edits Source Code? |
|
|
48
|
+
|---------|---------|-------------------|
|
|
49
|
+
| `/massu-create-plan` | Create plan document | **NO** |
|
|
50
|
+
| `/massu-plan` | Audit/improve plan document | **NO** |
|
|
51
|
+
| `/massu-loop` | Implement plan with verification | **YES** |
|
|
47
52
|
|
|
48
53
|
---
|
|
49
54
|
|
|
50
55
|
## START NOW
|
|
51
56
|
|
|
52
|
-
**Step 0: Write AUTHORIZED_COMMAND to session state (CR-
|
|
57
|
+
**Step 0: Write AUTHORIZED_COMMAND to session state (CR-12)**
|
|
53
58
|
|
|
54
59
|
Update `session-state/CURRENT.md` to include `AUTHORIZED_COMMAND: massu-plan`.
|
|
55
60
|
|
|
@@ -60,12 +65,28 @@ Write a transition entry to `.massu/workflow-log.md`:
|
|
|
60
65
|
| [timestamp] | PLAN | AUDIT | /massu-plan | [session-id] |
|
|
61
66
|
```
|
|
62
67
|
|
|
68
|
+
**Execute the LOOP CONTROLLER below.**
|
|
69
|
+
|
|
70
|
+
1. Parse plan path from `$ARGUMENTS`
|
|
71
|
+
2. Start the loop: spawn `general-purpose` subagent (via Task tool) for iteration 1
|
|
72
|
+
3. Parse `GAPS_DISCOVERED` from the subagent result
|
|
73
|
+
4. If gaps > 0: fix what the auditor couldn't, spawn another iteration
|
|
74
|
+
5. If gaps == 0: output final report to user
|
|
75
|
+
6. Continue until zero gaps or max 10 iterations
|
|
76
|
+
7. **Score and append to command-scores.jsonl** (silent)
|
|
77
|
+
|
|
78
|
+
**The auditor subagent handles**: reading the plan, reading CLAUDE.md, extracting items, running verifications, fixing plan document gaps, returning structured result.
|
|
79
|
+
|
|
80
|
+
**You (the loop controller) handle**: spawning auditors, parsing results, fixing code-level gaps the auditor identifies but can't fix, and looping.
|
|
81
|
+
|
|
82
|
+
**Two sources of truth**:
|
|
83
|
+
- **Plan** = What to build
|
|
84
|
+
- **CLAUDE.md** = How to build it correctly
|
|
85
|
+
|
|
63
86
|
---
|
|
64
87
|
|
|
65
88
|
## MANDATORY LOOP CONTROLLER (EXECUTE THIS - DO NOT SKIP)
|
|
66
89
|
|
|
67
|
-
**This section is the EXECUTION ENTRY POINT. You MUST follow these steps exactly.**
|
|
68
|
-
|
|
69
90
|
### How This Command Works
|
|
70
91
|
|
|
71
92
|
This command is a **loop controller**. Your job is to:
|
|
@@ -130,7 +151,7 @@ WHILE true:
|
|
|
130
151
|
a. Specificity: exact file path, exact changes, verification command
|
|
131
152
|
b. Feasibility: target files exist (or create is planned), patterns are correct
|
|
132
153
|
c. Completeness: all aspects covered (tool reg, tests, config if needed)
|
|
133
|
-
5. Check pattern compliance matrix against
|
|
154
|
+
5. Check pattern compliance matrix against massu patterns
|
|
134
155
|
6. If adding tools: verify plan includes VR-TOOL-REG steps
|
|
135
156
|
7. If modifying hooks: verify plan includes VR-HOOK-BUILD
|
|
136
157
|
8. If changing config: verify plan includes VR-CONFIG
|
|
@@ -171,13 +192,13 @@ END WHILE
|
|
|
171
192
|
|
|
172
193
|
| Rule | Meaning |
|
|
173
194
|
|------|---------|
|
|
174
|
-
| **NEVER output a final verdict while gaps
|
|
195
|
+
| **NEVER output a final verdict while gaps > 0** | Only a zero-gap-from-start iteration produces the final report |
|
|
175
196
|
| **NEVER treat "found and fixed" as zero gaps** | Fixing during a pass still means gaps were discovered |
|
|
176
|
-
| **NEVER ask user "should I continue?"** | The loop is mandatory
|
|
177
|
-
| **NEVER stop after fixing gaps** |
|
|
197
|
+
| **NEVER ask user "should I continue?"** | The loop is mandatory |
|
|
198
|
+
| **NEVER stop after fixing gaps** | Requires a FRESH re-audit to verify |
|
|
178
199
|
| **ALWAYS use Task tool for audit passes** | Subagents keep context clean |
|
|
179
200
|
| **ALWAYS parse GAPS_DISCOVERED from result** | This is the loop control variable |
|
|
180
|
-
| **Maximum 10 iterations** | If still failing after 10, report to user
|
|
201
|
+
| **Maximum 10 iterations** | If still failing after 10, report to user |
|
|
181
202
|
|
|
182
203
|
---
|
|
183
204
|
|
|
@@ -204,16 +225,11 @@ Run a repeatable audit->fix->re-audit loop that verifies the entire plan against
|
|
|
204
225
|
|
|
205
226
|
## PLAN ITEM EXTRACTION (MANDATORY FIRST STEP)
|
|
206
227
|
|
|
207
|
-
**Before auditing,
|
|
228
|
+
**Before auditing, extract ALL items from the plan into a trackable list.**
|
|
208
229
|
|
|
209
|
-
###
|
|
230
|
+
### Step 1: Read Plan Document (File, Not Memory)
|
|
210
231
|
|
|
211
|
-
|
|
212
|
-
```bash
|
|
213
|
-
cat [PLAN_FILE_PATH]
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
#### Step 2: Extract ALL Deliverables
|
|
232
|
+
### Step 2: Extract ALL Deliverables
|
|
217
233
|
|
|
218
234
|
```markdown
|
|
219
235
|
## PLAN ITEM EXTRACTION
|
|
@@ -221,6 +237,7 @@ cat [PLAN_FILE_PATH]
|
|
|
221
237
|
### Plan Document
|
|
222
238
|
- **File**: [path]
|
|
223
239
|
- **Title**: [title]
|
|
240
|
+
- **Date Read**: [timestamp]
|
|
224
241
|
|
|
225
242
|
### Extracted Items
|
|
226
243
|
|
|
@@ -229,100 +246,86 @@ cat [PLAN_FILE_PATH]
|
|
|
229
246
|
| P1-001 | MODULE | foo-tools.ts | packages/core/src/ | ls -la [path] |
|
|
230
247
|
| P1-002 | TOOL_WIRE | Wire into tools.ts | packages/core/src/tools.ts | grep [module] tools.ts |
|
|
231
248
|
| P2-001 | TEST | foo-tools.test.ts | packages/core/src/__tests__/ | npm test |
|
|
249
|
+
| P-003 | REMOVAL | Remove pattern | all files | grep -rn "pattern" = 0 |
|
|
250
|
+
|
|
251
|
+
### Item Types: MODULE (exists), TOOL_WIRE (registered), TEST (passes), CONFIG (parses), HOOK (compiles), REMOVAL (0 matches)
|
|
232
252
|
|
|
233
253
|
### Coverage Baseline
|
|
234
254
|
- **Total Items**: [N]
|
|
235
255
|
- **Current Status**: 0/[N] verified (0%)
|
|
236
256
|
```
|
|
237
257
|
|
|
258
|
+
### Step 3: Use This List Throughout Audit
|
|
259
|
+
Every audit iteration must reference this list, check each item, update coverage, and report missing items.
|
|
260
|
+
|
|
238
261
|
---
|
|
239
262
|
|
|
240
263
|
## VR-PLAN-FEASIBILITY: Plan Reality Verification (MANDATORY)
|
|
241
264
|
|
|
242
|
-
**Before accepting ANY plan, verify
|
|
265
|
+
**Before accepting ANY plan, verify it is REALISTIC and CAN be implemented.**
|
|
243
266
|
|
|
244
|
-
###
|
|
245
|
-
|
|
246
|
-
#### Check 1: File System Reality
|
|
247
|
-
For EACH file modification in the plan, verify the target exists:
|
|
267
|
+
### Check 1: File System Reality
|
|
268
|
+
For files plan modifies: `ls -la [file_path]`. For directories plan creates in: `ls -la [directory_path]`.
|
|
248
269
|
|
|
270
|
+
### Check 1.5: Config-Code Data Alignment (VR-DATA)
|
|
271
|
+
If ANY feature uses config-stored values, verify VALUES match code expectations:
|
|
249
272
|
```bash
|
|
250
|
-
#
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
# For directories plan says to CREATE files in:
|
|
254
|
-
ls -la [directory_path]
|
|
273
|
+
# Find what the CODE expects
|
|
274
|
+
grep -rn "getConfig\(\)\." packages/core/src/ | grep -oE 'getConfig\(\)\.\w+' | sort -u
|
|
255
275
|
```
|
|
276
|
+
Compare config keys to code expectations. Mismatches = FAIL. Add plan items to fix alignment BEFORE implementation.
|
|
256
277
|
|
|
257
|
-
|
|
258
|
-
For
|
|
278
|
+
### Check 2: Dependency Reality
|
|
279
|
+
For each new import: `npm list [package]` or `ls -la packages/core/src/[import-path].ts`.
|
|
259
280
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
npm list [package-name] 2>/dev/null || echo "NOT INSTALLED"
|
|
263
|
-
|
|
264
|
-
# Check if internal import path exists
|
|
265
|
-
ls -la packages/core/src/[import-path].ts
|
|
266
|
-
```
|
|
281
|
+
### Check 3: Pattern Reality
|
|
282
|
+
For each pattern referenced: `grep -n "[pattern_name]" .claude/CLAUDE.md`.
|
|
267
283
|
|
|
268
|
-
|
|
269
|
-
For EACH pattern the plan references:
|
|
270
|
-
|
|
271
|
-
```bash
|
|
272
|
-
# Verify pattern is documented in CLAUDE.md
|
|
273
|
-
grep -n "[pattern_name]" .claude/CLAUDE.md
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
#### Check 4: Tool Registration Completeness
|
|
284
|
+
### Check 4: Tool Registration Completeness
|
|
277
285
|
If plan adds MCP tools:
|
|
278
|
-
|
|
279
286
|
```bash
|
|
280
287
|
# Verify plan includes ALL 3 registration steps
|
|
281
288
|
grep "getToolDefinitions\|isXTool\|handleToolCall" [plan_file]
|
|
282
289
|
```
|
|
283
290
|
|
|
284
|
-
### Feasibility Gate
|
|
285
|
-
|
|
286
|
-
```markdown
|
|
287
|
-
### VR-PLAN-FEASIBILITY GATE
|
|
291
|
+
### Feasibility Gate Decision
|
|
288
292
|
|
|
289
|
-
| Check |
|
|
290
|
-
|
|
291
|
-
| File System |
|
|
292
|
-
|
|
|
293
|
-
|
|
|
294
|
-
|
|
|
293
|
+
| Check | Status |
|
|
294
|
+
|-------|--------|
|
|
295
|
+
| File System | PASS/FAIL |
|
|
296
|
+
| Config-Code Alignment | PASS/FAIL/N/A |
|
|
297
|
+
| Dependencies | PASS/FAIL |
|
|
298
|
+
| Patterns | PASS/FAIL |
|
|
299
|
+
| Tool Registration | PASS/FAIL |
|
|
295
300
|
|
|
296
|
-
**
|
|
297
|
-
```
|
|
301
|
+
**If ANY check fails: BLOCK plan until resolved. Do NOT proceed.**
|
|
298
302
|
|
|
299
303
|
---
|
|
300
304
|
|
|
301
|
-
## VR-PLAN-SPECIFICITY: Implementation
|
|
305
|
+
## VR-PLAN-SPECIFICITY: Implementation Direction Verification (MANDATORY)
|
|
302
306
|
|
|
303
|
-
|
|
307
|
+
Every plan item MUST have implementation details specific enough to execute WITHOUT guessing.
|
|
304
308
|
|
|
305
|
-
|
|
|
306
|
-
|
|
307
|
-
| **
|
|
308
|
-
| **
|
|
309
|
-
| **
|
|
310
|
-
| **
|
|
309
|
+
| Item Type | Minimum Specificity |
|
|
310
|
+
|-----------|---------------------|
|
|
311
|
+
| **MODULE_CREATE** | File path + exported functions + pattern reference |
|
|
312
|
+
| **MODULE_MODIFY** | File path + exact changes + insertion point |
|
|
313
|
+
| **TOOL_WIRE** | tools.ts changes (import + definition + handler) |
|
|
314
|
+
| **TEST** | Test file path + what it covers + expected assertions |
|
|
315
|
+
| **CONFIG** | config.ts interface changes + YAML example |
|
|
316
|
+
| **HOOK** | Hook file path + stdin/stdout format + esbuild compatibility |
|
|
311
317
|
|
|
312
|
-
|
|
318
|
+
ANY item with vague implementation directions = FAIL. Fix the plan BEFORE implementation.
|
|
313
319
|
|
|
314
|
-
|
|
315
|
-
|------|-------------|
|
|
316
|
-
| MODULE_CREATE | File path + exported functions + pattern reference |
|
|
317
|
-
| MODULE_MODIFY | File path + exact changes + insertion point |
|
|
318
|
-
| TOOL_WIRE | tools.ts changes (import + definition + handler) |
|
|
319
|
-
| TEST | Test file path + what it covers + expected assertions |
|
|
320
|
-
| CONFIG | config.ts interface changes + YAML example |
|
|
321
|
-
| HOOK | Hook file path + stdin/stdout format + esbuild compatibility |
|
|
320
|
+
How to fix: Research target format, write exact content, specify insertion point, verify format against existing patterns, update plan.
|
|
322
321
|
|
|
323
322
|
---
|
|
324
323
|
|
|
325
|
-
## PATTERN
|
|
324
|
+
## MANDATORY PATTERN ALIGNMENT GATE (PRE-IMPLEMENTATION)
|
|
325
|
+
|
|
326
|
+
The PLAN DOCUMENT itself must explicitly address ALL relevant patterns from CLAUDE.md.
|
|
327
|
+
|
|
328
|
+
### Pattern Compliance Matrix (Massu-Specific)
|
|
326
329
|
|
|
327
330
|
The auditor MUST verify plan items against these patterns:
|
|
328
331
|
|
|
@@ -336,11 +339,136 @@ The auditor MUST verify plan items against these patterns:
|
|
|
336
339
|
| Test location | __tests__/ directory | Correct path |
|
|
337
340
|
| No process.exit() | Library code only | Not in plan modules |
|
|
338
341
|
|
|
342
|
+
### Steps
|
|
343
|
+
1. **Extract mandatory patterns** from CLAUDE.md
|
|
344
|
+
2. **Build alignment matrix**: Cross-reference plan against ALL extracted patterns
|
|
345
|
+
|
|
346
|
+
```markdown
|
|
347
|
+
| Pattern ID | Pattern Requirement | Plan Addresses | Location in Plan | Status |
|
|
348
|
+
|------------|---------------------|----------------|------------------|--------|
|
|
349
|
+
| MCP-001 | 3-function tool pattern | YES/NO | Section X.X | ALIGNED/GAP |
|
|
350
|
+
| CFG-001 | getConfig() usage | YES/NO | Section X.X | ALIGNED/GAP |
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
3. **Plan completeness check** - every plan MUST include:
|
|
354
|
+
- Scope & Objectives
|
|
355
|
+
- Files to Modify / Files to Create (explicit paths)
|
|
356
|
+
- Module/Tool Registration (or N/A)
|
|
357
|
+
- Error Handling approach
|
|
358
|
+
- Testing Approach
|
|
359
|
+
- Rollback Plan
|
|
360
|
+
- Success Criteria
|
|
361
|
+
4. **Gap identification**: Document all missing info with recommendations
|
|
362
|
+
|
|
363
|
+
### Gate
|
|
364
|
+
ALL relevant patterns must be addressed. If FAIL: plan CANNOT proceed until gaps fixed.
|
|
365
|
+
|
|
366
|
+
### New Pattern Protocol
|
|
367
|
+
If plan requires functionality with no existing pattern:
|
|
368
|
+
1. Document why existing patterns don't work
|
|
369
|
+
2. Define pattern with WRONG/CORRECT examples
|
|
370
|
+
3. Get explicit user approval
|
|
371
|
+
4. Save to CLAUDE.md BEFORE implementation
|
|
372
|
+
5. Reference in plan
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
## Inputs You Must Read First (In Order)
|
|
377
|
+
|
|
378
|
+
1. **The Plan**: Read line-by-line, extract EVERY requirement into `REQUIREMENTS_CHECKLIST`
|
|
379
|
+
2. **CLAUDE.md**: Read fully, extract EVERY rule/pattern into `PATTERNS_CHECKLIST`
|
|
380
|
+
|
|
381
|
+
**Do NOT scan the repo to "discover" patterns. CLAUDE.md defines what patterns ARE correct.**
|
|
382
|
+
|
|
339
383
|
---
|
|
340
384
|
|
|
341
|
-
##
|
|
385
|
+
## PRIME DIRECTIVE: NO ASSUMPTIONS
|
|
386
|
+
|
|
387
|
+
**NEVER assume module interfaces or config structure. ALWAYS verify against real code.**
|
|
342
388
|
|
|
343
|
-
|
|
389
|
+
### Mandatory Structure Verification
|
|
390
|
+
|
|
391
|
+
```bash
|
|
392
|
+
# Verify module exports match plan expectations
|
|
393
|
+
grep -n "export" packages/core/src/[MODULE].ts
|
|
394
|
+
|
|
395
|
+
# Verify config interface matches plan
|
|
396
|
+
grep -A 20 "interface.*Config" packages/core/src/config.ts
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
## Operating Mode: Two-Pass Audit
|
|
402
|
+
|
|
403
|
+
### PASS A: Inventory & Mapping (NO FIXES YET)
|
|
404
|
+
|
|
405
|
+
#### A1. Requirements -> Implementation Matrix
|
|
406
|
+
|
|
407
|
+
```markdown
|
|
408
|
+
| Req ID | Requirement | Status | Evidence (file paths) | Notes |
|
|
409
|
+
|--------|-------------|--------|----------------------|-------|
|
|
410
|
+
| R-001 | [text] | Implemented/Partial/Missing/Unclear | [paths] | [notes] |
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
Status: **Implemented** (full evidence), **Partial** (some evidence), **Missing** (none found), **Unclear** (HARD STOP - ask for clarification).
|
|
414
|
+
|
|
415
|
+
#### A2. Patterns & Constraints Matrix
|
|
416
|
+
|
|
417
|
+
Primary verification:
|
|
418
|
+
```bash
|
|
419
|
+
bash scripts/massu-pattern-scanner.sh
|
|
420
|
+
# Exit 0 = ALL patterns pass
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
Additional targeted VR-NEGATIVE checks for rules not covered by scanner:
|
|
424
|
+
```bash
|
|
425
|
+
grep -rn "[violation pattern]" [directories] | wc -l
|
|
426
|
+
# Expected: 0
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
#### A3. User-Flow Coverage Map
|
|
430
|
+
|
|
431
|
+
```markdown
|
|
432
|
+
| Flow ID | Flow Name | Entry Point | Steps | API Calls | Expected Outcome | Status |
|
|
433
|
+
|---------|-----------|-------------|-------|-----------|------------------|--------|
|
|
434
|
+
| UF-001 | [name] | [module] | [list] | [list] | [outcome] | MAPPED |
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
### PASS B: Verification & Breakage Hunting
|
|
440
|
+
|
|
441
|
+
#### B1. Module / File Structure
|
|
442
|
+
|
|
443
|
+
```bash
|
|
444
|
+
# Module inventory
|
|
445
|
+
find packages/core/src -name "*.ts" -not -path "*__tests__*" -not -path "*node_modules*" | sort
|
|
446
|
+
|
|
447
|
+
# Tool definition files
|
|
448
|
+
find packages/core/src -name "*-tools.ts" | sort
|
|
449
|
+
|
|
450
|
+
# Hook files
|
|
451
|
+
find packages/core/src/hooks -name "*.ts" 2>/dev/null | sort
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
Verify: all planned modules exist, all tool files follow naming convention, hooks are in correct directory.
|
|
455
|
+
|
|
456
|
+
#### B2. Tool Registration & Wiring
|
|
457
|
+
|
|
458
|
+
```bash
|
|
459
|
+
# Tool definitions in each module
|
|
460
|
+
grep -rn "getToolDefinitions\|getDefs" packages/core/src/ | grep -v node_modules | grep -v __tests__
|
|
461
|
+
|
|
462
|
+
# Handler registrations
|
|
463
|
+
grep -rn "handleToolCall\|handleCall" packages/core/src/ | grep -v node_modules | grep -v __tests__
|
|
464
|
+
|
|
465
|
+
# Wiring in tools.ts
|
|
466
|
+
grep -rn "import\|getDefs\|isTool\|handleCall" packages/core/src/tools.ts
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
Verify: all tools have definitions + handlers + wiring in tools.ts. A tool that exists but is not registered is INVISIBLE to users.
|
|
470
|
+
|
|
471
|
+
#### B2.5 Tool Registration Matrix
|
|
344
472
|
|
|
345
473
|
```markdown
|
|
346
474
|
### Tool Registration Matrix
|
|
@@ -350,11 +478,22 @@ For EVERY tool in the plan:
|
|
|
350
478
|
| [name] | [file:line] | [file:line] | [file:line] | YES/NO | [test] | PASS/FAIL |
|
|
351
479
|
```
|
|
352
480
|
|
|
353
|
-
|
|
481
|
+
#### B3. Data Layer Integrity
|
|
354
482
|
|
|
355
|
-
|
|
483
|
+
```bash
|
|
484
|
+
cd packages/core && npx tsc --noEmit
|
|
485
|
+
# Compare module interfaces to usage
|
|
486
|
+
grep -A 10 "export interface\|export type" packages/core/src/[MODULE].ts
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
#### B4. Hook Compilation
|
|
490
|
+
|
|
491
|
+
```bash
|
|
492
|
+
cd packages/core && npm run build:hooks
|
|
493
|
+
# MUST exit 0
|
|
494
|
+
```
|
|
356
495
|
|
|
357
|
-
|
|
496
|
+
#### B4.5 Hook Compilation Matrix
|
|
358
497
|
|
|
359
498
|
If plan includes hooks:
|
|
360
499
|
|
|
@@ -366,9 +505,7 @@ If plan includes hooks:
|
|
|
366
505
|
| [name] | [path] | [format] | [format] | YES/NO | PASS/FAIL |
|
|
367
506
|
```
|
|
368
507
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
## B-CONFIG: Config Validation
|
|
508
|
+
#### B5. Config Validation
|
|
372
509
|
|
|
373
510
|
If plan includes config changes:
|
|
374
511
|
|
|
@@ -380,23 +517,160 @@ If plan includes config changes:
|
|
|
380
517
|
| [section] | YES/NO | YES/NO | [value] | PASS/FAIL |
|
|
381
518
|
```
|
|
382
519
|
|
|
383
|
-
|
|
520
|
+
#### B6. Regression Risk
|
|
521
|
+
|
|
522
|
+
```bash
|
|
523
|
+
git log --oneline -20
|
|
524
|
+
git diff HEAD~5 --stat
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
Review for side effects, incomplete refactors, duplicated logic, silent failures.
|
|
528
|
+
|
|
529
|
+
#### B7. Consistency & Reusability
|
|
530
|
+
|
|
531
|
+
Reuse existing modules per CLAUDE.md. Do NOT create one-off modules when reusable ones exist.
|
|
532
|
+
|
|
533
|
+
#### B8. Import/Export Integrity
|
|
534
|
+
|
|
535
|
+
```bash
|
|
536
|
+
cd packages/core && npx tsc --noEmit 2>&1 | grep -i "cannot find module\|not found"
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
#### B9. Environment & Configuration
|
|
384
540
|
|
|
385
|
-
|
|
541
|
+
```bash
|
|
542
|
+
grep -rn "process.env\." packages/core/src/ | grep -v node_modules | grep -oE 'process\.env\.\w+' | sort -u
|
|
543
|
+
ls -la tsconfig.json package.json massu.config.yaml 2>/dev/null
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
#### B10. Test Coverage
|
|
547
|
+
|
|
548
|
+
```bash
|
|
549
|
+
# Test files
|
|
550
|
+
find packages/core/src/__tests__ -name "*.test.ts" | sort
|
|
551
|
+
|
|
552
|
+
# Run tests
|
|
553
|
+
npm test
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
Verify: all new modules have corresponding test files, all tests pass.
|
|
557
|
+
|
|
558
|
+
#### B11. Third-Party Integration
|
|
559
|
+
|
|
560
|
+
```bash
|
|
561
|
+
grep -rn "fetch(\|axios\." packages/core/src/ | grep -v node_modules | grep -v __tests__ | head -20
|
|
562
|
+
grep -rn "https://\|http://" packages/core/src/ | grep -v node_modules | grep -v ".env\|localhost" | head -10
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
### Blast Radius Verification
|
|
566
|
+
|
|
567
|
+
When plan changes ANY constant/path/value:
|
|
568
|
+
```bash
|
|
569
|
+
# For EACH changed value:
|
|
570
|
+
grep -rn '"[OLD_VALUE]"' packages/core/src/ --include="*.ts" | grep -v node_modules
|
|
571
|
+
# ALL matches must be accounted for in blast radius analysis
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
Produce matrix: Old Value | Total Refs | Changed | Kept (with reason) | Uncategorized | Status. Zero uncategorized = PASS.
|
|
386
575
|
|
|
387
|
-
|
|
576
|
+
---
|
|
388
577
|
|
|
389
|
-
|
|
390
|
-
|----------|------------|
|
|
391
|
-
| **P0** | Missing deliverables, impossible items, security issues |
|
|
392
|
-
| **P1** | Vague/unverifiable items, missing verification commands |
|
|
393
|
-
| **P2** | Minor specificity gaps, formatting issues |
|
|
578
|
+
## Fix Protocol (When Gaps Found)
|
|
394
579
|
|
|
395
|
-
|
|
580
|
+
Sort by severity: **P0** (broken tools, data loss, security) > **P1** (incorrect behavior, missing requirements) > **P2** (consistency, minor gaps).
|
|
581
|
+
|
|
582
|
+
For each fix:
|
|
396
583
|
1. Edit the plan document directly
|
|
397
584
|
2. Add missing detail or correct errors
|
|
398
585
|
3. Mark the fix with a comment: `<!-- Fixed in audit iteration N -->`
|
|
399
586
|
|
|
587
|
+
### Technical Debt
|
|
588
|
+
If fixes introduce debt: add to Technical Debt Register with concrete removal plan, document in session-state/CURRENT.md.
|
|
589
|
+
|
|
590
|
+
---
|
|
591
|
+
|
|
592
|
+
## Audit Loop (Repeat Until ZERO Gaps)
|
|
593
|
+
|
|
594
|
+
```
|
|
595
|
+
ITERATION N:
|
|
596
|
+
1. Run PASS A (Inventory & Mapping)
|
|
597
|
+
2. Run PASS B (Verification & Breakage Hunting)
|
|
598
|
+
3. Produce Report
|
|
599
|
+
4. IF gaps: Build Fix Queue (P0->P1->P2), apply fixes, verify, return to Step 1
|
|
600
|
+
5. IF zero gaps: Verify completion criteria, produce final report, STOP
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
### Stop Conditions (ALL must be true)
|
|
604
|
+
|
|
605
|
+
**Plan Coverage**: 100% items verified with VR-* proof.
|
|
606
|
+
**Requirements**: 100% Implemented with evidence.
|
|
607
|
+
**Pattern Compliance**: massu-pattern-scanner exits 0, all VR-NEGATIVE checks pass.
|
|
608
|
+
**Build & Types**: `npm run build` exit 0, `cd packages/core && npx tsc --noEmit` 0 errors, `npm test` passes.
|
|
609
|
+
**Blast Radius** (if applicable): Zero uncategorized references.
|
|
610
|
+
**Technical Debt**: Empty OR fully planned with cleanup steps.
|
|
611
|
+
|
|
612
|
+
---
|
|
613
|
+
|
|
614
|
+
## Report Format (Every Loop Iteration)
|
|
615
|
+
|
|
616
|
+
### A. Executive Summary
|
|
617
|
+
```markdown
|
|
618
|
+
## MASSU PLAN AUDIT - Iteration [N]
|
|
619
|
+
**Date**: [YYYY-MM-DD] | **Plan**: [path] | **Stop Condition**: NOT MET / MET
|
|
620
|
+
|
|
621
|
+
| P0 | P1 | P2 | Total |
|
|
622
|
+
|----|----|----|-------|
|
|
623
|
+
| X | X | X | X |
|
|
624
|
+
|
|
625
|
+
### Key Findings
|
|
626
|
+
- [Finding 1]
|
|
627
|
+
- [Finding 2]
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
### B. Requirements Coverage
|
|
631
|
+
Req ID | Requirement | Status | Evidence (file paths) | Notes
|
|
632
|
+
|
|
633
|
+
### C. Pattern Compliance
|
|
634
|
+
Rule | Status | Violations | Fix Plan/Proof
|
|
635
|
+
|
|
636
|
+
### D. Tool Registration Verification
|
|
637
|
+
Tool | Definition | Handler | Wired | Test | Status
|
|
638
|
+
|
|
639
|
+
### E. Technical Debt Register
|
|
640
|
+
ID | Item | Impact | Remediation | Target
|
|
641
|
+
|
|
642
|
+
### F. Fix Queue + Completed Fixes
|
|
643
|
+
Completed: fix, files changed, verification. Remaining: priority, fix, blocker.
|
|
644
|
+
|
|
645
|
+
---
|
|
646
|
+
|
|
647
|
+
## Completion Criteria
|
|
648
|
+
|
|
649
|
+
```markdown
|
|
650
|
+
## COMPLETION DECLARATION
|
|
651
|
+
|
|
652
|
+
### Plan Coverage: 100% Verified
|
|
653
|
+
- Total plan items: [N], Verified: [N] (100%)
|
|
654
|
+
- Evidence: Plan Item Extraction table with VR-* proof
|
|
655
|
+
|
|
656
|
+
### Requirements: 100% Implemented
|
|
657
|
+
- Evidence: VR-GREP and VR-FILE proof for each
|
|
658
|
+
|
|
659
|
+
### Patterns: 0 Violations
|
|
660
|
+
- Pattern scanner: exit 0
|
|
661
|
+
- VR-NEGATIVE proof for massu-specific patterns
|
|
662
|
+
|
|
663
|
+
### Tool Registration: All tools registered and wired
|
|
664
|
+
|
|
665
|
+
### Build & Types: VR-BUILD + VR-TYPE pass
|
|
666
|
+
|
|
667
|
+
### Technical Debt: Register empty or planned
|
|
668
|
+
|
|
669
|
+
**AUDIT COMPLETE - DUAL VERIFICATION PASSED:**
|
|
670
|
+
- Code Quality Gate: PASS
|
|
671
|
+
- Plan Coverage Gate: PASS
|
|
672
|
+
```
|
|
673
|
+
|
|
400
674
|
---
|
|
401
675
|
|
|
402
676
|
## PLAN DOCUMENT COMPLETION TRACKING (MANDATORY)
|
|
@@ -418,7 +692,7 @@ Checklist: completion table at TOP, all tasks have status, completed tasks have
|
|
|
418
692
|
|
|
419
693
|
---
|
|
420
694
|
|
|
421
|
-
##
|
|
695
|
+
## Context Management
|
|
422
696
|
|
|
423
697
|
Use Task tool with subagents for exploration. Update session-state/CURRENT.md after major phases. If compacted mid-protocol, read CURRENT.md and resume. Never mix unrelated tasks during a protocol.
|
|
424
698
|
|
|
@@ -430,27 +704,20 @@ After EACH iteration, update `session-state/CURRENT.md` with: audit iteration, s
|
|
|
430
704
|
|
|
431
705
|
---
|
|
432
706
|
|
|
433
|
-
##
|
|
434
|
-
|
|
435
|
-
```markdown
|
|
436
|
-
## CS PLAN AUDIT COMPLETE
|
|
707
|
+
## QUALITY SCORING (silent, automatic)
|
|
437
708
|
|
|
438
|
-
|
|
439
|
-
- **Plan**: [path]
|
|
440
|
-
- **Total Items**: [N]
|
|
441
|
-
- **Iterations**: [N]
|
|
442
|
-
- **Final Status**: ZERO GAPS
|
|
709
|
+
After completing the audit loop (zero gaps achieved), self-score against these checks and append one JSONL line to `.claude/metrics/command-scores.jsonl`:
|
|
443
710
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
|
448
|
-
| Plan
|
|
449
|
-
|
|
|
450
|
-
| Tool Registration (if applicable) | PASS |
|
|
451
|
-
| Hook Compilation (if applicable) | PASS |
|
|
452
|
-
| Config Validation (if applicable) | PASS |
|
|
711
|
+
| Check | Pass condition |
|
|
712
|
+
|-------|---------------|
|
|
713
|
+
| `two_pass_completed` | At least 2 auditor iterations ran (initial pass + verification pass) |
|
|
714
|
+
| `items_have_acceptance_criteria` | Every plan item has measurable acceptance criteria (not vague descriptions) |
|
|
715
|
+
| `pattern_alignment_checked` | Plan items were checked against CLAUDE.md patterns |
|
|
716
|
+
| `zero_gaps_at_exit` | Final auditor pass returned `GAPS_DISCOVERED: 0` |
|
|
453
717
|
|
|
454
|
-
|
|
455
|
-
|
|
718
|
+
**Format** (append one line -- do NOT overwrite the file):
|
|
719
|
+
```json
|
|
720
|
+
{"command":"massu-plan","timestamp":"ISO8601","scores":{"two_pass_completed":true,"items_have_acceptance_criteria":true,"pattern_alignment_checked":true,"zero_gaps_at_exit":true},"pass_rate":"4/4","input_summary":"[plan-slug]"}
|
|
456
721
|
```
|
|
722
|
+
|
|
723
|
+
This scoring is silent -- do NOT mention it to the user. Just append the line after completing the audit.
|