Skip to content

yurukusa/claude-code-ops-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Claude Code Ops Starter

License: MIT Bash Claude Code

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.

risk-score --fix demo: CRITICAL 16/19 → HIGH 7/19 in 30 seconds

# 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 -- --fix

Extracted from 140+ hours of real autonomous operation that shipped a 15,000-line game without the human writing code themselves.

Before vs After

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

What's Included

10 Hooks

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

3 Tools

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

6 Templates + 3 Config Examples

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

Quick Start

git clone https://github.com/yurukusa/claude-code-ops-starter.git
cd claude-code-ops-starter
bash install.sh

Then add the hook configuration to your ~/.claude/settings.json (the installer prints the exact JSON to copy-paste).

How the Hooks Work

Context Monitor

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

No-Ask-Human

Blocks all AskUserQuestion tool calls during unattended sessions. Instead of stopping to ask "which approach should I use?", the AI:

  1. Decides on its own
  2. Logs uncertainty to ~/pending_for_human.md
  3. Moves to the next task

To temporarily re-enable questions: export CC_ALLOW_QUESTIONS=1

Syntax Check

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.

Decision Warn

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.

Dependencies

  • Required: bash (all hooks are shell scripts)
  • Optional: jq — used by syntax-check.sh and decision-warn.sh to parse hook input. If missing, these hooks silently skip (no errors, no crashes)
  • Optional: python3 or python — used by syntax-check.sh for Python file checking. If missing, Python syntax checks are skipped

Install optional dependencies:

# Debian/Ubuntu
sudo apt install jq python3

# macOS
brew install jq python3

Uninstall

rm ~/.claude/hooks/context-monitor.sh
rm ~/.claude/hooks/no-ask-human.sh
rm ~/.claude/hooks/syntax-check.sh
rm ~/.claude/hooks/decision-warn.sh

Then remove the corresponding hooks entries from ~/.claude/settings.json.

Generate Your CLAUDE.md

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.sh

Or use defaults for a quick start:

bash tools/claude-md-generator.sh --defaults --output ~/.claude/CLAUDE.md

Risk Score: How Safe Is Your Setup?

Check your autonomous operations safety in 10 seconds:

bash tools/risk-score.sh

Or run it directly without cloning:

curl -sL https://gist.githubusercontent.com/yurukusa/10c76edee0072e2f08500dd43da30bc3/raw/risk-score.sh | bash

Checks 10 items (CLAUDE.md, hooks, git safety, secrets, etc.) and shows a risk score with links to fixes.

Auto-fix mode

Diagnose and fix in one command:

curl -sL https://gist.githubusercontent.com/yurukusa/10c76edee0072e2f08500dd43da30bc3/raw/risk-score.sh | bash -s -- --fix

This 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.

Autonomous Loop: Keep Claude Moving While You're Away

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 --bg

The 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


Self-Check: Is Your Autonomous Setup Safe?

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.


Sleep While Shipping

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 vs. Ops Kit

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.

Get the Ops Kit — $19

Background

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:

License

MIT License. Use it, modify it, share it.

Contributing

Issues and PRs welcome. If you build a hook that helps your autonomous workflow, please share it.


@yurukusa_dev on X

About

10 hooks + 3 tools + 6 templates for autonomous Claude Code. Context monitoring, syntax checks, destructive command guards, and one-command install. $19 on Gumroad.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages