oh-my-customcode 0.117.0 → 0.118.1
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 +2 -2
- package/dist/cli/index.js +212 -94
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/templates/.claude/hooks/hooks.json +42 -22
- package/templates/.claude/hooks/scripts/auto-dev-token-summary.sh +67 -0
- package/templates/.claude/hooks/scripts/auto-dev-token-tracker.sh +57 -0
- package/templates/.claude/rules/MUST-agent-design.md +6 -0
- package/templates/.claude/skills/deep-plan/SKILL.md +37 -307
- package/templates/.claude/skills/professor-triage/SKILL.md +39 -329
- package/templates/CLAUDE.md +1 -1
- package/templates/guides/deep-plan/README.md +68 -0
- package/templates/guides/deep-plan/phases.md +266 -0
- package/templates/guides/professor-triage/README.md +42 -0
- package/templates/guides/professor-triage/phases.md +335 -0
- package/templates/manifest.json +2 -2
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"command": "bash .claude/hooks/scripts/stage-blocker.sh"
|
|
11
11
|
}
|
|
12
12
|
],
|
|
13
|
-
"description": "Block Write/Edit tools during plan/verify/compound stages
|
|
13
|
+
"description": "Block Write/Edit tools during plan/verify/compound stages \u2014 only allow in implement stage"
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
"matcher": "tool == \"Bash\" && tool_input.command matches \"(npm run dev|pnpm( run)? dev|yarn dev|bun run dev)\"",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"command": "bash .claude/hooks/scripts/content-hash-validator.sh"
|
|
71
71
|
}
|
|
72
72
|
],
|
|
73
|
-
"description": "Validate file content hash before Edit
|
|
73
|
+
"description": "Validate file content hash before Edit \u2014 advisory staleness warning"
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
76
|
"matcher": "tool == \"Write\" || tool == \"Edit\" || tool == \"Bash\"",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"command": "bash .claude/hooks/scripts/schema-validator.sh"
|
|
81
81
|
}
|
|
82
82
|
],
|
|
83
|
-
"description": "Schema-based tool input validation
|
|
83
|
+
"description": "Schema-based tool input validation \u2014 Phase 1 advisory only"
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
86
|
"matcher": "tool == \"Bash\"",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"command": "bash .claude/hooks/scripts/rtk-intercept.sh"
|
|
91
91
|
}
|
|
92
92
|
],
|
|
93
|
-
"description": "RTK auto-intercept
|
|
93
|
+
"description": "RTK auto-intercept \u2014 transparently rewrites CLI commands through RTK proxy when available (R015 advisory)"
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
"matcher": "tool == \"Bash\" && tool_input.command matches \"(rm|git rm|mv|unlink|claude/rules)\"",
|
|
@@ -100,14 +100,14 @@
|
|
|
100
100
|
"command": "bash .claude/hooks/scripts/rule-deletion-guard.sh"
|
|
101
101
|
}
|
|
102
102
|
],
|
|
103
|
-
"description": "Block rule file deletion
|
|
103
|
+
"description": "Block rule file deletion \u2014 requires individual user confirmation per rule (R001 safety)"
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
106
|
"matcher": "tool == \"Task\" || tool == \"Agent\"",
|
|
107
107
|
"hooks": [
|
|
108
108
|
{
|
|
109
109
|
"type": "command",
|
|
110
|
-
"command": "#!/bin/bash\ninput=$(cat)\nagent_type=$(echo \"$input\" | jq -r '.tool_input.subagent_type // \"unknown\"')\nmodel=$(echo \"$input\" | jq -r '.tool_input.model // \"inherit\"')\ndesc=$(echo \"$input\" | jq -r '.tool_input.description // \"\"' | head -c 40)\nresume=$(echo \"$input\" | jq -r '.tool_input.resume // empty')\nif [ -n \"$resume\" ]; then\n echo \"
|
|
110
|
+
"command": "#!/bin/bash\ninput=$(cat)\nagent_type=$(echo \"$input\" | jq -r '.tool_input.subagent_type // \"unknown\"')\nmodel=$(echo \"$input\" | jq -r '.tool_input.model // \"inherit\"')\ndesc=$(echo \"$input\" | jq -r '.tool_input.description // \"\"' | head -c 40)\nresume=$(echo \"$input\" | jq -r '.tool_input.resume // empty')\nif [ -n \"$resume\" ]; then\n echo \"\u2500\u2500\u2500 [Resume] ${agent_type}:${model} | ${desc} \u2500\u2500\u2500\" >&2\nelse\n echo \"\u2500\u2500\u2500 [Spawn] ${agent_type}:${model} | ${desc} \u2500\u2500\u2500\" >&2\nfi\necho \"$input\""
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
"type": "command",
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
"command": "bash .claude/hooks/scripts/user-prompt-preprocessor.sh"
|
|
187
187
|
}
|
|
188
188
|
],
|
|
189
|
-
"description": "Advisory pre-processing of user input
|
|
189
|
+
"description": "Advisory pre-processing of user input \u2014 skill matching hints and intent analysis"
|
|
190
190
|
},
|
|
191
191
|
{
|
|
192
192
|
"matcher": "*",
|
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
"hooks": [
|
|
206
206
|
{
|
|
207
207
|
"type": "command",
|
|
208
|
-
"command": "#!/bin/bash\ninput=$(cat)\nagent_type=$(echo \"$input\" | jq -r '.agent_type // \"unknown\"')\nmodel=$(echo \"$input\" | jq -r '.model // \"inherit\"')\ndesc=$(echo \"$input\" | jq -r '.description // \"\"' | head -c 40)\necho \"
|
|
208
|
+
"command": "#!/bin/bash\ninput=$(cat)\nagent_type=$(echo \"$input\" | jq -r '.agent_type // \"unknown\"')\nmodel=$(echo \"$input\" | jq -r '.model // \"inherit\"')\ndesc=$(echo \"$input\" | jq -r '.description // \"\"' | head -c 40)\necho \"\u2500\u2500\u2500 [SubagentStart] ${agent_type}:${model} | ${desc} \u2500\u2500\u2500\" >&2\necho \"$input\""
|
|
209
209
|
},
|
|
210
210
|
{
|
|
211
211
|
"type": "command",
|
|
@@ -233,7 +233,7 @@
|
|
|
233
233
|
},
|
|
234
234
|
{
|
|
235
235
|
"type": "prompt",
|
|
236
|
-
"prompt": "A background subagent just completed. Check if there are pending workflow steps that depend on this result. If the previous subagent FAILED, do NOT auto-continue
|
|
236
|
+
"prompt": "A background subagent just completed. Check if there are pending workflow steps that depend on this result. If the previous subagent FAILED, do NOT auto-continue \u2014 report the failure and wait for user input. If the previous step succeeded and there are pending steps, proceed automatically. If no pending steps, report results and wait. Safety: The file /tmp/.claude-loop-count-$PPID tracks auto-continue count. After 3 consecutive auto-continues without user interaction, pause and ask the user before proceeding."
|
|
237
237
|
}
|
|
238
238
|
],
|
|
239
239
|
"description": "Record agent outcomes + auto-continue workflow on subagent completion"
|
|
@@ -260,7 +260,7 @@
|
|
|
260
260
|
"command": "bash .claude/hooks/scripts/file-change-validator.sh"
|
|
261
261
|
}
|
|
262
262
|
],
|
|
263
|
-
"description": "Validate externally modified files
|
|
263
|
+
"description": "Validate externally modified files \u2014 advisory staleness warning (v2.1.83+)"
|
|
264
264
|
}
|
|
265
265
|
],
|
|
266
266
|
"Notification": [
|
|
@@ -281,7 +281,7 @@
|
|
|
281
281
|
"hooks": [
|
|
282
282
|
{
|
|
283
283
|
"type": "command",
|
|
284
|
-
"command": "#!/bin/bash\ninput=$(cat)\nteammate=$(echo \"$input\" | jq -r '.teammate_id // \"unknown\"' 2>/dev/null)\necho \"[Hook] TeammateIdle: $teammate
|
|
284
|
+
"command": "#!/bin/bash\ninput=$(cat)\nteammate=$(echo \"$input\" | jq -r '.teammate_id // \"unknown\"' 2>/dev/null)\necho \"[Hook] TeammateIdle: $teammate \u2014 available for reassignment\" >&2\necho \"$input\""
|
|
285
285
|
}
|
|
286
286
|
],
|
|
287
287
|
"description": "Track idle Agent Teams members for work reassignment"
|
|
@@ -293,7 +293,7 @@
|
|
|
293
293
|
"hooks": [
|
|
294
294
|
{
|
|
295
295
|
"type": "command",
|
|
296
|
-
"command": "#!/bin/bash\ninput=$(cat)\ntask_id=$(echo \"$input\" | jq -r '.task_id // \"\"' 2>/dev/null)\ndesc=$(echo \"$input\" | jq -r '.description // \"\"' 2>/dev/null | head -c 60)\necho \"[Hook] TaskCreated: $task_id
|
|
296
|
+
"command": "#!/bin/bash\ninput=$(cat)\ntask_id=$(echo \"$input\" | jq -r '.task_id // \"\"' 2>/dev/null)\ndesc=$(echo \"$input\" | jq -r '.description // \"\"' 2>/dev/null | head -c 60)\necho \"[Hook] TaskCreated: $task_id \u2014 $desc\" >&2\necho \"$input\""
|
|
297
297
|
}
|
|
298
298
|
],
|
|
299
299
|
"description": "Log task creation events for Agent Teams coordination"
|
|
@@ -305,7 +305,7 @@
|
|
|
305
305
|
"hooks": [
|
|
306
306
|
{
|
|
307
307
|
"type": "command",
|
|
308
|
-
"command": "#!/bin/bash\ninput=$(cat)\ntask_id=$(echo \"$input\" | jq -r '.task_id // \"\"' 2>/dev/null)\nresult=$(echo \"$input\" | jq -r '.result // \"\"' 2>/dev/null | head -c 60)\necho \"[Hook] TaskCompleted: $task_id
|
|
308
|
+
"command": "#!/bin/bash\ninput=$(cat)\ntask_id=$(echo \"$input\" | jq -r '.task_id // \"\"' 2>/dev/null)\nresult=$(echo \"$input\" | jq -r '.result // \"\"' 2>/dev/null | head -c 60)\necho \"[Hook] TaskCompleted: $task_id \u2014 $result\" >&2\necho \"$input\""
|
|
309
309
|
}
|
|
310
310
|
],
|
|
311
311
|
"description": "Log task completion events for Agent Teams coordination"
|
|
@@ -320,7 +320,7 @@
|
|
|
320
320
|
"command": "bash .claude/hooks/scripts/task-state-precompact.sh"
|
|
321
321
|
}
|
|
322
322
|
],
|
|
323
|
-
"description": "Serialize active task state before compaction
|
|
323
|
+
"description": "Serialize active task state before compaction \u2014 pairs with PostCompact restore (#922)"
|
|
324
324
|
}
|
|
325
325
|
],
|
|
326
326
|
"PostCompact": [
|
|
@@ -329,10 +329,10 @@
|
|
|
329
329
|
"hooks": [
|
|
330
330
|
{
|
|
331
331
|
"type": "prompt",
|
|
332
|
-
"prompt": "Context compacted. RULES ACTIVE.\n\nR007: next response MUST start with
|
|
332
|
+
"prompt": "Context compacted. RULES ACTIVE.\n\nR007: next response MUST start with \u250c\u2500 Agent: claude (default) / \u2514\u2500 Task: {task}\nR008: before EVERY tool call \u2192 [claude][model] \u2192 Tool: Name / Target: path\nR010: write\u2192delegate to subagent; orchestrator read-only (Read/Glob/Grep); git\u2192mgr-gitnerd\nR009: 2+ independent tasks \u2192 parallel agents, same message\nR018: 3+ agents OR review cycle \u2192 Agent Teams\nR000: user communication in Korean (\ud55c\uad6d\uc5b4); code/files in English \u2014 NON-NEGOTIABLE\nR001: prohibited actions (no secrets, no system files, no rm -rf); stop on violation \u2192 preserve state \u2192 report \u2192 wait\nR002: tool tiers (Read/Grep=free, Write/Edit=notify, Bash=approval); no writes outside project; no .env/.git/config\n\nAutonomous mode: if /tmp/.claude-autonomous-$PPID exists \u2192 simple git (add/commit/push) may run directly; Write/Edit still delegates.\nbypassPermissions does NOT persist across compaction \u2014 re-enable if tasks seem blocked.\n\nTask state restore: if /tmp/.claude-task-state-$PPID.json exists, read it to recover active pipeline, dev stage, and autonomous mode state. This was saved by PreCompact hook.\n\nRe-read CLAUDE.md NOW."
|
|
333
333
|
}
|
|
334
334
|
],
|
|
335
|
-
"description": "Reinforce enforced rules after context compaction
|
|
335
|
+
"description": "Reinforce enforced rules after context compaction \u2014 prevents rule amnesia (v2.1.76+)"
|
|
336
336
|
}
|
|
337
337
|
],
|
|
338
338
|
"PostToolUse": [
|
|
@@ -414,7 +414,7 @@
|
|
|
414
414
|
"command": "bash .claude/hooks/scripts/context-budget-advisor.sh"
|
|
415
415
|
}
|
|
416
416
|
],
|
|
417
|
-
"description": "Context budget advisor
|
|
417
|
+
"description": "Context budget advisor \u2014 track tool usage patterns and advise ecomode activation"
|
|
418
418
|
},
|
|
419
419
|
{
|
|
420
420
|
"matcher": "tool == \"Edit\" || tool == \"Write\" || tool == \"Bash\" || tool == \"Task\" || tool == \"Agent\"",
|
|
@@ -434,7 +434,7 @@
|
|
|
434
434
|
"command": "bash .claude/hooks/scripts/cost-cap-advisor.sh"
|
|
435
435
|
}
|
|
436
436
|
],
|
|
437
|
-
"description": "Advisory cost cap monitoring
|
|
437
|
+
"description": "Advisory cost cap monitoring \u2014 warn when session cost approaches configurable limit"
|
|
438
438
|
},
|
|
439
439
|
{
|
|
440
440
|
"matcher": "tool == \"Read\"",
|
|
@@ -444,7 +444,7 @@
|
|
|
444
444
|
"command": "bash .claude/hooks/scripts/content-hash-validator.sh"
|
|
445
445
|
}
|
|
446
446
|
],
|
|
447
|
-
"description": "Store content hashes for Read operations
|
|
447
|
+
"description": "Store content hashes for Read operations \u2014 enables Edit staleness detection"
|
|
448
448
|
},
|
|
449
449
|
{
|
|
450
450
|
"matcher": "tool == \"Bash\" || tool == \"Read\" || tool == \"Grep\"",
|
|
@@ -454,7 +454,7 @@
|
|
|
454
454
|
"command": "bash .claude/hooks/scripts/secret-filter.sh"
|
|
455
455
|
}
|
|
456
456
|
],
|
|
457
|
-
"description": "Detect potential secrets in Bash/Read/Grep output
|
|
457
|
+
"description": "Detect potential secrets in Bash/Read/Grep output \u2014 advisory warning only"
|
|
458
458
|
},
|
|
459
459
|
{
|
|
460
460
|
"matcher": "tool == \"Edit\" || tool == \"Write\" || tool == \"Bash\" || tool == \"Agent\"",
|
|
@@ -485,6 +485,16 @@
|
|
|
485
485
|
}
|
|
486
486
|
],
|
|
487
487
|
"description": "Layer 4: Compress Playwright/Chrome MCP output via Haiku summarization"
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
"matcher": "tool == \"Task\" || tool == \"Agent\"",
|
|
491
|
+
"hooks": [
|
|
492
|
+
{
|
|
493
|
+
"type": "command",
|
|
494
|
+
"command": "bash .claude/hooks/scripts/auto-dev-token-tracker.sh"
|
|
495
|
+
}
|
|
496
|
+
],
|
|
497
|
+
"description": "auto-dev token spend tracker \u2014 records per-phase token estimates during /pipeline auto-dev (Issue #1057, advisory)"
|
|
488
498
|
}
|
|
489
499
|
],
|
|
490
500
|
"Stop": [
|
|
@@ -533,10 +543,20 @@
|
|
|
533
543
|
"hooks": [
|
|
534
544
|
{
|
|
535
545
|
"type": "prompt",
|
|
536
|
-
"prompt": "Session-end memory checkpoint (R011 enforcement). Check if the session-end memory save workflow was completed: 1) sys-memory-keeper was delegated to update MEMORY.md 2) claude-mem save was attempted via ToolSearch + mcp__plugin_claude-mem_mcp-search__save_memory. Note: episodic-memory auto-indexes after session
|
|
546
|
+
"prompt": "Session-end memory checkpoint (R011 enforcement). Check if the session-end memory save workflow was completed: 1) sys-memory-keeper was delegated to update MEMORY.md 2) claude-mem save was attempted via ToolSearch + mcp__plugin_claude-mem_mcp-search__save_memory. Note: episodic-memory auto-indexes after session \u2014 no manual action needed. Decision rules (evaluate in order): 1. If session had no explicit session-end signal (quick question, no memory work): APPROVE immediately. 2. If BOTH steps were already attempted (success or failure both count): APPROVE. 3. If MCP tools unavailable after ToolSearch attempt: APPROVE with note. 4. If steps were NOT yet performed: PERFORM THEM NOW (maximum 1 attempt each): a. Delegate to sys-memory-keeper to update MEMORY.md \u2014 call Agent tool with sys-memory-keeper. b. Attempt claude-mem save \u2014 ToolSearch for save_memory tool, then call it. c. After completion (success or failure), APPROVE stop. IMPORTANT: Do NOT block indefinitely. After 1 attempt per step, always APPROVE. IMPORTANT: Do NOT loop \u2014 if you already performed these steps in this same stop hook evaluation, APPROVE."
|
|
547
|
+
}
|
|
548
|
+
],
|
|
549
|
+
"description": "Enforce R011 session-end memory saves \u2014 auto-perform if not yet done (episodic-memory auto-indexes)"
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
"matcher": "*",
|
|
553
|
+
"hooks": [
|
|
554
|
+
{
|
|
555
|
+
"type": "command",
|
|
556
|
+
"command": "bash .claude/hooks/scripts/auto-dev-token-summary.sh"
|
|
537
557
|
}
|
|
538
558
|
],
|
|
539
|
-
"description": "
|
|
559
|
+
"description": "Print auto-dev token spend summary on session end (Issue #1057, advisory)"
|
|
540
560
|
}
|
|
541
561
|
]
|
|
542
562
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# auto-dev Token Spend Summary (Issue #1057, Option 1)
|
|
5
|
+
# Trigger: Stop event
|
|
6
|
+
# Purpose: Print phase-by-phase token spend table to stderr
|
|
7
|
+
# Protocol: stdin pass-through, stderr summary, exit 0 always
|
|
8
|
+
|
|
9
|
+
input=$(cat 2>/dev/null || true)
|
|
10
|
+
trap 'printf "%s" "$input"' EXIT
|
|
11
|
+
|
|
12
|
+
LOG_FILE="/tmp/auto-dev-spend-${PPID}.json"
|
|
13
|
+
[ -f "$LOG_FILE" ] || exit 0
|
|
14
|
+
[ -s "$LOG_FILE" ] || exit 0
|
|
15
|
+
|
|
16
|
+
command -v jq >/dev/null 2>&1 || exit 0
|
|
17
|
+
|
|
18
|
+
# Aggregate per phase: sum tokens_in, tokens_out, count entries
|
|
19
|
+
summary=$(jq -s -r '
|
|
20
|
+
group_by(.phase)
|
|
21
|
+
| map({
|
|
22
|
+
phase: .[0].phase,
|
|
23
|
+
calls: length,
|
|
24
|
+
tokens_in: (map(.tokens_in) | add),
|
|
25
|
+
tokens_out: (map(.tokens_out) | add),
|
|
26
|
+
total: (map(.tokens_in + .tokens_out) | add)
|
|
27
|
+
})
|
|
28
|
+
| sort_by(-.total)
|
|
29
|
+
' "$LOG_FILE" 2>/dev/null) || exit 0
|
|
30
|
+
|
|
31
|
+
[ -z "$summary" ] && exit 0
|
|
32
|
+
[ "$summary" = "[]" ] && exit 0
|
|
33
|
+
|
|
34
|
+
# Totals
|
|
35
|
+
totals=$(echo "$summary" | jq -r '
|
|
36
|
+
{
|
|
37
|
+
total_calls: (map(.calls) | add),
|
|
38
|
+
total_in: (map(.tokens_in) | add),
|
|
39
|
+
total_out: (map(.tokens_out) | add),
|
|
40
|
+
grand: (map(.total) | add)
|
|
41
|
+
}
|
|
42
|
+
')
|
|
43
|
+
total_calls=$(echo "$totals" | jq -r '.total_calls')
|
|
44
|
+
total_in=$(echo "$totals" | jq -r '.total_in')
|
|
45
|
+
total_out=$(echo "$totals" | jq -r '.total_out')
|
|
46
|
+
grand=$(echo "$totals" | jq -r '.grand')
|
|
47
|
+
|
|
48
|
+
{
|
|
49
|
+
echo ""
|
|
50
|
+
echo "=== [auto-dev Token Spend Summary] (Issue #1057, advisory) ==="
|
|
51
|
+
echo "Source: $LOG_FILE | Heuristic: bytes ÷ 4"
|
|
52
|
+
echo ""
|
|
53
|
+
printf "| %-32s | %5s | %10s | %10s | %10s |\n" "Phase" "Calls" "Tokens In" "Tokens Out" "Total"
|
|
54
|
+
printf "| %-32s | %5s | %10s | %10s | %10s |\n" "--------------------------------" "-----" "----------" "----------" "----------"
|
|
55
|
+
echo "$summary" | jq -r '.[] | "\(.phase)\t\(.calls)\t\(.tokens_in)\t\(.tokens_out)\t\(.total)"' | \
|
|
56
|
+
while IFS=$'\t' read -r phase calls tin tout tot; do
|
|
57
|
+
phase_trunc=$(printf "%s" "$phase" | head -c 32)
|
|
58
|
+
printf "| %-32s | %5s | %10s | %10s | %10s |\n" "$phase_trunc" "$calls" "$tin" "$tout" "$tot"
|
|
59
|
+
done
|
|
60
|
+
printf "| %-32s | %5s | %10s | %10s | %10s |\n" "TOTAL" "$total_calls" "$total_in" "$total_out" "$grand"
|
|
61
|
+
echo ""
|
|
62
|
+
echo "Note: Estimates only. For exact usage, integrate Anthropic API usage events (Option 2, separate issue)."
|
|
63
|
+
echo "================================================================"
|
|
64
|
+
echo ""
|
|
65
|
+
} >&2
|
|
66
|
+
|
|
67
|
+
exit 0
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# auto-dev Token Spend Tracker (Issue #1057, Option 1)
|
|
5
|
+
# Trigger: PostToolUse on Agent/Task during auto-dev pipeline
|
|
6
|
+
# Purpose: Estimate token spend per phase from byte counts (÷4 heuristic)
|
|
7
|
+
# Protocol: stdin JSON -> log -> stdout pass-through, exit 0 always
|
|
8
|
+
# Gate: only logs when /tmp/.claude-pipeline-auto-dev-${PPID}.json exists
|
|
9
|
+
|
|
10
|
+
# Always pass through input no matter what
|
|
11
|
+
input=$(cat)
|
|
12
|
+
trap 'echo "$input"' EXIT
|
|
13
|
+
|
|
14
|
+
# Gate: only active during auto-dev pipeline
|
|
15
|
+
PIPELINE_STATE="/tmp/.claude-pipeline-auto-dev-${PPID}.json"
|
|
16
|
+
[ -f "$PIPELINE_STATE" ] || exit 0
|
|
17
|
+
|
|
18
|
+
# Dependency check
|
|
19
|
+
command -v jq >/dev/null 2>&1 || exit 0
|
|
20
|
+
|
|
21
|
+
LOG_FILE="/tmp/auto-dev-spend-${PPID}.json"
|
|
22
|
+
|
|
23
|
+
# Extract fields (PostToolUse Agent shape)
|
|
24
|
+
agent_type=$(echo "$input" | jq -r '.tool_input.subagent_type // "unknown"' 2>/dev/null || echo "unknown")
|
|
25
|
+
description=$(echo "$input" | jq -r '.tool_input.description // ""' 2>/dev/null || echo "")
|
|
26
|
+
prompt_text=$(echo "$input" | jq -r '.tool_input.prompt // ""' 2>/dev/null || echo "")
|
|
27
|
+
output_text=$(echo "$input" | jq -r '.tool_output.output // .tool_output // ""' 2>/dev/null || echo "")
|
|
28
|
+
|
|
29
|
+
# Derive phase from pipeline state (current_phase) or fallback to description prefix
|
|
30
|
+
phase=$(jq -r '.current_phase // .phase // "unknown"' "$PIPELINE_STATE" 2>/dev/null || echo "unknown")
|
|
31
|
+
if [ "$phase" = "unknown" ] || [ "$phase" = "null" ]; then
|
|
32
|
+
# Fallback: extract [N] prefix or first word from description
|
|
33
|
+
phase=$(echo "$description" | grep -oE '^\[[0-9]+\][^|]*' | head -c 40 || true)
|
|
34
|
+
[ -z "$phase" ] && phase=$(echo "$description" | head -c 30)
|
|
35
|
+
[ -z "$phase" ] && phase="unknown"
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# Byte counts -> token estimate (÷4 heuristic)
|
|
39
|
+
in_bytes=$(printf '%s' "$prompt_text" | wc -c | tr -d ' ')
|
|
40
|
+
out_bytes=$(printf '%s' "$output_text" | wc -c | tr -d ' ')
|
|
41
|
+
tokens_in=$((in_bytes / 4))
|
|
42
|
+
tokens_out=$((out_bytes / 4))
|
|
43
|
+
|
|
44
|
+
ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
45
|
+
|
|
46
|
+
# Append JSONL entry
|
|
47
|
+
entry=$(jq -n -c \
|
|
48
|
+
--arg ts "$ts" \
|
|
49
|
+
--arg phase "$phase" \
|
|
50
|
+
--arg agent "$agent_type" \
|
|
51
|
+
--argjson tin "$tokens_in" \
|
|
52
|
+
--argjson tout "$tokens_out" \
|
|
53
|
+
'{ts: $ts, phase: $phase, agent: $agent, tokens_in: $tin, tokens_out: $tout}' 2>/dev/null) || exit 0
|
|
54
|
+
|
|
55
|
+
echo "$entry" >> "$LOG_FILE" 2>/dev/null || true
|
|
56
|
+
|
|
57
|
+
exit 0
|
|
@@ -31,6 +31,12 @@ Extended context suffix: `[1m]` (e.g., `claude-opus-4-6[1m]`) — enables 1M tok
|
|
|
31
31
|
|
|
32
32
|
Key optional fields: `memory`, `effort`, `skills`, `soul`, `isolation`, `background`, `maxTurns`, `maxTokens`, `mcpServers`, `hooks`, `permissionMode`, `disallowedTools`, `limitations`, `domain`, `disableSkillShellExecution`. Supported since CC v2.1.63+. See full optional frontmatter via Read tool.
|
|
33
33
|
|
|
34
|
+
### Note on `skills:` field
|
|
35
|
+
|
|
36
|
+
The `skills:` frontmatter field is **advisory metadata** consumed by oh-my-customcode tooling (graph-builder, mgr-sauron) for documentation and validation. It is **NOT a runtime allowlist** — Claude Code does not filter the available skills based on this field, and subagents can invoke any registered skill regardless of what `skills:` declares. Use it to document a subagent's intended skill dependencies; do not rely on it for access control.
|
|
37
|
+
|
|
38
|
+
Reference: research findings on issue #1055 (closed not-planned).
|
|
39
|
+
|
|
34
40
|
<!-- DETAIL: Optional Frontmatter (full yaml block)
|
|
35
41
|
```yaml
|
|
36
42
|
memory: project # user | project | local
|