@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
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Phase 1: Plan Creation & Audit
|
|
2
|
+
|
|
3
|
+
> Reference doc for `/massu-golden-path`. Return to main file for overview.
|
|
4
|
+
|
|
5
|
+
## Phase 1A: Research & Reality Check
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
[GOLDEN PATH -- PHASE 1A: RESEARCH & REALITY CHECK]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**If plan file was provided**: Skip to Phase 1C.
|
|
12
|
+
|
|
13
|
+
### 1A.1 Feature Understanding
|
|
14
|
+
|
|
15
|
+
- Call `massu_knowledge_search`, `massu_knowledge_pattern`, `massu_knowledge_schema_check` with feature name
|
|
16
|
+
- Document: exact user request, feature type, affected domains
|
|
17
|
+
- Search codebase for similar features, routers, pages
|
|
18
|
+
|
|
19
|
+
### 1A.2 Database Reality Check (VR-SCHEMA-PRE)
|
|
20
|
+
|
|
21
|
+
For EACH table the feature might use, query via MCP:
|
|
22
|
+
|
|
23
|
+
```sql
|
|
24
|
+
SELECT column_name, data_type, is_nullable, column_default
|
|
25
|
+
FROM information_schema.columns WHERE table_name = '[TABLE]' ORDER BY ordinal_position;
|
|
26
|
+
|
|
27
|
+
SELECT polname, polcmd FROM pg_policies WHERE tablename = '[TABLE]';
|
|
28
|
+
|
|
29
|
+
SELECT grantee, privilege_type FROM information_schema.table_privileges WHERE table_name = '[TABLE]';
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Run `./scripts/check-bad-columns.sh`. Call `massu_schema` for Prisma cross-reference.
|
|
33
|
+
Document: existing tables, required new tables/columns, migration SQL previews.
|
|
34
|
+
|
|
35
|
+
### 1A.3 Config-Code Alignment (VR-DATA)
|
|
36
|
+
|
|
37
|
+
If feature uses DB-stored configs:
|
|
38
|
+
|
|
39
|
+
```sql
|
|
40
|
+
SELECT DISTINCT jsonb_object_keys(config_column) as keys FROM config_table;
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Compare to code: `grep -rn "config\." src/lib/[feature]/ | grep -oP 'config\.\w+' | sort -u`
|
|
44
|
+
|
|
45
|
+
### 1A.4 Codebase Reality Check
|
|
46
|
+
|
|
47
|
+
- Verify target directories/files exist
|
|
48
|
+
- Read similar routers and components
|
|
49
|
+
- Load relevant pattern files (database/auth/ui/realtime/build)
|
|
50
|
+
|
|
51
|
+
### 1A.5 Blast Radius Analysis (CR-25)
|
|
52
|
+
|
|
53
|
+
**MANDATORY when plan changes any constant, path, route, enum, or config key.**
|
|
54
|
+
|
|
55
|
+
1. Identify ALL changed values (old -> new)
|
|
56
|
+
2. Codebase-wide grep for EACH value
|
|
57
|
+
3. Call `massu_impact` for indirect impact through import chains
|
|
58
|
+
4. If plan deletes files: call `massu_sentinel_impact` -- zero orphaned features allowed
|
|
59
|
+
5. Categorize EVERY occurrence: CHANGE / KEEP (with reason) / INVESTIGATE
|
|
60
|
+
6. Resolve ALL INVESTIGATE to 0. Add ALL CHANGE items as plan deliverables.
|
|
61
|
+
|
|
62
|
+
### 1A.6 Pattern Compliance Check
|
|
63
|
+
|
|
64
|
+
Check applicable patterns: ctx.db, user_profiles, 3-step query, BigInt/Decimal, RLS+Grants, Suspense, Select.Item, protectedProcedure, Zod validation. Read most similar router/component for patterns used.
|
|
65
|
+
|
|
66
|
+
### 1A.7 Backend-Frontend Coupling Check (CR-12)
|
|
67
|
+
|
|
68
|
+
For EVERY backend z.enum, type, or procedure planned -- verify a corresponding frontend item exists. If NOT, ADD IT.
|
|
69
|
+
|
|
70
|
+
### 1A.8 Question Filtering
|
|
71
|
+
|
|
72
|
+
1. List all open questions
|
|
73
|
+
2. Self-answer anything answerable by reading code or querying DB
|
|
74
|
+
3. Surface only business logic / UX / scope / priority questions to user via AskUserQuestion
|
|
75
|
+
4. If all self-answerable, skip user prompt
|
|
76
|
+
|
|
77
|
+
### 1A.9 Security Pre-Screen (6 Dimensions)
|
|
78
|
+
|
|
79
|
+
| Dim | Check | If Triggered |
|
|
80
|
+
|-----|-------|-------------|
|
|
81
|
+
| S1 | PII / Sensitive Data | Add RLS + column-level access |
|
|
82
|
+
| S2 | Authentication | Verify protectedProcedure |
|
|
83
|
+
| S3 | Authorization | Add RBAC checks, RLS policies |
|
|
84
|
+
| S4 | Injection Surfaces | Add Zod validation, parameterized queries |
|
|
85
|
+
| S5 | Secrets Management (CR-5) | Add AWS Secrets Manager items |
|
|
86
|
+
| S6 | Rate Limiting | Add rate limiting middleware |
|
|
87
|
+
|
|
88
|
+
**BLOCKS_REMAINING must = 0 before proceeding.**
|
|
89
|
+
|
|
90
|
+
### 1A.10 ADR Generation (Optional)
|
|
91
|
+
|
|
92
|
+
For architectural decisions: `massu_adr_list` -> `massu_adr_generate`.
|
|
93
|
+
|
|
94
|
+
Mark all coverage dimensions as `done` or `n/a`.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Phase 1B: Plan Generation
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
[GOLDEN PATH -- PHASE 1B: PLAN GENERATION]
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Write plan to: `plans/[YYYY-MM-DD]-[feature-name].md`
|
|
105
|
+
|
|
106
|
+
**Plan structure** (P-XXX numbered items):
|
|
107
|
+
- Overview (feature, complexity, domains, item count)
|
|
108
|
+
- Requirements Coverage Map (D1-D10 all resolved)
|
|
109
|
+
- Phase 0: Credentials & Secrets (CR-5)
|
|
110
|
+
- Phase 1: Database Changes (migrations with exact SQL)
|
|
111
|
+
- Phase 2: Backend Implementation (routers, procedures, input schemas)
|
|
112
|
+
- Phase 3: Frontend Implementation (components, pages, renders-in)
|
|
113
|
+
- Phase 4: Testing & Verification
|
|
114
|
+
- Phase 5: Documentation (help site pages, changelog)
|
|
115
|
+
- Verification Commands table
|
|
116
|
+
- Item Summary table
|
|
117
|
+
- Risk Assessment
|
|
118
|
+
- Dependencies
|
|
119
|
+
|
|
120
|
+
**Item numbering**: P0-XXX (secrets), P1-XXX (database), P2-XXX (backend), P3-XXX (frontend), P4-XXX (testing), P5-XXX (docs).
|
|
121
|
+
|
|
122
|
+
**Implementation Specificity Check**: Every item MUST have exact file path, exact content/SQL, insertion point, format matches target, verification command.
|
|
123
|
+
|
|
124
|
+
**Documentation Impact Assessment**: If ANY user-facing features, Phase 5 deliverables are MANDATORY.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Phase 1C: Plan Audit Loop
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
[GOLDEN PATH -- PHASE 1C: PLAN AUDIT LOOP]
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Run audit loop using subagent architecture (prevents early termination):
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
iteration = 0
|
|
138
|
+
WHILE true:
|
|
139
|
+
iteration += 1
|
|
140
|
+
|
|
141
|
+
result = Task(subagent_type="massu-plan-auditor", model="opus", prompt="
|
|
142
|
+
Audit iteration {iteration} for plan: {PLAN_PATH}
|
|
143
|
+
Execute ONE complete audit pass. Verify ALL deliverables.
|
|
144
|
+
Check: VR-PLAN-FEASIBILITY, VR-PLAN-SPECIFICITY, Pattern Alignment, Schema Reality.
|
|
145
|
+
Fix any plan document gaps you find.
|
|
146
|
+
|
|
147
|
+
CRITICAL: Report GAPS_DISCOVERED as total gaps FOUND, EVEN IF you fixed them.
|
|
148
|
+
Finding N gaps and fixing all N = GAPS_DISCOVERED: N.
|
|
149
|
+
A clean pass finding nothing = GAPS_DISCOVERED: 0.
|
|
150
|
+
")
|
|
151
|
+
|
|
152
|
+
gaps = parse GAPS_DISCOVERED from result
|
|
153
|
+
IF gaps == 0: BREAK (clean pass)
|
|
154
|
+
ELSE: CONTINUE (re-audit)
|
|
155
|
+
|
|
156
|
+
IF iteration >= 10: Report to user, ask how to proceed
|
|
157
|
+
END WHILE
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**VR-PLAN-FEASIBILITY**: DB schema exists, files exist, dependencies available, patterns documented, credentials planned.
|
|
161
|
+
**VR-PLAN-SPECIFICITY**: Every item has exact path, exact content, insertion point, verification command.
|
|
162
|
+
**Pattern Alignment**: Cross-reference ALL applicable patterns from CLAUDE.md and patterns/*.md.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Phase 1 Complete -> APPROVAL POINT #1: PLAN
|
|
167
|
+
|
|
168
|
+
See `approval-points.md` for the exact format.
|
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
# Phase 2: Implementation
|
|
2
|
+
|
|
3
|
+
> Reference doc for `/massu-golden-path`. Return to main file for overview.
|
|
4
|
+
|
|
5
|
+
## Competitive Mode Check
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
IF --competitive flag:
|
|
9
|
+
Read references/competitive-mode.md and execute Phase 2-COMP protocol
|
|
10
|
+
SKIP Phase 2A-2G (competitive mode handles implementation differently)
|
|
11
|
+
After winner selection, continue with Phase 2.5
|
|
12
|
+
ELSE:
|
|
13
|
+
Execute standard Phase 2A-2G as below
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Phase 2A: Plan Item Extraction & Setup
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
[GOLDEN PATH -- PHASE 2: IMPLEMENTATION]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
1. Read plan from disk (NOT memory)
|
|
25
|
+
2. Extract ALL deliverables into tracking table:
|
|
26
|
+
|
|
27
|
+
| Item # | Type | Description | Location | Verification | Status |
|
|
28
|
+
|--------|------|-------------|----------|--------------|--------|
|
|
29
|
+
| P1-001 | MIGRATION | ... | ... | VR-SCHEMA | PENDING |
|
|
30
|
+
|
|
31
|
+
3. Create VR-PLAN verification strategy:
|
|
32
|
+
|
|
33
|
+
| # | VR-* Check | Target | Why Applicable | Status |
|
|
34
|
+
|---|-----------|--------|----------------|--------|
|
|
35
|
+
| 1 | VR-BUILD | Full project | Always | PENDING |
|
|
36
|
+
|
|
37
|
+
4. Initialize session state with AUTHORIZED_COMMAND: massu-golden-path
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Phase 2A.5: Sprint Contracts
|
|
42
|
+
|
|
43
|
+
> Full protocol: [sprint-contract-protocol.md](sprint-contract-protocol.md)
|
|
44
|
+
|
|
45
|
+
**Before implementation begins**, negotiate a sprint contract for each plan item:
|
|
46
|
+
|
|
47
|
+
1. For each plan item in the tracking table:
|
|
48
|
+
- Define **Scope Boundary** (IN/OUT)
|
|
49
|
+
- Define **Implementation Approach** (files, patterns)
|
|
50
|
+
- Write **3-5 Acceptance Criteria** (must be specific enough that two independent evaluators agree on PASS/FAIL)
|
|
51
|
+
- Map to **VR-\* Verification Types**
|
|
52
|
+
|
|
53
|
+
2. Add contract columns to the Phase 2A tracking table:
|
|
54
|
+
|
|
55
|
+
| Item # | Type | Description | Location | Verification | Scope Boundary | Acceptance Criteria | Contract Status |
|
|
56
|
+
|--------|------|-------------|----------|--------------|----------------|---------------------|-----------------|
|
|
57
|
+
| P1-001 | MIGRATION | ... | ... | VR-SCHEMA | IN: ... / OUT: ... | 1. ... 2. ... 3. ... | AGREED |
|
|
58
|
+
|
|
59
|
+
3. **Quality bar**: Criteria using words like "good", "correct", "proper" without specifics = reject and rewrite. Each contract must include criteria from at least 3 categories: happy path, data display, empty/loading/error states, user feedback, edge cases.
|
|
60
|
+
|
|
61
|
+
4. **Skip conditions**: Mark `Contract: N/A` for pure refactors (VR-BUILD + VR-TYPE + VR-TEST sufficient), documentation-only items, and migrations where SQL IS the contract.
|
|
62
|
+
|
|
63
|
+
5. **Max 3 negotiation rounds** per item. If unresolved, escalate via AskUserQuestion.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Phase 2B: Implementation Loop
|
|
68
|
+
|
|
69
|
+
For each plan item:
|
|
70
|
+
1. **Pre-check**: Load CR rules, domain patterns for the affected file
|
|
71
|
+
2. **Execute**: Implement the item following established patterns
|
|
72
|
+
3. **Guardrail**: Run `./scripts/pattern-scanner.sh` (ABORT if fails)
|
|
73
|
+
4. **Verify**: Run applicable VR-* checks with proof
|
|
74
|
+
5. **VR-PIPELINE**: If the item involves a data pipeline (AI, cron, generation, ETL), trigger the pipeline manually, verify output is non-empty. Empty output = fix before continuing.
|
|
75
|
+
6. **Update**: Mark item complete in tracking table
|
|
76
|
+
|
|
77
|
+
**DO NOT STOP between items** unless:
|
|
78
|
+
- New pattern needed (Approval Point #2)
|
|
79
|
+
- True blocker (external service, credentials)
|
|
80
|
+
- Critical error after 3 retries
|
|
81
|
+
|
|
82
|
+
**Checkpoint Audit at phase boundaries** (after all P1-XXX, after all P2-XXX, etc.):
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
CHECKPOINT:
|
|
86
|
+
[1] READ plan section [2] QUERY DB [3] GREP routers
|
|
87
|
+
[4] LS components [5] VR-RENDER check [6] VR-COUPLING check
|
|
88
|
+
[7] Pattern scanner [8] npm run build [9] npx tsc --noEmit
|
|
89
|
+
[10] npm run lint [11] npx prisma validate [12] npm test
|
|
90
|
+
[13] UI/UX verification [14] API/router verification [15] Security check
|
|
91
|
+
[16] COUNT gaps -> IF > 0: FIX and return to [1]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
> **Cross-reference**: Full checkpoint audit protocol with detailed steps is in `massu-loop/references/checkpoint-audit.md`.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Phase 2C: Multi-Perspective Review
|
|
99
|
+
|
|
100
|
+
After implementation, BEFORE verification loop -- spawn 3 review agents **IN PARALLEL**:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
security_result = Task(subagent_type="massu-security-reviewer", model="opus", prompt="
|
|
104
|
+
Review implementation for plan: {PLAN_PATH}
|
|
105
|
+
Focus: Security vulnerabilities, auth gaps, input validation, data exposure.
|
|
106
|
+
Return structured result with SECURITY_GATE: PASS/FAIL.
|
|
107
|
+
")
|
|
108
|
+
|
|
109
|
+
architecture_result = Task(subagent_type="massu-architecture-reviewer", model="opus", prompt="
|
|
110
|
+
Review implementation for plan: {PLAN_PATH}
|
|
111
|
+
Focus: Design issues, coupling, pattern compliance, scalability.
|
|
112
|
+
Return structured result with ARCHITECTURE_GATE: PASS/FAIL.
|
|
113
|
+
")
|
|
114
|
+
|
|
115
|
+
ux_result = Task(subagent_type="massu-ux-reviewer", model="sonnet", prompt="
|
|
116
|
+
Review implementation for plan: {PLAN_PATH}
|
|
117
|
+
Focus: UX, accessibility, loading/error/empty states, consistency.
|
|
118
|
+
Return structured result with UX_GATE: PASS/FAIL.
|
|
119
|
+
")
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Phase 2C.2: QA Evaluator** (conditional -- UI plans only)
|
|
123
|
+
|
|
124
|
+
> Full spec: [qa-evaluator-spec.md](qa-evaluator-spec.md)
|
|
125
|
+
|
|
126
|
+
If the plan touches UI files, spawn an adversarial QA evaluator:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
IF plan has UI files:
|
|
130
|
+
qa_result = Task(subagent_type="massu-ux-reviewer", model="opus", prompt="
|
|
131
|
+
=== QA EVALUATOR MODE ===
|
|
132
|
+
You are an ADVERSARIAL QA agent. Your job is to FIND BUGS, not approve work.
|
|
133
|
+
|
|
134
|
+
Plan: {PLAN_PATH}
|
|
135
|
+
Sprint contracts: {CONTRACTS_FROM_2A5}
|
|
136
|
+
|
|
137
|
+
For EACH plan item with a sprint contract:
|
|
138
|
+
1. NAVIGATE to the affected page using Playwright MCP
|
|
139
|
+
2. EXERCISE the feature as a real user would
|
|
140
|
+
3. VERIFY against sprint contract acceptance criteria (EVERY criterion)
|
|
141
|
+
4. CHECK for known failure patterns:
|
|
142
|
+
- Mock/hardcoded data (data doesn't change when DB changes)
|
|
143
|
+
- Write succeeds but read/display broken
|
|
144
|
+
- Feature stubs (onClick/onSubmit empty or log-only)
|
|
145
|
+
- Invisible elements (display:none, opacity:0, z-index buried)
|
|
146
|
+
- Missing query invalidation (create item, verify list updates without refresh)
|
|
147
|
+
5. GRADE: PASS / PARTIAL / FAIL with specific evidence
|
|
148
|
+
|
|
149
|
+
ANTI-LENIENCY RULES:
|
|
150
|
+
- Never say 'this is acceptable because...' — if criteria aren't met, it's FAIL
|
|
151
|
+
- Never give benefit of the doubt — if you can't verify it works, it's FAIL
|
|
152
|
+
- Partial credit is still failure — PARTIAL means 'not done yet'
|
|
153
|
+
- Every PASS must cite specific evidence (screenshot, DOM state, network response)
|
|
154
|
+
|
|
155
|
+
Return structured result with QA_GATE: PASS/FAIL and per-item grades.
|
|
156
|
+
")
|
|
157
|
+
ELSE:
|
|
158
|
+
Log: "QA Evaluator: SKIPPED (no UI files in plan)"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**Gate logic**: Fix ALL CRITICAL/HIGH findings before proceeding. WARN findings = document and proceed.
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
GATES = [SECURITY_GATE, ARCHITECTURE_GATE, UX_GATE]
|
|
165
|
+
IF plan has UI files: GATES += [QA_GATE]
|
|
166
|
+
IF ANY gate == FAIL: Fix findings and re-run failed gates
|
|
167
|
+
ALL gates must PASS before proceeding to Phase 2D.
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Phase 2D: Verification Audit Loop
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
iteration = 0
|
|
176
|
+
WHILE true:
|
|
177
|
+
iteration += 1
|
|
178
|
+
|
|
179
|
+
# Circuit breaker (detect stagnation)
|
|
180
|
+
IF iteration >= 3:
|
|
181
|
+
stalled_items = items that failed in ALL of last 3 iterations
|
|
182
|
+
IF stalled_items.length > 0:
|
|
183
|
+
Log: "REFINE-OR-PIVOT: {stalled_items.length} items stalled for 3+ iterations"
|
|
184
|
+
FOR EACH stalled_item:
|
|
185
|
+
IF same_root_cause_each_time: REFINE (targeted fix for root cause)
|
|
186
|
+
IF different_failures_each_time: PIVOT (scrap approach, try alternative)
|
|
187
|
+
IF no_clear_pattern: AskUserQuestion with evidence from last 3 attempts
|
|
188
|
+
|
|
189
|
+
result = Task(subagent_type="massu-plan-auditor", model="opus", prompt="
|
|
190
|
+
Audit iteration {iteration} for plan: {PLAN_PATH}
|
|
191
|
+
Verify ALL deliverables with VR-* proof.
|
|
192
|
+
Check code quality (patterns, build, types, tests).
|
|
193
|
+
Check plan coverage (every item verified).
|
|
194
|
+
|
|
195
|
+
VR-SPEC-MATCH: For EVERY UI plan item with specific CSS classes,
|
|
196
|
+
component names, or layout instructions -- grep the implementation for those
|
|
197
|
+
EXACT strings. Missing = gap.
|
|
198
|
+
|
|
199
|
+
VR-PIPELINE: For features with data pipelines (AI, cron, generation),
|
|
200
|
+
trigger the pipeline procedure and verify output is non-empty. Empty = gap.
|
|
201
|
+
|
|
202
|
+
SPRINT CONTRACT VERIFICATION: For each plan item with a sprint contract
|
|
203
|
+
(from Phase 2A.5), verify EVERY acceptance criterion is met:
|
|
204
|
+
- Read the contract's acceptance criteria list
|
|
205
|
+
- Test each criterion with specific evidence (screenshot, grep, DOM state)
|
|
206
|
+
- Any unmet criterion = gap, even if the code 'looks right'
|
|
207
|
+
- Contract criteria are IN ADDITION TO VR-* checks — both must pass
|
|
208
|
+
|
|
209
|
+
Fix any gaps you find.
|
|
210
|
+
|
|
211
|
+
CRITICAL: GAPS_DISCOVERED = total FOUND, even if fixed.
|
|
212
|
+
Finding 5 + fixing 5 = GAPS_DISCOVERED: 5 (NOT 0).
|
|
213
|
+
")
|
|
214
|
+
|
|
215
|
+
gaps = parse GAPS_DISCOVERED from result
|
|
216
|
+
Output: "Verification iteration {iteration}: {gaps} gaps"
|
|
217
|
+
|
|
218
|
+
IF gaps == 0: BREAK
|
|
219
|
+
IF iteration >= 10: Report remaining gaps, ask user
|
|
220
|
+
END WHILE
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Phase 2E: Post-Build Reflection + Memory Persist
|
|
226
|
+
|
|
227
|
+
**MANDATORY -- reflection + memory write = ONE atomic action.**
|
|
228
|
+
|
|
229
|
+
Answer these questions:
|
|
230
|
+
1. "Now that I've built this, what would I have done differently?"
|
|
231
|
+
2. "What should be refactored before moving on?"
|
|
232
|
+
3. "Did we over-build? Is there a simpler way?"
|
|
233
|
+
4. "Would a staff engineer approve this?"
|
|
234
|
+
|
|
235
|
+
**IMMEDIATELY write ALL learnings to memory/ files** -- failed approaches, new patterns, tool gotchas, architectural insights. DO NOT output reflections as text without writing to memory.
|
|
236
|
+
|
|
237
|
+
Apply any low-risk refactors immediately. Log remaining suggestions in plan under `## Post-Build Reflection`.
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Phase 2F: Documentation Sync (User-Facing Features)
|
|
242
|
+
|
|
243
|
+
If plan includes ANY user-facing features:
|
|
244
|
+
|
|
245
|
+
1. Audit documentation against code changes
|
|
246
|
+
2. Update affected documentation pages
|
|
247
|
+
3. Add changelog entry
|
|
248
|
+
4. Commit documentation updates (separate repo if applicable)
|
|
249
|
+
|
|
250
|
+
Skip ONLY if purely backend/infra with zero user-facing changes.
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Phase 2G: Browser Verification & Fix Loop
|
|
255
|
+
|
|
256
|
+
```
|
|
257
|
+
[GOLDEN PATH -- PHASE 2G: BROWSER VERIFICATION]
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
**Auto-trigger condition**: If plan touches ANY UI files, this phase runs automatically. If purely backend/infra with zero UI changes, skip with log note: `Browser verification: SKIPPED (no UI files changed)`.
|
|
261
|
+
|
|
262
|
+
**SAFETY RULE**: NEVER use real client data. NEVER click destructive actions (Delete, Send, Submit) on production.
|
|
263
|
+
|
|
264
|
+
### 2G.1 Determine Target Pages
|
|
265
|
+
|
|
266
|
+
Map changed files to URLs:
|
|
267
|
+
- Component changes: identify ALL pages that render the component
|
|
268
|
+
- Layout changes: test ALL child routes under that layout
|
|
269
|
+
|
|
270
|
+
### 2G.2 Browser Setup & Authentication
|
|
271
|
+
|
|
272
|
+
Use Playwright MCP plugin tools.
|
|
273
|
+
|
|
274
|
+
1. `browser_navigate` to first target URL
|
|
275
|
+
2. `browser_snapshot` to check auth status
|
|
276
|
+
3. If redirected to `/login` or auth check visible: STOP and request manual login
|
|
277
|
+
|
|
278
|
+
```
|
|
279
|
+
AUTHENTICATION REQUIRED
|
|
280
|
+
|
|
281
|
+
The Playwright browser is not logged in to the app.
|
|
282
|
+
Please log in manually in the open browser window, then re-run the golden path.
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
**NEVER type credentials. NEVER hardcode passwords. NEVER proceed without authentication.**
|
|
286
|
+
|
|
287
|
+
### 2G.3 Load Audit (Per Page)
|
|
288
|
+
|
|
289
|
+
For EACH target page:
|
|
290
|
+
|
|
291
|
+
| Check | Tool | Captures |
|
|
292
|
+
|-------|------|----------|
|
|
293
|
+
| Console errors/warnings | `browser_console_messages` | React errors, TypeError, CSP violations, auth warnings |
|
|
294
|
+
| Network failures | `browser_network_requests` | 500s, 404s, CORS failures, timeouts |
|
|
295
|
+
|
|
296
|
+
Categorize findings:
|
|
297
|
+
|
|
298
|
+
| Category | Severity |
|
|
299
|
+
|----------|----------|
|
|
300
|
+
| React crash, 500 error, data exposure | **P0 -- CRITICAL** |
|
|
301
|
+
| Network failure, CSP violation, broken interaction, auth warning | **P1 -- HIGH** |
|
|
302
|
+
| Visual issues, performance warnings, broken images | **P2 -- MEDIUM** |
|
|
303
|
+
| Console warnings, deprecations, i18n missing keys | **P3 -- LOW** |
|
|
304
|
+
|
|
305
|
+
### 2G.4 Interactive Testing (Per Page)
|
|
306
|
+
|
|
307
|
+
1. `browser_snapshot` -> inventory ALL interactive elements
|
|
308
|
+
2. For EACH testable element:
|
|
309
|
+
- Capture console state BEFORE interaction
|
|
310
|
+
- Perform interaction
|
|
311
|
+
- Wait 2-3 seconds for async operations
|
|
312
|
+
- Capture console state AFTER interaction
|
|
313
|
+
- Record any NEW errors introduced
|
|
314
|
+
- `browser_snapshot` to verify DOM state after interaction
|
|
315
|
+
- If interaction opened modal/sheet: test elements inside, then close
|
|
316
|
+
|
|
317
|
+
**SAFETY**: Never submit forms, click Delete/Send/Submit, or create real records on production.
|
|
318
|
+
|
|
319
|
+
### 2G.5 Visual & Performance Audit
|
|
320
|
+
|
|
321
|
+
**Visual checks**:
|
|
322
|
+
- Broken images: find `img` elements with `naturalWidth === 0`
|
|
323
|
+
- Layout issues: overflow, overlapping, missing content, broken alignment
|
|
324
|
+
- Responsive: test at 1440x900 (desktop), 768x1024 (tablet), 375x812 (mobile)
|
|
325
|
+
- Screenshot evidence at each breakpoint if issues found
|
|
326
|
+
|
|
327
|
+
**Performance checks**:
|
|
328
|
+
- Page load timing
|
|
329
|
+
- Resources > 500KB
|
|
330
|
+
- Slow API calls > 3s, duplicate requests
|
|
331
|
+
|
|
332
|
+
| Metric | Good | Needs Work | Critical |
|
|
333
|
+
|--------|------|------------|----------|
|
|
334
|
+
| DOM Content Loaded | < 2s | 2-5s | > 5s |
|
|
335
|
+
| Full Load | < 4s | 4-8s | > 8s |
|
|
336
|
+
| TTFB | < 500ms | 500ms-1.5s | > 1.5s |
|
|
337
|
+
|
|
338
|
+
### 2G.6 Fix Loop
|
|
339
|
+
|
|
340
|
+
```
|
|
341
|
+
issues = ALL findings from 2G.3-2G.5, sorted by priority (P0 first)
|
|
342
|
+
|
|
343
|
+
FOR EACH issue WHERE priority <= P2:
|
|
344
|
+
1. IDENTIFY root cause (Grep/Read source files)
|
|
345
|
+
2. APPLY fix (follow CLAUDE.md patterns)
|
|
346
|
+
3. VERIFY fix (VR-GREP, VR-NEGATIVE, VR-BUILD, VR-TYPE)
|
|
347
|
+
4. LOG fix in report
|
|
348
|
+
|
|
349
|
+
Zero-issue standard: ALL P0/P1 fixed, ALL P2 fixed or documented with justification.
|
|
350
|
+
Circuit breaker: 5 iterations on same page -> ask user.
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
Post-fix: reload target URLs, re-run load audit + interactive testing for elements that had failures. If new errors appear, add to issues list and continue fix loop.
|
|
354
|
+
|
|
355
|
+
### 2G.7 Report
|
|
356
|
+
|
|
357
|
+
Save to `.claude/playwright-reports/{TIMESTAMP}-{SLUG}.md`.
|
|
358
|
+
|
|
359
|
+
Report includes: summary table, console errors, network failures, interactive element failures, visual issues, performance issues, fix log with files changed and VR checks, unfixed issues with justification, screenshots.
|
|
360
|
+
|
|
361
|
+
### 2G.8 Auto-Learning Protocol
|
|
362
|
+
|
|
363
|
+
For EACH browser-discovered fix:
|
|
364
|
+
1. Record with type="bugfix" including browser symptom -> code fix mapping
|
|
365
|
+
2. Update MEMORY.md with symptom/root cause/fix/files
|
|
366
|
+
3. Add to `scripts/pattern-scanner.sh` if the bad pattern is grep-able
|
|
367
|
+
4. Codebase-wide search for same bad pattern (CR-9) -- fix ALL instances
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## Subagent Budget Discipline
|
|
372
|
+
|
|
373
|
+
The golden path spawns multiple subagents across Phase 2. Follow these principles:
|
|
374
|
+
|
|
375
|
+
| Principle | Meaning |
|
|
376
|
+
|-----------|---------|
|
|
377
|
+
| **One task per subagent** | Each Task call has a single, scoped objective |
|
|
378
|
+
| **Main agent coordinates, subagents execute** | Controller fixes code-level gaps; auditor/reviewer subagents verify |
|
|
379
|
+
| **No nested spawns** | Subagents NEVER spawn their own subagents |
|
|
380
|
+
| **Parallel only when independent** | 2C review agents run in parallel; 2D audit passes run sequentially |
|
|
381
|
+
| **Budget awareness** | Each subagent pass costs ~20-40K tokens. Fix root causes, not symptoms, to minimize iterations |
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
## Phase 2 Complete
|
|
386
|
+
|
|
387
|
+
```
|
|
388
|
+
[GOLDEN PATH -- PHASE 2 COMPLETE]
|
|
389
|
+
Sprint contracts: NEGOTIATED ({N} items contracted, {M} N/A)
|
|
390
|
+
All plan items implemented
|
|
391
|
+
Multi-perspective review: PASSED (security, architecture, UX)
|
|
392
|
+
QA evaluator: PASSED / SKIPPED (no UI files)
|
|
393
|
+
Verification audit: PASSED (Loop #{iteration}, 0 gaps, contracts verified)
|
|
394
|
+
Post-build reflection: PERSISTED to memory
|
|
395
|
+
Documentation sync: COMPLETE / N/A
|
|
396
|
+
Browser verification: PASSED ({N} pages tested, {M} issues fixed) / SKIPPED (no UI files)
|
|
397
|
+
```
|