@massu/core 0.1.1 → 0.4.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 (151) hide show
  1. package/commands/_shared-preamble.md +76 -0
  2. package/commands/massu-audit-deps.md +211 -0
  3. package/commands/massu-changelog.md +174 -0
  4. package/commands/massu-cleanup.md +315 -0
  5. package/commands/massu-commit.md +481 -0
  6. package/commands/massu-create-plan.md +752 -0
  7. package/commands/massu-dead-code.md +131 -0
  8. package/commands/massu-debug.md +484 -0
  9. package/commands/massu-deploy.md +91 -0
  10. package/commands/massu-deps.md +374 -0
  11. package/commands/massu-doc-gen.md +279 -0
  12. package/commands/massu-docs.md +364 -0
  13. package/commands/massu-estimate.md +313 -0
  14. package/commands/massu-golden-path.md +973 -0
  15. package/commands/massu-guide.md +167 -0
  16. package/commands/massu-hotfix.md +480 -0
  17. package/commands/massu-loop-playwright.md +837 -0
  18. package/commands/massu-loop.md +775 -0
  19. package/commands/massu-new-feature.md +511 -0
  20. package/commands/massu-parity.md +214 -0
  21. package/commands/massu-plan.md +456 -0
  22. package/commands/massu-push-light.md +207 -0
  23. package/commands/massu-push.md +434 -0
  24. package/commands/massu-refactor.md +410 -0
  25. package/commands/massu-release.md +363 -0
  26. package/commands/massu-review.md +238 -0
  27. package/commands/massu-simplify.md +281 -0
  28. package/commands/massu-status.md +278 -0
  29. package/commands/massu-tdd.md +201 -0
  30. package/commands/massu-test.md +516 -0
  31. package/commands/massu-verify-playwright.md +281 -0
  32. package/commands/massu-verify.md +667 -0
  33. package/dist/cli.js +7772 -3140
  34. package/dist/hooks/cost-tracker.js +103 -40
  35. package/dist/hooks/post-edit-context.js +74 -8
  36. package/dist/hooks/post-tool-use.js +268 -106
  37. package/dist/hooks/pre-compact.js +167 -43
  38. package/dist/hooks/pre-delete-check.js +159 -42
  39. package/dist/hooks/quality-event.js +103 -40
  40. package/dist/hooks/security-gate.js +29 -0
  41. package/dist/hooks/session-end.js +143 -84
  42. package/dist/hooks/session-start.js +186 -49
  43. package/dist/hooks/user-prompt.js +189 -43
  44. package/package.json +10 -15
  45. package/src/adr-generator.ts +9 -2
  46. package/src/analytics.ts +9 -3
  47. package/src/audit-trail.ts +10 -3
  48. package/src/backfill-sessions.ts +5 -4
  49. package/src/cli.ts +6 -0
  50. package/src/cloud-sync.ts +14 -18
  51. package/src/commands/doctor.ts +193 -6
  52. package/src/commands/init.ts +230 -5
  53. package/src/commands/install-commands.ts +137 -0
  54. package/src/config.ts +68 -2
  55. package/src/cost-tracker.ts +11 -6
  56. package/src/db.ts +115 -2
  57. package/src/dependency-scorer.ts +9 -2
  58. package/src/docs-tools.ts +21 -16
  59. package/src/hooks/post-edit-context.ts +4 -4
  60. package/src/hooks/post-tool-use.ts +130 -0
  61. package/src/hooks/pre-compact.ts +23 -1
  62. package/src/hooks/pre-delete-check.ts +92 -4
  63. package/src/hooks/security-gate.ts +32 -0
  64. package/src/hooks/session-end.ts +3 -3
  65. package/src/hooks/session-start.ts +99 -6
  66. package/src/hooks/user-prompt.ts +46 -1
  67. package/src/import-resolver.ts +2 -1
  68. package/src/knowledge-db.ts +169 -0
  69. package/src/knowledge-indexer.ts +704 -0
  70. package/src/knowledge-tools.ts +1413 -0
  71. package/src/license.ts +482 -0
  72. package/src/memory-db.ts +1364 -23
  73. package/src/memory-tools.ts +14 -15
  74. package/src/observability-tools.ts +13 -2
  75. package/src/observation-extractor.ts +11 -4
  76. package/src/page-deps.ts +3 -2
  77. package/src/prompt-analyzer.ts +9 -2
  78. package/src/python/coupling-detector.ts +124 -0
  79. package/src/python/domain-enforcer.ts +83 -0
  80. package/src/python/impact-analyzer.ts +95 -0
  81. package/src/python/import-parser.ts +244 -0
  82. package/src/python/import-resolver.ts +135 -0
  83. package/src/python/migration-indexer.ts +115 -0
  84. package/src/python/migration-parser.ts +332 -0
  85. package/src/python/model-indexer.ts +70 -0
  86. package/src/python/model-parser.ts +279 -0
  87. package/src/python/route-indexer.ts +58 -0
  88. package/src/python/route-parser.ts +317 -0
  89. package/src/python-tools.ts +629 -0
  90. package/src/regression-detector.ts +9 -3
  91. package/src/security-scorer.ts +9 -2
  92. package/src/sentinel-db.ts +45 -89
  93. package/src/sentinel-tools.ts +8 -11
  94. package/src/server.ts +29 -7
  95. package/src/session-archiver.ts +4 -5
  96. package/src/team-knowledge.ts +9 -2
  97. package/src/tools.ts +1032 -44
  98. package/src/validate-features-runner.ts +0 -1
  99. package/src/validation-engine.ts +9 -2
  100. package/README.md +0 -40
  101. package/dist/server.js +0 -7008
  102. package/src/__tests__/adr-generator.test.ts +0 -260
  103. package/src/__tests__/analytics.test.ts +0 -282
  104. package/src/__tests__/audit-trail.test.ts +0 -382
  105. package/src/__tests__/backfill-sessions.test.ts +0 -690
  106. package/src/__tests__/cli.test.ts +0 -290
  107. package/src/__tests__/cloud-sync.test.ts +0 -261
  108. package/src/__tests__/config-sections.test.ts +0 -359
  109. package/src/__tests__/config.test.ts +0 -732
  110. package/src/__tests__/cost-tracker.test.ts +0 -348
  111. package/src/__tests__/db.test.ts +0 -177
  112. package/src/__tests__/dependency-scorer.test.ts +0 -325
  113. package/src/__tests__/docs-integration.test.ts +0 -178
  114. package/src/__tests__/docs-tools.test.ts +0 -199
  115. package/src/__tests__/domains.test.ts +0 -236
  116. package/src/__tests__/hooks.test.ts +0 -221
  117. package/src/__tests__/import-resolver.test.ts +0 -95
  118. package/src/__tests__/integration/path-traversal.test.ts +0 -134
  119. package/src/__tests__/integration/pricing-consistency.test.ts +0 -88
  120. package/src/__tests__/integration/tool-registration.test.ts +0 -146
  121. package/src/__tests__/memory-db.test.ts +0 -404
  122. package/src/__tests__/memory-enhancements.test.ts +0 -316
  123. package/src/__tests__/memory-tools.test.ts +0 -199
  124. package/src/__tests__/middleware-tree.test.ts +0 -177
  125. package/src/__tests__/observability-tools.test.ts +0 -595
  126. package/src/__tests__/observability.test.ts +0 -437
  127. package/src/__tests__/observation-extractor.test.ts +0 -167
  128. package/src/__tests__/page-deps.test.ts +0 -60
  129. package/src/__tests__/prompt-analyzer.test.ts +0 -298
  130. package/src/__tests__/regression-detector.test.ts +0 -295
  131. package/src/__tests__/rules.test.ts +0 -87
  132. package/src/__tests__/schema-mapper.test.ts +0 -29
  133. package/src/__tests__/security-scorer.test.ts +0 -238
  134. package/src/__tests__/security-utils.test.ts +0 -175
  135. package/src/__tests__/sentinel-db.test.ts +0 -491
  136. package/src/__tests__/sentinel-scanner.test.ts +0 -750
  137. package/src/__tests__/sentinel-tools.test.ts +0 -324
  138. package/src/__tests__/sentinel-types.test.ts +0 -750
  139. package/src/__tests__/server.test.ts +0 -452
  140. package/src/__tests__/session-archiver.test.ts +0 -524
  141. package/src/__tests__/session-state-generator.test.ts +0 -900
  142. package/src/__tests__/team-knowledge.test.ts +0 -327
  143. package/src/__tests__/tools.test.ts +0 -340
  144. package/src/__tests__/transcript-parser.test.ts +0 -195
  145. package/src/__tests__/trpc-index.test.ts +0 -25
  146. package/src/__tests__/validate-features-runner.test.ts +0 -517
  147. package/src/__tests__/validation-engine.test.ts +0 -300
  148. package/src/core-tools.ts +0 -685
  149. package/src/memory-queries.ts +0 -804
  150. package/src/memory-schema.ts +0 -546
  151. package/src/tool-helpers.ts +0 -41
@@ -0,0 +1,364 @@
1
+ ---
2
+ name: massu-docs
3
+ description: Documentation sync protocol ensuring docs align with code changes and features
4
+ allowed-tools: Bash(*), Read(*), Write(*), Edit(*), Grep(*), Glob(*)
5
+ ---
6
+ name: massu-docs
7
+
8
+ > **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding. CR-9 enforced.
9
+
10
+ # Massu Docs: Documentation Sync Protocol
11
+
12
+ ## Objective
13
+
14
+ Ensure **documentation accuracy** by auditing documentation content against current codebase features, CLI elements, and workflows. Keep help articles, CLAUDE.md, and API docs in sync with code changes.
15
+
16
+ ---
17
+
18
+ ## NON-NEGOTIABLE RULES
19
+
20
+ - **Code is truth** - Docs must match actual behavior
21
+ - **Feature parity** - Every user feature needs docs
22
+ - **Terminology sync** - Same labels in CLI output and docs
23
+ - **Version awareness** - Document breaking changes
24
+ - **No assumptions** - Verify features exist before documenting
25
+
26
+ ---
27
+
28
+ ## ZERO-GAP AUDIT LOOP
29
+
30
+ **Documentation sync does NOT complete until a SINGLE COMPLETE AUDIT finds ZERO discrepancies.**
31
+
32
+ ### The Rule
33
+
34
+ ```
35
+ DOCS AUDIT LOOP:
36
+ 1. Run ALL documentation checks (features, terminology, API)
37
+ 2. Count discrepancies found
38
+ 3. IF discrepancies > 0:
39
+ - Fix ALL discrepancies
40
+ - Re-run ENTIRE audit from Step 1
41
+ 4. IF discrepancies == 0:
42
+ - DOCS IN SYNC
43
+ ```
44
+
45
+ **Partial re-checks are NOT valid. The ENTIRE docs audit must pass in a SINGLE run.**
46
+
47
+ ---
48
+
49
+ ## DOCUMENTATION LOCATIONS
50
+
51
+ | Type | Location | Purpose |
52
+ |------|----------|---------|
53
+ | CLAUDE.md | `.claude/CLAUDE.md` | AI assistant context and project rules |
54
+ | Config docs | `massu.config.yaml` comments | Config schema documentation |
55
+ | README | `packages/core/README.md` | Public-facing package docs |
56
+ | Website docs | `website/` (if applicable) | User-facing documentation site |
57
+ | Command files | `.claude/commands/*.md` | Workflow command documentation |
58
+ | Plans | `docs/plans/*.md` | Implementation plans and specs |
59
+
60
+ ---
61
+
62
+ ## AUDIT SECTION 1: FEATURE INVENTORY
63
+
64
+ ### 1.1 List All MCP Tools (User-Facing Features)
65
+ ```bash
66
+ # Find all tool definitions
67
+ grep -rn "name:" packages/core/src/tools.ts packages/core/src/*-tools.ts packages/core/src/*.ts 2>/dev/null \
68
+ | grep -E "name:\s*[\`'\"]" \
69
+ | grep -v "__tests__" \
70
+ | head -40
71
+
72
+ # Count tools
73
+ grep -c "name:" packages/core/src/tools.ts 2>/dev/null
74
+ ```
75
+
76
+ ### 1.2 Feature Matrix
77
+ ```markdown
78
+ ### Feature Inventory
79
+
80
+ | Feature/Tool | Module | Documented in README | Documented in CLAUDE.md | Status |
81
+ |-------------|--------|---------------------|------------------------|--------|
82
+ | [tool] | [module] | YES/NO | YES/NO | OK/NEEDS DOC |
83
+ ```
84
+
85
+ ### 1.3 Find Undocumented Features
86
+ Compare tools found in codebase against README documentation.
87
+
88
+ ---
89
+
90
+ ## AUDIT SECTION 2: CLI/TOOL OUTPUT SYNC
91
+
92
+ ### 2.1 Extract Tool Output Strings
93
+ ```bash
94
+ # Find tool output text
95
+ grep -rn "text:" packages/core/src/ --include="*.ts" | grep -v "__tests__" | head -30
96
+
97
+ # Find error messages
98
+ grep -rn "Error\|error\|Invalid\|invalid" packages/core/src/ --include="*.ts" | grep -v "__tests__" | head -20
99
+ ```
100
+
101
+ ### 2.2 Terminology Matrix
102
+ ```markdown
103
+ ### Tool Output Terminology Audit
104
+
105
+ | Tool | Output String | Docs String | Match | Status |
106
+ |------|--------------|-------------|-------|--------|
107
+ | [tool] | [code] | [docs] | YES/NO | OK/FIX |
108
+ ```
109
+
110
+ ---
111
+
112
+ ## AUDIT SECTION 3: WORKFLOW DOCUMENTATION
113
+
114
+ ### 3.1 Identify User Workflows
115
+ ```bash
116
+ # Find all command files (these define workflows)
117
+ ls .claude/commands/massu-*.md | wc -l
118
+
119
+ # Find workflow references in CLAUDE.md
120
+ grep "massu-" .claude/CLAUDE.md | head -30
121
+ ```
122
+
123
+ ### 3.2 Workflow Matrix
124
+ ```markdown
125
+ ### Workflow Documentation
126
+
127
+ | Workflow | Command File | In CLAUDE.md | Steps Match | Status |
128
+ |----------|-------------|--------------|-------------|--------|
129
+ | Implementation | massu-loop.md | YES | YES/NO | OK/UPDATE |
130
+ | Commit | massu-commit.md | YES | YES/NO | OK/UPDATE |
131
+ ```
132
+
133
+ ### 3.3 Verify Command Table in CLAUDE.md
134
+
135
+ Compare the Workflow Commands tables in CLAUDE.md against actual command files:
136
+ ```bash
137
+ # Count commands in CLAUDE.md table
138
+ grep -c "massu-" .claude/CLAUDE.md
139
+
140
+ # Count actual command files
141
+ ls .claude/commands/massu-*.md | wc -l
142
+ ```
143
+
144
+ **CRITICAL**: Every command file MUST be listed in the CLAUDE.md Workflow Commands tables.
145
+
146
+ ---
147
+
148
+ ## AUDIT SECTION 4: API/CONFIG DOCUMENTATION
149
+
150
+ ### 4.1 Config Schema Documentation
151
+ ```bash
152
+ # Check massu.config.yaml has comments explaining fields
153
+ grep -c "#" massu.config.yaml
154
+
155
+ # Check config.ts documents the schema
156
+ grep -c "description\|comment\|//" packages/core/src/config.ts
157
+ ```
158
+
159
+ ### 4.2 API Documentation
160
+ ```bash
161
+ # Check if tool inputSchema has descriptions for all properties
162
+ grep -rn "description:" packages/core/src/ --include="*.ts" | grep -v "__tests__" | wc -l
163
+ ```
164
+
165
+ ### 4.3 Config Documentation Matrix
166
+ ```markdown
167
+ ### Config Documentation
168
+
169
+ | Config Key | Documented in YAML | Documented in README | Type Correct | Status |
170
+ |-----------|-------------------|---------------------|--------------|--------|
171
+ | [key] | YES/NO | YES/NO | YES/NO | OK/FIX |
172
+ ```
173
+
174
+ ---
175
+
176
+ ## AUDIT SECTION 5: README ACCURACY
177
+
178
+ ### 5.1 Check README Contents
179
+ ```bash
180
+ # Read public README
181
+ cat packages/core/README.md 2>/dev/null | head -50
182
+
183
+ # Check if README mentions all key features
184
+ grep -c "tool\|hook\|config\|install\|usage" packages/core/README.md 2>/dev/null
185
+ ```
186
+
187
+ ### 5.2 README Sections Checklist
188
+ ```markdown
189
+ ### README Completeness
190
+
191
+ | Section | Present | Accurate | Status |
192
+ |---------|---------|----------|--------|
193
+ | Installation | YES/NO | YES/NO | OK/FIX |
194
+ | Configuration | YES/NO | YES/NO | OK/FIX |
195
+ | Usage | YES/NO | YES/NO | OK/FIX |
196
+ | Tools Reference | YES/NO | YES/NO | OK/FIX |
197
+ | Contributing | YES/NO | YES/NO | OK/FIX |
198
+ ```
199
+
200
+ ---
201
+
202
+ ## AUDIT SECTION 6: DEVELOPER DOCS SYNC
203
+
204
+ ### 6.1 CLAUDE.md Accuracy
205
+ ```bash
206
+ # Check if CLAUDE.md file locations match actual
207
+ grep "packages/core/src/" .claude/CLAUDE.md | while read line; do
208
+ path=$(echo "$line" | grep -oP 'packages/core/src/[a-zA-Z0-9_./-]+')
209
+ if [ -n "$path" ]; then
210
+ [ -f "$path" ] && echo "OK: $path" || echo "MISSING: $path"
211
+ fi
212
+ done
213
+
214
+ # Verify tool module inventory matches actual files
215
+ grep -c "\.ts" .claude/CLAUDE.md
216
+ ```
217
+
218
+ ### 6.2 Build & Test Commands Accuracy
219
+ ```bash
220
+ # Verify each documented build command works
221
+ npm run build --dry-run 2>/dev/null
222
+ npm test --help 2>/dev/null
223
+ ```
224
+
225
+ ### 6.3 Developer Docs Matrix
226
+ ```markdown
227
+ ### Developer Documentation
228
+
229
+ | Doc | Last Updated | Accurate | Status |
230
+ |-----|--------------|----------|--------|
231
+ | CLAUDE.md | [date] | YES/NO | OK/UPDATE |
232
+ | massu.config.yaml | [date] | YES/NO | OK/UPDATE |
233
+ | README.md | [date] | YES/NO | OK/UPDATE |
234
+ ```
235
+
236
+ ---
237
+
238
+ ## SYNC PROCESS
239
+
240
+ ### When Code Changes
241
+
242
+ 1. **Identify impact**
243
+ - What feature/tool changed?
244
+ - What CLI output changed?
245
+ - What workflows changed?
246
+
247
+ 2. **Find related docs**
248
+ - Search README for feature mentions
249
+ - Search CLAUDE.md for related rules
250
+ - Search command files for related references
251
+
252
+ 3. **Update docs**
253
+ - Change terminology if labels changed
254
+ - Update steps if workflow changed
255
+ - Update examples if API changed
256
+ - Update CLAUDE.md tables if commands added/removed
257
+
258
+ 4. **Verify sync**
259
+ - Re-read updated docs
260
+ - Compare against actual behavior
261
+ - Run documented commands to verify accuracy
262
+
263
+ ---
264
+
265
+ ## DOCS SYNC REPORT FORMAT
266
+
267
+ ```markdown
268
+ ## MASSU DOCS SYNC REPORT
269
+
270
+ ### Summary
271
+ - **Date**: [timestamp]
272
+ - **Scope**: Full sync / [specific area]
273
+ - **Features Audited**: [N]
274
+ - **Issues Found**: [N]
275
+
276
+ ### Feature Coverage
277
+ | Status | Count |
278
+ |--------|-------|
279
+ | Documented | N |
280
+ | Undocumented | N |
281
+ | Outdated | N |
282
+
283
+ ### Terminology Sync
284
+ | Status | Count |
285
+ |--------|-------|
286
+ | Matching | N |
287
+ | Mismatched | N |
288
+
289
+ ### Issues Found
290
+ | Priority | Issue | Location | Fix |
291
+ |----------|-------|----------|-----|
292
+ | HIGH | [issue] | [loc] | [fix] |
293
+
294
+ ### Updates Applied
295
+ - [Update 1]
296
+ - [Update 2]
297
+
298
+ ### Recommendations
299
+ 1. [Recommendation 1]
300
+ 2. [Recommendation 2]
301
+
302
+ **DOCS STATUS: IN SYNC / NEEDS UPDATE / CRITICAL**
303
+ ```
304
+
305
+ ---
306
+
307
+ ## SESSION STATE UPDATE
308
+
309
+ After sync, update `session-state/CURRENT.md`:
310
+
311
+ ```markdown
312
+ ## DOCS SYNC SESSION
313
+
314
+ ### Audit
315
+ - **Date**: [timestamp]
316
+ - **Scope**: Full / [specific area]
317
+
318
+ ### Findings
319
+ - Undocumented features: [N]
320
+ - Outdated docs: [N]
321
+ - Terminology mismatches: [N]
322
+
323
+ ### Updates Applied
324
+ [List or "None - audit only"]
325
+
326
+ ### Status
327
+ - README: IN SYNC / NEEDS UPDATE
328
+ - CLAUDE.md: IN SYNC / NEEDS UPDATE
329
+ - Config docs: IN SYNC / NEEDS UPDATE
330
+ ```
331
+
332
+ ---
333
+
334
+ ## QUICK COMMANDS
335
+
336
+ ```bash
337
+ # List all MCP tools (potential doc topics)
338
+ grep -rn "name:" packages/core/src/tools.ts | head -20
339
+
340
+ # Check CLAUDE.md freshness
341
+ ls -la .claude/CLAUDE.md
342
+
343
+ # List command files
344
+ ls -la .claude/commands/massu-*.md | wc -l
345
+
346
+ # Search docs for term
347
+ grep -rn "[search term]" packages/core/README.md .claude/CLAUDE.md 2>/dev/null
348
+ ```
349
+
350
+ ---
351
+
352
+ ## START NOW
353
+
354
+ 1. Run Section 1: Feature Inventory
355
+ 2. Run Section 2: CLI/Tool Output Sync
356
+ 3. Run Section 3: Workflow Documentation
357
+ 4. Run Section 4: API/Config Documentation
358
+ 5. Run Section 5: README Accuracy
359
+ 6. Run Section 6: Developer Docs Sync
360
+ 7. Apply necessary updates
361
+ 8. Produce Docs Sync Report
362
+ 9. Update session state
363
+
364
+ **Remember: Documentation is a product. Outdated docs = broken product.**
@@ -0,0 +1,313 @@
1
+ ---
2
+ name: massu-estimate
3
+ description: Effort estimation with complexity scoring, codebase impact analysis, and historical comparison
4
+ allowed-tools: Bash(*), Read(*), Grep(*), Glob(*)
5
+ ---
6
+ name: massu-estimate
7
+
8
+ > **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding. CR-9, CR-35 enforced.
9
+
10
+ # CS Estimate: Effort Estimation
11
+
12
+ ## Objective
13
+
14
+ Analyze a feature or change request, score its complexity across multiple dimensions, measure codebase impact, compare against historical work, and produce a structured effort estimate. This is READ-ONLY — no source code is modified.
15
+
16
+ **Usage**: `/massu-estimate [description of the feature or change]`
17
+
18
+ ---
19
+
20
+ ## NON-NEGOTIABLE RULES
21
+
22
+ - Do NOT modify any files
23
+ - All estimates MUST be based on actual codebase data — no guessing
24
+ - FIX ALL ISSUES ENCOUNTERED (CR-9) — if blockers are found during analysis, flag them
25
+ - Express uncertainty explicitly — ranges are more honest than point estimates
26
+ - Every complexity factor MUST be justified with a concrete codebase observation
27
+
28
+ ---
29
+
30
+ ## STEP 1: REQUIREMENT ANALYSIS
31
+
32
+ Parse and clarify the request from `$ARGUMENTS`.
33
+
34
+ ### 1a. Identify Change Type
35
+
36
+ ```markdown
37
+ ### Change Classification
38
+
39
+ | Dimension | Assessment |
40
+ |-----------|-----------|
41
+ | Type | [new feature / enhancement / bug fix / refactor / infrastructure] |
42
+ | Scope | [MCP tool / website / config / testing / documentation / multi-area] |
43
+ | Public API change? | YES/NO — [what changes] |
44
+ | Database change? | YES/NO — [what changes] |
45
+ | Config change? | YES/NO — [what changes] |
46
+ | New dependencies? | YES/NO — [what needed] |
47
+ ```
48
+
49
+ ### 1b. Decompose into Sub-Tasks
50
+
51
+ Break the request into concrete deliverables:
52
+
53
+ ```markdown
54
+ ### Sub-Task Breakdown
55
+
56
+ | # | Sub-Task | Type |
57
+ |---|----------|------|
58
+ | 1 | [task] | [implementation/test/config/docs] |
59
+ | 2 | [task] | [implementation/test/config/docs] |
60
+ | ... | | |
61
+ ```
62
+
63
+ ---
64
+
65
+ ## STEP 2: CODEBASE IMPACT ANALYSIS
66
+
67
+ Determine what the change will touch.
68
+
69
+ ### 2a. Files That Will Be Modified
70
+
71
+ ```bash
72
+ # Search for related code to the requested feature
73
+ grep -rn "$ARGUMENTS" packages/core/src/ --include="*.ts" | head -20
74
+ grep -rn "$ARGUMENTS" website/src/ --include="*.ts" --include="*.tsx" | head -20
75
+ ```
76
+
77
+ ### 2b. Tool Registration Impact (if adding MCP tools)
78
+
79
+ ```bash
80
+ # Count existing tools for baseline
81
+ grep -c "name:" packages/core/src/tools.ts 2>/dev/null
82
+
83
+ # Check if tool registration pattern is stable
84
+ grep -n "getToolDefinitions\|handleToolCall" packages/core/src/tools.ts | head -10
85
+ ```
86
+
87
+ ### 2c. Database Schema Impact
88
+
89
+ ```bash
90
+ # If changes require schema: check existing tables
91
+ grep -rn "CREATE TABLE" website/supabase/migrations/*.sql 2>/dev/null | tail -10
92
+ grep -rn "CREATE TABLE\|ALTER TABLE" packages/core/src/memory-db.ts 2>/dev/null | head -10
93
+ ```
94
+
95
+ ### 2d. Config Impact
96
+
97
+ ```bash
98
+ # Current config structure
99
+ cat massu.config.yaml 2>/dev/null | head -30
100
+
101
+ # Config interface
102
+ grep -A 30 "interface.*Config\|type.*Config" packages/core/src/config.ts 2>/dev/null | head -40
103
+ ```
104
+
105
+ ### 2e. Blast Radius Estimate
106
+
107
+ ```bash
108
+ # How many files import from core modules that would change
109
+ grep -rn "from.*tools\|from.*server\|from.*config" packages/core/src/ --include="*.ts" | wc -l
110
+ ```
111
+
112
+ ```markdown
113
+ ### Impact Matrix
114
+
115
+ | Area | Impact | Files Affected | Notes |
116
+ |------|--------|---------------|-------|
117
+ | MCP tools | [NONE/LOW/MED/HIGH] | [N] | [details] |
118
+ | Website | [NONE/LOW/MED/HIGH] | [N] | [details] |
119
+ | Database | [NONE/LOW/MED/HIGH] | [N] | [details] |
120
+ | Config | [NONE/LOW/MED/HIGH] | [N] | [details] |
121
+ | Tests | [NONE/LOW/MED/HIGH] | [N] | [details] |
122
+ | Total affected files | | [N] | |
123
+ ```
124
+
125
+ ---
126
+
127
+ ## STEP 3: COMPLEXITY SCORING
128
+
129
+ Score complexity across 6 dimensions. Each dimension is 1-5 (1=trivial, 5=very complex).
130
+
131
+ ### Scoring Rubric
132
+
133
+ | Score | Definition |
134
+ |-------|-----------|
135
+ | 1 | Trivial — copy-paste pattern, well-understood domain, no surprises |
136
+ | 2 | Simple — small change, existing pattern to follow |
137
+ | 3 | Moderate — some novel logic, a few unknowns |
138
+ | 4 | Complex — non-trivial logic, cross-cutting concerns, or significant unknowns |
139
+ | 5 | Very complex — research required, high risk, many unknowns |
140
+
141
+ ### 3a. Technical Complexity
142
+
143
+ ```bash
144
+ # How novel is this relative to existing patterns?
145
+ # Read the most similar existing implementation for comparison
146
+ ls packages/core/src/*.ts | head -10
147
+ ```
148
+
149
+ Score: [1-5] — Justification: [based on similarity to existing patterns]
150
+
151
+ ### 3b. Integration Complexity
152
+
153
+ ```bash
154
+ # How many systems does this touch?
155
+ # Check all integration points
156
+ grep -rn "import.*from" packages/core/src/tools.ts | wc -l
157
+ ```
158
+
159
+ Score: [1-5] — Justification: [number of integration points]
160
+
161
+ ### 3c. Testing Complexity
162
+
163
+ ```bash
164
+ # Existing test patterns for reference
165
+ ls packages/core/src/__tests__/ 2>/dev/null
166
+ wc -l packages/core/src/__tests__/*.test.ts 2>/dev/null | sort -rn | head -5
167
+ ```
168
+
169
+ Score: [1-5] — Justification: [test scope required]
170
+
171
+ ### 3d. Risk Complexity
172
+
173
+ ```bash
174
+ # Are there known blockers or failure modes?
175
+ cat .claude/session-state/CURRENT.md 2>/dev/null | grep -i "failed\|blocked\|issue" | head -10
176
+ ```
177
+
178
+ Score: [1-5] — Justification: [known risks identified]
179
+
180
+ ### 3e. Documentation Complexity
181
+
182
+ Score: [1-5] — Justification: [scope of docs required: JSDoc / README / API ref / config schema]
183
+
184
+ ### 3f. Verification Complexity
185
+
186
+ ```bash
187
+ # How many VR- gates apply?
188
+ # Count applicable: VR-TEST, VR-TYPE, VR-TOOL-REG, VR-HOOK-BUILD, VR-PATTERN, VR-BLAST-RADIUS
189
+ ```
190
+
191
+ Score: [1-5] — Justification: [N applicable verification gates]
192
+
193
+ ```markdown
194
+ ### Complexity Scorecard
195
+
196
+ | Dimension | Score (1-5) | Weight | Weighted Score | Justification |
197
+ |-----------|-------------|--------|----------------|---------------|
198
+ | Technical | [N] | 2x | [N] | [reason] |
199
+ | Integration | [N] | 1.5x | [N] | [reason] |
200
+ | Testing | [N] | 1.5x | [N] | [reason] |
201
+ | Risk | [N] | 2x | [N] | [reason] |
202
+ | Documentation | [N] | 1x | [N] | [reason] |
203
+ | Verification | [N] | 1x | [N] | [reason] |
204
+ | **Total weighted score** | | | **[N]/50** | |
205
+
206
+ **Complexity Tier**: TRIVIAL (≤10) / SMALL (11-20) / MEDIUM (21-30) / LARGE (31-40) / EXTRA LARGE (>40)
207
+ ```
208
+
209
+ ---
210
+
211
+ ## STEP 4: HISTORICAL COMPARISON
212
+
213
+ Compare against completed work for calibration.
214
+
215
+ ### 4a. Recent Similar Work
216
+
217
+ ```bash
218
+ # Commits of similar type/scope
219
+ git log -30 --format="%H %s" 2>/dev/null | grep -i "feat\|add\|implement" | head -15
220
+ ```
221
+
222
+ ### 4b. Time Proxy: Commit Count
223
+
224
+ ```bash
225
+ # How many commits did similar features take?
226
+ # Look at feat commits and their diff stats
227
+ git log -20 --stat --format="%s" 2>/dev/null | grep -A 5 "^feat"
228
+ ```
229
+
230
+ ```markdown
231
+ ### Historical Comparison
232
+
233
+ | Similar Past Work | Commit Count | Complexity Score | Actual Outcome |
234
+ |-------------------|-------------|-----------------|----------------|
235
+ | [commit subject] | [N] | [estimated] | [result if known] |
236
+ ```
237
+
238
+ ---
239
+
240
+ ## STEP 5: ESTIMATE GENERATION
241
+
242
+ Produce the final estimate.
243
+
244
+ ```markdown
245
+ ### EFFORT ESTIMATE
246
+
247
+ **Request**: [description from $ARGUMENTS]
248
+ **Complexity Tier**: [TRIVIAL/SMALL/MEDIUM/LARGE/EXTRA LARGE]
249
+ **Complexity Score**: [N]/50
250
+
251
+ ### Sub-Task Estimates
252
+
253
+ | # | Sub-Task | Complexity | Estimate | Notes |
254
+ |---|----------|-----------|----------|-------|
255
+ | 1 | [task] | [1-5] | [S/M/L] | [key assumption] |
256
+ | 2 | [task] | [1-5] | [S/M/L] | [key assumption] |
257
+
258
+ **S** = Small (< 1 session) | **M** = Medium (1-3 sessions) | **L** = Large (3+ sessions, consider plan)
259
+
260
+ ### Total Estimate
261
+
262
+ | Scenario | Reasoning |
263
+ |----------|-----------|
264
+ | Optimistic | [N] sessions — [if assumptions hold and no blockers] |
265
+ | Realistic | [N] sessions — [expected with normal iteration] |
266
+ | Pessimistic | [N] sessions — [if integration complexity materializes] |
267
+
268
+ ### Recommendation
269
+
270
+ **Approach**: [implement directly / create-plan first / spike required]
271
+
272
+ **Rationale**: [why this approach given the complexity score]
273
+
274
+ ### Key Assumptions
275
+
276
+ 1. [assumption 1 — what must be true for estimate to hold]
277
+ 2. [assumption 2]
278
+ 3. [assumption 3]
279
+
280
+ ### Risk Flags
281
+
282
+ | Risk | Likelihood | Impact | Mitigation |
283
+ |------|-----------|--------|-----------|
284
+ | [risk] | HIGH/MED/LOW | HIGH/MED/LOW | [mitigation] |
285
+ ```
286
+
287
+ ---
288
+
289
+ ## COMPLETION REPORT
290
+
291
+ ```markdown
292
+ ## CS ESTIMATE COMPLETE
293
+
294
+ ### Request Analyzed
295
+ - **Feature**: [description]
296
+ - **Complexity Tier**: [tier]
297
+ - **Weighted Score**: [N]/50
298
+
299
+ ### Estimate Summary
300
+ - **Optimistic**: [N] sessions
301
+ - **Realistic**: [N] sessions
302
+ - **Pessimistic**: [N] sessions
303
+
304
+ ### Files Analyzed
305
+ | File | Purpose |
306
+ |------|---------|
307
+ | [file] | [why read] |
308
+
309
+ ### Suggested Next Step
310
+ - Score < 20 (Small): `/massu-hotfix` or direct implementation
311
+ - Score 21-30 (Medium): Direct implementation with `/massu-loop`
312
+ - Score 31+ (Large): Create plan first with `/massu-create-plan`
313
+ ```