maxsimcli 4.0.0 → 4.0.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.
@@ -1,118 +1,79 @@
1
1
  ---
2
2
  name: sdd
3
- description: Dispatch fresh subagent per task with 2-stage review between tasks
3
+ description: >-
4
+ Executes plan tasks sequentially, each in a fresh subagent with minimal context,
5
+ with mandatory two-stage review between tasks. Use when executing sequential
6
+ tasks where context rot is a concern or running spec-driven dispatch.
4
7
  ---
5
8
 
6
9
  # Spec-Driven Dispatch (SDD)
7
10
 
8
11
  Execute tasks sequentially, each in a fresh subagent with clean context. Review every task before moving to the next.
9
12
 
10
- **If the previous task did not pass review, you do not start the next task.**
11
-
12
- ## When to Use
13
-
14
- - Tasks are sequential and each builds on the previous
15
- - Context rot is a concern (long plans, many files, complex logic)
16
- - Each task benefits from starting with a clean context window
17
- - You want enforced quality gates between tasks
18
-
19
- Do NOT use this skill when:
20
- - Tasks are independent and can run in parallel (use batch-worktree instead)
21
- - The plan has only 1-2 small tasks (overhead is not worth it)
22
- - All tasks modify the same small set of files (single-agent execution is simpler)
23
-
24
- ## The Iron Law
25
-
26
- <HARD-GATE>
27
- NO TASK STARTS UNTIL THE PREVIOUS TASK PASSES 2-STAGE REVIEW.
28
- If the review found issues, they must be fixed before the next task begins.
29
- No "we'll fix it later." No "it's close enough." No skipping review for simple tasks.
30
- Violating this rule ships unreviewed code — the exact problem SDD prevents.
31
- </HARD-GATE>
13
+ **HARD GATE** -- No task starts until the previous task passes two-stage review. If the review found issues, they must be fixed before the next task begins. No exceptions, no deferral, no skipping review for simple tasks.
32
14
 
33
15
  ## Process
34
16
 
35
- ### 1. LOAD Read the Plan
17
+ ### 1. LOAD -- Read the Plan
36
18
 
37
19
  - Read the plan file (PLAN.md) to get the ordered task list
38
20
  - For each task, identify: description, acceptance criteria, relevant files
39
21
  - Confirm task order makes sense (later tasks may depend on earlier ones)
40
22
 
41
- ```bash
42
- # Load plan context
43
- INIT=$(node .claude/maxsim/bin/maxsim-tools.cjs init execute-phase "${PHASE}")
44
- ```
45
-
46
- ### 2. DISPATCH — Spawn Fresh Agent Per Task
23
+ ### 2. DISPATCH -- Spawn Fresh Agent Per Task
47
24
 
48
25
  For each task in order:
49
26
 
50
27
  1. Assemble the task context:
51
28
  - Task description and acceptance criteria from the plan
52
29
  - Only the files relevant to this specific task
53
- - Results from previous tasks (commit hashes, created files) NOT the full previous context
54
- 2. Spawn a fresh `general-purpose` agent with this minimal context
30
+ - Results from previous tasks (commit hashes, created files) -- NOT the full previous context
31
+ 2. Spawn a fresh agent with this minimal context
55
32
  3. The agent implements the task, runs tests, and commits
56
33
 
57
- ```bash
58
- # Record task dispatch
59
- node .claude/maxsim/bin/maxsim-tools.cjs state-add-decision "SDD: dispatching task N — [description]"
60
- ```
61
-
62
- ### 3. REVIEW — 2-Stage Quality Gate
34
+ ### 3. REVIEW -- Two-Stage Quality Gate
63
35
 
64
36
  After each task completes, run two review stages before proceeding:
65
37
 
66
- #### Stage 1: Spec Compliance
38
+ **Stage 1: Spec Compliance**
67
39
 
68
40
  - Does the implementation match the task description?
69
41
  - Are all acceptance criteria met?
70
42
  - Were only the specified files modified (no scope creep)?
71
43
  - Do the changes align with the plan's intent?
72
44
 
73
- **Verdict:** PASS or FAIL with specific issues.
45
+ Verdict: PASS or FAIL with specific issues.
74
46
 
75
- #### Stage 2: Code Quality
47
+ **Stage 2: Code Quality**
76
48
 
77
49
  - Are there obvious bugs, edge cases, or error handling gaps?
78
50
  - Is the code readable and consistent with codebase conventions?
79
51
  - Are there unnecessary complications or dead code?
80
52
  - Do all tests pass?
81
53
 
82
- ```bash
83
- # Run tests to verify
84
- npx vitest run
85
- ```
86
-
87
- **Verdict:** PASS or FAIL with specific issues.
54
+ Verdict: PASS or FAIL with specific issues.
88
55
 
89
- ### 4. FIX Address Review Failures
56
+ ### 4. FIX -- Address Review Failures
90
57
 
91
58
  If either review stage fails:
92
59
 
93
- 1. Spawn a NEW fresh agent with:
94
- - The original task description
95
- - The review feedback (specific issues found)
96
- - The current state of the files
97
- 2. The fix agent addresses ONLY the review issues — no new features
60
+ 1. Spawn a NEW fresh agent with the original task description, the review feedback, and the current file state
61
+ 2. The fix agent addresses ONLY the review issues -- no new features
98
62
  3. Re-run both review stages on the fixed code
99
63
  4. If 3 fix attempts fail: STOP and escalate to the user
100
64
 
101
- ### 5. ADVANCE Move to Next Task
65
+ ### 5. ADVANCE -- Move to Next Task
102
66
 
103
67
  Only after both review stages pass:
68
+
104
69
  - Record the task as complete
105
- - Note the commit hash and any files created/modified
70
+ - Note the commit hash and any files created or modified
106
71
  - Pass this minimal summary (not full context) to the next task's agent
107
72
 
108
- ```bash
109
- # Record task completion
110
- node .claude/maxsim/bin/maxsim-tools.cjs state-add-decision "SDD: task N complete — [summary]"
111
- ```
112
-
113
- ### 6. REPORT — Final Summary
73
+ ### 6. REPORT -- Final Summary
114
74
 
115
75
  After all tasks complete:
76
+
116
77
  - List each task with its status and commit hash
117
78
  - Note any tasks that required fix iterations
118
79
  - Summarize the total changes made
@@ -122,38 +83,27 @@ After all tasks complete:
122
83
  Each agent receives ONLY what it needs:
123
84
 
124
85
  | Context Item | Included? |
125
- |-------------|-----------|
86
+ |---|---|
126
87
  | Task description + acceptance criteria | Always |
127
88
  | Files relevant to this task | Always |
128
89
  | Previous task commit hashes | Always |
129
90
  | Previous task full diff | Never |
130
91
  | Previous task agent conversation | Never |
131
92
  | PROJECT.md / REQUIREMENTS.md | Only if task references project-level concerns |
132
- | Full codebase | Never only specified files |
133
-
134
- **The point of SDD is fresh context. Loading the previous agent's full context defeats the purpose.**
93
+ | Full codebase | Never -- only specified files |
135
94
 
136
- ## Common Rationalizations REJECT THESE
95
+ The point of SDD is fresh context. Loading the previous agent's full context defeats the purpose.
137
96
 
138
- | Excuse | Why It Violates the Rule |
139
- |--------|--------------------------|
140
- | "This task is simple, skip review" | Simple tasks still have bugs. Review takes seconds for simple code. |
141
- | "Review is slowing us down" | Unreviewed code slows you down more when bugs compound across tasks. |
142
- | "Just pass the full context forward" | Full context = context rot. Minimal summaries keep agents effective. |
143
- | "Fix it in the next task" | The next task's agent does not know about the bug. Fix it now. |
144
- | "The agent knows best, trust it" | Agents make mistakes. That is why review exists. |
97
+ ## Common Pitfalls
145
98
 
146
- ## Red Flags STOP If You Catch Yourself:
99
+ | Pitfall | Why it matters |
100
+ |---|---|
101
+ | Skipping review for simple tasks | Simple tasks still have bugs. Review takes seconds for simple code. |
102
+ | Passing full context forward | Full context causes context rot. Minimal summaries keep agents effective. |
103
+ | Deferring fixes to the next task | The next task's agent does not know about the bug. Fix it now. |
104
+ | Accumulating fix-later items across tasks | Each task must be clean before the next starts. |
147
105
 
148
- - Starting a new task before the previous one passed review
149
- - Passing full conversation history to the next agent
150
- - Skipping Stage 1 or Stage 2 of the review
151
- - Accumulating "fix later" items across tasks
152
- - On the 3rd fix attempt for the same review issue (escalate to user)
153
-
154
- **If any red flag triggers: STOP. Complete the review cycle for the current task before proceeding.**
155
-
156
- ## Verification Checklist
106
+ ## Verification
157
107
 
158
108
  Before reporting completion, confirm:
159
109
 
@@ -164,12 +114,13 @@ Before reporting completion, confirm:
164
114
  - [ ] All tests pass after the final task
165
115
  - [ ] Summary includes per-task status and commit hashes
166
116
 
167
- ## In MAXSIM Plan Execution
117
+ ## MAXSIM Integration
168
118
 
169
119
  When a plan specifies `skill: "sdd"`:
120
+
170
121
  - The orchestrator reads tasks from PLAN.md in order
171
122
  - Each task is dispatched to a fresh subagent
172
- - 2-stage review runs between every task
123
+ - Two-stage review runs between every task
173
124
  - Failed reviews trigger fix agents (up to 3 attempts)
174
125
  - Progress is tracked in STATE.md via decision entries
175
126
  - Final results are recorded in SUMMARY.md
@@ -1,185 +1,142 @@
1
1
  ---
2
2
  name: simplify
3
- description: Use after implementation and before commit — requires reviewing changed code for reuse opportunities, quality issues, and unnecessary complexity
3
+ description: >-
4
+ Reviews changed code for reuse opportunities, unnecessary complexity, and
5
+ dead weight using three parallel review agents. Use when reviewing code
6
+ before committing, cleaning up implementations, or preparing changes for
7
+ review.
4
8
  ---
5
9
 
6
10
  # Simplify
7
11
 
8
- Every line of code is a liability. Less code that does the same thing is always better.
12
+ Every line of code is a liability. Remove what does not earn its place.
9
13
 
10
- **If you have not looked for ways to simplify, you are shipping the first draft.**
14
+ **HARD GATE**: No code ships without a simplification pass. If you have not checked for duplication, dead code, and unnecessary complexity, the change is not ready. "It works" is the starting point, not the finish line.
11
15
 
12
- ## The Iron Law
16
+ ## When to Use
13
17
 
14
- <HARD-GATE>
15
- NO COMMIT WITHOUT REVIEWING FOR SIMPLIFICATION.
16
- If you have not checked for duplication, dead code, and unnecessary complexity, you CANNOT commit.
17
- "It works" is the starting point, not the finish line.
18
- Violating this rule is a violation — not a preference.
19
- </HARD-GATE>
18
+ - After implementing a feature or fix, before committing
19
+ - When preparing changes for code review
20
+ - When cleaning up code that has grown organically over multiple iterations
21
+ - When onboarding to a file and noticing accumulated complexity
20
22
 
21
- ## The Gate Function
23
+ Do NOT use this skill when:
24
+ - Making a hotfix where speed matters more than polish (file a follow-up instead)
25
+ - The changes are purely mechanical (renames, formatting, dependency bumps)
22
26
 
23
- After implementation is complete and tests pass, BEFORE committing:
27
+ ## Process
24
28
 
25
- ### 1. DIFF — Review What Changed
29
+ ### 1. DIFF — Identify What Changed
26
30
 
27
- - Run `git diff --staged` (or `git diff` for unstaged changes)
28
- - Read every line you are about to commit
29
- - Flag anything that feels "off" trust that instinct
31
+ - Collect the set of modified and added files
32
+ - Read each file in full, not just the changed hunks
33
+ - Note files that interact with the changes (callers, consumers, shared modules)
30
34
 
31
- ```bash
32
- # Review staged changes
33
- git diff --staged
34
- # Or all uncommitted changes
35
- git diff
36
- ```
35
+ ### 2. DUPLICATION — Eliminate Repeated Logic
37
36
 
38
- ### 2. DUPLICATION Find Reuse Opportunities
37
+ - Are there patterns repeated across files that should be a shared helper?
38
+ - Does new code duplicate existing utilities or library functions?
39
+ - Could two similar implementations be merged behind a single interface?
40
+ - Is there copy-paste that should be refactored?
39
41
 
40
- - Does any new code duplicate existing logic in the codebase?
41
- - Are there two or more blocks that do similar things and could share a helper?
42
- - Could an existing utility, library function, or helper replace new code?
43
- - Is there copy-paste from another file that should be extracted?
42
+ **Rule of three**: If the same pattern appears three times, extract it.
44
43
 
45
- **Rule of three:** If the same pattern appears three times, extract it. Two occurrences are acceptable.
44
+ ### 3. DEAD CODE Remove What Is Not Called
46
45
 
47
- ### 3. DEAD CODE Remove What Is Not Used
48
-
49
- - Are there unused imports, variables, or functions?
50
- - Are there commented-out code blocks? (Delete them git has history)
51
- - Are there unreachable branches or impossible conditions?
52
- - Are there parameters that are always passed the same value?
53
-
54
- **If it is not called, it does not belong. Delete it.**
46
+ - Delete unused imports, variables, functions, and parameters
47
+ - Remove commented-out code blocks (version control is the archive)
48
+ - Strip unreachable branches and impossible conditions
49
+ - Drop feature flags and configuration for features that no longer exist
55
50
 
56
51
  ### 4. COMPLEXITY — Question Every Abstraction
57
52
 
58
- - Is there a wrapper that adds no value beyond indirection?
59
- - Is there a generic solution where a specific one would be simpler?
60
- - Are there feature flags, configuration options, or extension points for hypothetical future needs?
61
- - Could a 3-line inline block replace a 20-line abstraction?
53
+ - Does every wrapper, adapter, or indirection layer justify its existence?
54
+ - Are there generics or parametrization that serve only one concrete case?
55
+ - Could a 20-line class be replaced by a 3-line function?
56
+ - Is there defensive programming that guards against conditions that cannot occur?
62
57
 
63
- **The right amount of abstraction is the minimum needed for the current requirements.**
58
+ **If removing it does not break anything, it should not be there.**
64
59
 
65
- ### 5. CLARITY — Improve Readability
60
+ ### 5. CLARITY — Tighten Naming and Structure
66
61
 
67
- - Are variable and function names self-explanatory?
68
- - Could a confusing block be rewritten more clearly without comments?
69
- - Are there nested conditions that could be flattened with early returns?
70
- - Is the control flow straightforward or unnecessarily clever?
62
+ - Are names self-documenting? Rename anything that needs a comment to explain.
63
+ - Could nested logic be flattened with early returns?
64
+ - Is control flow straightforward, or does it require tracing to understand?
65
+ - Are there layers of indirection that obscure the data path?
71
66
 
72
- ### 6. EFFICIENCYCheck for Obvious Issues
67
+ ### 6. REVIEWFinal Sanity Check
73
68
 
74
- - Are there O(n^2) operations where O(n) is straightforward?
75
- - Are there repeated computations that could be cached or hoisted?
76
- - Are there unnecessary allocations in hot paths?
77
- - Is data being transformed multiple times when once would suffice?
69
+ - Re-read the simplified code end to end
70
+ - Confirm all tests still pass
71
+ - Verify no behavioral changes were introduced (simplify, do not alter)
78
72
 
79
- **Only fix efficiency issues that are obvious. Do not optimize without evidence of a problem.**
73
+ ## Parallel 3-Reviewer Pattern
80
74
 
81
- ## Review Checklist
75
+ When invoked as part of the execute-phase cycle, simplification runs as three parallel review agents, each focused on one dimension.
82
76
 
83
- | Category | Question | Action if Yes |
84
- |----------|----------|---------------|
85
- | Duplication | Same logic exists elsewhere? | Extract shared helper or reuse existing |
86
- | Duplication | Copy-paste from another file? | Extract to shared module |
87
- | Dead code | Unused imports or variables? | Delete them |
88
- | Dead code | Commented-out code? | Delete it (git has history) |
89
- | Complexity | Abstraction for one call site? | Inline it |
90
- | Complexity | Generic where specific suffices? | Simplify to specific |
91
- | Complexity | Config for hypothetical needs? | Remove until needed |
92
- | Clarity | Confusing variable name? | Rename to describe purpose |
93
- | Clarity | Deep nesting? | Flatten with early returns |
94
- | Efficiency | O(n^2) with obvious O(n) fix? | Fix it now |
95
- | Efficiency | Same computation in a loop? | Hoist outside the loop |
77
+ ### Reviewer 1: Code Reuse
96
78
 
97
- ## Common Rationalizations REJECT THESE
79
+ - Scan all changed files for duplicated patterns
80
+ - Cross-reference against existing shared utilities and helpers
81
+ - Flag any logic that appears three or more times without extraction
82
+ - **Output**: List of reuse opportunities with file paths and line ranges
98
83
 
99
- | Excuse | Why It Violates the Rule |
100
- |--------|--------------------------|
101
- | "It works, don't touch it" | Working is the minimum bar. Simplify before it becomes legacy. |
102
- | "We might need the flexibility later" | YAGNI. Add flexibility when you need it, not before. |
103
- | "Refactoring is risky" | Small simplifications with passing tests are safe. Large refactors are a separate task. |
104
- | "The duplication is minor" | Minor duplication compounds. Three occurrences is the threshold, not six. |
105
- | "I'll clean it up in a follow-up" | Follow-ups rarely happen. Simplify now while context is fresh. |
106
- | "It's just a few extra lines" | Every unnecessary line is maintenance cost. Delete it. |
84
+ ### Reviewer 2: Code Quality
107
85
 
108
- ## Red Flags STOP If You Catch Yourself:
86
+ - Check for dead code: unused imports, unreachable branches, commented blocks
87
+ - Verify naming consistency with codebase conventions
88
+ - Flag unnecessary abstractions, wrappers, and indirection
89
+ - **Output**: List of quality issues categorized by severity
109
90
 
110
- - Committing without reading your own diff
111
- - Keeping dead code "just in case"
112
- - Adding a utility class for a single use case
113
- - Building configuration for features no one has requested
114
- - Writing a comment to explain code that could be rewritten to be self-evident
115
- - Skipping simplification because "it's good enough"
91
+ ### Reviewer 3: Efficiency
116
92
 
117
- **If any red flag triggers: STOP. Review the diff again. Simplify before committing.**
93
+ - Identify over-engineered solutions (parametrization serving one case, generic interfaces with one implementor)
94
+ - Flag defensive programming that guards impossible conditions
95
+ - Check for configuration and feature flags that serve no current purpose
96
+ - **Output**: List of efficiency issues with suggested removals
118
97
 
119
- ## Verification Checklist
98
+ ### Consolidation
120
99
 
121
- Before committing, confirm:
100
+ After all three reviewers complete:
101
+ 1. Merge findings into a deduplicated list
102
+ 2. Apply fixes for all actionable items (BLOCKER and HIGH priority first)
103
+ 3. Re-run tests to confirm nothing broke
104
+ 4. Report status: CLEAN (nothing found), FIXED (issues resolved), or BLOCKED (cannot simplify without architectural changes)
122
105
 
123
- - [ ] All staged changes have been reviewed line by line
124
- - [ ] No duplication with existing codebase logic (or duplication is below threshold)
125
- - [ ] No dead code: unused imports, variables, unreachable branches, commented code
126
- - [ ] No unnecessary abstractions, wrappers, or premature generalizations
127
- - [ ] Naming is clear and consistent with codebase conventions
128
- - [ ] No obvious efficiency issues (unnecessary O(n^2), repeated computations)
129
- - [ ] Tests still pass after simplification changes
106
+ ## Common Rationalizations REJECT THESE
130
107
 
131
- ## In MAXSIM Plan Execution
108
+ | Excuse | Why It Violates the Rule |
109
+ |--------|--------------------------|
110
+ | "It might be needed later" | Delete it. Re-adding is cheaper than maintaining unused code. |
111
+ | "The abstraction makes it extensible" | Extensibility that serves no current requirement is dead weight. |
112
+ | "Refactoring is risky" | Small, tested simplifications reduce risk. Accumulated complexity increases it. |
113
+ | "I'll clean it up later" | Later never comes. Simplify now while context is fresh. |
132
114
 
133
- Simplification applies at the task level, after implementation and before commit:
134
- - After task implementation is complete and tests pass, run this review
135
- - Make simplification changes as part of the same commit (not a separate task)
136
- - If simplification reveals a larger refactoring opportunity, file a todo — do not scope-creep
137
- - Track significant simplifications in the task's commit message (e.g., "extracted shared helper for X")
115
+ ## Red Flags STOP If You Catch Yourself:
138
116
 
139
- ## Parallel 3-Reviewer Pattern (Execution Pipeline)
117
+ - Skipping the simplification pass because the diff is small
118
+ - Keeping dead code "just in case"
119
+ - Adding complexity during a simplification pass
120
+ - Merging without having read the full file (not just changed lines)
140
121
 
141
- When invoked as part of the Execute-Review-Simplify-Review cycle in `execute-plan.md`, simplification runs as 3 parallel review agents. Each reviewer focuses on one dimension:
122
+ **If any red flag triggers: STOP. Complete the simplification cycle before proceeding.**
142
123
 
143
- ### Reviewer 1: Code Reuse
144
- - Find duplicated logic across the codebase (not just within changed files)
145
- - Identify copy-paste from other files that should be extracted to shared modules
146
- - Suggest shared helpers for patterns appearing 3+ times (Rule of Three)
147
- - Check if existing utility functions, library methods, or helpers could replace new code
148
- - **Output:** List of reuse opportunities with file paths and line ranges
124
+ ## Verification Checklist
149
125
 
150
- ### Reviewer 2: Code Quality
151
- - Check naming consistency with codebase conventions (read CLAUDE.md first)
152
- - Verify error handling covers all external calls and edge cases
153
- - Look for dead code: unused imports, variables, unreachable branches, commented-out code
154
- - Check for unnecessary abstractions, wrappers, or premature generalizations
155
- - Verify security: no hardcoded secrets, no unsanitized inputs, no data exposure
156
- - **Output:** List of quality issues categorized by severity (BLOCKER, HIGH, MEDIUM)
126
+ Before reporting completion, confirm:
157
127
 
158
- ### Reviewer 3: Efficiency
159
- - Find O(n^2) operations where O(n) is straightforward
160
- - Identify repeated computations that could be cached or hoisted out of loops
161
- - Check for unnecessary allocations in hot paths
162
- - Look for redundant data transformations (data processed multiple times when once suffices)
163
- - Only flag obvious issues do not optimize without evidence of a problem
164
- - **Output:** List of efficiency issues with suggested fixes
128
+ - [ ] All changed files were reviewed in full (not just diffs)
129
+ - [ ] No duplicated logic remains that appears three or more times
130
+ - [ ] No dead code: unused imports, commented blocks, unreachable branches
131
+ - [ ] No unnecessary abstractions, wrappers, or indirection layers
132
+ - [ ] All tests pass after simplification
133
+ - [ ] No behavioral changes were introduced (simplify only, do not alter)
165
134
 
166
- ### Consolidation
135
+ ## MAXSIM Integration
167
136
 
168
- After all 3 reviewers report, the orchestrating agent:
169
- 1. Merges findings into a single deduplicated list
170
- 2. Prioritizes: BLOCKER > HIGH > MEDIUM > informational
171
- 3. Applies fixes for all actionable items (BLOCKER and HIGH)
172
- 4. Files MEDIUM issues as todos if they require larger refactoring
173
- 5. Runs tests to confirm fixes do not break anything
174
- 6. Reports final status: CLEAN (nothing found), FIXED (issues found and resolved), or BLOCKED (cannot fix without architectural change)
175
-
176
- ### Spawning Pattern
177
-
178
- Each reviewer is spawned as a parallel agent via the Agent tool:
179
- ```
180
- # All 3 run in parallel
181
- Task(prompt="Reviewer 1: Code Reuse — {files_to_review} ...", subagent_type="maxsim-executor")
182
- Task(prompt="Reviewer 2: Code Quality — {files_to_review} ...", subagent_type="maxsim-executor")
183
- Task(prompt="Reviewer 3: Efficiency — {files_to_review} ...", subagent_type="maxsim-executor")
184
- # Wait for all 3 to complete, then consolidate
185
- ```
137
+ When a plan specifies `skill: "simplify"`:
138
+ - The orchestrator collects changed files from the implementation step
139
+ - Three parallel reviewers (Reuse, Quality, Efficiency) are spawned
140
+ - Findings are consolidated and fixes applied
141
+ - Progress is tracked in STATE.md via decision entries
142
+ - Final results are recorded in SUMMARY.md