Published
-
Claude Code commands
Notes I kept while working in Claude Code daily. Reference first — the commands I reach for, and
the handful of behaviours that are easy to get wrong. Availability varies by plan and version, so
/help is always the authority over this page.
Sessions
The distinction worth learning first is continue versus resume.
claude -c/claude --continue— pick the most recent conversation in this directory back up. No prompts, no picker.claude -r/claude --resume— open a picker and choose. Use it when several sessions are in flight.claude -r <name-or-id>— skip the picker and go straight to one.
Both describe the same operation; --continue is the convenience, --resume is the choice.
Inside a session:
/resume [name]— switch to another conversation./branch [name]— copy the conversation to this point and continue in the copy. The original is left intact, and anything after the branch belongs only to the branch./clear [name]— start empty, saving what you were in./cd <path>— move the session to another working directory. Note this relocates the transcript too, so--continuein the old directory will no longer find it.
Model, context and cost
/model [name]— switch model. It applies to future turns only; earlier turns stay as they were, which is what keeps a transcript honest./context— show what is currently in the context window. It is a picture of now, not a forecast of your next message./compact [instructions]— replace history with a summary, optionally steered (“keep the debugging detail, drop the file listings”)./usage,/cost— tokens and spend for the session.
Permissions
Five modes, cycled with Shift+Tab in a fixed order: default → acceptEdits → plan →
bypassPermissions → auto → default.
- default — asks as it goes.
- acceptEdits — writes files without asking; still prompts for the riskier things.
- plan — proposes first, executes nothing until you approve.
- auto — a classifier approves silently.
- bypassPermissions — asks for nothing. Worth knowing it exists; worth almost never using.
/permissions manages the allow, ask and deny rules.
The wildcard rule that catches people: in a Bash permission rule the trailing * is what
enables prefix matching, and the space before it matters. Bash(git diff *) allows anything
starting with git diff. Written Bash(git diff*), without the space, it would also match
git diff-index — a different command than the one you thought you were allowing.
Everyday CLI
| Command | What it does |
|---|---|
claude | Interactive session here |
claude "prompt" | Start with an opening instruction |
claude -p "query" | Run once, print, exit — the scripting mode |
claude -p "…" --output-format json | Structured result: text, session id, usage, cost |
claude --model opus | Pick the model up front |
claude --add-dir ~/other | Let the session read another directory |
claude --max-budget-usd 5 | Cap spend for the run |
claude doctor | Diagnose the install without starting a session |
Two -p details worth knowing. Plain claude --continue leaves scripted sessions out;
claude -p --continue includes -p, SDK and /loop sessions when it looks for the most recent
conversation. And --output-format json returns far more than the text — pipe it through
jq -r '.result' when the answer is all you want.
Keyboard
Esc— interrupt mid-response, keeping the work already done.EscEsc— with text in the box, clear it; on an empty box, open the rewind menu.Ctrl+C— clear the input; again on an empty box to exit.Ctrl+R— reverse-search your prompt history.Ctrl+O— the transcript viewer: tool calls, timestamps, the model behind each message.Ctrl+L— redraw a garbled screen without losing anything.Ctrl+G— open the prompt in$EDITORfor anything long.
Newlines are the thing everyone hunts for. \ then Enter works in every terminal, Ctrl+J
works without configuration, and Shift+Enter works natively in iTerm2, WezTerm, Ghostty, Kitty,
Warp, Windows Terminal and Apple Terminal.
Three prefixes are worth muscle memory: / opens commands, ! runs a shell command and hands the
output to Claude, and @ autocompletes file paths.
The files that change behaviour
Two things live in .claude/ and they are not the same kind of thing.
CLAUDE.mdis context. It is loaded into the conversation and read as instructions. Coding standards, the build command, project layout, the rules you would tell a new colleague. Keep it short — long files cost tokens and get followed less well..claude/settings.jsonis configuration. It changes what the harness does: permission rules, hooks, MCP servers, environment. Claude does not read it as advice.
One is a memo; the other is wiring. Most confusion about “why didn’t it listen” comes from putting a wiring problem in the memo.
Also useful:
.claude/rules/*.md— topic rules, optionally path-scoped with frontmatter, so they load only when you touch matching files. This is the cure for a CLAUDE.md that has grown too long..claude/settings.local.json— your overrides, gitignored.~/.claude/settings.json— your settings everywhere..mcp.json— MCP servers.@path/to/fileinside CLAUDE.md imports that file. Inside backticks it does not — which is how you mention a path without pulling it in.
Things that are not what they sound like
/memorymanages, it does not report. It is where you work onCLAUDE.mdand auto memory — turning auto memory on or off, viewing its entries. To see what is actually consuming the context window, use/context.--bareis not “load nothing.” It skips auto-discovery — hooks, skills, CLAUDE.md, MCP, plugins — but still honours what you pass explicitly with--settingsor--mcp-config. For a genuinely locked-down CI run, combine them.--max-turnscounts agentic turns, not messages. A turn is one complete cycle of the agent processing input, taking actions and producing output. It is a runaway-loop guard, not a conversation limit.- The session picker takes a PR URL. Paste one and it finds the session that opened it.
Verified against the official Claude Code documentation in September 2026. Commands and flags move
quickly — when this page and /help disagree, believe /help.