Claude Code Automation: Running Unattended Coding Sessions That Actually Finish
Claude Code is a powerful coding agent, but running it unattended requires more than a long timeout. Here's how a workflow layer around Claude Code turns automated sessions into reviewable, verified output.
Claude Code Automation: Running Unattended Coding Sessions That Actually Finish
Claude Code is one of the best coding agents available right now. It reasons well about codebases, handles multi-file changes, and produces clean diffs. The problem is not what Claude Code can do while you are watching — it is what happens when you are not.
Running Claude Code unattended means starting a session and walking away, expecting to come back to something reviewable. Most attempts at this fail for the same reason: Claude Code is an agent, not a workflow. It does not know when to stop, does not automatically verify its own output, and has no built-in re-entry mechanism when something goes wrong.
The Four Things Claude Code Needs for Unattended Runs
1. A spec, not a prompt. A prompt is "refactor the auth module." A spec is a concrete list of files, interfaces, and test expectations. Claude Code is good enough that it can handle a vague prompt — but it will also drift. A spec keeps the session bounded, and a bounded session is a session that is more likely to finish.
2. A stop condition. Without an explicit stop condition, Claude Code will keep going until it runs out of context or produces diminishing returns. The stop condition should be concrete: "all tests in auth/tests/ pass" or "the three target files match the refactor specification." Claude Code does not enforce this on its own — the workflow layer does.
3. Automated verification. The most common unattended-run failure mode: Claude Code produces a diff that looks right, but the tests do not pass, or a lint rule is broken, or a dependency is missing. A verify step that runs tests, lint, and a diff audit catches these before the human ever sees the output. Without it, "unattended" just means "unsupervised."
4. Clean re-entry. If the run fails, you need to know what failed, where, and why — not just that "the session ended." A workflow layer that logs phase results gives you a re-entry point: the develop phase produced X, the verify phase failed at Y, the loop returned to develop with these specific constraints. You do not have to reverse-engineer the session transcript.
The Pattern That Works
The pattern that makes Claude Code automation reliable is simple:
spec → Claude Code builds → verify catches issues → loop if broken → clean result
Each phase produces a concrete artifact. The spec is a markdown file. The build output is a diff. The verify result is a structured report. If the loop iterates, each iteration adds to the log. If the loop completes, the output is ready to review — not ready to audit.
This is not a hypothetical workflow. It is the default four-phase loop in Ralph Workflow: plan, develop, verify, deploy. Claude Code runs in the develop phase. Everything else — the spec, the verification gates, the re-entry path — is handled by the loop around it.
Why This Matters for Teams
The difference between "I use Claude Code" and "I can run Claude Code unattended" is not about prompt engineering. It is about whether there is a workflow layer that handles the boring parts: did it actually finish, did it pass the tests, and do I know exactly what changed?
For teams, this is the difference between an agent that helps one person move faster and an agent that can handle backlog work while the team sleeps.
Ralph Workflow is a free and open-source composable loop framework that wraps Claude Code (or your preferred agent) in a four-phase workflow with automated verification. You write the spec, the loop handles the rest.
Codeberg (primary) · GitHub mirror · How to run Claude Code unattended
Best evaluator path
Turn the idea into a real overnight test, not another saved tab.
Codeberg-first: open the primary repo, choose one bounded backlog task, run it tonight, and ask one question tomorrow morning — would I merge this? GitHub stays available as the mirror.
Open the primary Codeberg repo
Read the public source before you install anything.
Pick a first task
Use the guide to choose a bounded backlog item that is honest to review.
Install and run Ralph Workflow
Keep the machine awake, then decide in the morning whether the diff is good enough to merge.