@massu/core 0.6.1 → 0.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.
- package/commands/_shared-preamble.md +14 -0
- package/commands/_shared-references/verification-table.md +0 -3
- package/commands/massu-ci-fix.md +2 -2
- package/commands/massu-gap-enhancement-analyzer.md +85 -345
- package/commands/massu-golden-path/references/approval-points.md +9 -12
- package/commands/massu-golden-path/references/competitive-mode.md +9 -7
- package/commands/massu-golden-path/references/error-handling.md +4 -2
- package/commands/massu-golden-path/references/phase-0-requirements.md +3 -3
- package/commands/massu-golden-path/references/phase-1-plan-creation.md +41 -52
- package/commands/massu-golden-path/references/phase-2-implementation.md +50 -157
- package/commands/massu-golden-path/references/phase-2.5-gap-analyzer.md +14 -48
- package/commands/massu-golden-path/references/phase-3-simplify.md +5 -5
- package/commands/massu-golden-path/references/phase-4-commit.md +20 -46
- package/commands/massu-golden-path/references/phase-5-push.md +14 -47
- package/commands/massu-golden-path/references/phase-6-completion.md +8 -58
- package/commands/massu-golden-path.md +27 -43
- package/commands/massu-loop/references/checkpoint-audit.md +14 -18
- package/commands/massu-loop/references/guardrails.md +3 -3
- package/commands/massu-loop/references/iteration-structure.md +46 -14
- package/commands/massu-loop/references/loop-controller.md +72 -63
- package/commands/massu-loop/references/plan-extraction.md +19 -11
- package/commands/massu-loop/references/vr-plan-spec.md +20 -28
- package/commands/massu-loop.md +36 -56
- package/commands/massu-review.md +2 -2
- package/dist/cli.js +0 -0
- package/package.json +1 -1
- package/README.md +0 -40
- package/commands/massu-golden-path/references/phase-3.5-security-audit.md +0 -108
|
@@ -7,24 +7,20 @@
|
|
|
7
7
|
```
|
|
8
8
|
CHECKPOINT AUDIT FLOW:
|
|
9
9
|
[1] READ plan section for this checkpoint
|
|
10
|
-
[2]
|
|
11
|
-
[3]
|
|
12
|
-
[4]
|
|
13
|
-
[5]
|
|
14
|
-
[6]
|
|
15
|
-
[7]
|
|
16
|
-
[8] RUN
|
|
17
|
-
[9] RUN
|
|
18
|
-
[10] RUN
|
|
19
|
-
[11] RUN
|
|
20
|
-
[12]
|
|
21
|
-
[13]
|
|
22
|
-
[14]
|
|
23
|
-
[15]
|
|
24
|
-
[16] COUNT gaps found
|
|
25
|
-
[17] IF gaps > 0: FIX each gap, return to Step 1
|
|
26
|
-
[18] IF gaps = 0: UPDATE session state
|
|
27
|
-
[19] IF gaps = 0: Create checkpoint sign-off
|
|
10
|
+
[2] GREP source files to verify modules/tools exist
|
|
11
|
+
[3] LS files to verify they exist
|
|
12
|
+
[4] VR-TOOL-REG: Verify tools are WIRED in tools.ts (not just created)
|
|
13
|
+
[5] GREP for pattern violations
|
|
14
|
+
[6] RUN build verification (npm run build)
|
|
15
|
+
[7] RUN type verification (cd packages/core && npx tsc --noEmit)
|
|
16
|
+
[8] RUN tests (npm test) - MANDATORY, NOT optional
|
|
17
|
+
[9] RUN hook build (cd packages/core && npm run build:hooks)
|
|
18
|
+
[10] RUN pattern scanner (bash scripts/massu-pattern-scanner.sh)
|
|
19
|
+
[11] RUN security check (secrets staged)
|
|
20
|
+
[12] COUNT gaps found
|
|
21
|
+
[13] IF gaps > 0: FIX each gap, return to Step 1
|
|
22
|
+
[14] IF gaps = 0: UPDATE session state
|
|
23
|
+
[15] IF gaps = 0: Create checkpoint sign-off
|
|
28
24
|
```
|
|
29
25
|
|
|
30
26
|
---
|
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
6. **Post-Compaction Recovery** - Read session state FIRST, re-read plan, resume from exact point.
|
|
13
13
|
7. **No Claims Without Evidence** - "I verified...", "Build passed..." require accompanying proof output.
|
|
14
14
|
8. **Failure Acknowledgment** - Acknowledge failures, re-execute audit from Step 1, log in session state.
|
|
15
|
-
9. **User Flow Audit Required** - ALL
|
|
16
|
-
10. **Component Reuse Verification** - Check existing
|
|
17
|
-
11. **No Workarounds Allowed** -
|
|
15
|
+
9. **User Flow Audit Required** - ALL tools, hooks, handlers, flows verified AFTER technical audits pass.
|
|
16
|
+
10. **Component Reuse Verification** - Check existing modules before creating new ones.
|
|
17
|
+
11. **No Workarounds Allowed** - TODOs, ts-ignore are BLOCKING violations. Pattern scanner is a HARD GATE.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
```
|
|
8
8
|
ITERATION N:
|
|
9
9
|
1. [EXECUTE] Perform task segment
|
|
10
|
-
2. [GUARDRAIL] Run pattern-scanner.sh (ABORT if fails)
|
|
10
|
+
2. [GUARDRAIL] Run massu-pattern-scanner.sh (ABORT if fails)
|
|
11
11
|
3. [GUARDRAIL] Check for security violations
|
|
12
12
|
4. [VERIFY] Run applicable VR-* checks
|
|
13
13
|
5. [AUDIT] Count gaps
|
|
@@ -22,27 +22,27 @@ ITERATION N:
|
|
|
22
22
|
|
|
23
23
|
### MEMORY CHECK (Start of Each Iteration)
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Search memory files and session state for failures related to this plan's domain and files being modified. Surface relevant past failures as additional audit checkpoints.
|
|
26
26
|
|
|
27
27
|
### Enhanced Context Loading
|
|
28
28
|
|
|
29
29
|
For each file being modified:
|
|
30
30
|
- `massu_context` - Load CR rules, schema alerts, patterns relevant to the file
|
|
31
|
-
- `massu_coupling_check` - Verify
|
|
31
|
+
- `massu_coupling_check` - Verify tool registration coupling (CR-11)
|
|
32
32
|
- `massu_knowledge_rule` - Load applicable CR rules for the file's domain
|
|
33
33
|
- `massu_knowledge_verification` - Load required VR-* checks for the file type
|
|
34
34
|
|
|
35
|
-
For VR-
|
|
35
|
+
For VR-TOOL-REG checks, also call `massu_trpc_map` to get automated tool-to-handler mapping for comprehensive coverage.
|
|
36
36
|
|
|
37
|
-
When verifying CR-
|
|
37
|
+
When verifying CR-11 tool registration, use `massu_sentinel_detail` to get full feature details and verify all linked components/tools/handlers exist.
|
|
38
38
|
|
|
39
39
|
When CR-30 applies (rebuilds), call `massu_sentinel_parity` to compare old vs new implementation for feature parity.
|
|
40
40
|
|
|
41
41
|
### Mandatory Checks
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
# Pattern scanner (covers
|
|
45
|
-
|
|
44
|
+
# Pattern scanner (covers all pattern checks)
|
|
45
|
+
bash scripts/massu-pattern-scanner.sh
|
|
46
46
|
# Exit 0 = PASS, non-zero = ABORT iteration
|
|
47
47
|
|
|
48
48
|
# Security check
|
|
@@ -51,21 +51,53 @@ git diff --cached --name-only | grep -E '\.(env|pem|key|secret)' && echo "SECURI
|
|
|
51
51
|
|
|
52
52
|
---
|
|
53
53
|
|
|
54
|
-
##
|
|
54
|
+
## IMPLEMENTATION PROTOCOL
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
### For EACH Plan Item
|
|
57
|
+
|
|
58
|
+
1. **Read the plan item** from the extracted list
|
|
59
|
+
2. **Read any referenced files** before modifying
|
|
60
|
+
3. **Implement** following CLAUDE.md patterns
|
|
61
|
+
4. **Verify** with the item's verification command
|
|
62
|
+
5. **Update coverage** count
|
|
63
|
+
6. **Continue** to next item
|
|
64
|
+
|
|
65
|
+
### Pattern Compliance During Implementation
|
|
66
|
+
|
|
67
|
+
For every file you create or modify, verify against:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Run pattern scanner
|
|
71
|
+
bash scripts/massu-pattern-scanner.sh
|
|
72
|
+
|
|
73
|
+
# Type check
|
|
74
|
+
cd packages/core && npx tsc --noEmit
|
|
75
|
+
|
|
76
|
+
# Tests still pass
|
|
77
|
+
npm test
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Massu-Specific Implementation Checks
|
|
81
|
+
|
|
82
|
+
| If Implementing | Must Also |
|
|
83
|
+
|-----------------|-----------|
|
|
84
|
+
| New MCP tool | Wire 3 functions into tools.ts (CR-11) |
|
|
85
|
+
| New hook | Verify esbuild compilation (CR-12) |
|
|
86
|
+
| Config changes | Update interface in config.ts AND example in YAML |
|
|
87
|
+
| New test | Place in `__tests__/` directory |
|
|
88
|
+
| New module | Use ESM imports, getConfig() for config |
|
|
57
89
|
|
|
58
90
|
---
|
|
59
91
|
|
|
60
|
-
## API/
|
|
92
|
+
## API/TOOL VERIFICATION (When Tool Work Done)
|
|
61
93
|
|
|
62
|
-
Verify
|
|
94
|
+
Verify tools exist with 3-function pattern (getDefs, isTool, handleCall) in tools.ts, input schemas defined, and tool registration is complete.
|
|
63
95
|
|
|
64
96
|
---
|
|
65
97
|
|
|
66
98
|
## ENVIRONMENT & CONFIG VERIFICATION
|
|
67
99
|
|
|
68
|
-
Verify env vars documented, no hardcoded secrets (`grep -rn "sk-\|password.*=" src/` = 0), config files exist.
|
|
100
|
+
Verify env vars documented, no hardcoded secrets (`grep -rn "sk-\|password.*=" packages/core/src/` = 0), config files exist.
|
|
69
101
|
|
|
70
102
|
---
|
|
71
103
|
|
|
@@ -78,7 +110,7 @@ Check for `console.log` (remove for production), error boundaries exist, null sa
|
|
|
78
110
|
## ITERATION OUTPUT FORMAT
|
|
79
111
|
|
|
80
112
|
```markdown
|
|
81
|
-
## [
|
|
113
|
+
## [CS LOOP - Iteration N]
|
|
82
114
|
|
|
83
115
|
### Task
|
|
84
116
|
Phase: X | Task: [description]
|
|
@@ -112,4 +144,4 @@ Update `session-state/CURRENT.md` with: loop status (task, iteration, phase, che
|
|
|
112
144
|
|
|
113
145
|
## CONTEXT MANAGEMENT
|
|
114
146
|
|
|
115
|
-
Use Task tool with subagents for exploration to keep main context clean. Update session state before compaction. After compaction, read
|
|
147
|
+
Use Task tool with subagents for exploration to keep main context clean. Update session state before compaction. After compaction, read session state and resume from correct step. Never mix unrelated tasks during a protocol.
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
This command is a **loop controller** for implementation + verification. Your job is to:
|
|
12
12
|
1. Extract plan items and implement them
|
|
13
|
-
2. After implementation, spawn a `
|
|
13
|
+
2. After implementation, spawn a `general-purpose` subagent for verification
|
|
14
14
|
3. Parse the structured result (`GAPS_DISCOVERED: N`)
|
|
15
15
|
4. If gaps discovered > 0: fix gaps, then spawn ANOTHER FRESH auditor pass
|
|
16
16
|
5. Only when a COMPLETE FRESH PASS discovers ZERO gaps can you declare complete
|
|
17
17
|
|
|
18
18
|
**The verification audit runs inside Task subagents. This prevents early termination.**
|
|
19
19
|
|
|
20
|
-
### CRITICAL: GAPS_DISCOVERED Semantics (Incident #19
|
|
20
|
+
### CRITICAL: GAPS_DISCOVERED Semantics (Incident #19)
|
|
21
21
|
|
|
22
22
|
**`GAPS_DISCOVERED` = total gaps FOUND during the pass, REGARDLESS of whether they were also fixed.**
|
|
23
23
|
|
|
@@ -29,6 +29,26 @@ This command is a **loop controller** for implementation + verification. Your jo
|
|
|
29
29
|
|
|
30
30
|
**THE RULE**: A clean pass means zero gaps DISCOVERED from the start. Fixing gaps during a pass does NOT make it a clean pass. The fixes themselves could introduce new issues. Only a fresh pass starting clean and finding nothing proves correctness.
|
|
31
31
|
|
|
32
|
+
### Agent Result Persistence
|
|
33
|
+
|
|
34
|
+
All Task sub-agents MUST write their results to disk in addition to returning text:
|
|
35
|
+
- Security review: `.massu/agent-results/{timestamp}-security.json`
|
|
36
|
+
- Architecture review: `.massu/agent-results/{timestamp}-architecture.json`
|
|
37
|
+
- Verification audit: `.massu/agent-results/{timestamp}-verify-{iteration}.json`
|
|
38
|
+
|
|
39
|
+
JSON format: `{ iteration, gaps_discovered, gaps_fixed, gaps_remaining, plan_items_total, plan_items_verified, findings: [] }`
|
|
40
|
+
|
|
41
|
+
This prevents context overflow from killing verification progress. If the parent session crashes, a new session can read these files via `bash scripts/hooks/read-agent-results.sh` to resume.
|
|
42
|
+
|
|
43
|
+
### Workflow State Tracking
|
|
44
|
+
|
|
45
|
+
At the start of this command, write a transition entry to `.massu/workflow-log.md`:
|
|
46
|
+
```
|
|
47
|
+
| [timestamp] | AUDIT/PLAN | IMPLEMENT | /massu-loop | [session-id] |
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
At completion, write a completion entry.
|
|
51
|
+
|
|
32
52
|
### Execution Protocol
|
|
33
53
|
|
|
34
54
|
```
|
|
@@ -39,88 +59,68 @@ iteration = 0
|
|
|
39
59
|
# Read plan, extract items, implement each one with VR-* proof
|
|
40
60
|
|
|
41
61
|
# Phase 1.5: MULTI-PERSPECTIVE REVIEW (after implementation, before verification)
|
|
42
|
-
# Spawn
|
|
62
|
+
# Spawn focused review subagents IN PARALLEL for independent analysis
|
|
43
63
|
# Each reviewer has an adversarial mindset and a SINGLE focused concern (Principle #20)
|
|
44
64
|
# Elegance/simplicity assessment happens in Phase 2.1 POST-BUILD REFLECTION (Q4)
|
|
45
65
|
|
|
46
|
-
security_result = Task(subagent_type="
|
|
66
|
+
security_result = Task(subagent_type="general-purpose", model="opus", prompt="
|
|
47
67
|
Review implementation for plan: {PLAN_PATH}
|
|
48
68
|
Focus: Security vulnerabilities, auth gaps, input validation, data exposure
|
|
49
69
|
Check all new/modified files. Return structured result with SECURITY_GATE.
|
|
50
70
|
")
|
|
51
71
|
|
|
52
|
-
architecture_result = Task(subagent_type="
|
|
72
|
+
architecture_result = Task(subagent_type="general-purpose", model="opus", prompt="
|
|
53
73
|
Review implementation for plan: {PLAN_PATH}
|
|
54
74
|
Focus: Design issues, coupling problems, pattern compliance, scalability
|
|
55
75
|
Check all new/modified files. Return structured result with ARCHITECTURE_GATE.
|
|
56
76
|
")
|
|
57
77
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Check all new/modified UI files. Return structured result with UX_GATE.
|
|
62
|
-
")
|
|
63
|
-
|
|
64
|
-
# Parse results and fix any CRITICAL/HIGH findings before proceeding to verification
|
|
65
|
-
# FAIL gate = must fix before proceeding
|
|
66
|
-
# WARN findings = document and proceed
|
|
67
|
-
|
|
68
|
-
# Phase 1.6: TEST-FIRST FOR CRITICAL FINDINGS
|
|
69
|
-
# If ANY Phase 1.5 reviewer flagged a CRITICAL-severity BUG (not pattern violation):
|
|
70
|
-
# 1. Read _shared-references/test-first-protocol.md
|
|
71
|
-
# 2. For EACH critical bug finding:
|
|
72
|
-
# - Write a failing test that demonstrates the bug (Step 1)
|
|
73
|
-
# - Verify the test fails for the expected reason (Step 2)
|
|
74
|
-
# - Apply the fix (Step 3)
|
|
75
|
-
# - Verify the test passes (Step 4)
|
|
76
|
-
# 3. Report TEST_FIRST_GATE: PASS or SKIPPED (with reason)
|
|
77
|
-
# If NO critical bug findings: skip this phase entirely
|
|
78
|
+
# Parse results and fix ALL findings at ALL severity levels (CR-45)
|
|
79
|
+
# CRITICAL, HIGH, MEDIUM, LOW — all get fixed before proceeding
|
|
80
|
+
# No severity is exempt — "clean pass" means ZERO findings
|
|
78
81
|
|
|
79
82
|
# Phase 2: VERIFY (audit loop - STRUCTURAL)
|
|
80
83
|
WHILE true:
|
|
81
84
|
iteration += 1
|
|
82
85
|
|
|
83
|
-
# Run circuit breaker check (
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
IF CIRCUIT_BREAKER_STATUS == "DEPTH_EXCEEDED":
|
|
87
|
-
Output: "CIRCUIT BREAKER: Loop depth exceeded (nested spawn detected)."
|
|
88
|
-
Output: "Current LOOP_DEPTH exceeds MAX_LOOP_DEPTH. Refusing to continue."
|
|
89
|
-
STOP loop immediately — cascade prevention.
|
|
90
|
-
|
|
91
|
-
IF CIRCUIT_BREAKER_STATUS == "BAIL_AND_REPLAN":
|
|
86
|
+
# Run circuit breaker check (detect stagnation)
|
|
87
|
+
# If same gaps appear 3+ times with no progress, consider changing approach
|
|
88
|
+
IF iteration > 3 AND no_progress_count >= 3:
|
|
92
89
|
Output: "CIRCUIT BREAKER: The current approach is not converging after {iteration} passes."
|
|
93
|
-
Output: "No progress: {no_progress_count} passes | Same errors: {same_error_count} passes"
|
|
94
90
|
Output: "Options: (a) Re-plan with different approach (b) Continue current approach (c) Stop"
|
|
95
91
|
AskUserQuestion: "The loop has stalled. How should we proceed?"
|
|
96
92
|
IF user chooses re-plan: STOP loop, output current state, recommend /massu-create-plan
|
|
97
|
-
IF user chooses continue: CONTINUE loop (reset circuit breaker
|
|
98
|
-
IF user chooses stop: STOP loop, output current state as incomplete
|
|
99
|
-
|
|
100
|
-
IF CIRCUIT_BREAKER_STATUS == "PLAN_FUNDAMENTALLY_WRONG":
|
|
101
|
-
Output: "CIRCUIT BREAKER: Plan is fundamentally wrong — {distinct_failures} different items have failed."
|
|
102
|
-
Output: "This indicates a systemic plan issue, not isolated implementation problems."
|
|
103
|
-
Output: "Options:"
|
|
104
|
-
Output: " (a) DISPOSE plan and regenerate from scratch (preserves learnings)"
|
|
105
|
-
Output: " (b) Continue with current plan (override)"
|
|
106
|
-
Output: " (c) Stop and review manually"
|
|
107
|
-
AskUserQuestion: "The plan appears fundamentally flawed. How should we proceed?"
|
|
108
|
-
IF user chooses dispose:
|
|
109
|
-
- Save failed items + error context to plan trajectory file
|
|
110
|
-
- STOP loop, output current state
|
|
111
|
-
- Recommend: /massu-create-plan with failed items as constraints
|
|
112
|
-
- The NEW plan goes through the same zero-gaps audit loop before implementation
|
|
113
|
-
IF user chooses continue: CONTINUE loop (reset: bash scripts/hooks/loop-circuit-breaker.sh --reset)
|
|
93
|
+
IF user chooses continue: CONTINUE loop (reset circuit breaker)
|
|
114
94
|
IF user chooses stop: STOP loop, output current state as incomplete
|
|
115
95
|
|
|
116
96
|
# Spawn auditor subagent for ONE complete verification pass
|
|
117
|
-
result = Task(subagent_type="
|
|
118
|
-
|
|
97
|
+
result = Task(subagent_type="general-purpose", model="opus", prompt="
|
|
98
|
+
Verification audit iteration {iteration} for plan: {PLAN_PATH}
|
|
99
|
+
This is a Massu implementation (library/MCP server, NOT a web app).
|
|
119
100
|
Execute ONE complete audit pass. Verify ALL deliverables.
|
|
120
|
-
Check code quality (patterns,
|
|
101
|
+
Check code quality (patterns, types, tests).
|
|
121
102
|
Check plan coverage (every item verified with proof).
|
|
122
103
|
Fix any gaps you find (code or plan document).
|
|
123
104
|
|
|
105
|
+
CONTEXT: Massu is a TypeScript monorepo with:
|
|
106
|
+
- packages/core/src/ (MCP server source)
|
|
107
|
+
- packages/core/src/__tests__/ (vitest tests)
|
|
108
|
+
- packages/core/src/hooks/ (esbuild-compiled hooks)
|
|
109
|
+
- website/ (Next.js + Supabase website)
|
|
110
|
+
- massu.config.yaml (project config)
|
|
111
|
+
- Tool registration: 3-function pattern (getDefs, isTool, handleCall) in tools.ts
|
|
112
|
+
|
|
113
|
+
VERIFICATION COMMANDS:
|
|
114
|
+
- Pattern scanner: bash scripts/massu-pattern-scanner.sh
|
|
115
|
+
- Type check: cd packages/core && npx tsc --noEmit
|
|
116
|
+
- Tests: npm test
|
|
117
|
+
- Hook build: cd packages/core && npm run build:hooks
|
|
118
|
+
|
|
119
|
+
VR-* CHECKS (use ONLY these, per CLAUDE.md):
|
|
120
|
+
- VR-FILE, VR-GREP, VR-NEGATIVE, VR-COUNT (generic)
|
|
121
|
+
- VR-BUILD: npm run build (tsc + hooks)
|
|
122
|
+
- VR-TYPE, VR-TEST, VR-TOOL-REG, VR-HOOK-BUILD, VR-CONFIG, VR-PATTERN
|
|
123
|
+
|
|
124
124
|
CRITICAL INSTRUCTION FOR GAPS_DISCOVERED:
|
|
125
125
|
Report GAPS_DISCOVERED as the total number of gaps you FOUND during this pass,
|
|
126
126
|
EVEN IF you also fixed them. Finding 5 gaps and fixing all 5 = GAPS_DISCOVERED: 5.
|
|
@@ -128,7 +128,17 @@ WHILE true:
|
|
|
128
128
|
Do NOT report 0 just because you fixed everything. The loop controller needs to know
|
|
129
129
|
whether this was a clean pass (found nothing) or a dirty pass (found and fixed things).
|
|
130
130
|
|
|
131
|
-
Return the structured result block
|
|
131
|
+
Return the structured result block:
|
|
132
|
+
---STRUCTURED-RESULT---
|
|
133
|
+
ITERATION: {iteration}
|
|
134
|
+
GAPS_DISCOVERED: [number]
|
|
135
|
+
GAPS_FIXED: [number]
|
|
136
|
+
GAPS_REMAINING: [number]
|
|
137
|
+
PLAN_ITEMS_TOTAL: [number]
|
|
138
|
+
PLAN_ITEMS_VERIFIED: [number]
|
|
139
|
+
CODE_QUALITY_GATE: PASS/FAIL
|
|
140
|
+
PLAN_COVERAGE_GATE: PASS/FAIL
|
|
141
|
+
---END-RESULT---
|
|
132
142
|
")
|
|
133
143
|
|
|
134
144
|
# Parse structured result
|
|
@@ -162,16 +172,15 @@ END WHILE
|
|
|
162
172
|
| **ALWAYS use Task tool for verification passes** | Subagents keep context clean |
|
|
163
173
|
| **ALWAYS parse GAPS_DISCOVERED from result** | This is the loop control variable (DISCOVERED, not REMAINING) |
|
|
164
174
|
| **Maximum 10 iterations** | If still failing after 10, report to user with remaining gaps |
|
|
165
|
-
| **ALWAYS run multi-perspective review after implementation** |
|
|
166
|
-
| **Run review subagents IN PARALLEL** | Security
|
|
175
|
+
| **ALWAYS run multi-perspective review after implementation** | Multiple reviewers catch different issues than 1 auditor |
|
|
176
|
+
| **Run review subagents IN PARALLEL** | Security and architecture reviews are independent |
|
|
167
177
|
| **Fix CRITICAL/HIGH findings before verification** | Don't waste auditor passes on known issues |
|
|
168
|
-
| **VR-PIPELINE for data features (CR-43)** | After implementing any data pipeline (AI, cron, generation, ETL), trigger it manually and verify non-empty output before marking complete |
|
|
169
178
|
|
|
170
179
|
### Why This Architecture Exists
|
|
171
180
|
|
|
172
|
-
**Incident #14
|
|
181
|
+
**Incident #14**: Audit loop terminated after 1 pass with open gaps. Root cause: instructional "MUST loop" text competed with default "report and stop" behavior. By making the loop STRUCTURAL (spawn subagent, check result, loop), early termination becomes structurally impossible.
|
|
173
182
|
|
|
174
|
-
**Incident #19
|
|
183
|
+
**Incident #19**: Auditor found 16 gaps and fixed all 16 in the same pass, reported GAPS_FOUND: 0. Loop exited after 1 iteration without verifying the fixes. GAPS_DISCOVERED (not GAPS_REMAINING) is the correct metric.
|
|
175
184
|
|
|
176
185
|
---
|
|
177
186
|
|
|
@@ -183,6 +192,6 @@ The loop controller (main agent) coordinates; subagents execute scoped work. Fol
|
|
|
183
192
|
|-----------|---------|
|
|
184
193
|
| **One task per subagent** | Each Task call has a single, scoped objective (Principle #20) |
|
|
185
194
|
| **Main agent fixes, subagent verifies** | Controller fixes code-level gaps; auditor subagent re-verifies |
|
|
186
|
-
| **No nested spawns** | Subagents NEVER spawn their own subagents
|
|
187
|
-
| **Parallel only when independent** | Review agents (security, architecture
|
|
195
|
+
| **No nested spawns** | Subagents NEVER spawn their own subagents |
|
|
196
|
+
| **Parallel only when independent** | Review agents (security, architecture) run in parallel; sequential passes run sequentially |
|
|
188
197
|
| **Budget awareness** | Each subagent pass costs ~20-40K tokens. 10 iterations = significant cost. Fix root causes, not symptoms |
|
|
@@ -23,16 +23,24 @@ For EACH section of the plan, extract concrete items into a table:
|
|
|
23
23
|
|
|
24
24
|
### Source Document
|
|
25
25
|
- **Plan File**: [path]
|
|
26
|
+
- **Plan Title**: [title]
|
|
26
27
|
- **Total Sections**: [N]
|
|
27
28
|
|
|
28
29
|
### Extracted Items
|
|
29
30
|
| Item # | Type | Description | Location | Verification Command | Status |
|
|
30
31
|
|--------|------|-------------|----------|---------------------|--------|
|
|
31
|
-
| P1-001 |
|
|
32
|
-
| P1-002 |
|
|
32
|
+
| P1-001 | MODULE_CREATE | foo-tools.ts | packages/core/src/ | ls -la [path] | PENDING |
|
|
33
|
+
| P1-002 | TOOL_WIRE | Wire into tools.ts | packages/core/src/tools.ts | grep [module] tools.ts | PENDING |
|
|
34
|
+
| P2-001 | TEST | foo.test.ts | packages/core/src/__tests__/ | npm test | PENDING |
|
|
33
35
|
|
|
34
36
|
### Item Types
|
|
35
|
-
|
|
37
|
+
- MODULE_CREATE: New TypeScript module
|
|
38
|
+
- MODULE_MODIFY: Existing module to change
|
|
39
|
+
- TOOL_WIRE: Wire tool into tools.ts
|
|
40
|
+
- TEST: Test file
|
|
41
|
+
- CONFIG: Config changes (config.ts + YAML)
|
|
42
|
+
- HOOK: New or modified hook
|
|
43
|
+
- REMOVAL: Code/file to remove (use VR-NEGATIVE)
|
|
36
44
|
|
|
37
45
|
### Coverage Summary
|
|
38
46
|
- **Total Items**: [N] | **Verified Complete**: 0 | **Coverage**: 0%
|
|
@@ -42,13 +50,13 @@ FILE_CREATE, FILE_MODIFY, COMPONENT, PROCEDURE, MIGRATION, FEATURE, REMOVAL (VR-
|
|
|
42
50
|
|
|
43
51
|
| Item Type | Verification Method | Expected Result |
|
|
44
52
|
|-----------|---------------------|-----------------|
|
|
45
|
-
|
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
| REMOVAL | `grep -rn "[old]" src/
|
|
53
|
+
| MODULE_CREATE | `ls -la [path]` | File exists, size > 0 |
|
|
54
|
+
| MODULE_MODIFY | `grep "[change]" [file]` | Pattern found |
|
|
55
|
+
| TOOL_WIRE | `grep "getXDefs\|isXTool\|handleXCall" tools.ts` | All 3 present |
|
|
56
|
+
| TEST | `npm test` | All pass |
|
|
57
|
+
| CONFIG | Parse YAML, grep interface | Valid |
|
|
58
|
+
| HOOK | `cd packages/core && npm run build:hooks` | Exit 0 |
|
|
59
|
+
| REMOVAL | `grep -rn "[old]" packages/core/src/ | wc -l` | 0 matches |
|
|
52
60
|
|
|
53
61
|
### Step 0.4: Track Coverage Throughout
|
|
54
62
|
|
|
@@ -67,7 +75,7 @@ Add completion table to TOP of plan document with status for each task:
|
|
|
67
75
|
|
|
68
76
|
| # | Task/Phase | Status | Verification | Date |
|
|
69
77
|
|---|------------|--------|--------------|------|
|
|
70
|
-
| 1 | [description] | 100% COMPLETE | VR-GREP: 0 refs |
|
|
78
|
+
| 1 | [description] | 100% COMPLETE | VR-GREP: 0 refs | [date] |
|
|
71
79
|
```
|
|
72
80
|
|
|
73
81
|
### VR-PLAN-STATUS Verification
|
|
@@ -10,16 +10,16 @@
|
|
|
10
10
|
### VR-PLAN: Verification Strategy
|
|
11
11
|
|
|
12
12
|
**Work being verified**: [description]
|
|
13
|
-
**Domains touched**: [
|
|
13
|
+
**Domains touched**: [tools / hooks / config / tests / website]
|
|
14
14
|
|
|
15
15
|
| # | VR-* Check | Target File/Component | Why Applicable | Status |
|
|
16
16
|
|---|------------|----------------------|----------------|--------|
|
|
17
17
|
| 1 | VR-BUILD | Full project | Always required | PENDING |
|
|
18
|
-
| 2 | VR-TYPE |
|
|
19
|
-
| 3 | VR-TEST |
|
|
18
|
+
| 2 | VR-TYPE | packages/core | Always required | PENDING |
|
|
19
|
+
| 3 | VR-TEST | All tests | Always required | PENDING |
|
|
20
20
|
| ... | ... | ... | ... | ... |
|
|
21
21
|
|
|
22
|
-
**Execution order**: VR-
|
|
22
|
+
**Execution order**: VR-FILE first -> VR-BUILD/VR-TYPE -> VR-TEST -> VR-TOOL-REG -> VR-HOOK-BUILD -> VR-PATTERN
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
### Mandatory Checks (ALWAYS include)
|
|
@@ -28,20 +28,16 @@
|
|
|
28
28
|
|-------|----------------|
|
|
29
29
|
| VR-BUILD | ALWAYS |
|
|
30
30
|
| VR-TYPE | ALWAYS |
|
|
31
|
-
| VR-TEST | ALWAYS
|
|
31
|
+
| VR-TEST | ALWAYS |
|
|
32
32
|
| VR-FILE | When files created |
|
|
33
33
|
| VR-GREP | When code added |
|
|
34
34
|
| VR-NEGATIVE | When code removed |
|
|
35
|
-
| VR-
|
|
36
|
-
| VR-
|
|
37
|
-
| VR-
|
|
38
|
-
| VR-
|
|
39
|
-
| VR-HANDLER | When buttons/actions added |
|
|
40
|
-
| VR-API-CONTRACT | When frontend calls backend |
|
|
35
|
+
| VR-TOOL-REG | When new tools added (3-function pattern in tools.ts) |
|
|
36
|
+
| VR-HOOK-BUILD | When hooks added or modified |
|
|
37
|
+
| VR-CONFIG | When config.ts or massu.config.yaml changed |
|
|
38
|
+
| VR-PATTERN | Always (pattern scanner) |
|
|
41
39
|
| VR-PLAN-COVERAGE | When implementing a plan |
|
|
42
|
-
| VR-
|
|
43
|
-
| VR-PIPELINE | When data pipeline features implemented (CR-43) |
|
|
44
|
-
| VR-RUNTIME | After all other checks pass |
|
|
40
|
+
| VR-COUNT | When verifying numeric expectations |
|
|
45
41
|
|
|
46
42
|
Do NOT start verification until VR-PLAN is complete with all domains, checks, targets, and execution order.
|
|
47
43
|
|
|
@@ -49,18 +45,16 @@ Do NOT start verification until VR-PLAN is complete with all domains, checks, ta
|
|
|
49
45
|
|
|
50
46
|
## COMPLETION CRITERIA
|
|
51
47
|
|
|
52
|
-
|
|
48
|
+
CS Loop is COMPLETE **only when BOTH gates pass: Code Quality AND Plan Coverage**.
|
|
53
49
|
|
|
54
50
|
### GATE 1: Code Quality Verification (All Must Pass in SAME Audit Run)
|
|
55
51
|
- [ ] All phases executed, all checkpoints passed with zero gaps
|
|
56
52
|
- [ ] Pattern scanner: Exit 0
|
|
57
53
|
- [ ] Type check: 0 errors
|
|
58
54
|
- [ ] Build: Exit 0
|
|
59
|
-
- [ ] Lint: Exit 0
|
|
60
|
-
- [ ] Prisma validate: Exit 0
|
|
61
55
|
- [ ] Tests: ALL PASS (MANDATORY)
|
|
56
|
+
- [ ] Hook build: Exit 0
|
|
62
57
|
- [ ] Security: No secrets staged
|
|
63
|
-
- [ ] VR-RENDER: All UI components rendered in pages
|
|
64
58
|
|
|
65
59
|
### GATE 2: Plan Coverage Verification
|
|
66
60
|
- [ ] Plan file read (actual file, not memory)
|
|
@@ -77,7 +71,7 @@ Massu Loop is COMPLETE **only when BOTH gates pass: Code Quality AND Plan Covera
|
|
|
77
71
|
## DUAL VERIFICATION RESULT
|
|
78
72
|
| Gate | Status | Details |
|
|
79
73
|
|------|--------|---------|
|
|
80
|
-
| Code Quality | PASS/FAIL | Pattern scanner, build, types |
|
|
74
|
+
| Code Quality | PASS/FAIL | Pattern scanner, build, types, tests |
|
|
81
75
|
| Plan Coverage | PASS/FAIL | X/Y items (Z%) |
|
|
82
76
|
|
|
83
77
|
**RESULT: COMPLETE** (only if both PASS)
|
|
@@ -86,12 +80,10 @@ Massu Loop is COMPLETE **only when BOTH gates pass: Code Quality AND Plan Covera
|
|
|
86
80
|
**Code Quality: PASS + Plan Coverage: FAIL = NOT COMPLETE**
|
|
87
81
|
|
|
88
82
|
### Additional Verification
|
|
89
|
-
- [ ]
|
|
90
|
-
- [ ]
|
|
91
|
-
- [ ] DB verified: all environments
|
|
83
|
+
- [ ] Tool Registration: ALL new tools wired in tools.ts (3-function pattern)
|
|
84
|
+
- [ ] Hook Build: esbuild compilation succeeds
|
|
92
85
|
- [ ] Session state shows COMPLETED
|
|
93
86
|
- [ ] Phase archives created
|
|
94
|
-
- [ ] Help site updated for user-facing changes (or N/A)
|
|
95
87
|
- [ ] Plan document completion table added at TOP
|
|
96
88
|
|
|
97
89
|
---
|
|
@@ -99,7 +91,7 @@ Massu Loop is COMPLETE **only when BOTH gates pass: Code Quality AND Plan Covera
|
|
|
99
91
|
## COMPLETION OUTPUT
|
|
100
92
|
|
|
101
93
|
```markdown
|
|
102
|
-
## [
|
|
94
|
+
## [CS LOOP - COMPLETE]
|
|
103
95
|
|
|
104
96
|
### Dual Verification Certification
|
|
105
97
|
- **Audit loops required**: N (loop #N achieved 0 gaps + 100% coverage)
|
|
@@ -115,11 +107,11 @@ Massu Loop is COMPLETE **only when BOTH gates pass: Code Quality AND Plan Covera
|
|
|
115
107
|
### GATE 1: Code Quality Evidence
|
|
116
108
|
| Gate | Command | Result |
|
|
117
109
|
|------|---------|--------|
|
|
118
|
-
| Pattern scanner |
|
|
119
|
-
| Type check | `npx tsc --noEmit` | 0 errors |
|
|
110
|
+
| Pattern scanner | `bash scripts/massu-pattern-scanner.sh` | Exit 0 |
|
|
111
|
+
| Type check | `cd packages/core && npx tsc --noEmit` | 0 errors |
|
|
120
112
|
| Build | `npm run build` | Exit 0 |
|
|
121
|
-
|
|
|
122
|
-
|
|
|
113
|
+
| Tests | `npm test` | All pass |
|
|
114
|
+
| Hook build | `cd packages/core && npm run build:hooks` | Exit 0 |
|
|
123
115
|
|
|
124
116
|
### GATE 2: Plan Coverage Evidence
|
|
125
117
|
| Item # | Description | Verification | Status |
|