@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,187 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: massu-infra-audit
|
|
3
|
+
description: "When user asks about .claude/ infrastructure health, says 'audit infra', 'check claude setup', or needs to verify references, staleness, and format compliance"
|
|
4
|
+
allowed-tools: Bash(*), Read(*), Grep(*), Glob(*)
|
|
5
|
+
---
|
|
6
|
+
name: massu-infra-audit
|
|
7
|
+
|
|
8
|
+
# Massu Infrastructure Audit: .claude/ Directory Health Check
|
|
9
|
+
|
|
10
|
+
## Objective
|
|
11
|
+
|
|
12
|
+
Verify the health of the `.claude/` directory infrastructure: dead references, staleness, conflicts, format consistency, and memory health. Designed for periodic execution to catch drift before it causes problems.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## AUDIT PHASES (8 Checks)
|
|
17
|
+
|
|
18
|
+
| Phase | Check | Pass Criteria |
|
|
19
|
+
|-------|-------|---------------|
|
|
20
|
+
| 1 | **Dead References in CLAUDE.md** | All file paths referenced in CLAUDE.md exist |
|
|
21
|
+
| 2 | **Script References** | All scripts referenced by commands/patterns exist |
|
|
22
|
+
| 3 | **Command Format Consistency** | All commands have valid YAML frontmatter (name, description, allowed-tools) |
|
|
23
|
+
| 4 | **Cross-Reference Integrity** | Commands reference patterns that exist; patterns reference files that exist |
|
|
24
|
+
| 5 | **Line Count Accuracy** | Line counts in CLAUDE.md Load Instructions match actual file line counts |
|
|
25
|
+
| 6 | **Memory Health** | MEMORY.md under 200-line limit; topic files organized |
|
|
26
|
+
| 7 | **Archive Bloat** | Session state archive size and count assessment |
|
|
27
|
+
| 8 | **Orphan Detection** | Files in .claude/ not referenced from CLAUDE.md or any command |
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## EXECUTION PROTOCOL
|
|
32
|
+
|
|
33
|
+
### Phase 1: Dead References in CLAUDE.md
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Extract all relative file paths from CLAUDE.md and verify each exists
|
|
37
|
+
grep -oE '\[.*?\]\((protocols|patterns|commands|incidents|reference|session-state)/[^)]+\)' .claude/CLAUDE.md \
|
|
38
|
+
| grep -oE '(protocols|patterns|commands|incidents|reference|session-state)/[^)]+' \
|
|
39
|
+
| sort -u \
|
|
40
|
+
| while read path; do
|
|
41
|
+
[ -f ".claude/$path" ] && echo "OK: $path" || echo "MISSING: $path"
|
|
42
|
+
done
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**FAIL** if any path is MISSING.
|
|
46
|
+
|
|
47
|
+
### Phase 2: Script References
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Find all script references across .claude/ files
|
|
51
|
+
grep -roh 'scripts/[a-zA-Z0-9_-]*\.\(sh\|ts\)' .claude/ | sort -u | while read script; do
|
|
52
|
+
[ -f "$script" ] && echo "OK: $script" || echo "MISSING: $script"
|
|
53
|
+
done
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**FAIL** if any script is MISSING.
|
|
57
|
+
|
|
58
|
+
### Phase 3: Command Format Consistency
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# For each command file, verify YAML frontmatter has required fields
|
|
62
|
+
for f in .claude/commands/massu-*.md; do
|
|
63
|
+
name=$(basename "$f" .md)
|
|
64
|
+
has_name=$(head -10 "$f" | grep -c "^name:")
|
|
65
|
+
has_desc=$(head -10 "$f" | grep -c "^description:")
|
|
66
|
+
has_tools=$(head -10 "$f" | grep -c "^allowed-tools:")
|
|
67
|
+
if [ "$has_name" -eq 0 ] || [ "$has_desc" -eq 0 ] || [ "$has_tools" -eq 0 ]; then
|
|
68
|
+
echo "INVALID: $name (name:$has_name desc:$has_desc tools:$has_tools)"
|
|
69
|
+
else
|
|
70
|
+
echo "OK: $name"
|
|
71
|
+
fi
|
|
72
|
+
done
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**FAIL** if any command has missing required fields.
|
|
76
|
+
|
|
77
|
+
### Phase 4: Cross-Reference Integrity
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Find pattern/protocol references in commands and verify they exist
|
|
81
|
+
grep -roh 'patterns/[a-zA-Z0-9_-]*\.md\|protocols/[a-zA-Z0-9_-]*\.md' .claude/commands/ \
|
|
82
|
+
| sort -u \
|
|
83
|
+
| while read ref; do
|
|
84
|
+
[ -f ".claude/$ref" ] && echo "OK: $ref" || echo "BROKEN: $ref"
|
|
85
|
+
done
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**FAIL** if any cross-reference is BROKEN.
|
|
89
|
+
|
|
90
|
+
### Phase 5: Line Count Accuracy
|
|
91
|
+
|
|
92
|
+
Read CLAUDE.md Load Instructions table. For each entry with a line count:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Compare claimed vs actual line counts
|
|
96
|
+
# Flag if delta > 20 lines (significant drift)
|
|
97
|
+
wc -l .claude/patterns/*.md .claude/protocols/*.md .claude/reference/*.md 2>/dev/null
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Compare to claimed counts in CLAUDE.md. **WARN** if any delta > 20 lines.
|
|
101
|
+
|
|
102
|
+
### Phase 6: Memory Health
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Check memory directory
|
|
106
|
+
MEMORY_DIR="$HOME/.claude/projects/$(pwd | tr '/' '-')/memory"
|
|
107
|
+
echo "=== Memory Files ==="
|
|
108
|
+
ls -la "$MEMORY_DIR/"
|
|
109
|
+
echo "=== MEMORY.md line count ==="
|
|
110
|
+
wc -l "$MEMORY_DIR/MEMORY.md"
|
|
111
|
+
echo "=== Total memory size ==="
|
|
112
|
+
du -sh "$MEMORY_DIR/"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**WARN** if MEMORY.md exceeds 180 lines (approaching 200 limit).
|
|
116
|
+
|
|
117
|
+
### Phase 7: Archive Bloat Assessment
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
echo "=== Archive Stats ==="
|
|
121
|
+
echo "File count: $(ls .claude/session-state/archive/ | wc -l)"
|
|
122
|
+
echo "Total size: $(du -sh .claude/session-state/archive/)"
|
|
123
|
+
echo "=== Age distribution ==="
|
|
124
|
+
echo "Last 7 days: $(find .claude/session-state/archive/ -mtime -7 | wc -l)"
|
|
125
|
+
echo "7-30 days: $(find .claude/session-state/archive/ -mtime +7 -mtime -30 | wc -l)"
|
|
126
|
+
echo "30+ days: $(find .claude/session-state/archive/ -mtime +30 | wc -l)"
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**INFO** only — no pass/fail, but flag if > 500 files or > 5MB.
|
|
130
|
+
|
|
131
|
+
### Phase 8: Orphan Detection
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# List all non-archive .claude/ files
|
|
135
|
+
# For each, check if referenced from CLAUDE.md or any command
|
|
136
|
+
find .claude/ -name "*.md" -not -path "*/archive/*" -not -path "*/session-state/*" | while read f; do
|
|
137
|
+
basename=$(basename "$f")
|
|
138
|
+
refs=$(grep -rl "$basename" .claude/CLAUDE.md .claude/commands/ .claude/patterns/ .claude/protocols/ 2>/dev/null | wc -l)
|
|
139
|
+
if [ "$refs" -eq 0 ]; then
|
|
140
|
+
echo "ORPHAN?: $f (0 incoming references)"
|
|
141
|
+
fi
|
|
142
|
+
done
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**INFO** only — orphans may be intentional (specialized tools).
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## OUTPUT FORMAT
|
|
150
|
+
|
|
151
|
+
```markdown
|
|
152
|
+
## Massu Infrastructure Audit Report
|
|
153
|
+
Date: YYYY-MM-DD
|
|
154
|
+
|
|
155
|
+
### Results Summary
|
|
156
|
+
| Phase | Check | Status | Details |
|
|
157
|
+
|-------|-------|--------|---------|
|
|
158
|
+
| 1 | Dead References | PASS/FAIL | [count] issues |
|
|
159
|
+
| 2 | Script References | PASS/FAIL | [count] issues |
|
|
160
|
+
| 3 | Command Format | PASS/FAIL | [count] issues |
|
|
161
|
+
| 4 | Cross-References | PASS/FAIL | [count] issues |
|
|
162
|
+
| 5 | Line Counts | PASS/WARN | [count] stale |
|
|
163
|
+
| 6 | Memory Health | PASS/WARN | [lines] / 200 limit |
|
|
164
|
+
| 7 | Archive Bloat | INFO | [count] files, [size] |
|
|
165
|
+
| 8 | Orphan Detection | INFO | [count] potential orphans |
|
|
166
|
+
|
|
167
|
+
### Overall: PASS / WARN / FAIL
|
|
168
|
+
[Summary of action items if any]
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## PASS CRITERIA
|
|
174
|
+
|
|
175
|
+
- **PASS**: Phases 1-4 all pass, Phase 6 under limits
|
|
176
|
+
- **WARN**: Phases 5, 7, 8 have non-critical findings
|
|
177
|
+
- **FAIL**: Any of Phases 1-4 have failures (broken references, missing files, invalid format)
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## WHEN TO RUN
|
|
182
|
+
|
|
183
|
+
- After editing CLAUDE.md or any command file
|
|
184
|
+
- After adding/removing pattern or protocol files
|
|
185
|
+
- After memory cleanup or reorganization
|
|
186
|
+
- Weekly as part of `/massu-codebase-audit`
|
|
187
|
+
- After any `.claude/` directory restructuring
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: massu-learning-audit
|
|
3
|
+
description: "When user says 'learning audit', 'check auto-learning', 'memory coverage', or needs to validate that incidents are being learned from and patterns are being captured"
|
|
4
|
+
allowed-tools: Bash(*), Read(*), Grep(*), Glob(*), ToolSearch(mcp__massu-codegraph__*)
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
---
|
|
7
|
+
name: massu-learning-audit
|
|
8
|
+
|
|
9
|
+
# Massu Learning Audit: Auto-Learning Effectiveness Validation
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Validate that the CR-34 auto-learning protocol is working effectively by checking:
|
|
14
|
+
1. Memory coverage for each canonical rule (CR)
|
|
15
|
+
2. Pattern scanner coverage for each documented incident
|
|
16
|
+
3. Failure recurrence rates
|
|
17
|
+
4. Session quality statistics
|
|
18
|
+
|
|
19
|
+
**CR-34**: ALL fixes MUST be auto-learned: ingest to memory, record pattern, update scanner.
|
|
20
|
+
|
|
21
|
+
**Philosophy**: Every incident that recurs is evidence that auto-learning failed. This audit proves the learning system is working.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## NON-NEGOTIABLE RULES
|
|
26
|
+
|
|
27
|
+
- **Proof > Claims** - Show MCP tool output, not summaries
|
|
28
|
+
- **Every CR must have memory** - CRs without entries = learning gaps
|
|
29
|
+
- **Every incident must have scanner rule** - Incidents without grep checks recur
|
|
30
|
+
- **Zero tolerance for recurrence** - Any recurrence_count > 1 is a learning failure
|
|
31
|
+
- **FIX ALL ISSUES ENCOUNTERED (CR-9)** - If any learning gap is discovered, fix it immediately by ingesting the missing memory and adding the missing scanner rule.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Section 1: Memory Coverage Check
|
|
36
|
+
|
|
37
|
+
**For each canonical rule (CR-1 through CR-12), verify memory entries exist.**
|
|
38
|
+
|
|
39
|
+
### 1.1 Query Memory by CR
|
|
40
|
+
|
|
41
|
+
Use `mcp__massu-codegraph__massu_memory_search` for each major CR category:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
massu_memory_search query="CR-9 fix all issues"
|
|
45
|
+
massu_memory_search query="CR-29 config map fallback"
|
|
46
|
+
massu_memory_search query="CR-30 feature parity rebuild"
|
|
47
|
+
massu_memory_search query="CR-33 RLS audit"
|
|
48
|
+
massu_memory_search query="CR-34 auto-learning"
|
|
49
|
+
massu_memory_search query="CR-12 compaction authorized command"
|
|
50
|
+
massu_memory_search query="include: ignored"
|
|
51
|
+
massu_memory_search query="ctx.prisma wrong"
|
|
52
|
+
massu_memory_search query="user_profiles not users"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 1.2 Memory Coverage Report
|
|
56
|
+
|
|
57
|
+
| CR | Rule Summary | Memory Entries Found | Status |
|
|
58
|
+
|----|-------------|---------------------|--------|
|
|
59
|
+
| CR-1 | Verify don't claim | Query required | - |
|
|
60
|
+
| CR-2 | Never assume schema | Query required | - |
|
|
61
|
+
| CR-9 | Fix all issues | Query required | - |
|
|
62
|
+
| CR-29 | Config map fallback | Query required | - |
|
|
63
|
+
| CR-30 | Feature parity | Query required | - |
|
|
64
|
+
| CR-33 | RLS audit | Query required | - |
|
|
65
|
+
| CR-12 | No compaction escalation | Query required | - |
|
|
66
|
+
|
|
67
|
+
**Expected**: Every critical CR has >= 1 memory entry.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Section 2: Pattern Scanner Coverage
|
|
72
|
+
|
|
73
|
+
**For each documented incident, verify the pattern scanner catches the bad pattern.**
|
|
74
|
+
|
|
75
|
+
### 2.1 Scan for Incident Patterns
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Verify pattern-scanner.sh exists and is executable
|
|
79
|
+
ls -la scripts/pattern-scanner.sh
|
|
80
|
+
|
|
81
|
+
# Run pattern scanner
|
|
82
|
+
scripts/pattern-scanner.sh
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 2.2 Verify Key Patterns Are Checked
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Incident #1: ctx.prisma usage
|
|
89
|
+
grep -c "ctx\.prisma" scripts/pattern-scanner.sh
|
|
90
|
+
|
|
91
|
+
# Incident #2: include: statements
|
|
92
|
+
grep -c "include:" scripts/pattern-scanner.sh
|
|
93
|
+
|
|
94
|
+
# Incident #5: wrong column names
|
|
95
|
+
grep -c "bad-columns\|check-bad-columns" scripts/pattern-scanner.sh
|
|
96
|
+
|
|
97
|
+
# Incident #10: import type from heavy deps
|
|
98
|
+
grep -c "import-chains\|check-import" scripts/pattern-scanner.sh
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 2.3 Scanner Coverage Report
|
|
102
|
+
|
|
103
|
+
| Incident | Pattern | Scanner Check Exists | Rule |
|
|
104
|
+
|----------|---------|---------------------|------|
|
|
105
|
+
| #1 Dec 18 | Unverified "complete" claims | N/A (behavioral) | - |
|
|
106
|
+
| #2 Dec 21 | ctx.prisma | grep check | - |
|
|
107
|
+
| #5 Jan 20 | Wrong column names | check-bad-columns.sh | - |
|
|
108
|
+
| #10 Jan 25 | import type from heavy deps | check-import-chains.sh | - |
|
|
109
|
+
| #20 Feb 8 | CONFIG_MAP no fallback | grep check | - |
|
|
110
|
+
|
|
111
|
+
**Expected**: All grep-able patterns have scanner checks.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Section 3: Failure Recurrence Analysis
|
|
116
|
+
|
|
117
|
+
**Check if any known failures have recurred.**
|
|
118
|
+
|
|
119
|
+
### 3.1 Query Memory for Recurrences
|
|
120
|
+
|
|
121
|
+
Use `mcp__massu-codegraph__massu_memory_failures`:
|
|
122
|
+
```
|
|
123
|
+
massu_memory_failures
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Look for entries with `recurrence_count > 1`.
|
|
127
|
+
|
|
128
|
+
### 3.2 Timeline Analysis
|
|
129
|
+
|
|
130
|
+
Use `mcp__massu-codegraph__massu_memory_timeline`:
|
|
131
|
+
```
|
|
132
|
+
massu_memory_timeline days=30
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Check for patterns appearing more than once in the timeline.
|
|
136
|
+
|
|
137
|
+
### 3.3 Recurrence Report
|
|
138
|
+
|
|
139
|
+
| Pattern | First Occurrence | Recurrence Count | Status |
|
|
140
|
+
|---------|-----------------|------------------|--------|
|
|
141
|
+
| Query required | - | - | - |
|
|
142
|
+
|
|
143
|
+
**Expected**: recurrence_count == 1 for all patterns (no recurrences).
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Section 4: Session Quality Statistics
|
|
148
|
+
|
|
149
|
+
### 4.1 Query Session Stats
|
|
150
|
+
|
|
151
|
+
Use `mcp__massu-codegraph__massu_session_stats`:
|
|
152
|
+
```
|
|
153
|
+
massu_session_stats
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### 4.2 Prompt Effectiveness
|
|
157
|
+
|
|
158
|
+
Use `mcp__massu-codegraph__massu_prompt_effectiveness`:
|
|
159
|
+
```
|
|
160
|
+
massu_prompt_effectiveness
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### 4.3 Session Quality Report
|
|
164
|
+
|
|
165
|
+
| Metric | Value | Target | Status |
|
|
166
|
+
|--------|-------|--------|--------|
|
|
167
|
+
| Average gaps per session | Query required | < 5 | - |
|
|
168
|
+
| Recurrence rate | Query required | 0% | - |
|
|
169
|
+
| Auto-learning compliance | Query required | 100% | - |
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Section 5: Gap Report
|
|
174
|
+
|
|
175
|
+
**Identify and remediate learning gaps.**
|
|
176
|
+
|
|
177
|
+
### 5.1 CRs Without Memory Entries
|
|
178
|
+
|
|
179
|
+
List all CRs from Section 1 with 0 memory entries.
|
|
180
|
+
|
|
181
|
+
### 5.2 Incidents Without Scanner Rules
|
|
182
|
+
|
|
183
|
+
List all incidents from Section 2 with no scanner check.
|
|
184
|
+
|
|
185
|
+
### 5.3 Remediation Steps
|
|
186
|
+
|
|
187
|
+
For each gap found:
|
|
188
|
+
|
|
189
|
+
**Missing Memory Entry**: Use `mcp__massu-codegraph__massu_memory_ingest`:
|
|
190
|
+
```
|
|
191
|
+
massu_memory_ingest type="pattern" description="[CR summary]" importance=3
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Missing Scanner Rule**: Add to `scripts/pattern-scanner.sh`:
|
|
195
|
+
```bash
|
|
196
|
+
# Add grep check for the bad pattern
|
|
197
|
+
grep -rn "[bad_pattern]" src/ && echo "VIOLATION: [description]" && exit 1
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Completion Criteria
|
|
203
|
+
|
|
204
|
+
- [ ] All CRs have >= 1 memory entry
|
|
205
|
+
- [ ] All grep-able incident patterns have scanner checks
|
|
206
|
+
- [ ] recurrence_count == 1 for all patterns (no recurrences found)
|
|
207
|
+
- [ ] Session stats reviewed, quality >= target
|
|
208
|
+
- [ ] All gaps remediated
|
|
209
|
+
- [ ] pattern-scanner.sh exits 0
|
|
210
|
+
|
|
211
|
+
**Remember: Auto-learning is not optional. Every incident that recurs proves CR-34 failed.**
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Auto-Learning Protocol
|
|
2
|
+
|
|
3
|
+
> Reference doc for `/massu-loop`. Return to main file for overview.
|
|
4
|
+
|
|
5
|
+
## POST-BUILD REFLECTION + MANDATORY MEMORY PERSIST (CR-38)
|
|
6
|
+
|
|
7
|
+
After verification passes with zero gaps, capture accumulated implementation knowledge before it's lost to context compression. Answer these questions:
|
|
8
|
+
|
|
9
|
+
1. **"Now that I've built this, what would I have done differently?"**
|
|
10
|
+
- Architectural choices that caused friction
|
|
11
|
+
- Patterns that were harder to work with than expected
|
|
12
|
+
- Code that works but feels fragile or overly complex
|
|
13
|
+
|
|
14
|
+
2. **"What should be refactored before moving on?"**
|
|
15
|
+
- Concrete suggestions with file paths and line numbers
|
|
16
|
+
- Technical debt introduced during this implementation
|
|
17
|
+
- Opportunities to simplify or consolidate
|
|
18
|
+
|
|
19
|
+
3. **"Did we over-build? Is there a simpler way?"**
|
|
20
|
+
- Identify any added complexity that wasn't strictly needed
|
|
21
|
+
- Flag scope expansion beyond the original plan
|
|
22
|
+
- Check if any "fix everything encountered" items could have been simpler
|
|
23
|
+
|
|
24
|
+
4. **"Would a staff engineer approve this?" (Principle #19)**
|
|
25
|
+
|
|
26
|
+
**MANDATORY Actions** (reflection + memory write = ONE atomic action):
|
|
27
|
+
1. Apply any low-risk refactors immediately (re-run build/type check after)
|
|
28
|
+
2. **IMMEDIATELY write ALL learnings to memory/ files** -- failed approaches, new patterns, tool gotchas, architectural insights. DO NOT just output reflections as text. Every insight MUST be persisted to `memory/MEMORY.md` or a topic file using the Write/Edit tool.
|
|
29
|
+
3. Log remaining suggestions in the plan document under `## Post-Build Reflection`
|
|
30
|
+
|
|
31
|
+
**WARNING**: Outputting reflections without writing them to memory files is a CR-38 violation. The reflection and the memory write are inseparable.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## AUTO-LEARNING PROTOCOL (MANDATORY after every loop completion)
|
|
36
|
+
|
|
37
|
+
After Loop Completes (Zero Gaps):
|
|
38
|
+
|
|
39
|
+
- **Persist Phase 2.1 reflections**: EVERY insight from Post-Build Reflection MUST be written to `memory/MEMORY.md` or a topic file -- failed approaches, tool gotchas, unexpected behavior, "what I'd do differently". This is NOT optional. If Phase 2.1 produced reflections that aren't in memory files, this protocol is INCOMPLETE.
|
|
40
|
+
- **Ingest fixes into massu memory**: `massu_memory_ingest` with type "bugfix"/"pattern", description "[Wrong] -> [Fixed]", files, importance (5=security, 3=build, 2=cosmetic)
|
|
41
|
+
- **Record failed approaches**: `massu_memory_ingest` with type "failed_attempt", importance 5
|
|
42
|
+
- **Update MEMORY.md**: Add wrong vs correct patterns, tool behaviors, config gotchas
|
|
43
|
+
- **Update pattern scanner**: Add new grep-able bad patterns to `scripts/pattern-scanner.sh`
|
|
44
|
+
- **Codebase-wide search**: Verify no other instances of same bad pattern (CR-9)
|
|
45
|
+
- **Consider new CR rule**: If a class of bug was found (not one-off), propose for CLAUDE.md
|
|
46
|
+
- **Record user corrections**: If the user corrected any behavior during this loop, add structured entry to `memory/corrections.md` with date, wrong behavior, correction, and prevention rule
|
|
47
|
+
|
|
48
|
+
**A loop that fixes 5 bugs but records 0 learnings is 80% wasted. The fixes are temporary; the learnings are permanent.**
|
|
49
|
+
**A reflection that isn't persisted to memory is a learning that will be lost. Text output is not persistence.**
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Checkpoint Audit Protocol
|
|
2
|
+
|
|
3
|
+
> Reference doc for `/massu-loop`. Return to main file for overview.
|
|
4
|
+
|
|
5
|
+
## CHECKPOINT AUDIT (Phase Boundaries)
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
CHECKPOINT AUDIT FLOW:
|
|
9
|
+
[1] READ plan section for this checkpoint
|
|
10
|
+
[2] QUERY database to verify tables/columns/policies/grants (all envs)
|
|
11
|
+
[3] GREP router files to verify procedures exist
|
|
12
|
+
[4] LS component files to verify they exist
|
|
13
|
+
[5] VR-RENDER: Verify UI components are RENDERED in pages (not just created)
|
|
14
|
+
[6] VR-COUPLING: Run ./scripts/check-coupling.sh (backend features exposed in UI)
|
|
15
|
+
[7] GREP for pattern violations (P-001 through P-008)
|
|
16
|
+
[8] RUN build verification (npm run build)
|
|
17
|
+
[9] RUN type verification (npx tsc --noEmit)
|
|
18
|
+
[10] RUN lint verification (npm run lint)
|
|
19
|
+
[11] RUN prisma validate (npx prisma validate)
|
|
20
|
+
[12] RUN tests (npm test) - MANDATORY, NOT optional
|
|
21
|
+
[13] RUN UI/UX verification (if UI changes)
|
|
22
|
+
[14] RUN API/router verification (if API changes)
|
|
23
|
+
[15] RUN security check (secrets staged)
|
|
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
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## PROGRESS DOCUMENTATION
|
|
33
|
+
|
|
34
|
+
At the end of each phase, create archive: `session-state/archive/[plan-name]/phase-[X]-complete.md` with documentation, commit hash, files touched. Maintain `INDEX.md` for overall progress.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## PATTERN LIBRARY UPDATES
|
|
39
|
+
|
|
40
|
+
After implementation, document genuinely NEW patterns in `patterns/*.md`. Only add if the pattern is new (not reuse of existing). Include Problem, Solution, File reference, Code example, When to Use.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# The 10 Accountability Safeguards
|
|
2
|
+
|
|
3
|
+
> Reference doc for `/massu-loop`. Return to main file for overview.
|
|
4
|
+
|
|
5
|
+
## THE 10 ACCOUNTABILITY SAFEGUARDS
|
|
6
|
+
|
|
7
|
+
1. **Audit Proof Requirement** - Every claim MUST include proof output. Claims without proof are INVALID.
|
|
8
|
+
2. **Explicit Gap Count Per Loop** - State gaps found, gap details, status (PASS/FAIL). "Looks good" is BANNED.
|
|
9
|
+
3. **Checkpoint Sign-Off Format** - Use exact format from COMPLETION OUTPUT section (see [vr-plan-spec.md](vr-plan-spec.md)).
|
|
10
|
+
4. **Session State Mandatory Updates** - Update `session-state/CURRENT.md` after EVERY change with proof.
|
|
11
|
+
5. **User Verification Rights** - User can request proof re-runs at any time. Comply with actual output.
|
|
12
|
+
6. **Post-Compaction Recovery** - Read session state FIRST, re-read plan, resume from exact point.
|
|
13
|
+
7. **No Claims Without Evidence** - "I verified...", "Build passed..." require accompanying proof output.
|
|
14
|
+
8. **Failure Acknowledgment** - Acknowledge failures, re-execute audit from Step 1, log in session state.
|
|
15
|
+
9. **User Flow Audit Required** - ALL buttons, links, callbacks, flows verified AFTER technical audits pass.
|
|
16
|
+
10. **Component Reuse Verification** - Check existing components before creating new ones.
|
|
17
|
+
11. **No Workarounds Allowed** - ctx.prisma, TODOs, ts-ignore are BLOCKING violations. Pattern scanner is a HARD GATE.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Iteration Structure
|
|
2
|
+
|
|
3
|
+
> Reference doc for `/massu-loop`. Return to main file for overview.
|
|
4
|
+
|
|
5
|
+
## ITERATION STRUCTURE
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
ITERATION N:
|
|
9
|
+
1. [EXECUTE] Perform task segment
|
|
10
|
+
2. [GUARDRAIL] Run pattern-scanner.sh (ABORT if fails)
|
|
11
|
+
3. [GUARDRAIL] Check for security violations
|
|
12
|
+
4. [VERIFY] Run applicable VR-* checks
|
|
13
|
+
5. [AUDIT] Count gaps
|
|
14
|
+
6. [DECIDE] If gaps > 0: fix and re-verify
|
|
15
|
+
7. [PERSIST] Update session-state/CURRENT.md
|
|
16
|
+
8. [CHECKPOINT] At phase boundary: run full audit
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## GUARDRAIL CHECKS (Every Iteration)
|
|
22
|
+
|
|
23
|
+
### MEMORY CHECK (Start of Each Iteration)
|
|
24
|
+
|
|
25
|
+
Query `massu_memory_failures` and `massu_memory_search` for failures related to this plan's domain and files being modified. Surface relevant past failures as additional audit checkpoints.
|
|
26
|
+
|
|
27
|
+
### Enhanced Context Loading
|
|
28
|
+
|
|
29
|
+
For each file being modified:
|
|
30
|
+
- `massu_context` - Load CR rules, schema alerts, patterns relevant to the file
|
|
31
|
+
- `massu_coupling_check` - Verify frontend-backend coupling (CR-12/CR-23)
|
|
32
|
+
- `massu_knowledge_rule` - Load applicable CR rules for the file's domain
|
|
33
|
+
- `massu_knowledge_verification` - Load required VR-* checks for the file type
|
|
34
|
+
|
|
35
|
+
For VR-COUPLING checks, also call `massu_trpc_map` to get automated procedure-to-UI mapping and compare against check-coupling.sh results for comprehensive coverage.
|
|
36
|
+
|
|
37
|
+
When verifying CR-32 feature registration, use `massu_sentinel_detail` to get full feature details and verify all linked components/procedures/pages exist.
|
|
38
|
+
|
|
39
|
+
When CR-30 applies (rebuilds), call `massu_sentinel_parity` to compare old vs new implementation for feature parity.
|
|
40
|
+
|
|
41
|
+
### Mandatory Checks
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Pattern scanner (covers P-001 through P-008)
|
|
45
|
+
./scripts/pattern-scanner.sh
|
|
46
|
+
# Exit 0 = PASS, non-zero = ABORT iteration
|
|
47
|
+
|
|
48
|
+
# Security check
|
|
49
|
+
git diff --cached --name-only | grep -E '\.(env|pem|key|secret)' && echo "SECURITY VIOLATION" && exit 1
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## UI/UX VERIFICATION (When UI Work Done)
|
|
55
|
+
|
|
56
|
+
Trace ALL: buttons (onClick -> handler -> API), navigation (href/router.push), props chains (source -> consumer), callbacks (defined -> called), state (init -> update -> render), end-to-end flows. Verify loading/error/empty/success states exist. Run `./scripts/check-ux-quality.sh`.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## API/ROUTER VERIFICATION (When API Work Done)
|
|
61
|
+
|
|
62
|
+
Verify procedures exist with `protectedProcedure` for mutations, input schemas defined, client calls match server definitions, and procedures exported in root router.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## ENVIRONMENT & CONFIG VERIFICATION
|
|
67
|
+
|
|
68
|
+
Verify env vars documented, no hardcoded secrets (`grep -rn "sk-\|password.*=" src/` = 0), config files exist.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## CONSOLE & ERROR PREVENTION
|
|
73
|
+
|
|
74
|
+
Check for `console.log` (remove for production), error boundaries exist, null safety with optional chaining.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## ITERATION OUTPUT FORMAT
|
|
79
|
+
|
|
80
|
+
```markdown
|
|
81
|
+
## [MASSU LOOP - Iteration N]
|
|
82
|
+
|
|
83
|
+
### Task
|
|
84
|
+
Phase: X | Task: [description]
|
|
85
|
+
|
|
86
|
+
### Guardrails
|
|
87
|
+
- Pattern scanner: PASS/FAIL
|
|
88
|
+
- Security check: PASS/FAIL
|
|
89
|
+
|
|
90
|
+
### Verifications
|
|
91
|
+
| Check | Type | Result | Proof |
|
|
92
|
+
|-------|------|--------|-------|
|
|
93
|
+
| [item] | VR-FILE | PASS | `ls -la output` |
|
|
94
|
+
|
|
95
|
+
### Gap Count
|
|
96
|
+
Gaps found: N
|
|
97
|
+
|
|
98
|
+
### Status
|
|
99
|
+
CONTINUE | FIX_REQUIRED | CHECKPOINT | COMPLETE
|
|
100
|
+
|
|
101
|
+
### Next Action
|
|
102
|
+
[Specific next step]
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## SESSION STATE UPDATE (After Every Iteration)
|
|
108
|
+
|
|
109
|
+
Update `session-state/CURRENT.md` with: loop status (task, iteration, phase, checkpoint), iteration log table, verified work with proof, failed attempts (do not retry), next iteration plan.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## CONTEXT MANAGEMENT
|
|
114
|
+
|
|
115
|
+
Use Task tool with subagents for exploration to keep main context clean. Update session state before compaction. After compaction, read recovery.md and resume from correct step. Never mix unrelated tasks during a protocol.
|