@massu/core 0.6.1 → 0.6.2

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 (28) hide show
  1. package/commands/_shared-preamble.md +14 -0
  2. package/commands/_shared-references/verification-table.md +0 -3
  3. package/commands/massu-ci-fix.md +2 -2
  4. package/commands/massu-gap-enhancement-analyzer.md +85 -345
  5. package/commands/massu-golden-path/references/approval-points.md +9 -12
  6. package/commands/massu-golden-path/references/competitive-mode.md +9 -7
  7. package/commands/massu-golden-path/references/error-handling.md +4 -2
  8. package/commands/massu-golden-path/references/phase-0-requirements.md +3 -3
  9. package/commands/massu-golden-path/references/phase-1-plan-creation.md +41 -52
  10. package/commands/massu-golden-path/references/phase-2-implementation.md +50 -157
  11. package/commands/massu-golden-path/references/phase-2.5-gap-analyzer.md +14 -48
  12. package/commands/massu-golden-path/references/phase-3-simplify.md +5 -5
  13. package/commands/massu-golden-path/references/phase-4-commit.md +20 -46
  14. package/commands/massu-golden-path/references/phase-5-push.md +14 -47
  15. package/commands/massu-golden-path/references/phase-6-completion.md +8 -58
  16. package/commands/massu-golden-path.md +27 -43
  17. package/commands/massu-loop/references/checkpoint-audit.md +14 -18
  18. package/commands/massu-loop/references/guardrails.md +3 -3
  19. package/commands/massu-loop/references/iteration-structure.md +46 -14
  20. package/commands/massu-loop/references/loop-controller.md +72 -63
  21. package/commands/massu-loop/references/plan-extraction.md +19 -11
  22. package/commands/massu-loop/references/vr-plan-spec.md +20 -28
  23. package/commands/massu-loop.md +36 -56
  24. package/commands/massu-review.md +2 -2
  25. package/dist/cli.js +0 -0
  26. package/package.json +1 -1
  27. package/README.md +0 -40
  28. package/commands/massu-golden-path/references/phase-3.5-security-audit.md +0 -108
@@ -1,13 +1,16 @@
1
1
  ---
2
2
  name: massu-loop
3
- description: "When user wants to implement a plan autonomously -- 'implement this plan', 'start the loop', 'execute', or provides a plan file to implement end-to-end"
4
- allowed-tools: Bash(*), Read(*), Write(*), Edit(*), Grep(*), Glob(*)
3
+ description: "When user wants to implement a plan autonomously 'implement this plan', 'start the loop', 'execute', or provides a plan file to implement end-to-end"
4
+ allowed-tools: Bash(*), Read(*), Write(*), Edit(*), Grep(*), Glob(*), Task(*)
5
5
  ---
6
+
7
+ > **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding.
8
+
6
9
  name: massu-loop
7
10
 
8
- # Massu Loop: Autonomous Execution Protocol
11
+ # CS Loop: Autonomous Execution Protocol
9
12
 
10
- **Shared rules**: Read `.claude/commands/_shared-preamble.md` before proceeding.
13
+ **Shared rules**: Read `.claude/commands/_shared-preamble.md` for POST-COMPACTION (CR-35), QUALITY STANDARDS (CR-14), FIX ALL ISSUES (CR-9) rules.
11
14
 
12
15
  ---
13
16
 
@@ -15,7 +18,7 @@ name: massu-loop
15
18
 
16
19
  ```
17
20
  /massu-create-plan -> /massu-plan -> /massu-loop -> [/massu-simplify] -> /massu-commit -> /massu-push
18
- (CREATE) (AUDIT) (IMPLEMENT) (QUALITY) (COMMIT) (PUSH)
21
+ (CREATE) (AUDIT) (IMPLEMENT) (QUALITY) (COMMIT) (PUSH)
19
22
  ```
20
23
 
21
24
  **This command is step 3 of 5 in the standard workflow. /massu-simplify is an optional quality step after implementation.**
@@ -40,43 +43,23 @@ This skill is a folder. The following files are available for reference:
40
43
 
41
44
  ## Gotchas
42
45
 
43
- - **Stagnating loops must bail (CR-37)** -- if the same item fails 3+ times with the same error, stop the loop, document the blocker, and replan. Grinding wastes context
44
- - **100% coverage required (CR-11)** -- never stop early. Every single plan item must be implemented and verified. "Most items done" is failure
45
- - **Backend without UI violates CR-12** -- if you implement a backend procedure, it MUST be called from the UI. Orphan procedures are invisible features
46
- - **Plan file must be re-read from disk (CR-5)** -- after ANY compaction or long pause, re-read the plan file. Memory of plan contents drifts
46
+ - **Stagnating loops must bail** -- if the same item fails 3+ times with the same error, stop the loop, document the blocker, and replan. Grinding wastes context
47
+ - **100% coverage required** -- never stop early. Every single plan item must be implemented and verified. "Most items done" is failure
48
+ - **New tools must be wired (CR-11)** -- if you implement a new MCP tool, it MUST be wired into tools.ts with the 3-function pattern. Unwired tools are invisible
49
+ - **Plan file must be re-read from disk** -- after ANY compaction or long pause, re-read the plan file. Memory of plan contents drifts
47
50
  - **Compaction risk** -- long loops may trigger context compaction; update `session-state/CURRENT.md` after each iteration so recovery can resume cleanly
48
51
 
49
52
  ---
50
53
 
51
- ## External Loop Mode
52
-
53
- For large plans or sessions at risk of context exhaustion, use the **external bash loop** to spawn fresh Claude CLI sessions per plan item:
54
-
55
- ```bash
56
- bash scripts/loop-external.sh --plan /path/to/plan.md [--max-iterations N] [--dry-run]
57
- ```
58
-
59
- Each iteration gets a clean 200K context window. The bash outer loop handles:
60
- - Plan item extraction and sequencing
61
- - State tracking in `.claude/loop-state/external-loop.json`
62
- - Inter-iteration quality gate (`pattern-scanner.sh`)
63
- - Hook profile propagation via `MASSU_HOOK_PROFILE`
64
-
65
- **When to use**: Plans with 15+ items, sessions already at high context usage, or when compaction risk is high.
66
-
67
- **Safety**: Does NOT use `--dangerously-skip-permissions`. Safety model is fully preserved.
68
-
69
- ---
70
-
71
54
  ## Objective
72
55
 
73
56
  Execute task/plan autonomously with **verified proof at every step**. Continue until ZERO gaps with VR-* evidence. Claims without proof are invalid.
74
57
 
75
58
  ---
76
59
 
77
- ## COMPLETION MANDATE (CR-11, CR-21)
60
+ ## COMPLETION MANDATE
78
61
 
79
- Loop does NOT stop until: (1) every plan item verified 100%, (2) every VR-* check passes with proof, (3) pattern scanner 0 violations, (4) build passes, (5) tsc --noEmit 0 errors, (6) ALL tests pass (npm test exit 0), (7) lint passes. Test failures must be fixed regardless of origin. No deferral, no "should I continue?", no partial progress reports.
62
+ Loop does NOT stop until: (1) every plan item verified 100%, (2) every VR-* check passes with proof, (3) pattern scanner 0 violations, (4) type check passes, (5) ALL tests pass (npm test exit 0), (6) hook build succeeds. Test failures must be fixed regardless of origin. No deferral, no "should I continue?", no partial progress reports. Register features with massu_sentinel (CR-11).
80
63
 
81
64
  ---
82
65
 
@@ -84,16 +67,14 @@ Loop does NOT stop until: (1) every plan item verified 100%, (2) every VR-* chec
84
67
 
85
68
  1. **Never claim without proof (CR-1)** - VR-* output must be pasted. "I verified" without output = invalid
86
69
  2. **Recursive audit until zero gaps** - Fix and re-verify until gaps = 0
87
- 3. **Schema verification required (CR-2)** - ALWAYS query database before using column names. See CLAUDE.md "Known Schema Mismatches"
88
- 4. **Session state after every iteration** - Update CURRENT.md so compaction recovery can resume (CR-12)
89
- 5. **Component reuse is mandatory** - Check existing before creating new
90
- 6. **User flow audit required (CR-12)** - Backend without UI = invisible feature. Technical audits alone are NOT sufficient
91
- 7. **Document new patterns immediately (CR-34)** - Ingest to memory, record pattern, update scanner
92
- 8. **Pattern scanner must pass** - `./scripts/pattern-scanner.sh` exit 0 required before claiming complete
93
- 9. **No workarounds allowed** - TODOs, ts-ignore are BLOCKING violations
94
- 10. **NO HARDCODED TAILWIND COLORS** - Use semantic CSS classes from globals.css (VR-TOKEN)
95
- 11. **FIX ALL ISSUES ENCOUNTERED (CR-9)** - Fix immediately regardless of origin. "Not in scope" is NEVER valid
96
- 12. **Stagnation bail-out (CR-37)** - If same item fails 3+ times with same error, stop loop and replan
70
+ 3. **Session state after every iteration** - Update CURRENT.md so compaction recovery can resume (CR-35)
71
+ 4. **Component reuse is mandatory** - Check existing modules before creating new
72
+ 5. **Tool wiring audit required (CR-11)** - New tools must be wired into tools.ts with 3-function pattern
73
+ 6. **Document new patterns immediately (CR-34)** - Ingest to memory, record pattern, update scanner
74
+ 7. **Pattern scanner must pass** - `bash scripts/massu-pattern-scanner.sh` exit 0 required before claiming complete
75
+ 8. **No workarounds allowed** - TODOs, ts-ignore are BLOCKING violations
76
+ 9. **FIX ALL ISSUES ENCOUNTERED (CR-9)** - Fix immediately regardless of origin. "Not in scope" is NEVER valid
77
+ 10. **Stagnation bail-out** - If same item fails 3+ times with same error, stop loop and replan
97
78
 
98
79
  ---
99
80
 
@@ -102,14 +83,14 @@ Loop does NOT stop until: (1) every plan item verified 100%, (2) every VR-* chec
102
83
  Before starting, verify:
103
84
 
104
85
  ```bash
105
- ls -la ./scripts/pattern-scanner.sh
86
+ ls -la ./scripts/massu-pattern-scanner.sh
106
87
  touch session-state/CURRENT.md
107
88
  ls -la [PLAN_FILE_PATH]
108
89
  ```
109
90
 
110
91
  Initialize session state:
111
92
  ```markdown
112
- ## MASSU LOOP SESSION
93
+ ## CS LOOP SESSION
113
94
  - **Task**: [description]
114
95
  - **Status**: IN_PROGRESS
115
96
  - **Iteration**: 1
@@ -118,7 +99,7 @@ Initialize session state:
118
99
 
119
100
  ---
120
101
 
121
- **VR-* Reference**: See CLAUDE.md VR table and `.claude/reference/vr-verification-reference.md`.
102
+ **VR-* Reference**: See CLAUDE.md VR table.
122
103
 
123
104
  ---
124
105
 
@@ -131,7 +112,7 @@ After completing the loop (zero gaps achieved), self-score against these checks
131
112
  | `all_items_verified_with_proof` | Every plan item has VR-* verification output showing proof |
132
113
  | `multi_perspective_review_spawned` | At least one auditor subagent was spawned for verification |
133
114
  | `gaps_reached_zero` | Final auditor pass returned `GAPS_DISCOVERED: 0` |
134
- | `memory_persisted` | AUTO-LEARNING PROTOCOL executed: at least one memory file update |
115
+ | `memory_persisted` | AUTO-LEARNING PROTOCOL executed: at least one `massu_memory_ingest` call or memory file update |
135
116
 
136
117
  **Format** (append one line -- do NOT overwrite the file):
137
118
  ```json
@@ -144,7 +125,7 @@ This scoring is silent -- do NOT mention it to the user. Just append the line af
144
125
 
145
126
  ## START NOW
146
127
 
147
- **Step 0: Write AUTHORIZED_COMMAND to session state (CR-12)**
128
+ **Step 0: Write AUTHORIZED_COMMAND to session state (CR-35)**
148
129
 
149
130
  Before any other work, update `session-state/CURRENT.md` to include:
150
131
  ```
@@ -156,8 +137,9 @@ This ensures that if the session compacts, the recovery protocol knows `/massu-l
156
137
 
157
138
  ### Phase 0: Pre-Implementation Memory Check
158
139
  0. **Search memory** for failed attempts and known issues related to the plan's domain:
159
- - Search memory for keywords from the plan
160
- - Search memory for file paths being modified
140
+ - Check `.claude/session-state/CURRENT.md` for recent failures
141
+ - Call `massu_memory_search` with file paths being modified
142
+ - Call `massu_memory_failures` with keywords from the plan
161
143
  - If matches found: read the previous failures and avoid repeating them
162
144
 
163
145
  ### Phase 1: Implement
@@ -167,15 +149,14 @@ This ensures that if the session compacts, the recovery protocol knows `/massu-l
167
149
  4. Update session state after each major step
168
150
 
169
151
  ### Phase 1.5: Multi-Perspective Review
170
- Spawn 3 focused review subagents IN PARALLEL (Principle #20):
152
+ Spawn focused review subagents IN PARALLEL (Principle #20):
171
153
  - **Security reviewer**: vulnerabilities, auth gaps, input validation, data exposure
172
154
  - **Architecture reviewer**: design issues, coupling, pattern compliance, scalability
173
- - **UX reviewer**: user experience, accessibility, loading/error/empty states, consistency
174
155
 
175
- Fix CRITICAL/HIGH findings before proceeding. WARN findings: document and proceed.
156
+ Fix ALL findings at ALL severity levels before proceeding (CR-45). CRITICAL, HIGH, MEDIUM, LOW — all get fixed. No severity is exempt.
176
157
 
177
158
  ### Phase 2: Verify (Subagent Loop)
178
- 5. Spawn `plan-auditor` subagent (via Task tool) for verification iteration 1
159
+ 5. Spawn `general-purpose` subagent (via Task tool) for verification iteration 1
179
160
  6. Parse `GAPS_DISCOVERED` from the subagent result (see [references/loop-controller.md](references/loop-controller.md))
180
161
  7. If gaps > 0: fix what the auditor identified, spawn another iteration
181
162
  8. If gaps == 0: output final completion report with dual gate evidence
@@ -189,7 +170,7 @@ See [references/auto-learning.md](references/auto-learning.md) for full protocol
189
170
 
190
171
  **The auditor subagent handles**: reading the plan, verifying all deliverables, checking patterns/build/types, fixing plan document gaps, and returning structured results.
191
172
 
192
- **You (the loop controller) handle**: implementation, spawning auditors, parsing results, fixing code-level gaps, looping, learning.
173
+ **You (the loop controller) handle**: implementation, spawning auditors, parsing results, fixing code-level gaps, looping, learning, and documentation.
193
174
 
194
175
  **Remember: Claims without proof are invalid. Show the verification output.**
195
176
 
@@ -199,16 +180,15 @@ See [references/auto-learning.md](references/auto-learning.md) for full protocol
199
180
 
200
181
  See [references/vr-plan-spec.md](references/vr-plan-spec.md) for full dual-gate verification and completion output format.
201
182
 
202
- Massu Loop is COMPLETE **only when BOTH gates pass: Code Quality AND Plan Coverage**.
183
+ CS Loop is COMPLETE **only when BOTH gates pass: Code Quality AND Plan Coverage**.
203
184
 
204
185
  ### GATE 1: Code Quality (All Must Pass)
205
186
  - [ ] Pattern scanner: Exit 0
206
187
  - [ ] Type check: 0 errors
207
188
  - [ ] Build: Exit 0
208
- - [ ] Lint: Exit 0
209
189
  - [ ] Tests: ALL PASS (MANDATORY)
190
+ - [ ] Hook build: Exit 0
210
191
  - [ ] Security: No secrets staged
211
- - [ ] VR-RENDER: All UI components rendered in pages
212
192
 
213
193
  ### GATE 2: Plan Coverage
214
194
  - [ ] Plan file read (actual file, not memory)
@@ -19,11 +19,11 @@ Perform a comprehensive code review across 7 dimensions: pattern compliance, sec
19
19
 
20
20
  ## NON-NEGOTIABLE RULES
21
21
 
22
- - Do NOT modify any files
23
- - Do NOT fix any issues found (report only)
22
+ - Do NOT modify any files (this is a report-only tool)
24
23
  - Review ALL changed files, not just a sample
25
24
  - Security findings are ALWAYS reported, even if minor
26
25
  - Output structured findings that can be acted on
26
+ - **ALL findings at ALL severity levels MUST be fixed by the caller (CR-45)** — this tool reports, the caller fixes. No severity is exempt. When used as part of a workflow (golden path, massu-loop, etc.), the parent command is responsible for fixing every finding before proceeding
27
27
 
28
28
  ---
29
29
 
package/dist/cli.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massu/core",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "description": "AI Engineering Governance MCP Server - Session memory, knowledge system, feature registry, code intelligence, rule enforcement, tiered tooling (12 free / 72 total), 55+ workflow commands, 11 agents, 20+ patterns",
6
6
  "main": "src/server.ts",
package/README.md DELETED
@@ -1,40 +0,0 @@
1
- # @massu/core
2
-
3
- AI Engineering Governance MCP Server — session memory, feature registry, code intelligence, and rule enforcement for AI coding assistants.
4
-
5
- ## Quick Start
6
-
7
- ```bash
8
- npx massu init
9
- ```
10
-
11
- This sets up the MCP server, configuration, and lifecycle hooks in one command.
12
-
13
- ## What is Massu?
14
-
15
- Massu is a source-available [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that adds governance capabilities to AI coding assistants like Claude Code. It provides:
16
-
17
- - **51 MCP Tools** — quality analytics, cost tracking, security scoring, dependency analysis, and more
18
- - **11 Lifecycle Hooks** — pre-commit gates, security scanning, intent suggestion, and session management
19
- - **3-Database Architecture** — code graph (read-only), data (imports/mappings), and memory (sessions/analytics)
20
- - **Config-Driven** — all project-specific data lives in `massu.config.yaml`
21
-
22
- ## Usage
23
-
24
- After `npx massu init`, your AI assistant gains access to all governance tools automatically via the MCP protocol.
25
-
26
- ```bash
27
- # Health check
28
- npx massu doctor
29
-
30
- # Validate configuration
31
- npx massu validate-config
32
- ```
33
-
34
- ## Documentation
35
-
36
- Full documentation at [massu.ai](https://massu.ai).
37
-
38
- ## License
39
-
40
- [BSL 1.1](https://github.com/massu-ai/massu/blob/main/LICENSE) — source-available. Free to use, modify, and distribute. See LICENSE for full terms.
@@ -1,108 +0,0 @@
1
- # Phase 3.5: Deep Security Audit
2
-
3
- > Reference doc for `/massu-golden-path`. Return to main file for overview.
4
-
5
- ```
6
- [GOLDEN PATH -- PHASE 3.5: DEEP SECURITY AUDIT]
7
- ```
8
-
9
- ## Purpose
10
-
11
- Run a full adversarial security audit loop against ALL files changed in this golden path run. This is a deep, iterative audit with parallel red-team agents that converges to zero findings. It runs AFTER simplification (Phase 3) so the audit targets the final, cleaned-up code -- and BEFORE pre-commit verification (Phase 4) so all security fixes are included in the verification gates.
12
-
13
- **This phase is NEVER skipped.** Security is non-negotiable regardless of change size, type, or scope.
14
-
15
- ---
16
-
17
- ## 3.5.1 Determine Audit Scope
18
-
19
- Collect ALL files changed during this golden path run:
20
-
21
- ```bash
22
- git diff --name-only HEAD
23
- ```
24
-
25
- If files were already committed in earlier phases, also include:
26
- ```bash
27
- git diff --name-only main...HEAD
28
- ```
29
-
30
- The audit scope is the union of all changed files. Do NOT narrow scope -- every changed file gets audited.
31
-
32
- **Output:**
33
- ```
34
- SECURITY AUDIT SCOPE:
35
- Files: [N]
36
- [list of files]
37
- ```
38
-
39
- ---
40
-
41
- ## 3.5.2 Execute Deep Security Audit
42
-
43
- Run the full security audit protocol against the scoped files:
44
-
45
- 1. **Launch 2-4 parallel adversarial reviewer agents** adapted to the codebase area:
46
- - Backend/API code: 4 agents (Injection, Network/Leakage, DoS/Resources, Red Team Bypass)
47
- - Frontend code: 3 agents (XSS/Injection, Auth/Data Exposure, Input Validation/Logic)
48
- - Infrastructure/config: 2 agents (Secrets/Config, Dependencies/Supply Chain)
49
-
50
- 2. **Consolidate findings** -- deduplicate across agents, take higher severity on disagreements
51
-
52
- 3. **Fix ALL findings** -- CRITICAL first, then HIGH, MEDIUM, LOW. INFO documented only.
53
-
54
- 4. **Verify fixes** -- import checks, input validation tests, functionality preserved
55
-
56
- 5. **Loop until zero findings** -- max 5 iterations, escalate to user if still failing after 5
57
-
58
- ---
59
-
60
- ## 3.5.3 Attack Vector Coverage
61
-
62
- Every audit iteration MUST verify the complete attack vector checklist:
63
-
64
- ### Universal
65
- - Hardcoded secrets / API keys / credentials
66
- - Error messages leaking internal details
67
- - Dependency vulnerabilities
68
- - Input validation on ALL external boundaries
69
-
70
- ### Backend / API
71
- - SQL injection, command injection, path traversal
72
- - SSRF, authentication bypass, authorization bypass
73
- - DoS via unbounded inputs, memory leaks, race conditions
74
- - Response validation, type confusion
75
-
76
- ### Frontend
77
- - XSS, open redirects, sensitive data in client state
78
- - CSRF, client-side auth bypass
79
-
80
- ### LLM / AI Specific
81
- - Prompt injection, model output trust
82
- - Tool argument injection, vision/multimodal injection
83
-
84
- ---
85
-
86
- ## 3.5.4 Completion Gate
87
-
88
- The phase completes ONLY when the audit loop achieves a clean pass with zero findings.
89
-
90
- ```
91
- SECURITY_AUDIT_GATE: PASS
92
- Iterations: [N]
93
- Total findings fixed: [N]
94
- Breakdown: [X] CRITICAL, [X] HIGH, [X] MEDIUM, [X] LOW fixed
95
- Clean pass: Iteration [N]
96
- ```
97
-
98
- **Do NOT proceed to Phase 4 until SECURITY_AUDIT_GATE = PASS.**
99
-
100
- ---
101
-
102
- ## Rules
103
-
104
- 1. **NEVER skip this phase** -- not for small changes, not for docs, not for config
105
- 2. **NEVER proceed with findings unfixed** -- zero means zero
106
- 3. **ALL severity levels get fixed** -- CRITICAL through LOW
107
- 4. **No commit prompt** -- unlike standalone security audit commands, do NOT offer to commit here (Phase 4 handles commits)
108
- 5. **Findings feed Phase 4** -- security fixes are verified by Phase 4's type check, build, lint, and secrets gates automatically