.claude/skills/ac-hooks-manager/SKILL.md
Hook installation and management for autonomous coding. Use when setting up Stop hooks, managing pre/post tool hooks, or configuring autonomous continuation.
npx skillsauth add adaptationio/skrillz ac-hooks-managerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Hook installation and management for enabling autonomous operation.
Manages all Claude Code hooks for autonomous operation:
from scripts.hooks_manager import HooksManager
hooks = HooksManager(project_dir)
await hooks.install_autonomous_hooks()
# Installs Stop hook for autonomous continuation
status = await hooks.get_status()
print(f"Stop hook: {'installed' if status.stop_hook else 'missing'}")
The Stop hook enables autonomous continuation by intercepting Claude Code's stop event:
Claude Code completes response
│
▼ (Stop event fires)
Stop Hook Script
├─ Read transcript
├─ Check safety limits
├─ Call Opus analyzer
└─ Return decision
│
├─ CONTINUE: block stop, inject next task
└─ COMPLETE: allow stop, terminate
stop_hook_active (prevents infinite loops)CONTINUE: Exit code 2 + reason → Claude continuesCOMPLETE: Exit code 0 → Claude stops{
"session_id": "abc123",
"transcript_path": "/path/to/conversation.jsonl",
"cwd": "/current/working/directory",
"permission_mode": "default",
"hook_event_name": "Stop",
"stop_hook_active": false
}
Critical Field: stop_hook_active
false: First time hook firing (proceed with analysis)true: Hook already blocked once (allow stop to prevent doom loop)To Continue:
{
"decision": "block",
"reason": "Next task: implement the login endpoint"
}
Exit code: 2
To Stop:
{
"decision": "approve"
}
Exit code: 0
{
"hooks": {
"Stop": [{
"matcher": {},
"hooks": [{
"type": "command",
"command": ".claude/skills/ac-hooks-manager/scripts/autonomous-loop.sh"
}],
"timeout": 120
}],
"PreToolUse": [{
"tools": ["Bash"],
"hooks": [{
"type": "command",
"command": ".claude/skills/ac-security-sandbox/scripts/validate.sh"
}]
}],
"PostToolUse": [{
"tools": ["Write", "Edit"],
"hooks": [{
"type": "command",
"command": "npx prettier --write \"$FILE\""
}]
}]
}
}
await hooks.install_stop_hook(
script_path=".claude/skills/ac-hooks-manager/scripts/autonomous-loop.sh",
timeout=120
)
await hooks.install_pre_tool_hook(
tools=["Bash"],
script_path=".claude/skills/ac-security-sandbox/scripts/validate.sh"
)
await hooks.install_post_tool_hook(
tools=["Write", "Edit"],
command="npx prettier --write \"$FILE\""
)
await hooks.install_session_hooks(
on_start=".claude/hooks/load-memory.sh",
on_end=".claude/hooks/save-memory.sh"
)
await hooks.install_autonomous_hooks()
# Installs:
# - Stop hook (continuation)
# - PreToolUse hook (security)
# - Session hooks (memory)
await hooks.install_hook(
event="Stop",
config={
"type": "command",
"command": "path/to/script.sh"
},
timeout=120
)
await hooks.remove_hook(event="Stop")
status = await hooks.get_status()
# Returns:
# stop_hook: bool
# pre_tool_hooks: list
# post_tool_hooks: list
# session_hooks: dict
errors = await hooks.validate()
if errors:
for error in errors:
print(f"Hook error: {error}")
#!/bin/bash
# Read input from stdin
INPUT=$(cat)
# Extract fields
STOP_ACTIVE=$(echo "$INPUT" | jq -r '.stop_hook_active')
TRANSCRIPT=$(echo "$INPUT" | jq -r '.transcript_path')
CWD=$(echo "$INPUT" | jq -r '.cwd')
# Safety check: prevent doom loops
if [ "$STOP_ACTIVE" == "true" ]; then
echo '{"decision": "approve"}'
exit 0
fi
# Load state
STATE_FILE="$CWD/.claude/autonomous-state.json"
if [ -f "$STATE_FILE" ]; then
ITERATION=$(jq -r '.iteration' "$STATE_FILE")
COST=$(jq -r '.estimated_cost' "$STATE_FILE")
else
ITERATION=0
COST=0
fi
# Check limits
MAX_ITERATIONS=50
MAX_COST=20.00
if [ "$ITERATION" -ge "$MAX_ITERATIONS" ]; then
echo '{"decision": "approve"}'
exit 0
fi
if (( $(echo "$COST > $MAX_COST" | bc -l) )); then
echo '{"decision": "approve"}'
exit 0
fi
# Call Opus analyzer (see ac-opus-analyzer skill)
DECISION=$(python3 "$CWD/.claude/skills/ac-hooks-manager/scripts/analyze.py" \
--transcript "$TRANSCRIPT" \
--iteration "$ITERATION")
# Return decision
echo "$DECISION"
exit $(echo "$DECISION" | jq -r 'if .decision == "block" then 2 else 0 end')
if [ "$STOP_ACTIVE" == "true" ]; then
exit 0 # Allow stop
fi
if [ "$ITERATION" -ge "$MAX_ITERATIONS" ]; then
exit 0 # Allow stop
fi
if (( $(echo "$COST > $MAX_COST" | bc -l) )); then
exit 0 # Allow stop
fi
FAILURES=$(jq -r '.consecutive_failures' "$STATE_FILE")
if [ "$FAILURES" -ge 3 ]; then
exit 0 # Allow stop, escalate
fi
references/HOOK-MECHANICS.md - Detailed hook behaviorreferences/STOP-HOOK.md - Stop hook deep divereferences/SAFETY.md - Safety mechanismsscripts/hooks_manager.py - Core HooksManagerscripts/autonomous-loop.sh - Stop hook handlerscripts/analyze.py - Opus analyzer wrapperscripts/hook_installer.py - Hook installationdevelopment
Setup secure web-based terminal access to WSL2 from mobile/tablet via ttyd + ngrok/Cloudflare/Tailscale. One-command install, start, stop, status. Use when you need remote terminal access, web terminal, browser-based shell, or mobile access to WSL2 environment.
development
Complete development workflows where Claude writes the code while Gemini and Codex provide research, planning, reviews, and different perspectives. Claude remains the main developer. Use for complex projects requiring expert planning and multi-perspective reviews.
development
Systematic progress tracking for skill development. Manages task states (pending/in_progress/completed), updates in real-time, reports progress, identifies blockers, and maintains momentum. Use when tracking skill development, coordinating work, or reporting progress.
testing
Comprehensive testing workflow orchestrating functional testing, example validation, integration testing, and usability assessment. Sequential workflow for complete skill testing from examples through scenarios to integration validation. Use when conducting thorough testing, pre-deployment validation, ensuring skill functionality, or comprehensive quality checks.