maxsimcli 3.10.3 → 3.12.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 (142) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/assets/CHANGELOG.md +26 -0
  3. package/dist/assets/dashboard/client/assets/index-CxFKStBk.css +32 -0
  4. package/dist/assets/dashboard/client/assets/{index-CZ8WC97G.js → index-wtQDvXzr.js} +64 -64
  5. package/dist/assets/dashboard/client/index.html +2 -2
  6. package/dist/assets/dashboard/server.js +5 -1
  7. package/dist/assets/templates/agents/AGENTS.md +82 -0
  8. package/dist/assets/templates/commands/maxsim/settings.md +1 -1
  9. package/dist/assets/templates/skills/code-review/SKILL.md +151 -0
  10. package/dist/assets/templates/skills/memory-management/SKILL.md +174 -0
  11. package/dist/assets/templates/skills/simplify/SKILL.md +137 -0
  12. package/dist/assets/templates/skills/using-maxsim/SKILL.md +115 -0
  13. package/dist/assets/templates/templates/config.json +1 -1
  14. package/dist/assets/templates/workflows/add-tests.md +3 -3
  15. package/dist/assets/templates/workflows/complete-milestone.md +1 -1
  16. package/dist/assets/templates/workflows/execute-phase.md +4 -14
  17. package/dist/assets/templates/workflows/execute-plan.md +10 -0
  18. package/dist/assets/templates/workflows/init-existing.md +7 -3
  19. package/dist/assets/templates/workflows/new-milestone.md +4 -0
  20. package/dist/assets/templates/workflows/new-project.md +6 -2
  21. package/dist/assets/templates/workflows/plan-phase.md +2 -2
  22. package/dist/assets/templates/workflows/settings.md +8 -4
  23. package/dist/assets/templates/workflows/verify-work.md +1 -1
  24. package/dist/cli.cjs +818 -599
  25. package/dist/cli.cjs.map +1 -1
  26. package/dist/cli.js +78 -204
  27. package/dist/cli.js.map +1 -1
  28. package/dist/core/commands.d.ts +7 -0
  29. package/dist/core/commands.d.ts.map +1 -1
  30. package/dist/core/commands.js +40 -35
  31. package/dist/core/commands.js.map +1 -1
  32. package/dist/core/core.d.ts +39 -1
  33. package/dist/core/core.d.ts.map +1 -1
  34. package/dist/core/core.js +122 -47
  35. package/dist/core/core.js.map +1 -1
  36. package/dist/core/dashboard-launcher.d.ts +56 -0
  37. package/dist/core/dashboard-launcher.d.ts.map +1 -0
  38. package/dist/core/dashboard-launcher.js +243 -0
  39. package/dist/core/dashboard-launcher.js.map +1 -0
  40. package/dist/core/index.d.ts +4 -2
  41. package/dist/core/index.d.ts.map +1 -1
  42. package/dist/core/index.js +20 -2
  43. package/dist/core/index.js.map +1 -1
  44. package/dist/core/init.d.ts +2 -3
  45. package/dist/core/init.d.ts.map +1 -1
  46. package/dist/core/init.js +33 -52
  47. package/dist/core/init.js.map +1 -1
  48. package/dist/core/milestone.d.ts.map +1 -1
  49. package/dist/core/milestone.js +15 -20
  50. package/dist/core/milestone.js.map +1 -1
  51. package/dist/core/phase.d.ts +33 -0
  52. package/dist/core/phase.d.ts.map +1 -1
  53. package/dist/core/phase.js +282 -225
  54. package/dist/core/phase.js.map +1 -1
  55. package/dist/core/roadmap.d.ts.map +1 -1
  56. package/dist/core/roadmap.js +17 -18
  57. package/dist/core/roadmap.js.map +1 -1
  58. package/dist/core/state.d.ts +5 -0
  59. package/dist/core/state.d.ts.map +1 -1
  60. package/dist/core/state.js +51 -42
  61. package/dist/core/state.js.map +1 -1
  62. package/dist/core/template.d.ts.map +1 -1
  63. package/dist/core/template.js +1 -1
  64. package/dist/core/template.js.map +1 -1
  65. package/dist/core/types.d.ts +4 -4
  66. package/dist/core/types.d.ts.map +1 -1
  67. package/dist/core/types.js +1 -2
  68. package/dist/core/types.js.map +1 -1
  69. package/dist/core/verify.d.ts.map +1 -1
  70. package/dist/core/verify.js +61 -80
  71. package/dist/core/verify.js.map +1 -1
  72. package/dist/install/adapters.d.ts +15 -0
  73. package/dist/install/adapters.d.ts.map +1 -0
  74. package/dist/install/adapters.js +203 -0
  75. package/dist/install/adapters.js.map +1 -0
  76. package/dist/install/copy.d.ts +15 -0
  77. package/dist/install/copy.d.ts.map +1 -0
  78. package/dist/install/copy.js +191 -0
  79. package/dist/install/copy.js.map +1 -0
  80. package/dist/install/dashboard.d.ts +16 -0
  81. package/dist/install/dashboard.d.ts.map +1 -0
  82. package/dist/install/dashboard.js +273 -0
  83. package/dist/install/dashboard.js.map +1 -0
  84. package/dist/install/hooks.d.ts +32 -0
  85. package/dist/install/hooks.d.ts.map +1 -0
  86. package/dist/install/hooks.js +285 -0
  87. package/dist/install/hooks.js.map +1 -0
  88. package/dist/install/index.d.ts +2 -0
  89. package/dist/install/index.d.ts.map +1 -0
  90. package/dist/install/index.js +598 -0
  91. package/dist/install/index.js.map +1 -0
  92. package/dist/install/manifest.d.ts +20 -0
  93. package/dist/install/manifest.d.ts.map +1 -0
  94. package/dist/install/manifest.js +135 -0
  95. package/dist/install/manifest.js.map +1 -0
  96. package/dist/install/patches.d.ts +11 -0
  97. package/dist/install/patches.d.ts.map +1 -0
  98. package/dist/install/patches.js +136 -0
  99. package/dist/install/patches.js.map +1 -0
  100. package/dist/install/shared.d.ts +50 -0
  101. package/dist/install/shared.d.ts.map +1 -0
  102. package/dist/install/shared.js +142 -0
  103. package/dist/install/shared.js.map +1 -0
  104. package/dist/install/uninstall.d.ts +6 -0
  105. package/dist/install/uninstall.d.ts.map +1 -0
  106. package/dist/install/uninstall.js +280 -0
  107. package/dist/install/uninstall.js.map +1 -0
  108. package/dist/install.cjs +782 -705
  109. package/dist/install.cjs.map +1 -1
  110. package/dist/mcp/index.d.ts +12 -0
  111. package/dist/mcp/index.d.ts.map +1 -0
  112. package/dist/mcp/index.js +21 -0
  113. package/dist/mcp/index.js.map +1 -0
  114. package/dist/mcp/phase-tools.d.ts +13 -0
  115. package/dist/mcp/phase-tools.d.ts.map +1 -0
  116. package/dist/mcp/phase-tools.js +164 -0
  117. package/dist/mcp/phase-tools.js.map +1 -0
  118. package/dist/mcp/state-tools.d.ts +13 -0
  119. package/dist/mcp/state-tools.d.ts.map +1 -0
  120. package/dist/mcp/state-tools.js +185 -0
  121. package/dist/mcp/state-tools.js.map +1 -0
  122. package/dist/mcp/todo-tools.d.ts +13 -0
  123. package/dist/mcp/todo-tools.d.ts.map +1 -0
  124. package/dist/mcp/todo-tools.js +143 -0
  125. package/dist/mcp/todo-tools.js.map +1 -0
  126. package/dist/mcp/utils.d.ts +27 -0
  127. package/dist/mcp/utils.d.ts.map +1 -0
  128. package/dist/mcp/utils.js +82 -0
  129. package/dist/mcp/utils.js.map +1 -0
  130. package/dist/mcp-server.cjs +11806 -0
  131. package/dist/mcp-server.cjs.map +1 -0
  132. package/dist/mcp-server.d.cts +2 -0
  133. package/dist/mcp-server.d.ts +12 -0
  134. package/dist/mcp-server.d.ts.map +1 -0
  135. package/dist/mcp-server.js +31 -0
  136. package/dist/mcp-server.js.map +1 -0
  137. package/package.json +5 -3
  138. package/dist/assets/dashboard/client/assets/index-DzJChB-D.css +0 -32
  139. package/dist/install.d.ts +0 -2
  140. package/dist/install.d.ts.map +0 -1
  141. package/dist/install.js +0 -1804
  142. package/dist/install.js.map +0 -1
@@ -10,8 +10,8 @@
10
10
  href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700;800;900&family=Geist+Mono:wght@400;500;600;700&display=swap"
11
11
  rel="stylesheet"
12
12
  />
13
- <script type="module" crossorigin src="/assets/index-CZ8WC97G.js"></script>
14
- <link rel="stylesheet" crossorigin href="/assets/index-DzJChB-D.css">
13
+ <script type="module" crossorigin src="/assets/index-wtQDvXzr.js"></script>
14
+ <link rel="stylesheet" crossorigin href="/assets/index-CxFKStBk.css">
15
15
  </head>
16
16
  <body>
17
17
  <div id="root"></div>
@@ -77514,7 +77514,7 @@ var SessionStore = class {
77514
77514
  scrollback = [];
77515
77515
  append(data) {
77516
77516
  this.scrollback.push(data);
77517
- if (this.scrollback.length > MAX_SCROLLBACK) this.scrollback = this.scrollback.slice(-MAX_SCROLLBACK);
77517
+ if (this.scrollback.length > MAX_SCROLLBACK * 1.5) this.scrollback = this.scrollback.slice(-MAX_SCROLLBACK);
77518
77518
  }
77519
77519
  getAll() {
77520
77520
  return this.scrollback.join("");
@@ -77746,6 +77746,10 @@ function isWithinPlanning(cwd, targetPath) {
77746
77746
  }
77747
77747
  const suppressedPaths = /* @__PURE__ */ new Map();
77748
77748
  const SUPPRESS_TTL_MS = 500;
77749
+ setInterval(() => {
77750
+ const now = Date.now();
77751
+ for (const [p, ts] of suppressedPaths.entries()) if (now - ts > SUPPRESS_TTL_MS) suppressedPaths.delete(p);
77752
+ }, 6e4).unref();
77749
77753
  function suppressPath(filePath) {
77750
77754
  suppressedPaths.set(normalizeFsPath(filePath), Date.now());
77751
77755
  }
@@ -0,0 +1,82 @@
1
+ # AGENTS.md — Agent-Skill Registry
2
+
3
+ This file maps MAXSIM agents to the skills they should auto-load and enforce during execution.
4
+
5
+ ## How This Registry Works
6
+
7
+ When a MAXSIM agent is spawned, it checks this registry to determine which skills apply. Skills are behavioral rules that constrain agent actions — they are not optional guidelines.
8
+
9
+ Agents load skills by reading `SKILL.md` from each skill directory listed in their entry below. Skills are loaded once at agent startup and enforced throughout the session.
10
+
11
+ ## Registry
12
+
13
+ ### maxsim-executor
14
+
15
+ **Skills:** `tdd`, `verification-before-completion`, `using-maxsim`
16
+
17
+ The executor implements plan tasks. TDD ensures tests are written before code. Verification ensures completion claims have evidence. Using-maxsim ensures work stays within the plan structure.
18
+
19
+ ### maxsim-debugger
20
+
21
+ **Skills:** `systematic-debugging`, `verification-before-completion`
22
+
23
+ The debugger investigates bugs. Systematic-debugging enforces the reproduce-hypothesize-isolate-verify-fix cycle. Verification ensures the fix is confirmed with evidence before claiming resolution.
24
+
25
+ ### maxsim-verifier
26
+
27
+ **Skills:** `verification-before-completion`
28
+
29
+ The verifier checks phase goal achievement. Verification-before-completion is its core purpose — every claim must have fresh evidence.
30
+
31
+ ### maxsim-planner
32
+
33
+ **Skills:** `using-maxsim`
34
+
35
+ The planner creates PLAN.md files. Using-maxsim ensures plans reference the correct workflow structure and available skills.
36
+
37
+ ### maxsim-code-reviewer
38
+
39
+ **Skills:** `verification-before-completion`
40
+
41
+ The code reviewer checks implementation quality. Verification ensures review findings are backed by evidence from the codebase, not assumptions.
42
+
43
+ ### maxsim-roadmapper
44
+
45
+ **Skills:** `using-maxsim`
46
+
47
+ The roadmapper creates project roadmaps. Using-maxsim ensures roadmaps align with the MAXSIM phase structure.
48
+
49
+ ### maxsim-phase-researcher
50
+
51
+ **Skills:** `memory-management`
52
+
53
+ The phase researcher gathers context for planning. Memory-management ensures valuable research findings are persisted for future sessions.
54
+
55
+ ### maxsim-project-researcher
56
+
57
+ **Skills:** `memory-management`
58
+
59
+ The project researcher analyzes project structure during init. Memory-management ensures architectural patterns and conventions are saved.
60
+
61
+ ### maxsim-integration-checker
62
+
63
+ **Skills:** `verification-before-completion`
64
+
65
+ The integration checker validates cross-component wiring. Verification ensures integration claims are tested, not assumed.
66
+
67
+ ## Skill Reference
68
+
69
+ | Skill | Directory | Purpose |
70
+ |-------|-----------|---------|
71
+ | `systematic-debugging` | `skills/systematic-debugging/` | Root cause investigation before fixes |
72
+ | `tdd` | `skills/tdd/` | Failing test before implementation |
73
+ | `verification-before-completion` | `skills/verification-before-completion/` | Evidence before completion claims |
74
+ | `using-maxsim` | `skills/using-maxsim/` | Workflow routing and structure |
75
+ | `memory-management` | `skills/memory-management/` | Pattern and error persistence |
76
+
77
+ ## Adding New Skills
78
+
79
+ 1. Create a directory under `skills/` with a `SKILL.md` file
80
+ 2. Follow the existing skill format (frontmatter + Iron Law + Gate Function + Red Flags)
81
+ 3. Add the skill to the relevant agent entries in this registry
82
+ 4. Add the skill to the reference table above
@@ -14,7 +14,7 @@ Interactive configuration of MAXSIM workflow agents and model profile via multi-
14
14
  Routes to the settings workflow which handles:
15
15
  - Config existence ensuring
16
16
  - Current settings reading and parsing
17
- - Interactive 5-question prompt (model, research, plan_check, verifier, branching)
17
+ - Interactive 5-question prompt (model, research, plan_checker, verifier, branching)
18
18
  - Config merging and writing
19
19
  - Confirmation display with quick command references
20
20
  </objective>
@@ -0,0 +1,151 @@
1
+ ---
2
+ name: code-review
3
+ description: Use after completing a phase or significant implementation — requires reviewing all changed code for critical issues before sign-off
4
+ ---
5
+
6
+ # Code Review
7
+
8
+ Shipping unreviewed code is shipping unknown risk. Review before sign-off.
9
+
10
+ **If you have not reviewed every changed file, you cannot approve the phase.**
11
+
12
+ ## The Iron Law
13
+
14
+ <HARD-GATE>
15
+ NO PHASE SIGN-OFF WITHOUT REVIEWING ALL CHANGED CODE.
16
+ If you have not read every diff introduced in this phase, you CANNOT mark it complete.
17
+ "It works" is not "it's correct." Passing tests do not prove code quality.
18
+ Violating this rule is a violation — not a shortcut.
19
+ </HARD-GATE>
20
+
21
+ ## The Gate Function
22
+
23
+ Follow these steps IN ORDER before approving any phase or significant implementation.
24
+
25
+ ### 1. SCOPE — Identify All Changes
26
+
27
+ - Run `git diff` against the phase's starting point to see every changed file
28
+ - List all new files, modified files, and deleted files
29
+ - Do NOT skip generated files, config changes, or "minor" edits
30
+
31
+ ```bash
32
+ # Example: see all changes since phase branch point
33
+ git diff --stat main...HEAD
34
+ git diff main...HEAD
35
+ ```
36
+
37
+ ### 2. SECURITY — Check for Vulnerabilities
38
+
39
+ Review every changed file for:
40
+
41
+ | Category | What to Look For |
42
+ |----------|-----------------|
43
+ | Injection | Unsanitized user input in SQL, shell commands, HTML output, template strings |
44
+ | Authentication | Missing auth checks, hardcoded credentials, tokens in source |
45
+ | Authorization | Missing permission checks, privilege escalation paths |
46
+ | Data exposure | Secrets in logs, overly broad API responses, sensitive data in error messages |
47
+ | Dependencies | New dependencies with known vulnerabilities, unnecessary dependencies |
48
+
49
+ **Any security issue is a blocking finding. No exceptions.**
50
+
51
+ ### 3. INTERFACES — Verify API Contracts
52
+
53
+ - Do public function signatures match their documentation?
54
+ - Are return types accurate and complete?
55
+ - Do error types cover all failure modes?
56
+ - Are breaking changes documented and intentional?
57
+ - Do exported interfaces maintain backward compatibility (or is the break intentional)?
58
+
59
+ ### 4. ERROR HANDLING — Check Failure Paths
60
+
61
+ - Are all external calls (I/O, network, user input) wrapped in error handling?
62
+ - Do error messages provide enough context to diagnose the issue?
63
+ - Are errors propagated correctly (not swallowed silently)?
64
+ - Are edge cases handled (empty input, null values, boundary conditions)?
65
+
66
+ ### 5. TESTS — Evaluate Coverage
67
+
68
+ - Does every new public function have corresponding tests?
69
+ - Do tests cover both success and failure paths?
70
+ - Are edge cases tested (empty, null, boundary, error conditions)?
71
+ - Do tests verify behavior, not implementation details?
72
+
73
+ ### 6. QUALITY — Assess Maintainability
74
+
75
+ - Is naming consistent with the existing codebase conventions?
76
+ - Are there code duplication opportunities that should be extracted?
77
+ - Is the complexity justified by the requirements?
78
+ - Are comments present where logic is non-obvious (and absent where code is self-evident)?
79
+
80
+ ## Critical Issues — Block Phase Sign-Off
81
+
82
+ These categories MUST be resolved before the phase can be marked complete:
83
+
84
+ | Severity | Category | Example |
85
+ |----------|----------|---------|
86
+ | **Blocker** | Security vulnerability | SQL injection, XSS, hardcoded secrets |
87
+ | **Blocker** | Broken interface | Public API returns wrong type, missing required field |
88
+ | **Blocker** | Missing error handling | Unhandled promise rejection, swallowed exceptions on I/O |
89
+ | **Blocker** | Data loss risk | Destructive operation without confirmation, missing transaction |
90
+ | **High** | Performance regression | O(n^2) where O(n) is trivial, unbounded memory allocation |
91
+ | **High** | Missing critical tests | No tests for error paths, no tests for new public API |
92
+ | **Medium** | Naming inconsistency | Convention mismatch with existing codebase |
93
+ | **Medium** | Dead code | Unreachable branches, unused imports, commented-out code |
94
+
95
+ **Blocker and High severity issues block sign-off. Medium issues should be filed for follow-up.**
96
+
97
+ ## Common Rationalizations — REJECT THESE
98
+
99
+ | Excuse | Why It Violates the Rule |
100
+ |--------|--------------------------|
101
+ | "Tests pass, so the code is fine" | Tests verify behavior, not code quality. Review is separate. |
102
+ | "I wrote it, so I know it's correct" | Author bias is real. Review as if someone else wrote it. |
103
+ | "It's just a small change" | Small changes cause large outages. Review proportional effort, not zero effort. |
104
+ | "We'll clean it up later" | "Later" accumulates. Fix blockers now, file medium issues. |
105
+ | "The deadline is tight" | Shipping broken code costs more time than reviewing. |
106
+ | "Generated code doesn't need review" | Generated code has the same bugs. Review it. |
107
+
108
+ ## Red Flags — STOP If You Catch Yourself:
109
+
110
+ - Skipping files because they "look fine" from the diff stat
111
+ - Approving without reading the actual code changes
112
+ - Ignoring a gut feeling that something is wrong
113
+ - Rushing through review to meet a deadline
114
+ - Assuming tests cover everything without checking
115
+ - Skipping error handling review because "the happy path works"
116
+
117
+ **If any red flag triggers: STOP. Go back to step 1 (SCOPE) and review properly.**
118
+
119
+ ## Verification Checklist
120
+
121
+ Before signing off on a phase, confirm:
122
+
123
+ - [ ] All changed files have been reviewed (not just the "important" ones)
124
+ - [ ] No security vulnerabilities found (or all found issues resolved)
125
+ - [ ] Public interfaces match their contracts and documentation
126
+ - [ ] Error handling covers all external calls and edge cases
127
+ - [ ] Test coverage exists for new public functions and error paths
128
+ - [ ] Naming and style are consistent with codebase conventions
129
+ - [ ] No blocker or high severity issues remain open
130
+
131
+ ## Review Output Format
132
+
133
+ Produce a review summary for phase documentation:
134
+
135
+ ```
136
+ REVIEW SCOPE: [number] files changed, [number] additions, [number] deletions
137
+ SECURITY: PASS | ISSUES FOUND (list)
138
+ INTERFACES: PASS | ISSUES FOUND (list)
139
+ ERROR HANDLING: PASS | ISSUES FOUND (list)
140
+ TEST COVERAGE: PASS | GAPS FOUND (list)
141
+ QUALITY: PASS | ISSUES FOUND (list)
142
+ VERDICT: APPROVED | BLOCKED (list blocking issues)
143
+ ```
144
+
145
+ ## In MAXSIM Plan Execution
146
+
147
+ Code review applies at phase boundaries:
148
+ - After all tasks in a phase are complete, run this review before marking the phase done
149
+ - Blocking issues must be resolved before phase completion
150
+ - Medium issues should be captured as todos for the next phase
151
+ - The review summary should be included in the phase SUMMARY.md
@@ -0,0 +1,174 @@
1
+ ---
2
+ name: memory-management
3
+ description: Use when encountering recurring patterns, errors, or decisions that should persist across sessions — defines when and how to save to project memory
4
+ ---
5
+
6
+ # Memory Management
7
+
8
+ Context dies with each session. Patterns discovered but not saved are patterns lost.
9
+
10
+ **If you encountered it twice, save it. You will encounter it again.**
11
+
12
+ ## The Iron Law
13
+
14
+ <HARD-GATE>
15
+ RECURRING PATTERNS MUST BE PERSISTED.
16
+ If you have seen the same error, pattern, or decision twice in this session or across sessions, you MUST save it.
17
+ "I'll remember" is a lie — your context resets. Write it down.
18
+ Violating this rule guarantees repeated mistakes across sessions.
19
+ </HARD-GATE>
20
+
21
+ ## When to Save
22
+
23
+ ### Auto-Save Triggers (MUST save)
24
+
25
+ These situations require immediate memory persistence:
26
+
27
+ | Trigger | Threshold | What to Save |
28
+ |---------|-----------|-------------|
29
+ | Same error encountered | 2+ occurrences | Error pattern, root cause, fix |
30
+ | Same debugging path followed | 2+ times | The shortcut or solution |
31
+ | Architectural decision made | Once (if significant) | Decision, rationale, alternatives rejected |
32
+ | Non-obvious convention discovered | Once | The convention and where it applies |
33
+ | Workaround for tooling/framework quirk | Once | The quirk and the workaround |
34
+ | Project-specific pattern confirmed | 2+ uses | The pattern and when to apply it |
35
+
36
+ ### Do NOT Save
37
+
38
+ - Session-specific context (current task details, in-progress work)
39
+ - Information already in CLAUDE.md or project documentation
40
+ - Speculative conclusions from reading a single file
41
+ - Temporary workarounds that will be removed
42
+ - Obvious patterns that any developer would know
43
+
44
+ ## Where to Save
45
+
46
+ Memory files live in `.claude/memory/` (for Claude Code) or the equivalent runtime memory directory.
47
+
48
+ ### File Organization
49
+
50
+ ```
51
+ .claude/memory/
52
+ MEMORY.md # Index file — always loaded into context
53
+ patterns.md # Code patterns and conventions
54
+ errors.md # Error patterns and solutions
55
+ architecture.md # Architectural decisions and rationale
56
+ tooling.md # Tool quirks and workarounds
57
+ ```
58
+
59
+ - **MEMORY.md** is the index: keep it under 200 lines, link to topic files for details
60
+ - Topic files hold detailed notes organized by subject
61
+ - Use headers and bullet points for scannability
62
+
63
+ ### Memory Entry Format
64
+
65
+ Each entry should follow this structure:
66
+
67
+ ```markdown
68
+ ## [Short descriptive title]
69
+
70
+ **Context:** When this applies
71
+ **Pattern/Error:** What was observed
72
+ **Solution/Decision:** What to do about it
73
+ **Evidence:** How this was confirmed (dates, occurrences, test results)
74
+ ```
75
+
76
+ ## The Gate Function
77
+
78
+ When you encounter something worth remembering:
79
+
80
+ ### 1. DETECT — Recognize the Pattern
81
+
82
+ - Is this the same error/pattern you saw before?
83
+ - Is this a decision that will affect future work?
84
+ - Is this a non-obvious convention or quirk?
85
+
86
+ ### 2. CHECK — Avoid Duplicates
87
+
88
+ - Read the existing memory files first
89
+ - If the pattern is already documented, update it (don't duplicate)
90
+ - If it contradicts existing memory, investigate which is correct
91
+
92
+ ### 3. WRITE — Persist the Memory
93
+
94
+ - Add to the appropriate topic file
95
+ - Update MEMORY.md index if adding a new topic
96
+ - Keep entries concise — future you needs the answer, not the journey
97
+
98
+ ### 4. VERIFY — Confirm the Save
99
+
100
+ - Re-read the file to confirm the entry was written correctly
101
+ - Ensure the entry is actionable (someone reading it can act on it)
102
+
103
+ ## Error Pattern Detection
104
+
105
+ When debugging, track errors in a mental tally:
106
+
107
+ ```
108
+ Error seen once → Note it, move on
109
+ Error seen twice → Save to errors.md with pattern and fix
110
+ Error seen 3+ times → Save AND add to MEMORY.md index for immediate visibility
111
+ ```
112
+
113
+ ### What Makes a Good Error Memory
114
+
115
+ Good:
116
+ ```markdown
117
+ ## Vitest "cannot find module" for path aliases
118
+
119
+ **Context:** When running tests that import from `@maxsim/core`
120
+ **Error:** `Cannot find module '@maxsim/core/types'`
121
+ **Fix:** Add `resolve.alias` to `vitest.config.ts` matching tsconfig paths
122
+ **Evidence:** Hit 3 times across phases 01-03 (Feb 2026)
123
+ ```
124
+
125
+ Bad:
126
+ ```markdown
127
+ ## Test error
128
+ There was an error with tests. Fixed it by changing config.
129
+ ```
130
+
131
+ ## Common Rationalizations — REJECT THESE
132
+
133
+ | Excuse | Why It Violates the Rule |
134
+ |--------|--------------------------|
135
+ | "I'll remember this" | No you won't. Context resets. Write it down. |
136
+ | "It's too specific to save" | Specific is good. Generic memories are useless. |
137
+ | "Memory files are messy" | Organize them. Messy files > lost knowledge. |
138
+ | "This only applies to this project" | Project memory IS project-scoped. Save it. |
139
+ | "Someone else documented this" | If it's not in your memory files, you won't find it next session. |
140
+ | "I'll save it later" | You'll forget to. Save it now. |
141
+
142
+ ## Red Flags — STOP If You Catch Yourself:
143
+
144
+ - Encountering the same error for the second time without saving it
145
+ - Making the same architectural decision you made in a previous session
146
+ - Debugging a problem you already solved before
147
+ - Saying "I think we fixed this before" without finding the memory entry
148
+ - Leaving a session without updating memory for patterns discovered
149
+
150
+ **If any red flag triggers: STOP. Write the memory entry NOW, before continuing.**
151
+
152
+ ## Verification Checklist
153
+
154
+ Before ending a work session:
155
+
156
+ - [ ] All errors encountered 2+ times are saved to `errors.md`
157
+ - [ ] All significant decisions are saved to `architecture.md`
158
+ - [ ] All discovered patterns are saved to `patterns.md`
159
+ - [ ] MEMORY.md index is up to date
160
+ - [ ] No duplicate entries were created
161
+ - [ ] All entries follow the format (Context, Pattern, Solution, Evidence)
162
+
163
+ ## Integration with MAXSIM
164
+
165
+ During plan execution, the executor and researcher agents load memory files at startup:
166
+ - **Executor:** Reads MEMORY.md to avoid known pitfalls before implementing
167
+ - **Researcher:** Saves findings to memory for future phases
168
+ - **Debugger:** Checks error memories before starting investigation — the fix may already be known
169
+
170
+ Memory persistence happens at natural breakpoints:
171
+ - After resolving a bug (save to errors.md)
172
+ - After completing a phase (save patterns discovered)
173
+ - After making an architectural decision (save to architecture.md)
174
+ - At checkpoints (save current understanding before context resets)
@@ -0,0 +1,137 @@
1
+ ---
2
+ name: simplify
3
+ description: Use after implementation and before commit — requires reviewing changed code for reuse opportunities, quality issues, and unnecessary complexity
4
+ ---
5
+
6
+ # Simplify
7
+
8
+ Every line of code is a liability. Less code that does the same thing is always better.
9
+
10
+ **If you have not looked for ways to simplify, you are shipping the first draft.**
11
+
12
+ ## The Iron Law
13
+
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>
20
+
21
+ ## The Gate Function
22
+
23
+ After implementation is complete and tests pass, BEFORE committing:
24
+
25
+ ### 1. DIFF — Review What Changed
26
+
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
30
+
31
+ ```bash
32
+ # Review staged changes
33
+ git diff --staged
34
+ # Or all uncommitted changes
35
+ git diff
36
+ ```
37
+
38
+ ### 2. DUPLICATION — Find Reuse Opportunities
39
+
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?
44
+
45
+ **Rule of three:** If the same pattern appears three times, extract it. Two occurrences are acceptable.
46
+
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.**
55
+
56
+ ### 4. COMPLEXITY — Question Every Abstraction
57
+
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?
62
+
63
+ **The right amount of abstraction is the minimum needed for the current requirements.**
64
+
65
+ ### 5. CLARITY — Improve Readability
66
+
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?
71
+
72
+ ### 6. EFFICIENCY — Check for Obvious Issues
73
+
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?
78
+
79
+ **Only fix efficiency issues that are obvious. Do not optimize without evidence of a problem.**
80
+
81
+ ## Review Checklist
82
+
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 |
96
+
97
+ ## Common Rationalizations — REJECT THESE
98
+
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. |
107
+
108
+ ## Red Flags — STOP If You Catch Yourself:
109
+
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"
116
+
117
+ **If any red flag triggers: STOP. Review the diff again. Simplify before committing.**
118
+
119
+ ## Verification Checklist
120
+
121
+ Before committing, confirm:
122
+
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
130
+
131
+ ## In MAXSIM Plan Execution
132
+
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")