Your First Session
Start, steer, interrupt, and rewind
- Start a Claude Code session from the terminal — bare or with an initial task — and complete the first-run login
- Steer Claude conversationally by interrupting with Esc and typing a correction mid-run
- Recover from mistakes using checkpoints — Esc Esc or /rewind — and distinguish restore from summarize
- Respond to permission prompts and paste an image for a mockup or error screenshot
- Exit a session and resume it later with claude -c, knowing where transcripts are stored
Your first hands-on run with Claude Code: start a session with a task, watch the agentic loop work, interrupt and redirect it mid-run, recover instantly with checkpoints, and exit and resume — so you feel in control from the very first minute.
- 1The mental model: a teammate you steer, not a button you press
- 2Starting a session and the first-run login
- 3Watch the loop, then steer it mid-run
- 4Permission prompts: you approve before anything happens
- 5Checkpoints: an undo button for Claude's edits
- 6Paste an image: mockups and error screenshots
- 7Exit and resume: your work persists
The mental model: a teammate you steer, not a button you press
Before you type anything, hold one picture in your head. Claude Code is an agent running a loop in your terminal, not an autocomplete that fires once. Give it a goal and it works in three blended phases: gather context (reads files, searches the codebase), takes action (edits files, runs commands), and verifies (runs tests, checks output). The loop is adaptive — a quick question may only gather context; a refactor may run all three many times.
That single fact changes how you work. Because Claude is running over time, you don't have to write the perfect prompt up front and pray. You can watch it work and steer it like a conversation — nudge it when it drifts, correct a wrong assumption, or stop it entirely. And because every edit is snapshotted, a wrong turn is never fatal: you can rewind to any earlier state.
This lesson is a guided first run. By the end you'll have started a session, redirected Claude mid-task, undone a change with a checkpoint, handled a permission prompt, pasted an image, and resumed a session after quitting. Those six moves are the whole game for a beginner — everything else builds on them.
Key insight
Steering beats prompting
A beginner's instinct is to agonize over the opening prompt. Don't. A good-enough prompt plus active steering — interrupt, correct, rewind — beats a 'perfect' prompt you can't adjust once it's running. Treat the session as a live conversation, not a one-shot command.
Starting a session and the first-run login
Open your terminal, cd into a project directory, and run claude. The session starts in your current working directory — that's the scope Claude can see and edit.
You have two ways to begin:
# Start an interactive session, then type your task at the prompt
claude
# Or hand Claude a task right on the command line
claude "fix the login bug"Both land you in the same interactive session; the second just pre-fills your first message. The task can be plain English — Claude figures out which files to read.
First-run login. The very first time you run claude, it walks you through authentication: it opens your browser so you can log in with your Claude subscription (or you can run /login from inside a session). Credentials are then stored for you — encrypted in the macOS Keychain, or in ~/.claude/.credentials.json (mode 0600) on Linux and Windows — so you only do this once per machine.
A reminder from setup: Claude Code is not on the free tier. You need a paid plan — Pro, Max, Team Premium, Enterprise, or Console (API) — to authenticate. A free Claude.ai account can't run it.
Note
The default model
As of 2026 (Claude Code v2.1.x) the default model is Sonnet 4.6, with Opus 4.6 / 4.7 / 4.8 available for harder work. You don't need to choose anything to start — Sonnet 4.6 is a strong default. Switch later with /model if you want.
Watch the loop, then steer it mid-run
Send your task and watch. Claude narrates what it's doing — reading a file, searching for a function, proposing an edit. This visibility is the point: you're not waiting in the dark, you're supervising.
Here's the move that makes you feel in control immediately. If Claude heads the wrong way — editing the wrong file, misunderstanding the goal — press Esc to interrupt it. Esc stops Claude immediately while preserving the work it has already done, so nothing you wanted is thrown away. Then just type a correction and send it.
Claude reads your correction after it finishes the current action, then incorporates it and continues — no restart, no re-explaining the whole task. It's exactly like tapping a colleague on the shoulder: "actually, use the helper in utils.ts, not a new function."
> Refactor the auth code into a service class
[Claude starts editing api/login.ts...]
(you press Esc)
> Wait — put the service in services/, not api/. And keep the existing function signatures.
[Claude reads the correction, adjusts course, continues]The habit to build: don't suffer a bad trajectory. The instant Claude drifts, Esc and redirect. It's faster and cheaper than letting it finish, then asking it to undo.
Tip
Esc preserves, it doesn't discard
Interrupting with Esc is safe. It pauses Claude and keeps everything done so far — useful edits, files already read. You're redirecting the conversation, not nuking progress. So interrupt freely the moment something looks off.
Permission prompts: you approve before anything happens
Claude doesn't silently change your machine. By default it runs in a permission mode where it asks before editing a file or running a command. You'll see a prompt that shows exactly what it wants to do — the file and the diff for an edit, or the literal command for a shell run — and you choose: allow it, allow it and stop asking for similar actions this session, or reject and tell Claude what to do instead.
This is the beginner's safety rail. Nothing irreversible happens without your yes. Read the diff in the prompt the way you'd read a teammate's pull request — it's your chance to catch a mistake before it lands.
When you reject a prompt, you're not stuck: you can type why, and Claude adapts. "No — don't delete that file, just comment out the call instead." Rejection is just another form of steering.
A realistic first session looks like a short back-and-forth of approvals: Claude proposes an edit, you approve, it runs the test, you approve, it makes the next edit. That rhythm is normal and it's exactly where your judgment lives.
Watch out
Read before you approve
It's tempting to mash 'yes' to keep things moving. Slow down on commands that touch files broadly or run shell operations — rm, git, anything that writes outside your project. The permission prompt exists so a wrong action gets caught by you, not discovered later.
Checkpoints: an undo button for Claude's edits
Even with permission prompts, you'll sometimes approve a change that turns out wrong — or you'll want to try a different approach. That's what checkpoints are for. Claude Code automatically snapshots your code before each edit, and every prompt you send also creates a checkpoint. It's a session-level safety net that lets you pursue ambitious changes knowing you can always return.
To rewind, run /rewind, or press Esc twice when the prompt input is empty. (If there's text in the input, double-Esc clears it instead — that text is saved to your input history, so press Up to recall it.) The rewind menu lists every prompt you sent this session; pick a point, then choose an action:
| Action | What it does |
|---|---|
| Restore code and conversation | Revert both files and chat history to that point |
| Restore conversation | Rewind the chat to that message, keep current code |
| Restore code | Revert file changes, keep the conversation |
| Summarize from here | Compress the selected message and everything after into a summary (frees context) |
| Summarize up to here | Compress everything before that point, keep later messages intact |
| Never mind | Back out without changing anything |
Restore vs. summarize is the key distinction. Restore actually reverts state — it undoes code, conversation, or both, as if it never happened. Summarize doesn't touch files on disk at all; it just compresses part of the conversation into an AI-generated summary to free up context-window space. Restore is your undo; summarize is your declutter.
Three limits to internalize now, because they catch beginners:
- Checkpoints are session-local and separate from git. They're a fast 'local undo,' not version history. Git is still your permanent record — keep committing.
- File changes only. Checkpoints track edits made by Claude's file-editing tools. Changes from bash commands —
rm,mv,cp,git reset— are not captured and can't be rewound. For those, rely on git. - Auto-cleaned after 30 days (configurable), along with the session itself.
Example
A typical rescue
Claude refactors three files and the app breaks. You don't debug its mess — you press Esc Esc, pick the prompt right before the refactor, and choose Restore code. Files snap back to the working state; the conversation stays, so you can say 'try that again, but don't touch the router' and go. Total recovery time: seconds.
Paste an image: mockups and error screenshots
Claude can see, not just read. You can paste an image directly into the prompt and Claude analyzes it as [Image #N]. Two everyday uses:
- A design mockup — paste it and say 'build this component to match,' and Claude compares its implementation against the picture.
- An error screenshot — paste a stack trace or a broken UI and Claude uses it as debugging context, instead of you transcribing the error by hand.
The paste shortcut depends on your platform:
| Platform | Shortcut |
|---|---|
| Windows / Linux | Ctrl+V |
| macOS (incl. iTerm2) | Cmd+V |
| WSL | Alt+V |
> (Cmd+V to paste a screenshot of the failing page)
[Image #1]
This is the 500 error users hit on checkout. Find the cause and fix it.Watch out
Don't hoard screenshots in one session
Images are stored at full resolution in the session transcript and pile up fast. Accumulating many can bloat context and, on long sessions, cause errors on resume. If you've pasted a lot of images, start fresh with /clear for the next unrelated task.
Exit and resume: your work persists
When you're done, exit with /exit (or just close the terminal). Your session isn't lost. Claude Code stores every session as a JSONL transcript under ~/.claude/projects/, one directory per project. Nothing is uploaded to be 'saved' — it's a local file you own.
To pick up where you left off, cd back into the same project and run:
# Resume the most recent conversation in this directory
claude -c # or: claude --continueThat reloads your last conversation with full history — Claude remembers what you were doing. If you have several past sessions and want to choose, use claude -r (--resume) to get a picker, or pass an ID or name.
Note a subtlety: each resumed session continues your conversation, but checkpoints persist across sessions too, so you can still rewind to states from a previous run. Your context, your history, and your undo stack all survive a quit.
Tip
One task per session
Resuming is great for continuing the same task. For a new, unrelated task, prefer a fresh session (or /clear) rather than piling it onto an old conversation — a clean context keeps Claude sharp and avoids dragging in irrelevant history.
Try it: Run, steer, and rewind your first session
Pick a small project of your own (or clone a tiny repo) and run all six first-session moves end to end.
1) Start. In the project directory, run claude "add a comment block at the top of the main file explaining what it does". Complete the browser login if prompted.
2) Watch and steer. As Claude works, press Esc and type a correction — e.g. 'actually, also list the key functions in the comment.' Confirm it folds in your change without restarting.
3) Handle a permission prompt. When Claude proposes the edit, read the diff in the prompt before approving. Then reject one action on purpose and tell Claude to do it differently — watch it adapt.
4) Rewind. After an edit lands, press Esc Esc (empty input), pick the prompt before that edit, and choose Restore code. Verify the file snapped back while the conversation stayed.
5) Paste an image. Take a screenshot of anything (a webpage, an error), paste it with your platform's shortcut (Cmd+V / Ctrl+V / Alt+V), and ask Claude to describe what it sees — proving it can read images.
6) Exit and resume. Run /exit, then claude -c to continue. Confirm Claude remembers the conversation. Finally, peek at ~/.claude/projects/ to see your session stored as JSONL.
Write three sentences: which move felt most empowering, where a permission prompt or rewind saved you, and one thing you'd do differently next session. This builds the core instinct — you're always in control.
Key takeaways
- 1Claude Code runs an adaptive agentic loop (gather context, act, verify) — you supervise it live, you don't fire a one-shot prompt.
- 2Start with `claude` or `claude "task"`; the first run logs you in via browser, and Claude Code requires a paid plan (no free tier).
- 3Press `Esc` to interrupt and preserve work, then type a correction — Claude reads it after the current action and continues without restarting.
- 4Checkpoints snapshot every edit; `Esc Esc` or `/rewind` restores code and/or conversation. Restore reverts state; summarize only compresses context.
- 5Checkpoints are session-local, separate from git, and track file edits only — not bash commands like `rm`/`mv` — so keep using git.
- 6Exit anytime; sessions are stored as JSONL under `~/.claude/projects/` and `claude -c` resumes the most recent one with full history.
Quiz
Lock in what you learned
Check your understanding
0 / 4 answered
1.Claude is editing the wrong file mid-task. What's the right way to redirect it?
2.You want to undo a set of bad edits Claude made, but keep the conversation so you can ask it to try again differently. In the rewind menu, which action fits?
3.Claude ran `rm config.old` via a bash command, and now you want to bring that file back with a checkpoint. What happens?
4.You quit Claude Code after working on a feature. The next day you want to continue that same conversation. What's the right command, and where was your session stored?
Go deeper
Hand-picked sources to keep learning
The fastest path from install to your first working session — start commands and the first-run flow.
The agentic loop, sessions, and the tools Claude uses — the mental model behind this lesson.
Authoritative reference for /rewind, Esc Esc, the restore vs. summarize options, and the limitations.
Full keyboard-shortcut table — Esc, Esc Esc, image-paste keys per platform, and more.
Every command and flag, including claude -c / --continue and claude -r / --resume.
Official repository — release notes, issues, and the place to report bugs from your first sessions.