create-merlin-brain 3.11.0 → 3.13.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/bin/install.cjs +156 -32
- package/bin/runtime-adapters.cjs +396 -0
- package/dist/server/api/types.d.ts +7 -0
- package/dist/server/api/types.d.ts.map +1 -1
- package/dist/server/cost/tracker.d.ts +38 -2
- package/dist/server/cost/tracker.d.ts.map +1 -1
- package/dist/server/cost/tracker.js +87 -15
- package/dist/server/cost/tracker.js.map +1 -1
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/server.js +74 -30
- package/dist/server/server.js.map +1 -1
- package/dist/server/tools/__tests__/augmentation.test.d.ts +8 -0
- package/dist/server/tools/__tests__/augmentation.test.d.ts.map +1 -0
- package/dist/server/tools/__tests__/augmentation.test.js +76 -0
- package/dist/server/tools/__tests__/augmentation.test.js.map +1 -0
- package/dist/server/tools/__tests__/route-helpers.test.d.ts +5 -0
- package/dist/server/tools/__tests__/route-helpers.test.d.ts.map +1 -0
- package/dist/server/tools/__tests__/route-helpers.test.js +49 -0
- package/dist/server/tools/__tests__/route-helpers.test.js.map +1 -0
- package/dist/server/tools/adaptive.js +1 -1
- package/dist/server/tools/adaptive.js.map +1 -1
- package/dist/server/tools/agent-spawn.d.ts +25 -0
- package/dist/server/tools/agent-spawn.d.ts.map +1 -0
- package/dist/server/tools/agent-spawn.js +95 -0
- package/dist/server/tools/agent-spawn.js.map +1 -0
- package/dist/server/tools/agents-index.js +3 -3
- package/dist/server/tools/agents-index.js.map +1 -1
- package/dist/server/tools/agents.js +5 -5
- package/dist/server/tools/agents.js.map +1 -1
- package/dist/server/tools/augmentation.d.ts +45 -0
- package/dist/server/tools/augmentation.d.ts.map +1 -0
- package/dist/server/tools/augmentation.js +167 -0
- package/dist/server/tools/augmentation.js.map +1 -0
- package/dist/server/tools/behaviors.js +4 -4
- package/dist/server/tools/behaviors.js.map +1 -1
- package/dist/server/tools/context.js +7 -7
- package/dist/server/tools/context.js.map +1 -1
- package/dist/server/tools/cost.d.ts +3 -1
- package/dist/server/tools/cost.d.ts.map +1 -1
- package/dist/server/tools/cost.js +66 -13
- package/dist/server/tools/cost.js.map +1 -1
- package/dist/server/tools/discoveries.js +6 -6
- package/dist/server/tools/discoveries.js.map +1 -1
- 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/learning.d.ts +12 -0
- package/dist/server/tools/learning.d.ts.map +1 -0
- package/dist/server/tools/learning.js +269 -0
- package/dist/server/tools/learning.js.map +1 -0
- package/dist/server/tools/project.js +7 -7
- package/dist/server/tools/project.js.map +1 -1
- package/dist/server/tools/promote.d.ts +11 -0
- package/dist/server/tools/promote.d.ts.map +1 -0
- package/dist/server/tools/promote.js +315 -0
- package/dist/server/tools/promote.js.map +1 -0
- package/dist/server/tools/route-helpers.d.ts +45 -0
- package/dist/server/tools/route-helpers.d.ts.map +1 -0
- package/dist/server/tools/route-helpers.js +93 -0
- package/dist/server/tools/route-helpers.js.map +1 -0
- package/dist/server/tools/route.d.ts +4 -3
- package/dist/server/tools/route.d.ts.map +1 -1
- package/dist/server/tools/route.js +80 -284
- package/dist/server/tools/route.js.map +1 -1
- package/dist/server/tools/session-restore.d.ts +18 -0
- package/dist/server/tools/session-restore.d.ts.map +1 -0
- package/dist/server/tools/session-restore.js +154 -0
- package/dist/server/tools/session-restore.js.map +1 -0
- package/dist/server/tools/session-search.d.ts +16 -0
- package/dist/server/tools/session-search.d.ts.map +1 -0
- package/dist/server/tools/session-search.js +240 -0
- package/dist/server/tools/session-search.js.map +1 -0
- package/dist/server/tools/sights-index.js +2 -2
- package/dist/server/tools/sights-index.js.map +1 -1
- package/dist/server/tools/smart-route.d.ts.map +1 -1
- package/dist/server/tools/smart-route.js +4 -5
- package/dist/server/tools/smart-route.js.map +1 -1
- package/dist/server/tools/verification.js +1 -1
- package/dist/server/tools/verification.js.map +1 -1
- package/files/agents/code-organization-supervisor.md +1 -0
- package/files/agents/context-guardian.md +1 -0
- package/files/agents/docs-keeper.md +1 -0
- package/files/agents/dry-refactor.md +1 -0
- package/files/agents/elite-code-refactorer.md +1 -0
- package/files/agents/hardening-guard.md +1 -0
- package/files/agents/implementation-dev.md +1 -0
- package/files/agents/merlin-access-control-reviewer.md +248 -0
- package/files/agents/merlin-codebase-mapper.md +1 -1
- package/files/agents/merlin-dependency-auditor.md +216 -0
- package/files/agents/merlin-executor.md +1 -0
- package/files/agents/merlin-input-validator.md +247 -0
- package/files/agents/merlin-reviewer.md +1 -0
- package/files/agents/merlin-sast-reviewer.md +182 -0
- package/files/agents/merlin-secret-scanner.md +203 -0
- package/files/agents/tests-qa.md +1 -0
- package/files/commands/merlin/execute-phase.md +94 -197
- package/files/commands/merlin/execute-plan.md +116 -180
- package/files/commands/merlin/health.md +385 -0
- package/files/commands/merlin/loop-recipes.md +93 -36
- package/files/commands/merlin/optimize-prompts.md +158 -0
- package/files/commands/merlin/profiles.md +215 -0
- package/files/commands/merlin/promote.md +176 -0
- package/files/commands/merlin/quick.md +229 -0
- package/files/commands/merlin/resume-work.md +27 -1
- package/files/commands/merlin/route.md +43 -1
- package/files/commands/merlin/sandbox.md +359 -0
- package/files/commands/merlin/usage.md +55 -0
- package/files/docker/Dockerfile.merlin +20 -0
- package/files/docker/docker-compose.merlin.yml +23 -0
- package/files/hook-templates/auto-commit.sh +64 -0
- package/files/hook-templates/auto-format.sh +95 -0
- package/files/hook-templates/auto-test.sh +117 -0
- package/files/hook-templates/branch-protection.sh +72 -0
- package/files/hook-templates/changelog-reminder.sh +76 -0
- package/files/hook-templates/complexity-check.sh +112 -0
- package/files/hook-templates/import-audit.sh +83 -0
- package/files/hook-templates/license-header.sh +84 -0
- package/files/hook-templates/pr-description.sh +100 -0
- package/files/hook-templates/todo-tracker.sh +80 -0
- package/files/hooks/check-file-size.sh +17 -4
- package/files/hooks/config-change.sh +44 -16
- package/files/hooks/instructions-loaded.sh +22 -5
- package/files/hooks/notify-desktop.sh +157 -0
- package/files/hooks/notify-webhook.sh +141 -0
- package/files/hooks/pre-edit-sights-check.sh +76 -9
- package/files/hooks/security-scanner.sh +153 -0
- package/files/hooks/session-end-memory-sync.sh +97 -0
- package/files/hooks/session-end.sh +274 -1
- package/files/hooks/session-start.sh +19 -6
- package/files/hooks/smart-approve.sh +270 -0
- package/files/hooks/teammate-idle-verify.sh +87 -12
- package/files/hooks/worktree-create.sh +20 -3
- package/files/hooks/worktree-remove.sh +21 -3
- package/files/merlin/references/plan-format.md +37 -9
- package/files/merlin/sandbox.json +9 -0
- package/files/merlin/security.json +11 -0
- package/files/merlin/templates/ci/docs-update.yml +81 -0
- package/files/merlin/templates/ci/pr-review.yml +50 -0
- package/files/merlin/templates/ci/security-audit.yml +74 -0
- package/files/merlin/templates/config.json +9 -1
- package/files/rules/api-rules.md +30 -0
- package/files/rules/frontend-rules.md +25 -0
- package/files/rules/hooks-rules.md +36 -0
- package/files/rules/mcp-rules.md +30 -0
- package/files/rules/worker-rules.md +29 -0
- package/package.json +5 -2
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: merlin:profiles
|
|
3
|
+
description: Manage config profiles — snapshot and switch between agent/hook/rule configurations
|
|
4
|
+
argument-hint: "list | create <name> | switch <name> | delete <name>"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Bash
|
|
9
|
+
- Glob
|
|
10
|
+
- AskUserQuestion
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<objective>
|
|
14
|
+
Manage Merlin config profiles. A profile is a named snapshot of your active agents, rules overrides, and hook overrides.
|
|
15
|
+
|
|
16
|
+
Built-in profiles: default, security-audit, frontend, backend.
|
|
17
|
+
Custom profiles are stored in `~/.claude/merlin/profiles/<name>/`.
|
|
18
|
+
|
|
19
|
+
Subcommands:
|
|
20
|
+
- `list` — Show available profiles (built-in + custom) and which is active
|
|
21
|
+
- `create <name>` — Snapshot current config into a new profile
|
|
22
|
+
- `switch <name>` — Apply a profile's overrides to the active config
|
|
23
|
+
- `delete <name>` — Remove a custom profile (built-in profiles cannot be deleted)
|
|
24
|
+
</objective>
|
|
25
|
+
|
|
26
|
+
<context>
|
|
27
|
+
Arguments: $ARGUMENTS
|
|
28
|
+
Profiles root: ~/.claude/merlin/profiles/
|
|
29
|
+
Active profile marker: ~/.claude/merlin/profiles/.active
|
|
30
|
+
</context>
|
|
31
|
+
|
|
32
|
+
<process>
|
|
33
|
+
|
|
34
|
+
## Step 1: Parse subcommand
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
ARGS="$ARGUMENTS"
|
|
38
|
+
SUBCMD=$(echo "$ARGS" | awk '{print $1}')
|
|
39
|
+
PROFILE_NAME=$(echo "$ARGS" | awk '{print $2}')
|
|
40
|
+
PROFILES_DIR="$HOME/.claude/merlin/profiles"
|
|
41
|
+
ACTIVE_MARKER="$PROFILES_DIR/.active"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Subcommand: list
|
|
47
|
+
|
|
48
|
+
Show all available profiles, marking which is currently active.
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
mkdir -p "$PROFILES_DIR"
|
|
52
|
+
ACTIVE=$(cat "$ACTIVE_MARKER" 2>/dev/null || echo "default")
|
|
53
|
+
|
|
54
|
+
echo "Available profiles:"
|
|
55
|
+
echo ""
|
|
56
|
+
|
|
57
|
+
# Built-in profiles
|
|
58
|
+
for name in default security-audit frontend backend; do
|
|
59
|
+
if [ "$name" = "$ACTIVE" ]; then
|
|
60
|
+
echo " * $name (active) [built-in]"
|
|
61
|
+
else
|
|
62
|
+
echo " $name [built-in]"
|
|
63
|
+
fi
|
|
64
|
+
done
|
|
65
|
+
|
|
66
|
+
# Custom profiles
|
|
67
|
+
for dir in "$PROFILES_DIR"/*/; do
|
|
68
|
+
name=$(basename "$dir")
|
|
69
|
+
# Skip built-in names
|
|
70
|
+
case "$name" in
|
|
71
|
+
default|security-audit|frontend|backend) continue ;;
|
|
72
|
+
esac
|
|
73
|
+
if [ "$name" = "$ACTIVE" ]; then
|
|
74
|
+
echo " * $name (active)"
|
|
75
|
+
else
|
|
76
|
+
echo " $name"
|
|
77
|
+
fi
|
|
78
|
+
done
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
If no custom profiles exist, note: "No custom profiles yet. Use `/merlin:profiles create <name>` to snapshot your current config."
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Subcommand: create <name>
|
|
86
|
+
|
|
87
|
+
Snapshot the current active config into a new profile.
|
|
88
|
+
|
|
89
|
+
Validate name:
|
|
90
|
+
- Must match `[a-zA-Z0-9_-]+`
|
|
91
|
+
- Must not conflict with built-in names (default, security-audit, frontend, backend)
|
|
92
|
+
- Must not already exist (if it does, ask user to confirm overwrite)
|
|
93
|
+
|
|
94
|
+
Steps:
|
|
95
|
+
```bash
|
|
96
|
+
PROFILE_DIR="$PROFILES_DIR/$PROFILE_NAME"
|
|
97
|
+
mkdir -p "$PROFILE_DIR"
|
|
98
|
+
|
|
99
|
+
# Snapshot CLAUDE.md overrides if present in project
|
|
100
|
+
[ -f ".claude/CLAUDE.md" ] && cp ".claude/CLAUDE.md" "$PROFILE_DIR/CLAUDE.md"
|
|
101
|
+
|
|
102
|
+
# Snapshot local settings hooks section
|
|
103
|
+
if [ -f ".claude/settings.local.json" ]; then
|
|
104
|
+
cp ".claude/settings.local.json" "$PROFILE_DIR/settings.local.json"
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
# Write profile metadata
|
|
108
|
+
cat > "$PROFILE_DIR/profile.json" << METAEOF
|
|
109
|
+
{
|
|
110
|
+
"name": "$PROFILE_NAME",
|
|
111
|
+
"created": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
|
|
112
|
+
"description": "Custom profile"
|
|
113
|
+
}
|
|
114
|
+
METAEOF
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Report: "Profile '$PROFILE_NAME' created. Switch to it with `/merlin:profiles switch $PROFILE_NAME`."
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Subcommand: switch <name>
|
|
122
|
+
|
|
123
|
+
Apply a profile's overrides to the active config.
|
|
124
|
+
|
|
125
|
+
### Built-in profile definitions
|
|
126
|
+
|
|
127
|
+
**default** — Standard balanced config. No overrides applied; restores baseline.
|
|
128
|
+
|
|
129
|
+
**security-audit** — Security-focused overrides:
|
|
130
|
+
- Activates agents: merlin-security, merlin-sast-reviewer, merlin-secret-scanner, merlin-access-control-reviewer, merlin-dependency-auditor, merlin-input-validator
|
|
131
|
+
- Remind user to run `/merlin:route merlin-security "full audit"` after switching
|
|
132
|
+
|
|
133
|
+
**frontend** — Frontend-focused overrides:
|
|
134
|
+
- Activates agents: merlin-frontend, implementation-dev, tests-qa, dry-refactor
|
|
135
|
+
- Suggest: "Pair with `/merlin:route merlin-frontend` for component work"
|
|
136
|
+
|
|
137
|
+
**backend** — Backend-focused overrides:
|
|
138
|
+
- Activates agents: implementation-dev, merlin-api-designer, merlin-migrator, hardening-guard, tests-qa
|
|
139
|
+
- Suggest: "Pair with `/merlin:route merlin-api-designer` for API design"
|
|
140
|
+
|
|
141
|
+
### Custom profile switch
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
PROFILE_DIR="$PROFILES_DIR/$PROFILE_NAME"
|
|
145
|
+
|
|
146
|
+
if [ ! -d "$PROFILE_DIR" ]; then
|
|
147
|
+
echo "Profile '$PROFILE_NAME' not found. Run \`/merlin:profiles list\` to see available profiles."
|
|
148
|
+
exit 1
|
|
149
|
+
fi
|
|
150
|
+
|
|
151
|
+
# Restore settings if snapshot exists
|
|
152
|
+
if [ -f "$PROFILE_DIR/settings.local.json" ]; then
|
|
153
|
+
cp "$PROFILE_DIR/settings.local.json" ".claude/settings.local.json"
|
|
154
|
+
fi
|
|
155
|
+
if [ -f "$PROFILE_DIR/CLAUDE.md" ]; then
|
|
156
|
+
cp "$PROFILE_DIR/CLAUDE.md" ".claude/CLAUDE.md"
|
|
157
|
+
fi
|
|
158
|
+
|
|
159
|
+
# Mark active
|
|
160
|
+
echo "$PROFILE_NAME" > "$ACTIVE_MARKER"
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Report: "Switched to profile '$PROFILE_NAME'. Active config updated."
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Subcommand: delete <name>
|
|
168
|
+
|
|
169
|
+
Remove a custom profile.
|
|
170
|
+
|
|
171
|
+
Validate:
|
|
172
|
+
- Cannot delete built-in profiles (default, security-audit, frontend, backend) — explain why
|
|
173
|
+
- Cannot delete the currently active profile — prompt user to switch first
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
PROFILE_DIR="$PROFILES_DIR/$PROFILE_NAME"
|
|
177
|
+
|
|
178
|
+
case "$PROFILE_NAME" in
|
|
179
|
+
default|security-audit|frontend|backend)
|
|
180
|
+
echo "Cannot delete built-in profile '$PROFILE_NAME'."
|
|
181
|
+
exit 0
|
|
182
|
+
;;
|
|
183
|
+
esac
|
|
184
|
+
|
|
185
|
+
ACTIVE=$(cat "$ACTIVE_MARKER" 2>/dev/null || echo "default")
|
|
186
|
+
if [ "$PROFILE_NAME" = "$ACTIVE" ]; then
|
|
187
|
+
echo "Cannot delete the active profile. Switch to another profile first."
|
|
188
|
+
exit 0
|
|
189
|
+
fi
|
|
190
|
+
|
|
191
|
+
if [ ! -d "$PROFILE_DIR" ]; then
|
|
192
|
+
echo "Profile '$PROFILE_NAME' not found."
|
|
193
|
+
exit 0
|
|
194
|
+
fi
|
|
195
|
+
|
|
196
|
+
rm -rf "$PROFILE_DIR"
|
|
197
|
+
echo "Profile '$PROFILE_NAME' deleted."
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Step 2: Display results
|
|
203
|
+
|
|
204
|
+
After each operation, confirm the result clearly. For `list`, display the full table. For `switch`, confirm the new active profile and suggest relevant next steps.
|
|
205
|
+
|
|
206
|
+
</process>
|
|
207
|
+
|
|
208
|
+
<success_criteria>
|
|
209
|
+
- [ ] `list` shows built-in and custom profiles, marks active
|
|
210
|
+
- [ ] `create` snapshots current settings.local.json and CLAUDE.md
|
|
211
|
+
- [ ] `switch` applies profile overrides and updates active marker
|
|
212
|
+
- [ ] `delete` prevents removing built-in or active profiles
|
|
213
|
+
- [ ] Built-in profiles are described without needing files on disk
|
|
214
|
+
- [ ] All operations are idempotent and safe to re-run
|
|
215
|
+
</success_criteria>
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: merlin:promote
|
|
3
|
+
description: Promote a high-confidence learned behavior into a permanent reusable skill or agent
|
|
4
|
+
argument-hint: "[behavior-id or keyword]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- mcp__merlin__merlin_get_behaviors
|
|
7
|
+
- mcp__merlin__merlin_list_promotion_candidates
|
|
8
|
+
- mcp__merlin__merlin_promote_behavior
|
|
9
|
+
- AskUserQuestion
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<objective>
|
|
13
|
+
Turn proven learned behaviors into first-class, permanent skills.
|
|
14
|
+
|
|
15
|
+
Behaviors with confidence >= 0.85 have been validated enough to be formalized. This command
|
|
16
|
+
walks you through selecting candidates, reviewing auto-generated skill drafts, editing them,
|
|
17
|
+
and saving them to the project's Sights catalog — where they become discoverable by all agents.
|
|
18
|
+
</objective>
|
|
19
|
+
|
|
20
|
+
<process>
|
|
21
|
+
|
|
22
|
+
## Step 1: Parse Arguments
|
|
23
|
+
|
|
24
|
+
Extract from $ARGUMENTS (optional):
|
|
25
|
+
- **behavior-id**: A specific behavior UUID to promote directly
|
|
26
|
+
- **keyword**: A word/phrase to filter candidates by pattern text
|
|
27
|
+
|
|
28
|
+
If no argument is given, proceed to list all candidates.
|
|
29
|
+
|
|
30
|
+
## Step 2: Load Promotion Candidates
|
|
31
|
+
|
|
32
|
+
Call `merlin_list_promotion_candidates` with no filters.
|
|
33
|
+
|
|
34
|
+
If the result says there are no candidates yet:
|
|
35
|
+
```
|
|
36
|
+
No behaviors are ready for promotion yet.
|
|
37
|
+
Confidence >= 0.85 is required. Keep applying behaviors — each successful
|
|
38
|
+
application adds +0.05 confidence.
|
|
39
|
+
|
|
40
|
+
Use /merlin:check-behaviors to see current confidence levels.
|
|
41
|
+
```
|
|
42
|
+
Then stop.
|
|
43
|
+
|
|
44
|
+
## Step 3: Display Candidates
|
|
45
|
+
|
|
46
|
+
Present the candidates in a numbered list:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
Promotion Candidates ({N} behaviors ready)
|
|
50
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
51
|
+
|
|
52
|
+
[1] {pattern}
|
|
53
|
+
Action: {action}
|
|
54
|
+
Confidence: {confidence} | Applied: {timesApplied}x
|
|
55
|
+
ID: {id}
|
|
56
|
+
|
|
57
|
+
[2] ...
|
|
58
|
+
|
|
59
|
+
[A] Promote ALL candidates
|
|
60
|
+
[Q] Quit
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Step 4: Ask User to Select
|
|
64
|
+
|
|
65
|
+
Ask the user which behavior(s) to promote. Accept:
|
|
66
|
+
- A single number (promote that one)
|
|
67
|
+
- Multiple numbers comma-separated ("1,3")
|
|
68
|
+
- "A" to promote all
|
|
69
|
+
- "Q" to quit
|
|
70
|
+
|
|
71
|
+
If $ARGUMENTS had a valid behavior-id or keyword, auto-select matching candidates
|
|
72
|
+
and skip the question (just confirm: "Found behavior matching '{keyword}' — promoting it.").
|
|
73
|
+
|
|
74
|
+
## Step 5: Generate Skill Draft(s)
|
|
75
|
+
|
|
76
|
+
For the selected behaviors, call:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
merlin_promote_behavior(
|
|
80
|
+
behaviorId: "{id}", // or omit and use patternKeyword if multi-select
|
|
81
|
+
repoUrl: optional
|
|
82
|
+
)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
If multiple behaviors selected, call once with no behaviorId to get all clustered:
|
|
86
|
+
```
|
|
87
|
+
merlin_promote_behavior() // clusters ALL candidates automatically
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Step 6: Present Draft for Review
|
|
91
|
+
|
|
92
|
+
Show each draft inside a code block. Then ask:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
Review the skill draft above.
|
|
96
|
+
|
|
97
|
+
[A] Approve and save as-is
|
|
98
|
+
[E] Edit then save (paste your edited version)
|
|
99
|
+
[S] Skip this skill
|
|
100
|
+
[Q] Quit without saving
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
If the user chooses **E**:
|
|
104
|
+
- Ask them to paste their edited SKILL.md content
|
|
105
|
+
- Use their version as the skillDraft
|
|
106
|
+
|
|
107
|
+
## Step 7: Save Approved Draft
|
|
108
|
+
|
|
109
|
+
When user approves (A or E):
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
merlin_promote_behavior(
|
|
113
|
+
approved: true,
|
|
114
|
+
skillDraft: "{draft content}",
|
|
115
|
+
repoUrl: optional
|
|
116
|
+
)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Show the confirmation message returned by the tool.
|
|
120
|
+
|
|
121
|
+
## Step 8: Handle Multiple Drafts
|
|
122
|
+
|
|
123
|
+
If there were multiple skill drafts, loop through each (Step 6-7) before finishing.
|
|
124
|
+
|
|
125
|
+
## Step 9: Summary
|
|
126
|
+
|
|
127
|
+
After all drafts are handled:
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
Promotion complete
|
|
131
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
132
|
+
|
|
133
|
+
Saved: {N} skill(s)
|
|
134
|
+
Skipped: {M} skill(s)
|
|
135
|
+
|
|
136
|
+
Saved skills are now in the Sights index and discoverable by:
|
|
137
|
+
merlin_get_context("skill: {name}")
|
|
138
|
+
|
|
139
|
+
Next: Reference these skills in agent prompts or route tasks to them
|
|
140
|
+
via /merlin:route.
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
</process>
|
|
144
|
+
|
|
145
|
+
<behavior_clustering>
|
|
146
|
+
|
|
147
|
+
When multiple behaviors share overlapping trigger keywords (Jaccard similarity >= 0.3),
|
|
148
|
+
the promotion tool automatically clusters them into a single skill with multiple actions.
|
|
149
|
+
This keeps the agent catalog focused rather than fragmenting related patterns.
|
|
150
|
+
|
|
151
|
+
Example: "always run tests after editing src/" and "always run lint on TypeScript files"
|
|
152
|
+
would cluster into a "QualityGates" skill with two actions.
|
|
153
|
+
|
|
154
|
+
The draft shows which behaviors were merged and preserves their individual trigger conditions.
|
|
155
|
+
|
|
156
|
+
</behavior_clustering>
|
|
157
|
+
|
|
158
|
+
<error_handling>
|
|
159
|
+
|
|
160
|
+
| Condition | Action |
|
|
161
|
+
|-----------|--------|
|
|
162
|
+
| No candidates yet | Explain threshold, show path to get there |
|
|
163
|
+
| Behavior ID not found | Show available IDs, ask user to re-select |
|
|
164
|
+
| API unavailable | Inform user, suggest trying again later |
|
|
165
|
+
| User skips all drafts | Exit cleanly with "Nothing saved" message |
|
|
166
|
+
| Draft edit is empty | Ask again, do not save empty skill |
|
|
167
|
+
|
|
168
|
+
</error_handling>
|
|
169
|
+
|
|
170
|
+
<design_notes>
|
|
171
|
+
- This command is a guided UX wrapper around merlin_promote_behavior and merlin_list_promotion_candidates
|
|
172
|
+
- The tools do the heavy lifting (clustering, draft generation, saving)
|
|
173
|
+
- Always show the draft BEFORE saving — never auto-save without user review
|
|
174
|
+
- Skill drafts are saved to the Sights catalog as discoveries, not as local files
|
|
175
|
+
- Skills are retrievable with merlin_get_context("skill: {name}")
|
|
176
|
+
</design_notes>
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: merlin:quick
|
|
3
|
+
description: Run an ad-hoc task with Merlin guarantees but no ceremony — no plan files, no phase tracking
|
|
4
|
+
argument-hint: "\"task description\""
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Glob
|
|
8
|
+
- Grep
|
|
9
|
+
- Bash
|
|
10
|
+
- Write
|
|
11
|
+
- AskUserQuestion
|
|
12
|
+
- mcp__merlin__merlin_get_context
|
|
13
|
+
- mcp__merlin__merlin_search
|
|
14
|
+
- mcp__merlin__merlin_find_files
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<objective>
|
|
18
|
+
Handle ad-hoc tasks fast — no PLAN.md, no STATE.md updates, no phase ceremony.
|
|
19
|
+
|
|
20
|
+
Skips: research agents, discussion phase, plan-checking, post-execution verification.
|
|
21
|
+
Provides: Sights context injection, specialist routing, fresh 200K process, git diff review.
|
|
22
|
+
|
|
23
|
+
Perfect for: bug fixes, small features, one-off tasks, config changes, experiments.
|
|
24
|
+
Use the full workflow (`/merlin:plan-phase` + `/merlin:execute-plan`) for anything that touches core architecture or spans multiple files significantly.
|
|
25
|
+
|
|
26
|
+
Estimated 40-50% token reduction vs full workflow.
|
|
27
|
+
</objective>
|
|
28
|
+
|
|
29
|
+
<context>
|
|
30
|
+
User's task: $ARGUMENTS
|
|
31
|
+
</context>
|
|
32
|
+
|
|
33
|
+
<process>
|
|
34
|
+
|
|
35
|
+
## Step 1: Parse Task
|
|
36
|
+
|
|
37
|
+
Extract task description from $ARGUMENTS (the quoted string).
|
|
38
|
+
|
|
39
|
+
If no arguments provided:
|
|
40
|
+
```
|
|
41
|
+
Usage: /merlin:quick "task description"
|
|
42
|
+
|
|
43
|
+
Examples:
|
|
44
|
+
/merlin:quick "add dark mode toggle to settings page"
|
|
45
|
+
/merlin:quick "fix the 404 on /api/users when id is missing"
|
|
46
|
+
/merlin:quick "write tests for the auth middleware"
|
|
47
|
+
/merlin:quick "update README with new env vars"
|
|
48
|
+
```
|
|
49
|
+
Exit.
|
|
50
|
+
|
|
51
|
+
## Step 2: Get Sights Context
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
Call: merlin_get_context
|
|
55
|
+
Task: "{task-description}"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Store as SIGHTS_CONTEXT. If unavailable, use Glob, Grep, and Read to discover relevant files manually.
|
|
59
|
+
|
|
60
|
+
## Step 3: Determine Best Agent
|
|
61
|
+
|
|
62
|
+
Route based on task description keywords:
|
|
63
|
+
|
|
64
|
+
| Task type | Agent |
|
|
65
|
+
|-----------|-------|
|
|
66
|
+
| Code, feature, fix, refactor, implement, add, change, update (code) | `implementation-dev` |
|
|
67
|
+
| Test, spec, coverage, unit, integration, e2e | `tests-qa` |
|
|
68
|
+
| Docs, README, comment, document, explain | `docs-keeper` |
|
|
69
|
+
| Debug, error, crash, broken, failing, investigate | `merlin-debugger` |
|
|
70
|
+
| API design, endpoint, schema, contract | `merlin-api-designer` |
|
|
71
|
+
| Performance, slow, optimize, bottleneck | `merlin-performance` |
|
|
72
|
+
| Frontend, UI, component, styling, CSS | `merlin-frontend` |
|
|
73
|
+
| Migration, schema change, data | `merlin-migrator` |
|
|
74
|
+
| Security, vulnerability, auth, permissions | `merlin-security` |
|
|
75
|
+
|
|
76
|
+
If unclear, default to `implementation-dev`.
|
|
77
|
+
|
|
78
|
+
State the chosen agent and why, one line.
|
|
79
|
+
|
|
80
|
+
## Step 4: Clarify If Needed
|
|
81
|
+
|
|
82
|
+
If the task is ambiguous in a way that would cause the agent to make wrong assumptions, ask ONE focused question using AskUserQuestion.
|
|
83
|
+
|
|
84
|
+
Examples of good clarifying questions:
|
|
85
|
+
- "Should this update the existing endpoint or create a new one?"
|
|
86
|
+
- "Is this for the frontend or backend auth layer?"
|
|
87
|
+
|
|
88
|
+
If the task is clear, skip this step and note: "Task is clear — spawning {agent} directly."
|
|
89
|
+
|
|
90
|
+
## Step 5: Spawn Fresh Agent
|
|
91
|
+
|
|
92
|
+
Write a handoff file and spawn the specialist in a fresh 200K context.
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
HANDOFF_DIR="/tmp/merlin-quick-$$"
|
|
96
|
+
mkdir -p "$HANDOFF_DIR"
|
|
97
|
+
HANDOFF_FILE="$HANDOFF_DIR/handoff.md"
|
|
98
|
+
RESULT_FILE="$HANDOFF_DIR/result.md"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Write handoff content:
|
|
102
|
+
|
|
103
|
+
```markdown
|
|
104
|
+
# Quick Task Handoff
|
|
105
|
+
|
|
106
|
+
## Your Task
|
|
107
|
+
{task-description}
|
|
108
|
+
|
|
109
|
+
## Mode
|
|
110
|
+
automated — make reasonable assumptions. Do NOT output CHECKPOINT_NEEDED.
|
|
111
|
+
State any assumptions you made at the end.
|
|
112
|
+
|
|
113
|
+
## Merlin Sights Context
|
|
114
|
+
{SIGHTS_CONTEXT}
|
|
115
|
+
|
|
116
|
+
## Constraints
|
|
117
|
+
- This is a quick task — scope to what's described, no more
|
|
118
|
+
- Prefer targeted changes over broad refactors
|
|
119
|
+
- If you discover something bigger that needs attention, note it in Decisions but do NOT fix it
|
|
120
|
+
- Commit your changes when done with a clear conventional commit message
|
|
121
|
+
|
|
122
|
+
## Result Protocol
|
|
123
|
+
When done, output this exact block at the END of your response:
|
|
124
|
+
|
|
125
|
+
---QUICK_RESULT---
|
|
126
|
+
Status: completed | error
|
|
127
|
+
Summary: <2-3 sentence summary of what you did>
|
|
128
|
+
Files-Changed: <comma-separated list of files modified>
|
|
129
|
+
Decisions: <key decisions and assumptions, one per line>
|
|
130
|
+
Follow-Up: <anything bigger discovered that needs attention, one per line>
|
|
131
|
+
---END_QUICK_RESULT---
|
|
132
|
+
|
|
133
|
+
Also write a detailed result to: {RESULT_FILE}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Spawn:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
unset CLAUDECODE && cat "$HANDOFF_FILE" | claude \
|
|
140
|
+
--agent {agent-name} \
|
|
141
|
+
-p \
|
|
142
|
+
--permission-mode acceptEdits \
|
|
143
|
+
--output-format text \
|
|
144
|
+
2>&1
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Use Bash tool with `timeout: 600000` (10 minutes max).
|
|
148
|
+
|
|
149
|
+
## Step 6: Review Changes
|
|
150
|
+
|
|
151
|
+
After the agent completes:
|
|
152
|
+
|
|
153
|
+
1. Parse the `---QUICK_RESULT---` block from output.
|
|
154
|
+
2. Run a quick git diff review:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
git diff --stat HEAD 2>/dev/null
|
|
158
|
+
git diff HEAD 2>/dev/null | head -100
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
3. Check exit code — non-zero means error; show output and offer retry.
|
|
162
|
+
|
|
163
|
+
4. Clean up:
|
|
164
|
+
```bash
|
|
165
|
+
rm -rf "$HANDOFF_DIR"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Step 7: Present Result
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
════════════════════════════════════════
|
|
172
|
+
Quick Task — {agent-name} completed
|
|
173
|
+
════════════════════════════════════════
|
|
174
|
+
|
|
175
|
+
{summary from result}
|
|
176
|
+
|
|
177
|
+
Files changed:
|
|
178
|
+
{files-changed list}
|
|
179
|
+
|
|
180
|
+
Decisions / Assumptions:
|
|
181
|
+
{decisions from result}
|
|
182
|
+
|
|
183
|
+
{If follow-up items exist:}
|
|
184
|
+
Noticed (not fixed):
|
|
185
|
+
{follow-up items — these may warrant a full workflow}
|
|
186
|
+
|
|
187
|
+
────────────────────────────────────────
|
|
188
|
+
Looks good? Run: git add -p && git commit
|
|
189
|
+
Or discard: git checkout .
|
|
190
|
+
────────────────────────────────────────
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
If any follow-up items were surfaced, suggest:
|
|
194
|
+
```
|
|
195
|
+
For larger work found above, consider:
|
|
196
|
+
/merlin:plan-phase — full workflow with planning + execution
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
</process>
|
|
200
|
+
|
|
201
|
+
<agent_selection_notes>
|
|
202
|
+
- `implementation-dev` handles the vast majority of quick code tasks
|
|
203
|
+
- Only switch to a specialist if the task is clearly domain-specific
|
|
204
|
+
- When in doubt, `implementation-dev` is the right default — it knows to call other agents if needed
|
|
205
|
+
- Never spawn `merlin-planner`, `system-architect`, or `product-spec` for quick tasks — those are for full workflow phases
|
|
206
|
+
</agent_selection_notes>
|
|
207
|
+
|
|
208
|
+
<error_handling>
|
|
209
|
+
|
|
210
|
+
| Condition | Action |
|
|
211
|
+
|-----------|--------|
|
|
212
|
+
| No arguments | Show usage examples, exit |
|
|
213
|
+
| Sights unavailable | Proceed with manual discovery via Glob/Grep |
|
|
214
|
+
| Agent not found | Default to `implementation-dev` |
|
|
215
|
+
| Spawn fails (exit != 0) | Show error output, offer retry or `/merlin:debug` |
|
|
216
|
+
| Spawn times out (>10 min) | Warn: task too large for quick mode, suggest full workflow |
|
|
217
|
+
| No result block in output | Treat full output as summary, still run git diff review |
|
|
218
|
+
| Nothing changed in git | Note: agent may have analyzed only — confirm with user |
|
|
219
|
+
|
|
220
|
+
</error_handling>
|
|
221
|
+
|
|
222
|
+
<design_notes>
|
|
223
|
+
- NEVER use Task() — it shares parent context, not true isolation
|
|
224
|
+
- ALWAYS use `claude --agent <name> -p` via Bash — true fresh process
|
|
225
|
+
- No PLAN.md written — that's the whole point of quick mode
|
|
226
|
+
- No STATE.md update — quick tasks are ephemeral by design
|
|
227
|
+
- The git diff IS the verification — no formal verify-work agent
|
|
228
|
+
- For anything that feels like it needs a plan, redirect to the full workflow
|
|
229
|
+
</design_notes>
|
|
@@ -12,7 +12,8 @@ allowed-tools:
|
|
|
12
12
|
<objective>
|
|
13
13
|
Restore complete project context and resume work seamlessly from previous session.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
First restores the last session snapshot (files changed, commits, agents used),
|
|
16
|
+
then routes to the resume-project workflow which handles:
|
|
16
17
|
|
|
17
18
|
- STATE.md loading (or reconstruction if missing)
|
|
18
19
|
- Checkpoint detection (.continue-here files)
|
|
@@ -26,6 +27,25 @@ Routes to the resume-project workflow which handles:
|
|
|
26
27
|
</execution_context>
|
|
27
28
|
|
|
28
29
|
<process>
|
|
30
|
+
## Step 1 — Restore last session context
|
|
31
|
+
|
|
32
|
+
Call `merlin_session_restore` to load the previous session snapshot before
|
|
33
|
+
opening any PLAN files. This gives immediate visibility into what was worked
|
|
34
|
+
on, which files were modified, and which agents were used last time.
|
|
35
|
+
|
|
36
|
+
If `merlin_session_restore` returns a session, show a brief summary:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
## Last Session
|
|
40
|
+
<timestamp> — <duration>
|
|
41
|
+
<summary text>
|
|
42
|
+
Files: <count> modified | Commits: <count> | Agents: <list>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
If no session is found, note it and continue to Step 2.
|
|
46
|
+
|
|
47
|
+
## Step 2 — Follow the resume-project workflow
|
|
48
|
+
|
|
29
49
|
**Follow the resume-project workflow** from `@~/.claude/merlin/workflows/resume-project.md`.
|
|
30
50
|
|
|
31
51
|
The workflow handles all resumption logic including:
|
|
@@ -37,4 +57,10 @@ The workflow handles all resumption logic including:
|
|
|
37
57
|
5. Context-aware option offering (checks CONTEXT.md before suggesting plan vs discuss)
|
|
38
58
|
6. Routing to appropriate next command
|
|
39
59
|
7. Session continuity updates
|
|
60
|
+
|
|
61
|
+
## Tips
|
|
62
|
+
|
|
63
|
+
- Use `merlin_session_search(query="...")` to find a specific past session
|
|
64
|
+
(e.g., `merlin_session_search(query="OAuth login")`)
|
|
65
|
+
- Use `merlin_session_restore(count=3)` to see the last 3 sessions at once
|
|
40
66
|
</process>
|