maxsimcli 5.0.6 → 5.1.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 (91) hide show
  1. package/README.md +316 -288
  2. package/dist/assets/CHANGELOG.md +14 -0
  3. package/dist/assets/hooks/maxsim-capture-learnings.cjs +128 -0
  4. package/dist/assets/hooks/maxsim-capture-learnings.cjs.map +1 -0
  5. package/dist/assets/hooks/maxsim-check-update.cjs +126 -88
  6. package/dist/assets/hooks/maxsim-check-update.cjs.map +1 -1
  7. package/dist/assets/hooks/maxsim-notification-sound.cjs +87 -43
  8. package/dist/assets/hooks/maxsim-notification-sound.cjs.map +1 -1
  9. package/dist/assets/hooks/maxsim-statusline.cjs +45 -171
  10. package/dist/assets/hooks/maxsim-statusline.cjs.map +1 -1
  11. package/dist/assets/hooks/maxsim-stop-sound.cjs +86 -43
  12. package/dist/assets/hooks/maxsim-stop-sound.cjs.map +1 -1
  13. package/dist/assets/hooks/maxsim-sync-reminder.cjs +72 -21
  14. package/dist/assets/hooks/maxsim-sync-reminder.cjs.map +1 -1
  15. package/dist/assets/templates/agents/AGENTS.md +62 -51
  16. package/dist/assets/templates/agents/executor.md +44 -59
  17. package/dist/assets/templates/agents/planner.md +36 -31
  18. package/dist/assets/templates/agents/researcher.md +35 -43
  19. package/dist/assets/templates/agents/verifier.md +29 -31
  20. package/dist/assets/templates/commands/maxsim/debug.md +20 -154
  21. package/dist/assets/templates/commands/maxsim/execute.md +19 -33
  22. package/dist/assets/templates/commands/maxsim/go.md +21 -20
  23. package/dist/assets/templates/commands/maxsim/help.md +5 -14
  24. package/dist/assets/templates/commands/maxsim/init.md +18 -40
  25. package/dist/assets/templates/commands/maxsim/plan.md +22 -37
  26. package/dist/assets/templates/commands/maxsim/progress.md +15 -16
  27. package/dist/assets/templates/commands/maxsim/quick.md +18 -29
  28. package/dist/assets/templates/commands/maxsim/settings.md +18 -26
  29. package/dist/assets/templates/references/continuation-format.md +2 -4
  30. package/dist/assets/templates/references/model-profiles.md +2 -2
  31. package/dist/assets/templates/references/planning-config.md +10 -11
  32. package/dist/assets/templates/references/self-improvement.md +120 -0
  33. package/dist/assets/templates/rules/conventions.md +1 -1
  34. package/dist/assets/templates/rules/verification-protocol.md +1 -1
  35. package/dist/assets/templates/skills/brainstorming/SKILL.md +35 -26
  36. package/dist/assets/templates/skills/code-review/SKILL.md +78 -55
  37. package/dist/assets/templates/skills/commit-conventions/SKILL.md +70 -36
  38. package/dist/assets/templates/skills/github-operations/SKILL.md +142 -0
  39. package/dist/assets/templates/skills/handoff-contract/SKILL.md +62 -28
  40. package/dist/assets/templates/skills/maxsim-batch/SKILL.md +68 -42
  41. package/dist/assets/templates/skills/maxsim-simplify/SKILL.md +65 -40
  42. package/dist/assets/templates/skills/project-memory/SKILL.md +121 -0
  43. package/dist/assets/templates/skills/research/SKILL.md +126 -0
  44. package/dist/assets/templates/skills/roadmap-writing/SKILL.md +71 -68
  45. package/dist/assets/templates/skills/systematic-debugging/SKILL.md +37 -25
  46. package/dist/assets/templates/skills/tdd/SKILL.md +36 -39
  47. package/dist/assets/templates/skills/using-maxsim/SKILL.md +69 -55
  48. package/dist/assets/templates/skills/verification/SKILL.md +167 -0
  49. package/dist/assets/templates/workflows/batch.md +249 -268
  50. package/dist/assets/templates/workflows/diagnose-issues.md +225 -151
  51. package/dist/assets/templates/workflows/execute-plan.md +191 -981
  52. package/dist/assets/templates/workflows/execute.md +350 -309
  53. package/dist/assets/templates/workflows/go.md +119 -138
  54. package/dist/assets/templates/workflows/health.md +71 -114
  55. package/dist/assets/templates/workflows/help.md +85 -147
  56. package/dist/assets/templates/workflows/init-existing.md +180 -1373
  57. package/dist/assets/templates/workflows/init.md +53 -165
  58. package/dist/assets/templates/workflows/new-milestone.md +91 -334
  59. package/dist/assets/templates/workflows/new-project.md +165 -1384
  60. package/dist/assets/templates/workflows/plan-create.md +182 -73
  61. package/dist/assets/templates/workflows/plan-discuss.md +89 -82
  62. package/dist/assets/templates/workflows/plan-research.md +191 -85
  63. package/dist/assets/templates/workflows/plan.md +122 -58
  64. package/dist/assets/templates/workflows/progress.md +76 -310
  65. package/dist/assets/templates/workflows/quick.md +70 -495
  66. package/dist/assets/templates/workflows/sdd.md +231 -221
  67. package/dist/assets/templates/workflows/settings.md +90 -120
  68. package/dist/assets/templates/workflows/verify-phase.md +296 -258
  69. package/dist/cli.cjs +17 -23465
  70. package/dist/cli.cjs.map +1 -1
  71. package/dist/install.cjs +356 -8358
  72. package/dist/install.cjs.map +1 -1
  73. package/package.json +16 -22
  74. package/dist/assets/templates/skills/agent-system-map/SKILL.md +0 -92
  75. package/dist/assets/templates/skills/evidence-collection/SKILL.md +0 -87
  76. package/dist/assets/templates/skills/github-artifact-protocol/SKILL.md +0 -67
  77. package/dist/assets/templates/skills/github-tools-guide/SKILL.md +0 -89
  78. package/dist/assets/templates/skills/input-validation/SKILL.md +0 -51
  79. package/dist/assets/templates/skills/memory-management/SKILL.md +0 -75
  80. package/dist/assets/templates/skills/research-methodology/SKILL.md +0 -137
  81. package/dist/assets/templates/skills/sdd/SKILL.md +0 -91
  82. package/dist/assets/templates/skills/tool-priority-guide/SKILL.md +0 -80
  83. package/dist/assets/templates/skills/verification-before-completion/SKILL.md +0 -71
  84. package/dist/assets/templates/skills/verification-gates/SKILL.md +0 -169
  85. package/dist/assets/templates/workflows/discuss-phase.md +0 -683
  86. package/dist/assets/templates/workflows/research-phase.md +0 -73
  87. package/dist/assets/templates/workflows/verify-work.md +0 -572
  88. package/dist/core-D5zUr9cb.cjs +0 -4305
  89. package/dist/core-D5zUr9cb.cjs.map +0 -1
  90. package/dist/skills-CjFWZIGM.cjs +0 -6824
  91. package/dist/skills-CjFWZIGM.cjs.map +0 -1
@@ -52,7 +52,7 @@ Standard format for presenting next steps after completing a command or workflow
52
52
 
53
53
  **Also available:**
54
54
  - Review plan before executing
55
- - `/maxsim:plan --review 2` — check assumptions
55
+ - `/maxsim:plan 2` — review and adjust assumptions
56
56
 
57
57
  ---
58
58
  ```
@@ -99,7 +99,6 @@ Add note that this is the last plan and what comes after:
99
99
 
100
100
  **Also available:**
101
101
  - `/maxsim:plan 2` — gather context first
102
- - `/maxsim:plan --research 2` — investigate unknowns
103
102
  - Review roadmap
104
103
 
105
104
  ---
@@ -128,7 +127,6 @@ Show completion status before next action:
128
127
 
129
128
  **Also available:**
130
129
  - `/maxsim:plan 3` — gather context first
131
- - `/maxsim:plan --research 3` — investigate unknowns
132
130
  - Review what Phase 2 built
133
131
 
134
132
  ---
@@ -149,7 +147,7 @@ When there's no clear primary action:
149
147
 
150
148
  **To discuss context first:** `/maxsim:plan 3`
151
149
 
152
- **To research unknowns:** `/maxsim:plan --research 3`
150
+ **To research unknowns:** `/maxsim:plan 3`
153
151
 
154
152
  <sub>`/clear` first → fresh context window</sub>
155
153
 
@@ -34,7 +34,7 @@ Model profiles control which Claude model each MAXSIM agent uses. This allows ba
34
34
  Orchestrators resolve model before spawning:
35
35
 
36
36
  ```
37
- 1. Read .planning/config.json
37
+ 1. Read maxsim config (via maxsim-tools.cjs state load)
38
38
  2. Check model_overrides for agent-specific override
39
39
  3. If no override, look up agent in profile table
40
40
  4. Pass model parameter to Task call
@@ -60,7 +60,7 @@ Overrides take precedence over the profile. Valid values: `opus`, `sonnet`, `hai
60
60
 
61
61
  Runtime: `/maxsim:settings` (change profile)
62
62
 
63
- Per-project default: Set in `.planning/config.json`:
63
+ Per-project default: Set in `maxsim.config.json`:
64
64
  ```json
65
65
  {
66
66
  "model_profile": "balanced"
@@ -47,7 +47,7 @@ INIT=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs state load)
47
47
  # commit_docs is available in the JSON output
48
48
 
49
49
  # Or use init commands which include commit_docs:
50
- INIT=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs init execute-phase "1")
50
+ INIT=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs init execute "1")
51
51
  # commit_docs is included in all init command outputs
52
52
  ```
53
53
 
@@ -101,7 +101,7 @@ To use uncommitted mode:
101
101
  git commit -m "chore: stop tracking planning docs"
102
102
  ```
103
103
 
104
- 4. **Branch merges:** When using `branching_strategy: phase` or `milestone`, the `complete-milestone` workflow automatically strips `.planning/` files from staging before merge commits when `commit_docs: false`.
104
+ 4. **Branch merges:** When using `branching_strategy: phase` or `milestone`, merge commits should be created manually or via git after the phase/milestone completes.
105
105
 
106
106
  </setup_uncommitted_mode>
107
107
 
@@ -112,25 +112,24 @@ To use uncommitted mode:
112
112
  | Strategy | When branch created | Branch scope | Merge point |
113
113
  |----------|---------------------|--------------|-------------|
114
114
  | `none` | Never | N/A | N/A |
115
- | `phase` | At `execute-phase` start | Single phase | User merges after phase |
116
- | `milestone` | At first `execute-phase` of milestone | Entire milestone | At `complete-milestone` |
115
+ | `phase` | At `execute` start | Single phase | User merges after phase |
116
+ | `milestone` | At first `execute` of milestone | Entire milestone | User merges after milestone |
117
117
 
118
118
  **When `git.branching_strategy: "none"` (default):**
119
119
  - All work commits to current branch
120
120
  - Standard MAXSIM behavior
121
121
 
122
122
  **When `git.branching_strategy: "phase"`:**
123
- - `execute-phase` creates/switches to a branch before execution
123
+ - `execute` creates/switches to a branch before execution
124
124
  - Branch name from `phase_branch_template` (e.g., `maxsim/phase-03-authentication`)
125
125
  - All plan commits go to that branch
126
126
  - User merges branches manually after phase completion
127
- - `complete-milestone` offers to merge all phase branches
128
127
 
129
128
  **When `git.branching_strategy: "milestone"`:**
130
- - First `execute-phase` of milestone creates the milestone branch
129
+ - First `execute` of milestone creates the milestone branch
131
130
  - Branch name from `milestone_branch_template` (e.g., `maxsim/v1.0-mvp`)
132
131
  - All phases in milestone commit to same branch
133
- - `complete-milestone` offers to merge milestone branch to main
132
+ - User merges milestone branch to main when complete
134
133
 
135
134
  **Template variables:**
136
135
 
@@ -142,9 +141,9 @@ To use uncommitted mode:
142
141
 
143
142
  **Checking the config:**
144
143
 
145
- Use `init execute-phase` which returns all config as JSON:
144
+ Use `init execute` which returns all config as JSON:
146
145
  ```bash
147
- INIT=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs init execute-phase "1")
146
+ INIT=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs init execute "1")
148
147
  # JSON output includes: branching_strategy, phase_branch_template, milestone_branch_template
149
148
  ```
150
149
 
@@ -172,7 +171,7 @@ if [ "$BRANCHING_STRATEGY" = "milestone" ]; then
172
171
  fi
173
172
  ```
174
173
 
175
- **Merge options at complete-milestone:**
174
+ **Merge options when completing a milestone:**
176
175
 
177
176
  | Option | Git command | Result |
178
177
  |--------|-------------|--------|
@@ -0,0 +1,120 @@
1
+ # Self-Improvement System
2
+
3
+ MaxsimCLI v6 introduces an autoresearch-inspired feedback loop that lets the agent
4
+ learn from previous sessions rather than starting cold every time.
5
+
6
+ ---
7
+
8
+ ## 1. Git-as-Memory
9
+
10
+ At the start of each session the agent reads recent history directly from the repo:
11
+
12
+ ```
13
+ git log --oneline -20
14
+ ```
15
+
16
+ This gives an immediate, zero-overhead summary of what changed, what was shipped,
17
+ and which tasks were completed. No external database required.
18
+
19
+ **When to use it:**
20
+ - Orient quickly at session start before reading any other file.
21
+ - Detect whether a previous phase was committed or abandoned.
22
+ - Spot regressions (a feature that was added and later reverted).
23
+
24
+ ---
25
+
26
+ ## 2. Agent Memory File
27
+
28
+ Persistent learnings are stored in:
29
+
30
+ ```
31
+ .claude/agent-memory/maxsim-learner/MEMORY.md
32
+ ```
33
+
34
+ This file is appended automatically by the `maxsim-capture-learnings` Stop hook
35
+ at the end of every session in a MaxsimCLI project. Each entry records:
36
+
37
+ - The session date and ID.
38
+ - How many commits were made.
39
+ - The exact commit messages (oneline format).
40
+
41
+ **Reading the file at session start** lets the agent recall:
42
+ - Which approaches worked and were committed.
43
+ - Which tasks were attempted repeatedly without a commit (likely failed).
44
+ - Long-term trends across many sessions.
45
+
46
+ ---
47
+
48
+ ## 3. Results Tracking
49
+
50
+ Track two categories explicitly in task notes or phase plans:
51
+
52
+ | Category | Definition |
53
+ |---|---|
54
+ | Worked | Approach produced a commit or a passing test run. |
55
+ | Failed | Approach was retried or abandoned without a commit. |
56
+
57
+ Patterns that appear in the "Worked" column three or more times should be
58
+ promoted to templates or standard operating procedures. Patterns that appear in
59
+ the "Failed" column should be flagged before attempting again.
60
+
61
+ ---
62
+
63
+ ## 4. Verify + Guard Pattern
64
+
65
+ Every self-improvement cycle must include a guard step to prevent regression:
66
+
67
+ 1. **Implement** — make the change.
68
+ 2. **Verify** — run the relevant test, build, or lint command and confirm it passes.
69
+ 3. **Guard** — if verification fails, revert immediately and record the failure.
70
+ Do not proceed to the next task with a broken baseline.
71
+
72
+ This pattern keeps the main branch always green regardless of how many
73
+ improvement iterations run.
74
+
75
+ ---
76
+
77
+ ## 5. Bounded Iterations
78
+
79
+ To avoid infinite loops on hard problems, apply strict iteration limits:
80
+
81
+ - **Max 3 retries per task.** After the third failure, escalate or skip.
82
+ - Each retry must use a meaningfully different approach — no copy-paste retries.
83
+ - Record the approach variation in the task log so the next session can
84
+ distinguish them.
85
+
86
+ ---
87
+
88
+ ## 6. Stuck Detection and Recovery
89
+
90
+ If the agent records **5 consecutive failures** across sessions (i.e. 5 sessions
91
+ with no new commit on a given task), the recovery protocol activates:
92
+
93
+ 1. **Stop** working on the task directly.
94
+ 2. **Decompose** — break the task into smaller, verifiable sub-tasks.
95
+ 3. **Ask** — surface the blocker explicitly in the next session's opening message.
96
+ 4. **Document** — add a `## Blocked` section to MEMORY.md describing what was
97
+ tried and what the error state is.
98
+
99
+ Stuck detection relies on scanning MEMORY.md for repeated session entries that
100
+ reference the same task with no intervening commit.
101
+
102
+ ---
103
+
104
+ ## Hook Integration
105
+
106
+ The capture-learnings hook is registered as a `Stop` event hook during
107
+ `maxsim install`. It only writes to MEMORY.md when `.claude/maxsim/config.json`
108
+ exists, so it is a no-op in non-MaxsimCLI projects.
109
+
110
+ To inspect accumulated learnings:
111
+
112
+ ```
113
+ cat .claude/agent-memory/maxsim-learner/MEMORY.md
114
+ ```
115
+
116
+ To reset learnings for a fresh start:
117
+
118
+ ```
119
+ rm .claude/agent-memory/maxsim-learner/MEMORY.md
120
+ ```
@@ -29,7 +29,7 @@ Co-author line when AI-assisted: `Co-Authored-By: Claude <noreply@anthropic.com>
29
29
  | Skills | `.claude/skills/<kebab-case>/SKILL.md` |
30
30
  | Agents | `.claude/agents/<simple-name>.md` |
31
31
  | Rules | `.claude/rules/<topic>.md` |
32
- | Plans | `.planning/phases/XX-Name/XX-NN-PLAN.md` |
32
+ | Plans | `phases/{phase}-{name}/{phase}-{plan}-PLAN.md` |
33
33
 
34
34
  Use kebab-case for directory names. Use UPPER_CASE for protocol files (SKILL.md, PLAN.md, STATE.md).
35
35
 
@@ -54,4 +54,4 @@ These phrases indicate reasoning without evidence. Replace them with a verificat
54
54
 
55
55
  ## Retry Protocol
56
56
 
57
- When verification fails: read the error, fix the issue, re-run the command, produce a new evidence block. Maximum 3 total attempts per gate before escalating. The `verification-gates` skill provides detailed methodology for gate types, retry feedback, and escalation.
57
+ When verification fails: read the error, fix the issue, re-run the command, produce a new evidence block. Maximum 3 total attempts per gate before escalating. The `verification` skill provides detailed methodology for gate types, retry feedback, and escalation.
@@ -1,10 +1,6 @@
1
1
  ---
2
2
  name: brainstorming
3
- description: >-
4
- Multi-approach exploration before design decisions. Generates 3+ approaches
5
- with tradeoff analysis before selecting. Use when facing architectural
6
- choices, library selection, design decisions, or any problem with multiple
7
- viable solutions.
3
+ description: Explores multiple implementation approaches before committing to one. Produces a structured comparison table with effort/risk assessment. Use when starting features, facing design decisions, or multiple valid approaches exist.
8
4
  ---
9
5
 
10
6
  # Brainstorming
@@ -13,7 +9,7 @@ The first idea is rarely the best idea. Explore the space before committing to a
13
9
 
14
10
  ## Process
15
11
 
16
- ### 1. Frame the Problem
12
+ ### 1. Understand the Goal
17
13
 
18
14
  Define the problem clearly before proposing solutions:
19
15
 
@@ -22,45 +18,52 @@ Define the problem clearly before proposing solutions:
22
18
  - What has been tried or considered already?
23
19
  - What are the non-negotiables vs. nice-to-haves?
24
20
 
25
- Ask the user ONE question at a time. Each answer informs the next question.
21
+ Ask one question at a time. Each answer informs the next question. Do not front-load a list of questions.
26
22
 
27
23
  ### 2. Research Context
28
24
 
29
25
  Before proposing solutions, gather evidence:
30
26
 
31
- - Read relevant code and check for prior decisions
32
- - Identify patterns already in use in the codebase
33
- - Check STATE.md for existing architectural decisions
27
+ - Read relevant code and check for prior decisions in the codebase.
28
+ - Identify patterns already in use prefer consistency over novelty.
29
+ - Check for existing architectural decisions that constrain the options.
34
30
 
35
- ### 3. Present 3+ Approaches
31
+ ### 3. Generate 3+ Approaches
36
32
 
37
- For each approach, provide:
33
+ Present at least three distinct approaches. For each:
38
34
 
39
35
  | Aspect | Content |
40
36
  |--------|---------|
41
37
  | **Summary** | One sentence |
42
- | **How it works** | 3-5 implementation bullets |
38
+ | **How it works** | 35 implementation bullets |
43
39
  | **Pros** | Concrete advantages ("200 fewer lines" beats "simpler") |
44
- | **Cons** | Honest drawbacks -- do not hide weaknesses |
40
+ | **Cons** | Honest drawbacks do not hide weaknesses |
45
41
  | **Effort** | Low / Medium / High |
46
- | **Risk** | What could go wrong and how recoverable |
42
+ | **Risk** | What could go wrong and how recoverable it is |
47
43
 
48
- If one approach is clearly superior, say so -- but still present alternatives so the user can validate your reasoning.
44
+ If one approach is clearly superior, say so but still present the alternatives so the reasoning can be validated.
49
45
 
50
- ### 4. Discuss and Refine
46
+ ### 4. Compare Produce the Summary Table
51
47
 
52
- - Ask which approach the user prefers or whether they want a hybrid
53
- - Answer follow-up questions honestly
54
- - If no approach fits, propose new ones informed by the discussion
55
- - Continue one question at a time -- do not assume consensus
48
+ Always include a top-level comparison table before the detailed breakdowns:
56
49
 
57
- ### 5. Get Explicit Approval
50
+ | # | Approach | Effort | Risk |
51
+ |---|----------|--------|------|
52
+ | A | [one-line summary] | Low/Med/High | Low/Med/High |
53
+ | B | [one-line summary] | Low/Med/High | Low/Med/High |
54
+ | C | [one-line summary] | Low/Med/High | Low/Med/High |
55
+
56
+ ### 5. Select with Rationale
58
57
 
59
- The user must explicitly approve one approach (e.g., "Go with A", "Approved"). Vague responses like "Sounds good" or "Interesting" are not approval. If ambiguous, ask: "To confirm -- should I proceed with [specific approach]?"
58
+ State which approach is recommended and why. Reference specific tradeoffs not just "it's simpler." If no approach fits cleanly, propose a hybrid informed by the analysis.
60
59
 
61
60
  ### 6. Document the Decision
62
61
 
63
- Record: chosen approach, rejected alternatives with reasons, key implementation decisions, and risks.
62
+ Record:
63
+ - Chosen approach and rationale
64
+ - Rejected alternatives and reasons for rejection
65
+ - Key implementation decisions that follow from the choice
66
+ - Known risks and mitigation plan
64
67
 
65
68
  ## Output Format
66
69
 
@@ -88,14 +91,20 @@ Record: chosen approach, rejected alternatives with reasons, key implementation
88
91
  ## Selected: [letter]
89
92
  **Rationale:** [why this approach was chosen]
90
93
  **Rejected:** [why alternatives were not chosen]
94
+ **Risks:** [known risks and mitigation]
91
95
  ```
92
96
 
97
+ ## Explicit Approval Required
98
+
99
+ The user must explicitly approve one approach before any implementation begins. Vague responses like "Sounds good" or "Interesting" are not approval. If ambiguous, ask: "To confirm — should I proceed with [specific approach]?"
100
+
93
101
  ## Common Pitfalls
94
102
 
95
- | Excuse | Reality |
96
- |--------|---------|
103
+ | Pitfall | Reality |
104
+ |---------|---------|
97
105
  | "I already know the best approach" | You know your preferred approach. Alternatives may be better. |
98
106
  | "There's only one way to do this" | There is almost never only one way. |
99
107
  | "Brainstorming slows us down" | Building the wrong thing is slower. 30 minutes of design saves days of rework. |
108
+ | "The user will just pick the first one" | Present the best option last — anchoring on the first wastes the analysis. |
100
109
 
101
110
  Stop immediately if you catch yourself writing code before presenting approaches, presenting only one option, asking multiple questions at once, or assuming approval without explicit confirmation.
@@ -1,27 +1,18 @@
1
1
  ---
2
2
  name: code-review
3
3
  description: >-
4
- Code quality review covering security, interfaces, error handling, test
5
- coverage, and conventions. Produces structured findings with severity and
6
- evidence. Use when reviewing pull requests, completed implementations, or
7
- code changes.
4
+ Performs multi-dimensional code review covering security, quality, spec
5
+ compliance, and maintainability. Use when reviewing completed implementations
6
+ or before merging changes.
8
7
  ---
9
8
 
10
9
  # Code Review
11
10
 
12
- Shipping unreviewed code is shipping unknown risk. Review before sign-off.
11
+ Shipping unreviewed code is shipping unknown risk. Every implementation review covers five dimensions.
13
12
 
14
13
  ## Review Dimensions
15
14
 
16
- Follow these dimensions in order for every review.
17
-
18
- ### 1. SCOPE -- Identify All Changes
19
-
20
- - Diff against the starting point to see every changed file
21
- - List all new, modified, and deleted files
22
- - Do not skip generated files, config changes, or minor edits
23
-
24
- ### 2. SECURITY -- Check for Vulnerabilities
15
+ ### 1. Security
25
16
 
26
17
  | Category | What to Look For |
27
18
  |----------|-----------------|
@@ -29,76 +20,108 @@ Follow these dimensions in order for every review.
29
20
  | Authentication | Missing auth checks, hardcoded credentials, tokens in source |
30
21
  | Authorization | Missing permission checks, privilege escalation paths |
31
22
  | Data exposure | Secrets in logs, overly broad API responses, sensitive data in error messages |
32
- | Dependencies | New dependencies with known vulnerabilities, unnecessary dependencies |
23
+ | Dependencies | New packages with known CVEs, unnecessary new dependencies |
24
+
25
+ Any security issue is a Blocker. No exceptions. No deferrals.
33
26
 
34
- Any security issue is a blocking finding. No exceptions.
27
+ ### 2. Quality
35
28
 
36
- ### 3. INTERFACES -- Verify API Contracts
29
+ - Are all external calls wrapped in error handling?
30
+ - Do error messages provide enough context to diagnose the issue?
31
+ - Are errors propagated correctly, not swallowed silently?
32
+ - Are edge cases handled: empty input, null values, boundary conditions, concurrent access?
33
+ - Are there obvious performance problems: N+1 queries, unbounded loops, missing pagination?
37
34
 
38
- - Do public function signatures match their documentation?
39
- - Are return types accurate and complete?
40
- - Do error types cover all failure modes?
35
+ ### 3. Spec Compliance
36
+
37
+ - Does the implementation match what was planned?
38
+ - Are all tasks from the plan completed?
39
+ - Are acceptance criteria met?
41
40
  - Are breaking changes documented and intentional?
41
+ - Does the scope match the plan — neither over-built nor under-built?
42
42
 
43
- ### 4. ERROR HANDLING -- Check Failure Paths
43
+ ### 4. Maintainability
44
44
 
45
- - Are all external calls wrapped in error handling?
46
- - Do error messages provide enough context to diagnose the issue?
47
- - Are errors propagated correctly (not swallowed silently)?
48
- - Are edge cases handled (empty input, null values, boundary conditions)?
45
+ - Is naming consistent with existing codebase conventions?
46
+ - Is complexity justified by the requirements? Could this be simpler?
47
+ - Are comments present where logic is non-obvious?
48
+ - Is there duplicated logic that should be extracted?
49
+ - Would a new contributor understand this code without asking?
49
50
 
50
- ### 5. TESTS -- Evaluate Coverage
51
+ ### 5. Test Coverage
51
52
 
52
53
  - Does every new public function have corresponding tests?
53
54
  - Do tests cover both success and failure paths?
54
55
  - Are edge cases tested?
55
56
  - Do tests verify behavior, not implementation details?
57
+ - Would a test failure actually catch a regression?
56
58
 
57
- ### 6. CONVENTIONS -- Assess Compliance
59
+ ## Severity Levels
58
60
 
59
- - Is naming consistent with existing codebase conventions?
60
- - Is the complexity justified by the requirements?
61
- - Are comments present where logic is non-obvious?
61
+ | Severity | Definition | Action |
62
+ |----------|------------|--------|
63
+ | Blocker | Security vulnerability, data loss risk, broken public API contract | Block merge. Fix before any other work. |
64
+ | High | Missing critical tests, no error path handling, performance regression | Fix now. File issue if fix takes >30min. |
65
+ | Medium | Naming inconsistency, dead code, convention mismatch, weak tests | File for follow-up. Do not block merge. |
66
+ | Low | Style preference, minor naming, optional improvement | Comment only. No tracking required. |
67
+
68
+ Blocker and High block approval. Medium and Low do not.
62
69
 
63
- ## Review Output Format
70
+ ## Parallel Review Pattern
71
+
72
+ For large diffs (10+ files), spawn one review agent per dimension in parallel:
64
73
 
65
74
  ```
66
- REVIEW SCOPE: [number] files changed, [number] additions, [number] deletions
67
- SECURITY: PASS | ISSUES FOUND (list)
68
- INTERFACES: PASS | ISSUES FOUND (list)
69
- ERROR HANDLING: PASS | ISSUES FOUND (list)
70
- TEST COVERAGE: PASS | GAPS FOUND (list)
71
- CONVENTIONS: PASS | ISSUES FOUND (list)
72
- VERDICT: APPROVED | BLOCKED (list blocking issues)
75
+ Agent 1: Security review only
76
+ Agent 2: Quality and error handling only
77
+ Agent 3: Spec compliance only
78
+ Agent 4: Maintainability only
79
+ Agent 5: Test coverage only
73
80
  ```
74
81
 
75
- ### Severity Reference
82
+ Each agent returns findings in the output format below. The orchestrator collates findings and produces the final verdict.
83
+
84
+ ## Output Format
76
85
 
77
- | Severity | Examples |
78
- |----------|---------|
79
- | Blocker | SQL injection, XSS, hardcoded secrets, broken public API, data loss risk |
80
- | High | Performance regression, missing critical tests, no error path tests |
81
- | Medium | Naming inconsistency, dead code, convention mismatch |
86
+ ```
87
+ REVIEW SCOPE: [N] files changed, [N] additions, [N] deletions
82
88
 
83
- Blocker and High severity issues block approval. Medium issues should be filed for follow-up.
89
+ SECURITY: PASS | [BLOCKER] description
90
+ QUALITY: PASS | [HIGH] description
91
+ SPEC COMPLIANCE: PASS | [HIGH] description
92
+ MAINTAINABILITY: PASS | [MEDIUM] description
93
+ TEST COVERAGE: PASS | [HIGH] description
84
94
 
85
- ## Spec Review vs Code Review
95
+ VERDICT: APPROVED | BLOCKED
86
96
 
87
- | Dimension | Spec Review | Code Review |
88
- |-----------|------------|-------------|
89
- | Question | Does it match the requirements? | Is the code correct and quality? |
90
- | Checks | Acceptance criteria, requirement coverage, scope | Security, interfaces, errors, tests, conventions |
91
- | Output | PASS/FAIL per requirement | APPROVED/BLOCKED per dimension |
97
+ Blocking issues:
98
+ - [BLOCKER] [file:line] SQL query uses string concatenation with user input
99
+ - [HIGH] [file:line] No error handling on database connection failure
92
100
 
93
- Both reviews are needed -- spec review alone does not catch security issues, and code review alone does not catch missing requirements.
101
+ Follow-up items:
102
+ - [MEDIUM] [file] Function name `doThing` does not describe behavior
103
+ ```
94
104
 
95
105
  ## Common Pitfalls
96
106
 
97
- | Issue | Reality |
98
- |-------|---------|
107
+ | Assumption | Reality |
108
+ |------------|---------|
99
109
  | "Tests pass, so the code is fine" | Tests verify behavior, not code quality. Review is separate. |
100
110
  | "I wrote it, so I know it's correct" | Author bias is real. Review as if someone else wrote it. |
101
111
  | "It's just a small change" | Small changes cause large outages. |
102
112
  | "Generated code doesn't need review" | Generated code has the same bugs. Review it. |
113
+ | "Security issues can be fixed later" | Security issues deferred are security issues shipped. |
114
+
115
+ ## Spec Review vs Code Review
116
+
117
+ These are different activities. Both are required.
118
+
119
+ | Dimension | Spec Review | Code Review |
120
+ |-----------|------------|-------------|
121
+ | Question | Does it match the requirements? | Is the code correct and quality? |
122
+ | Checks | Acceptance criteria, requirement coverage, scope | Security, quality, errors, tests, maintainability |
123
+ | Output | PASS/FAIL per requirement | APPROVED/BLOCKED per dimension |
124
+
125
+ Spec review alone misses security issues. Code review alone misses missing requirements. Run both.
103
126
 
104
- See also: `/maxsim-simplify` for maintainability optimization (duplication, dead code, complexity).
127
+ See also: `/maxsim-simplify` for maintainability optimization (duplication, dead code, complexity reduction).