cd /news/ai-agents/i-ran-claude-code-unattended-all-nig… · home topics ai-agents article
[ARTICLE · art-91652] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=· neutral

I ran Claude Code unattended, all night

A developer built auto-claude, a bash loop that runs Claude Code unattended overnight on a queue of small, well-defined tasks, using verification commands to decide pass or fail. The tool isolates each task in a git worktree, caps spending, and logs results, shifting the bottleneck from model capability to task specification.

read3 min views1 publishedAug 11, 2026

I keep a running list of small, well-defined tasks I never get to: a missing health-check endpoint, a flaky test, a config file that could use a default. None of them are hard. All of them lose every day to whatever is actually on fire. So I built auto-claude, a bash loop that picks tasks off a queue, runs Claude Code against each one in isolation, and only keeps the result if a command I chose says it passed.

The premise I started from: if the work is specified precisely enough, and something other than my judgment at 3 a.m. decides whether the result is acceptable, there's no reason a human needs to sit in the loop approving every step. That "something else" is a verification command — a test suite, a build, a lint pass, whatever proves the task worked. It either exits 0 or it doesn't. No vibes.

That reframes the actual bottleneck. It's not model capability, it's task specification. A vague task produces a vague result regardless of how good the model is. A task with a closed objective, verifiable acceptance criteria, and pointers to the right files is bounded by the model's competence, not by how many hours I spend babysitting the terminal.

queue/todo/*.md --> for each task:
                      git worktree from BASE_BRANCH   (my checkout stays untouched)
                      claude -p  <- prompts/build.md + the task
                      VERIFY_CMD
                        |- pass -> commit on branch auto/<task> [push] [PR]
                        |- fail -> claude -p --resume <- prompts/fix.md
                                   (bounded by MAX_FIXES)
                    --> queue/done/ or queue/failed/
                    --> logs/report-<timestamp>.md

One task at a time, each in its own git worktree

so a bad run can't touch my actual checkout. If verification fails, Claude gets one more shot with a fix prompt, bounded by MAX_FIXES

so a stubborn task doesn't burn the whole night. In the morning I read one report file: pass or fail per task, branch, diffstat, duration, cost.

The loop itself is maybe 300 lines of bash. Nothing clever. Where the actual engineering went is the list of things that go wrong when nobody's watching, and what stops each one:

VERIFY_CMD

actually passing, and the prompts explicitly forbid deleting or skipping tests to get there.MAX_BUDGET_USD

caps spend per invocation; the report totals the real cost.None of this makes the model more capable. It makes an incapable or confused run fail loudly and cheaply instead of quietly doing something wrong on a shared branch.

PERMISSION_FLAGS

defaults to --dangerously-skip-permissions

, because that's what unattended operation actually requires — Claude runs shell commands, edits files, and reaches the network without asking. The worktree isolates my source tree, not my machine or my credentials. Anything inside that worktree can see whatever SSH keys, cloud sessions, and tokens my shell can see. I'm not describing that as a sandbox, because it isn't one. If I were pointing this at something I actually cared about protecting, I'd run it inside a container with only the credentials that specific task needs, and I'd replace the permission flag with an explicit allowlist instead of skipping the check entirely.

Right now I run it against throwaway repos and side projects, PUSH_BRANCH

and OPEN_PR

both off, and I read every branch before it goes anywhere. That's not a limitation of the tool so much as the appropriate amount of trust for a script that executes AI-generated shell commands while I'm asleep.

Writing the task file is now the part that takes effort, which is the correct place for effort to go. "Add GET /health

returning {"status":"ok"}

" survives an unattended run. "Improve observability" does not — there's no verification command that can judge that, so it either loops forever trying to guess what I meant or passes something I didn't ask for. Once I started writing tasks like the first kind, the backlog of small annoying things actually started shrinking overnight instead of accumulating.

Repo: auto-claude on GitHub

── more in #ai-agents 4 stories · sorted by recency
── more on @claude code 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/i-ran-claude-code-un…] indexed:0 read:3min 2026-08-11 ·