create-merlin-brain 3.2.0 → 3.3.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 (48) hide show
  1. package/bin/install.cjs +125 -12
  2. package/bin/merlin-cli.cjs +26 -0
  3. package/files/agents/code-organization-supervisor.md +1 -0
  4. package/files/agents/context-guardian.md +1 -0
  5. package/files/agents/docs-keeper.md +2 -1
  6. package/files/agents/dry-refactor.md +2 -1
  7. package/files/agents/elite-code-refactorer.md +1 -0
  8. package/files/agents/hardening-guard.md +2 -1
  9. package/files/agents/implementation-dev.md +2 -1
  10. package/files/agents/merlin-api-designer.md +1 -0
  11. package/files/agents/merlin-codebase-mapper.md +1 -0
  12. package/files/agents/merlin-debugger.md +1 -0
  13. package/files/agents/merlin-executor.md +1 -0
  14. package/files/agents/merlin-frontend.md +1 -0
  15. package/files/agents/merlin-integration-checker.md +1 -0
  16. package/files/agents/merlin-migrator.md +1 -0
  17. package/files/agents/merlin-milestone-auditor.md +1 -0
  18. package/files/agents/merlin-performance.md +1 -0
  19. package/files/agents/merlin-planner.md +2 -0
  20. package/files/agents/merlin-researcher.md +1 -0
  21. package/files/agents/merlin-reviewer.md +2 -0
  22. package/files/agents/merlin-security.md +2 -0
  23. package/files/agents/merlin-verifier.md +2 -0
  24. package/files/agents/merlin-work-verifier.md +1 -0
  25. package/files/agents/merlin.md +1 -0
  26. package/files/agents/ops-railway.md +2 -1
  27. package/files/agents/orchestrator-retrofit.md +1 -0
  28. package/files/agents/product-spec.md +3 -1
  29. package/files/agents/system-architect.md +3 -1
  30. package/files/agents/tests-qa.md +2 -1
  31. package/files/hooks/agent-sync.sh +44 -0
  32. package/files/hooks/lib/analytics.sh +74 -0
  33. package/files/hooks/lib/sights-check.sh +58 -0
  34. package/files/hooks/post-edit-logger.sh +33 -0
  35. package/files/hooks/pre-edit-sights-check.sh +38 -0
  36. package/files/hooks/session-end.sh +27 -0
  37. package/files/hooks/session-start.sh +31 -0
  38. package/files/hooks/stop-check.md +14 -0
  39. package/files/hooks/subagent-context.sh +36 -0
  40. package/files/hooks/task-completed-verify.md +14 -0
  41. package/files/hooks/task-completed-verify.sh +46 -0
  42. package/files/hooks/teammate-idle-verify.sh +41 -0
  43. package/files/loop/lib/sights.sh +15 -4
  44. package/files/loop/lib/teams.sh +143 -0
  45. package/files/loop/merlin-loop.sh +16 -0
  46. package/files/merlin/agents-sync.sh +163 -0
  47. package/files/merlin/analytics.sh +159 -0
  48. package/package.json +1 -1
package/bin/install.cjs CHANGED
@@ -742,7 +742,7 @@ async function install() {
742
742
  }
743
743
 
744
744
  // Step 0: Clean up legacy GSD/ccwiki artifacts
745
- logStep('0/9', 'Cleaning up legacy installations...');
745
+ logStep('0/10', 'Cleaning up legacy installations...');
746
746
  const cleaned = cleanupLegacy();
747
747
  if (cleaned.length > 0) {
748
748
  for (const item of cleaned) {
@@ -753,7 +753,7 @@ async function install() {
753
753
  }
754
754
 
755
755
  // Step 1: Install globally for instant startup across all terminals
756
- logStep('1/9', 'Installing globally (fast startup for all terminals)...');
756
+ logStep('1/10', 'Installing globally (fast startup for all terminals)...');
757
757
  try {
758
758
  const { execSync } = require('child_process');
759
759
  // Check if already installed globally and up-to-date
@@ -794,7 +794,7 @@ async function install() {
794
794
  }
795
795
 
796
796
  // Step 2: Create directories
797
- logStep('2/9', 'Creating directories...');
797
+ logStep('2/10', 'Creating directories...');
798
798
  ensureDir(CLAUDE_DIR);
799
799
  ensureDir(MERLIN_DIR);
800
800
  ensureDir(AGENTS_DIR);
@@ -802,7 +802,7 @@ async function install() {
802
802
  logSuccess('Directories created');
803
803
 
804
804
  // Step 3: Install Merlin core (workflows, references, templates)
805
- logStep('3/9', 'Installing Merlin workflows...');
805
+ logStep('3/10', 'Installing Merlin workflows...');
806
806
  const merlinSrc = path.join(filesDir, 'merlin');
807
807
  if (fs.existsSync(merlinSrc)) {
808
808
  const count = copyDirRecursive(merlinSrc, MERLIN_DIR);
@@ -812,7 +812,7 @@ async function install() {
812
812
  }
813
813
 
814
814
  // Step 4: Install agents
815
- logStep('4/9', 'Installing Merlin agents...');
815
+ logStep('4/10', 'Installing Merlin agents...');
816
816
  const agentsSrc = path.join(filesDir, 'agents');
817
817
  if (fs.existsSync(agentsSrc)) {
818
818
  const count = copyDirRecursive(agentsSrc, AGENTS_DIR);
@@ -822,7 +822,7 @@ async function install() {
822
822
  }
823
823
 
824
824
  // Step 5: Install commands
825
- logStep('5/9', 'Installing /merlin:* commands...');
825
+ logStep('5/10', 'Installing /merlin:* commands...');
826
826
  const commandsSrc = path.join(filesDir, 'commands', 'merlin');
827
827
  if (fs.existsSync(commandsSrc)) {
828
828
  const count = copyDirRecursive(commandsSrc, COMMANDS_DIR);
@@ -832,7 +832,7 @@ async function install() {
832
832
  }
833
833
 
834
834
  // Step 6: Install CLAUDE.md
835
- logStep('6/9', 'Configuring Claude Code...');
835
+ logStep('6/10', 'Configuring Claude Code...');
836
836
  const claudeMdSrc = path.join(filesDir, 'CLAUDE.md');
837
837
  const claudeMdDest = path.join(CLAUDE_DIR, 'CLAUDE.md');
838
838
 
@@ -844,7 +844,7 @@ async function install() {
844
844
  }
845
845
 
846
846
  // Step 7: Install Merlin Loop (autonomous orchestration)
847
- logStep('7/9', 'Installing Merlin Loop...');
847
+ logStep('7/10', 'Installing Merlin Loop...');
848
848
  const loopSrc = path.join(filesDir, 'loop');
849
849
  if (fs.existsSync(loopSrc)) {
850
850
  ensureDir(LOOP_DIR);
@@ -869,6 +869,119 @@ async function install() {
869
869
  logWarn('Merlin Loop not found in package');
870
870
  }
871
871
 
872
+ // Step 8: Install Claude Code hooks
873
+ logStep('8/10', 'Installing Claude Code hooks...');
874
+ const HOOKS_DIR = path.join(CLAUDE_DIR, 'hooks');
875
+ const hooksSrc = path.join(filesDir, 'hooks');
876
+ if (fs.existsSync(hooksSrc)) {
877
+ ensureDir(HOOKS_DIR);
878
+ const hookCount = copyDirRecursive(hooksSrc, HOOKS_DIR);
879
+ // Make all .sh files executable (top-level and lib/)
880
+ const makeShExecutable = (dir) => {
881
+ if (!fs.existsSync(dir)) return;
882
+ fs.readdirSync(dir, { withFileTypes: true }).forEach(entry => {
883
+ const fullPath = path.join(dir, entry.name);
884
+ if (entry.isDirectory()) {
885
+ makeShExecutable(fullPath);
886
+ } else if (entry.name.endsWith('.sh')) {
887
+ fs.chmodSync(fullPath, '755');
888
+ }
889
+ });
890
+ };
891
+ makeShExecutable(HOOKS_DIR);
892
+ logSuccess(`Installed ${hookCount} hook files`);
893
+
894
+ // Configure hooks in settings.local.json
895
+ const settingsPath = path.join(CLAUDE_DIR, 'settings.local.json');
896
+ let settings = {};
897
+ if (fs.existsSync(settingsPath)) {
898
+ try { settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8')); } catch (e) { settings = {}; }
899
+ }
900
+ settings.hooks = settings.hooks || {};
901
+
902
+ const addHookIfMissing = (hookArray, hookConfig) => {
903
+ const exists = hookArray.some(h => h.command === hookConfig.command);
904
+ if (!exists) hookArray.push(hookConfig);
905
+ return hookArray;
906
+ };
907
+
908
+ // SessionStart hook
909
+ settings.hooks.SessionStart = settings.hooks.SessionStart || [];
910
+ addHookIfMissing(settings.hooks.SessionStart, {
911
+ type: 'command',
912
+ command: 'bash ~/.claude/hooks/session-start.sh'
913
+ });
914
+
915
+ // SessionStart hook: Agent sync (background, runs at most once/hour)
916
+ addHookIfMissing(settings.hooks.SessionStart, {
917
+ type: 'command',
918
+ command: 'bash ~/.claude/hooks/agent-sync.sh'
919
+ });
920
+
921
+ // PreToolUse hook (Edit/Write only)
922
+ settings.hooks.PreToolUse = settings.hooks.PreToolUse || [];
923
+ addHookIfMissing(settings.hooks.PreToolUse, {
924
+ type: 'command',
925
+ command: 'bash ~/.claude/hooks/pre-edit-sights-check.sh',
926
+ matcher: 'Edit|Write'
927
+ });
928
+
929
+ // PostToolUse hook (Edit/Write only)
930
+ settings.hooks.PostToolUse = settings.hooks.PostToolUse || [];
931
+ addHookIfMissing(settings.hooks.PostToolUse, {
932
+ type: 'command',
933
+ command: 'bash ~/.claude/hooks/post-edit-logger.sh',
934
+ matcher: 'Edit|Write'
935
+ });
936
+
937
+ // Stop hook (session end)
938
+ settings.hooks.Stop = settings.hooks.Stop || [];
939
+ addHookIfMissing(settings.hooks.Stop, {
940
+ type: 'command',
941
+ command: 'bash ~/.claude/hooks/session-end.sh'
942
+ });
943
+
944
+ // TeammateIdle hook (Agent Teams quality gate — only fires when Teams active)
945
+ settings.hooks.TeammateIdle = settings.hooks.TeammateIdle || [];
946
+ addHookIfMissing(settings.hooks.TeammateIdle, {
947
+ type: 'command',
948
+ command: 'bash ~/.claude/hooks/teammate-idle-verify.sh'
949
+ });
950
+
951
+ // SubagentStart hook (Agent Teams context injection — only fires when Teams active)
952
+ settings.hooks.SubagentStart = settings.hooks.SubagentStart || [];
953
+ addHookIfMissing(settings.hooks.SubagentStart, {
954
+ type: 'command',
955
+ command: 'bash ~/.claude/hooks/subagent-context.sh'
956
+ });
957
+
958
+ // --- Prompt-based hooks (LLM evaluates .md content) ---
959
+ const addPromptHookIfMissing = (hookArray, hookConfig) => {
960
+ const exists = hookArray.some(h => h.type === 'prompt' && h.prompt === hookConfig.prompt);
961
+ if (!exists) hookArray.push(hookConfig);
962
+ return hookArray;
963
+ };
964
+
965
+ // Prompt-based Stop hook: quality gate before session ends
966
+ addPromptHookIfMissing(settings.hooks.Stop, {
967
+ type: 'prompt',
968
+ prompt: fs.readFileSync(path.join(HOOKS_DIR, 'stop-check.md'), 'utf8')
969
+ });
970
+
971
+ // Prompt-based Notification hook: verify task completion quality
972
+ settings.hooks.Notification = settings.hooks.Notification || [];
973
+ addPromptHookIfMissing(settings.hooks.Notification, {
974
+ type: 'prompt',
975
+ prompt: fs.readFileSync(path.join(HOOKS_DIR, 'task-completed-verify.md'), 'utf8'),
976
+ matcher: 'task_completed'
977
+ });
978
+
979
+ fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
980
+ logSuccess('Configured hooks in settings.local.json');
981
+ } else {
982
+ logWarn('Hooks not found in package');
983
+ }
984
+
872
985
  // Helper: create MCP config object based on available binary
873
986
  function mcpConfig(apiKey, includeType) {
874
987
  const cfg = useGlobalBinary
@@ -879,8 +992,8 @@ async function install() {
879
992
  return cfg;
880
993
  }
881
994
 
882
- // Step 8: Optional Merlin Sights configuration
883
- logStep('8/9', 'Optional: Merlin Sights configuration...');
995
+ // Step 9: Optional Merlin Sights configuration
996
+ logStep('9/10', 'Optional: Merlin Sights configuration...');
884
997
  console.log(`Merlin Sights provides instant codebase context.`);
885
998
  console.log(`Get your API key at: ${colors.cyan}https://merlin.build${colors.reset}`);
886
999
 
@@ -978,8 +1091,8 @@ async function install() {
978
1091
  logWarn('Skipped Merlin Sights (you can configure it later)');
979
1092
  }
980
1093
 
981
- // Step 9: Set up shell integration
982
- logStep('9/9', 'Setting up shell integration...');
1094
+ // Step 10: Set up shell integration
1095
+ logStep('10/10', 'Setting up shell integration...');
983
1096
  const shellConfigured = setupShellIntegration();
984
1097
  if (shellConfigured) {
985
1098
  log(`\n ${colors.yellow}IMPORTANT:${colors.reset} Run ${colors.cyan}source ~/.zshrc${colors.reset} or ${colors.bright}restart your terminal${colors.reset}`);
@@ -363,6 +363,8 @@ Usage:
363
363
  merlin brief Get project overview
364
364
  merlin rules Get coding rules
365
365
  merlin files <purpose> Find files by purpose
366
+ merlin analytics [cmd] View session analytics (summary|compare|upload|clean)
367
+ merlin agents [cmd] Manage agents (sync|list|info <name>)
366
368
 
367
369
  Environment:
368
370
  MERLIN_API_KEY Your merlin.build API key
@@ -405,6 +407,30 @@ async function main() {
405
407
  case 'status':
406
408
  await status();
407
409
  break;
410
+ case 'analytics': {
411
+ const analyticsScript = path.join(process.env.HOME || '', '.claude', 'merlin', 'analytics.sh');
412
+ if (!fs.existsSync(analyticsScript)) {
413
+ console.error('Analytics not installed. Run: npx create-merlin-brain');
414
+ process.exit(1);
415
+ }
416
+ const analyticsArgs = args.slice(1).map(a => `"${a}"`).join(' ');
417
+ try {
418
+ execSync(`bash "${analyticsScript}" ${analyticsArgs}`, { stdio: 'inherit' });
419
+ } catch { process.exit(1); }
420
+ break;
421
+ }
422
+ case 'agents': {
423
+ const agentsSyncScript = path.join(process.env.HOME || '', '.claude', 'merlin', 'agents-sync.sh');
424
+ if (!fs.existsSync(agentsSyncScript)) {
425
+ console.error('Agents sync not installed. Run: npx create-merlin-brain');
426
+ process.exit(1);
427
+ }
428
+ const agentsArgs = args.slice(1).map(a => `"${a}"`).join(' ');
429
+ try {
430
+ execSync(`bash "${agentsSyncScript}" ${agentsArgs}`, { stdio: 'inherit' });
431
+ } catch { process.exit(1); }
432
+ break;
433
+ }
408
434
  case 'help':
409
435
  case '--help':
410
436
  case '-h':
@@ -3,6 +3,7 @@ name: code-organization-supervisor
3
3
  description: Use this agent when you need to ensure code quality standards are maintained, specifically monitoring file sizes and project organization. This agent should be used proactively after code is written or modified to check for files exceeding 400 lines, after creating new files to ensure proper folder structure, when the codebase needs reorganization, or when you suspect files have grown too large. Examples:\n\n<example>\nContext: The user has just finished implementing a large feature that added significant code to a file.\nuser: "Add user authentication with login, registration, password reset, and session management"\nassistant: "I've implemented the authentication system. Here's what was added:"\n<implementation details>\nassistant: "Now let me use the code-organization-supervisor agent to check if any files have exceeded the 400-line limit and ensure the code is properly organized."\n<commentary>\nSince significant code was just added, use the code-organization-supervisor agent to verify file sizes and organization standards are maintained.\n</commentary>\n</example>\n\n<example>\nContext: The user is working on a growing project and wants to ensure code organization standards.\nuser: "Can you check if our codebase is well organized?"\nassistant: "I'll use the code-organization-supervisor agent to analyze the codebase structure and file sizes."\n<commentary>\nThe user is explicitly asking about code organization, so use the code-organization-supervisor agent to perform a comprehensive review.\n</commentary>\n</example>\n\n<example>\nContext: After multiple development sessions, the codebase may have accumulated large files.\nuser: "I've been coding for a while, let's make sure everything is clean"\nassistant: "I'll launch the code-organization-supervisor agent to review the codebase for any files exceeding 400 lines and verify the folder structure is logical and maintainable."\n<commentary>\nProactive maintenance request - use the code-organization-supervisor agent to audit and refactor as needed.\n</commentary>\n</example>
4
4
  model: haiku
5
5
  color: blue
6
+ version: "1.0.0"
6
7
  ---
7
8
 
8
9
  You are an elite Code Organization Supervisor with deep expertise in software architecture, clean code principles, and maintainable project structures. Your primary mission is to ensure codebases remain organized, readable, and maintainable by enforcing strict file size limits and logical folder hierarchies.
@@ -4,6 +4,7 @@ description: Use this agent when starting new development work, before implement
4
4
  tools: Glob, Grep, Read, WebFetch, TodoWrite, WebSearch
5
5
  model: haiku
6
6
  color: green
7
+ version: "1.0.0"
7
8
  ---
8
9
 
9
10
  You are the Context Guardian, an expert project analyst and architectural advisor whose mission is to ensure developers have complete contextual awareness before writing any code. Your role is critical in preventing code duplication, maintaining architectural consistency, and maximizing reuse of existing functionality.
@@ -2,7 +2,8 @@
2
2
  name: docs-keeper
3
3
  description: Keeps claude.md documentation files up to date for each service or folder so AI agents always know what lives where and what does what.
4
4
  model: sonnet
5
- Color: green
5
+ color: green
6
+ version: "1.0.0"
6
7
  ---
7
8
 
8
9
  You are the Documentation Keeper for a vibe coded system.
@@ -2,7 +2,8 @@
2
2
  name: dry-refactor
3
3
  description: Keeps the codebase DRY, small, and maintainable by finding duplication, enforcing file size limits, and improving project structure.
4
4
  model: sonnet
5
- Color: purple
5
+ color: purple
6
+ version: "1.0.0"
6
7
  ---
7
8
 
8
9
  You are an elite Code Organization and DRY Supervisor with deep expertise in software architecture, clean code principles, and maintainable project structures.
@@ -3,6 +3,7 @@ name: elite-code-refactorer
3
3
  description: "Use this agent when you need to transform existing code into production-grade, enterprise-quality software. This includes when you want to: refactor a module or service to eliminate technical debt, ensure code is free from memory leaks and race conditions, restructure files exceeding 400 lines into well-organized smaller units, optimize a specific service's architecture before deployment, prepare code for production release with professional-grade standards, or when you need a thorough line-by-line code review with actionable improvements. This agent works best when focused on a single service or module at a time.\\n\\n<example>\\nContext: The user has completed implementing a new authentication service and wants it production-ready.\\nuser: \"I just finished the auth service, can you make sure it's production ready?\"\\nassistant: \"I'll use the elite-code-refactorer agent to perform a comprehensive refactoring pass on your authentication service, ensuring it meets production-grade standards.\"\\n<commentary>\\nSince the user wants production-ready code for a specific service, spawn the elite-code-refactorer agent via fresh process to perform deep analysis and refactoring of the auth service.\\n</commentary>\\n</example>\\n\\n<example>\\nContext: The user notices a file has grown too large during development.\\nuser: \"The UserService.ts file is getting pretty big, probably needs some cleanup\"\\nassistant: \"I'll launch the elite-code-refactorer agent to analyze UserService.ts and restructure it into a well-organized, maintainable architecture.\"\\n<commentary>\\nSince the user mentioned a file that likely exceeds size limits and needs cleanup, spawn the elite-code-refactorer agent via fresh process to break it down and optimize the structure.\\n</commentary>\\n</example>\\n\\n<example>\\nContext: The user is concerned about potential issues in their data processing module.\\nuser: \"Can you check the data-processor module for any potential issues? It handles concurrent requests.\"\\nassistant: \"I'll use the elite-code-refactorer agent to perform a deep analysis of your data-processor module, specifically looking for race conditions, memory leaks, and concurrency issues.\"\\n<commentary>\\nSince the user mentioned concurrent request handling which could have race conditions, spawn the elite-code-refactorer agent via fresh process to thoroughly audit and refactor the module.\\n</commentary>\\n</example>"
4
4
  model: opus
5
5
  color: green
6
+ version: "1.0.0"
6
7
  ---
7
8
 
8
9
  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.
@@ -2,7 +2,8 @@
2
2
  name: hardening-guard
3
3
  description: Reviews features for security, error handling, validation, and reliability to make them safer for real users and production use.
4
4
  model: sonnet
5
- Color: green
5
+ color: green
6
+ version: "1.0.0"
6
7
  ---
7
8
 
8
9
  You are the Hardening Guard.
@@ -2,7 +2,8 @@
2
2
  name: implementation-dev
3
3
  description: Implements features and changes across the codebase, following the architecture and reusing existing code whenever possible.
4
4
  model: sonnet
5
- Color: blue
5
+ color: blue
6
+ version: "1.0.0"
6
7
  ---
7
8
 
8
9
  You are the primary implementation developer working with a strong product minded vibe coder.
@@ -3,6 +3,7 @@ name: merlin-api-designer
3
3
  description: Designs clean, consistent REST and GraphQL APIs with proper documentation, versioning, and error handling.
4
4
  tools: Read, Write, Grep, Glob
5
5
  color: blue
6
+ version: "1.0.0"
6
7
  ---
7
8
 
8
9
  <role>
@@ -3,6 +3,7 @@ name: merlin-codebase-mapper
3
3
  description: Explores codebase and writes structured analysis documents. Spawned by map-codebase with a focus area (tech, arch, quality, concerns). Writes documents directly to reduce orchestrator context load.
4
4
  tools: Read, Bash, Grep, Glob, Write
5
5
  color: cyan
6
+ version: "1.0.0"
6
7
  ---
7
8
 
8
9
  <role>
@@ -3,6 +3,7 @@ name: merlin-debugger
3
3
  description: Investigates bugs using scientific method, manages debug sessions, handles checkpoints. Spawned by /merlin:debug orchestrator.
4
4
  tools: Read, Write, Edit, Bash, Grep, Glob, WebSearch
5
5
  color: orange
6
+ version: "1.0.0"
6
7
  ---
7
8
 
8
9
  <role>
@@ -3,6 +3,7 @@ name: merlin-executor
3
3
  description: Executes Merlin plans with atomic commits, deviation handling, checkpoint protocols, and state management. Spawned by execute-phase orchestrator or execute-plan command.
4
4
  tools: Read, Write, Edit, Bash, Grep, Glob
5
5
  color: yellow
6
+ version: "1.0.0"
6
7
  ---
7
8
 
8
9
  <role>
@@ -3,6 +3,7 @@ name: merlin-frontend
3
3
  description: Frontend specialist for React, Vue, and modern web development with focus on patterns, state management, and accessibility.
4
4
  tools: Read, Write, Grep, Glob, Bash
5
5
  color: cyan
6
+ version: "1.0.0"
6
7
  ---
7
8
 
8
9
  <role>
@@ -3,6 +3,7 @@ name: merlin-integration-checker
3
3
  description: Verifies cross-phase integration and E2E flows. Checks that phases connect properly and user workflows complete end-to-end.
4
4
  tools: Read, Bash, Grep, Glob
5
5
  color: blue
6
+ version: "1.0.0"
6
7
  ---
7
8
 
8
9
  <role>
@@ -3,6 +3,7 @@ name: merlin-migrator
3
3
  description: Plans and executes safe database schema migrations with rollback strategies and zero-downtime approaches.
4
4
  tools: Read, Write, Bash, Grep, Glob
5
5
  color: yellow
6
+ version: "1.0.0"
6
7
  ---
7
8
 
8
9
  <role>
@@ -3,6 +3,7 @@ name: merlin-milestone-auditor
3
3
  description: Orchestrates milestone-level verification. Spawns phase verifiers in parallel, runs integration checks, aggregates into MILESTONE-AUDIT.md.
4
4
  tools: Read, Bash, Grep, Glob, Task
5
5
  color: blue
6
+ version: "1.0.0"
6
7
  ---
7
8
 
8
9
  <role>
@@ -3,6 +3,7 @@ name: merlin-performance
3
3
  description: Analyzes code for performance issues and provides optimization recommendations with benchmarking guidance.
4
4
  tools: Read, Grep, Glob, Bash
5
5
  color: red
6
+ version: "1.0.0"
6
7
  ---
7
8
 
8
9
  <role>
@@ -3,6 +3,8 @@ name: merlin-planner
3
3
  description: Creates executable phase plans (PLAN.md files) with discovery, dependency graphs, and wave-based parallelization. Spawned by /merlin:plan-phase command.
4
4
  tools: Read, Write, Bash, Grep, Glob, AskUserQuestion, WebFetch, mcp__context7__*, mcp__merlin__merlin_get_context, mcp__merlin__merlin_search, mcp__merlin__merlin_find_files
5
5
  color: blue
6
+ version: "1.0.0"
7
+ disallowedTools: [Edit, Write, NotebookEdit, Bash]
6
8
  ---
7
9
 
8
10
  <role>
@@ -3,6 +3,7 @@ name: merlin-researcher
3
3
  description: Conducts comprehensive research using systematic methodology, source verification, and structured output. Spawned by /merlin:research-phase and /merlin:research-project orchestrators.
4
4
  tools: Read, Write, Bash, Grep, Glob, WebSearch, WebFetch, mcp__context7__*
5
5
  color: cyan
6
+ version: "1.0.0"
6
7
  ---
7
8
 
8
9
  <role>
@@ -3,6 +3,8 @@ name: merlin-reviewer
3
3
  description: Conducts thorough code reviews with actionable feedback on quality, patterns, security, and maintainability.
4
4
  tools: Read, Grep, Glob, Bash
5
5
  color: orange
6
+ version: "1.0.0"
7
+ disallowedTools: [Edit, Write, NotebookEdit]
6
8
  ---
7
9
 
8
10
  <role>
@@ -3,6 +3,8 @@ name: merlin-security
3
3
  description: Conducts deep security audits with OWASP awareness, threat modeling, and penetration testing mindset.
4
4
  tools: Read, Grep, Glob, Bash
5
5
  color: red
6
+ version: "1.0.0"
7
+ disallowedTools: [Edit, Write, NotebookEdit]
6
8
  ---
7
9
 
8
10
  <role>
@@ -3,6 +3,8 @@ name: merlin-verifier
3
3
  description: Verifies phase goal achievement through goal-backward analysis. Checks codebase delivers what phase promised, not just that tasks completed. Creates VERIFICATION.md report.
4
4
  tools: Read, Bash, Grep, Glob
5
5
  color: green
6
+ version: "1.0.0"
7
+ disallowedTools: [Edit, Write, NotebookEdit]
6
8
  ---
7
9
 
8
10
  <role>
@@ -3,6 +3,7 @@ name: merlin-work-verifier
3
3
  description: Validates built features through conversational UAT with persistent state. Spawned by /merlin:verify-work command.
4
4
  tools: Read, Bash, Grep, Glob, Edit, Write, AskUserQuestion
5
5
  color: green
6
+ version: "1.0.0"
6
7
  ---
7
8
 
8
9
  <role>
@@ -3,6 +3,7 @@ name: merlin
3
3
  description: The Merlin Brain - Master AI orchestrator. Routes to specialist agents, manages the full development pipeline, and uses Merlin Sights for cross-session memory.
4
4
  model: opus
5
5
  color: magenta
6
+ version: "1.0.0"
6
7
  ---
7
8
 
8
9
  # Merlin — Master Orchestrator
@@ -2,7 +2,8 @@
2
2
  name: ops-railway
3
3
  description: Manages deployment, environments, and configuration on Railway and Google Cloud in a pragmatic way.
4
4
  model: sonnet
5
- Color: red
5
+ color: red
6
+ version: "1.0.0"
6
7
  ---
7
8
 
8
9
  You are the ops and infrastructure guide focusing on Railway and Google Cloud for a small, fast moving team.
@@ -3,6 +3,7 @@ name: orchestrator-retrofit
3
3
  description: Orchestrator used to audit and improve existing projects by applying architecture, DRY, hardening, testing, and documentation standards. Supports an autonomous “GO mode” for fully automatic retrofitting.
4
4
  model: opus
5
5
  color: purple
6
+ version: "1.0.0"
6
7
  ---
7
8
 
8
9
  You are the retrofit orchestrator for existing projects that were already built, usually through vibe coding.
@@ -2,7 +2,9 @@
2
2
  name: product-spec
3
3
  description: Converts raw ideas into a lean, explicit product spec and user flows tailored for vibe coding and incremental delivery.
4
4
  model: opus
5
- Color: white
5
+ color: white
6
+ version: "1.0.0"
7
+ disallowedTools: [Edit, Write, NotebookEdit, Bash]
6
8
  ---
7
9
 
8
10
  You are a product specifier for a very strong product thinker and vibe coder.
@@ -2,7 +2,9 @@
2
2
  name: system-architect
3
3
  description: Designs simple, pragmatic architecture and service boundaries, avoiding over splitting while preventing tangled code.
4
4
  model: opus
5
- Color: Black
5
+ color: black
6
+ version: "1.0.0"
7
+ disallowedTools: [Edit, Write, NotebookEdit, Bash]
6
8
  ---
7
9
 
8
10
  You are a system architect for a vibe coder who tends to create many microservices.
@@ -2,7 +2,8 @@
2
2
  name: tests-qa
3
3
  description: Designs and implements lightweight but meaningful tests and manual QA flows for features and bug fixes.
4
4
  model: sonnet
5
- Color: yellow
5
+ color: yellow
6
+ version: "1.0.0"
6
7
  ---
7
8
 
8
9
  You are a tests and QA designer for a busy founder and vibe coder.
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env bash
2
+ # Merlin Hook: Agent Sync (SessionStart, background)
3
+ # Checks installed agents freshness and updates from cloud. Max once/hour.
4
+ set -euo pipefail
5
+ trap 'exit 0' ERR
6
+
7
+ AGENTS_DIR="${HOME}/.claude/agents"
8
+ MERLIN_DIR="${HOME}/.claude/merlin"
9
+ LAST_SYNC="${MERLIN_DIR}/.last-agent-sync"
10
+ API_URL="${MERLIN_API_URL:-https://api.merlin.build}"
11
+
12
+ [ -d "${AGENTS_DIR}" ] || exit 0
13
+
14
+ # Skip if synced within the last hour
15
+ if [ -f "${LAST_SYNC}" ]; then
16
+ last=$(cat "${LAST_SYNC}" 2>/dev/null || echo "0")
17
+ [ $(($(date +%s) - last)) -lt 3600 ] && exit 0
18
+ fi
19
+
20
+ sync_agents() {
21
+ local installed=""
22
+ for f in "${AGENTS_DIR}"/*.md; do
23
+ [ -f "${f}" ] || continue
24
+ local name hash
25
+ name=$(basename "${f}" .md)
26
+ hash=$(md5sum "${f}" 2>/dev/null | cut -c1-8 || md5 -q "${f}" 2>/dev/null | cut -c1-8 || echo "unknown")
27
+ installed="${installed}${name}:${hash},"
28
+ done
29
+ local response
30
+ response=$(curl -s --max-time 5 "${API_URL}/api/agents-sync/check?installed=${installed}" 2>/dev/null) || return 0
31
+ local stale_names
32
+ stale_names=$(echo "${response}" | grep -o '"name":"[^"]*"' | sed 's/"name":"//;s/"//' 2>/dev/null) || return 0
33
+ [ -z "${stale_names}" ] && { date +%s > "${LAST_SYNC}"; return 0; }
34
+ for agent_name in ${stale_names}; do
35
+ local content md_content
36
+ content=$(curl -s --max-time 5 "${API_URL}/api/agents-sync/${agent_name}" 2>/dev/null) || continue
37
+ md_content=$(echo "${content}" | python3 -c "import sys,json;print(json.load(sys.stdin).get('content',''))" 2>/dev/null) || continue
38
+ [ -n "${md_content}" ] && echo "${md_content}" > "${AGENTS_DIR}/${agent_name}.md"
39
+ done
40
+ date +%s > "${LAST_SYNC}"
41
+ }
42
+
43
+ sync_agents &
44
+ exit 0