PromptPrio

How to run Claude Code autonomously (overnight, on a backlog)

To run Claude Code on its own, give it three things: a ranked queue of tasks it can pull from, a loop prompt (pull → work → complete → repeat), and hard safety gates so money, credentials and publishing stop for a human. With those in place it clears your backlog unattended — even while you sleep.

The short answer: Claude Code becomes autonomous when it has somewhere to read the next task, a prompt that loops, and state that stops it redoing or colliding. TaskPrio gives Claude Code a one-line MCP queue, a ready-made autopilot prompt with safety gates, and a live cockpit so you can watch what it's doing.
Open the board — free →

What "autonomous" actually requires

Out of the box, Claude Code does one task and waits. To run it autonomously you need four things — and the missing ones are usually why "set it loose" turns into chaos:

Step by step: put Claude Code on a backlog

  1. Write your work as one ranked queue. Drop the tasks into a single global priority order — the agent will work them top to bottom. (A shared queue like TaskPrio is built for exactly this; you rank once, no statuses to babysit.)
  2. Connect Claude Code over MCP. One line installs the server so Claude Code can call get_next_task, complete_task and flag_needs_human:
    curl -fsSL https://promptprio.com/install.sh | sh
    See the Claude Code setup guide for the exact steps.
  3. Paste the autopilot prompt. It tells Claude Code to loop — pull → work → complete → repeat — auto-scopes to the project's working directory, stops on an empty queue, and keeps hard gates on money / credentials / publishing. Grab it at promptprio.com/autopilot-prompt.txt.
  4. Let it run. Claude Code pulls the top task with full context, does the work in your repo, logs a result on completion, and moves to the next — until the queue is empty, blocked, or it flags something for you.
  5. Watch it (optional). The live Sessions cockpit shows what the agent is on right now, what's idle, throughput, and real value-per-token.

Running it overnight

A loop prompt keeps Claude Code working, but a closed terminal window kills the process. To leave it running while you're away, wrap the session so it survives disconnect and the machine staying awake. On macOS:

caffeinate -dimsu claude   # keeps the Mac awake on power
# run that inside a tmux session so a closed window doesn't stop it:
tmux new -s agent 'caffeinate -dimsu claude'
# detach with Ctrl-b then d — it keeps running. Re-attach: tmux attach -t agent

The loop pulls and completes tasks until the queue drains, then stops — so an overnight run does real work and ends cleanly rather than spinning.

Safety: what should never run unattended

Always gated to a human — even overnight: spending money, entering credentials / API keys / 2FA codes, creating accounts, publishing under your identity (social, email, posts), and permanent deletes. These route to a "needs you" item; they never auto-run.

This is the difference between "autonomous" and "reckless." Autonomy on reversible work (edit, test, commit to a branch, deploy to a preview) is a productivity win. Autonomy on irreversible actions is a liability. TaskPrio's autopilot prompt encodes these gates so an unattended run stays trustworthy.

Frequently asked questions

Can Claude Code run by itself?

Yes — give it a ranked queue to pull from, a loop prompt, and safety gates, and it clears the backlog on its own, stopping when the queue is empty or it hits a gate.

How do I give Claude Code a to-do list it works through?

Put the tasks in a shared priority queue and connect Claude Code over MCP. It calls get_next_task to pull the top task with context, works it, calls complete_task, and repeats.

How do I keep it running overnight?

Launch the session in tmux (survives a closed window) wrapped in caffeinate -dimsu (keeps the Mac awake). The loop ends cleanly on an empty queue.

Won't it waste tokens?

One ranked queue means there's a single, deterministic next task (no wrong-thing work), and leasing stops redo and collisions. The cockpit shows value-per-token so you can see which runs pay off.

Run your backlog free →   Run several Claude Code sessions in parallel →