@massu/core 0.5.0 → 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 (118) 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 +146 -95
  97. package/package.json +6 -2
  98. package/patterns/build-patterns.md +302 -0
  99. package/patterns/component-patterns.md +246 -0
  100. package/patterns/display-patterns.md +185 -0
  101. package/patterns/form-patterns.md +890 -0
  102. package/patterns/integration-testing-checklist.md +445 -0
  103. package/patterns/security-patterns.md +219 -0
  104. package/patterns/testing-patterns.md +569 -0
  105. package/patterns/tool-routing.md +81 -0
  106. package/patterns/ui-patterns.md +371 -0
  107. package/protocols/plan-implementation.md +267 -0
  108. package/protocols/recovery.md +225 -0
  109. package/protocols/verification.md +404 -0
  110. package/reference/command-taxonomy.md +178 -0
  111. package/reference/cr-rules-reference.md +76 -0
  112. package/reference/hook-execution-order.md +148 -0
  113. package/reference/lessons-learned.md +175 -0
  114. package/reference/patterns-quickref.md +208 -0
  115. package/reference/standards.md +135 -0
  116. package/reference/subagents-reference.md +17 -0
  117. package/reference/vr-verification-reference.md +867 -0
  118. package/src/commands/install-commands.ts +149 -53
@@ -7,7 +7,7 @@ name: massu-batch
7
7
 
8
8
  # Massu Batch: Parallel Code Migration via Worktree Agents
9
9
 
10
- > **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding.
10
+ **Shared rules**: Read `.claude/commands/_shared-preamble.md` for POST-COMPACTION (CR-12), ENTERPRISE-GRADE (CR-14), AWS SECRETS (CR-5) rules.
11
11
 
12
12
  ---
13
13
 
@@ -17,7 +17,7 @@ name: massu-batch
17
17
  /massu-batch [migration] → /massu-simplify → /massu-commit → /massu-push
18
18
  ```
19
19
 
20
- **This command is for CODE-ONLY migrations. It REFUSES database work.**
20
+ **This command is for CODE-ONLY migrations. It REFUSES database work (CR-36 safety).**
21
21
 
22
22
  ---
23
23
 
@@ -37,16 +37,35 @@ Takes a migration description, identifies all affected files, splits them into b
37
37
 
38
38
  Read `$ARGUMENTS` for the migration description.
39
39
 
40
- If no arguments provided, ask:
40
+ If no arguments provided, use AskUserQuestion:
41
+ ```
42
+ question: "What code migration do you want to run?"
43
+ options:
44
+ - label: "Import path change"
45
+ description: "Rename/move imports across files (e.g., @/old/path → @/new/path)"
46
+ - label: "Component swap"
47
+ description: "Replace one component with another across files"
48
+ - label: "Pattern replacement"
49
+ description: "Replace a code pattern with a new one across files"
50
+ - label: "API update"
51
+ description: "Update API calls to a new format"
52
+ ```
53
+
54
+ Then ask for specifics:
41
55
  - **Search pattern**: What to find (glob pattern or grep pattern)
42
56
  - **Transformation**: What to change it to
43
57
  - **Scope**: Directory to limit search (default: `src/`)
44
58
 
45
- ### Step 2: DB Guard (Safety Gate — MANDATORY)
59
+ ### Step 2: DB Guard (CR-36 Safety Gate — MANDATORY)
46
60
 
47
61
  **This step CANNOT be skipped. No exceptions.**
48
62
 
49
- Check the migration description for these keywords:
63
+ ```bash
64
+ # Run the DB guard script
65
+ bash scripts/batch-db-guard.sh "$MIGRATION_DESCRIPTION" $TARGET_FILES
66
+ ```
67
+
68
+ Additionally, check the migration description for these keywords:
50
69
  ```
51
70
  migration, schema, ALTER, CREATE TABLE, DROP, column, RLS, GRANT,
52
71
  database, prisma, supabase, ctx.db, ctx.prisma, $queryRaw, execute_sql
@@ -65,8 +84,8 @@ supabase/migrations/
65
84
  ```
66
85
  ## DB GUARD: Migration Blocked
67
86
 
68
- This migration touches database-related code. Database migrations require
69
- sequential coordination across environments.
87
+ This migration touches database-related code. Database migrations MUST use
88
+ /massu-loop to ensure CR-36 compliance (all 3 environments in same session).
70
89
 
71
90
  /massu-batch is designed for code-only migrations:
72
91
  - Import path changes
@@ -122,6 +141,18 @@ Each agent will:
122
141
  4. Report results
123
142
  ```
124
143
 
144
+ Use AskUserQuestion:
145
+ ```
146
+ question: "Proceed with this batch migration plan?"
147
+ options:
148
+ - label: "Proceed"
149
+ description: "Execute the migration with M parallel agents"
150
+ - label: "Adjust batch size"
151
+ description: "Change the number of files per agent"
152
+ - label: "Cancel"
153
+ description: "Abort the migration"
154
+ ```
155
+
125
156
  **Wait for explicit user approval. Do NOT proceed without it.**
126
157
 
127
158
  ### Step 5: Execution Phase (Parallel Worktree Agents)
@@ -283,8 +314,8 @@ git worktree remove [path]
283
314
 
284
315
  | Rule | Enforcement |
285
316
  |------|-------------|
286
- | **No database changes** | DB guard inline keyword check + path check |
287
- | **User approval required** | Interactive approval before execution phase |
317
+ | **No database changes** | DB guard script + inline keyword check + path check |
318
+ | **User approval required** | AskUserQuestion before execution phase |
288
319
  | **No file overlap between batches** | Planning phase ensures each file appears in exactly one batch |
289
320
  | **Per-agent verification** | Each agent runs pattern-scanner + tsc before completing |
290
321
  | **Consolidated verification** | Full checks run after merge |
@@ -314,7 +345,7 @@ git worktree remove [path]
314
345
 
315
346
  | Scenario | Use Instead |
316
347
  |----------|-------------|
317
- | Database/schema changes | `/massu-loop` |
348
+ | Database/schema changes | `/massu-loop` (CR-36: all 3 envs) |
318
349
  | < 5 files affected | Manual changes + `/massu-simplify` |
319
350
  | New feature development | `/massu-create-plan` → `/massu-loop` |
320
351
  | Cross-file dependencies | `/massu-loop` (sequential is safer) |
@@ -322,6 +353,7 @@ git worktree remove [path]
322
353
 
323
354
  ## Gotchas
324
355
 
325
- - **NEVER for database work** — batch migrations are CODE-ONLY. Database migrations must be applied to all environments in sequence, which requires coordination that parallel agents cannot provide
356
+ - **NEVER for database work (CR-36)** — batch migrations are CODE-ONLY. Database migrations must be applied to all 3 environments in sequence, which requires coordination that parallel agents cannot provide
357
+ - **DB guard auto-refuses** — `scripts/batch-db-guard.sh` automatically blocks batch items that reference database tables, migrations, or SQL
326
358
  - **Worktree isolation** — each agent runs in a git worktree. Changes must be mergeable. Agents editing the same file will cause merge conflicts
327
- - **One task per agent** — each worktree agent gets exactly one plan item. Never combine unrelated items in a single agent
359
+ - **One task per agent (Principle #20)** — each worktree agent gets exactly one plan item. Never combine unrelated items in a single agent
@@ -1,13 +1,13 @@
1
1
  ---
2
2
  name: massu-bearings
3
3
  description: "When user starts a new session, says 'good morning', asks 'where was I', 'what should I work on', or needs session orientation after being away"
4
- allowed-tools: Bash(*), Read(*), Grep(*), Glob(*)
4
+ allowed-tools: Bash(*), Read(*), Grep(*), Glob(*), mcp__massu-codegraph__massu_cost_session, mcp__massu-codegraph__massu_cost_trend, mcp__massu-codegraph__massu_cost_feature
5
5
  ---
6
6
  name: massu-bearings
7
7
 
8
8
  # Massu Bearings: Session Orientation
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
 
@@ -41,6 +41,9 @@ Read these in parallel where possible:
41
41
  | 10 | `.claude/metrics/command-invocations.jsonl` | Command usage frequency — top/least used in last 7 days |
42
42
  | 11 | `.claude/metrics/bearings-history.jsonl` | Previous bearings runs — show trends |
43
43
  | 12 | `.claude/commands/` (ls -d */`) | Detect folder-based skills (directories vs flat files) |
44
+ | 13 | `bash scripts/memory-contradiction-check.sh` | Contradiction count, consolidation candidates |
45
+ | 14 | `massu_cost_session` + `massu_cost_trend` MCP tools | Token spend this session, cost trend over time |
46
+ | 15 | `session-state/deferred-verifications.md` | Pending production verifications from previous deploys |
44
47
 
45
48
  ---
46
49
 
@@ -93,10 +96,28 @@ COMMAND USAGE (last 7 days)
93
96
  Least: [command] (N invocations), [command] (N)
94
97
  (or "No invocation data yet")
95
98
 
99
+ TOKEN SPEND
100
+ Session: $X.XX (N calls)
101
+ 7-day trend: $XX.XX total, $X.XX/day avg
102
+ Top feature: [feature] ($X.XX)
103
+ (or "No cost data available — massu_cost_session returned empty")
104
+
96
105
  FOLDER-BASED SKILLS
97
106
  [list any commands that are directories: massu-golden-path, massu-debug, massu-loop, massu-data]
98
107
  (or "No folder-based skills detected")
99
108
 
109
+ MEMORY HEALTH
110
+ Contradictions: [N] found
111
+ [1] file_a.md vs file_b.md — [brief description]
112
+ Consolidation candidates: [N]
113
+ (or "Memory is clean — 0 contradictions")
114
+
115
+ DEFERRED VERIFICATIONS
116
+ ! [DV-001] [feature] — expected by [time], query: [sql snippet]
117
+ ! [DV-002] [feature] — expected by [time], query: [sql snippet]
118
+ (or "No deferred verifications pending")
119
+ Action: Run `/massu-production-verify --deferred` to check
120
+
100
121
  ACTIVE WARNINGS
101
122
  - [any correction rules or memory enforcement reminders]
102
123
  (or "No active warnings")
@@ -109,11 +130,12 @@ ACTIVE WARNINGS
109
130
  ## Suggested Focus Logic
110
131
 
111
132
  Prioritize items in this order:
112
- 1. **Blockers** anything marked as blocked in CURRENT.md
113
- 2. **In-progress tasks** — partially completed work from last session
114
- 3. **Open plan items** — next items in an active plan
115
- 4. **Aging squirrels** — ideas parked > 7 days ago (mention but don't auto-promote)
116
- 5. **New work** — only if nothing else is open
133
+ 1. **Deferred verifications past due** items in `session-state/deferred-verifications.md` past their expected verification time
134
+ 2. **Blockers** — anything marked as blocked in CURRENT.md
135
+ 3. **In-progress tasks** — partially completed work from last session
136
+ 4. **Open plan items** — next items in an active plan
137
+ 5. **Aging squirrels** — ideas parked > 7 days ago (mention but don't auto-promote)
138
+ 6. **New work** — only if nothing else is open
117
139
 
118
140
  Keep to 2-3 items. This is a focus list, not an inventory.
119
141
 
@@ -189,6 +211,18 @@ Read `.claude/metrics/command-invocations.jsonl`. Filter to last 7 days by `time
189
211
 
190
212
  ---
191
213
 
214
+ ## Token Spend Logic
215
+
216
+ Call `massu_cost_session` MCP tool for current session cost. Call `massu_cost_trend` MCP tool for 7-day cost history. If either tool returns empty or errors, show "No cost data available — massu_cost_session returned empty". Otherwise:
217
+
218
+ 1. **Session cost**: Display total cost and call count from `massu_cost_session`
219
+ 2. **7-day trend**: Sum daily costs, calculate daily average from `massu_cost_trend`
220
+ 3. **Top feature**: If `massu_cost_feature` data is available, show the most expensive feature
221
+
222
+ If the MCP tools are unavailable (server not running), skip this section silently — do NOT error or block the bearings output.
223
+
224
+ ---
225
+
192
226
  ## Folder-Based Skill Detection
193
227
 
194
228
  Run `ls -d .claude/commands/*/` to find commands that are directories. Display the list in FOLDER-BASED SKILLS section. Each folder-based skill has a `## Skill Contents` table in its main file listing sub-files.
@@ -197,7 +231,7 @@ Run `ls -d .claude/commands/*/` to find commands that are directories. Display t
197
231
 
198
232
  ## START NOW
199
233
 
200
- 1. Read all data sources in parallel (CURRENT.md, archives, squirrels, plans, git log, git diff, corrections, metrics, bearings-history)
234
+ 1. Read all data sources in parallel (CURRENT.md, archives, squirrels, plans, git log, git diff, corrections, metrics, bearings-history, memory-contradiction-check, cost MCP tools)
201
235
  2. Synthesize into the output format above
202
236
  3. Present to terminal
203
237
  4. Append bearings-history.jsonl entry