create-merlin-brain 3.10.0 → 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 (151) hide show
  1. package/bin/install.cjs +146 -22
  2. package/bin/runtime-adapters.cjs +396 -0
  3. package/dist/server/cost/tracker.d.ts +38 -2
  4. package/dist/server/cost/tracker.d.ts.map +1 -1
  5. package/dist/server/cost/tracker.js +87 -15
  6. package/dist/server/cost/tracker.js.map +1 -1
  7. package/dist/server/server.d.ts.map +1 -1
  8. package/dist/server/server.js +74 -30
  9. package/dist/server/server.js.map +1 -1
  10. package/dist/server/tools/adaptive.js +1 -1
  11. package/dist/server/tools/adaptive.js.map +1 -1
  12. package/dist/server/tools/agents-index.js +3 -3
  13. package/dist/server/tools/agents-index.js.map +1 -1
  14. package/dist/server/tools/agents.js +5 -5
  15. package/dist/server/tools/agents.js.map +1 -1
  16. package/dist/server/tools/behaviors.js +4 -4
  17. package/dist/server/tools/behaviors.js.map +1 -1
  18. package/dist/server/tools/context.js +7 -7
  19. package/dist/server/tools/context.js.map +1 -1
  20. package/dist/server/tools/cost.d.ts +3 -1
  21. package/dist/server/tools/cost.d.ts.map +1 -1
  22. package/dist/server/tools/cost.js +66 -13
  23. package/dist/server/tools/cost.js.map +1 -1
  24. package/dist/server/tools/discoveries.js +6 -6
  25. package/dist/server/tools/discoveries.js.map +1 -1
  26. package/dist/server/tools/index.d.ts +4 -0
  27. package/dist/server/tools/index.d.ts.map +1 -1
  28. package/dist/server/tools/index.js +4 -0
  29. package/dist/server/tools/index.js.map +1 -1
  30. package/dist/server/tools/learning.d.ts +12 -0
  31. package/dist/server/tools/learning.d.ts.map +1 -0
  32. package/dist/server/tools/learning.js +269 -0
  33. package/dist/server/tools/learning.js.map +1 -0
  34. package/dist/server/tools/project.js +7 -7
  35. package/dist/server/tools/project.js.map +1 -1
  36. package/dist/server/tools/promote.d.ts +11 -0
  37. package/dist/server/tools/promote.d.ts.map +1 -0
  38. package/dist/server/tools/promote.js +315 -0
  39. package/dist/server/tools/promote.js.map +1 -0
  40. package/dist/server/tools/route.d.ts.map +1 -1
  41. package/dist/server/tools/route.js +65 -24
  42. package/dist/server/tools/route.js.map +1 -1
  43. package/dist/server/tools/session-restore.d.ts +18 -0
  44. package/dist/server/tools/session-restore.d.ts.map +1 -0
  45. package/dist/server/tools/session-restore.js +154 -0
  46. package/dist/server/tools/session-restore.js.map +1 -0
  47. package/dist/server/tools/session-search.d.ts +16 -0
  48. package/dist/server/tools/session-search.d.ts.map +1 -0
  49. package/dist/server/tools/session-search.js +240 -0
  50. package/dist/server/tools/session-search.js.map +1 -0
  51. package/dist/server/tools/sights-index.js +2 -2
  52. package/dist/server/tools/sights-index.js.map +1 -1
  53. package/dist/server/tools/smart-route.d.ts.map +1 -1
  54. package/dist/server/tools/smart-route.js +4 -5
  55. package/dist/server/tools/smart-route.js.map +1 -1
  56. package/dist/server/tools/verification.js +1 -1
  57. package/dist/server/tools/verification.js.map +1 -1
  58. package/files/agents/code-organization-supervisor.md +9 -0
  59. package/files/agents/context-guardian.md +9 -0
  60. package/files/agents/docs-keeper.md +11 -1
  61. package/files/agents/dry-refactor.md +12 -1
  62. package/files/agents/elite-code-refactorer.md +10 -0
  63. package/files/agents/hardening-guard.md +13 -1
  64. package/files/agents/implementation-dev.md +12 -1
  65. package/files/agents/merlin-access-control-reviewer.md +248 -0
  66. package/files/agents/merlin-api-designer.md +9 -0
  67. package/files/agents/merlin-codebase-mapper.md +9 -1
  68. package/files/agents/merlin-debugger.md +10 -0
  69. package/files/agents/merlin-dependency-auditor.md +216 -0
  70. package/files/agents/merlin-executor.md +12 -1
  71. package/files/agents/merlin-frontend.md +9 -0
  72. package/files/agents/merlin-input-validator.md +247 -0
  73. package/files/agents/merlin-integration-checker.md +9 -1
  74. package/files/agents/merlin-migrator.md +9 -0
  75. package/files/agents/merlin-milestone-auditor.md +8 -0
  76. package/files/agents/merlin-performance.md +8 -0
  77. package/files/agents/merlin-planner.md +10 -0
  78. package/files/agents/merlin-researcher.md +10 -0
  79. package/files/agents/merlin-reviewer.md +42 -7
  80. package/files/agents/merlin-sast-reviewer.md +182 -0
  81. package/files/agents/merlin-secret-scanner.md +203 -0
  82. package/files/agents/merlin-security.md +9 -0
  83. package/files/agents/merlin-verifier.md +9 -0
  84. package/files/agents/merlin-work-verifier.md +9 -0
  85. package/files/agents/merlin.md +10 -0
  86. package/files/agents/ops-railway.md +11 -1
  87. package/files/agents/orchestrator-retrofit.md +9 -1
  88. package/files/agents/product-spec.md +11 -1
  89. package/files/agents/remotion.md +8 -0
  90. package/files/agents/system-architect.md +11 -1
  91. package/files/agents/tests-qa.md +12 -1
  92. package/files/commands/merlin/course-correct.md +219 -0
  93. package/files/commands/merlin/debug.md +2 -2
  94. package/files/commands/merlin/execute-phase.md +96 -199
  95. package/files/commands/merlin/execute-plan.md +118 -182
  96. package/files/commands/merlin/health.md +385 -0
  97. package/files/commands/merlin/loop-recipes.md +93 -36
  98. package/files/commands/merlin/map-codebase.md +4 -4
  99. package/files/commands/merlin/next.md +240 -0
  100. package/files/commands/merlin/optimize-prompts.md +158 -0
  101. package/files/commands/merlin/plan-phase.md +1 -1
  102. package/files/commands/merlin/profiles.md +215 -0
  103. package/files/commands/merlin/promote.md +176 -0
  104. package/files/commands/merlin/quick.md +229 -0
  105. package/files/commands/merlin/readiness-gate.md +208 -0
  106. package/files/commands/merlin/research-phase.md +2 -2
  107. package/files/commands/merlin/research-project.md +4 -4
  108. package/files/commands/merlin/resume-work.md +27 -1
  109. package/files/commands/merlin/route.md +43 -1
  110. package/files/commands/merlin/sandbox.md +359 -0
  111. package/files/commands/merlin/usage.md +55 -0
  112. package/files/commands/merlin/verify-work.md +1 -1
  113. package/files/docker/Dockerfile.merlin +20 -0
  114. package/files/docker/docker-compose.merlin.yml +23 -0
  115. package/files/hook-templates/auto-commit.sh +64 -0
  116. package/files/hook-templates/auto-format.sh +95 -0
  117. package/files/hook-templates/auto-test.sh +117 -0
  118. package/files/hook-templates/branch-protection.sh +72 -0
  119. package/files/hook-templates/changelog-reminder.sh +76 -0
  120. package/files/hook-templates/complexity-check.sh +112 -0
  121. package/files/hook-templates/import-audit.sh +83 -0
  122. package/files/hook-templates/license-header.sh +84 -0
  123. package/files/hook-templates/pr-description.sh +100 -0
  124. package/files/hook-templates/todo-tracker.sh +80 -0
  125. package/files/hooks/check-file-size.sh +17 -4
  126. package/files/hooks/config-change.sh +44 -16
  127. package/files/hooks/instructions-loaded.sh +22 -5
  128. package/files/hooks/notify-desktop.sh +157 -0
  129. package/files/hooks/notify-webhook.sh +141 -0
  130. package/files/hooks/pre-edit-sights-check.sh +76 -9
  131. package/files/hooks/security-scanner.sh +153 -0
  132. package/files/hooks/session-end-memory-sync.sh +97 -0
  133. package/files/hooks/session-end.sh +274 -1
  134. package/files/hooks/session-start.sh +19 -6
  135. package/files/hooks/smart-approve.sh +270 -0
  136. package/files/hooks/teammate-idle-verify.sh +87 -12
  137. package/files/hooks/worktree-create.sh +20 -3
  138. package/files/hooks/worktree-remove.sh +21 -3
  139. package/files/merlin/references/plan-format.md +37 -9
  140. package/files/merlin/sandbox.json +9 -0
  141. package/files/merlin/security.json +11 -0
  142. package/files/merlin/templates/ci/docs-update.yml +81 -0
  143. package/files/merlin/templates/ci/pr-review.yml +50 -0
  144. package/files/merlin/templates/ci/security-audit.yml +74 -0
  145. package/files/merlin/templates/config.json +9 -1
  146. package/files/rules/api-rules.md +30 -0
  147. package/files/rules/frontend-rules.md +25 -0
  148. package/files/rules/hooks-rules.md +36 -0
  149. package/files/rules/mcp-rules.md +30 -0
  150. package/files/rules/worker-rules.md +29 -0
  151. package/package.json +1 -1
@@ -0,0 +1,81 @@
1
+ # Merlin Docs Update
2
+ # Auto-updates documentation when code changes are pushed to main.
3
+ # Detects stale docs, updates them, and opens a PR.
4
+ #
5
+ # Setup:
6
+ # 1. Add ANTHROPIC_API_KEY to your repo secrets (Settings > Secrets > Actions)
7
+ # 2. Copy this file to .github/workflows/docs-update.yml
8
+ #
9
+ name: Merlin Docs Update
10
+
11
+ on:
12
+ push:
13
+ branches: [main]
14
+ paths:
15
+ # Trigger when source code changes (not docs themselves)
16
+ - 'src/**'
17
+ - 'app/**'
18
+ - 'lib/**'
19
+ - 'packages/**'
20
+ - '*.ts'
21
+ - '*.js'
22
+ - '*.py'
23
+ - '*.go'
24
+
25
+ jobs:
26
+ docs-update:
27
+ runs-on: ubuntu-latest
28
+ permissions:
29
+ contents: write
30
+ pull-requests: write
31
+
32
+ steps:
33
+ - name: Checkout
34
+ uses: actions/checkout@v4
35
+ with:
36
+ fetch-depth: 2
37
+ token: ${{ secrets.GITHUB_TOKEN }}
38
+
39
+ - name: Get changed files
40
+ id: changed
41
+ run: |
42
+ git diff --name-only HEAD~1 HEAD > /tmp/changed-files.txt
43
+ echo "Changed files:"
44
+ cat /tmp/changed-files.txt
45
+
46
+ - name: Merlin Docs Update
47
+ uses: anthropics/claude-code-action@v1
48
+ with:
49
+ anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
50
+ prompt: |
51
+ The following files changed in the last commit (see /tmp/changed-files.txt):
52
+
53
+ Review the changed source files and identify any documentation that is now stale or missing.
54
+
55
+ Update documentation as needed:
56
+ - README.md — if public API, CLI commands, or setup steps changed
57
+ - docs/ files — if architecture, guides, or references are affected
58
+ - Inline JSDoc/comments — if function signatures or behavior changed
59
+
60
+ Rules:
61
+ - Only update docs that are genuinely stale due to the code changes
62
+ - Do not rewrite docs that are still accurate
63
+ - Keep the existing writing style and tone
64
+ - If no docs need updating, output: "No documentation updates needed."
65
+
66
+ After making changes, summarize what you updated and why.
67
+
68
+ - name: Create PR if docs changed
69
+ uses: peter-evans/create-pull-request@v6
70
+ with:
71
+ token: ${{ secrets.GITHUB_TOKEN }}
72
+ commit-message: 'docs: auto-update documentation for recent changes'
73
+ title: 'docs: auto-update documentation'
74
+ body: |
75
+ Automated documentation update triggered by changes to source files.
76
+
77
+ This PR was generated by the Merlin Docs Update workflow.
78
+ Review the changes and merge if accurate.
79
+ branch: merlin/docs-update-${{ github.run_number }}
80
+ delete-branch: true
81
+ labels: documentation,automated
@@ -0,0 +1,50 @@
1
+ # Merlin PR Review
2
+ # Automatically reviews pull requests for code quality, security, and correctness.
3
+ #
4
+ # Setup:
5
+ # 1. Add ANTHROPIC_API_KEY to your repo secrets (Settings > Secrets > Actions)
6
+ # 2. Copy this file to .github/workflows/pr-review.yml
7
+ #
8
+ name: Merlin PR Review
9
+
10
+ on:
11
+ pull_request:
12
+ types: [opened, synchronize, reopened]
13
+
14
+ jobs:
15
+ review:
16
+ runs-on: ubuntu-latest
17
+ permissions:
18
+ contents: read
19
+ pull-requests: write
20
+
21
+ steps:
22
+ - name: Checkout
23
+ uses: actions/checkout@v4
24
+ with:
25
+ fetch-depth: 0
26
+
27
+ - name: Merlin PR Review
28
+ uses: anthropics/claude-code-action@v1
29
+ with:
30
+ anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
31
+ prompt: |
32
+ Review this pull request. Be concise and constructive.
33
+
34
+ Check for:
35
+ - Code quality and clarity
36
+ - Security issues (secrets, injections, auth gaps)
37
+ - Correctness (logic errors, edge cases, off-by-ones)
38
+ - Breaking changes or regressions
39
+ - Missing tests for critical paths
40
+
41
+ Format your review as:
42
+ **Summary:** [1-2 sentences]
43
+
44
+ **Issues:** (only list real problems, not style preferences)
45
+ - [file:line] [severity: critical/major/minor] [description]
46
+
47
+ **Suggestions:** (optional improvements, not blocking)
48
+ - [description]
49
+
50
+ If the PR looks good, say so clearly. Don't invent issues.
@@ -0,0 +1,74 @@
1
+ # Merlin Security Audit
2
+ # Runs a weekly security scan across the codebase using Claude Code.
3
+ # Also runs on demand via workflow_dispatch.
4
+ #
5
+ # Setup:
6
+ # 1. Add ANTHROPIC_API_KEY to your repo secrets (Settings > Secrets > Actions)
7
+ # 2. Copy this file to .github/workflows/security-audit.yml
8
+ #
9
+ name: Merlin Security Audit
10
+
11
+ on:
12
+ schedule:
13
+ # Every Monday at 09:00 UTC
14
+ - cron: '0 9 * * 1'
15
+ workflow_dispatch:
16
+ inputs:
17
+ scope:
18
+ description: 'Audit scope (all, auth, api, deps)'
19
+ required: false
20
+ default: 'all'
21
+
22
+ jobs:
23
+ security-audit:
24
+ runs-on: ubuntu-latest
25
+ permissions:
26
+ contents: read
27
+ issues: write
28
+
29
+ steps:
30
+ - name: Checkout
31
+ uses: actions/checkout@v4
32
+ with:
33
+ fetch-depth: 0
34
+
35
+ - name: Run dependency vulnerability scan
36
+ run: |
37
+ if [ -f package.json ]; then npm audit --json > /tmp/npm-audit.json 2>&1 || true; fi
38
+ if [ -f requirements.txt ]; then pip install safety && safety check --json > /tmp/pip-audit.json 2>&1 || true; fi
39
+
40
+ - name: Merlin Security Analysis
41
+ uses: anthropics/claude-code-action@v1
42
+ with:
43
+ anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
44
+ prompt: |
45
+ Perform a security audit of this codebase. Scope: ${{ github.event.inputs.scope || 'all' }}.
46
+
47
+ Focus on:
48
+ 1. **Secrets and credentials** — hardcoded API keys, tokens, passwords
49
+ 2. **Injection vulnerabilities** — SQL, command, path traversal
50
+ 3. **Authentication and authorization gaps** — missing auth checks, privilege escalation
51
+ 4. **Dependency vulnerabilities** — check /tmp/npm-audit.json or /tmp/pip-audit.json if present
52
+ 5. **Data exposure** — PII in logs, unencrypted sensitive data
53
+
54
+ For each finding:
55
+ - File and line number
56
+ - Severity: critical / high / medium / low
57
+ - Description of the vulnerability
58
+ - Recommended fix
59
+
60
+ Output a structured report. If no issues found in a category, say "None found."
61
+ Focus on real vulnerabilities, not theoretical ones.
62
+
63
+ - name: Create issue if critical findings
64
+ if: failure()
65
+ uses: actions/github-script@v7
66
+ with:
67
+ script: |
68
+ github.rest.issues.create({
69
+ owner: context.repo.owner,
70
+ repo: context.repo.repo,
71
+ title: 'Security audit found critical issues',
72
+ body: 'The weekly Merlin security audit found critical issues. See the workflow run for details.',
73
+ labels: ['security', 'automated']
74
+ })
@@ -29,5 +29,13 @@
29
29
  "safety": {
30
30
  "always_confirm_destructive": true,
31
31
  "always_confirm_external_services": true
32
- }
32
+ },
33
+ "notifications": {
34
+ "desktop": true,
35
+ "sound": false,
36
+ "slack_webhook": "",
37
+ "discord_webhook": "",
38
+ "notify_on": ["stop", "needs_input", "error"]
39
+ },
40
+ "voice_mode_concise": false
33
41
  }
@@ -0,0 +1,30 @@
1
+ ---
2
+ paths: ["apps/api/**"]
3
+ ---
4
+
5
+ # API Rules (apps/api)
6
+
7
+ ## Route Patterns
8
+ - Use Express.js route patterns: `router.get('/path', middleware, handler)`
9
+ - Group related routes in dedicated router files under `src/routes/`
10
+ - Use route-level middleware for auth and validation before business logic
11
+
12
+ ## Error Handling
13
+ - All routes must have error handling — either try/catch or a next(err) pattern
14
+ - Use a centralized error middleware at the app level (`src/middleware/error.ts`)
15
+ - Never let unhandled promise rejections reach the client
16
+
17
+ ## Database Access
18
+ - All database access must go through the services layer (`src/services/`)
19
+ - No raw DB queries in route handlers
20
+ - Services are responsible for data mapping and business logic
21
+
22
+ ## Authentication
23
+ - All non-public routes must verify auth via the auth middleware
24
+ - Public routes must be explicitly marked with a comment: `// public route`
25
+ - Never trust client-supplied user IDs — derive from verified session/token
26
+
27
+ ## Validation
28
+ - Use Zod for request body, query param, and path param validation
29
+ - Define schemas alongside the route or in a shared `src/schemas/` folder
30
+ - Return 400 with structured errors on validation failure — never 500
@@ -0,0 +1,25 @@
1
+ ---
2
+ paths: ["apps/web/**"]
3
+ ---
4
+
5
+ # Frontend Rules (apps/web)
6
+
7
+ ## Next.js App Router
8
+ - Use the App Router (`app/` directory) — not the Pages Router
9
+ - Prefer Server Components by default; add `'use client'` only when interactivity requires it
10
+ - Use `loading.tsx` and `error.tsx` conventions for async boundaries
11
+
12
+ ## Component Boundaries
13
+ - Mark client components explicitly with `'use client'` at the top of the file
14
+ - Keep client components small and push data fetching to server components
15
+ - Shared UI primitives go in `components/ui/`; page-specific components stay co-located
16
+
17
+ ## Styling
18
+ - Use Tailwind CSS for all styling — no inline styles, no CSS modules unless forced
19
+ - Follow the project's existing Tailwind class ordering convention
20
+ - Use `cn()` (clsx/tailwind-merge helper) for conditional class concatenation
21
+
22
+ ## Data Fetching
23
+ - Never call backend APIs directly from components — use the api client module
24
+ - The api client lives in `lib/api/` — add new methods there, not ad-hoc fetch calls
25
+ - Server components can call services directly; client components must go through the api client
@@ -0,0 +1,36 @@
1
+ ---
2
+ paths: ["**/hooks/**", "**/files/hooks/**"]
3
+ ---
4
+
5
+ # Hook Rules (hooks/)
6
+
7
+ ## Language Constraints
8
+ - Pure bash only — no Python, no Node.js, no Ruby or other runtimes
9
+ - No npm packages, no pip installs, no external dependencies beyond standard Unix tools
10
+ - Assume only: bash, jq (optional), curl, grep, sed, awk, cat, date are available
11
+
12
+ ## Performance
13
+ - Hooks must complete in under 50ms — they run on every tool call
14
+ - No synchronous network calls — if you need network, fire-and-forget with `&` and move on
15
+ - Avoid spawning subshells in tight loops; process data with built-in bash constructs
16
+
17
+ ## Exit Codes
18
+ - Exit 0: allow the action / pass (default for all advisory hooks)
19
+ - Exit 2: block the action with a reason — output `{"decision":"block","reason":"..."}` to stdout
20
+ - Any other exit code is treated as 0 (pass) — never exit 1 to block, it's reserved for errors
21
+
22
+ ## Input Handling
23
+ - Read event data from stdin as JSON: `input=$(cat)`
24
+ - Use jq when available; always provide a grep/sed fallback for when jq is missing:
25
+ ```bash
26
+ if command -v jq >/dev/null 2>&1; then
27
+ tool_name=$(echo "$input" | jq -r '.tool_name // empty')
28
+ else
29
+ tool_name=$(echo "$input" | grep -o '"tool_name":"[^"]*"' | cut -d'"' -f4)
30
+ fi
31
+ ```
32
+
33
+ ## Output
34
+ - Blocking hooks: output valid JSON to stdout (`{"decision":"block","reason":"..."}`)
35
+ - Non-blocking hooks: output `{}` to stdout; all messages go to stderr
36
+ - Never output plain text to stdout — it breaks JSON parsing by Claude Code
@@ -0,0 +1,30 @@
1
+ ---
2
+ paths: ["**/src/server/**", "**/packages/create-merlin-brain/src/**"]
3
+ ---
4
+
5
+ # MCP Server Rules (src/server)
6
+
7
+ ## TypeScript
8
+ - Strict mode is required — `"strict": true` in tsconfig, no exceptions
9
+ - No `any` types; use `unknown` and narrow with guards when type is truly dynamic
10
+ - All exported functions and types must have explicit type annotations
11
+
12
+ ## Tool Descriptions
13
+ - MCP tool descriptions must be keyword-rich for LLM discoverability
14
+ - Include: what it does, when to use it, what it returns, example use cases
15
+ - Bad: `"Gets context"` — Good: `"Fetches codebase context for a task, returns relevant files, patterns, and architecture notes to guide implementation"`
16
+
17
+ ## Tool Loading Strategy
18
+ - Core tools (5-6 maximum): always loaded at server startup — these are the must-haves
19
+ - All other tools: deferred — loaded only when the core tools route to them or are explicitly requested
20
+ - This keeps the MCP tool list small and the LLM's tool selection fast
21
+
22
+ ## Input Validation
23
+ - Every MCP tool handler must validate its input with Zod before processing
24
+ - Define the Zod schema inline with the tool registration (co-location aids readability)
25
+ - On validation failure, return a user-friendly error message — not a stack trace
26
+
27
+ ## Error Responses
28
+ - All errors returned to the caller must be user-friendly (English prose, actionable)
29
+ - Internal errors (unexpected exceptions) should be caught and returned as structured text
30
+ - Never let an unhandled exception crash the MCP server process
@@ -0,0 +1,29 @@
1
+ ---
2
+ paths: ["workers/**"]
3
+ ---
4
+
5
+ # Worker Rules (workers/)
6
+
7
+ ## Idempotency
8
+ - All worker jobs must be idempotent — running the same job twice must not cause side effects
9
+ - Use job IDs or content hashes to detect and skip already-processed work
10
+ - Store processing state in the database, not in memory
11
+
12
+ ## Shared Infrastructure
13
+ - Use shared utilities from `workers/src/shared/` — database, queue, logger, config
14
+ - Never duplicate database connection logic — import from the shared db module
15
+ - Worker-specific code stays in the worker's own directory; cross-cutting code goes in shared
16
+
17
+ ## AI Call Cost Control
18
+ - Every AI/LLM call must include a cost estimate in the log before execution
19
+ - Use `estimateCost(model, inputTokens, outputTokens)` from the shared cost module
20
+ - Log: model name, estimated tokens, estimated cost — so runaway jobs are caught early
21
+
22
+ ## Database Connections
23
+ - Use connection pooling — never open a new connection per job
24
+ - Import the shared pool from `workers/src/shared/database.ts`
25
+ - Always release connections back to the pool — use pool.connect() with try/finally
26
+
27
+ ## Cleanup
28
+ - Wrap all job logic in try/finally — cleanup (connection release, temp files, locks) must run even on failure
29
+ - Log the final state (completed / failed / skipped) before exiting the job handler
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-merlin-brain",
3
- "version": "3.10.0",
3
+ "version": "3.12.0",
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",