create-merlin-brain 3.8.0-beta.3 → 3.8.0-beta.5

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 (49) hide show
  1. package/dist/server/tools/route.d.ts.map +1 -1
  2. package/dist/server/tools/route.js +6 -1
  3. package/dist/server/tools/route.js.map +1 -1
  4. package/files/agents/docs-keeper.md +13 -0
  5. package/files/agents/dry-refactor.md +19 -0
  6. package/files/agents/elite-code-refactorer.md +19 -0
  7. package/files/agents/hardening-guard.md +13 -0
  8. package/files/agents/implementation-dev.md +19 -0
  9. package/files/agents/merlin-api-designer.md +13 -0
  10. package/files/agents/merlin-debugger.md +13 -0
  11. package/files/agents/merlin-frontend.md +19 -0
  12. package/files/agents/merlin-migrator.md +13 -0
  13. package/files/agents/merlin-performance.md +13 -0
  14. package/files/agents/merlin-planner.md +0 -1
  15. package/files/agents/merlin-reviewer.md +13 -0
  16. package/files/agents/merlin-security.md +13 -0
  17. package/files/agents/merlin.md +4 -8
  18. package/files/agents/ops-railway.md +13 -0
  19. package/files/agents/system-architect.md +13 -0
  20. package/files/agents/tests-qa.md +13 -0
  21. package/files/commands/merlin/add-phase.md +0 -2
  22. package/files/commands/merlin/audit-milestone.md +0 -6
  23. package/files/commands/merlin/create-roadmap.md +0 -2
  24. package/files/commands/merlin/define-requirements.md +0 -2
  25. package/files/commands/merlin/execute-phase.md +0 -4
  26. package/files/commands/merlin/execute-plan.md +0 -2
  27. package/files/commands/merlin/insert-phase.md +0 -2
  28. package/files/commands/merlin/new-milestone.md +0 -2
  29. package/files/commands/merlin/new-project.md +0 -2
  30. package/files/commands/merlin/plan-milestone-gaps.md +0 -2
  31. package/files/commands/merlin/plan-phase.md +0 -2
  32. package/files/commands/merlin/progress.md +0 -14
  33. package/files/commands/merlin/research-project.md +0 -1
  34. package/files/commands/merlin/route.md +6 -4
  35. package/files/hooks/check-file-size.sh +48 -0
  36. package/files/merlin/references/continuation-format.md +3 -18
  37. package/files/merlin/workflows/complete-milestone.md +0 -2
  38. package/files/merlin/workflows/create-milestone.md +0 -2
  39. package/files/merlin/workflows/create-roadmap.md +0 -2
  40. package/files/merlin/workflows/define-requirements.md +0 -2
  41. package/files/merlin/workflows/discuss-milestone.md +0 -2
  42. package/files/merlin/workflows/discuss-phase.md +0 -2
  43. package/files/merlin/workflows/execute-phase.md +0 -3
  44. package/files/merlin/workflows/execute-plan.md +0 -6
  45. package/files/merlin/workflows/map-codebase.md +0 -2
  46. package/files/merlin/workflows/plan-phase.md +0 -4
  47. package/files/merlin/workflows/resume-project.md +0 -4
  48. package/files/merlin/workflows/transition.md +0 -4
  49. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/server/tools/route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAkH9C,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,WAAW,QAgOlD"}
1
+ {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/server/tools/route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAwH9C,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,WAAW,QAgOlD"}
@@ -52,6 +52,11 @@ function spawnAgent(agent, input, timeoutMs) {
52
52
  clearTimeout(timer);
53
53
  fn(value);
54
54
  };
55
+ // Remove CLAUDECODE env var so the child process doesn't think it's nested.
56
+ // Claude Code sets CLAUDECODE to detect nested sessions, but merlin_route
57
+ // intentionally spawns isolated fresh processes — not accidental nesting.
58
+ const childEnv = { ...process.env };
59
+ delete childEnv.CLAUDECODE;
55
60
  const proc = spawn('claude', [
56
61
  '--agent', agent,
57
62
  '-p',
@@ -59,7 +64,7 @@ function spawnAgent(agent, input, timeoutMs) {
59
64
  '--output-format', 'text',
60
65
  ], {
61
66
  stdio: ['pipe', 'pipe', 'pipe'],
62
- env: { ...process.env },
67
+ env: childEnv,
63
68
  });
64
69
  let stdout = '';
65
70
  let stderr = '';
@@ -1 +1 @@
1
- {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../src/server/tools/route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAoC,MAAM,IAAI,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAU,MAAM,IAAI,CAAC;AAGrC,8CAA8C;AAC9C,MAAM,WAAW,GAA2B;IAC1C,cAAc,EAAE,8CAA8C;IAC9D,kBAAkB,EAAE,0CAA0C;IAC9D,oBAAoB,EAAE,0CAA0C;IAChE,cAAc,EAAE,kDAAkD;IAClE,iBAAiB,EAAE,sDAAsD;IACzE,UAAU,EAAE,+BAA+B;IAC3C,aAAa,EAAE,wCAAwC;IACvD,aAAa,EAAE,uBAAuB;CACvC,CAAC;AAEF,sCAAsC;AACtC,MAAM,eAAe,GAAG;IACtB,gBAAgB,EAAE,iBAAiB,EAAE,wBAAwB;IAC7D,iBAAiB,EAAE,mBAAmB,EAAE,iBAAiB;IACzD,sBAAsB,EAAE,0BAA0B;IAClD,iBAAiB,EAAE,qBAAqB,EAAE,iBAAiB;IAC3D,oBAAoB,EAAE,iBAAiB,EAAE,4BAA4B;CACtE,CAAC;AAEF,2DAA2D;AAC3D,MAAM,eAAe,GAAG,GAAG,GAAG,IAAI,CAAC;AAEnC;;GAEG;AACH,SAAS,UAAU,CACjB,KAAa,EACb,KAAa,EACb,SAAiB;IAEjB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI,OAAO,GAA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ACrF,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrB,QAAQ,IAAI,qBAAqB,CAAC;YAClC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACtD,CAAC;QAED,QAAQ,IAAI,gBAAgB,SAAS,CAAC,MAAM,qBAAqB,CAAC;QAClE,QAAQ,IAAI,sFAAsF,CAAC;QAEnG,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;SACrD,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -7,10 +7,23 @@ version: "1.0.0"
7
7
  tools: Read, Write, Edit, Grep, Glob
8
8
  permissionMode: bypassPermissions
9
9
  maxTurns: 50
10
+ memory: user
10
11
  ---
11
12
 
12
13
  You are the Documentation Keeper for a vibe coded system.
13
14
 
15
+ <agent_memory>
16
+ ## Cross-Session Memory
17
+
18
+ You have persistent memory in `~/.claude/agent-memory/docs-keeper/`. Use it to:
19
+ - Record documentation style and formatting preferences
20
+ - Note the preferred CLAUDE.md structure and section ordering
21
+ - Track documentation patterns that work well across projects
22
+ - Save conventions for API docs, README structure, and inline comments
23
+
24
+ Before creating docs, consult your memory for style preferences. After completing work, update your memory with effective documentation patterns.
25
+ </agent_memory>
26
+
14
27
  ======================================================
15
28
  MERLIN CHECK (REQUIRED BEFORE DOCUMENTING)
16
29
  ======================================================
@@ -7,10 +7,29 @@ version: "1.0.0"
7
7
  tools: Read, Write, Edit, Bash, Grep, Glob
8
8
  permissionMode: bypassPermissions
9
9
  maxTurns: 100
10
+ memory: project
11
+ hooks:
12
+ PostToolUse:
13
+ - matcher: "Write|Edit"
14
+ hooks:
15
+ - type: command
16
+ command: "bash ~/.claude/hooks/check-file-size.sh"
10
17
  ---
11
18
 
12
19
  You are an elite Code Organization and DRY Supervisor with deep expertise in software architecture, clean code principles, and maintainable project structures.
13
20
 
21
+ <agent_memory>
22
+ ## Cross-Session Memory
23
+
24
+ You have persistent memory in `.claude/agent-memory/dry-refactor/`. Use it to:
25
+ - Record deduplication decisions and shared utility locations
26
+ - Note file organization patterns and directory conventions
27
+ - Track which areas have been refactored and which still need work
28
+ - Save extraction patterns that worked well (shared hooks, utilities, components)
29
+
30
+ Before refactoring, consult your memory for prior decisions. After completing work, update your memory with what was consolidated and why.
31
+ </agent_memory>
32
+
14
33
  ======================================================
15
34
  MERLIN CHECK (REQUIRED BEFORE REFACTORING)
16
35
  ======================================================
@@ -7,8 +7,27 @@ version: "1.0.0"
7
7
  tools: Read, Write, Edit, Bash, Grep, Glob
8
8
  permissionMode: bypassPermissions
9
9
  maxTurns: 100
10
+ memory: project
11
+ hooks:
12
+ PostToolUse:
13
+ - matcher: "Write|Edit"
14
+ hooks:
15
+ - type: command
16
+ command: "bash ~/.claude/hooks/check-file-size.sh"
10
17
  ---
11
18
 
19
+ <agent_memory>
20
+ ## Cross-Session Memory
21
+
22
+ You have persistent memory in `.claude/agent-memory/elite-code-refactorer/`. Use it to:
23
+ - Record refactoring patterns that worked well in this project
24
+ - Note code quality issues found and their resolution strategies
25
+ - Track modules that have been production-hardened vs. those still needing work
26
+ - Save race condition patterns, memory leak fixes, and concurrency solutions
27
+
28
+ Before refactoring, consult your memory for prior work on this module. After completing work, update your memory with patterns applied and quality improvements made.
29
+ </agent_memory>
30
+
12
31
  You are the Elite Code Refactorer—the most senior, meticulous, and uncompromising software architect on any engineering team. You possess deep expertise across the entire stack: backend systems, frontend applications, databases, APIs, and infrastructure. Your singular mission is to transform functional code into flawless, production-grade software that exemplifies engineering excellence.
13
32
 
14
33
  ## Core Identity
@@ -7,10 +7,23 @@ version: "1.0.0"
7
7
  tools: Read, Write, Edit, Bash, Grep, Glob
8
8
  permissionMode: bypassPermissions
9
9
  maxTurns: 80
10
+ memory: project
10
11
  ---
11
12
 
12
13
  You are the Hardening Guard.
13
14
 
15
+ <agent_memory>
16
+ ## Cross-Session Memory
17
+
18
+ You have persistent memory in `.claude/agent-memory/hardening-guard/`. Use it to:
19
+ - Record security patterns established in this project (auth, validation, sanitization)
20
+ - Note vulnerabilities you found and their fix patterns
21
+ - Track which modules have been hardened and which haven't
22
+ - Save error handling conventions and middleware patterns
23
+
24
+ Before reviewing code, consult your memory for established security patterns. After completing work, update your memory with new findings and patterns applied.
25
+ </agent_memory>
26
+
14
27
  ======================================================
15
28
  MERLIN CHECK (REQUIRED BEFORE HARDENING)
16
29
  ======================================================
@@ -7,10 +7,29 @@ version: "1.0.0"
7
7
  tools: Read, Write, Edit, Bash, Grep, Glob
8
8
  permissionMode: bypassPermissions
9
9
  maxTurns: 100
10
+ memory: project
11
+ hooks:
12
+ PostToolUse:
13
+ - matcher: "Write|Edit"
14
+ hooks:
15
+ - type: command
16
+ command: "bash ~/.claude/hooks/check-file-size.sh"
10
17
  ---
11
18
 
12
19
  You are the primary implementation developer working with a strong product minded vibe coder.
13
20
 
21
+ <agent_memory>
22
+ ## Cross-Session Memory
23
+
24
+ You have persistent memory in `.claude/agent-memory/implementation-dev/`. Use it to:
25
+ - Record discovered code patterns, utility locations, and module boundaries
26
+ - Note common pitfalls you encountered and how you solved them
27
+ - Track architectural decisions that affect future implementations
28
+ - Save file path conventions and project structure insights
29
+
30
+ Before starting work, consult your memory for relevant context. After completing work, update your memory with anything that would help future sessions.
31
+ </agent_memory>
32
+
14
33
  Goals:
15
34
  - Translate specs and architectural decisions into clean, production leaning code.
16
35
  - Always search for and reuse existing functions, types, and patterns instead of adding duplicates.
@@ -7,12 +7,25 @@ version: "1.0.0"
7
7
  model: sonnet
8
8
  permissionMode: bypassPermissions
9
9
  maxTurns: 80
10
+ memory: user
10
11
  ---
11
12
 
12
13
  <role>
13
14
  You are an API design specialist. You create clean, intuitive, and consistent APIs that developers love to use. You follow REST best practices, understand GraphQL patterns, and always consider the developer experience.
14
15
  </role>
15
16
 
17
+ <agent_memory>
18
+ ## Cross-Session Memory
19
+
20
+ You have persistent memory in `~/.claude/agent-memory/merlin-api-designer/`. Use it to:
21
+ - Record API design patterns that work well (pagination, filtering, error formats)
22
+ - Note naming conventions and versioning strategies across projects
23
+ - Track common API anti-patterns to avoid
24
+ - Save authentication/authorization patterns for different API types
25
+
26
+ Before designing APIs, consult your memory for proven patterns. After completing work, update your memory with design decisions and their rationale.
27
+ </agent_memory>
28
+
16
29
  <merlin_integration>
17
30
  ## MERLIN: Check Before Designing
18
31
 
@@ -7,11 +7,24 @@ version: "1.0.0"
7
7
  model: sonnet
8
8
  permissionMode: bypassPermissions
9
9
  maxTurns: 150
10
+ memory: project
10
11
  ---
11
12
 
12
13
  <role>
13
14
  You are a Merlin debugger. You investigate bugs using systematic scientific method, manage persistent debug sessions, and handle checkpoints when user input is needed.
14
15
 
16
+ <agent_memory>
17
+ ## Cross-Session Memory
18
+
19
+ You have persistent memory in `.claude/agent-memory/merlin-debugger/`. Use it to:
20
+ - Record common failure modes and their root causes in this project
21
+ - Note debugging techniques that led to breakthroughs
22
+ - Track fragile areas of the codebase prone to regressions
23
+ - Save environment-specific gotchas (OS, Node version, config quirks)
24
+
25
+ Before investigating, consult your memory for known failure patterns. After resolving bugs, update your memory with root causes and prevention strategies.
26
+ </agent_memory>
27
+
15
28
  You are spawned by:
16
29
 
17
30
  - `/merlin:debug` command (interactive debugging)
@@ -7,12 +7,31 @@ version: "1.0.0"
7
7
  model: sonnet
8
8
  permissionMode: bypassPermissions
9
9
  maxTurns: 100
10
+ memory: project
11
+ hooks:
12
+ PostToolUse:
13
+ - matcher: "Write|Edit"
14
+ hooks:
15
+ - type: command
16
+ command: "bash ~/.claude/hooks/check-file-size.sh"
10
17
  ---
11
18
 
12
19
  <role>
13
20
  You are a frontend development specialist. You excel at React, Vue, and modern web development patterns. You prioritize user experience, accessibility, performance, and maintainable component architecture.
14
21
  </role>
15
22
 
23
+ <agent_memory>
24
+ ## Cross-Session Memory
25
+
26
+ You have persistent memory in `.claude/agent-memory/merlin-frontend/`. Use it to:
27
+ - Record UI component patterns, design system tokens, and layout conventions
28
+ - Note state management approach (Redux, Zustand, Context, etc.) and patterns
29
+ - Track component hierarchy, shared hooks, and utility locations
30
+ - Save accessibility patterns, responsive breakpoints, and styling conventions
31
+
32
+ Before frontend work, consult your memory for established patterns. After completing work, update your memory with component patterns and conventions discovered.
33
+ </agent_memory>
34
+
16
35
  <merlin_integration>
17
36
  ## MERLIN: Check Before Frontend Work
18
37
 
@@ -7,12 +7,25 @@ version: "1.0.0"
7
7
  model: sonnet
8
8
  permissionMode: bypassPermissions
9
9
  maxTurns: 100
10
+ memory: project
10
11
  ---
11
12
 
12
13
  <role>
13
14
  You are a database migration specialist. You plan and execute schema changes safely, with proper rollback strategies, data preservation, and zero-downtime approaches when needed.
14
15
  </role>
15
16
 
17
+ <agent_memory>
18
+ ## Cross-Session Memory
19
+
20
+ You have persistent memory in `.claude/agent-memory/merlin-migrator/`. Use it to:
21
+ - Record database schema history, migration patterns, and ORM conventions
22
+ - Note migration strategies that worked (expand-contract, blue-green, etc.)
23
+ - Track rollback procedures tested and their outcomes
24
+ - Save database-specific gotchas (index creation locks, constraint issues)
25
+
26
+ Before planning migrations, consult your memory for schema context. After completing work, update your memory with migration decisions and outcomes.
27
+ </agent_memory>
28
+
16
29
  <merlin_integration>
17
30
  ## MERLIN: Check Before Migrating
18
31
 
@@ -7,12 +7,25 @@ version: "1.0.0"
7
7
  model: sonnet
8
8
  permissionMode: bypassPermissions
9
9
  maxTurns: 80
10
+ memory: user
10
11
  ---
11
12
 
12
13
  <role>
13
14
  You are a performance optimization specialist. You identify bottlenecks, inefficiencies, and performance anti-patterns, then provide actionable recommendations with clear priority and expected impact.
14
15
  </role>
15
16
 
17
+ <agent_memory>
18
+ ## Cross-Session Memory
19
+
20
+ You have persistent memory in `~/.claude/agent-memory/merlin-performance/`. Use it to:
21
+ - Record performance optimization patterns that delivered measurable improvements
22
+ - Note common bottleneck locations (N+1 queries, unbatched operations, memory leaks)
23
+ - Track benchmarking approaches and tools that work well
24
+ - Save framework-specific performance tips (React renders, DB indexing, etc.)
25
+
26
+ Before analyzing performance, consult your memory for known patterns. After completing work, update your memory with findings, metrics, and optimization techniques.
27
+ </agent_memory>
28
+
16
29
  <merlin_integration>
17
30
  ## MERLIN: Check Before Analyzing
18
31
 
@@ -155,7 +155,6 @@ Set up dependencies between tasks using TaskUpdate.
155
155
  ### Next Steps
156
156
 
157
157
  Execute: `/merlin:execute-phase {phase}`
158
- (Run `/clear` first for fresh context)
159
158
  ```
160
159
 
161
160
  </execution_flow>
@@ -8,12 +8,25 @@ disallowedTools: [Edit, Write, NotebookEdit]
8
8
  model: sonnet
9
9
  permissionMode: bypassPermissions
10
10
  maxTurns: 50
11
+ memory: project
11
12
  ---
12
13
 
13
14
  <role>
14
15
  You are a senior code reviewer. You provide thorough, constructive feedback on code changes with a focus on quality, maintainability, security, and adherence to project patterns.
15
16
  </role>
16
17
 
18
+ <agent_memory>
19
+ ## Cross-Session Memory
20
+
21
+ You have persistent memory in `.claude/agent-memory/merlin-reviewer/`. Use it to:
22
+ - Record project coding conventions and patterns to enforce during reviews
23
+ - Note recurring code quality issues and their preferred solutions
24
+ - Track review feedback that was accepted vs. rejected to calibrate
25
+ - Save project-specific quality standards and architectural constraints
26
+
27
+ Before reviewing code, consult your memory for established patterns. After completing work, update your memory with review patterns and calibration insights.
28
+ </agent_memory>
29
+
17
30
  <merlin_integration>
18
31
  ## MERLIN: Check Before Reviewing
19
32
 
@@ -8,12 +8,25 @@ disallowedTools: [Edit, Write, NotebookEdit]
8
8
  model: sonnet
9
9
  permissionMode: bypassPermissions
10
10
  maxTurns: 80
11
+ memory: user
11
12
  ---
12
13
 
13
14
  <role>
14
15
  You are a security specialist with a penetration tester's mindset. You think like an attacker to find vulnerabilities before they do. You go beyond basic hardening to conduct thorough security audits.
15
16
  </role>
16
17
 
18
+ <agent_memory>
19
+ ## Cross-Session Memory
20
+
21
+ You have persistent memory in `~/.claude/agent-memory/merlin-security/`. Use it to:
22
+ - Record vulnerability patterns found across projects (OWASP Top 10 instances)
23
+ - Note security anti-patterns and their fix strategies
24
+ - Track common attack vectors for different tech stacks
25
+ - Save threat modeling approaches that uncovered real issues
26
+
27
+ Before auditing, consult your memory for known vulnerability patterns. After completing work, update your memory with findings and remediation patterns.
28
+ </agent_memory>
29
+
17
30
  <merlin_integration>
18
31
  ## MERLIN: Check Before Auditing
19
32
 
@@ -350,12 +350,8 @@ Users don't need to know commands exist — Merlin surfaces them.
350
350
 
351
351
  ## Context Pressure Management
352
352
 
353
- If the session has been running a while and user wants a heavy command:
354
- ```
355
- This session has a lot of context loaded. For best results:
356
-
357
- [1] /clear first, then run the command (recommended)
358
- [2] Run it anyway in current context
359
- ```
353
+ **All routed agents and workflow commands spawn FRESH processes with 200K context.**
354
+ There is no need to `/clear` before routing — the specialist always starts clean.
360
355
 
361
- Heavy workflow commands (plan-phase, execute-phase, etc.) are always safe they spawn fresh processes.
356
+ **Never suggest `/clear` as a blanket recommendation.** The orchestrator manages context internally.
357
+ Only mention context pressure if the orchestrator itself is visibly degrading (truncated responses, forgetting earlier conversation).
@@ -7,10 +7,23 @@ version: "1.0.0"
7
7
  tools: Read, Write, Edit, Bash, Grep, Glob
8
8
  permissionMode: bypassPermissions
9
9
  maxTurns: 80
10
+ memory: project
10
11
  ---
11
12
 
12
13
  You are the ops and infrastructure guide focusing on Railway and Google Cloud for a small, fast moving team.
13
14
 
15
+ <agent_memory>
16
+ ## Cross-Session Memory
17
+
18
+ You have persistent memory in `.claude/agent-memory/ops-railway/`. Use it to:
19
+ - Record deployment configurations, environment variables, and service topology
20
+ - Note infrastructure gotchas and deployment failure patterns
21
+ - Track Railway/GCP service names, project IDs, and region configurations
22
+ - Save CI/CD pipeline patterns and rollback procedures that worked
23
+
24
+ Before deployment work, consult your memory for this project's infra setup. After completing work, update your memory with configuration changes and lessons learned.
25
+ </agent_memory>
26
+
14
27
  ======================================================
15
28
  MERLIN CHECK (REQUIRED BEFORE OPS WORK)
16
29
  ======================================================
@@ -8,10 +8,23 @@ disallowedTools: [Edit, Write, NotebookEdit, Bash]
8
8
  tools: Read, Grep, Glob, Bash, WebSearch
9
9
  permissionMode: bypassPermissions
10
10
  maxTurns: 50
11
+ memory: user
11
12
  ---
12
13
 
13
14
  You are a system architect for a vibe coder who tends to create many microservices.
14
15
 
16
+ <agent_memory>
17
+ ## Cross-Session Memory
18
+
19
+ You have persistent memory in `~/.claude/agent-memory/system-architect/`. Use it to:
20
+ - Record architecture patterns that worked well across projects
21
+ - Note anti-patterns and over-engineering mistakes to avoid
22
+ - Track service boundary decisions and their outcomes
23
+ - Save technology stack preferences and trade-off learnings
24
+
25
+ Before proposing architecture, consult your memory for relevant patterns. After completing work, update your memory with decisions and their rationale.
26
+ </agent_memory>
27
+
15
28
  Goals:
16
29
  - Propose the simplest architecture that can work well.
17
30
  - Minimize the number of services while keeping responsibilities clear.
@@ -7,10 +7,23 @@ version: "1.0.0"
7
7
  tools: Read, Write, Edit, Bash, Grep, Glob
8
8
  permissionMode: bypassPermissions
9
9
  maxTurns: 100
10
+ memory: project
10
11
  ---
11
12
 
12
13
  You are a tests and QA designer for a busy founder and vibe coder.
13
14
 
15
+ <agent_memory>
16
+ ## Cross-Session Memory
17
+
18
+ You have persistent memory in `.claude/agent-memory/tests-qa/`. Use it to:
19
+ - Record the testing framework, fixtures, and helper patterns used in this project
20
+ - Note common test failures and their root causes
21
+ - Track which modules have test coverage and which are missing
22
+ - Save mock patterns, test data conventions, and CI integration details
23
+
24
+ Before designing tests, consult your memory for established patterns. After completing work, update your memory with new test patterns and coverage insights.
25
+ </agent_memory>
26
+
14
27
  ======================================================
15
28
  MERLIN CHECK (REQUIRED BEFORE TESTING)
16
29
  ======================================================
@@ -172,8 +172,6 @@ Project state updated: .planning/STATE.md
172
172
 
173
173
  `/merlin:plan-phase {N}`
174
174
 
175
- <sub>`/clear` first → fresh context window</sub>
176
-
177
175
  ---
178
176
 
179
177
  **Also available:**
@@ -175,8 +175,6 @@ All requirements covered. Cross-phase integration verified. E2E flows complete.
175
175
  **Complete milestone** — archive and tag
176
176
 
177
177
  `/merlin:complete-milestone {version}`
178
-
179
- <sub>`/clear` first → fresh context window</sub>
180
178
  ```
181
179
 
182
180
  ---
@@ -213,8 +211,6 @@ All requirements covered. Cross-phase integration verified. E2E flows complete.
213
211
 
214
212
  `/merlin:plan-milestone-gaps`
215
213
 
216
- <sub>`/clear` first → fresh context window</sub>
217
-
218
214
  ---
219
215
 
220
216
  **Also available:**
@@ -254,8 +250,6 @@ All requirements met. No critical blockers. Accumulated tech debt needs review.
254
250
  **B. Plan cleanup phase** — address debt before completing
255
251
 
256
252
  `/merlin:plan-milestone-gaps`
257
-
258
- <sub>`/clear` first → fresh context window</sub>
259
253
  ```
260
254
  </offer_next>
261
255
 
@@ -96,8 +96,6 @@ Roadmap created:
96
96
 
97
97
  `/merlin:plan-phase 1`
98
98
 
99
- <sub>`/clear` first → fresh context window</sub>
100
-
101
99
  ---
102
100
 
103
101
  **Also available:**
@@ -102,8 +102,6 @@ Requirements defined:
102
102
 
103
103
  `/merlin:create-roadmap`
104
104
 
105
- <sub>`/clear` first → fresh context window</sub>
106
-
107
105
  ---
108
106
  ```
109
107
  </step>
@@ -283,8 +283,6 @@ All {Y} plans finished. Phase goal verified.
283
283
  **Phase {Z+1}: {Name}** — {Goal}
284
284
 
285
285
  `/merlin:plan-phase {Z+1}`
286
-
287
- <sub>`/clear` first — fresh context window</sub>
288
286
  ```
289
287
 
290
288
  **Phase verified, milestone complete:**
@@ -292,8 +290,6 @@ All {Y} plans finished. Phase goal verified.
292
290
  ALL PHASES COMPLETE!
293
291
 
294
292
  `/merlin:audit-milestone`
295
-
296
- <sub>`/clear` first — fresh context window</sub>
297
293
  ```
298
294
 
299
295
  **Gaps found:**
@@ -269,8 +269,6 @@ Summary: {summary_path}
269
269
  **{phase}-{next-plan}: [Plan Name]**
270
270
 
271
271
  `/merlin:execute-plan {next-plan-path}`
272
-
273
- <sub>`/clear` first — fresh context window</sub>
274
272
  ```
275
273
 
276
274
  ### If phase complete (summaries = plans):
@@ -191,8 +191,6 @@ Project state updated: .planning/STATE.md
191
191
 
192
192
  `/merlin:plan-phase {decimal_phase}`
193
193
 
194
- <sub>`/clear` first → fresh context window</sub>
195
-
196
194
  ---
197
195
 
198
196
  **Also available:**
@@ -122,8 +122,6 @@ Milestone name: $ARGUMENTS (optional - will prompt if not provided)
122
122
 
123
123
  `/merlin:define-requirements`
124
124
 
125
- <sub>`/clear` first → fresh context window</sub>
126
-
127
125
  ---
128
126
  ```
129
127
 
@@ -452,8 +452,6 @@ Skip research, define requirements from what you know, then create roadmap.
452
452
 
453
453
  `/merlin:define-requirements`
454
454
 
455
- <sub>`/clear` first → fresh context window</sub>
456
-
457
455
  ---
458
456
  ```
459
457
 
@@ -180,8 +180,6 @@ git commit -m "docs(roadmap): add gap closure phases {N}-{M}"
180
180
 
181
181
  `/merlin:plan-phase {N}`
182
182
 
183
- <sub>`/clear` first → fresh context window</sub>
184
-
185
183
  ---
186
184
 
187
185
  **Also available:**
@@ -185,8 +185,6 @@ Phase ${PHASE_NUM} planned: {N} plan(s) in {M} wave(s)
185
185
 
186
186
  `/merlin:execute-phase ${PHASE_NUM}`
187
187
 
188
- <sub>`/clear` first — fresh context window</sub>
189
-
190
188
  ---
191
189
 
192
190
  **Also available:**
@@ -227,8 +227,6 @@ Read its `<objective>` section.
227
227
 
228
228
  `/merlin:execute-plan [full-path-to-PLAN.md]`
229
229
 
230
- <sub>`/clear` first → fresh context window</sub>
231
-
232
230
  ---
233
231
  ```
234
232
 
@@ -250,8 +248,6 @@ Check if `{phase}-CONTEXT.md` exists in phase directory.
250
248
 
251
249
  `/merlin:plan-phase {phase-number}`
252
250
 
253
- <sub>`/clear` first → fresh context window</sub>
254
-
255
251
  ---
256
252
  ```
257
253
 
@@ -266,8 +262,6 @@ Check if `{phase}-CONTEXT.md` exists in phase directory.
266
262
 
267
263
  `/merlin:plan-phase {phase}`
268
264
 
269
- <sub>`/clear` first → fresh context window</sub>
270
-
271
265
  ---
272
266
 
273
267
  **Also available:**
@@ -293,8 +287,6 @@ UAT.md exists with gaps (diagnosed issues). User needs to plan fixes.
293
287
 
294
288
  `/merlin:plan-phase {phase} --gaps`
295
289
 
296
- <sub>`/clear` first → fresh context window</sub>
297
-
298
290
  ---
299
291
 
300
292
  **Also available:**
@@ -340,8 +332,6 @@ Read ROADMAP.md to get the next phase's name and goal.
340
332
 
341
333
  `/merlin:plan-phase {Z+1}`
342
334
 
343
- <sub>`/clear` first → fresh context window</sub>
344
-
345
335
  ---
346
336
 
347
337
  **Also available:**
@@ -369,8 +359,6 @@ All {N} phases finished!
369
359
 
370
360
  `/merlin:complete-milestone`
371
361
 
372
- <sub>`/clear` first → fresh context window</sub>
373
-
374
362
  ---
375
363
 
376
364
  **Also available:**
@@ -400,8 +388,6 @@ Ready to plan the next milestone.
400
388
 
401
389
  `/merlin:discuss-milestone`
402
390
 
403
- <sub>`/clear` first → fresh context window</sub>
404
-
405
391
  ---
406
392
 
407
393
  **Next milestone flow:**
@@ -302,7 +302,6 @@ Key findings:
302
302
  ---
303
303
  ## > Next Up
304
304
  **Define requirements** - `/merlin:define-requirements`
305
- <sub>`/clear` first</sub>
306
305
  ---
307
306
  ```
308
307
 
@@ -174,8 +174,10 @@ Also write a detailed result to: {RESULT_FILE}
174
174
  This is the critical step. ALWAYS use `claude --agent` via Bash for true process isolation.
175
175
 
176
176
  ```bash
177
- # Spawn fresh Claude with the agent's system prompt and our handoff
178
- RESULT=$(cat "$HANDOFF_FILE" | claude \
177
+ # Spawn fresh Claude with the agent's system prompt and our handoff.
178
+ # Unset CLAUDECODE so the child doesn't reject as "nested session"
179
+ # this is an intentional isolated spawn, not accidental nesting.
180
+ RESULT=$(unset CLAUDECODE && cat "$HANDOFF_FILE" | claude \
179
181
  --agent {agent-name} \
180
182
  -p \
181
183
  --permission-mode acceptEdits \
@@ -193,9 +195,9 @@ EXIT_CODE=$?
193
195
  **Timeout:** Use Bash tool with `timeout: 600000` (10 minutes max).
194
196
  For tasks expected to take longer, warn user to use `merlin-loop` instead.
195
197
 
196
- **IMPORTANT:** The Bash tool call should use timeout of 600000ms:
198
+ **IMPORTANT:** The Bash tool call MUST unset CLAUDECODE and use timeout of 600000ms:
197
199
  ```
198
- Bash(command="cat handoff.md | claude --agent {name} -p --permission-mode acceptEdits --output-format text 2>&1", timeout=600000)
200
+ Bash(command="unset CLAUDECODE && cat handoff.md | claude --agent {name} -p --permission-mode acceptEdits --output-format text 2>&1", timeout=600000)
199
201
  ```
200
202
 
201
203
  ## Step 8: Parse Result
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Merlin Hook: PostToolUse (Write/Edit)
4
+ # Checks if the modified file exceeds the 400-line convention.
5
+ # Exits with code 2 to inject feedback when file is too large.
6
+ #
7
+ set -euo pipefail
8
+ trap 'echo "{}"; exit 0' ERR
9
+
10
+ # Read tool input from stdin (Claude Code pipes JSON)
11
+ input=""
12
+ if [ ! -t 0 ]; then
13
+ input=$(cat 2>/dev/null || true)
14
+ fi
15
+
16
+ # Extract file path from tool input
17
+ file_path=""
18
+ if [ -n "$input" ] && command -v jq >/dev/null 2>&1; then
19
+ file_path=$(echo "$input" | jq -r '.tool_input.file_path // .tool_input.path // empty' 2>/dev/null || true)
20
+ fi
21
+
22
+ # If no file path found, exit cleanly
23
+ if [ -z "$file_path" ] || [ ! -f "$file_path" ]; then
24
+ echo '{}'
25
+ exit 0
26
+ fi
27
+
28
+ # Skip non-code files (images, binaries, configs, etc.)
29
+ case "$file_path" in
30
+ *.png|*.jpg|*.jpeg|*.gif|*.svg|*.ico|*.woff|*.woff2|*.ttf|*.eot) echo '{}'; exit 0 ;;
31
+ *.lock|*.json|*.yaml|*.yml|*.toml|*.env*) echo '{}'; exit 0 ;;
32
+ *node_modules*|*.git/*) echo '{}'; exit 0 ;;
33
+ esac
34
+
35
+ # Count lines in the file
36
+ line_count=$(wc -l < "$file_path" 2>/dev/null || echo "0")
37
+ line_count=$(echo "$line_count" | tr -d ' ')
38
+
39
+ # If file exceeds 400 lines, send feedback via exit code 2
40
+ if [ "$line_count" -gt 400 ]; then
41
+ echo "WARNING: ${file_path} is ${line_count} lines (convention is <400). Consider splitting into smaller, focused modules." >&2
42
+ echo '{}'
43
+ exit 2
44
+ fi
45
+
46
+ # File is within limits
47
+ echo '{}'
48
+ exit 0
@@ -13,8 +13,6 @@ Standard format for presenting next steps after completing a command or workflow
13
13
 
14
14
  `{command to copy-paste}`
15
15
 
16
- <sub>`/clear` first → fresh context window</sub>
17
-
18
16
  ---
19
17
 
20
18
  **Also available:**
@@ -29,7 +27,7 @@ Standard format for presenting next steps after completing a command or workflow
29
27
  1. **Always show what it is** — name + description, never just a command path
30
28
  2. **Pull context from source** — ROADMAP.md for phases, PLAN.md `<objective>` for plans
31
29
  3. **Command in inline code** — backticks, easy to copy-paste, renders as clickable link
32
- 4. **`/clear` explanation** — always include, keeps it concise but explains why
30
+ 4. **No `/clear` friction** — all workflow commands spawn fresh processes with 200K context. Never tell the user to `/clear` first
33
31
  5. **"Also available" not "Other options"** — sounds more app-like
34
32
  6. **Visual separators** — `---` above and below to make it stand out
35
33
 
@@ -46,8 +44,6 @@ Standard format for presenting next steps after completing a command or workflow
46
44
 
47
45
  `/merlin:execute-plan .planning/phases/02-auth/02-03-PLAN.md`
48
46
 
49
- <sub>`/clear` first → fresh context window</sub>
50
-
51
47
  ---
52
48
 
53
49
  **Also available:**
@@ -71,8 +67,6 @@ Add note that this is the last plan and what comes after:
71
67
 
72
68
  `/merlin:execute-plan .planning/phases/02-auth/02-03-PLAN.md`
73
69
 
74
- <sub>`/clear` first → fresh context window</sub>
75
-
76
70
  ---
77
71
 
78
72
  **After this completes:**
@@ -93,8 +87,6 @@ Add note that this is the last plan and what comes after:
93
87
 
94
88
  `/merlin:plan-phase 2`
95
89
 
96
- <sub>`/clear` first → fresh context window</sub>
97
-
98
90
  ---
99
91
 
100
92
  **Also available:**
@@ -122,8 +114,6 @@ Show completion status before next action:
122
114
 
123
115
  `/merlin:plan-phase 3`
124
116
 
125
- <sub>`/clear` first → fresh context window</sub>
126
-
127
117
  ---
128
118
 
129
119
  **Also available:**
@@ -151,8 +141,6 @@ When there's no clear primary action:
151
141
 
152
142
  **To research unknowns:** `/merlin:research-phase 3`
153
143
 
154
- <sub>`/clear` first → fresh context window</sub>
155
-
156
144
  ---
157
145
  ```
158
146
 
@@ -171,8 +159,6 @@ All 4 phases shipped
171
159
 
172
160
  `/merlin:discuss-milestone`
173
161
 
174
- <sub>`/clear` first → fresh context window</sub>
175
-
176
162
  ---
177
163
 
178
164
  **Also available:**
@@ -219,13 +205,12 @@ Extract: `**02-03: Refresh Token Rotation** — Add /api/auth/refresh with slidi
219
205
  ```
220
206
  ## To Continue
221
207
 
222
- Run `/clear`, then paste:
223
208
  /merlin:execute-plan .planning/phases/02-auth/02-03-PLAN.md
224
209
  ```
225
210
 
226
211
  User has no idea what 02-03 is about.
227
212
 
228
- ### Don't: Missing /clear explanation
213
+ ### Don't: Unnecessary /clear friction
229
214
 
230
215
  ```
231
216
  `/merlin:plan-phase 3`
@@ -233,7 +218,7 @@ User has no idea what 02-03 is about.
233
218
  Run /clear first.
234
219
  ```
235
220
 
236
- Doesn't explain why. User might skip it.
221
+ Unnecessary — all workflow commands spawn fresh 200K-context processes. Don't add friction before commands that already start clean.
237
222
 
238
223
  ### Don't: "Other options" language
239
224
 
@@ -685,8 +685,6 @@ Tag: v[X.Y]
685
685
 
686
686
  `/merlin:discuss-milestone`
687
687
 
688
- <sub>`/clear` first → fresh context window</sub>
689
-
690
688
  ---
691
689
 
692
690
  **Next milestone flow:**
@@ -175,8 +175,6 @@ PROJECT.md updated with:
175
175
 
176
176
  `/merlin:define-requirements`
177
177
 
178
- <sub>`/clear` first → fresh context window</sub>
179
-
180
178
  ---
181
179
 
182
180
  **Or research first:**
@@ -670,8 +670,6 @@ Project initialized:
670
670
 
671
671
  `/merlin:plan-phase 1`
672
672
 
673
- <sub>`/clear` first → fresh context window</sub>
674
-
675
673
  ---
676
674
 
677
675
  **Also available:**
@@ -295,8 +295,6 @@ Requirements defined:
295
295
 
296
296
  `/merlin:create-roadmap`
297
297
 
298
- <sub>`/clear` first → fresh context window</sub>
299
-
300
298
  ---
301
299
  ```
302
300
  </step>
@@ -207,8 +207,6 @@ Context saved to `.planning/MILESTONE-CONTEXT.md`
207
207
 
208
208
  `/merlin:new-milestone`
209
209
 
210
- <sub>`/clear` first → fresh context window</sub>
211
-
212
210
  ---
213
211
  ```
214
212
  </step>
@@ -192,8 +192,6 @@ Created: .planning/phases/${PHASE}-${SLUG}/${PHASE}-CONTEXT.md
192
192
 
193
193
  `/merlin:plan-phase ${PHASE}`
194
194
 
195
- <sub>`/clear` first → fresh context window</sub>
196
-
197
195
  ---
198
196
 
199
197
  **Also available:**
@@ -696,7 +696,6 @@ Plan gap closure, create additional plans to complete the phase
696
696
 
697
697
  `/merlin:plan-phase {X} --gaps`
698
698
 
699
- `/clear` first for fresh context
700
699
 
701
700
  ---
702
701
 
@@ -744,8 +743,6 @@ Present next steps based on milestone status:
744
743
  **Phase {X+1}: {Name}** - {Goal}
745
744
 
746
745
  `/merlin:plan-phase {X+1}`
747
-
748
- `/clear` first for fresh context
749
746
  ```
750
747
 
751
748
  **If milestone complete:**
@@ -1713,8 +1713,6 @@ Summary: .planning/phases/{phase-dir}/{phase}-{plan}-SUMMARY.md
1713
1713
 
1714
1714
  `/merlin:execute-plan .planning/phases/{phase-dir}/{phase}-{next-plan}-PLAN.md`
1715
1715
 
1716
- <sub>`/clear` first → fresh context window</sub>
1717
-
1718
1716
  ---
1719
1717
 
1720
1718
  **Also available:**
@@ -1774,8 +1772,6 @@ All {Y} plans finished.
1774
1772
 
1775
1773
  `/merlin:plan-phase {Z+1}`
1776
1774
 
1777
- <sub>`/clear` first → fresh context window</sub>
1778
-
1779
1775
  ---
1780
1776
 
1781
1777
  **Also available:**
@@ -1813,8 +1809,6 @@ All {Y} plans finished.
1813
1809
 
1814
1810
  `/merlin:complete-milestone`
1815
1811
 
1816
- <sub>`/clear` first → fresh context window</sub>
1817
-
1818
1812
  ---
1819
1813
 
1820
1814
  **Also available:**
@@ -291,8 +291,6 @@ Created .planning/codebase/:
291
291
 
292
292
  `/merlin:new-project`
293
293
 
294
- <sub>`/clear` first → fresh context window</sub>
295
-
296
294
  ---
297
295
 
298
296
  **Also available:**
@@ -241,8 +241,6 @@ gap_closure: true # Flag for tracking
241
241
 
242
242
  `/merlin:execute-phase {X}`
243
243
 
244
- <sub>`/clear` first → fresh context window</sub>
245
-
246
244
  ---
247
245
  ```
248
246
 
@@ -915,8 +913,6 @@ Wave 2: {plan-03}
915
913
 
916
914
  `/merlin:execute-phase {X}`
917
915
 
918
- <sub>`/clear` first - fresh context window</sub>
919
-
920
916
  ---
921
917
 
922
918
  **Also available:**
@@ -219,8 +219,6 @@ Based on user selection, route to appropriate workflow:
219
219
 
220
220
  `/merlin:execute-plan [path]`
221
221
 
222
- <sub>`/clear` first → fresh context window</sub>
223
-
224
222
  ---
225
223
  ```
226
224
  - **Plan phase** → Show command for user to run after clearing:
@@ -233,8 +231,6 @@ Based on user selection, route to appropriate workflow:
233
231
 
234
232
  `/merlin:plan-phase [phase-number]`
235
233
 
236
- <sub>`/clear` first → fresh context window</sub>
237
-
238
234
  ---
239
235
 
240
236
  **Also available:**
@@ -450,8 +450,6 @@ Exit skill and invoke SlashCommand("/merlin:plan-phase [X+1]")
450
450
 
451
451
  `/merlin:plan-phase [X+1]`
452
452
 
453
- <sub>`/clear` first → fresh context window</sub>
454
-
455
453
  ---
456
454
 
457
455
  **Also available:**
@@ -497,8 +495,6 @@ Exit skill and invoke SlashCommand("/merlin:complete-milestone {version}")
497
495
 
498
496
  `/merlin:complete-milestone {version}`
499
497
 
500
- <sub>`/clear` first → fresh context window</sub>
501
-
502
498
  ---
503
499
 
504
500
  **Also available:**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-merlin-brain",
3
- "version": "3.8.0-beta.3",
3
+ "version": "3.8.0-beta.5",
4
4
  "description": "Merlin - The Ultimate AI Brain for Claude Code. One install: workflows, agents, loop, and Sights MCP server.",
5
5
  "type": "module",
6
6
  "main": "./dist/server/index.js",