MODULE 1 · GETTING STARTED / 25 MIN Free NOVEMBER 2026 EDITION · CLAUDE CODE 2.1.318
Sessions, slash commands and context
Use slash commands, resume earlier work, and manage the context window so long sessions stay sharp.
Updated 5 November 2026 · Reviewed 5 November 2026
What you’ll be able to do
Keep long working sessions focused, pick up where you left off yesterday, and know which built-in command to reach for, so you spend your time on the task rather than on fighting the tool.
Why this matters
After a few days with Claude Code, most people hit the same problem: a session that started sharp gets slower, vaguer and starts mixing up details from earlier tasks. That’s not the model getting tired. It’s the context window filling up with old, irrelevant material. Learning to manage context is the single biggest step from beginner to confident user, and it costs you nothing but a few commands.
What “context” is
Everything in the current conversation is held in the model’s context window: your messages, every file Claude read, every command’s output, and Claude’s own replies. On each turn, the model works from all of it.
The window is large, but it fills faster than you’d expect. A few big files, a long test log and an hour of back-and-forth add up. As it fills:
- cost and speed get worse, because more text is processed on every turn, and
- focus can suffer, because instructions and facts from an earlier, unrelated task are still sitting there competing for attention.
When the window is nearly full, Claude Code compacts automatically: it replaces older parts of the conversation with a summary. That keeps you going, but you don’t choose what’s kept. Managing context yourself means doing this deliberately, at good moments.
The four ways to manage context
| Situation | Do this | What happens |
|---|---|---|
| Finished a task, starting an unrelated one | /clear | Starts a fresh conversation. The old one is kept and can be resumed |
| Long task still in progress, window getting full | /compact keep <what matters> | Replaces the history with a summary. Your instructions steer what’s kept |
| One noisy stretch, such as a long debugging detour | Esc Esc → pick a prompt → Summarize from here | Compresses just that part, keeping the rest intact |
| A quick question that shouldn’t clutter the task | /btw <question> | Answers on the side, without adding it to the conversation |
Use /context at any time to see a grid of what’s using the window, with suggestions when something is taking up a lot of space.
Slash commands you’ll use constantly
Type / in a session to see every command; keep typing to filter. These are the ones worth knowing from day one:
| Command | What it does | Typical moment |
|---|---|---|
/help | Lists commands and keyboard shortcuts | When you forget a shortcut |
/clear | Starts a fresh conversation (project memory still loads) | Between unrelated tasks |
/compact [instructions] | Summarises the conversation to free up context | Midway through a long task |
/context | Shows what’s filling the context window | When a session feels slow or unfocused |
/rewind | Restores code and/or conversation from a checkpoint, or summarises part of the history | After a wrong turn (lesson 1.2) |
/btw <question> | Asks a side question without adding it to the conversation | Quick lookups during a task |
/resume | Opens an earlier session from a list | Picking up yesterday’s work |
/usage | Session cost, plan limits and what’s using them (/cost is an alias) | Keeping an eye on spending |
/model, /effort | Switch model, or how hard it thinks (Module 4) | Harder or simpler tasks |
/init | Generates a CLAUDE.md for the project (Module 2) | First session in a project |
/permissions | Shows and edits allow, ask and deny rules (Module 4) | Reducing repetitive prompts |
/doctor | Checks your setup and offers fixes | When something seems broken |
/powerup | Short interactive lessons on Claude Code features | Exploring what’s possible |
Picking up where you left off
Every conversation is saved on your machine, per project folder. To return to one:
claude --continue(orclaude -c) reopens the most recent conversation in the current folder.claude --resume(orclaude -r) shows a list to choose from. Inside a session,/resumedoes the same.
Exercise: one session, four moves
In your loop-practice project from lesson 1.2:
- Start
claudeand ask: “Add atruncate(text, max)helper with tests.” Let it finish. What you’ll see: the loop from lesson 1.2: reading, writing, running tests. - Run
/context. What you’ll see: a coloured grid of the window, split into categories such as system instructions, tools, files read and messages. Note roughly how full it is. - Run
/compact keep a note of the helpers that exist and their tests. What you’ll see: a short pause, then a summary replaces the history./contextnow shows much less used. - Ask: “What helpers exist in this repo and how are they tested?” What you’ll see: an answer drawn from the summary, often without re-reading files. Check it kept what you asked for.
- Run
/clear auth-free-helpers, then ask the same question. What you’ll see: Claude now re-reads the files to answer, because the conversation memory is gone. This is normal, and it’s why clearing is safe. - Ask a side question:
/btw what does node:test's describe() do?What you’ll see: an answer that doesn’t become part of the conversation history. - Type
/exit, then runclaude --continue. What you’ll see: you’re back in the most recent conversation, with its history intact.
Running a one-off from your shell
You don’t always need an interactive session. Print mode (-p) runs one request, prints the answer and exits:
claude -p "List the exported functions in this repo, one per line"
You can pipe text into it, too:
git diff | claude -p "Write a one-line commit message for this diff"
Common mistakes
- One endless session for everything. Clear between unrelated tasks; your files and project instructions are never lost.
- Waiting for auto-compaction. It works, but you don’t choose what’s kept. Compact yourself at natural break points, with a hint.
- Pasting huge logs into the chat. Point Claude at the file instead, or ask it to show only the failing part.
- Starting fresh when you meant to continue. Use
claude --continueor/resumeto get back to yesterday’s work.
Verify it worked
- You used
/context,/compactand/clear, and can explain when to use each - You asked a
/btwside question - You resumed a session with
claude --continue - You got an answer from
claude -pwithout entering a session
Next: using Claude Code from inside your editor.
Knowledge check
3 QUESTIONS · PASS MARK 80%Tip: select the text that's wrong before clicking, and it's quoted in your report.