I wanted Claude Code to keep working while I was away. Not "keep chatting", actually work: take a list of tasks, do them one by one, check each one, commit it, and leave me something I can review in the morning.
The problem is that an agent left alone has two bad habits. It stops to ask you something, and then waits for hours. Or it doesn't ask, and does something you would never have allowed.
So I wrote a skill for it. It's called otomode, and it lives in my open source repo multi-model-orchestra.
What it does
You start it with a duration:
otomode 8h
Before it starts, it asks everything in one round: the tasks in priority order, how to check that each one is done (a command whose exit code decides), which permissions the run will need, and what is off limits. After that answer it does not ask anything again.
Then it:
- writes a plan file,
OTOMODE.md, with a task table and a log; - creates its own branch;
- turns on a hook;
- schedules an hourly watchdog;
- starts working.
The hook is the important part
While otomode is on, a hook in ~/.claude/settings.json does two things for that session only.
It denies every permission prompt and every question. Nothing waits for me. Each denied prompt goes into QUESTIONS.md, so I can answer them all at the end.
It also refuses commands that are hard to undo: delete, deploy, push, send. rm, git push, reset --hard, gh pr create, kubectl, ssh, mail. These are logged too. The agent reads the reason, takes the safe default, and moves on to the next task.
A denial is not an error to retry. That one rule made the runs much calmer.
One commit per task, checked by a command
Each task runs in a subagent with its own git worktree. When it comes back, the main session does not trust its report. It reads the diff and runs the check command itself. The exit code decides, not the subagent's summary.
If the check passes, the change gets one commit on the otomode branch with the task id in the subject. If it fails, it retries with the failure in the brief, and moves up a model tier. After three tries the task is marked blocked with the reason, and the run continues.
Usage limits
Long runs hit plan limits. Before every task there is a usage gate. At 85% it stops starting new work, lets the running lanes finish, and schedules a one-shot cron for after the reset with otomode resume. When that fires, it re-reads OTOMODE.md and picks up from the first unfinished task.
A real run
My last run was 8 hours on a Go + React project, mostly while I was out:
- 16 tasks, all done
- about 25 commits, one per task plus a few fixes
- up to 3 lanes in parallel, each in its own worktree
- 15 prompts denied and logged
- paused at 87% usage, resumed after the reset
- 0 pushes
The parts that went wrong were useful too. One lane's test assumed a feature was off by default after another task had turned it on; the merge check caught it and it got its own fix commit. Generated files (an API spec digest, a test matrix) conflicted between lanes, so I now regenerate them after each cherry-pick instead of merging them by hand.
It is one run, not a benchmark. But I came back to a branch I could review commit by commit, and a short list of real questions.
When I say otomode off
It turns the hook off, stops the crons, and writes a report under 15 lines: tasks with commit hashes, what was blocked and why, the full check result, how many prompts were denied. Then a cleanup block with the exact commands it was not allowed to run (removing worktrees, test containers), and then the saved questions.
Nothing is pushed or merged until I say so.
Try it
The skill is in multi-model-orchestra, together with the routing skills it uses to send work to Claude, GPT (Codex CLI), Kimi or DeepSeek lanes. Install it, then register the hook once:
python ~/.claude/skills/otomode/scripts/otomode.py install
Then something like: "otomode 6h: these four tasks, each checked with go test ./...."
I'd like to hear how others handle unattended agent runs, especially what you block and what you let through.
Top comments (5)
The detail I'd steal first is the rule that a denial is not an error to retry — it turns the hook from a wall into a routing decision, and the QUESTIONS.md log is what makes that work. The merge check catching a lane's test that assumed a feature was off by default is a good catch too; it shows the review step earns its place. Do the 15 denied prompts tend to cluster around one or two questions, or are they spread across the whole run?
try feeding your hook wrapped commands too. ours denied git push fine but let timeout 30 git push, nice git push and env -i git push straight through. we added a git pre-push hook behind it, since that runs however the push got spelled
The first hour of an unattended session pays again on each request: every tool result it keeps goes back to the model with the next one. Measuring how much of those 8 hours was rereading would show whether the hook is the whole bill.
The part I'd steal is the denial log — turning a blocked prompt into a QUESTIONS.md entry instead of a stall is a neat trick. One thing I'm curious about: of the 15 denied prompts, were any ones the agent genuinely needed to move forward, and how did it recover on its own? Also, does the 85% usage gate only stop new tasks, or can it cut one off mid-flight?
Logging the denied prompts to QUESTIONS.md instead of letting the run stall is a smart default, and 0 pushes across the 8 hours is the number I'd care about most. One gap with command-text hooks: a script the agent writes and then runs with python3 doesn't look like rm. What I've added is running the agent in a sandbox and comparing a recorded trace (commands, exit codes, file changes) against its summary afterward. RayTrace does that for Claude Code and Codex (disclosure: I help the founder): github.com/Godcreatebugs/raytrace-cli