@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.
Files changed (125) hide show
  1. package/README.md +40 -0
  2. package/agents/massu-architecture-reviewer.md +104 -0
  3. package/agents/massu-blast-radius-analyzer.md +84 -0
  4. package/agents/massu-competitive-scorer.md +126 -0
  5. package/agents/massu-help-sync.md +73 -0
  6. package/agents/massu-migration-writer.md +94 -0
  7. package/agents/massu-output-scorer.md +87 -0
  8. package/agents/massu-pattern-reviewer.md +84 -0
  9. package/agents/massu-plan-auditor.md +170 -0
  10. package/agents/massu-schema-sync-verifier.md +70 -0
  11. package/agents/massu-security-reviewer.md +98 -0
  12. package/agents/massu-ux-reviewer.md +106 -0
  13. package/commands/_shared-preamble.md +53 -23
  14. package/commands/_shared-references/auto-learning-protocol.md +71 -0
  15. package/commands/_shared-references/blast-radius-protocol.md +76 -0
  16. package/commands/_shared-references/security-pre-screen.md +64 -0
  17. package/commands/_shared-references/test-first-protocol.md +87 -0
  18. package/commands/_shared-references/verification-table.md +52 -0
  19. package/commands/massu-article-review.md +343 -0
  20. package/commands/massu-autoresearch/references/eval-runner.md +84 -0
  21. package/commands/massu-autoresearch/references/safety-rails.md +125 -0
  22. package/commands/massu-autoresearch/references/scoring-protocol.md +151 -0
  23. package/commands/massu-autoresearch.md +258 -0
  24. package/commands/massu-batch.md +44 -12
  25. package/commands/massu-bearings.md +42 -8
  26. package/commands/massu-checkpoint.md +588 -0
  27. package/commands/massu-ci-fix.md +2 -2
  28. package/commands/massu-command-health.md +132 -0
  29. package/commands/massu-command-improve.md +232 -0
  30. package/commands/massu-commit.md +205 -44
  31. package/commands/massu-create-plan.md +239 -57
  32. package/commands/massu-data/references/common-queries.md +79 -0
  33. package/commands/massu-data/references/table-guide.md +50 -0
  34. package/commands/massu-data.md +66 -0
  35. package/commands/massu-dead-code.md +29 -34
  36. package/commands/massu-debug/references/auto-learning.md +61 -0
  37. package/commands/massu-debug/references/codegraph-tracing.md +80 -0
  38. package/commands/massu-debug/references/common-shortcuts.md +98 -0
  39. package/commands/massu-debug/references/investigation-phases.md +294 -0
  40. package/commands/massu-debug/references/report-format.md +107 -0
  41. package/commands/massu-debug.md +105 -386
  42. package/commands/massu-docs.md +1 -1
  43. package/commands/massu-full-audit.md +61 -0
  44. package/commands/massu-gap-enhancement-analyzer.md +276 -16
  45. package/commands/massu-golden-path/references/approval-points.md +216 -0
  46. package/commands/massu-golden-path/references/competitive-mode.md +273 -0
  47. package/commands/massu-golden-path/references/error-handling.md +121 -0
  48. package/commands/massu-golden-path/references/phase-0-requirements.md +53 -0
  49. package/commands/massu-golden-path/references/phase-1-plan-creation.md +168 -0
  50. package/commands/massu-golden-path/references/phase-2-implementation.md +397 -0
  51. package/commands/massu-golden-path/references/phase-2.5-gap-analyzer.md +156 -0
  52. package/commands/massu-golden-path/references/phase-3-simplify.md +40 -0
  53. package/commands/massu-golden-path/references/phase-4-commit.md +94 -0
  54. package/commands/massu-golden-path/references/phase-5-push.md +116 -0
  55. package/commands/massu-golden-path/references/phase-5.5-production-verify.md +170 -0
  56. package/commands/massu-golden-path/references/phase-6-completion.md +113 -0
  57. package/commands/massu-golden-path/references/qa-evaluator-spec.md +137 -0
  58. package/commands/massu-golden-path/references/sprint-contract-protocol.md +117 -0
  59. package/commands/massu-golden-path/references/vr-visual-calibration.md +73 -0
  60. package/commands/massu-golden-path.md +114 -848
  61. package/commands/massu-guide.md +72 -69
  62. package/commands/massu-hooks.md +27 -12
  63. package/commands/massu-hotfix.md +221 -144
  64. package/commands/massu-incident.md +49 -20
  65. package/commands/massu-infra-audit.md +187 -0
  66. package/commands/massu-learning-audit.md +211 -0
  67. package/commands/massu-loop/references/auto-learning.md +49 -0
  68. package/commands/massu-loop/references/checkpoint-audit.md +40 -0
  69. package/commands/massu-loop/references/guardrails.md +17 -0
  70. package/commands/massu-loop/references/iteration-structure.md +115 -0
  71. package/commands/massu-loop/references/loop-controller.md +188 -0
  72. package/commands/massu-loop/references/plan-extraction.md +78 -0
  73. package/commands/massu-loop/references/vr-plan-spec.md +140 -0
  74. package/commands/massu-loop-playwright.md +9 -9
  75. package/commands/massu-loop.md +115 -670
  76. package/commands/massu-new-pattern.md +423 -0
  77. package/commands/massu-perf.md +422 -0
  78. package/commands/massu-plan-audit.md +1 -1
  79. package/commands/massu-plan.md +389 -122
  80. package/commands/massu-production-verify.md +433 -0
  81. package/commands/massu-push.md +62 -378
  82. package/commands/massu-recap.md +29 -3
  83. package/commands/massu-rollback.md +613 -0
  84. package/commands/massu-scaffold-hook.md +2 -4
  85. package/commands/massu-scaffold-page.md +2 -3
  86. package/commands/massu-scaffold-router.md +1 -2
  87. package/commands/massu-security.md +619 -0
  88. package/commands/massu-simplify.md +115 -85
  89. package/commands/massu-squirrels.md +2 -2
  90. package/commands/massu-tdd.md +38 -22
  91. package/commands/massu-test.md +3 -3
  92. package/commands/massu-type-mismatch-audit.md +469 -0
  93. package/commands/massu-ui-audit.md +587 -0
  94. package/commands/massu-verify-playwright.md +287 -32
  95. package/commands/massu-verify.md +150 -46
  96. package/dist/cli.js +1451 -1047
  97. package/dist/hooks/post-tool-use.js +75 -6
  98. package/dist/hooks/user-prompt.js +16 -0
  99. package/package.json +6 -2
  100. package/patterns/build-patterns.md +302 -0
  101. package/patterns/component-patterns.md +246 -0
  102. package/patterns/display-patterns.md +185 -0
  103. package/patterns/form-patterns.md +890 -0
  104. package/patterns/integration-testing-checklist.md +445 -0
  105. package/patterns/security-patterns.md +219 -0
  106. package/patterns/testing-patterns.md +569 -0
  107. package/patterns/tool-routing.md +81 -0
  108. package/patterns/ui-patterns.md +371 -0
  109. package/protocols/plan-implementation.md +267 -0
  110. package/protocols/recovery.md +225 -0
  111. package/protocols/verification.md +404 -0
  112. package/reference/command-taxonomy.md +178 -0
  113. package/reference/cr-rules-reference.md +76 -0
  114. package/reference/hook-execution-order.md +148 -0
  115. package/reference/lessons-learned.md +175 -0
  116. package/reference/patterns-quickref.md +208 -0
  117. package/reference/standards.md +135 -0
  118. package/reference/subagents-reference.md +17 -0
  119. package/reference/vr-verification-reference.md +867 -0
  120. package/src/commands/init.ts +27 -0
  121. package/src/commands/install-commands.ts +149 -53
  122. package/src/hooks/post-tool-use.ts +17 -0
  123. package/src/hooks/user-prompt.ts +21 -0
  124. package/src/memory-file-ingest.ts +127 -0
  125. package/src/memory-tools.ts +34 -1
@@ -1,434 +1,118 @@
1
1
  ---
2
2
  name: massu-push
3
- description: Full verification gate (all tests, regression detection, security) before remote push
4
- allowed-tools: Bash(*), Read(*), Edit(*), Grep(*), Glob(*)
3
+ description: "When user says 'push', 'push to remote', 'deploy', or wants to push committed changes to the remote repository"
4
+ allowed-tools: Bash(*), Read(*), Edit(*), Write(*), Grep(*), Glob(*)
5
5
  ---
6
6
  name: massu-push
7
7
 
8
- > **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding. CR-9, CR-35 enforced.
9
-
10
- # CS Push: Full Verification Gate Before Remote Push
11
-
12
- ## Workflow Position
13
-
14
- ```
15
- /massu-create-plan -> /massu-plan -> /massu-loop -> /massu-commit -> /massu-push
16
- (CREATE) (AUDIT) (IMPLEMENT) (COMMIT) (PUSH)
17
- ```
18
-
19
- **This command is step 5 of 5 in the standard workflow.**
20
-
21
- ---
8
+ # Massu Push: Verify, Push, Monitor CI
22
9
 
23
10
  ## Objective
24
11
 
25
- Execute COMPREHENSIVE verification including ALL tests and security checks before pushing to remote. This is the final gate - code MUST pass every check before leaving your machine.
26
-
27
- **Philosophy**: Commit often (quality checks), push verified (full checks + security + regression).
28
-
29
- ---
30
-
31
- ## START NOW
32
-
33
- **Step 0: Write AUTHORIZED_COMMAND to session state (CR-35)**
34
-
35
- Update `session-state/CURRENT.md` to include `AUTHORIZED_COMMAND: massu-push`.
36
-
37
- **Step 0.1: Workflow State Tracking**
38
-
39
- Write a transition entry to `.massu/workflow-log.md`:
40
- ```
41
- | [timestamp] | VERIFY | DEPLOY | /massu-push | [session-id] |
42
- ```
43
-
44
- ---
45
-
46
- ## NON-NEGOTIABLE RULES
47
-
48
- - **ALL tests must pass** - vitest, full suite
49
- - **ALL security checks must pass** - npm audit, secrets scan
50
- - **Zero violations** - Pattern scanner, type check
51
- - **Do NOT push if ANY check fails**
52
- - **Document ALL test failures before fixing**
53
- - **Regression detection MANDATORY** - Compare against main branch
54
- - **FIX ALL ISSUES ENCOUNTERED (CR-9)** - Pre-existing or not
55
-
56
- ---
57
-
58
- ## CRITICAL: DUAL VERIFICATION REQUIREMENT
59
-
60
- **Push completion requires BOTH verification gates to pass.**
61
-
62
- | Verification | What It Checks | Required for Push |
63
- |--------------|----------------|-------------------|
64
- | **Code Quality** | Build, types, patterns, tests pass | YES |
65
- | **Plan Coverage** | ALL plan items implemented (if from plan) | YES |
66
-
67
- **Code Quality: PASS + Plan Coverage: FAIL = DO NOT PUSH**
12
+ Run deterministic pre-push checks, push, then monitor CI. If CI fails, auto-fix.
68
13
 
69
14
  ---
70
15
 
71
- ## CRITICAL: REGRESSION DETECTION
16
+ ## EXECUTION
72
17
 
73
- **Before pushing, verify no existing tests have regressed.**
18
+ ### Phase 1: Pre-Flight
74
19
 
75
- ### Regression Detection Protocol
76
-
77
- #### Step 1: Establish Baseline
78
- ```bash
79
- # If on main branch, compare against parent commit instead
80
- CURRENT_BRANCH=$(git branch --show-current)
81
- if [ "$CURRENT_BRANCH" = "main" ]; then
82
- # Compare against parent commit
83
- git stash -q 2>/dev/null || true
84
- git checkout HEAD~1 -q
85
- npm test 2>&1 | tee /tmp/baseline-tests.txt
86
- git checkout - -q
87
- git stash pop -q 2>/dev/null || true
88
- else
89
- # Compare against main branch
90
- git stash -q 2>/dev/null || true
91
- git checkout main -q
92
- npm test 2>&1 | tee /tmp/baseline-tests.txt
93
- git checkout - -q
94
- git stash pop -q 2>/dev/null || true
95
- fi
96
- ```
97
-
98
- #### Step 2: Run Tests on Current Branch
99
- ```bash
100
- npm test 2>&1 | tee /tmp/current-tests.txt
101
- ```
102
-
103
- #### Step 3: Compare Results
104
20
  ```bash
105
- # Parse vitest output: "Tests N passed (N)" or "Tests N failed | N passed (N)"
106
- BASELINE_PASS=$(grep -oP 'Tests\s+\K\d+(?=\s+passed)' /tmp/baseline-tests.txt || echo 0)
107
- BASELINE_FAIL=$(grep -oP '\K\d+(?=\s+failed)' /tmp/baseline-tests.txt || echo 0)
108
-
109
- CURRENT_PASS=$(grep -oP 'Tests\s+\K\d+(?=\s+passed)' /tmp/current-tests.txt || echo 0)
110
- CURRENT_FAIL=$(grep -oP '\K\d+(?=\s+failed)' /tmp/current-tests.txt || echo 0)
111
-
112
- echo "Baseline: $BASELINE_PASS passed, $BASELINE_FAIL failed"
113
- echo "Current: $CURRENT_PASS passed, $CURRENT_FAIL failed"
114
- ```
115
-
116
- #### Step 4: Gate Decision
117
- | Scenario | Action |
118
- |----------|--------|
119
- | No regressions | PASS - Continue to push |
120
- | Regressions found | FAIL - Fix before push |
121
- | New test failures | Investigate - may be new test or bug |
122
-
123
- ```markdown
124
- ### Regression Detection Report
125
-
126
- | Metric | Value |
127
- |--------|-------|
128
- | Baseline (main) passing tests | [N] |
129
- | Current branch passing tests | [N] |
130
- | Regressions (was passing, now failing) | [N] |
131
-
132
- **REGRESSION GATE: PASS / FAIL**
21
+ # Verify commits to push
22
+ git log origin/$(git branch --show-current)..HEAD --oneline
23
+ git remote -v
133
24
  ```
134
25
 
135
- ---
136
-
137
- ## VERIFICATION TIERS
26
+ If no commits to push, abort.
138
27
 
139
- ### Tier 1: Quick Checks (should already pass from massu-commit)
28
+ ### Phase 2: Pre-Push Verification
140
29
 
141
30
  ```bash
142
- # 1.1 Pattern Scanner
143
- bash scripts/massu-pattern-scanner.sh
144
- # MUST exit 0
145
-
146
- # 1.2 TypeScript
147
- cd packages/core && npx tsc --noEmit
148
- # MUST show 0 errors
149
-
150
- # 1.3 Hook Build
151
- cd packages/core && npm run build:hooks
152
- # MUST exit 0
153
-
154
- # 1.4 Generalization Compliance (VR-GENERIC)
155
- bash scripts/massu-generalization-scanner.sh
156
- # MUST exit 0
157
- ```
158
-
159
- **Gate Check:**
160
- ```markdown
161
- ### Tier 1: Quick Checks
162
- | Check | Command | Result | Status |
163
- |-------|---------|--------|--------|
164
- | Pattern Scanner | massu-pattern-scanner.sh | Exit [X] | PASS/FAIL |
165
- | TypeScript | tsc --noEmit | [X] errors | PASS/FAIL |
166
- | Hook Build | build:hooks | Exit [X] | PASS/FAIL |
167
- | Generalization | massu-generalization-scanner.sh | Exit [X] | PASS/FAIL |
168
-
169
- **Tier 1 Status: PASS/FAIL**
31
+ ./scripts/push-verify.sh
170
32
  ```
171
33
 
172
- ---
173
-
174
- ### Tier 2: Full Test Suite (CRITICAL)
34
+ **This script runs pre-push checks: pattern scanner, coupling, UX quality, schema validation, ESLint, TypeScript.**
175
35
 
176
- #### 2.0 Regression Detection (MANDATORY FIRST)
36
+ If it exits non-zero, fix the failures before proceeding. Do NOT push with failing checks.
177
37
 
178
- Run the regression detection protocol above before the full test suite.
38
+ ### Phase 3: Push
179
39
 
180
- #### 2.1 All Tests (vitest)
181
40
  ```bash
182
- npm test
183
- # MUST exit 0, all tests pass
41
+ git push origin $(git branch --show-current)
184
42
  ```
185
43
 
186
- Capture output:
187
- - Total tests
188
- - Passed tests
189
- - Failed tests
190
- - Skipped tests
191
-
192
- **If tests fail:**
193
- 1. Document ALL failures
194
- 2. Fix each failure
195
- 3. Re-run ALL tests (not just failed ones)
196
-
197
- #### 2.2 Tool Registration Verification (if new tools in this push)
44
+ ### Phase 4: Monitor CI
198
45
 
199
46
  ```bash
200
- # List new/modified tool files
201
- git diff origin/main..HEAD --name-only | grep "tools\|tool"
202
-
203
- # For EACH new tool, verify registration
204
- grep "getToolDefinitions\|isToolName\|handleToolCall" packages/core/src/tools.ts
47
+ ./scripts/ci-status.sh --wait --max-wait 300
205
48
  ```
206
49
 
207
- **Gate Check:**
208
- ```markdown
209
- ### Tier 2: Test Suite
210
- | Check | Command | Passed | Failed | Status |
211
- |-------|---------|--------|--------|--------|
212
- | Regression Detection | Compare vs main | 0 regressions | 0 | PASS/FAIL |
213
- | All Tests | npm test | [X]/[Y] | 0 | PASS/FAIL |
214
- | Tool Registration | grep tools.ts | All registered | 0 | PASS/FAIL |
50
+ Three outcomes:
51
+ - **CI passes**: Done. Report success.
52
+ - **CI fails**: Auto-run `/massu-ci-fix` protocol (diagnose, fix, commit, re-push, re-monitor).
53
+ - **CI timeout**: Report timeout, suggest manual check.
215
54
 
216
- **Tier 2 Status: PASS/FAIL**
217
- ```
55
+ ### Phase 5: CI Auto-Fix (if CI failed)
218
56
 
219
- ---
57
+ If CI failed, execute the `/massu-ci-fix` protocol inline:
220
58
 
221
- ### Tier 3: Security & Compliance
222
-
223
- #### 3.1 npm Audit
224
- ```bash
225
- npm audit --audit-level=high
226
- # MUST have 0 high/critical vulnerabilities
227
- ```
228
-
229
- **Vulnerability Handling:**
230
- - **Critical/High**: MUST fix before push
231
- - **Moderate**: Document and create ticket
232
- - **Low**: Informational only
233
-
234
- #### 3.2 Secrets Scan
235
- ```bash
236
- # Check for staged secret files
237
- git diff --cached --name-only | grep -E '\.(env|pem|key|secret)' && echo "FAIL" || echo "PASS"
238
-
239
- # Check for hardcoded credentials in source
240
- grep -rn 'sk-[a-zA-Z0-9]\{20,\}\|password.*=.*["\x27][^"\x27]\{8,\}' --include="*.ts" --include="*.tsx" \
241
- packages/core/src/ 2>/dev/null \
242
- | grep -v "process.env" \
243
- | grep -v 'RegExp\|regex\|REDACT\|redact\|sanitize\|mask' \
244
- | grep -v '\.test\.ts:' \
245
- | wc -l
246
- # MUST be 0
247
- ```
248
-
249
- #### 3.3 License Compliance (if deps changed)
250
- ```bash
251
- # Check if package.json or package-lock.json changed
252
- git diff origin/main..HEAD --name-only | grep -E 'package(-lock)?\.json' && \
253
- npm audit --audit-level=high 2>&1 || true
254
- ```
255
-
256
- #### 3.3 Plan Coverage (if from plan)
257
- ```markdown
258
- ### Plan Coverage Verification
259
-
260
- | Item # | Description | Status | Proof |
261
- |--------|-------------|--------|-------|
262
- | P1-001 | [desc] | DONE | [evidence] |
263
- | ... | ... | ... | ... |
264
-
265
- **Coverage: X/X items = 100%**
266
- ```
267
-
268
- **Gate Check:**
269
- ```markdown
270
- ### Tier 3: Security & Compliance
271
- | Check | Command | Result | Status |
272
- |-------|---------|--------|--------|
273
- | npm audit | npm audit --audit-level=high | [X] vulns | PASS/FAIL |
274
- | Secrets Scan | grep check | [X] found | PASS/FAIL |
275
- | Plan Coverage | item-by-item | [X]/[X] = [X]% | PASS/FAIL |
276
-
277
- **Tier 3 Status: PASS/FAIL**
278
- ```
59
+ 1. Pull failure logs: `gh run view [RUN_ID] --log-failed`
60
+ 2. Diagnose root cause
61
+ 3. Fix locally
62
+ 4. Verify fix: run the same check that failed
63
+ 5. Commit: `fix(ci): [description]`
64
+ 6. Re-push
65
+ 7. Re-monitor CI
66
+ 8. Max 3 fix attempts
279
67
 
280
68
  ---
281
69
 
282
- ## EXECUTION FLOW
283
-
284
- ### Phase 1: Pre-Flight Verification
70
+ ## OUTPUT FORMAT
285
71
 
286
- ```bash
287
- # Verify we're on a branch and have commits to push
288
- git status
289
- git log origin/main..HEAD --oneline
290
72
  ```
73
+ == MASSU PUSH ==
291
74
 
292
- If no commits to push, abort with message.
293
-
294
- ### Phase 2: Run All Tiers
295
-
296
- Run Tier 1, Tier 2, and Tier 3 in order. Stop at first tier failure.
75
+ Commits: 3 ahead of origin/main
76
+ Remote: [your-remote-url]
297
77
 
298
- ### Phase 3: Final Gate & Push
78
+ Pre-Push Verification:
79
+ [1/N] Pattern Scanner... PASS
80
+ [2/N] VR-COUPLING... PASS
81
+ ...
82
+ ALL CHECKS PASSED
299
83
 
300
- #### All Tiers Must Pass
84
+ Pushing to origin/main...
85
+ 0382f95a..29b569dc main -> main
301
86
 
302
- ```markdown
303
- ### PUSH GATE SUMMARY
304
- | Tier | Description | Status |
305
- |------|-------------|--------|
306
- | Tier 1 | Quick Checks (patterns, types, hooks) | PASS/FAIL |
307
- | Tier 2 | Full Test Suite + Regression | PASS/FAIL |
308
- | Tier 3 | Security & Compliance | PASS/FAIL |
87
+ CI Status:
88
+ Schema Validation: success
89
+ (300s timeout)
309
90
 
310
- ### DUAL VERIFICATION GATE
311
- | Gate | Status | Evidence |
312
- |------|--------|----------|
313
- | Code Quality | PASS/FAIL | Tiers 1-3 |
314
- | Plan Coverage | PASS/FAIL | X/X items (if plan) |
315
-
316
- **OVERALL: PASS / FAIL**
91
+ PUSH COMPLETE
317
92
  ```
318
93
 
319
- #### If ALL Pass
320
-
321
- ```bash
322
- # Push to remote
323
- git push origin [current-branch]
324
- ```
325
-
326
- #### If ANY Fail
327
-
328
- 1. **Document ALL failures**
329
- 2. **Fix each failure**
330
- 3. **Re-run ENTIRE verification** (not just failed tiers)
331
- 4. **Do NOT push until all tiers pass**
332
-
333
94
  ---
334
95
 
335
- ## TIMING EXPECTATIONS
96
+ ## GOTCHAS
336
97
 
337
- | Phase | Typical Duration |
338
- |-------|------------------|
339
- | Tier 1 (Quick) | ~30 seconds |
340
- | Tier 2 (Tests + Regression) | ~1-2 minutes |
341
- | Tier 3 (Security) | ~30 seconds |
342
- | Total | ~2-3 minutes |
98
+ - Verify remote URL before push (`git remote -v`)
99
+ - Verify branch before push (`git branch --show-current`)
100
+ - Never force-push to main without explicit user confirmation
101
+ - If push-verify.sh fails, fix issues first -- do NOT bypass
343
102
 
344
103
  ---
345
104
 
346
- ## ABORT CONDITIONS
347
-
348
- Immediately abort and report if:
349
- - Secrets detected in codebase
350
- - More than 10% of tests failing (indicates systemic issue)
351
- - Any HIGH/CRITICAL npm vulnerability with no fix available
352
-
353
- ```markdown
354
- ## PUSH ABORTED
355
-
356
- ### Reason
357
- [SECURITY | TEST_FAILURE | OTHER]
358
-
359
- ### Details
360
- [Specific issue]
361
-
362
- ### Required Action
363
- [Steps to resolve]
364
-
365
- ### Do NOT Attempt Push Until Resolved
366
- ```
367
-
368
- ---
369
-
370
- ## MANDATORY: PLAN DOCUMENT UPDATE (If Push Completes Plan)
371
-
372
- **If this push completes work from a plan document, the plan MUST be updated.**
373
-
374
- Before push is considered complete:
375
- - [ ] Plan document has IMPLEMENTATION STATUS at TOP
376
- - [ ] All completed items marked with status
377
- - [ ] Verification evidence recorded
378
- - [ ] Push commit hash recorded in plan
379
-
380
- ```markdown
381
- # IMPLEMENTATION STATUS
382
-
383
- **Plan**: [Plan Name]
384
- **Status**: COMPLETE - PUSHED
385
- **Last Updated**: [YYYY-MM-DD HH:MM]
386
- **Push Commit**: [commit hash]
387
-
388
- ## Final Verification
389
-
390
- | Check | Result | Status |
391
- |-------|--------|--------|
392
- | Pattern Scanner | Exit 0 | PASS |
393
- | Type Check | 0 errors | PASS |
394
- | Tests | All pass | PASS |
395
- | Push | Successful | PASS |
396
- ```
397
-
398
- ---
399
-
400
- ## AUTO-LEARNING PROTOCOL
401
-
402
- After pushing, if any issues were fixed during this verification:
403
-
404
- 1. **Record the pattern** - What went wrong and how it was fixed
405
- 2. **Check if pattern scanner should be updated**
406
- 3. **Update session state**
407
-
408
- ---
409
-
410
- ## COMPLETION REPORT
411
-
412
- ```markdown
413
- ## CS PUSH COMPLETE
414
-
415
- ### Push Details
416
- - **Branch**: [branch]
417
- - **Commits**: [count]
418
- - **Remote**: origin/[branch]
105
+ ## QUALITY SCORING (silent)
419
106
 
420
- ### Verification Summary
421
- | Tier | Checks | Status |
422
- |------|--------|--------|
423
- | Tier 1 | Patterns, Types, Hooks | PASS |
424
- | Tier 2 | Tests ([X] passed), Regression (0) | PASS |
425
- | Tier 3 | npm audit (0 high/critical), Secrets (0) | PASS |
107
+ After push completes, append one JSONL line to `.claude/metrics/command-scores.jsonl`:
426
108
 
427
- ### Dual Verification
428
- | Gate | Status |
429
- |------|--------|
430
- | Code Quality | PASS |
431
- | Plan Coverage | PASS (X/X = 100%) |
109
+ | Check | Pass condition |
110
+ |-------|---------------|
111
+ | `pre_push_verify_passed` | push-verify.sh exited 0 |
112
+ | `ci_monitored` | CI status was checked after push |
113
+ | `ci_passed_or_fixed` | CI passed (first try or after auto-fix) |
114
+ | `no_force_push` | No --force flag used |
432
115
 
433
- **Push succeeded.**
116
+ ```json
117
+ {"command":"massu-push","timestamp":"ISO8601","scores":{"pre_push_verify_passed":true,"ci_monitored":true,"ci_passed_or_fixed":true,"no_force_push":true},"pass_rate":"4/4","input_summary":"[branch]:[commit-range]"}
434
118
  ```
@@ -7,7 +7,7 @@ name: massu-recap
7
7
 
8
8
  # Massu Recap: Session Handoff
9
9
 
10
- > **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding.
10
+ > **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding. CR-14, CR-5, CR-12 enforced.
11
11
 
12
12
  ---
13
13
 
@@ -73,7 +73,7 @@ UNCOMMITTED CHANGES
73
73
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
74
74
  ```
75
75
 
76
- ### Step 2: Memory Persistence Check
76
+ ### Step 2: Memory Persistence Check (CR-38)
77
77
 
78
78
  Check whether significant work was done this session:
79
79
 
@@ -99,6 +99,31 @@ MEMORY CHECK
99
99
 
100
100
  If no significant work: skip this section.
101
101
 
102
+ ### Step 2.5: Memory Contradiction Check
103
+
104
+ Run the memory contradiction scanner:
105
+
106
+ ```bash
107
+ bash scripts/memory-contradiction-check.sh
108
+ ```
109
+
110
+ Parse the output:
111
+ - **CONTRADICTION_COUNT: 0** — Memory is clean. Proceed.
112
+ - **CONTRADICTION_COUNT: N** — Display each contradiction to the user:
113
+
114
+ ```
115
+ MEMORY HEALTH
116
+ Contradictions found: N
117
+ [1] CONFLICT: file_a.md vs file_b.md
118
+ File A: "X works correctly"
119
+ File B: "X is broken and fails"
120
+ Action: Review and resolve — delete or update the stale entry
121
+ ```
122
+
123
+ **Do NOT auto-resolve contradictions.** Surface them so the user can decide which memory is stale.
124
+
125
+ If the script is missing or fails, note: "Memory contradiction check unavailable — run `bash scripts/memory-contradiction-check.sh` manually."
126
+
102
127
  ### Step 3: Update Session State
103
128
 
104
129
  Update `session-state/CURRENT.md` with:
@@ -157,7 +182,8 @@ On next recap, read last 3 entries from `recap-history.jsonl` to compare session
157
182
 
158
183
  1. Read all data sources in parallel
159
184
  2. Generate and present the session summary
160
- 3. Run the memory persistence check
185
+ 3. Run the memory persistence check (CR-38)
186
+ 3.5. Run the memory contradiction check (Step 2.5)
161
187
  4. Update CURRENT.md with final state
162
188
  5. Append recap-history.jsonl entry
163
189
  6. If task is complete, ask about archiving