SC26Join us at Booth 5405 · Nov 16–19
Parallel Works

Plans, Goals & Checkpoints

Beyond one prompt and one answer, pw code can plan before it changes anything, keep working until a condition you set is met, repeat a prompt on a schedule, and roll code and conversation back to an earlier prompt.

Plan Mode

In plan mode the agent researches and writes a plan instead of changing your code. It can read and search files and run shell commands that do not modify anything, and the only file it may write is its plan. See Plan Mode for exactly what is allowed.

Enter plan mode in any of these ways:

  • Press Shift+Tab until the permission line shows ⏸ plan mode.
  • Start with pw code --permission-mode plan.
  • Run /plan, or /plan <description> to switch and start planning that task in one step.
CommandEffect
/planSwitch to plan mode, and show the session's plan if it has one.
/plan <description>Switch to plan mode and send the description as the next prompt.
/plan openOpen the plan file in your editor.

Plans are saved as markdown files under ~/.local/state/pw/plans/, named after your request. The plan stays with the session, so /plan shows it again after you resume. /plan works from the main session, not from a subagent's window.

Approving a Plan

When the plan is ready, the agent asks you to approve it. The prompt shows the plan and four choices:

  1. Yes, clear context and use auto mode: Clear the conversation and start building the plan in auto mode, with the plan as the starting point.
  2. Yes, use auto mode: Keep the conversation and switch to auto mode.
  3. Yes, auto-accept edits: Keep the conversation and switch to accept-edits mode.
  4. Tell the agent what to change: Type feedback and press Enter to send it back; the agent revises the plan and asks again.

See Permission Modes for what auto and accept-edits allow.

KeyAction
↑/↓ or k/jMove between choices.
1-4Jump to a choice.
EnterConfirm the highlighted choice.
Shift+TabWith feedback typed, approve the plan in auto mode and pass the feedback along as a note.
Ctrl+GEdit the plan in your editor ($VISUAL, then $EDITOR); your edits become the plan. Not available in an attached session.
PgUp/PgDn, Home/EndScroll the plan.
EscDecline; the agent stays in plan mode and keeps planning.

In a non-interactive run, approval is always declined and the run prints where the plan was saved.

Goals

/goal <condition> keeps the agent working until a condition is met. The agent starts right away, and after every turn a separate check reads the conversation and decides whether the condition holds. If it does not, the agent takes another turn, guided by what the check found missing.

/goal all tests in ./parser pass and go vet is clean, or stop after 20 turns

You can also ask in plain words, such as "set a goal to get the parser tests passing and keep going until they do". The agent then writes the condition itself and sets the same goal /goal would, which every /goal command works on. It sets a goal only when you ask for one, cannot replace a goal that is still active or paused, and never decides on its own that the goal is met.

The check cannot run commands or read files: it judges only what the agent showed in the conversation, so state the condition in terms the agent can prove, such as a command's exit status. Bound the loop in the condition itself, with a turn or time limit; the check honors it even when the work is unfinished. Conditions are limited to 4,000 characters.

CommandEffect
/goal <condition>Set the goal and start working toward it. Replaces any current goal.
/goalShow the current goal, or the one most recently achieved.
/goal edit <condition>Rewrite the current goal's condition, keeping its elapsed time, turn count, and token spend. Bare /goal edit puts the current condition in the composer to rewrite.
/goal pauseStop the loop but keep the condition. hold also works.
/goal resumePick a paused goal back up. continue also works.
/goal clearStop working toward the goal. stop, off, reset, none, and cancel also work.

/goal takes effect immediately, even while a turn is running. An edited goal that is active continues right away under the new condition; a paused one stays paused. Interrupting a turn with Esc or Ctrl+C pauses the goal, and only /goal resume picks it back up: a prompt you send while it is paused runs as an ordinary turn and leaves the goal paused, so you can ask about the work without restarting the loop. While a goal is set, ◎ /goal active (elapsed) or ◎ /goal paused shows above the composer, and when the check passes the transcript reports the time, turns, and tokens it took.

If the provider reports a usage limit that resets within about a day, the turn waits for the reset and then carries on, and the goal with it. The transcript shows Usage limit reached with the time work resumes; stopping the turn cancels the wait.

The goal is saved with the session and survives a resume. Each check is an extra model request. To run a goal from a script, see Running a Goal.

Loops

/loop repeats a prompt in the session:

/loop 10m check the deploy and report any failed pods
/loop run the flaky test again and dig into any failure
/loop
  • With an interval (30s, 5m, 2h, 1d, or a trailing every 2 hours), the agent creates a recurring scheduled task for the prompt. Intervals are converted to a cron schedule, so seconds round up to one minute.
  • Without an interval, the loop paces itself: after each pass, the agent picks a delay from 1 to 60 minutes before the next one, and stops when the work is done.
  • Without a prompt, a maintenance prompt runs: continue unfinished work from the conversation, then tend to the current branch's pull request (review comments, failed CI runs, merge conflicts), and otherwise do a focused cleanup pass. To replace it, write your own prompt in .claude/loop.md in the workspace, or in ~/.claude/loop.md for every workspace.

Ask the agent to list or cancel scheduled tasks at any time. A session holds up to 50 scheduled tasks, and recurring tasks expire after 7 days. Tasks fire while the session is hosted by the background daemon, so they keep running after you quit pw code. Set the CLAUDE_CODE_DISABLE_CRON environment variable to 1 to turn off /loop and scheduled tasks entirely.

Rewinding to a Checkpoint

pw code takes a checkpoint each time you send a prompt in the main session, keeping the 100 most recent. To go back to one, run /rewind, or press Esc twice at an empty prompt. Pick a prompt from the list, newest first, then choose what to restore:

ChoiceEffect
Restore code and conversationUndo file changes made since that prompt, and remove that prompt and everything after it from the conversation.
Restore conversationRemove that prompt and everything after it, leaving files as they are.
Restore codeUndo file changes made since that prompt, keeping the conversation.

The code choices appear only when files changed after that prompt. When the conversation is restored, the prompt is put back in the composer so you can edit and resend it.

What code restore covers

Code restore undoes changes the agent made with its file-editing tools. Changes made by shell commands, by you, or by other programs are not tracked.

/rewind is available only from the main session, and waits for a running turn to finish.