oh-my-customcode 0.33.1 → 0.35.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 +19 -19
- package/package.json +1 -1
- package/templates/.claude/hooks/hooks.json +10 -0
- package/templates/.claude/hooks/scripts/cost-cap-advisor.sh +71 -0
- package/templates/.claude/hooks/scripts/stuck-detector.sh +62 -2
- package/templates/.claude/hooks/scripts/task-outcome-recorder.sh +34 -7
- package/templates/.claude/rules/MUST-agent-design.md +2 -2
- package/templates/.claude/skills/analysis/SKILL.md +2 -2
- package/templates/.claude/skills/audit-agents/SKILL.md +1 -1
- package/templates/.claude/skills/create-agent/SKILL.md +1 -1
- package/templates/.claude/skills/dev-refactor/SKILL.md +76 -0
- package/templates/.claude/skills/dev-review/SKILL.md +76 -0
- package/templates/.claude/skills/evaluator-optimizer/SKILL.md +256 -0
- package/templates/.claude/skills/fix-refs/SKILL.md +1 -1
- package/templates/.claude/skills/help/SKILL.md +2 -2
- package/templates/.claude/skills/lists/SKILL.md +2 -2
- package/templates/.claude/skills/monitoring-setup/SKILL.md +1 -1
- package/templates/.claude/skills/npm-audit/SKILL.md +1 -1
- package/templates/.claude/skills/npm-publish/SKILL.md +1 -1
- package/templates/.claude/skills/npm-version/SKILL.md +1 -1
- package/templates/.claude/skills/research/SKILL.md +116 -0
- package/templates/.claude/skills/sauron-watch/SKILL.md +1 -1
- package/templates/.claude/skills/status/SKILL.md +2 -2
- package/templates/.claude/skills/task-decomposition/SKILL.md +13 -0
- package/templates/.claude/skills/update-docs/SKILL.md +1 -1
- package/templates/.claude/skills/update-external/SKILL.md +1 -1
- package/templates/.claude/skills/worker-reviewer-pipeline/SKILL.md +10 -0
- package/templates/.claude/statusline.sh +6 -0
- package/templates/CLAUDE.md.en +21 -21
- package/templates/CLAUDE.md.ko +21 -21
- package/templates/guides/claude-code/12-workflow-patterns.md +182 -0
- package/templates/manifest.json +3 -3
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ Like oh-my-zsh transformed shell customization, oh-my-customcode makes personali
|
|
|
21
21
|
|
|
22
22
|
| Feature | Description |
|
|
23
23
|
|---------|-------------|
|
|
24
|
-
| **Batteries Included** | 44 agents,
|
|
24
|
+
| **Batteries Included** | 44 agents, 71 skills, 25 guides, 19 rules, 1 hook, 4 contexts, ontology graph - ready to use out of the box |
|
|
25
25
|
| **Sub-Agent Model** | Supports hierarchical agent orchestration with specialized roles |
|
|
26
26
|
| **Dead Simple Customization** | Create a folder + markdown file = new agent or skill |
|
|
27
27
|
| **Mix and Match** | Use built-in components, create your own, or combine both |
|
|
@@ -101,7 +101,7 @@ All commands are invoked inside the Claude Code conversation.
|
|
|
101
101
|
|
|
102
102
|
| Command | Description |
|
|
103
103
|
|---------|-------------|
|
|
104
|
-
| `/analysis` | Analyze project and auto-configure agents, skills, rules |
|
|
104
|
+
| `/omcustom:analysis` | Analyze project and auto-configure agents, skills, rules |
|
|
105
105
|
| `/research` | 10-team parallel deep analysis with cross-verification |
|
|
106
106
|
|
|
107
107
|
#### Development
|
|
@@ -115,11 +115,11 @@ All commands are invoked inside the Claude Code conversation.
|
|
|
115
115
|
|
|
116
116
|
| Command | Description |
|
|
117
117
|
|---------|-------------|
|
|
118
|
-
| `/create-agent` | Create new agent |
|
|
119
|
-
| `/update-docs` | Sync project structure and documentation |
|
|
120
|
-
| `/update-external` | Update agents from external sources |
|
|
121
|
-
| `/audit-agents` | Audit agent dependencies |
|
|
122
|
-
| `/fix-refs` | Fix broken references |
|
|
118
|
+
| `/omcustom:create-agent` | Create new agent |
|
|
119
|
+
| `/omcustom:update-docs` | Sync project structure and documentation |
|
|
120
|
+
| `/omcustom:update-external` | Update agents from external sources |
|
|
121
|
+
| `/omcustom:audit-agents` | Audit agent dependencies |
|
|
122
|
+
| `/omcustom:fix-refs` | Fix broken references |
|
|
123
123
|
|
|
124
124
|
#### Memory
|
|
125
125
|
|
|
@@ -128,13 +128,13 @@ All commands are invoked inside the Claude Code conversation.
|
|
|
128
128
|
| `/memory-save` | Save session context to claude-mem |
|
|
129
129
|
| `/memory-recall` | Search and recall memories |
|
|
130
130
|
|
|
131
|
-
#### DevOps &
|
|
131
|
+
#### DevOps & Package Management
|
|
132
132
|
|
|
133
133
|
| Command | Description |
|
|
134
134
|
|---------|-------------|
|
|
135
|
-
| `/npm-publish` | Publish package to npm registry |
|
|
136
|
-
| `/npm-version` | Semantic version management |
|
|
137
|
-
| `/npm-audit` | Dependency security audit |
|
|
135
|
+
| `/omcustom:npm-publish` | Publish package to npm registry |
|
|
136
|
+
| `/omcustom:npm-version` | Semantic version management |
|
|
137
|
+
| `/omcustom:npm-audit` | Dependency security audit |
|
|
138
138
|
|
|
139
139
|
#### Optimization
|
|
140
140
|
|
|
@@ -148,14 +148,14 @@ All commands are invoked inside the Claude Code conversation.
|
|
|
148
148
|
|
|
149
149
|
| Command | Description |
|
|
150
150
|
|---------|-------------|
|
|
151
|
-
| `/sauron-watch` | Full R017 sync verification |
|
|
152
|
-
| `/monitoring-setup` | OTel console monitoring enable/disable |
|
|
151
|
+
| `/omcustom:sauron-watch` | Full R017 sync verification |
|
|
152
|
+
| `/omcustom:monitoring-setup` | OTel console monitoring enable/disable |
|
|
153
153
|
| `/codex-exec` | Execute Codex CLI prompt |
|
|
154
154
|
| `/deep-plan` | Research-validated planning (research → plan → verify) |
|
|
155
155
|
| `/structured-dev-cycle` | 6-phase structured development cycle |
|
|
156
|
-
| `/lists` | Show all available commands |
|
|
157
|
-
| `/status` | System status and health checks |
|
|
158
|
-
| `/help` | Help information |
|
|
156
|
+
| `/omcustom:lists` | Show all available commands |
|
|
157
|
+
| `/omcustom:status` | System status and health checks |
|
|
158
|
+
| `/omcustom:help` | Help information |
|
|
159
159
|
|
|
160
160
|
---
|
|
161
161
|
|
|
@@ -179,7 +179,7 @@ All commands are invoked inside the Claude Code conversation.
|
|
|
179
179
|
| **Security** | 1 | sec-codeql-expert |
|
|
180
180
|
| **Total** | **44** | |
|
|
181
181
|
|
|
182
|
-
### Skills (
|
|
182
|
+
### Skills (71)
|
|
183
183
|
|
|
184
184
|
| Category | Count | Skills |
|
|
185
185
|
|----------|-------|--------|
|
|
@@ -192,7 +192,7 @@ All commands are invoked inside the Claude Code conversation.
|
|
|
192
192
|
| **Package Management** | 3 | npm-publish, npm-version, npm-audit |
|
|
193
193
|
| **Operations** | 7 | update-docs, update-external, audit-agents, fix-refs, sauron-watch, monitoring-setup, claude-code-bible |
|
|
194
194
|
| **Utilities** | 5 | lists, help, status, result-aggregation, writing-clearly-and-concisely |
|
|
195
|
-
| **Quality & Workflow** |
|
|
195
|
+
| **Quality & Workflow** | 11 | multi-model-verification, structured-dev-cycle, model-escalation, stuck-recovery, dag-orchestration, task-decomposition, worker-reviewer-pipeline, pr-auto-improve, pipeline-guards, deep-plan, evaluator-optimizer |
|
|
196
196
|
| **Security** | 2 | cve-triage, jinja2-prompts |
|
|
197
197
|
| **Research** | 1 | research |
|
|
198
198
|
| **Deploy** | 2 | vercel-deploy, codex-exec |
|
|
@@ -281,7 +281,7 @@ your-project/
|
|
|
281
281
|
│ │ ├── be-fastapi-expert.md
|
|
282
282
|
│ │ ├── mgr-creator.md
|
|
283
283
|
│ │ └── ...
|
|
284
|
-
│ ├── skills/ # Skill modules (
|
|
284
|
+
│ ├── skills/ # Skill modules (71 directories, each with SKILL.md)
|
|
285
285
|
│ │ ├── go-best-practices/
|
|
286
286
|
│ │ ├── react-best-practices/
|
|
287
287
|
│ │ ├── secretary-routing/
|
package/package.json
CHANGED
|
@@ -221,6 +221,16 @@
|
|
|
221
221
|
}
|
|
222
222
|
],
|
|
223
223
|
"description": "Detect repetitive failure loops and advise recovery strategies"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"matcher": "tool == \"Edit\" || tool == \"Write\" || tool == \"Bash\" || tool == \"Task\" || tool == \"Agent\"",
|
|
227
|
+
"hooks": [
|
|
228
|
+
{
|
|
229
|
+
"type": "command",
|
|
230
|
+
"command": "bash .claude/hooks/scripts/cost-cap-advisor.sh"
|
|
231
|
+
}
|
|
232
|
+
],
|
|
233
|
+
"description": "Advisory cost cap monitoring — warn when session cost approaches configurable limit"
|
|
224
234
|
}
|
|
225
235
|
],
|
|
226
236
|
"Stop": [
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# cost-cap-advisor.sh — Advisory hook for session cost monitoring
|
|
3
|
+
# Trigger: PostToolUse (Agent/Task)
|
|
4
|
+
# Purpose: Warn when session cost approaches configurable cap
|
|
5
|
+
# Protocol: stdin JSON -> stdout pass-through, exit 0 always (advisory only, R010)
|
|
6
|
+
|
|
7
|
+
input=$(cat)
|
|
8
|
+
|
|
9
|
+
# Cost bridge file written by statusline.sh
|
|
10
|
+
COST_FILE="/tmp/.claude-cost-${PPID}"
|
|
11
|
+
ADVISORY_FILE="/tmp/.claude-cost-advisory-${PPID}"
|
|
12
|
+
|
|
13
|
+
# Configurable cap (default $5.00, override via CLAUDE_COST_CAP env var)
|
|
14
|
+
COST_CAP="${CLAUDE_COST_CAP:-5.00}"
|
|
15
|
+
|
|
16
|
+
# Check if cost data is available
|
|
17
|
+
if [ ! -f "$COST_FILE" ]; then
|
|
18
|
+
echo "$input"
|
|
19
|
+
exit 0
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
# Read cost data (TSV: cost_usd, ctx_pct, timestamp)
|
|
23
|
+
IFS=$'\t' read -r cost_usd ctx_pct timestamp < "$COST_FILE" 2>/dev/null || {
|
|
24
|
+
echo "$input"
|
|
25
|
+
exit 0
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
# Validate cost_usd is a number
|
|
29
|
+
if ! printf '%f' "$cost_usd" >/dev/null 2>&1; then
|
|
30
|
+
echo "$input"
|
|
31
|
+
exit 0
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
# Calculate percentage of cap used
|
|
35
|
+
# Use bc for float arithmetic
|
|
36
|
+
cost_pct=$(echo "scale=0; $cost_usd * 100 / $COST_CAP" | bc 2>/dev/null || echo "0")
|
|
37
|
+
|
|
38
|
+
# Staleness check — skip if data is older than 60 seconds
|
|
39
|
+
now=$(date +%s)
|
|
40
|
+
age=$((now - ${timestamp:-0}))
|
|
41
|
+
if [ "$age" -gt 60 ]; then
|
|
42
|
+
echo "$input"
|
|
43
|
+
exit 0
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
# Read last advisory level to avoid repeating the same warning
|
|
47
|
+
last_level=""
|
|
48
|
+
if [ -f "$ADVISORY_FILE" ]; then
|
|
49
|
+
last_level=$(cat "$ADVISORY_FILE" 2>/dev/null || echo "")
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
# Determine advisory level and emit warning (only once per level)
|
|
53
|
+
if [ "$cost_pct" -ge 100 ] && [ "$last_level" != "100" ]; then
|
|
54
|
+
echo "[Cost Cap] Session cost \$${cost_usd} has reached cap \$${COST_CAP} (${cost_pct}%)" >&2
|
|
55
|
+
echo "[Cost Cap] Consider wrapping up or increasing CLAUDE_COST_CAP" >&2
|
|
56
|
+
echo "100" > "$ADVISORY_FILE"
|
|
57
|
+
elif [ "$cost_pct" -ge 90 ] && [ "$last_level" != "90" ] && [ "$last_level" != "100" ]; then
|
|
58
|
+
echo "[Cost Cap] Session cost \$${cost_usd} at 90% of cap \$${COST_CAP}" >&2
|
|
59
|
+
echo "[Cost Cap] Ecomode recommended — consider /compact" >&2
|
|
60
|
+
echo "90" > "$ADVISORY_FILE"
|
|
61
|
+
elif [ "$cost_pct" -ge 75 ] && [ "$last_level" != "75" ] && [ "$last_level" != "90" ] && [ "$last_level" != "100" ]; then
|
|
62
|
+
echo "[Cost Cap] Session cost \$${cost_usd} at 75% of cap \$${COST_CAP}" >&2
|
|
63
|
+
echo "75" > "$ADVISORY_FILE"
|
|
64
|
+
elif [ "$cost_pct" -ge 50 ] && [ -z "$last_level" ]; then
|
|
65
|
+
echo "[Cost Cap] Session cost \$${cost_usd} at 50% of cap \$${COST_CAP}" >&2
|
|
66
|
+
echo "50" > "$ADVISORY_FILE"
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
# Pass through — advisory only
|
|
70
|
+
echo "$input"
|
|
71
|
+
exit 0
|
|
@@ -4,7 +4,12 @@ set -euo pipefail
|
|
|
4
4
|
# Stuck Detector Hook
|
|
5
5
|
# Trigger: PostToolUse, tool matches "Edit|Write|Bash|Task|Agent"
|
|
6
6
|
# Purpose: Detect repetitive failure loops and advise recovery
|
|
7
|
-
# Protocol: stdin JSON -> process -> stdout pass-through
|
|
7
|
+
# Protocol: stdin JSON -> process -> stdout pass-through
|
|
8
|
+
# - exit 0: advisory (normal cases, < HARD_BLOCK_THRESHOLD repetitions)
|
|
9
|
+
# - exit 1: hard block (extreme stuck loops, >= HARD_BLOCK_THRESHOLD repetitions)
|
|
10
|
+
|
|
11
|
+
# Hard block threshold: consecutive identical operations before blocking
|
|
12
|
+
HARD_BLOCK_THRESHOLD=5
|
|
8
13
|
|
|
9
14
|
input=$(cat)
|
|
10
15
|
|
|
@@ -26,7 +31,7 @@ if [ "$is_error" = "true" ]; then
|
|
|
26
31
|
error_hash=$(echo "$output_preview" | head -c 50 | md5sum 2>/dev/null | cut -d' ' -f1 || echo "unknown")
|
|
27
32
|
fi
|
|
28
33
|
|
|
29
|
-
entry=$(jq -
|
|
34
|
+
entry=$(jq -cn \
|
|
30
35
|
--arg ts "$timestamp" \
|
|
31
36
|
--arg tool "$tool_name" \
|
|
32
37
|
--arg path "$file_path" \
|
|
@@ -120,6 +125,61 @@ if [ "$stuck_detected" = true ]; then
|
|
|
120
125
|
echo "----------------------------------------" >&2
|
|
121
126
|
fi
|
|
122
127
|
|
|
128
|
+
# --- Hard Block Detection (extreme stuck loops) ---
|
|
129
|
+
# Check if the same operation has been repeated HARD_BLOCK_THRESHOLD+ times consecutively.
|
|
130
|
+
# This catches cases where advisory warnings are being ignored.
|
|
131
|
+
|
|
132
|
+
hard_block=false
|
|
133
|
+
hard_block_reason=""
|
|
134
|
+
|
|
135
|
+
if [ -f "$HISTORY_FILE" ]; then
|
|
136
|
+
last_n=$(tail -"$HARD_BLOCK_THRESHOLD" "$HISTORY_FILE" 2>/dev/null)
|
|
137
|
+
last_n_count=$(echo "$last_n" | wc -l | tr -d ' ')
|
|
138
|
+
|
|
139
|
+
if [ "$last_n_count" -ge "$HARD_BLOCK_THRESHOLD" ]; then
|
|
140
|
+
# Check 1: Same file edited HARD_BLOCK_THRESHOLD+ times consecutively
|
|
141
|
+
if [ -n "$file_path" ]; then
|
|
142
|
+
escaped_path=$(echo "$file_path" | sed 's/[.[\*^$()+?{|]/\\&/g')
|
|
143
|
+
consecutive_file=$(echo "$last_n" | grep -c "\"path\":\"${escaped_path}\"" 2>/dev/null || echo "0")
|
|
144
|
+
if [ "$consecutive_file" -ge "$HARD_BLOCK_THRESHOLD" ]; then
|
|
145
|
+
hard_block=true
|
|
146
|
+
hard_block_reason="Same file ($(basename "$file_path")) edited ${consecutive_file} consecutive times"
|
|
147
|
+
fi
|
|
148
|
+
fi
|
|
149
|
+
|
|
150
|
+
# Check 2: Same error repeated HARD_BLOCK_THRESHOLD+ times consecutively
|
|
151
|
+
if [ "$hard_block" = false ] && [ "$is_error" = "true" ] && [ -n "$error_hash" ]; then
|
|
152
|
+
consecutive_error=$(echo "$last_n" | grep -c "\"error_hash\":\"${error_hash}\"" 2>/dev/null || echo "0")
|
|
153
|
+
if [ "$consecutive_error" -ge "$HARD_BLOCK_THRESHOLD" ]; then
|
|
154
|
+
hard_block=true
|
|
155
|
+
hard_block_reason="Same error repeated ${consecutive_error} consecutive times"
|
|
156
|
+
fi
|
|
157
|
+
fi
|
|
158
|
+
|
|
159
|
+
# Check 3: Same tool+target combination HARD_BLOCK_THRESHOLD+ times consecutively
|
|
160
|
+
if [ "$hard_block" = false ] && [ -n "$file_path" ]; then
|
|
161
|
+
escaped_path=$(echo "$file_path" | sed 's/[.[\*^$()+?{|]/\\&/g')
|
|
162
|
+
consecutive_tool_target=$(echo "$last_n" | grep "\"tool\":\"${tool_name}\"" | grep -c "\"path\":\"${escaped_path}\"" 2>/dev/null || echo "0")
|
|
163
|
+
if [ "$consecutive_tool_target" -ge "$HARD_BLOCK_THRESHOLD" ]; then
|
|
164
|
+
hard_block=true
|
|
165
|
+
hard_block_reason="${tool_name} called on $(basename "$file_path") ${consecutive_tool_target} consecutive times"
|
|
166
|
+
fi
|
|
167
|
+
fi
|
|
168
|
+
fi
|
|
169
|
+
fi
|
|
170
|
+
|
|
171
|
+
if [ "$hard_block" = true ]; then
|
|
172
|
+
echo "" >&2
|
|
173
|
+
echo "=== [Stuck Detection] HARD BLOCK ===" >&2
|
|
174
|
+
echo " ${hard_block_reason}" >&2
|
|
175
|
+
echo " Threshold: ${HARD_BLOCK_THRESHOLD} consecutive identical operations" >&2
|
|
176
|
+
echo " Action: Blocking this tool call to break the stuck loop." >&2
|
|
177
|
+
echo " Recovery: Step back, re-read the error, and try a fundamentally different approach." >&2
|
|
178
|
+
echo "=====================================" >&2
|
|
179
|
+
echo "$input"
|
|
180
|
+
exit 1
|
|
181
|
+
fi
|
|
182
|
+
|
|
123
183
|
# Pass through
|
|
124
184
|
echo "$input"
|
|
125
185
|
exit 0
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
4
|
# Task/Agent Outcome Recorder Hook
|
|
5
|
-
# Trigger: PostToolUse
|
|
5
|
+
# Trigger: PostToolUse (tool == "Task" || "Agent") and SubagentStop
|
|
6
6
|
# Purpose: Record task outcomes for model escalation decisions
|
|
7
7
|
# Protocol: stdin JSON -> process -> stdout pass-through, exit 0 always
|
|
8
8
|
|
|
9
9
|
input=$(cat)
|
|
10
10
|
|
|
11
|
-
# Extract task info
|
|
12
|
-
agent_type=$(echo "$input" | jq -r '.tool_input.subagent_type // "unknown"')
|
|
13
|
-
model=$(echo "$input" | jq -r '.tool_input.model // "inherit"')
|
|
14
|
-
description=$(echo "$input" | jq -r '.tool_input.description // ""' | head -c 80)
|
|
11
|
+
# Extract task info — support both PostToolUse (tool_input.*) and SubagentStop (top-level) shapes
|
|
12
|
+
agent_type=$(echo "$input" | jq -r '.tool_input.subagent_type // .agent_type // "unknown"')
|
|
13
|
+
model=$(echo "$input" | jq -r '.tool_input.model // .model // "inherit"')
|
|
14
|
+
description=$(echo "$input" | jq -r '.tool_input.description // .description // ""' | head -c 80)
|
|
15
15
|
|
|
16
16
|
# Determine outcome
|
|
17
17
|
is_error=$(echo "$input" | jq -r '.tool_output.is_error // false')
|
|
@@ -24,8 +24,34 @@ else
|
|
|
24
24
|
error_summary=""
|
|
25
25
|
fi
|
|
26
26
|
|
|
27
|
-
# Session-scoped outcome log
|
|
27
|
+
# Session-scoped outcome log and agent count tracker
|
|
28
28
|
OUTCOME_FILE="/tmp/.claude-task-outcomes-${PPID}"
|
|
29
|
+
TASK_COUNT_FILE="/tmp/.claude-task-count-${PPID}"
|
|
30
|
+
|
|
31
|
+
# --- Pattern Detection ---
|
|
32
|
+
# Priority: skill-specific patterns > parallel > sequential (default)
|
|
33
|
+
pattern="sequential"
|
|
34
|
+
|
|
35
|
+
# Check description for skill-specific workflow patterns
|
|
36
|
+
desc_lower=$(echo "$description" | tr '[:upper:]' '[:lower:]')
|
|
37
|
+
|
|
38
|
+
if echo "$desc_lower" | grep -qE '(evaluator.optimizer|evaluator_optimizer)'; then
|
|
39
|
+
pattern="evaluator-optimizer"
|
|
40
|
+
elif echo "$desc_lower" | grep -qE '(worker.reviewer|worker_reviewer)'; then
|
|
41
|
+
pattern="worker-reviewer"
|
|
42
|
+
elif echo "$desc_lower" | grep -qE '(dag.orchestrat|dag_orchestrat|multi.phase|orchestrat)'; then
|
|
43
|
+
pattern="orchestrator"
|
|
44
|
+
elif echo "$desc_lower" | grep -qE '(parallel|\[1\]|\[2\]|\[3\]|\[4\])'; then
|
|
45
|
+
pattern="parallel"
|
|
46
|
+
else
|
|
47
|
+
# Infer parallel from agent count: if 2+ agents spawned this session, mark as parallel
|
|
48
|
+
if [ -f "$TASK_COUNT_FILE" ]; then
|
|
49
|
+
session_agent_count=$(cat "$TASK_COUNT_FILE" 2>/dev/null || echo "0")
|
|
50
|
+
if [ "$session_agent_count" -ge 2 ] 2>/dev/null; then
|
|
51
|
+
pattern="parallel"
|
|
52
|
+
fi
|
|
53
|
+
fi
|
|
54
|
+
fi
|
|
29
55
|
|
|
30
56
|
# Append JSON line entry
|
|
31
57
|
timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
@@ -34,9 +60,10 @@ entry=$(jq -n \
|
|
|
34
60
|
--arg agent "$agent_type" \
|
|
35
61
|
--arg model "$model" \
|
|
36
62
|
--arg outcome "$outcome" \
|
|
63
|
+
--arg pattern "$pattern" \
|
|
37
64
|
--arg desc "$description" \
|
|
38
65
|
--arg err "$error_summary" \
|
|
39
|
-
'{timestamp: $ts, agent_type: $agent, model: $model, outcome: $outcome, description: $desc, error_summary: $err}')
|
|
66
|
+
'{timestamp: $ts, agent_type: $agent, model: $model, outcome: $outcome, pattern_used: $pattern, description: $desc, error_summary: $err}')
|
|
40
67
|
|
|
41
68
|
echo "$entry" >> "$OUTCOME_FILE"
|
|
42
69
|
|
|
@@ -165,10 +165,10 @@ Use `context: fork` for skills that orchestrate multi-agent workflows. Cap at **
|
|
|
165
165
|
| Multi-agent coordination patterns | Single-agent reference skills |
|
|
166
166
|
| Task decomposition/planning | External tool integrations |
|
|
167
167
|
|
|
168
|
-
Current skills with `context: fork` (
|
|
168
|
+
Current skills with `context: fork` (9/10 cap):
|
|
169
169
|
- secretary-routing, dev-lead-routing, de-lead-routing, qa-lead-routing
|
|
170
170
|
- dag-orchestration, task-decomposition, worker-reviewer-pipeline
|
|
171
|
-
- pipeline-guards
|
|
171
|
+
- pipeline-guards, deep-plan
|
|
172
172
|
|
|
173
173
|
## Naming
|
|
174
174
|
|
|
@@ -9,6 +9,81 @@ argument-hint: "<file-or-directory> [--lang <language>]"
|
|
|
9
9
|
|
|
10
10
|
Refactor code for better structure, naming, and patterns using language-specific expert agents.
|
|
11
11
|
|
|
12
|
+
## When NOT to Use
|
|
13
|
+
|
|
14
|
+
| Scenario | Better Alternative |
|
|
15
|
+
|----------|--------------------|
|
|
16
|
+
| Renaming only (no structural change) | IDE rename refactoring or `sed` |
|
|
17
|
+
| Formatting cleanup | Run formatter (`prettier`, `gofmt`, `black`) |
|
|
18
|
+
| No test coverage for target code | Write tests first (`/structured-dev-cycle`) |
|
|
19
|
+
| Moving files between directories | `git mv` via mgr-gitnerd |
|
|
20
|
+
|
|
21
|
+
**Pre-execution check**: Verify test coverage exists for the refactoring target. Refactoring without tests risks silent regressions.
|
|
22
|
+
|
|
23
|
+
## Pre-flight Guards
|
|
24
|
+
|
|
25
|
+
Before executing the refactoring workflow, the agent MUST run these checks:
|
|
26
|
+
|
|
27
|
+
### Guard 1: Test Coverage Check
|
|
28
|
+
**Level**: WARN
|
|
29
|
+
**Check**: Verify test files exist for the refactoring target
|
|
30
|
+
```bash
|
|
31
|
+
# For target file src/module/foo.ts, check for:
|
|
32
|
+
# - src/module/foo.test.ts
|
|
33
|
+
# - src/module/foo.spec.ts
|
|
34
|
+
# - tests/module/foo.test.ts
|
|
35
|
+
# - test/module/foo.test.ts
|
|
36
|
+
# - __tests__/module/foo.test.ts
|
|
37
|
+
# For Go: foo_test.go in same package
|
|
38
|
+
# For Python: test_foo.py or foo_test.py
|
|
39
|
+
```
|
|
40
|
+
**Action**: `[Pre-flight] WARN: No test file found for {target}. Refactoring without tests risks silent regressions. Consider writing tests first (/structured-dev-cycle).`
|
|
41
|
+
|
|
42
|
+
### Guard 2: Rename-Only Detection
|
|
43
|
+
**Level**: INFO
|
|
44
|
+
**Check**: If the user request is purely about renaming (no structural change)
|
|
45
|
+
```
|
|
46
|
+
# Keyword detection in user request
|
|
47
|
+
keywords: rename, 이름 변경, 이름 바꿔, rename variable, rename function
|
|
48
|
+
# AND no structural keywords
|
|
49
|
+
structural_keywords: extract, split, merge, restructure, reorganize, decompose
|
|
50
|
+
```
|
|
51
|
+
**Action**: `[Pre-flight] INFO: For rename-only refactoring, IDE rename (F2) or sed is faster and safer (handles all references). Proceeding with full refactoring.`
|
|
52
|
+
|
|
53
|
+
### Guard 3: Formatting-Only Request Detection
|
|
54
|
+
**Level**: INFO
|
|
55
|
+
**Check**: If the request is about formatting or style cleanup
|
|
56
|
+
```
|
|
57
|
+
# Keyword detection
|
|
58
|
+
keywords: format, formatting, indent, indentation, 포맷, 스타일, whitespace, spacing
|
|
59
|
+
```
|
|
60
|
+
**Action**: `[Pre-flight] INFO: For formatting cleanup, run the appropriate formatter (prettier, gofmt, black, rustfmt). Proceeding with full refactoring.`
|
|
61
|
+
|
|
62
|
+
### Guard 4: File Move Detection
|
|
63
|
+
**Level**: INFO
|
|
64
|
+
**Check**: If the request is about moving files between directories
|
|
65
|
+
```
|
|
66
|
+
# Keyword detection
|
|
67
|
+
keywords: move file, move to, 파일 이동, 옮겨, relocate, reorganize files
|
|
68
|
+
# AND no code-level changes mentioned
|
|
69
|
+
```
|
|
70
|
+
**Action**: `[Pre-flight] INFO: For file moves without code changes, use git mv via mgr-gitnerd to preserve git history.`
|
|
71
|
+
|
|
72
|
+
### Display Format
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
[Pre-flight] dev-refactor
|
|
76
|
+
├── Test coverage: WARN — no test file for src/utils.ts
|
|
77
|
+
├── Rename-only: PASS
|
|
78
|
+
├── Formatting-only: PASS
|
|
79
|
+
└── File move: PASS
|
|
80
|
+
Result: PROCEED WITH CAUTION (0 GATE, 1 WARN, 0 INFO)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
If any GATE: block and suggest prerequisite.
|
|
84
|
+
If any WARN: show warning, ask user to confirm.
|
|
85
|
+
If only PASS/INFO: proceed automatically.
|
|
86
|
+
|
|
12
87
|
## Parameters
|
|
13
88
|
|
|
14
89
|
| Name | Type | Required | Description |
|
|
@@ -28,6 +103,7 @@ Refactor code for better structure, naming, and patterns using language-specific
|
|
|
28
103
|
## Workflow
|
|
29
104
|
|
|
30
105
|
```
|
|
106
|
+
0. Run pre-flight guards (MUST complete before proceeding)
|
|
31
107
|
1. Detect language (or use --lang)
|
|
32
108
|
2. Select appropriate expert agent
|
|
33
109
|
3. Load language-specific skill
|
|
@@ -9,6 +9,81 @@ argument-hint: "<file-or-directory> [--lang <language>]"
|
|
|
9
9
|
|
|
10
10
|
Review code for best practices using language-specific expert agents.
|
|
11
11
|
|
|
12
|
+
## When NOT to Use
|
|
13
|
+
|
|
14
|
+
| Scenario | Better Alternative |
|
|
15
|
+
|----------|--------------------|
|
|
16
|
+
| Formatting/style issues only | Run linter or formatter directly (`prettier`, `gofmt`, `black`) |
|
|
17
|
+
| Single syntax error | IDE/LSP diagnostics |
|
|
18
|
+
| Auto-generated code | Skip — generated code follows its own conventions |
|
|
19
|
+
| Pre-commit quick check | Git hooks with linter integration |
|
|
20
|
+
|
|
21
|
+
**Pre-execution check**: If the issue is purely formatting, run the appropriate formatter first.
|
|
22
|
+
|
|
23
|
+
## Pre-flight Guards
|
|
24
|
+
|
|
25
|
+
Before executing the review workflow, the agent MUST run these checks:
|
|
26
|
+
|
|
27
|
+
### Guard 1: Auto-generated Code Detection
|
|
28
|
+
**Level**: WARN
|
|
29
|
+
**Check**: Scan target files for auto-generation markers
|
|
30
|
+
```bash
|
|
31
|
+
# Detection patterns (any match = WARN)
|
|
32
|
+
grep -rl "DO NOT EDIT" {target} 2>/dev/null
|
|
33
|
+
grep -rl "auto-generated" {target} 2>/dev/null
|
|
34
|
+
grep -rl "@generated" {target} 2>/dev/null
|
|
35
|
+
# File pattern detection
|
|
36
|
+
# *.gen.*, *.pb.go, */generated/*, */proto/*, *_generated.*, *.g.dart
|
|
37
|
+
```
|
|
38
|
+
**Action**: `[Pre-flight] WARN: Auto-generated code detected in {file}. Generated code follows its own conventions — review may produce false positives. Continue? [Y/n]`
|
|
39
|
+
|
|
40
|
+
### Guard 2: Formatting-Only Changes Detection
|
|
41
|
+
**Level**: INFO
|
|
42
|
+
**Check**: If reviewing changed files (not full codebase), check if changes are formatting-only
|
|
43
|
+
```bash
|
|
44
|
+
# If git diff is available for the target
|
|
45
|
+
git diff --stat {target} | grep -E '^\s+\d+ files? changed'
|
|
46
|
+
# Compare with whitespace-ignored diff
|
|
47
|
+
git diff -w {target}
|
|
48
|
+
# If -w diff is empty but regular diff has changes → formatting only
|
|
49
|
+
```
|
|
50
|
+
**Action**: `[Pre-flight] INFO: Changes in {file} appear to be formatting-only. Consider running the appropriate formatter instead (prettier, gofmt, black).`
|
|
51
|
+
|
|
52
|
+
### Guard 3: Single Syntax Error Detection
|
|
53
|
+
**Level**: INFO
|
|
54
|
+
**Check**: If target is a single file and the request mentions "error", "syntax", or "broken"
|
|
55
|
+
```
|
|
56
|
+
# Keyword detection in user request
|
|
57
|
+
keywords: error, syntax, broken, doesn't compile, won't build
|
|
58
|
+
# Single file check
|
|
59
|
+
target is exactly 1 file (not a directory)
|
|
60
|
+
```
|
|
61
|
+
**Action**: `[Pre-flight] INFO: For single syntax errors, IDE/LSP diagnostics are faster. Proceeding with full review.`
|
|
62
|
+
|
|
63
|
+
### Guard 4: Linter/Formatter Available Detection
|
|
64
|
+
**Level**: INFO
|
|
65
|
+
**Check**: Detect if a project-appropriate linter exists
|
|
66
|
+
```bash
|
|
67
|
+
# Check for linter configs in project root
|
|
68
|
+
ls .eslintrc* .prettierrc* biome.json .golangci.yml pyproject.toml .rubocop.yml 2>/dev/null
|
|
69
|
+
```
|
|
70
|
+
**Action**: `[Pre-flight] INFO: Linter config found ({config}). For style-only issues, run the linter directly.`
|
|
71
|
+
|
|
72
|
+
### Display Format
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
[Pre-flight] dev-review
|
|
76
|
+
├── Auto-generated code: PASS
|
|
77
|
+
├── Formatting-only changes: INFO — whitespace changes in src/util.ts
|
|
78
|
+
├── Single syntax error: PASS
|
|
79
|
+
└── Linter available: INFO — .eslintrc.json found
|
|
80
|
+
Result: PROCEED (0 GATE, 0 WARN, 2 INFO)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
If any GATE: block and suggest alternative.
|
|
84
|
+
If any WARN: show warning, ask user to confirm.
|
|
85
|
+
If only PASS/INFO: proceed automatically.
|
|
86
|
+
|
|
12
87
|
## Parameters
|
|
13
88
|
|
|
14
89
|
| Name | Type | Required | Description |
|
|
@@ -27,6 +102,7 @@ Review code for best practices using language-specific expert agents.
|
|
|
27
102
|
## Workflow
|
|
28
103
|
|
|
29
104
|
```
|
|
105
|
+
0. Run pre-flight guards (see ## Pre-flight Guards)
|
|
30
106
|
1. Detect language (or use --lang)
|
|
31
107
|
2. Select appropriate expert agent
|
|
32
108
|
3. Load language-specific skill
|