Claude works.
You sleep.

Two skills that turn Claude Code from an interactive tool into an autonomous worker. Validated, secured, ready for overnight runs.

2
Skills
8
Genre Templates
4
Security Layers
0
Humans at the Terminal
Explore

Claude Code Needs Babysitting

This is what it looks like when you use Claude Code for larger tasks. Four problems everyone encounters who has tried it.

Approval Fatigue

40 clicks per hour on "Approve". After 20 minutes, you stop reading what you're approving.

🧠

Context Loss

After /compact, Claude forgets the plan, the stack, the completed steps. Without correction, it loops.

💥

No Protection

rm -rf ~/ has documented cases of deleting entire home directories. --dangerously-skip-permissions alone is not a safety concept.

🪑

Human Required

No overnight runs. No parallel work. Leave the terminal, Claude stops.

Two Skills. Two Operating Modes.

Nightshift for planned project work. 24x7 for a continuous task queue. Both generate a complete, ready-to-run setup.

Nightshift

The Sprint

One task. One project. One validated plan. Claude works all night and commits the result in the morning.

  • Describe the task, pick a genre, install, start
  • 8 genre templates: Refactoring, Feature, Migration, Bugfix, Testing, Cleanup, DevOps, Docs
  • 15-point validation checks every runbook step before launch
  • Compact recovery: hook re-injects the plan after every context compression
  • Stall detection: 3 checks without progress triggers a loop warning
  • Run memory: decisions.md persists architecture decisions across runs
  • Result: a clean git commit the next morning
24x7

The Daemon

Endless runner. Drop tasks as folders. Claude processes them sequentially and delivers results.

  • Inbox/outbox architecture: mkdir, write task.md, done
  • Every task gets a fresh session — no context rot
  • Bash loop is the daemon, Claude is the worker
  • Workspace memory: decisions.md shares context across tasks
  • Configurable idle behavior: cleanup, docs, tests, or sleep
  • Watchdog shows live counters: inbox, working, done, failed

What the Skills Generate

Each skill generates a complete setup. Install, copy into your project, start.

nightshift-setup
runbook.md ← Task plan + autonomy zones + error budget .claude/settings.json ← Hooks: security + heartbeat + compact + stall detect nightshift-run.sh ← Headless + skip-permissions + PID lock nightshift-run-bg.sh ← Background starter (nohup) nightshift-watchdog.sh ← Heartbeat monitor nightshift-sandbox.sb ← macOS kernel sandbox CLAUDE-nightshift.md ← Conventions + run memory (decisions.md) README-nightshift.md ← Installation guide
24x7-setup
inbox/ ← Drop tasks here example-task/task.md ← Template working/ ← Auto-populated outbox/ ← Collect results failed/ ← Failed tasks runner.sh ← Endless loop + PID lock watchdog.sh ← Live status with counters sandbox.sb ← macOS kernel sandbox CLAUDE.md ← Rules + workspace memory (decisions.md) .claude/settings.json ← Security hooks

8 Templates for Every Task Type

Nightshift detects the task type and fills the runbook with the matching phases, risk checks, and autonomy zones.

Refactoring

5 phases

Feature

6 phases

Migration

5 phases

Bugfix

5 phases

Testing

4 phases

Cleanup

4 phases

DevOps

4 phases

Documentation

4 phases

When to Use Which Skill?

Property Nightshift 24x7
Mode Single run, then exit Endless loop
Task type Planned project work Continuous task queue
Workspace Directly in the project repo Isolated workspace
Runbook Validated, genre-based Freeform via task.md
Compact recovery Hook re-injects plan Not needed (fresh session)
Output Git commit in project Files in outbox/output/
Parallel projects Start multiple nightshifts One queue, sequential
Idle behavior Configurable
Loop detection Stall warning after 3 checks without progress Not needed (fresh session per task)
Cross-run memory decisions.md in project root decisions.md in workspace root

Four Layers of Defense

--dangerously-skip-permissions alone is not a safety concept. Both skills build four lines of defense.

1

PreToolUse Hook

Blocks rm -rf, sudo, mkfs, chmod 777, curl|bash, eval, fork bombs

2

macOS Sandbox

Kernel-level isolation. Claude can only write to the project folder and /tmp.

3

Git as Emergency Brake

git checkout . reverts everything. Always commit before starting.

4

Watchdog

Heartbeat monitor detects when Claude stalls. macOS notification or custom alerting.

How It Actually Works

Both skills combine four mechanisms. None of them work well alone. Together, they make autonomous runs reliable.

Layer 1 Runbook — Claude's External Memory

A markdown file with checkboxes that Claude reads before each step. When context compression happens (and it will, on any run longer than 20 minutes), Claude loses its internal memory of the plan. The runbook survives because it's a file on disk, not in Claude's context window. After every compression, a hook tells Claude: "Read runbook.md again. Find the next unchecked item. Continue there."

The runbook also contains autonomy zones that tell Claude what it may do freely, what to log, and what is forbidden. Plus an error budget defining how many test failures are acceptable before Claude should stop.

Layer 2 Hooks — Automated Guardrails

Claude Code hooks are scripts that fire on specific events. They run even with --dangerously-skip-permissions. A PreToolUse hook returning exit code 2 blocks the tool call unconditionally — Claude cannot override it.

PreToolUse → Blocks rm -rf, sudo, mkfs, chmod 777, curl|bash, eval PostToolUse → Writes heartbeat timestamp after every tool call SessionStart → After /compact: "Re-read runbook.md, continue at next open item" Stop → Every 5 steps: repeat constraints. 3× no progress: STALL WARNING

Layer 3 macOS Sandbox — Kernel-Level Isolation

A sandbox-exec profile restricts Claude's filesystem access at the kernel level. Claude can only write to the project directory and /tmp. Even if Claude tries rm -rf ~/, the kernel blocks it — the hook doesn't even need to catch it. This is the real safety net, not the hook.

Important: The sandbox is not active by default. You must explicitly start with sandbox-exec -f sandbox.sb ./run.sh. Without it, Claude has full access to everything your user account can reach. On Linux, use Docker or a dedicated user account instead.

Layer 4 Watchdog — Liveness Monitoring

A separate script that checks the heartbeat log. If Claude hasn't written a heartbeat in N minutes (default: 10), it raises an alarm. On macOS, this is a system notification. You can extend it with your own alerting (Slack webhook, email, etc.).

New Stall Detection — Loop Prevention

The watchdog catches crashes (no heartbeat). But what about loops? Claude retries the same failing test 50 times — the heartbeat looks healthy, but no progress is made. The Stop hook now tracks completed steps between checks. If 3 consecutive checks show no new checkmarks in the runbook, a STALL WARNING is injected into Claude's context.

The warning tells Claude to check its error budget and skip the step if allowed. This catches the most expensive failure mode in autonomous runs: burning hours of API credits on a loop that a human would have interrupted after 5 minutes.

New Run Memory — decisions.md

Autonomous runs are ephemeral — Claude starts fresh each time. But architecture decisions made in one run should inform the next. If Tuesday's run chose PostgreSQL over SQLite, Wednesday's run should know that.

Both skills now maintain a decisions.md file. Claude reads it at the start of every run and appends relevant decisions at the end. Format: date, decision, reasoning. Append-only, never overwrite. It's not learning — it's structured remembering.

Nightshift: decisions.md in the project root, persists across overnight runs. 24x7: decisions.md in the workspace root, shared across all tasks.

Using Nightshift: From Zero to Overnight Run

Everything you need to do, in order. Takes about 5 minutes to set up, then Claude runs for hours.

1

Install the Skill

Download nightshift.skill and unzip it into Claude's skill directory: unzip nightshift.skill -d ~/.claude/skills/. This makes the skill available in Claude Code and Claude.ai. You only do this once.

2

Tell Claude What to Do

Open Claude and say something like: "Set up a nightshift run for /my/project — refactor auth module to use JWT tokens". Claude detects the genre (refactoring), asks you to confirm, generates a runbook with concrete steps, validates it against 15 checks, and produces all setup files.

3

Copy Files Into Your Project

Claude generates a setup package. Copy the files into your project: runbook.md, .claude/settings.json, the shell scripts, and the sandbox profile. Append CLAUDE-nightshift.md to your existing CLAUDE.md.

4

Commit Your Current State

This is your safety net. Run git add -A && git commit -m "Checkpoint before Nightshift". If anything goes wrong during the run, git checkout . brings you back to exactly this state. Never skip this step.

5

Start the Run

For maximum safety: sandbox-exec -f nightshift-sandbox.sb ./nightshift-run.sh. For background operation (terminal can be closed): ./nightshift-run-bg.sh. The PID lock prevents accidental double starts. A cost warning is displayed — this run uses API credits.

6

Check Results in the Morning

Look at the git log: git log --oneline -5. Check what changed: git diff HEAD~1. Open runbook.md to see which steps were completed [x]. If something went wrong, git checkout . undoes everything.

Using 24x7: The Endless Task Queue

Set it up once, then drop tasks as folders whenever you need something done.

1

Install and Generate

Install the skill: unzip 24x7.skill -d ~/.claude/skills/. Then tell Claude: "Set up a 24x7 runner at /my/workspace with idle behavior cleanup". Claude generates the workspace structure with runner, watchdog, hooks, and sandbox.

2

Start the Runner

Copy the generated files to your workspace, make scripts executable, and start: ./runner-bg.sh. The runner now polls the inbox every 30 seconds. Start the watchdog in a second terminal: ./watchdog.sh

3

Drop a Task

Create a folder in inbox/ with a task.md describing the assignment and optionally a materials/ folder with input files. The runner detects it automatically, moves it to working/, spawns a fresh Claude session, and routes the result to outbox/ or failed/.

4

Collect Results

Check outbox/your-task/output/ for the deliverables. Read outbox/your-task/log.md for what Claude did. Failed tasks land in failed/ with error information in their log.md.

Why Fresh Sessions, Not One Long Run?

A single Claude session running for hours suffers from "context rot" — Claude becomes increasingly unreliable as context accumulates and gets compressed. The 24x7 runner avoids this entirely: the bash loop is the daemon (runs forever), Claude is the worker (fresh session per task, exits cleanly). Every task gets Claude at full quality.

What to Watch Out For

Autonomous Claude Code is powerful but not magic. Here's what you need to know before you start.

API Costs

Both skills run Claude Code in headless mode. Every tool call, every file read, every response consumes API credits. A Nightshift run might cost $5–50 depending on complexity. A 24x7 runner generates continuous costs. Monitor your usage at console.anthropic.com. For 24x7, set idle to "sleep" if cost is a concern — this prevents Claude from burning credits when no tasks are waiting.

The Sandbox Is Not Active by Default

The generated sandbox profile is just a file. You must explicitly start with sandbox-exec -f sandbox.sb ./run.sh. Without it, Claude has full access to your entire user account. The PreToolUse hook catches obvious destructive commands via pattern matching, but it's not a real security boundary — the sandbox is. On Linux, use Docker or a dedicated user account instead of sandbox-exec.

Runbook Quality Matters

Vague steps produce vague results. "Implement auth" can mean anything — Claude will guess, and in headless mode, nobody corrects the guess. Good steps include file paths, function names, or shell commands. The 15-point validation catches the worst offenders, but you should review the runbook before starting. If a runbook needs more than 20 steps, split it into multiple runs.

Always Commit Before Nightshift

Without a clean git state, you have no rollback. The runner warns you about uncommitted changes (non-blocking), but it's your responsibility to commit first. git checkout . is your emergency brake — it only works if you committed before the run.

macOS Only for Sandbox

sandbox-exec is a macOS-only feature (deprecated but functional). On Linux, run Claude inside a Docker container with mounted volumes, or create a dedicated user account with limited permissions. The hooks and watchdog work on any platform — only the kernel-level sandbox is macOS-specific.

Long Runs and Context Compression

Nightshift handles compression with two mechanisms: the SessionStart hook re-injects the plan after /compact, and the Stop hook repeats constraints every 5 steps. This works well for 10–20 step runbooks. For very long tasks (30+ steps), quality degrades even with these mechanisms. Split into multiple runs instead. The 24x7 skill avoids this entirely with fresh sessions per task.

What You Need Before Starting

⚙️

Claude Code CLI

The claude command must be installed and authenticated. These skills generate setups that use claude -p (headless mode).

🐚

bash, python3, jq

The runner scripts are bash. The build script is Python. Hooks use jq to parse JSON. All three must be in your PATH.

🍎

macOS (recommended)

For sandbox-exec kernel-level isolation. Works on Linux without the sandbox — use Docker or a dedicated user instead.

📁

Git repo (Nightshift)

Nightshift commits results to your repo. Without git, there's no rollback. For 24x7, any directory works.

Up and Running in 3 Minutes

Install and run Nightshift
# Install skill unzip nightshift.skill -d ~/.claude/skills/ # Tell Claude: # "Set up a Nightshift run for /my/project # — migrate auth module to JWT" # Copy generated files into project cp -r nightshift-setup/* /my/project/ chmod +x /my/project/nightshift-*.sh cd /my/project # IMPORTANT: commit first! git add -A && git commit -m "Checkpoint before Nightshift" # Start with sandbox (recommended) sandbox-exec -f nightshift-sandbox.sb ./nightshift-run.sh # Or background (terminal can be closed) ./nightshift-run-bg.sh # Monitor in second terminal ./nightshift-watchdog.sh
Install 24x7 and drop a task
# Install skill unzip 24x7.skill -d ~/.claude/skills/ # Tell Claude: # "Set up a 24x7 runner at /claude-workspace" # Copy and start cp -r 24x7-setup/* /claude-workspace/ chmod +x /claude-workspace/*.sh cd /claude-workspace ./runner-bg.sh # Drop a task — anytime mkdir -p inbox/my-task/materials cp my-files.* inbox/my-task/materials/ nano inbox/my-task/task.md # The runner picks it up automatically # Collect results ls outbox/my-task/output/ cat outbox/my-task/log.md