Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Running Work While You Sleep

Whether an unattended run succeeds is decided during the day, by the preparation you do before you leave. An agent can be left alone with a hard task only if it can verify its own work. The guide names three things that make this safe: a finish condition the agent can check, an isolated worktree or cloud agent, and a decision log that you audit in the morning.

This chapter follows the order in which you meet those concerns: preparing the run, writing the handoff, choosing a playbook for the shape of the work, reading the results in the morning, and the safety rules that hold throughout. The source is the guide’s overnight page together with the playbooks it routes to.

Earn trust before you start the loop

A loop you do not trust simply produces unchecked work faster, and each iteration builds on the previous mess. Before leaving a run unattended, confirm four conditions.

  • You have done the task once by hand, or watched an agent do it, so you know what a good result looks like.
  • The agent has the same tools and signals you would use: the project’s verification skill, the profiler, the logs.
  • Every stage proves its work and can stop the line when the work falls short.
  • You have read a few transcripts and converted the recurring failures into tools, skills, or checks.

Until all four hold, run the loop while you watch it. Make it autonomous only afterwards.

The overnight contract

A good handoff states the goal, the finish condition, the permissions, and an escape hatch. It does not need to be long. The guide’s example reads:

/poteto-mode im going to bed. migrate every caller to the new parser in a fresh worktree off <base>.
done means zero old callers, all parser fixtures pass, old api deleted.
keep a decision log. don't ask me before committing.
/loop until done. if you're truly stuck after a few hours, stop and write up why.

Each line does a specific job.

LineWhat it buys you
“im going to bed”A session override: the agent stops asking questions and keeps going.
“done means …”Turns the goal into checks that every iteration can run.
“fresh worktree off <base>”Keeps the run from colliding with anything else you have open.
“don’t ask me before committing”Answers in advance the permission question on which the agent would otherwise block.
/loopCursor’s built-in wake mechanism (not a pstack skill), used to re-check the finish condition.
The escape hatchLets the agent stop at a genuine dead end and explain why, instead of spending 8 hours reinterpreting the goal.

Because you will review this work after stepping away, /poteto-mode routes it through figure-it-out, which designs the phases of the run before any code is written and wires in the decision log.

A duration is not a finish condition. If you ask for “Work on this for 4 hours”, the agent has no test to apply, so the morning brings 4 hours of activity and no result. What /loop needs is a predicate that either passes or fails.

What the loop does each iteration

The Autonomous run playbook defines the cycle:

  1. Check the finish condition.
  2. Make the smallest change that the evidence justifies.
  3. Verify it against the real artifact.
  4. Commit it if it advanced the predicate, or discard it if it did not.
  5. Log one decision row.

Changes that did not help are discarded, including defensive additions that “might help”. A plateau is a reason to change approach, not a reason to stop, and the predicate is never quietly relaxed so that the run can declare victory. Only a genuine dead end, an irreversible action, or a product or preference question that no experiment can settle goes back to you.

For waking up, the playbook distinguishes two cases. When there is an event to wait for (a CI run, a merge, a ref advancing), a watcher subagent wakes the run on that event, with a long time-based heartbeat as a fallback. When there is no event, a fixed-interval heartbeat is sized to how often the result is worth re-checking.

Pausing and resuming on purpose

To stop a run deliberately, tell the agent to pause, or say that you are about to go offline or restart Cursor. The Pause safely playbook then:

  • finishes or backs out of the current atomic step and cancels nested subagents;
  • takes no irreversible action (no new PR or push);
  • commits uncommitted edits as one wip: commit on the current branch;
  • writes a resume note with the intent, progress, current state, next steps, key files, and gotchas.

Pausing happens only on an explicit request. “Keep going”, “going to bed, keep going”, and “don’t stop” never trigger it.

A fresh chat continues the work through the Session pickup playbook. It treats the previous trail as authoritative input, reconstructs the branch, the commits, and the open decisions, and names the resume point without redoing finished work. It still checks the inherited claims against the original goal on the real artifact, because a passing self-report from the previous agent does not count as proof.

When the night holds a queue or a program

The contract above drives one task to one finish condition. Some nights hold more than that.

Shape of the workUse
One taskThe Autonomous run playbook, as above.
A queue of independent PRs, merged by morningThe Autopilot-full playbook.
A queue of PRs that you will land yourselfThe Autopilot-stack playbook.
A PR that only needs to be carried to greenThe Babysit playbook.
A whole program, such as a migration across many packagesNo dedicated playbook; /poteto-mode routes it to figure-it-out.

Autopilot-full assigns a single owner agent to every PR and makes it responsible from build to merge, yet an owner never merges on the strength of its own verdict. Once the head is code-ready, a swarm of fresh verifiers examines it. After that, a rebase or a minor fix is checked by one verifier, and the full swarm returns only for new behavior or a large new diff. The prompt in the guide is brief:

/poteto-mode full autopilot on this queue. each item is independent. i want them merged by morning.

Autopilot-stack is the same playbook without the merge. You wake up to verified PRs, each with its verdict, and review them before anything lands:

/poteto-mode autopilot these five changes, but don't merge. i'll land them in the morning.

Babysit declares a mode first (drive, threads-only, or check), then clears conflicts, review threads, and CI in that order, using the watch-pr script to follow the PR’s state on GitHub. It never rebases or force-pushes, and babysitting never counts as permission to merge.

Running several projects in parallel

A Cursor Project gives one coordinator agent a persistent thread. The coordinator does not write code; it directs subagents, which run in the cloud by default, so the work continues while your laptop is closed. Each agent it starts first reads worker.md, a short rule sheet that tells workers to hold to the kickoff’s bar, make reversible decisions instead of asking, and open PRs ready for review.

The guide recommends a few habits for this setup:

  • Give each body of work (a feature, a migration, a performance push, a cleanup) its own Project.
  • Drag related chats into the Project, including finished ones, so that every agent in it has them as context.
  • Run a verification swarm on every PR before it is merged, and hand the queue to Autopilot-stack or Autopilot-full.
  • Ask the coordinator for a plan backed by data, and have it settle open questions with prototypes before it asks you.

Letting loops start themselves

Each loop described so far still depends on you to launch it. An automation triggered by a schedule or an event takes over that step. Software maintenance suits this well because it breaks into stages: triage a report, reproduce it, fix it, and verify the fix. Two rules make such a pipeline trustworthy. First, any stage is allowed to halt the line; triage may conclude that the behavior is expected, and reproduction may fail. Second, each stage hands over evidence, for example screenshots of the broken state and proof of the fix taken before and after.

For issue reports posted in a Slack channel, pstack includes a dormant automation pack of this kind, benny. It consists of 2 automations: the first triages every incoming report, and the second reproduces the bugs that triage confirms and is allowed to prepare a small draft fix. Setting it up means directing an agent to the pack’s FOR_AGENTS.md and telling it which repository to target.

The morning audit

In the morning your task is to audit decisions, not to re-read the whole night. show-me-your-work is what makes this possible. It keeps a decision log: a TSV file with one row per decision and the columns ts, phase, decision, why, evidence, and result. The file lives at decisions.tsv, or at .audit/<task-slug>.tsv when several runs share a directory. It stays out of git by default and is committed only when a reviewer needs the trail to trust the result. The log is append-only, so a wrong call is corrected by a new row, never by editing an old one.

  1. Ask for the run in review form, for example /show-me-your-work catch me up on what you did last night.
  2. Read the Attention section at the end of the reply first. Before handing back, the skill has a reviewer on another vendor’s model read the trail and the transcript and flag weak evidence, skipped verification, and risky choices.
  3. Follow only the log rows those flags point at, and open their evidence (commits, screenshots, command output).

For a quick status instead of a full audit, run ketchup in the chat that ran the work. It changes nothing, explains in plain words what has changed since your last message, and lists every call waiting on you with its recommended choice, evidence, and risk.

Treat a row whose result is INCONCLUSIVE as undecided. figure-it-out states that “Inconclusive is not a pass”, and benchmark-checklist uses the same verdict for a performance number whose limiting factor cannot be named, whose comparison ran untuned, or whose error and work counts were not checked. In that case the fix is to close the named gap and measure again, not to round the result up to success.

After a queue run, each PR comes back with its state and verdict. With Autopilot-stack the verified PRs are waiting for your review. What justifies a merge is the verifiers’ clean verdict on the patch that lands; Autopilot-full states that green CI alone never authorizes a merge.

Safety rules

The autonomy of poteto-mode has clear limits, defined in its SKILL.md and in the playbooks above.

  • Reversible work and external actions such as team chat, ticket updates, or starting evals proceed without asking.
  • Irreversible writes always pause the run: force-pushes to shared branches, deploys, data deletion, and messages to customers.
  • The finish condition is never relaxed to claim success. A plateau means a change of approach; only a genuine dead end is reported.
  • Changes that did not help are discarded, and so are speculative additions kept “just in case”.
  • In Autopilot-full, any change that loosens a gate (a raised budget, a new allowlist entry) needs a verifier’s proof and a fresh countersign from the root agent, because the owner is the party that wants the check to pass. Disabling a check, or letting it fail softly, is never kept, because such a check stops guarding every case.
  • Parallel agents work in separate worktrees or as cloud agents. Agents sharing one worktree overwrite each other, and afterwards it is impossible to tell which agent changed what.