04 — Workflow, Sessions, and Rewind — How a Task Moves Through the Loop
"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].
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
[2] Anthropic, "Multiline input," Claude Code Docs, 2025. [Online]. Available: 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
[4] Anthropic, "Work with sessions," Claude Code Docs, 2025. [Online]. Available: 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
[6] Anthropic, "CLI commands," Claude Code Docs, 2025. [Online]. Available: 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
[8] Anthropic, "Rewind and summarize," Claude Code Docs, 2025. [Online]. Available: https://code.claude.com/docs/en/checkpointing#rewind-and-summarize
Knowledge check · Question 1 of 5
What are the four phases of the Claude Code workflow, in order?
Comments
Leave a Comment
You must be signed in to comment
0 Comments
No comments yet. Be the first to comment!