Spend less time babysitting your AI. 10 production-tested hooks + 3 tools + 6 templates that let Claude Code run with less supervision — catching errors, managing context, and making decisions without asking you constantly.
# Try it now (read-only scan, nothing installed)
curl -sL https://gist.githubusercontent.com/yurukusa/10c76edee0072e2f08500dd43da30bc3/raw/risk-score.sh | bash
# Auto-fix with free hooks (non-destructive, existing files kept)
curl -sL https://gist.githubusercontent.com/yurukusa/10c76edee0072e2f08500dd43da30bc3/raw/risk-score.sh | bash -s -- --fixExtracted from 140+ hours of real autonomous operation that shipped a 15,000-line game without the human writing code themselves.
| Without hooks | With hooks |
|---|---|
| Claude asks "should I continue?" every 5 min | Claude decides and logs uncertainty |
| Syntax errors found 50 tool calls later | Errors caught immediately after every edit |
| Session runs out of context without warning | Staged warnings at 80/120/150 tool calls |
rm -rf executes with no warning |
Destructive commands flagged before execution |
| Hook | What it does |
|---|---|
context-monitor.sh |
Tracks context window usage with staged warnings (soft/hard/critical) |
no-ask-human.sh |
Blocks "should I continue?" questions — forces autonomous decisions |
syntax-check.sh |
Auto-runs syntax verification after every file edit (Python, Shell, JSON) |
decision-warn.sh |
Flags destructive commands (rm -rf, git reset --hard) before execution |
activity-logger.sh |
Logs every tool call with timestamps for post-session audit |
branch-guard.sh |
Prevents direct commits to main/master — forces feature branches |
error-gate.sh |
Blocks continuation after 3+ consecutive errors — forces root cause analysis |
cdp-safety-check.sh |
Validates CDP browser targets before automation runs |
proof-log-session.sh |
Auto-generates session proof logs for accountability |
session-start-marker.sh |
Stamps session metadata on startup for tracking |
| Tool | What it does |
|---|---|
claude-md-generator.sh |
Interactive CLAUDE.md generator — answer 8 questions, get a tailored config |
risk-score.sh |
Check your autonomous operations safety in 10 seconds — scores 10 items, links to fixes |
cc-solo-watchdog.sh |
Idle detector — monitors your Claude pane and sends a nudge when it goes quiet |
| File | What it does |
|---|---|
templates/CLAUDE.md |
Baseline instructions for autonomous operation |
templates/CLAUDE-autonomous.md |
Extended CLAUDE.md for fully autonomous sessions |
templates/LESSONS.md |
Self-improvement tracking template |
templates/dod-checklists.md |
Definition of Done checklists for quality gates |
templates/mission.md |
Mission focus template for session continuity |
templates/task-queue.yaml |
Structured task queue format |
examples/settings.json |
Standard settings with all 10 hooks configured |
examples/settings-autonomous.json |
Settings for fully autonomous sessions |
examples/settings-minimal.json |
Minimal 4-hook config for getting started |
install.sh |
One-command setup — installs hooks, copies templates, prints config |
git clone https://github.com/yurukusa/claude-code-ops-starter.git
cd claude-code-ops-starter
bash install.shThen add the hook configuration to your ~/.claude/settings.json (the installer prints the exact JSON to copy-paste).
Counts tool calls as a proxy for context window usage. Warns you at 3 thresholds:
- Soft (80 calls): "Consider deferring large tasks"
- Hard (120 calls): "Wrap up and prepare to hand off"
- Critical (150 calls): Auto-generates a checkpoint file for session handoff
Blocks all AskUserQuestion tool calls during unattended sessions. Instead of stopping to ask "which approach should I use?", the AI:
- Decides on its own
- Logs uncertainty to
~/pending_for_human.md - Moves to the next task
To temporarily re-enable questions: export CC_ALLOW_QUESTIONS=1
Runs after every Edit or Write tool call:
- Python:
python -m py_compile - Shell:
bash -n - JSON:
jq empty
Catches syntax errors immediately instead of discovering them 50 tool calls later.
Scans Bash commands for dangerous patterns (rm -rf, git reset --hard, DROP TABLE, etc.) and prints a warning. Doesn't block by default — uncomment one line in the script to enable hard blocking.
- Required:
bash(all hooks are shell scripts) - Optional:
jq— used bysyntax-check.shanddecision-warn.shto parse hook input. If missing, these hooks silently skip (no errors, no crashes) - Optional:
python3orpython— used bysyntax-check.shfor Python file checking. If missing, Python syntax checks are skipped
Install optional dependencies:
# Debian/Ubuntu
sudo apt install jq python3
# macOS
brew install jq python3rm ~/.claude/hooks/context-monitor.sh
rm ~/.claude/hooks/no-ask-human.sh
rm ~/.claude/hooks/syntax-check.sh
rm ~/.claude/hooks/decision-warn.shThen remove the corresponding hooks entries from ~/.claude/settings.json.
Don't know where to start? The generator asks 8 questions and produces a project-specific CLAUDE.md with safety rules built in:
bash tools/claude-md-generator.shOr use defaults for a quick start:
bash tools/claude-md-generator.sh --defaults --output ~/.claude/CLAUDE.mdCheck your autonomous operations safety in 10 seconds:
bash tools/risk-score.shOr run it directly without cloning:
curl -sL https://gist.githubusercontent.com/yurukusa/10c76edee0072e2f08500dd43da30bc3/raw/risk-score.sh | bashChecks 10 items (CLAUDE.md, hooks, git safety, secrets, etc.) and shows a risk score with links to fixes.
Diagnose and fix in one command:
curl -sL https://gist.githubusercontent.com/yurukusa/10c76edee0072e2f08500dd43da30bc3/raw/risk-score.sh | bash -s -- --fixThis runs the scan, installs the free hooks, then re-scans to show your improvement (e.g. CRITICAL 14/19 → MODERATE 5/19). Existing files are never overwritten.
The 4 hooks stop bad things from happening. cc-solo-watchdog keeps good things happening.
When Claude finishes a task and sits idle, the watchdog detects the silence and sends it a nudge — a structured prompt containing your mission focus and task queue. Claude reads the nudge, picks the next task, and continues working. No human required.
# Step 1: enable the loop
touch ~/cc_loop.enabled
# Step 2: start the watchdog (inside a tmux session)
bash tools/cc-solo-watchdog.sh --bgThe nudge message it sends looks like:
[idle 120s detected / 2026-03-01 14:30]
▶ Decision tree — check in order
1. Any content scheduled for today or earlier? → publish it
2. Any finished but unshipped work? → ship it
3. Top item in your task queue? → work on it
4. Blocked 3+ times on one thing? → log it in pending_for_human.md
▶ Next task
(your task queue output)
▶ Mission focus
(first items from your ~/ops/mission.md)
Settings (configurable at the top of the script):
| Variable | Default | What it controls |
|---|---|---|
IDLE_THRESHOLD |
120s | How long before a nudge is sent |
NUDGE_COOLDOWN |
300s | Minimum gap between nudges |
MAX_NUDGES_PER_HOUR |
4 | Safety cap on nudge rate |
TMUX_SESSION |
cc |
tmux session name to watch |
Prerequisites: tmux, Claude Code running in a tmux session.
To stop: bash tools/cc-solo-watchdog.sh --stop or rm ~/cc_loop.enabled
Before adding hooks, check where your current workflow stands. This 10-item checklist covers the most common failure points from 140+ hours of autonomous operation:
Claude Code Ops Self-Check (10 items) — 5 minutes to read, no signup required.
Covers: context monitoring, dangerous command blocking, session state saving, external send approval, error root cause analysis, and more. Each item includes a real failure example and a fix.
The full system — 10 hooks + watchdog + templates + examples — is what enabled 88 tasks to complete autonomously in one overnight session while the human slept.
| Free: claude-code-hooks | Ops Kit ($19) | |
|---|---|---|
| Hooks | 10 hooks (copy & configure yourself) | Same 10 hooks, pre-configured |
| Templates | 5 templates | 6 templates (+ baseline CLAUDE.md) |
| Tools | — | 3 tools (watchdog, CLAUDE.md generator, risk-score) |
| Config examples | — | 3 ready-to-use settings.json variants |
| install.sh | — | One-command setup |
| Setup time | ~45 min (read docs, configure each hook) | ~15 min (run install.sh, done) |
The free repo gives you all the parts. The Ops Kit gives you the assembled, tested, ready-to-run package.
This toolkit emerged from a real experiment: a non-engineer using Claude Code to build a complete game (Azure Flame, 15,000+ lines of Python) with minimal human intervention. Every hook in this repo solved a real problem encountered during autonomous operation.
Read more:
- 4 Hooks That Let Claude Code Run Autonomously (dev.to) — deep dive into each hook
- 5 Design Patterns for LLM Agent Teams (dev.to) — the patterns behind these hooks
- How Two AIs Consult Each Other While I Sleep (Zenn) — multi-agent orchestration
- I Spent $200 on AI and Made $2 (dev.to) — the full story
MIT License. Use it, modify it, share it.
Issues and PRs welcome. If you build a hook that helps your autonomous workflow, please share it.
@yurukusa_dev on X