Every time you talk to Claude Code, the full conversation is saved to a file on your machine. The location is ~/.claude/projects/ (the ~ is shorthand for your home folder), one folder per project. Each session lives in a JSONL file (plain text, one line per message) you could open with any editor if you wanted to.
This is not a cloud feature. It is local. Close the terminal, shut your laptop, come back tomorrow. The conversation is still there, ready to pick up where you left off.
Think of a session like a notebook on your desk. Close the cover, walk away, come back next week, open it again. The notes are still there in the order you wrote them.
You just need to know the right commands.
When you want to keep working on what you were doing five minutes ago, this is the command:
claude --continueIt opens the most recent session for the current working directory. No menu, no prompt, no session ID to remember. The conversation reopens with all its history, and the next message you type appends to it.
Use --continue when:
Info
Tip: --continue is per-directory. If you cd into a different project and run --continue, you get that project's most recent session, not the one you were in last.
--continue is fine for "the last thing I did." For "the thing I was working on yesterday before I got distracted by the other thing," you want --resume.
claude --resumeThis opens an interactive picker. Each session shows the first message (or a name you gave it), how long ago you last used it, and its message count. Arrow keys to pick, enter to open.
claude --resume <session-id>If you already know the ID, pass it directly. The session ID is the filename inside ~/.claude/projects/<your-project>/ (minus the .jsonl extension). You can look it up there if you need to script it.
Info
Heads up: --resume is also directory-scoped. It shows sessions for the project in your current working directory. To resume a session from a different project, cd into that project's folder first.
Resume is how you keep multiple threads alive at once. One session for the cleanup work you are doing in the morning, another for the new feature in the afternoon, a third for your side project in the evening. Each one is its own session. You hop between them as needed.
A practical note on session names. The picker identifies sessions by date and first message. If you always open with something vague like "help me with this," sessions start to look identical. A habit worth building: open each new session with a short task description like "refactor auth module" or "write tests for payment flow." That first message becomes your label in the picker.
Sometimes you want to keep the same terminal open but start a brand new conversation. That is what /clear is for.
/clear/clear resets the active conversation in memory. The session ends and a new empty one begins. The previous conversation is still saved to disk, so you can bring it back later with --resume or --continue. /clear only clears what Claude is holding in context right now. It does not delete anything.
Info
Heads up: /clear is not destructive. The previous conversation is saved to disk automatically and stays resumable with --resume or --continue. What /clear changes is the active context: Claude starts fresh and no longer sees the earlier messages in this session.
Use /clear when:
Long sessions eventually hit the context window limit. The context window is the amount of text Claude can hold in mind at one time. Think of it like a desk with a fixed surface area: at some point you cannot fit any more papers on it without pushing older ones off the edge. Once the conversation grows past that limit, Claude starts forgetting things from earlier. Every new reply also gets slower and more expensive because there is more text to re-read each turn.
/compact is the middle option between "keep everything" and "throw it all away."
/compact
/compact focus on the database migration we just designedClaude reads the entire conversation, writes a dense summary, and replaces the history with that summary. The session continues, but with a smaller, smarter memory. You can pass instructions to steer what the summary keeps. This is useful when only part of the conversation still matters.
Claude Code also runs /compact automatically when the context window gets close to full. You will see a notice when this happens. The auto-compact is good but not perfect. Manual /compact with focused instructions usually preserves what you care about more reliably.
Sessions are plain text files. They are small. Even a long session is usually well under a megabyte. Hundreds of sessions cost you almost nothing in storage. By default, Claude Code deletes session files automatically after 30 days. You can change that window with the cleanupPeriodDays setting, or raise it to keep sessions longer. You can also delete files directly from ~/.claude/projects/ whenever you want.
When in doubt, ask yourself two questions:
Yes / Yes → keep the same window open, just continue
Yes / No → /compact with focus instructions, then continue
No / No → /clear and start a new task in the same window
Yes / lost → claude --continue (you closed the terminal)
Yesterday → claude --resume (pick from the list)Two patterns to avoid. They both come from not knowing that sessions persist.
Closing the terminal as a reset. People close the terminal because they think it ends the conversation. It does not. It just hides the conversation. claude --continue brings the whole thing back. If you actually wanted a fresh start, you wanted /clear.
Keeping one long session forever. Sessions are cheap. Starting a new one for each task keeps each conversation focused and short, which keeps Claude sharp. The token cost of a fresh session beats the token cost of dragging fifty unrelated turns into every new prompt.
Info
Tip: Use one session per task. When the task is done, end the session and start the next one fresh. Many small focused sessions beat one giant one.
Claude Code keeps every conversation on disk, one folder per project, for 30 days by default (longer if you raise cleanupPeriodDays). --continue reopens the most recent. --resume picks any of them. The session ID is the filename at ~/.claude/projects/. /clear resets the active context, and the conversation stays saved on disk and resumable. /compact compresses it without losing the plot. Most users only ever learn /clear. Knowing the other three is the difference between scrambling for context and picking up right where you left off.
Next up: 06. Show, Don't Tell: Screenshots and Image Input.
Discussion
0 comments· Help other readers by sharing what worked (or didn't) for you.
Sign in to join the discussion.
No comments yet. Be the first to share your thoughts!