oh-my-customcode 0.132.0 → 0.133.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/dist/cli/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/templates/.claude/hooks/hooks.json +6 -3
- package/templates/.claude/hooks/scripts/context-budget-advisor.sh +14 -0
- package/templates/.claude/hooks/scripts/cost-cap-advisor.sh +2 -0
- package/templates/.claude/hooks/scripts/stuck-detector.sh +1 -1
- package/templates/.claude/rules/MUST-enforcement-policy.md +2 -1
- package/templates/manifest.json +1 -1
package/dist/cli/index.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -411,7 +411,8 @@
|
|
|
411
411
|
"hooks": [
|
|
412
412
|
{
|
|
413
413
|
"type": "command",
|
|
414
|
-
"command": "bash .claude/hooks/scripts/context-budget-advisor.sh"
|
|
414
|
+
"command": "bash .claude/hooks/scripts/context-budget-advisor.sh",
|
|
415
|
+
"continueOnBlock": true
|
|
415
416
|
}
|
|
416
417
|
],
|
|
417
418
|
"description": "Context budget advisor \u2014 track tool usage patterns and advise ecomode activation"
|
|
@@ -421,7 +422,8 @@
|
|
|
421
422
|
"hooks": [
|
|
422
423
|
{
|
|
423
424
|
"type": "command",
|
|
424
|
-
"command": "bash .claude/hooks/scripts/stuck-detector.sh"
|
|
425
|
+
"command": "bash .claude/hooks/scripts/stuck-detector.sh",
|
|
426
|
+
"continueOnBlock": true
|
|
425
427
|
}
|
|
426
428
|
],
|
|
427
429
|
"description": "Detect repetitive failure loops and advise recovery strategies"
|
|
@@ -431,7 +433,8 @@
|
|
|
431
433
|
"hooks": [
|
|
432
434
|
{
|
|
433
435
|
"type": "command",
|
|
434
|
-
"command": "bash .claude/hooks/scripts/cost-cap-advisor.sh"
|
|
436
|
+
"command": "bash .claude/hooks/scripts/cost-cap-advisor.sh",
|
|
437
|
+
"continueOnBlock": true
|
|
435
438
|
}
|
|
436
439
|
],
|
|
437
440
|
"description": "Advisory cost cap monitoring \u2014 warn when session cost approaches configurable limit"
|
|
@@ -85,6 +85,20 @@ if [ "$tool_count" -gt 0 ] && [ $((tool_count % 25)) -eq 0 ]; then
|
|
|
85
85
|
fi
|
|
86
86
|
fi
|
|
87
87
|
|
|
88
|
+
# continueOnBlock: emit conversation feedback when task-type threshold is reached (once per session)
|
|
89
|
+
BLOCK_FILE="/tmp/.claude-budget-blocked-${PPID}"
|
|
90
|
+
if [ "$tool_count" -ge "$THRESHOLD" ] && [ ! -f "$BLOCK_FILE" ]; then
|
|
91
|
+
touch "$BLOCK_FILE"
|
|
92
|
+
echo "[Context Budget] Threshold ${THRESHOLD}% reached for ${task_type} task — activate ecomode (R013)" >&2
|
|
93
|
+
HOOK_END=$(date +%s%N 2>/dev/null || echo 0)
|
|
94
|
+
if [ "$HOOK_START" != "0" ] && [ "$HOOK_END" != "0" ]; then
|
|
95
|
+
HOOK_MS=$(( (HOOK_END - HOOK_START) / 1000000 ))
|
|
96
|
+
echo "[Hook Perf] $(basename "$0"): ${HOOK_MS}ms" >> "/tmp/.claude-hook-perf-${PPID}.log"
|
|
97
|
+
fi
|
|
98
|
+
echo "$input"
|
|
99
|
+
exit 2
|
|
100
|
+
fi
|
|
101
|
+
|
|
88
102
|
# R010 compliance heartbeat (every 50 tool calls)
|
|
89
103
|
if [ "$tool_count" -gt 0 ] && [ $((tool_count % 50)) -eq 0 ]; then
|
|
90
104
|
echo "[Compliance] R007: Agent ID required | R008: Tool ID required | R010: Delegate writes" >&2
|
|
@@ -54,6 +54,8 @@ if [ "$cost_pct" -ge 100 ] && [ "$last_level" != "100" ]; then
|
|
|
54
54
|
echo "[Cost Cap] Session cost \$${cost_usd} has reached cap \$${COST_CAP} (${cost_pct}%)" >&2
|
|
55
55
|
echo "[Cost Cap] Consider wrapping up or increasing CLAUDE_COST_CAP" >&2
|
|
56
56
|
echo "100" > "$ADVISORY_FILE"
|
|
57
|
+
echo "$input"
|
|
58
|
+
exit 2
|
|
57
59
|
elif [ "$cost_pct" -ge 90 ] && [ "$last_level" != "90" ] && [ "$last_level" != "100" ]; then
|
|
58
60
|
echo "[Cost Cap] Session cost \$${cost_usd} at 90% of cap \$${COST_CAP}" >&2
|
|
59
61
|
echo "[Cost Cap] Ecomode recommended — consider /compact" >&2
|
|
@@ -12,6 +12,7 @@ oh-my-customcode uses an **advisory-first enforcement model**. Most rules are en
|
|
|
12
12
|
|------|-----------|-------|----------|
|
|
13
13
|
| Hard Block | PreToolUse hook, exit 2 | stage-blocker, dev-server tmux, rule-deletion-guard | Prevents tool execution |
|
|
14
14
|
| Soft Block | Stop hook prompt | R011 session-end saves | Auto-performs then approves |
|
|
15
|
+
| Conversation Block | PostToolUse hook + `continueOnBlock` (CC v2.1.139+), exit 2 | stuck-detector, context-budget-advisor, cost-cap-advisor | Feeds rejection reason into conversation; Claude continues with awareness |
|
|
15
16
|
| Advisory | PostToolUse hooks | R007, R008, R009, R010, R018 | Warns via stderr, never blocks |
|
|
16
17
|
| Prompt-based | CLAUDE.md + rules/ + PostCompact | All MUST rules | Behavioral guidance in context |
|
|
17
18
|
|
|
@@ -22,7 +23,7 @@ oh-my-customcode uses an **advisory-first enforcement model**. Most rules are en
|
|
|
22
23
|
3. **Composability**: External skills and internal rules can coexist without deadlocks
|
|
23
24
|
4. **PostCompact reinforcement**: R007/R008/R009/R010/R018 are re-injected after context compaction
|
|
24
25
|
|
|
25
|
-
## Hard Enforcement Candidates — R010 git-delegation-guard (conditional), R007/R008 (
|
|
26
|
+
## Hard Enforcement Candidates — R010 git-delegation-guard (conditional), R007/R008 UserPromptSubmit/PreToolUse hook (multi-turn gap candidate, #1096). Promoted: rule-deletion-guard.sh (2026-04-08). See details via Read tool.
|
|
26
27
|
|
|
27
28
|
<!-- DETAIL: Hard Enforcement Candidates (Future)
|
|
28
29
|
If advisory enforcement proves insufficient for specific rules, these are candidates for promotion to hard-block:
|
package/templates/manifest.json
CHANGED