@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
@@ -0,0 +1,76 @@
1
+ # Shared Reference: Blast Radius Protocol
2
+
3
+ **This is a shared content block. Referenced by multiple commands. Do NOT invoke directly.**
4
+
5
+ ---
6
+
7
+ ## BLAST RADIUS ANALYSIS PROTOCOL (CR-25 — MANDATORY)
8
+
9
+ **MANDATORY** when ANY plan or change modifies a constant value, redirect path, route, string literal, enum value, or configuration key. See [incidents/INCIDENT-LOG.md](../../incidents/INCIDENT-LOG.md) Incident #15 for origin.
10
+
11
+ ### Step 1: Identify ALL Changed Values
12
+
13
+ | # | Old Value | New Value | Type | Scope |
14
+ |---|-----------|-----------|------|-------|
15
+ | 1 | `[old]` | `[new]` | [redirect path / enum / route / config key] | codebase-wide |
16
+
17
+ ### Step 2: Codebase-Wide Grep for EACH Changed Value
18
+
19
+ ```bash
20
+ grep -rn '"[old_value]"' src/ --include="*.ts" --include="*.tsx" | grep -v node_modules
21
+ grep -rn "'[old_value]'" src/ --include="*.ts" --include="*.tsx" | grep -v node_modules
22
+ grep -rn '"[old_value]"' src/ --include="*.ts" --include="*.tsx" | grep -v node_modules | wc -l
23
+ ```
24
+
25
+ ### Step 2.5: Codegraph Impact Analysis
26
+
27
+ For each file found by grep, call `mcp__massu-codegraph__massu_impact({ file: "[relative_path]" })` to discover INDIRECT impact through import chains.
28
+
29
+ ### Step 2.7: Sentinel Feature Impact (CR-32)
30
+
31
+ For plans that DELETE files, run `massu_sentinel_impact`. Every orphaned feature MUST have a migration target. Zero orphaned features allowed.
32
+
33
+ ### Step 3: Categorize EVERY Occurrence
34
+
35
+ **EVERY match must be categorized. No exceptions.**
36
+
37
+ | # | File | Line | Context | Action | Reason |
38
+ |---|------|------|---------|--------|--------|
39
+ | 1 | src/middleware.ts | 523 | Root redirect | CHANGE | Landing page |
40
+ | 2 | src/components/Sidebar.tsx | 93 | Nav href | KEEP | Links TO target |
41
+
42
+ **Disposition Summary**: Count of CHANGE / KEEP / INVESTIGATE items. INVESTIGATE must resolve to 0 before plan is final.
43
+
44
+ ### Step 4: Add ALL "CHANGE" Items to Plan
45
+
46
+ Every "CHANGE" occurrence becomes a plan deliverable with item ID, file, change required, and phase.
47
+
48
+ ### Automated Blast Radius Analysis (Optional)
49
+
50
+ Spawn `Task(subagent_type="massu-blast-radius-analyzer", prompt="Analyze blast radius for value changes: {old_value} -> {new_value}. Categorize every occurrence.")` for automated codebase-wide grep, codegraph impact tracing, and automatic categorization.
51
+
52
+ ---
53
+
54
+ ## Blast Radius Gate
55
+
56
+ All of the following must be true:
57
+ - All changed values identified
58
+ - Grep run for each value
59
+ - Every occurrence categorized
60
+ - Zero INVESTIGATE remaining
61
+ - All CHANGE items in plan
62
+ - All KEEP items documented with reasons
63
+
64
+ **BLAST RADIUS GATE: PASS / FAIL**
65
+
66
+ ---
67
+
68
+ ## Common Search Patterns
69
+
70
+ | Change Type | Search Patterns |
71
+ |-------------|-----------------|
72
+ | Route/path | `href="[old]"`, `push('[old]')`, `replace('[old]')`, `redirect('[old]')`, `pathname === '[old]'` |
73
+ | Status/enum | `=== '[old]'`, `value="[old]"`, `status: '[old]'` |
74
+ | Table/column rename | `ctx.db.[old]`, `[old]_id`, `table_name = '[old]'` |
75
+ | Component rename | `<[Old]`, `import.*[Old]`, `from.*[old]` |
76
+ | Config key | `config.[old]`, `[old]:`, `"[old]"` |
@@ -0,0 +1,64 @@
1
+ # Shared Reference: Security Pre-Screen
2
+
3
+ **This is a shared content block. Referenced by multiple commands. Do NOT invoke directly.**
4
+
5
+ ---
6
+
7
+ ## SECURITY PRE-SCREEN (Shift-Left Gate)
8
+
9
+ **Purpose**: Catch security gaps BEFORE implementation/plan generation, not after. Complements (does not replace) the security-reviewer subagent that audits implemented code.
10
+
11
+ ### 6 Security Dimensions
12
+
13
+ | # | Dimension | Trigger | Action if Triggered |
14
+ |---|-----------|---------|---------------------|
15
+ | S1 | PII / Sensitive Data | Feature handles names, emails, financial data, addresses | Add RLS policies + column-level access to plan |
16
+ | S2 | Authentication | Feature needs to know WHO the user is | Verify protectedProcedure usage, add auth items |
17
+ | S3 | Authorization | Feature restricts WHAT users can do (roles, ownership) | Add RBAC checks, RLS policies to plan |
18
+ | S4 | Injection Surfaces | User input flows to SQL, HTML, shell, or file paths | Add Zod validation, parameterized queries to plan |
19
+ | S5 | Secrets Management | New API keys, tokens, or credentials (CR-5) | Add AWS Secrets Manager items (P0-XXX) to plan |
20
+ | S6 | Rate Limiting | Public endpoints or high-cost operations (AI, email, PDF) | Add rate limiting middleware to plan |
21
+
22
+ ### Scoring
23
+
24
+ For each dimension, assign:
25
+ - **PASS**: Not applicable or already handled
26
+ - **N/A**: Feature does not touch this dimension
27
+ - **BLOCK**: Unresolved concern that must be addressed before proceeding
28
+
29
+ ### Block Resolution
30
+
31
+ | Block Type | Resolution |
32
+ |------------|------------|
33
+ | Self-resolvable | Add missing security deliverable (RLS policy, Zod schema, protectedProcedure, etc.) and change to PASS |
34
+ | Requires user decision | Ask via AskUserQuestion (e.g., "Should factory portal users see all orders or only their own?") |
35
+ | Architectural concern | Document in Risk Assessment section |
36
+
37
+ ### Gate
38
+
39
+ ```
40
+ BLOCKS_REMAINING = count of BLOCK items
41
+ IF BLOCKS_REMAINING > 0: DO NOT proceed. Resolve all blocks first.
42
+ IF BLOCKS_REMAINING = 0: PASS.
43
+ ```
44
+
45
+ ### Skip Condition
46
+
47
+ Pure read-only UI cosmetic changes (styling, copy, layout) with NO data access changes may skip this phase. Document: `Security Pre-Screen SKIPPED: [reason -- cosmetic-only, no data flow changes]`.
48
+
49
+ ### Pre-Screen Report Format
50
+
51
+ ```markdown
52
+ ## Security Pre-Screen
53
+
54
+ | # | Dimension | Status | Notes |
55
+ |---|-----------|--------|-------|
56
+ | S1 | PII / Sensitive Data | PASS/N/A/BLOCK | [details] |
57
+ | S2 | Authentication | PASS/N/A/BLOCK | [details] |
58
+ | S3 | Authorization | PASS/N/A/BLOCK | [details] |
59
+ | S4 | Injection Surfaces | PASS/N/A/BLOCK | [details] |
60
+ | S5 | Secrets Management | PASS/N/A/BLOCK | [details] |
61
+ | S6 | Rate Limiting | PASS/N/A/BLOCK | [details] |
62
+
63
+ **SECURITY PRE-SCREEN: PASS / BLOCKED ([N] blocks remaining)**
64
+ ```
@@ -0,0 +1,87 @@
1
+ # Test-First Protocol for Critical Findings
2
+
3
+ > Shared reference for /massu-loop and /massu-debug.
4
+ > Inspired by Hurlicane's "evidence before assertions" pattern.
5
+
6
+ ## When This Applies
7
+
8
+ This protocol is MANDATORY when:
9
+ - A review agent or debug investigation identifies a CRITICAL severity finding
10
+ - The finding involves a bug (not a style/pattern violation)
11
+ - The fix touches logic that can be unit-tested or integration-tested
12
+
13
+ This protocol is OPTIONAL (but recommended) for:
14
+ - HIGH severity findings
15
+ - Findings that involve data flow, state management, or business logic
16
+
17
+ This protocol does NOT apply to:
18
+ - LOW/MEDIUM pattern compliance fixes (CSS, naming, import order)
19
+ - Documentation-only changes
20
+ - Config/command infrastructure changes
21
+
22
+ ## The Protocol (4 Steps)
23
+
24
+ ### Step 1: Write the Failing Test
25
+
26
+ Before touching ANY source code, write a test that demonstrates the bug:
27
+
28
+ ```typescript
29
+ // Example: proving a serialization bug exists
30
+ it('should serialize BigInt fields to Number', () => {
31
+ const result = serializeRecord({ id: BigInt(123) });
32
+ expect(typeof result.id).toBe('number'); // This will FAIL
33
+ });
34
+ ```
35
+
36
+ ### Step 2: Verify Test Fails
37
+
38
+ Run the test and confirm it fails for the expected reason:
39
+
40
+ ```bash
41
+ npm test -- -t "should serialize BigInt"
42
+ # Expected: FAIL with the specific assertion error
43
+ # Note: This project uses Vitest. Use -t (--testNamePattern) for filtering, NOT --grep.
44
+ ```
45
+
46
+ If the test PASSES (the bug doesn't reproduce in test):
47
+ - The finding may be a false positive — investigate further
48
+ - Or the test doesn't exercise the right code path — fix the test
49
+ - Do NOT proceed to fix until you have a failing test
50
+
51
+ ### Step 3: Apply the Fix
52
+
53
+ Now fix the source code. The fix should be minimal and targeted.
54
+
55
+ ### Step 4: Verify Test Passes
56
+
57
+ ```bash
58
+ npm test -- -t "should serialize BigInt"
59
+ # Expected: PASS
60
+ ```
61
+
62
+ Run the full test suite to check for regressions:
63
+
64
+ ```bash
65
+ npm test
66
+ # Expected: ALL pass
67
+ ```
68
+
69
+ ## Output Format
70
+
71
+ When using this protocol, report:
72
+
73
+ ```
74
+ TEST-FIRST PROTOCOL for: [finding description]
75
+ Step 1: Test written → [file:line]
76
+ Step 2: Test fails → [error message confirming the bug]
77
+ Step 3: Fix applied → [file:line, description]
78
+ Step 4: Test passes → [npm test output showing pass]
79
+ TEST_FIRST_GATE: PASS
80
+ ```
81
+
82
+ ## Exceptions
83
+
84
+ If the finding CANNOT be tested (e.g., race condition only in production, visual rendering issue):
85
+ - Document WHY it can't be tested
86
+ - Use VR-BROWSER or VR-VISUAL as the evidence-before-assertion equivalent
87
+ - Report: `TEST_FIRST_GATE: SKIPPED — [reason]`
@@ -0,0 +1,52 @@
1
+ # Shared Reference: Verification Table
2
+
3
+ **This is a shared content block. Referenced by multiple commands. Do NOT invoke directly.**
4
+
5
+ ---
6
+
7
+ ## Standard VR-* Verification Gates
8
+
9
+ | Type | Command | Expected | Use When |
10
+ |------|---------|----------|----------|
11
+ | VR-BUILD | `npm run build` | Exit 0 | Claiming production ready |
12
+ | VR-TYPE | `npx tsc --noEmit` | 0 errors | Claiming type safety |
13
+ | VR-TEST | `npm test` | ALL pass (MANDATORY) | ALWAYS before claiming complete |
14
+ | VR-SCHEMA-PRE | `SELECT column_name FROM information_schema.columns WHERE table_name = 'X'` | All columns exist | BEFORE writing ANY query |
15
+ | VR-NEGATIVE | `grep -rn "[old]" src/` | 0 matches | Claiming removal |
16
+ | VR-GREP | `grep "[pattern]" [file]` | Match found | Claiming code added |
17
+ | VR-RENDER | `grep "<ComponentName" src/app/**/page.tsx` | Match in page file | UI component integrated |
18
+ | VR-COUPLING | `./scripts/check-coupling.sh` | Exit 0 | Backend features have UI exposure |
19
+ | VR-BLAST-RADIUS | Grep codebase for ALL refs to changed value | 0 uncategorized refs | Changing any constant/path/enum |
20
+ | VR-PLAN-COVERAGE | Item-by-item verification with proof | 100% items verified | Before claiming plan complete |
21
+ | VR-SCHEMA-SYNC | Query same table across all environments via MCP | Column counts + names match | After ANY database migration |
22
+ | VR-TOKEN | `scripts/audit-design-tokens.sh` | Exit 0 | CSS changes |
23
+ | VR-BROWSER | Playwright: navigate, snapshot, console_messages, interact | 0 errors, UI works | ANY UI fix/change (CR-41) |
24
+ | VR-SPEC-MATCH | Grep for EXACT CSS classes/structure from plan | All plan-specified strings found | UI plan items (CR-42) |
25
+ | VR-PIPELINE | Trigger pipeline procedure, verify non-empty output | Output contains data | Data pipeline features (CR-43) |
26
+
27
+ **Full VR-* reference (50+ types)**: [reference/vr-verification-reference.md](../../reference/vr-verification-reference.md)
28
+
29
+ ---
30
+
31
+ ## Auto-Verification Command Gate (Pre-Commit/Push)
32
+
33
+ | Gate | Command | Must |
34
+ |------|---------|------|
35
+ | 1. Pattern Scanner | `./scripts/pattern-scanner.sh` | Exit 0 |
36
+ | 2. Type Safety | `npx tsc --noEmit` | 0 errors |
37
+ | 3. Build | `npm run build` | Exit 0 |
38
+ | 4. Lint | `npm run lint` | Exit 0 |
39
+ | 5. Schema | `npx prisma validate` | Exit 0 |
40
+ | 6. Secrets Staged | `git diff --cached --name-only \| grep -E '\.(env\|pem\|key\|secret)'` | 0 files |
41
+ | 7. Credentials | `grep -rn "sk-\|password.*=.*['\"]" --include="*.ts" --include="*.tsx" src/ \| grep -v "process.env"` | 0 matches |
42
+
43
+ ---
44
+
45
+ ## Database Environments
46
+
47
+ | Environment | Description | MCP Tool Prefix |
48
+ |-------------|-------------|-----------------|
49
+ | DEV | Local development, testing | `mcp__supabase__DEV__` |
50
+ | PROD | Production database | `mcp__supabase__PROD__` |
51
+
52
+ > **Note**: Project-specific Supabase project IDs should be configured in the project's CLAUDE.md or `.env` file, not in shared references.
@@ -0,0 +1,343 @@
1
+ ---
2
+ name: massu-article-review
3
+ description: "When user shares a URL, article, tweet, or post and wants analysis of how it applies to the project -- 'review this', 'what do you think of this'"
4
+ allowed-tools: WebFetch(*), WebSearch(*), Read(*), Write(*), Bash(*)
5
+ disable-model-invocation: true
6
+ ---
7
+ name: massu-article-review
8
+
9
+ > **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding. CR-14, CR-5, CR-12 enforced.
10
+
11
+ # Massu Article Review: Technical Article Analysis Protocol
12
+
13
+ ## Objective
14
+
15
+ Analyze technical articles, blog posts, and documentation to extract actionable insights for project development. Produce structured summaries with cost/benefit scoring and automatic comparison to current project approaches.
16
+
17
+ ---
18
+
19
+ ## ARGUMENTS
20
+
21
+ The command accepts an optional URL argument:
22
+
23
+ ```
24
+ /massu-article-review https://example.com/article
25
+ /massu-article-review # Will prompt for input
26
+ ```
27
+
28
+ **Arguments from $ARGUMENTS**: {{ARGUMENTS}}
29
+
30
+ ---
31
+
32
+ ## INPUT HANDLING
33
+
34
+ ### Priority Order
35
+ 1. If `$ARGUMENTS` contains a URL -> fetch it
36
+ 2. If user pasted article content -> use that
37
+ 3. Otherwise -> ask user for URL or content
38
+
39
+ ### Paywall/Login Handling
40
+
41
+ **Claude Code CANNOT access authenticated sessions or bypass paywalls.**
42
+
43
+ If WebFetch fails or returns incomplete content:
44
+
45
+ ```
46
+ The article appears to be behind a paywall or requires login.
47
+
48
+ Please provide the content using one of these methods:
49
+ 1. Copy/paste the article text directly
50
+ 2. Save as PDF from Safari and tell me the file path
51
+ 3. Use Safari Reader mode -> Export -> provide file path
52
+ 4. Save webpage as HTML and provide file path
53
+ ```
54
+
55
+ ---
56
+
57
+ ## AUTOMATIC BEHAVIORS
58
+
59
+ ### 1. Always Compare to Current Project Approach
60
+ Every review MUST include comparison to existing project patterns, commands, and architecture. This is NOT optional.
61
+
62
+ ### 2. Always Save Review
63
+ Every review MUST be saved to the project's documentation directory.
64
+
65
+ ### 3. Always Include Cost/Benefit Score
66
+ Every review MUST include a numeric score (see scoring section).
67
+
68
+ ---
69
+
70
+ ## COST/BENEFIT SCORING
71
+
72
+ Calculate a **Project Fit Score** (0-100):
73
+
74
+ ### Scoring Components
75
+
76
+ | Component | Weight | Criteria |
77
+ |-----------|--------|----------|
78
+ | **Problem Relevance** | 25 pts | Does it solve a current project pain point? |
79
+ | **Architecture Fit** | 20 pts | Compatible with the project's technology stack? |
80
+ | **Pattern Compliance** | 20 pts | Can it follow project verification/quality patterns? |
81
+ | **Implementation Effort** | 15 pts | Low effort = high score, high effort = low score |
82
+ | **Risk Level** | 10 pts | Low risk = high score, high risk = low score |
83
+ | **Maintenance Burden** | 10 pts | Low maintenance = high score |
84
+
85
+ ### Score Interpretation
86
+
87
+ | Score | Rating | Recommendation |
88
+ |-------|--------|----------------|
89
+ | 80-100 | Excellent | ADOPT - implement soon |
90
+ | 60-79 | Good | TRIAL - experiment in isolated context |
91
+ | 40-59 | Mixed | ASSESS - needs more research |
92
+ | 20-39 | Poor | HOLD - not suitable now |
93
+ | 0-19 | Bad | AVOID - conflicts with project patterns |
94
+
95
+ ### Score Card Format
96
+
97
+ ```markdown
98
+ ## Project Fit Score: XX/100
99
+
100
+ | Component | Score | Notes |
101
+ |-----------|-------|-------|
102
+ | Problem Relevance | /25 | [why] |
103
+ | Architecture Fit | /20 | [why] |
104
+ | Pattern Compliance | /20 | [why] |
105
+ | Implementation Effort | /15 | [why] |
106
+ | Risk Level | /10 | [why] |
107
+ | Maintenance Burden | /10 | [why] |
108
+ | **TOTAL** | **XX/100** | **[RATING]** |
109
+ ```
110
+
111
+ ---
112
+
113
+ ## ANALYSIS FRAMEWORK
114
+
115
+ ### 1. Executive Summary
116
+ 2-3 sentence overview of the article's main thesis.
117
+
118
+ ### 2. Key Points Extraction
119
+
120
+ | # | Key Point | Technical Detail |
121
+ |---|-----------|------------------|
122
+ | 1 | [Point] | [Specifics] |
123
+ | 2 | [Point] | [Specifics] |
124
+
125
+ ### 3. Technology/Tool Overview (if applicable)
126
+
127
+ | Aspect | Details |
128
+ |--------|---------|
129
+ | **Name** | [Tool/Tech name] |
130
+ | **Purpose** | [What it does] |
131
+ | **Key Features** | [Main features] |
132
+ | **Prerequisites** | [Requirements] |
133
+ | **Maturity** | [Production-ready/Beta/Experimental] |
134
+ | **Community** | [Downloads, stars, activity] |
135
+
136
+ ### 4. Current Project Approach Comparison (MANDATORY)
137
+
138
+ **This section is REQUIRED for every review.**
139
+
140
+ | Aspect | Article Approach | Current Project Approach | Delta |
141
+ |--------|------------------|-------------------------|-------|
142
+ | [Feature 1] | [How article does it] | [How project does it] | [Difference] |
143
+ | [Feature 2] | [How article does it] | [How project does it] | [Difference] |
144
+
145
+ ### Commands/Patterns That Overlap
146
+
147
+ | Project Asset | Overlap | Notes |
148
+ |---------------|---------|-------|
149
+ | `/massu-*` command | [Which one] | [How it compares] |
150
+ | Pattern file | [Which one] | [How it compares] |
151
+ | Existing tool | [Which one] | [How it compares] |
152
+
153
+ ### What Project Does Better
154
+ - [Point 1]
155
+ - [Point 2]
156
+
157
+ ### What Article Approach Does Better
158
+ - [Point 1]
159
+ - [Point 2]
160
+
161
+ ### 5. Implementation Path (if score >= 40)
162
+
163
+ #### Phase 1: Assessment
164
+ - [ ] [Action items]
165
+
166
+ #### Phase 2: Trial (if applicable)
167
+ - [ ] [Action items]
168
+
169
+ #### Phase 3: Adoption (if applicable)
170
+ - [ ] [Action items]
171
+
172
+ ---
173
+
174
+ ## SOURCE CREDIBILITY
175
+
176
+ | Factor | Assessment |
177
+ |--------|------------|
178
+ | **Author** | [Expert/Practitioner/Unknown] |
179
+ | **Publication** | [Official/Major blog/Personal/Unknown] |
180
+ | **Date** | [Recent/Dated] |
181
+ | **Evidence** | [Metrics provided/Claims only] |
182
+ | **Community** | [Downloads/Stars/Activity] |
183
+
184
+ ---
185
+
186
+ ## REPORT FORMAT
187
+
188
+ The final report saved to file:
189
+
190
+ ```markdown
191
+ # Article Review: [Title]
192
+
193
+ **Source**: [URL]
194
+ **Author**: [Name]
195
+ **Reviewed**: [Date]
196
+ **Reviewer**: Claude (massu-article-review)
197
+
198
+ ---
199
+
200
+ ## Project Fit Score: XX/100 - [RATING]
201
+
202
+ | Component | Score | Notes |
203
+ |-----------|-------|-------|
204
+ | Problem Relevance | /25 | |
205
+ | Architecture Fit | /20 | |
206
+ | Pattern Compliance | /20 | |
207
+ | Implementation Effort | /15 | |
208
+ | Risk Level | /10 | |
209
+ | Maintenance Burden | /10 | |
210
+ | **TOTAL** | **XX/100** | |
211
+
212
+ **Recommendation**: ADOPT / TRIAL / ASSESS / HOLD / AVOID
213
+
214
+ ---
215
+
216
+ ## Executive Summary
217
+
218
+ [2-3 sentences]
219
+
220
+ ---
221
+
222
+ ## Key Points
223
+
224
+ 1. [Point]
225
+ 2. [Point]
226
+ ...
227
+
228
+ ---
229
+
230
+ ## Comparison to Current Project Approach
231
+
232
+ ### What This Article Proposes
233
+ [Summary]
234
+
235
+ ### How Project Currently Handles This
236
+ [Summary]
237
+
238
+ ### Gap Analysis
239
+ | Gap | Impact | Action |
240
+ |-----|--------|--------|
241
+ | [Gap] | [Impact] | [Action] |
242
+
243
+ ### Verdict
244
+ [Which approach is better and why]
245
+
246
+ ---
247
+
248
+ ## Benefits
249
+ - [Benefit 1]
250
+ - [Benefit 2]
251
+
252
+ ## Concerns/Risks
253
+ - [Concern 1]
254
+ - [Concern 2]
255
+
256
+ ---
257
+
258
+ ## Implementation Path
259
+
260
+ [If score >= 40, provide phased approach]
261
+
262
+ ---
263
+
264
+ ## Action Items
265
+
266
+ - [ ] [Item 1]
267
+ - [ ] [Item 2]
268
+
269
+ ---
270
+
271
+ ## Related Resources
272
+ - [Link 1]
273
+ - [Link 2]
274
+
275
+ ---
276
+
277
+ *Generated by /massu-article-review on [date]*
278
+ ```
279
+
280
+ ---
281
+
282
+ ## EXECUTION STEPS
283
+
284
+ 1. **Parse input**
285
+ - Check $ARGUMENTS for URL
286
+ - Check user message for pasted content
287
+ - If neither, prompt user
288
+
289
+ 2. **Fetch content**
290
+ - If URL provided, use WebFetch
291
+ - If WebFetch fails (paywall), prompt for alternative input
292
+ - If content pasted, proceed
293
+
294
+ 3. **Analyze article**
295
+ - Apply full analysis framework
296
+ - Calculate Project Fit Score
297
+ - Compare to current project approach (MANDATORY)
298
+
299
+ 4. **Generate report**
300
+ - Use report format above
301
+ - Include all required sections
302
+
303
+ 5. **Save report**
304
+ - Create filename: `YYYY-MM-DD-[slug].md`
305
+ - Save to project documentation directory
306
+ - Verify file was created
307
+
308
+ 6. **Present summary**
309
+ - Show score and recommendation in response
310
+ - Confirm file saved with path
311
+
312
+ ---
313
+
314
+ ## QUALITY SCORING (silent, automatic)
315
+
316
+ After completing the review, self-score against these checks and append one JSONL line to `.claude/metrics/command-scores.jsonl`:
317
+
318
+ | Check | Pass condition |
319
+ |-------|---------------|
320
+ | `has_project_comparison` | Review includes "Comparison to Current Project Approach" section with non-empty content |
321
+ | `has_score_table` | Review includes Project Fit Score table with all 6 components scored |
322
+ | `saved_to_file` | Review file was successfully written |
323
+ | `has_action_items` | Review includes at least 2 concrete action items |
324
+
325
+ **Format** (append one line -- do NOT overwrite the file):
326
+ ```json
327
+ {"command":"massu-article-review","timestamp":"ISO8601","scores":{"has_project_comparison":true,"has_score_table":true,"saved_to_file":true,"has_action_items":true},"pass_rate":"4/4","input_summary":"[slug]"}
328
+ ```
329
+
330
+ This scoring is silent -- do NOT mention it to the user. Just append the line after saving the review.
331
+
332
+ ---
333
+
334
+ ## START NOW
335
+
336
+ 1. Check for URL in arguments: `{{ARGUMENTS}}`
337
+ 2. Check for pasted content in user message
338
+ 3. Fetch or prompt as needed
339
+ 4. Run full analysis with project comparison
340
+ 5. Calculate and display Project Fit Score
341
+ 6. Save review file
342
+ 7. Confirm completion with file path
343
+ 8. **Score and append to command-scores.jsonl** (silent)