oh-my-customcode 0.44.1 → 0.44.3
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/package.json +1 -1
- package/templates/.claude/hooks/hooks.json +2 -2
- package/templates/.claude/hooks/scripts/context-budget-advisor.sh +12 -0
- package/templates/.claude/hooks/scripts/git-delegation-guard.sh +17 -0
- package/templates/.claude/hooks/scripts/stage-blocker.sh +4 -0
- package/templates/.claude/rules/MUST-orchestrator-coordination.md +73 -0
- package/templates/manifest.json +1 -1
package/package.json
CHANGED
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"hooks": [
|
|
58
58
|
{
|
|
59
59
|
"type": "command",
|
|
60
|
-
"command": "#!/bin/bash\nCOUNTER_FILE=\"/tmp/claude-tool-count
|
|
60
|
+
"command": "#!/bin/bash\nCOUNTER_FILE=\"/tmp/claude-tool-count-$PPID\"\nTHRESHOLD=${COMPACT_THRESHOLD:-50}\nif [ -f \"$COUNTER_FILE\" ]; then COUNT=$(cat \"$COUNTER_FILE\"); COUNT=$((COUNT + 1)); else COUNT=1; fi\necho \"$COUNT\" > \"$COUNTER_FILE\"\nif [ \"$COUNT\" -eq \"$THRESHOLD\" ]; then echo '[StrategicCompact] Reached '$THRESHOLD' tool calls' >&2; echo '[StrategicCompact] Consider /compact if at a logical breakpoint' >&2; fi\nif [ \"$COUNT\" -gt \"$THRESHOLD\" ] && [ $(((COUNT - THRESHOLD) % 25)) -eq 0 ]; then echo \"[StrategicCompact] $COUNT tool calls - /compact reminder\" >&2; fi\ncat"
|
|
61
61
|
}
|
|
62
62
|
],
|
|
63
63
|
"description": "Suggest manual compaction at logical intervals"
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
"hooks": [
|
|
148
148
|
{
|
|
149
149
|
"type": "prompt",
|
|
150
|
-
"prompt": "Context
|
|
150
|
+
"prompt": "Context compacted. RULES STILL ACTIVE — no exceptions.\n\nR007 FORMAT — Your NEXT response MUST start with:\n┌─ Agent: claude (default)\n└─ Task: {current task}\n\nR008 FORMAT — Before EVERY tool call:\n[claude][opus] → Tool: ToolName\n[claude][opus] → Target: /path/to/file\n\nR010 — ALL file writes MUST be delegated to subagents. Orchestrator uses Read/Glob/Grep ONLY. ALL git operations go through mgr-gitnerd.\n\nR009 — 2+ independent tasks → spawn agents in parallel, same message.\n\nR018 — 3+ agents OR review cycle → use Agent Teams.\n\nIf /tmp/.claude-autonomous-$PPID exists: R010 lightweight mode is active — simple git (add/commit/push) may execute directly, but file Write/Edit still requires delegation.\n\nRe-read CLAUDE.md NOW to restore project context."
|
|
151
151
|
}
|
|
152
152
|
],
|
|
153
153
|
"description": "Reinforce enforced rules after context compaction — prevents rule amnesia (v2.1.76+)"
|
|
@@ -85,6 +85,18 @@ if [ "$tool_count" -gt 0 ] && [ $((tool_count % 25)) -eq 0 ]; then
|
|
|
85
85
|
fi
|
|
86
86
|
fi
|
|
87
87
|
|
|
88
|
+
# R010 compliance heartbeat (every 50 tool calls)
|
|
89
|
+
if [ "$tool_count" -gt 0 ] && [ $((tool_count % 50)) -eq 0 ]; then
|
|
90
|
+
echo "[Compliance] R007: Agent ID required | R008: Tool ID required | R010: Delegate writes" >&2
|
|
91
|
+
VIOLATION_FILE="/tmp/.claude-r010-violations-${PPID}"
|
|
92
|
+
if [ -f "$VIOLATION_FILE" ]; then
|
|
93
|
+
v_count=$(wc -l < "$VIOLATION_FILE" | tr -d ' ')
|
|
94
|
+
if [ "$v_count" -gt 0 ]; then
|
|
95
|
+
echo "[Compliance] R010 violations this session: ${v_count}" >&2
|
|
96
|
+
fi
|
|
97
|
+
fi
|
|
98
|
+
fi
|
|
99
|
+
|
|
88
100
|
# Pass through
|
|
89
101
|
echo "$input"
|
|
90
102
|
HOOK_END=$(date +%s%N 2>/dev/null || echo 0)
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
# R010 git-delegation-guard hook
|
|
3
3
|
# Warns when git operations are delegated to a non-mgr-gitnerd agent via Agent/Task tool.
|
|
4
4
|
# WARN only - does NOT block (exit 0, passes input through).
|
|
5
|
+
#
|
|
6
|
+
# PPID Scoping Convention:
|
|
7
|
+
# All session-scoped temp files MUST use $PPID (Claude Code parent PID),
|
|
8
|
+
# NOT $$ (subprocess PID which changes per hook invocation).
|
|
9
|
+
# Pattern: /tmp/.claude-{purpose}-${PPID}
|
|
10
|
+
# See also: agent-teams-advisor.sh, context-budget-advisor.sh, stuck-detector.sh
|
|
5
11
|
|
|
6
12
|
# Dependency check: exit silently if jq not available
|
|
7
13
|
command -v jq >/dev/null 2>&1 || exit 0
|
|
@@ -11,6 +17,9 @@ input=$(cat)
|
|
|
11
17
|
agent_type=$(echo "$input" | jq -r '.tool_input.subagent_type // ""')
|
|
12
18
|
prompt=$(echo "$input" | jq -r '.tool_input.prompt // ""')
|
|
13
19
|
|
|
20
|
+
# R010 violation tracking file (PPID-scoped for session persistence)
|
|
21
|
+
VIOLATION_FILE="/tmp/.claude-r010-violations-${PPID}"
|
|
22
|
+
|
|
14
23
|
# Only warn when the delegated agent is NOT mgr-gitnerd
|
|
15
24
|
if [ "$agent_type" != "mgr-gitnerd" ]; then
|
|
16
25
|
git_keywords=(
|
|
@@ -30,6 +39,14 @@ if [ "$agent_type" != "mgr-gitnerd" ]; then
|
|
|
30
39
|
if echo "$prompt" | grep -qi "$keyword"; then
|
|
31
40
|
echo "[Hook] WARNING: R010 violation detected - git operation ('$keyword') delegated to '$agent_type' instead of 'mgr-gitnerd'" >&2
|
|
32
41
|
echo "[Hook] Per R010, all git operations (commit/push/branch/merge/etc.) MUST be delegated to mgr-gitnerd" >&2
|
|
42
|
+
|
|
43
|
+
# Record violation for R021 promotion tracking
|
|
44
|
+
echo "$(date -u +%Y-%m-%dT%H:%M:%SZ) $keyword $agent_type" >> "$VIOLATION_FILE"
|
|
45
|
+
violation_count=$(wc -l < "$VIOLATION_FILE" 2>/dev/null | tr -d ' ')
|
|
46
|
+
if [ "$violation_count" -ge 3 ]; then
|
|
47
|
+
echo "[Hook] R010 violations: ${violation_count} this session — R021 promotion threshold reached" >&2
|
|
48
|
+
fi
|
|
49
|
+
|
|
33
50
|
break
|
|
34
51
|
fi
|
|
35
52
|
done
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
# Stage-blocking hook: blocks Write/Edit in non-implement stages
|
|
3
|
+
# Mutual Exclusion: This hook is mutually exclusive with autonomous mode (R010).
|
|
4
|
+
# When /tmp/.claude-dev-stage exists, autonomous mode cannot be activated.
|
|
5
|
+
# When /tmp/.claude-autonomous-$PPID exists, /structured-dev-cycle should not be started.
|
|
6
|
+
# See: MUST-orchestrator-coordination.md "Autonomous Execution Mode" section.
|
|
3
7
|
if [ -f /tmp/.claude-dev-stage ]; then
|
|
4
8
|
stage=$(cat /tmp/.claude-dev-stage | tr -d '[:space:]')
|
|
5
9
|
if [ -z "$stage" ]; then exit 0; fi
|
|
@@ -112,6 +112,79 @@ Main Conversation (orchestrator)
|
|
|
112
112
|
Agent(mgr-gitnerd, prompt="commit the fix")
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
+
## Autonomous Execution Mode
|
|
116
|
+
|
|
117
|
+
When the user explicitly signals full-delegation intent, the orchestrator operates in a lightweight mode that reduces delegation overhead while preserving safety.
|
|
118
|
+
|
|
119
|
+
### Activation Signals
|
|
120
|
+
|
|
121
|
+
| Signal (Korean) | Signal (English) | Confidence |
|
|
122
|
+
|-----------------|------------------|------------|
|
|
123
|
+
| "알아서 해" | "just do it" | High |
|
|
124
|
+
| "다 해" | "do it all" | High |
|
|
125
|
+
| "전부 처리해" | "handle everything" | High |
|
|
126
|
+
| "중간에 묻지 말고" | "don't ask, just do" | High |
|
|
127
|
+
| "자율적으로 진행" | "proceed autonomously" | High |
|
|
128
|
+
|
|
129
|
+
### Activation Protocol
|
|
130
|
+
|
|
131
|
+
1. User gives explicit autonomous signal (not inferred from task complexity)
|
|
132
|
+
2. Verify stage-blocker is NOT active (`/tmp/.claude-dev-stage` must not exist)
|
|
133
|
+
3. Create marker: `echo 1 > /tmp/.claude-autonomous-$PPID`
|
|
134
|
+
4. Announce: `[Autonomous Mode] Activated for current task scope`
|
|
135
|
+
|
|
136
|
+
### Lightweight Delegation Table
|
|
137
|
+
|
|
138
|
+
| Operation | Normal Mode | Autonomous Mode |
|
|
139
|
+
|-----------|-------------|-----------------|
|
|
140
|
+
| File Write/Edit | MUST delegate to specialist | MUST delegate to specialist |
|
|
141
|
+
| Simple git (add, commit, push) | MUST delegate to mgr-gitnerd | MAY execute directly |
|
|
142
|
+
| Complex git (rebase, merge, cherry-pick) | MUST delegate to mgr-gitnerd | MUST delegate to mgr-gitnerd |
|
|
143
|
+
| Brainstorming/planning gates | Follow skill workflow | Skip confirmation gates |
|
|
144
|
+
| Confirmation prompts (Execute? [Y/n]) | Per skill workflow | Auto-proceed |
|
|
145
|
+
|
|
146
|
+
### Boundaries (NEVER relaxed in autonomous mode)
|
|
147
|
+
|
|
148
|
+
- **R001 (Safety)**: All safety rules remain absolute — no exceptions
|
|
149
|
+
- **R007/R008 (Identification)**: Agent/tool identification still required for traceability
|
|
150
|
+
- **File Write/Edit delegation**: Still requires specialist agents — autonomous mode only relaxes git and gate overhead
|
|
151
|
+
- **Hard-block hooks**: stage-blocker, dev-server tmux, .md creation blocker remain active
|
|
152
|
+
- **R009 (Parallel execution)**: Still required for efficiency
|
|
153
|
+
|
|
154
|
+
### Scope and Lifetime
|
|
155
|
+
|
|
156
|
+
- **Task-scoped**: Expires when the delegated task completes or user gives a new instruction
|
|
157
|
+
- **Session-local**: Never persisted to MEMORY.md or across sessions
|
|
158
|
+
- **Compaction-aware**: PostCompact hook checks `/tmp/.claude-autonomous-$PPID` and preserves mode
|
|
159
|
+
- **Explicit exit**: User says "stop", "wait", "멈춰", "잠깐" → mode deactivated
|
|
160
|
+
|
|
161
|
+
### Mutual Exclusion
|
|
162
|
+
|
|
163
|
+
- Autonomous mode and `/structured-dev-cycle` (stage-blocker) are **mutually exclusive**
|
|
164
|
+
- If `/tmp/.claude-dev-stage` exists → autonomous mode CANNOT be activated
|
|
165
|
+
- If autonomous mode is active → `/structured-dev-cycle` should not be started
|
|
166
|
+
|
|
167
|
+
### Self-Check
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
╔══════════════════════════════════════════════════════════════════╗
|
|
171
|
+
║ BEFORE ACTIVATING AUTONOMOUS MODE: ║
|
|
172
|
+
║ ║
|
|
173
|
+
║ 1. Did user give EXPLICIT autonomous signal? ║
|
|
174
|
+
║ YES → Continue ║
|
|
175
|
+
║ NO → Do NOT activate ║
|
|
176
|
+
║ ║
|
|
177
|
+
║ 2. Is stage-blocker inactive? ║
|
|
178
|
+
║ (/tmp/.claude-dev-stage does NOT exist) ║
|
|
179
|
+
║ YES → Continue ║
|
|
180
|
+
║ NO → Cannot activate (mutually exclusive) ║
|
|
181
|
+
║ ║
|
|
182
|
+
║ 3. Is task scope clear and bounded? ║
|
|
183
|
+
║ YES → Create marker, announce, proceed ║
|
|
184
|
+
║ NO → Clarify scope first ║
|
|
185
|
+
╚══════════════════════════════════════════════════════════════════╝
|
|
186
|
+
```
|
|
187
|
+
|
|
115
188
|
## Session Continuity
|
|
116
189
|
|
|
117
190
|
After restart/compaction: re-read CLAUDE.md, all delegation rules still apply. Never write code directly from orchestrator.
|
package/templates/manifest.json
CHANGED