---
title: "04 — Workflow, Sessions, and Rewind — How a Task Moves Through the Loop"
uid: workflow-sessions-rewind
tags: ["workflow", "roadmap:claude-code", "cli-flags", "sessions", "claude-code", "rewind"]
excerpt: "A task moves through a fixed four-phase workflow — explore, plan, implement, verify — inside resumable sessions, with rewind as the safety net when a turn goes wrong."
date: 2026-08-13T03:28:22+0000
source: https://www.aveshina.my.id/en/blog/workflow-sessions-rewind
---

"I type, it replies" was my model of how a task gets done in Claude Code, and it made me retype far too much. The structure that replaced it: **there is a fixed four-phase workflow the loop runs, and my job is to steer each phase, not to retype the whole task every turn.** [1] The phases are explore, plan, implement, verify; the sessions hold the work between turns; and rewind is the net when a turn goes sideways.

The framing that clicked is to stop treating a session as a stream of independent prompts and start treating it as a pipeline I'm feeding. The agent indexes my codebase, reads the persistent CLAUDE.md, then for each task it researches the files (explore), proposes a strategy (plan), executes the edits on approval (implement), and runs my tests or linters to check for regressions (verify) [1]. Each phase has a steering move, and the CLI flags (-c, -r, --add-dir) plus the rewind menu are all about *moving between* phases and sessions without losing the work in them.

## The four-phase workflow

The roadmap names the phases directly, and once I could see them I started recognizing where a drifting session had gotten stuck [1]:

- **Explore.** The agent uses read-only tools to research the relevant files and dependencies. This is Plan mode's whole job — gather context without touching anything.
- **Plan.** From the research, it proposes a step-by-step strategy. I review and edit the plan before any execution.
- **Implement.** On approval, it edits files and runs shell tools to make the change.
- **Verify.** It runs the test suite or linters to confirm no regressions, often using MCP to sync results with GitHub or Jira.

The single biggest habit I picked up: **don't collapse explore and plan into implement.** When I rush a vague prompt straight into edits, the agent guesses the codebase and the verify phase fails. When I let explore+plan run first (Plan mode exists precisely to enforce this), the implement phase has a real strategy to execute and verify usually passes on the first try [1].

```figure
<svg viewBox="0 0 740 200" xmlns="http://www.w3.org/2000/svg" class="my-6 w-full max-w-2xl" role="img" aria-label="The four-phase workflow as a left-to-right pipeline: Explore (read-only research), Plan (propose strategy, review), Implement (edit files on approval), Verify (run tests/linters). Arrows flow left to right with a feedback arrow from Verify back to Explore labelled regressions found.">
  <defs>
    <marker id="wf1" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto">
      <path d="M0,0 L10,5 L0,10 z" fill="#64748b"/>
    </marker>
  </defs>
  <g font-family="ui-sans-serif, system-ui, sans-serif" text-rendering="geometricPrecision">
    <rect x="20" y="60" width="150" height="70" rx="10" fill="#dcfce7" stroke="#16a34a" stroke-width="1.5"/>
    <text x="95" y="85" font-size="13" font-weight="700" fill="#052e16" text-anchor="middle">Explore</text>
    <text x="95" y="103" font-size="9.5" fill="#475569" text-anchor="middle">read-only research</text>
    <text x="95" y="118" font-size="9.5" fill="#475569" text-anchor="middle">find the right files</text>

    <rect x="200" y="60" width="150" height="70" rx="10" fill="#fef9c3" stroke="#ca8a04" stroke-width="1.5"/>
    <text x="275" y="85" font-size="13" font-weight="700" fill="#422006" text-anchor="middle">Plan</text>
    <text x="275" y="103" font-size="9.5" fill="#475569" text-anchor="middle">propose strategy</text>
    <text x="275" y="118" font-size="9.5" fill="#475569" text-anchor="middle">human reviews</text>

    <rect x="380" y="60" width="150" height="70" rx="10" fill="#e0e7ff" stroke="#6366f1" stroke-width="1.5"/>
    <text x="455" y="85" font-size="13" font-weight="700" fill="#1e1b4b" text-anchor="middle">Implement</text>
    <text x="455" y="103" font-size="9.5" fill="#475569" text-anchor="middle">edit files</text>
    <text x="455" y="118" font-size="9.5" fill="#475569" text-anchor="middle">on approval</text>

    <rect x="560" y="60" width="150" height="70" rx="10" fill="#fce7f3" stroke="#db2777" stroke-width="1.5"/>
    <text x="635" y="85" font-size="13" font-weight="700" fill="#500724" text-anchor="middle">Verify</text>
    <text x="635" y="103" font-size="9.5" fill="#475569" text-anchor="middle">run tests / linters</text>
    <text x="635" y="118" font-size="9.5" fill="#475569" text-anchor="middle">check regressions</text>

    <path d="M170,95 L198,95" fill="none" stroke="#64748b" stroke-width="1.5" marker-end="url(#wf1)"/>
    <path d="M350,95 L378,95" fill="none" stroke="#64748b" stroke-width="1.5" marker-end="url(#wf1)"/>
    <path d="M530,95 L558,95" fill="none" stroke="#64748b" stroke-width="1.5" marker-end="url(#wf1)"/>

    <path d="M635,130 C635,170 95,170 95,132" fill="none" stroke="#db2777" stroke-width="1.5" stroke-dasharray="5,4" marker-end="url(#wf1)"/>
    <text x="365" y="186" font-size="10" font-style="italic" fill="#db2777" text-anchor="middle">regressions found → back to Explore</text>
  </g>
</svg>
```

## Steering the inputs: multiline and @ mentions

Two small input habits shape the explore phase a lot. **Multiline input** — typing \ then Enter — lets me format a complex instruction across several lines without sending it prematurely [2]. The roadmap's point is that this works in all terminals by default and tells the system to treat the next line as a continuation. I use it to lay out acceptance criteria as a bulleted block instead of a run-on sentence.

**File path mentions** — typing @ followed by a filename — point the agent at specific parts of the codebase, prioritizing those files in the conversation with autocomplete support [3]. Instead of letting it search the whole project to find the relevant module, I @lib/auth.ts and the explore phase starts from the right place. Both moves shape *what the loop perceives* — the same axis I covered in the previous post, now applied to the explore phase specifically.

## Sessions: where the work lives between turns

A **session** is the persistent container for a conversation — every interaction is stored in a unique session file, and the workflow above runs *inside* one [4]. The CLI flags are how I move between them without losing context:

- **claude -c** (or --continue) instantly reopens the most recent session in the current directory [5]. My default when I closed the terminal and want to pick up exactly where I left off.
- **claude -r** (or --resume) opens an interactive picker of past sessions, or jumps straight to one by Session ID [6]. When the work I want isn't the most recent — a different feature branch, an older debug thread.
- **claude --add-dir** includes extra folders at launch, granting read/write access to external locations alongside the current project [7]. For cross-repo tasks like updating a shared library and its consumer at once.

The detail that made sessions click: each new session starts with a fresh context window (to avoid irrelevance and control tokens), but Claude automatically snapshots affected files before any modification [4]. That snapshotting is what makes the next feature safe.

## Rewind: the safety net

**Rewind** is the feature I underrated for longest. Triggered by the /rewind slash command or the Esc + Esc shortcut, it opens a checkpoint menu built on the automatic snapshotting [8]. Every user prompt and every file modification creates a restore point through the session. When a turn goes wrong — a misunderstood instruction, a code-gen branch that's clearly broken — I rewind to a previous prompt and re-issue, without manually reverting individual files or juggling git commits.

The roadmap frames two scopes I use differently [8]:

- **Restore conversation only** — refine instructions without losing current file edits. Useful when the code is fine but I want to re-ask with better framing.
- **Restore code only** — revert specific file changes while keeping the chat context. Useful when the conversation's research is valuable but the edits were wrong.
- **Restore both** — a full rollback to a verified checkpoint. The "discard this entire branch of reasoning" button.

The mental shift: rewind means a wrong turn costs me seconds, not a recovery operation. That changes how willing I am to let the agent try something, because the downside is bounded.

## How I use this

The habit these notes left me with is a session rhythm. I open a fresh session per task (clean context), let it explore before planning (Plan mode for anything non-trivial), review the plan, then implement and verify. If a turn drifts, I rewind instead of typing corrections on top of the drift. When I close the terminal, -c brings me back; when the work is older, -r finds it. The phases are fixed; my steering of them — what I @-mention, where I rewind, which session I resume — is the entire craft.

## References

[1] Anthropic, "How Claude Code Works," Claude Code Docs, 2025. [Online]. Available: [https://code.claude.com/docs/en/how-claude-code-works](https://code.claude.com/docs/en/how-claude-code-works)

[2] Anthropic, "Multiline input," Claude Code Docs, 2025. [Online]. Available: [https://code.claude.com/docs/en/interactive-mode#multiline-input](https://code.claude.com/docs/en/interactive-mode#multiline-input)

[3] Anthropic, "CLAUDE.md imports," Claude Code Docs, 2025. [Online]. Available: [https://code.claude.com/docs/en/memory#claude-md-imports](https://code.claude.com/docs/en/memory#claude-md-imports)

[4] Anthropic, "Work with sessions," Claude Code Docs, 2025. [Online]. Available: [https://code.claude.com/docs/en/how-claude-code-works#work-with-sessions](https://code.claude.com/docs/en/how-claude-code-works#work-with-sessions)

[5] Anthropic, "Resume previous conversations," Claude Code Docs, 2025. [Online]. Available: [https://code.claude.com/docs/en/common-workflows#resume-previous-conversations](https://code.claude.com/docs/en/common-workflows#resume-previous-conversations)

[6] Anthropic, "CLI commands," Claude Code Docs, 2025. [Online]. Available: [https://code.claude.com/docs/en/cli-reference#cli-commands](https://code.claude.com/docs/en/cli-reference#cli-commands)

[7] Anthropic, "CLI commands — --add-dir," Claude Code Docs, 2025. [Online]. Available: [https://code.claude.com/docs/en/cli-reference](https://code.claude.com/docs/en/cli-reference)

[8] Anthropic, "Rewind and summarize," Claude Code Docs, 2025. [Online]. Available: [https://code.claude.com/docs/en/checkpointing#rewind-and-summarize](https://code.claude.com/docs/en/checkpointing#rewind-and-summarize)

```quiz
Q: What are the four phases of the Claude Code workflow, in order?
- Type, Wait, Read, Copy
- Explore, Plan, Implement, Verify
correct: 1
explain: The loop researches files (explore), proposes a strategy (plan), executes edits on approval (implement), and runs tests/linters to check for regressions (verify).

Q: What does typing `\` then Enter do in the prompt?
- Sends the prompt immediately
- Starts a multiline continuation so the next line is part of the same prompt
correct: 1
explain: Backslash-Enter is the multiline input shortcut. It works in all terminals by default and lets you format complex instructions across several lines without sending prematurely.

Q: `claude -r` (without a session ID) opens…
- a fresh session with a clean context
- an interactive picker of past sessions to choose from
correct: 1
explain: `-r`/`--resume` opens a session picker. With a Session ID it jumps straight to that session; `-c` reopens only the most recent one.

Q: What is the difference between "restore conversation only" and "restore code only" in the Rewind menu?
- There is no difference; both do the same thing
- Conversation-only keeps current file edits; code-only reverts files but keeps the chat context
correct: 1
explain: Conversation-only is for re-asking with better framing without losing edits. Code-only keeps the valuable research but discards wrong edits. Restore both is a full rollback.

Q: Why does Claude snapshot affected files before each modification?
- To enable the Rewind/checkpoint feature so a wrong turn can be reverted without git surgery
- To train the model on your edits
correct: 0
explain: Snapshotting is the mechanism behind checkpoints and rewind. It bounds the cost of a wrong turn to seconds instead of a manual recovery operation.
```
