create-merlin-brain 3.22.0 → 3.23.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.
- package/README.md +22 -4
- package/bin/merlin-ask.cjs +111 -0
- package/bin/merlin-cli.cjs +22 -0
- package/bin/runtime-adapters.cjs +678 -28
- package/dist/server/api/client.d.ts +2 -0
- package/dist/server/api/client.d.ts.map +1 -1
- package/dist/server/api/client.js +4 -0
- package/dist/server/api/client.js.map +1 -1
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/server.js +45 -4
- package/dist/server/server.js.map +1 -1
- package/dist/server/tools/auto-mode.d.ts +9 -0
- package/dist/server/tools/auto-mode.d.ts.map +1 -0
- package/dist/server/tools/auto-mode.js +231 -0
- package/dist/server/tools/auto-mode.js.map +1 -0
- package/dist/server/tools/computer-use.d.ts +8 -0
- package/dist/server/tools/computer-use.d.ts.map +1 -0
- package/dist/server/tools/computer-use.js +355 -0
- package/dist/server/tools/computer-use.js.map +1 -0
- package/dist/server/tools/dream.d.ts +9 -0
- package/dist/server/tools/dream.d.ts.map +1 -0
- package/dist/server/tools/dream.js +246 -0
- package/dist/server/tools/dream.js.map +1 -0
- package/dist/server/tools/hud.d.ts +13 -0
- package/dist/server/tools/hud.d.ts.map +1 -0
- package/dist/server/tools/hud.js +295 -0
- package/dist/server/tools/hud.js.map +1 -0
- package/dist/server/tools/index.d.ts +4 -0
- package/dist/server/tools/index.d.ts.map +1 -1
- package/dist/server/tools/index.js +4 -0
- package/dist/server/tools/index.js.map +1 -1
- package/dist/server/tools/provider-ask.d.ts +10 -0
- package/dist/server/tools/provider-ask.d.ts.map +1 -0
- package/dist/server/tools/provider-ask.js +234 -0
- package/dist/server/tools/provider-ask.js.map +1 -0
- package/dist/server/tools/rate-limit.d.ts +8 -0
- package/dist/server/tools/rate-limit.d.ts.map +1 -0
- package/dist/server/tools/rate-limit.js +184 -0
- package/dist/server/tools/rate-limit.js.map +1 -0
- package/dist/server/tools/skills.d.ts +16 -0
- package/dist/server/tools/skills.d.ts.map +1 -0
- package/dist/server/tools/skills.js +326 -0
- package/dist/server/tools/skills.js.map +1 -0
- package/dist/server/tools/team-workers.d.ts +7 -0
- package/dist/server/tools/team-workers.d.ts.map +1 -0
- package/dist/server/tools/team-workers.js +271 -0
- package/dist/server/tools/team-workers.js.map +1 -0
- package/dist/server/utils/merlin-manifest.d.ts +6 -1
- package/dist/server/utils/merlin-manifest.d.ts.map +1 -1
- package/dist/server/utils/merlin-manifest.js +34 -1
- package/dist/server/utils/merlin-manifest.js.map +1 -1
- package/files/CLAUDE.md +22 -0
- package/files/hooks/rate-limit-watch.sh +120 -0
- package/files/hooks/statusline.sh +148 -0
- package/files/merlin/skills/SKILLS-INDEX.md +82 -0
- package/files/merlin/skills/automation/payments.md +14 -0
- package/files/merlin/skills/automation/webhooks.md +14 -0
- package/files/merlin/skills/coding/accessibility.md +14 -0
- package/files/merlin/skills/coding/api-design.md +14 -0
- package/files/merlin/skills/coding/debug-mode.md +14 -0
- package/files/merlin/skills/coding/focus-mode.md +14 -0
- package/files/merlin/skills/coding/loop.md +14 -0
- package/files/merlin/skills/coding/performance.md +14 -0
- package/files/merlin/skills/coding/react-patterns.md +51 -0
- package/files/merlin/skills/coding/security-hardening.md +56 -0
- package/files/merlin/skills/coding/verify.md +14 -0
- package/files/merlin/skills/communication/dispatcher.md +40 -0
- package/files/merlin/skills/communication/email-gmail.md +31 -0
- package/files/merlin/skills/communication/telegram.md +50 -0
- package/files/merlin/skills/communication/whatsapp.md +47 -0
- package/files/merlin/skills/data/google-sheets.md +14 -0
- package/files/merlin/skills/design/animation.md +14 -0
- package/files/merlin/skills/devops/docker-containers.md +14 -0
- package/files/merlin/skills/research/brainstorm.md +14 -0
- package/files/merlin/skills/testing/tdd-workflow.md +58 -0
- package/package.json +4 -2
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Discovery chain:
|
|
9
9
|
* 1. .merlin.json (local file, 0 tokens, any agent)
|
|
10
|
-
* 2. CLAUDE.md
|
|
10
|
+
* 2. Instruction file comment (CLAUDE.md / AGENTS.md / GEMINI.md)
|
|
11
11
|
* 3. git remote → API lookup (network call, MCP required)
|
|
12
12
|
*/
|
|
13
13
|
/** Filename for the manifest */
|
|
@@ -26,6 +26,8 @@ export declare const MERLIN_MCP_SERVER = "merlin-mcp-server";
|
|
|
26
26
|
export declare const MERLIN_DEFAULT_CAPABILITIES: readonly ["context", "search", "conventions", "files", "ask"];
|
|
27
27
|
/** CLAUDE.md comment marker for Sight URL injection */
|
|
28
28
|
export declare const CLAUDEMD_SIGHT_MARKER = "MERLIN_SIGHT";
|
|
29
|
+
export declare const AGENTSMD_SIGHT_MARKER = "MERLIN_SIGHT";
|
|
30
|
+
export declare const GEMINIMD_SIGHT_MARKER = "MERLIN_SIGHT";
|
|
29
31
|
/** MCP configuration for the manifest */
|
|
30
32
|
export interface MerlinManifestMcp {
|
|
31
33
|
/** npm install command (e.g., "npx create-merlin-brain") */
|
|
@@ -95,4 +97,7 @@ export declare function buildManifest(sightId: string, repoUrl: string): MerlinM
|
|
|
95
97
|
* @returns true if injected, false if already present or no CLAUDE.md
|
|
96
98
|
*/
|
|
97
99
|
export declare function injectSightIntoClaudeMd(repoRoot: string, sightUrl: string): boolean;
|
|
100
|
+
export declare function injectSightIntoAgentsMd(repoRoot: string, sightUrl: string): boolean;
|
|
101
|
+
export declare function injectSightIntoGeminiMd(repoRoot: string, sightUrl: string): boolean;
|
|
102
|
+
export declare function injectSightIntoInstructionFiles(repoRoot: string, sightUrl: string): boolean;
|
|
98
103
|
//# sourceMappingURL=merlin-manifest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merlin-manifest.d.ts","sourceRoot":"","sources":["../../../src/server/utils/merlin-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,gCAAgC;AAChC,eAAO,MAAM,wBAAwB,iBAAiB,CAAC;AAEvD,0DA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oCAAoC;IACpC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ9D;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAqC1E;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,IAAI,CAKpF;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAkB9E;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAyBnF;AAqBD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEnF;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEnF;AAED,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAQ3F"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Discovery chain:
|
|
9
9
|
* 1. .merlin.json (local file, 0 tokens, any agent)
|
|
10
|
-
* 2. CLAUDE.md
|
|
10
|
+
* 2. Instruction file comment (CLAUDE.md / AGENTS.md / GEMINI.md)
|
|
11
11
|
* 3. git remote → API lookup (network call, MCP required)
|
|
12
12
|
*/
|
|
13
13
|
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
|
@@ -34,6 +34,8 @@ export const MERLIN_DEFAULT_CAPABILITIES = [
|
|
|
34
34
|
];
|
|
35
35
|
/** CLAUDE.md comment marker for Sight URL injection */
|
|
36
36
|
export const CLAUDEMD_SIGHT_MARKER = 'MERLIN_SIGHT';
|
|
37
|
+
export const AGENTSMD_SIGHT_MARKER = 'MERLIN_SIGHT';
|
|
38
|
+
export const GEMINIMD_SIGHT_MARKER = 'MERLIN_SIGHT';
|
|
37
39
|
/**
|
|
38
40
|
* Extract the UUID sight ID from a Merlin Sights URL.
|
|
39
41
|
*
|
|
@@ -161,4 +163,35 @@ export function injectSightIntoClaudeMd(repoRoot, sightUrl) {
|
|
|
161
163
|
return false;
|
|
162
164
|
}
|
|
163
165
|
}
|
|
166
|
+
function injectSightMarker(filePath, markerPrefix, sightUrl) {
|
|
167
|
+
if (!existsSync(filePath)) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
try {
|
|
171
|
+
const content = readFileSync(filePath, 'utf-8');
|
|
172
|
+
if (content.includes(markerPrefix)) {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
writeFileSync(filePath, `${markerPrefix}: ${sightUrl}\n${content}`, 'utf-8');
|
|
176
|
+
console.error(`[merlin-manifest] Injected Sight URL into ${filePath}`);
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
export function injectSightIntoAgentsMd(repoRoot, sightUrl) {
|
|
184
|
+
return injectSightMarker(join(repoRoot, 'AGENTS.md'), '# MERLIN_SIGHT', sightUrl);
|
|
185
|
+
}
|
|
186
|
+
export function injectSightIntoGeminiMd(repoRoot, sightUrl) {
|
|
187
|
+
return injectSightMarker(join(repoRoot, 'GEMINI.md'), '# MERLIN_SIGHT', sightUrl);
|
|
188
|
+
}
|
|
189
|
+
export function injectSightIntoInstructionFiles(repoRoot, sightUrl) {
|
|
190
|
+
const results = [
|
|
191
|
+
injectSightIntoClaudeMd(repoRoot, sightUrl),
|
|
192
|
+
injectSightIntoAgentsMd(repoRoot, sightUrl),
|
|
193
|
+
injectSightIntoGeminiMd(repoRoot, sightUrl),
|
|
194
|
+
];
|
|
195
|
+
return results.some(Boolean);
|
|
196
|
+
}
|
|
164
197
|
//# sourceMappingURL=merlin-manifest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merlin-manifest.js","sourceRoot":"","sources":["../../../src/server/utils/merlin-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,gCAAgC;AAChC,MAAM,CAAC,MAAM,wBAAwB,GAAG,cAAc,CAAC;AAEvD,0DAA0D;AAC1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,6CAA6C,CAAC;AAE/E,0BAA0B;AAC1B,MAAM,CAAC,MAAM,kBAAkB,GAAG,6BAA6B,CAAC;AAEhE,qEAAqE;AACrE,MAAM,CAAC,MAAM,eAAe,GAAG,wCAAwC,CAAC;AAExE,0BAA0B;AAC1B,MAAM,CAAC,MAAM,kBAAkB,GAAG,yBAAyB,CAAC;AAE5D,sBAAsB;AACtB,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAErD,gCAAgC;AAChC,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,SAAS;IACT,QAAQ;IACR,aAAa;IACb,OAAO;IACP,KAAK;CACG,CAAC;AAEX,uDAAuD;AACvD,MAAM,CAAC,MAAM,qBAAqB,GAAG,cAAc,CAAC;AA4BpD;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAE3B,kBAAkB;IAClB,MAAM,WAAW,GAAG,+DAA+D,CAAC;IACpF,MAAM,KAAK,GAAG,QAAQ,CAAC,K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C;QACf,CAAC;QAED,aAAa,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,QAAQ,KAAK,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;QAC7E,OAAO,CAAC,KAAK,CAAC,6CAA6C,QAAQ,EAAE,CAAC,CAAC;QACvE,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,QAAgB,EAAE,QAAgB;IACxE,OAAO,iBAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC;AACpF,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,QAAgB,EAAE,QAAgB;IACxE,OAAO,iBAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC;AACpF,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,QAAgB,EAAE,QAAgB;IAChF,MAAM,OAAO,GAAG;QACd,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,CAAC;QAC3C,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,CAAC;QAC3C,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,CAAC;KAC5C,CAAC;IAEF,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC"}
|
package/files/CLAUDE.md
CHANGED
|
@@ -65,3 +65,25 @@ When user corrects you → `merlin_save_behavior`. When user says "always/never/
|
|
|
65
65
|
- Never kill user processes (Xcode, VS Code, browsers) without explicit confirmation.
|
|
66
66
|
- Never claim "done" without actually building/compiling/testing.
|
|
67
67
|
- Badge on EVERY action — if the user can't see `⟡🔮 MERLIN ›`, you're not doing your job.
|
|
68
|
+
|
|
69
|
+
## New Capabilities (March 2026)
|
|
70
|
+
|
|
71
|
+
### Auto Mode — `merlin loop yolo`
|
|
72
|
+
Enable autonomous tool approval. Call `merlin_auto_mode(action: "enable", level: "yolo")` for full autonomy or `level: "safe"` for read-only mode. Disable with `merlin_auto_mode(action: "disable")`.
|
|
73
|
+
- "loop yolo" / "auto mode" / "go autonomous" → `merlin_auto_mode(action: "enable", level: "yolo")`
|
|
74
|
+
|
|
75
|
+
### AutoDream — Memory Consolidation
|
|
76
|
+
Keep memory files clean and organized. Call `merlin_dream(action: "enable")` to turn on auto-dream, or `action: "consolidate"` to manually review and clean up memory.
|
|
77
|
+
- "dream" / "consolidate memory" / "clean up memory" → `merlin_dream(action: "consolidate")`
|
|
78
|
+
|
|
79
|
+
### Computer Use — Desktop Control
|
|
80
|
+
Take over and control desktop apps. Call `merlin_computer_use(action: "launch", app: "AppName")` to open an app, or `merlin_screenshot()` to capture the screen.
|
|
81
|
+
- "take over [app]" / "open [app]" / "control [app]" → `merlin_computer_use(action: "launch", app: "[app]")`
|
|
82
|
+
- "screenshot" / "what's on screen" → `merlin_screenshot()`
|
|
83
|
+
|
|
84
|
+
### Self-Evolving Skills — The Brain Gets Smarter
|
|
85
|
+
Skills are prompt injections that enhance your capabilities. They live at `~/.claude/merlin/skills/`.
|
|
86
|
+
- **Before any task**: Call `merlin_find_skill("what you need")` to discover relevant skills. Load 1-3 by reading their .md files.
|
|
87
|
+
- **After any task**: Call `merlin_track_skill(skillId, success)` to record whether the skill helped.
|
|
88
|
+
- **When a skill is wrong or missing**: Call `merlin_evolve_skill(...)` to improve it or create a new one. The improvement syncs to all users.
|
|
89
|
+
- Skills auto-improve over time. High success rate skills get recommended more. Failed skills get flagged for evolution.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# Merlin Hook: PostToolUse — Rate-Limit Watcher
|
|
4
|
+
# Detects rate-limit signals in tool output and writes state to ~/.merlin/state/rate-limit.json.
|
|
5
|
+
# Sends a desktop notification on first detection (fire-and-forget).
|
|
6
|
+
#
|
|
7
|
+
# Always exits 0 — advisory only, never blocks.
|
|
8
|
+
#
|
|
9
|
+
set -euo pipefail
|
|
10
|
+
trap 'echo "{}"; exit 0' ERR
|
|
11
|
+
|
|
12
|
+
STATE_DIR="${HOME}/.merlin/state"
|
|
13
|
+
STATE_FILE="${STATE_DIR}/rate-limit.json"
|
|
14
|
+
|
|
15
|
+
# ── Ensure state directory exists ────────────────────────────────────────────
|
|
16
|
+
mkdir -p "${STATE_DIR}"
|
|
17
|
+
|
|
18
|
+
# ── Read stdin event ──────────────────────────────────────────────────────────
|
|
19
|
+
input=$(cat)
|
|
20
|
+
|
|
21
|
+
# ── Extract tool_result (jq with grep/sed fallback) ──────────────────────────
|
|
22
|
+
if command -v jq >/dev/null 2>&1; then
|
|
23
|
+
tool_result=$(echo "${input}" | jq -r '.tool_result // ""')
|
|
24
|
+
else
|
|
25
|
+
tool_result=$(echo "${input}" | grep -o '"tool_result":"[^"]*"' | cut -d'"' -f4 || true)
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# Lowercase for case-insensitive matching
|
|
29
|
+
tool_result_lower=$(echo "${tool_result}" | tr '[:upper:]' '[:lower:]')
|
|
30
|
+
|
|
31
|
+
# ── Rate-limit pattern matching ───────────────────────────────────────────────
|
|
32
|
+
is_rate_limited=false
|
|
33
|
+
trigger_label=""
|
|
34
|
+
|
|
35
|
+
if echo "${tool_result_lower}" | grep -qE 'rate.?limit|429|too many requests|quota exceeded|overloaded'; then
|
|
36
|
+
is_rate_limited=true
|
|
37
|
+
|
|
38
|
+
if echo "${tool_result_lower}" | grep -q '429'; then
|
|
39
|
+
trigger_label="429 response"
|
|
40
|
+
elif echo "${tool_result_lower}" | grep -q 'quota exceeded'; then
|
|
41
|
+
trigger_label="quota exceeded"
|
|
42
|
+
elif echo "${tool_result_lower}" | grep -q 'overloaded'; then
|
|
43
|
+
trigger_label="overloaded"
|
|
44
|
+
elif echo "${tool_result_lower}" | grep -q 'too many requests'; then
|
|
45
|
+
trigger_label="too many requests"
|
|
46
|
+
else
|
|
47
|
+
trigger_label="rate limit"
|
|
48
|
+
fi
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
NOW=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
52
|
+
|
|
53
|
+
# ── Compute estimated reset time (5 min from now) ────────────────────────────
|
|
54
|
+
# macOS date -v; Linux date -d fallback
|
|
55
|
+
if date -v+5M >/dev/null 2>&1; then
|
|
56
|
+
RESET_AT=$(date -u -v+5M +"%Y-%m-%dT%H:%M:%SZ")
|
|
57
|
+
else
|
|
58
|
+
RESET_AT=$(date -u -d "+5 minutes" +"%Y-%m-%dT%H:%M:%SZ" 2>/dev/null || echo "${NOW}")
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
# ── If rate-limited: write blocked state ─────────────────────────────────────
|
|
62
|
+
if [ "${is_rate_limited}" = "true" ]; then
|
|
63
|
+
# Only notify on new detection (when previous state wasn't already blocked)
|
|
64
|
+
prev_status=""
|
|
65
|
+
if [ -f "${STATE_FILE}" ]; then
|
|
66
|
+
if command -v jq >/dev/null 2>&1; then
|
|
67
|
+
prev_status=$(jq -r '.status // ""' "${STATE_FILE}" 2>/dev/null || true)
|
|
68
|
+
else
|
|
69
|
+
prev_status=$(grep -o '"status":"[^"]*"' "${STATE_FILE}" | cut -d'"' -f4 || true)
|
|
70
|
+
fi
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
cat > "${STATE_FILE}" <<EOF
|
|
74
|
+
{
|
|
75
|
+
"status": "blocked",
|
|
76
|
+
"detectedAt": "${NOW}",
|
|
77
|
+
"trigger": "${trigger_label}",
|
|
78
|
+
"estimatedResetAt": "${RESET_AT}"
|
|
79
|
+
}
|
|
80
|
+
EOF
|
|
81
|
+
|
|
82
|
+
# Desktop notification only on transition to blocked (macOS)
|
|
83
|
+
if [ "${prev_status}" != "blocked" ] && command -v osascript >/dev/null 2>&1; then
|
|
84
|
+
osascript -e 'display notification "Rate limit detected — will auto-resume" with title "⟡🔮 Merlin"' &
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
echo "{}"
|
|
88
|
+
exit 0
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
# ── If not rate-limited: check if we should clear a previous blocked state ───
|
|
92
|
+
if [ -f "${STATE_FILE}" ]; then
|
|
93
|
+
if command -v jq >/dev/null 2>&1; then
|
|
94
|
+
prev_status=$(jq -r '.status // ""' "${STATE_FILE}" 2>/dev/null || true)
|
|
95
|
+
detected_at=$(jq -r '.detectedAt // ""' "${STATE_FILE}" 2>/dev/null || true)
|
|
96
|
+
else
|
|
97
|
+
prev_status=$(grep -o '"status":"[^"]*"' "${STATE_FILE}" | cut -d'"' -f4 || true)
|
|
98
|
+
detected_at=$(grep -o '"detectedAt":"[^"]*"' "${STATE_FILE}" | cut -d'"' -f4 || true)
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
if [ "${prev_status}" = "blocked" ] && [ -n "${detected_at}" ]; then
|
|
102
|
+
# Calculate elapsed seconds using python3 (available on macOS/Linux)
|
|
103
|
+
elapsed=$(python3 -c "
|
|
104
|
+
import datetime
|
|
105
|
+
try:
|
|
106
|
+
d = datetime.datetime.fromisoformat('${detected_at}'.replace('Z','+00:00'))
|
|
107
|
+
print(int((datetime.datetime.now(datetime.timezone.utc) - d).total_seconds()))
|
|
108
|
+
except Exception:
|
|
109
|
+
print(0)
|
|
110
|
+
" 2>/dev/null || echo "0")
|
|
111
|
+
|
|
112
|
+
# Clear blocked state only after 2+ minutes have elapsed
|
|
113
|
+
if [ "${elapsed}" -ge 120 ] 2>/dev/null; then
|
|
114
|
+
printf '{\n "status": "ok",\n "clearedAt": "%s"\n}\n' "${NOW}" > "${STATE_FILE}"
|
|
115
|
+
fi
|
|
116
|
+
fi
|
|
117
|
+
fi
|
|
118
|
+
|
|
119
|
+
echo "{}"
|
|
120
|
+
exit 0
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# Merlin Hook: Notification — HUD Statusline
|
|
4
|
+
#
|
|
5
|
+
# Outputs a single-line statusline for Claude Code's status bar with live
|
|
6
|
+
# Merlin session metrics. Reads only local state files — no network calls.
|
|
7
|
+
#
|
|
8
|
+
# Output JSON:
|
|
9
|
+
# {"hookSpecificOutput":{"hookEventName":"Notification","statusLine":"..."}}
|
|
10
|
+
#
|
|
11
|
+
# Metrics included:
|
|
12
|
+
# - Merlin version (from ~/.claude/merlin/VERSION)
|
|
13
|
+
# - Active agents (from ~/.merlin/state/agents.json)
|
|
14
|
+
# - Task progress (from ~/.merlin/state/tasks.json)
|
|
15
|
+
# - Session cost (from ~/.merlin/state/session-cost.json)
|
|
16
|
+
# - Git branch (git rev-parse, fast)
|
|
17
|
+
# - Context age (from ~/.merlin/state/last-context.json)
|
|
18
|
+
# - Rate limit (from ~/.merlin/state/rate-limit.json)
|
|
19
|
+
#
|
|
20
|
+
# Always exits 0 — purely advisory.
|
|
21
|
+
#
|
|
22
|
+
set -euo pipefail
|
|
23
|
+
trap 'echo "{}"; exit 0' ERR
|
|
24
|
+
|
|
25
|
+
STATE_DIR="${HOME}/.merlin/state"
|
|
26
|
+
MERLIN_DIR="${HOME}/.claude/merlin"
|
|
27
|
+
|
|
28
|
+
# ── Version ────────────────────────────────────────────────────────────────
|
|
29
|
+
VERSION_FILE="${MERLIN_DIR}/VERSION"
|
|
30
|
+
if [ -f "${VERSION_FILE}" ]; then
|
|
31
|
+
MERLIN_VERSION=$(cat "${VERSION_FILE}" 2>/dev/null | tr -d '[:space:]' || echo "--")
|
|
32
|
+
else
|
|
33
|
+
MERLIN_VERSION="--"
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# ── Active agents ──────────────────────────────────────────────────────────
|
|
37
|
+
AGENTS_FILE="${STATE_DIR}/agents.json"
|
|
38
|
+
if [ -f "${AGENTS_FILE}" ]; then
|
|
39
|
+
if command -v jq >/dev/null 2>&1; then
|
|
40
|
+
AGENT_COUNT=$(jq '.active // 0' "${AGENTS_FILE}" 2>/dev/null || echo "0")
|
|
41
|
+
else
|
|
42
|
+
AGENT_COUNT=$(grep -o '"active":[0-9]*' "${AGENTS_FILE}" 2>/dev/null | grep -o '[0-9]*$' || echo "0")
|
|
43
|
+
fi
|
|
44
|
+
else
|
|
45
|
+
AGENT_COUNT="0"
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
# ── Task progress ──────────────────────────────────────────────────────────
|
|
49
|
+
TASKS_FILE="${STATE_DIR}/tasks.json"
|
|
50
|
+
if [ -f "${TASKS_FILE}" ]; then
|
|
51
|
+
if command -v jq >/dev/null 2>&1; then
|
|
52
|
+
TASKS_DONE=$(jq '.done // 0' "${TASKS_FILE}" 2>/dev/null || echo "0")
|
|
53
|
+
TASKS_TOTAL=$(jq '.total // 0' "${TASKS_FILE}" 2>/dev/null || echo "0")
|
|
54
|
+
else
|
|
55
|
+
TASKS_DONE=$(grep -o '"done":[0-9]*' "${TASKS_FILE}" 2>/dev/null | grep -o '[0-9]*$' || echo "0")
|
|
56
|
+
TASKS_TOTAL=$(grep -o '"total":[0-9]*' "${TASKS_FILE}" 2>/dev/null | grep -o '[0-9]*$' || echo "0")
|
|
57
|
+
fi
|
|
58
|
+
if [ "${TASKS_TOTAL}" -gt 0 ] 2>/dev/null; then
|
|
59
|
+
TASKS_DISPLAY="${TASKS_DONE}/${TASKS_TOTAL} tasks"
|
|
60
|
+
else
|
|
61
|
+
TASKS_DISPLAY="--"
|
|
62
|
+
fi
|
|
63
|
+
else
|
|
64
|
+
TASKS_DISPLAY="--"
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
# ── Session cost ───────────────────────────────────────────────────────────
|
|
68
|
+
COST_FILE="${STATE_DIR}/session-cost.json"
|
|
69
|
+
if [ -f "${COST_FILE}" ]; then
|
|
70
|
+
if command -v jq >/dev/null 2>&1; then
|
|
71
|
+
COST_RAW=$(jq -r '.total // ""' "${COST_FILE}" 2>/dev/null || echo "")
|
|
72
|
+
else
|
|
73
|
+
COST_RAW=$(grep -o '"total":"[^"]*"' "${COST_FILE}" 2>/dev/null | cut -d'"' -f4 || echo "")
|
|
74
|
+
# Also try numeric total
|
|
75
|
+
if [ -z "${COST_RAW}" ]; then
|
|
76
|
+
COST_RAW=$(grep -o '"total":[0-9.]*' "${COST_FILE}" 2>/dev/null | grep -o '[0-9.]*$' || echo "")
|
|
77
|
+
fi
|
|
78
|
+
fi
|
|
79
|
+
if [ -n "${COST_RAW}" ] && [ "${COST_RAW}" != "null" ]; then
|
|
80
|
+
COST_DISPLAY="\$${COST_RAW}"
|
|
81
|
+
else
|
|
82
|
+
COST_DISPLAY="--"
|
|
83
|
+
fi
|
|
84
|
+
else
|
|
85
|
+
COST_DISPLAY="--"
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
# ── Git branch ─────────────────────────────────────────────────────────────
|
|
89
|
+
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "--")
|
|
90
|
+
|
|
91
|
+
# ── Context freshness ──────────────────────────────────────────────────────
|
|
92
|
+
CTX_FILE="${STATE_DIR}/last-context.json"
|
|
93
|
+
if [ -f "${CTX_FILE}" ]; then
|
|
94
|
+
if command -v jq >/dev/null 2>&1; then
|
|
95
|
+
LAST_TS=$(jq -r '.timestamp // ""' "${CTX_FILE}" 2>/dev/null || echo "")
|
|
96
|
+
else
|
|
97
|
+
LAST_TS=$(grep -o '"timestamp":[0-9]*' "${CTX_FILE}" 2>/dev/null | grep -o '[0-9]*$' || echo "")
|
|
98
|
+
fi
|
|
99
|
+
if [ -n "${LAST_TS}" ] && [ "${LAST_TS}" != "null" ] && [ "${LAST_TS}" != "" ]; then
|
|
100
|
+
NOW=$(date +%s)
|
|
101
|
+
ELAPSED=$(( NOW - LAST_TS ))
|
|
102
|
+
if [ "${ELAPSED}" -lt 60 ]; then
|
|
103
|
+
CTX_DISPLAY="${ELAPSED}s"
|
|
104
|
+
elif [ "${ELAPSED}" -lt 3600 ]; then
|
|
105
|
+
CTX_DISPLAY="$(( ELAPSED / 60 ))m"
|
|
106
|
+
else
|
|
107
|
+
CTX_DISPLAY="$(( ELAPSED / 3600 ))h"
|
|
108
|
+
fi
|
|
109
|
+
else
|
|
110
|
+
CTX_DISPLAY="--"
|
|
111
|
+
fi
|
|
112
|
+
else
|
|
113
|
+
CTX_DISPLAY="--"
|
|
114
|
+
fi
|
|
115
|
+
|
|
116
|
+
# ── Rate limit status ──────────────────────────────────────────────────────
|
|
117
|
+
RATE_FILE="${STATE_DIR}/rate-limit.json"
|
|
118
|
+
if [ -f "${RATE_FILE}" ]; then
|
|
119
|
+
if command -v jq >/dev/null 2>&1; then
|
|
120
|
+
RATE_STATUS=$(jq -r '.status // "OK"' "${RATE_FILE}" 2>/dev/null || echo "OK")
|
|
121
|
+
else
|
|
122
|
+
RATE_STATUS=$(grep -o '"status":"[^"]*"' "${RATE_FILE}" 2>/dev/null | cut -d'"' -f4 || echo "OK")
|
|
123
|
+
fi
|
|
124
|
+
# Normalize to OK / WARN / BLOCKED
|
|
125
|
+
case "${RATE_STATUS}" in
|
|
126
|
+
OK|ok) RATE_DISPLAY="OK" ;;
|
|
127
|
+
WARN|warn) RATE_DISPLAY="WARN" ;;
|
|
128
|
+
BLOCKED|blocked) RATE_DISPLAY="BLOCKED" ;;
|
|
129
|
+
*) RATE_DISPLAY="OK" ;;
|
|
130
|
+
esac
|
|
131
|
+
else
|
|
132
|
+
RATE_DISPLAY="OK"
|
|
133
|
+
fi
|
|
134
|
+
|
|
135
|
+
# ── Compose statusline ─────────────────────────────────────────────────────
|
|
136
|
+
STATUSLINE="v${MERLIN_VERSION} | ${AGENT_COUNT} agents | ${TASKS_DISPLAY} | ${COST_DISPLAY} | ${GIT_BRANCH} | ctx:${CTX_DISPLAY} | rate:${RATE_DISPLAY}"
|
|
137
|
+
|
|
138
|
+
# ── Output ─────────────────────────────────────────────────────────────────
|
|
139
|
+
if command -v jq >/dev/null 2>&1; then
|
|
140
|
+
jq -n --arg sl "${STATUSLINE}" \
|
|
141
|
+
'{"hookSpecificOutput":{"hookEventName":"Notification","statusLine":$sl}}'
|
|
142
|
+
else
|
|
143
|
+
# Escape double-quotes in statusline for safe inline embedding
|
|
144
|
+
SAFE="${STATUSLINE//\"/\\\"}"
|
|
145
|
+
printf '{"hookSpecificOutput":{"hookEventName":"Notification","statusLine":"%s"}}\n' "${SAFE}"
|
|
146
|
+
fi
|
|
147
|
+
|
|
148
|
+
exit 0
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Merlin Skills Index
|
|
2
|
+
|
|
3
|
+
When planning or executing a task, search this index to find relevant skills to load.
|
|
4
|
+
Load a skill by reading its full .md file from the matching path. Only load 1-3 skills per task — pick the most relevant ones.
|
|
5
|
+
|
|
6
|
+
Skills are prompt injections that enhance your capabilities for specific domains. They don't change what tools you have — they change how you think about the problem.
|
|
7
|
+
|
|
8
|
+
## How to Use
|
|
9
|
+
|
|
10
|
+
1. Read this index to find skills matching the current task
|
|
11
|
+
2. Load the skill .md file (e.g., `~/.claude/merlin/skills/coding/react-patterns.md`)
|
|
12
|
+
3. Follow the instructions in the skill while executing the task
|
|
13
|
+
4. After the task: if the skill helped, note it. If it was wrong or outdated, improve it.
|
|
14
|
+
|
|
15
|
+
## Coding > Frontend
|
|
16
|
+
- `coding/react-patterns` — React component patterns, hooks, performance, server components — [react, nextjs, remix, vite]
|
|
17
|
+
- `coding/tailwind-systems` — Design systems with Tailwind CSS, utility patterns, responsive — [tailwind, css, design-system]
|
|
18
|
+
- `coding/css-3d` — Advanced CSS 3D transforms, perspective, immersive effects — [css, 3d, animation]
|
|
19
|
+
- `coding/accessibility` — WCAG compliance, screen readers, keyboard nav, ARIA — [a11y, wcag, accessibility]
|
|
20
|
+
- `coding/performance` — Core Web Vitals, bundle optimization, lazy loading, caching — [performance, lighthouse, web-vitals]
|
|
21
|
+
- `coding/api-design` — RESTful conventions, versioning, OpenAPI specs, pagination — [api, rest, openapi, express]
|
|
22
|
+
|
|
23
|
+
## Coding > Security
|
|
24
|
+
- `coding/security-hardening` — OWASP top 10, input validation, auth patterns, XSS/CSRF — [security, owasp, auth, validation]
|
|
25
|
+
|
|
26
|
+
## Testing
|
|
27
|
+
- `testing/tdd-workflow` — Red-green-refactor, write tests first, Jest/Vitest/pytest — [tdd, testing, jest, vitest]
|
|
28
|
+
- `testing/e2e-playwright` — End-to-end browser testing with Playwright — [playwright, e2e, testing, browser]
|
|
29
|
+
|
|
30
|
+
## DevOps
|
|
31
|
+
- `devops/docker-containers` — Dockerfiles, multi-stage builds, docker-compose, minimal images — [docker, containers, devops]
|
|
32
|
+
- `devops/ci-cd` — GitHub Actions, CI pipelines, automated testing and deployment — [ci, cd, github-actions, deployment]
|
|
33
|
+
|
|
34
|
+
## Design
|
|
35
|
+
- `design/animation` — Smooth animations with Framer Motion, GSAP, CSS transitions — [animation, framer-motion, gsap, motion]
|
|
36
|
+
|
|
37
|
+
## Research
|
|
38
|
+
- `research/brainstorm` — Explore 3-5 approaches before committing, present pros/cons — [brainstorm, ideation, exploration]
|
|
39
|
+
- `research/challenge` — Devil's advocate review, poke holes, identify weaknesses — [challenge, review, critique]
|
|
40
|
+
- `research/deep-research` — Study problem domain before proposing, find best practices — [research, analysis, study]
|
|
41
|
+
- `research/step-by-step` — Break task into numbered steps, get approval before building — [planning, steps, breakdown]
|
|
42
|
+
|
|
43
|
+
## Execution
|
|
44
|
+
- `coding/focus-mode` — GSD mode: minimal questions, maximum speed, make decisions — [focus, gsd, speed, autonomous]
|
|
45
|
+
- `coding/loop` — Test-fix loop: run tests, fix failures, repeat until green — [loop, testing, iteration]
|
|
46
|
+
- `coding/verify` — Validate results: run code, check output, confirm requirements met — [verify, validation, qa]
|
|
47
|
+
- `coding/debug-mode` — Systematic debugging: reproduce, hypothesize, test, fix — [debug, troubleshoot, investigate]
|
|
48
|
+
|
|
49
|
+
## Communication (Non-Coding)
|
|
50
|
+
- `communication/whatsapp` — Two-way WhatsApp via Business API — direct, no middleware — [whatsapp, messaging, business-api]
|
|
51
|
+
- `communication/telegram` — Telegram bot via Bot API — direct HTTP calls — [telegram, bot, bot-api]
|
|
52
|
+
- `communication/dispatcher` — Central hub: receives from all channels, dispatches to specialists — [dispatcher, hub, routing]
|
|
53
|
+
- `communication/email-gmail` — Gmail read/send/draft/search via API — [email, gmail, mailbox]
|
|
54
|
+
- `communication/discord` — Discord bot: channels, roles, embeds, slash commands — [discord, bot]
|
|
55
|
+
- `communication/slack` — Slack integration: channels, DMs, Block Kit, threads — [slack, messaging, workspace]
|
|
56
|
+
- `communication/email` — Email automation: HTML emails, campaigns, auto-respond — [email, sendgrid, resend, smtp]
|
|
57
|
+
- `communication/sms-voice` — Twilio SMS and voice: notifications, IVR, 2FA — [twilio, sms, voice, phone]
|
|
58
|
+
|
|
59
|
+
## Automation (Non-Coding)
|
|
60
|
+
- `automation/webhooks` — Receive/send webhooks, parse payloads, validate signatures — [webhooks, http, events]
|
|
61
|
+
- `automation/zapier-make` — Connect 5000+ apps via Zapier/Make automation — [zapier, make, automation, integrations]
|
|
62
|
+
- `automation/scheduled-tasks` — Cron jobs, recurring automations, periodic reports — [cron, scheduling, automation]
|
|
63
|
+
- `automation/monitoring` — Health checks, uptime monitoring, auto-alerts — [monitoring, heartbeat, uptime]
|
|
64
|
+
- `automation/payments` — Stripe: checkout, subscriptions, invoices, webhooks — [stripe, payments, billing]
|
|
65
|
+
|
|
66
|
+
## Data (Non-Coding)
|
|
67
|
+
- `data/google-sheets` — Read/write Google Sheets, formulas, batch operations — [sheets, google, spreadsheet]
|
|
68
|
+
- `data/airtable` — Airtable CRUD, filters, linked records, attachments — [airtable, database, no-code]
|
|
69
|
+
- `data/notion` — Notion pages, databases, content sync, knowledge base — [notion, wiki, knowledge-base]
|
|
70
|
+
- `data/analytics` — Analytics platforms, dashboards, KPIs, reports — [analytics, mixpanel, amplitude, reporting]
|
|
71
|
+
|
|
72
|
+
## Marketing (Non-Coding)
|
|
73
|
+
- `marketing/social-media` — Post to Twitter/X, LinkedIn, Instagram, schedule content — [social, twitter, linkedin, instagram]
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Evolution
|
|
78
|
+
|
|
79
|
+
Skills evolve. When you improve a skill after using it:
|
|
80
|
+
1. Update the skill .md file with your improvement
|
|
81
|
+
2. Increment the `version` in the frontmatter
|
|
82
|
+
3. Add a line to `evolution` in the frontmatter describing what changed
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: payments
|
|
3
|
+
name: Stripe Payments
|
|
4
|
+
domain: non-coding
|
|
5
|
+
category: automation
|
|
6
|
+
tags: [stripe, payments, billing, subscriptions, checkout]
|
|
7
|
+
version: 1
|
|
8
|
+
source: builtin
|
|
9
|
+
successRate: 0
|
|
10
|
+
usageCount: 0
|
|
11
|
+
evolution: []
|
|
12
|
+
---
|
|
13
|
+
# Stripe Payments
|
|
14
|
+
Interact with Stripe for payment processing. Create Checkout Sessions for one-time payments. Manage Subscriptions with billing cycles. Handle webhooks for payment events (payment_intent.succeeded, invoice.paid, customer.subscription.updated). Process refunds. Generate invoices. Always use Stripe's official SDK, never raw API calls with card numbers.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: webhooks
|
|
3
|
+
name: Webhooks
|
|
4
|
+
domain: non-coding
|
|
5
|
+
category: automation
|
|
6
|
+
tags: [webhooks, http, events, callbacks, integrations]
|
|
7
|
+
version: 1
|
|
8
|
+
source: builtin
|
|
9
|
+
successRate: 0
|
|
10
|
+
usageCount: 0
|
|
11
|
+
evolution: []
|
|
12
|
+
---
|
|
13
|
+
# Webhooks
|
|
14
|
+
Set up webhook endpoints to receive events from external services (GitHub, Stripe, Shopify, etc.) and send outgoing webhooks to trigger actions in other systems. Parse payloads, validate signatures (HMAC-SHA256), handle retries with idempotency keys, and route events to appropriate handlers. Always verify webhook authenticity before processing.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: accessibility
|
|
3
|
+
name: Accessibility (a11y)
|
|
4
|
+
domain: coding
|
|
5
|
+
category: frontend
|
|
6
|
+
tags: [a11y, wcag, accessibility, screen-reader, keyboard]
|
|
7
|
+
version: 1
|
|
8
|
+
source: builtin
|
|
9
|
+
successRate: 0
|
|
10
|
+
usageCount: 0
|
|
11
|
+
evolution: []
|
|
12
|
+
---
|
|
13
|
+
# Accessibility (a11y)
|
|
14
|
+
Ensure all UI elements are accessible. Add ARIA labels to interactive elements without visible text. Support full keyboard navigation (Tab, Enter, Escape, Arrow keys). Maintain color contrast ratios (WCAG AA: 4.5:1 for text, 3:1 for large text). Use semantic HTML (button not div, nav not div, heading hierarchy). Test with screen reader patterns. Every image needs alt text. Focus management on route changes and modal open/close.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api-design
|
|
3
|
+
name: REST API Design
|
|
4
|
+
domain: coding
|
|
5
|
+
category: backend
|
|
6
|
+
tags: [api, rest, openapi, express, fastify, pagination]
|
|
7
|
+
version: 1
|
|
8
|
+
source: builtin
|
|
9
|
+
successRate: 0
|
|
10
|
+
usageCount: 0
|
|
11
|
+
evolution: []
|
|
12
|
+
---
|
|
13
|
+
# REST API Design
|
|
14
|
+
Design RESTful APIs following best practices: proper HTTP verbs (GET=read, POST=create, PUT=replace, PATCH=update, DELETE=remove), meaningful status codes (200, 201, 204, 400, 401, 403, 404, 409, 500), cursor-based pagination for lists, consistent error response shape `{ error: string, code: string }`, API versioning via URL prefix (/v1/), and OpenAPI/Swagger documentation for every endpoint.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: debug-mode
|
|
3
|
+
name: Debug Mode
|
|
4
|
+
domain: coding
|
|
5
|
+
category: execution
|
|
6
|
+
tags: [debug, troubleshoot, investigate, hypothesis]
|
|
7
|
+
version: 1
|
|
8
|
+
source: builtin
|
|
9
|
+
successRate: 0
|
|
10
|
+
usageCount: 0
|
|
11
|
+
evolution: []
|
|
12
|
+
---
|
|
13
|
+
# Debug Mode
|
|
14
|
+
Use systematic debugging: 1) Reproduce the issue with a minimal test case, 2) Form a hypothesis about the root cause, 3) Test the hypothesis with targeted investigation, 4) Fix or form new hypothesis. Show your reasoning at each step. Never shotgun-debug (changing random things hoping something works).
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: focus-mode
|
|
3
|
+
name: Focus Mode (GSD)
|
|
4
|
+
domain: coding
|
|
5
|
+
category: execution
|
|
6
|
+
tags: [focus, gsd, speed, autonomous, minimal-questions]
|
|
7
|
+
version: 1
|
|
8
|
+
source: builtin
|
|
9
|
+
successRate: 0
|
|
10
|
+
usageCount: 0
|
|
11
|
+
evolution: []
|
|
12
|
+
---
|
|
13
|
+
# Focus Mode (GSD)
|
|
14
|
+
Work in Get Stuff Done mode. Make reasonable decisions without asking. Build quickly and show results. Only ask questions when truly blocked. Prefer action over deliberation. If two approaches seem equally valid, pick the simpler one and move on.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: loop
|
|
3
|
+
name: Test-Fix Loop
|
|
4
|
+
domain: coding
|
|
5
|
+
category: execution
|
|
6
|
+
tags: [loop, testing, iteration, fix]
|
|
7
|
+
version: 1
|
|
8
|
+
source: builtin
|
|
9
|
+
successRate: 0
|
|
10
|
+
usageCount: 0
|
|
11
|
+
evolution: []
|
|
12
|
+
---
|
|
13
|
+
# Test-Fix Loop
|
|
14
|
+
After implementing, run tests. If tests fail, fix the issues and re-run. Repeat until all tests pass. Show the test results at each iteration. Maximum 5 iterations — if still failing after 5, stop and explain what's wrong.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: performance
|
|
3
|
+
name: Performance Optimization
|
|
4
|
+
domain: coding
|
|
5
|
+
category: frontend
|
|
6
|
+
tags: [performance, lighthouse, web-vitals, bundle, lazy-loading]
|
|
7
|
+
version: 1
|
|
8
|
+
source: builtin
|
|
9
|
+
successRate: 0
|
|
10
|
+
usageCount: 0
|
|
11
|
+
evolution: []
|
|
12
|
+
---
|
|
13
|
+
# Performance Optimization
|
|
14
|
+
Optimize for performance. Use code splitting and dynamic imports for route-level chunks. Lazy load below-fold images and heavy components. Set proper Cache-Control headers for static assets. Minimize main thread blocking (defer non-critical JS). Target Core Web Vitals: LCP < 2.5s, FID < 100ms, CLS < 0.1. Use `next/image` or equivalent for automatic image optimization.
|