Everything the terminal agent, the model family, and the API expose — commands, flags, keys, settings, hook events, frontmatter, model IDs and prices — on one page. Guide cards explain the mechanisms; the index below is a searchable dictionary of every command, flag, tool, setting, variable, and event. Three terms recur: a token is the unit models read and bill by (about ¾ of an English word); the context window is the token budget one conversation can hold; MCP (Model Context Protocol) is the open standard for plugging outside tools and data sources into an agent.
-r opens a picker
claude --model opus --effort xhighpick model + reasoning depth for this session only
claude -w feature-auth --tmuxrun in a fresh git worktree (a second checkout of the repo in its own folder), inside its own tmux terminal pane
claude --bg "investigate flaky test"detach as a background agent; manage with claude agents
claude --safe-modedisable every customization — the first move when config breaks
-c takes the newest; -r picks any; --fork-session resumes into a new ID so the original stays intact./clear starts a fresh conversation (the old one is kept and resumable). /compact keeps working but summarizes. /rewind steps the conversation and/or the code back to a checkpoint.--session-id <uuid> pins a known ID for scripting; -n/--name labels the session in the prompt bar, picker, and terminal title.claude project purge [path] deletes all local state (transcripts, tasks, file history) for a project.--cloud starts a session on claude.ai infrastructure; /teleport pulls a web session down into this terminal; --remote-control lets claude.ai drive this local session.--ide auto-attaches to a running IDE; /ide manages the connection.--bare — skips hooks, LSP (language-server) integration, plugin sync, auto-memory, CLAUDE.md discovery and keychain reads. Fastest cold start for scripts; auth is strictly ANTHROPIC_API_KEY/apiKeyHelper.--add-dir ../lib ../apps — grant file access outside the cwd without moving./cd <path> — move the session to another directory keeping the conversation and its prompt cache.--tools "Bash,Edit,Read" — restrict the built-in tool set; --tools "" disables all tools.--restricted — for evaluation harnesses on shared machines: removes the command-running tools and WebFetch, ignores user/project settings, confines file tools to the working directories.| Key | Action | Notes |
|---|---|---|
Esc | Interrupt Claude / close a dialog | Stops the current response or tool call without exiting |
Esc Esc | Clear input draft, or rewind | With text: clears it. Empty: opens the rewind / checkpoint picker |
Shift+Tab | Cycle permission modes | Manual → acceptEdits → plan → auto…; Alt+M on Windows without VT input |
Ctrl+C | Interrupt, or clear the input | Twice in a row exits |
Ctrl+D | Exit session | First press asks for confirmation |
Ctrl+O | Toggle transcript viewer | Full tool calls and execution detail |
Ctrl+R | Reverse-search prompt history | History is stored per working directory, across sessions |
Ctrl+B | Background the running task | Backgrounds Bash commands and agents |
Ctrl+T | Toggle the task checklist | Inside /theme: toggles code syntax highlighting instead |
Ctrl+S | Stash / restore the prompt | Park a half-written prompt, do something else, bring it back |
Ctrl+X Enter | Queue the message | Submits without interrupting a running turn; it waits its turn (v2.1.247+) |
Ctrl+] | Reopen the latest artifact | Opens the most recently published artifact page in the browser |
Ctrl+G / Ctrl+X Ctrl+E | Open prompt in $EDITOR | For long or structured prompts |
Ctrl+L | Redraw the screen | Keeps input and conversation |
Ctrl+V | Paste image from clipboard | Cmd+V in iTerm2, Alt+V on Windows/WSL; inserts an [Image #N] chip |
Ctrl+X Ctrl+K | Stop all background subagents | Twice within 3 s to confirm; also disarms artifact auto-replies |
Ctrl+Z | Suspend the process | Unix only; fg to resume |
Option+P / Alt+P | Switch model | Without clearing the prompt |
Option+T / Option+O | Toggle extended thinking / fast mode | macOS needs Option-as-Meta configured |
Tab | Accept autocomplete; or annotate a permission answer | Add a comment to a yes/no permission decision |
Ctrl+A/Ctrl+E line start/end · Ctrl+K kill to end · Ctrl+U kill to start · Ctrl+W delete word · Ctrl+Y yank it back · Alt+Y cycles the kill ring.Alt+B/Alt+F move by word · Alt+D delete next word · Ctrl+_ undo the last input edit."keybindingFlavor": "readline" to make Ctrl+W delete back to whitespace (GNU/bash behavior) instead of only the last path segment. Default is "classic".\+Enter anywhere · Ctrl+J anywhere · Shift+Enter natively in iTerm2, WezTerm, Ghostty, Kitty, Warp, Apple Terminal, Windows Terminal · Option+Enter with Option-as-Meta. /terminal-setup configures the rest./ at start → command or skill · ! at start → shell mode: run it, add the output to context, and let Claude react · @ → file-path autocomplete (and other live sessions to message) · : → emoji shortcode.Ctrl+O){ / } jump to the previous/next user prompt · [ dumps the whole conversation into native terminal scrollback so Cmd+F and tmux copy-mode can search it · v opens it in $EDITOR · ? shows the shortcut panel · q/Esc exits./tui fullscreen) is flicker-free and mouse-aware; /tui alone reports which renderer is active.Enable with /config → Editor mode, or "editorMode": "vim". Mode and cursor position survive toggling the transcript or opening a panel.
| Mode | Keys |
|---|---|
| Enter NORMAL | Esc from INSERT or VISUAL |
| Enter INSERT | i I a A o O |
| Enter VISUAL | v char-wise · V line-wise (no Ctrl+V block mode) |
h j k l · w e b · 0 ^ $ · gg G · f F t T then ; / , to repeat · / opens reverse history search (same as Ctrl+R).
x dd D dw de db · cc C cw ce cb · s S substitute · yy/Y yw ye yb · p P · >> << · J join · u undo · . repeat.
iw aw iW aW i" a" i' a' i( a( i[ a[ i{ a{ — combine with d, c, y.
At the top or bottom of the input, j/k fall through to command history. Map an escape sequence with "vimInsertModeRemaps": {"jj": "<Esc>"} — user settings only, so a checked-out repo can never remap your keys.
| Mode | Runs without asking | Best for |
|---|---|---|
default (shown as Manual) | Reads only | Reviewing every action; sensitive work |
acceptEdits | Reads, file edits, common filesystem commands (mkdir, touch, mv, cp) | Iterating on code you're watching |
plan | Reads, plus classifier-approved commands where auto mode is available — never edits your source | Exploring before changing anything |
auto | Everything, with a background classifier — a separate model call that judges each action against your request — checking every call | Long tasks; killing prompt fatigue |
dontAsk | Only pre-approved tools; everything else is auto-denied | Locked-down CI and scripts |
bypassPermissions | Everything, no checks | Isolated containers and VMs only |
permissions.allow (never prompts), permissions.ask (always prompts), permissions.deny (always blocks). Deny wins in every mode, bypassPermissions included.//abs from filesystem root · ~/… from home · /rel relative to the settings file that declares it · bare or ./ relative to the cwd.Edit(src/**) matches only this project's src; write Edit(**/src/**) to match at any depth.ask rule, AskUserQuestion, or MCP tools marked requiresUserInteraction — not even bypass mode./fewer-permission-prompts mines your own transcripts for repeated read-only Bash/MCP calls and writes a prioritized allowlist into project settings.--allowedTools "Bash(git log *)" "Read" and --disallowedTools set rules for one run — the usual pair for CI.auto mode is the middle ground: it classifies each call rather than blanket-approving. claude auto-mode defaults prints the built-in classifier rules as JSON.--permission-prompt-tool mcp_auth_tool routes prompts to an MCP tool in non-interactive runs; --permission-prompts none denies anything that would have prompted.auto; API-key, Console and cloud-provider logins start in Manual. permissions.defaultMode or --permission-mode overrides either.deny rule blocks in every mode; an allow rule skips the prompt in every mode; only what is left over is decided by the mode (ask you, ask the classifier, or refuse).sandbox.enabled, Bash runs inside an OS-enforced boundary and autoAllowBashIfSandboxed (default true) stops prompting for it — the kernel, not the classifier, is what keeps it inside the allowed paths and domains..claude/, .git/, .mcp.json, settings files) are never auto-approved by the classifier; a person answers, or a rule.permissions.blockReadsOutsideWorkingDirectories stops Read/Grep/Glob leaving the working directories in every mode, bypass included.| Model | API model ID | Ctx / max out | $ per million tokens (MTok), in / out | Reach for it when… |
|---|---|---|---|---|
| Claude Fable 5.1 most capable released | claude-fable-5-1 | 1M / 128k | $10 / $50 cache hit $0.25 | Work bigger than one sitting: multi-hour autonomous runs, root-cause hunts through an unfamiliar system, outage forensics, architecture decisions. Describe the outcome, not the steps — it plans the path and verifies itself without nagging. Slower per turn; not the default on any plan. Alias fable, or best. Successor to Fable 5 (claude-fable-5, still served, same price but cache hits at $1) — the one API difference: forced tool choice (tool_choice any/tool) is rejected. |
| Claude Opus 5 the default workhorse | claude-opus-5 | 1M / 128k | $5 / $25 | Complex agentic coding and enterprise work — large refactors, multi-file features, debugging with real reasoning, anything where being wrong is expensive. Thinking is on by default. This is the right starting point for almost everything. Alias opus. |
| Claude Sonnet 5 speed × intelligence | claude-sonnet-5 | 1M / 128k | $2 / $10 | Daily coding at volume: code generation, data analysis, content, visual understanding. Frontier-class at a third of Opus's price — the sensible default for high-throughput pipelines and for subagents doing well-specified work. Alias sonnet. |
| Claude Haiku 4.5 fastest | claude-haiku-4-5 | 200k / 64k | $1 / $5 | Real-time and high-volume: classification, extraction, routing, log triage, cheap fan-out workers. Near-frontier quality at the lowest latency. The one model here that still uses the old fixed budget_tokens thinking. Alias haiku. |
| Claude Mythos 5.1 (invite-only) | claude-mythos-5-1 | 1M / 128k | $10 / $50 | Fable 5.1's specs and pricing, offered through Project Glasswing for defensive cybersecurity work. No self-serve access. (claude-mythos-5 remains.) |
Still available, previous generation: claude-opus-4-8 · claude-opus-4-7 · claude-opus-4-6 · claude-opus-4-5 (all 1M ctx, $5/$25) · claude-sonnet-4-6 · claude-sonnet-4-5 ($3/$15). Every ID is a pinned snapshot, never an evergreen pointer — from the 4.6 generation on, IDs are dateless but still pinned. | ||||
| Alias | Resolves to |
|---|---|
default | Clears any override, back to your account's runtime default |
best | Fable 5.1 where your org has it, else the latest Opus |
fable / opus / sonnet / haiku | Latest of that tier for your provider — today Fable 5.1, Opus 5, Sonnet 5, Haiku 4.5 on the Anthropic API |
opus[1m] / sonnet[1m] | Force the 1M-token context window |
opusplan | Opus while planning, Sonnet to execute — cheap way to buy good plans |
On Bedrock and Google Cloud, sonnet still resolves to Sonnet 4.5, and on Foundry opus is 4.6 — pin the full ID or set ANTHROPIC_DEFAULT_SONNET_MODEL to get newer.
| Level | Use for |
|---|---|
low | Short, scoped, latency-sensitive work that isn't intelligence-sensitive |
medium | Cost-sensitive work that can trade a little quality |
high | Balanced — the default on the API and in Claude Code for every model except Opus 4.7, which defaults to xhigh |
xhigh | Deeper reasoning, more tokens. Best setting for most coding and agentic work on Fable 5 / Opus 5 / Sonnet 5 |
max | Correctness over cost. Diminishing returns; can overthink — test before adopting |
ultracode | Claude Code only: plans a dynamic multi-agent workflow per task at xhigh reasoning |
Effort often matters more than the model choice. Opus 5 at low can beat Sonnet at high for reasoning, and cost less than Opus at max. Set it with /effort, --effort, effortLevel, or per-skill / per-subagent frontmatter.
opusplan, or Opus in the main loop with CLAUDE_CODE_SUBAGENT_MODEL=sonnet for the fan-out. Subagents doing well-specified searching rarely need frontier reasoning./fast, Option+O) runs Opus 5 / 4.8 at up to 2.5× output speed for $10/$50 — the same model, priced up, not a smaller one.--fallback-model sonnet,haiku tries each in order when the primary is overloaded, retrying the primary each turn. Fable requests flagged by the safety classifiers fall back on their own: biology to Opus 5, cybersecurity to Opus 4.8.-p mode never does.Prompt caching is the real cost lever, not the model. A cache hit costs 10% of base input — $0.50/MTok on Opus 5 versus $5 — and only 2.5% ($0.25) on Fable 5.1. Batch API halves both directions and stacks with caching. Switching models mid-session invalidates the cache and buys you one slow, expensive uncached turn, so switch at a natural boundary.
ENABLE_TOOL_SEARCH=auto loads them upfront while they fit in 10% of the window (auto:5 for 5%); false loads everything. Often the single biggest context win./context all when the conversation has been compacted, to see the whole picture./compact.Auto-compaction defaults scale with the window; --autocompact auto|<tokens> or autoCompactWindow override it. DISABLE_AUTO_COMPACT=1 turns it off entirely — useful when you'd rather hit the wall than lose fidelity.
| Scope | Location |
|---|---|
| Managed policy | /Library/Application Support/ClaudeCode/CLAUDE.md · /etc/claude-code/CLAUDE.md · C:\Program Files\ClaudeCode\CLAUDE.md |
| User | ~/.claude/CLAUDE.md |
| Project | ./CLAUDE.md or ./.claude/CLAUDE.md |
| Local (gitignored) | ./CLAUDE.local.md |
All discovered files are concatenated, root-down — they don't override each other. Files above the cwd load at launch; files in subdirectories load lazily when Claude reads there.
paths: frontmatter scopes them by glob
Claude Code reads CLAUDE.md, not AGENTS.md — if your repo has the latter, make a CLAUDE.md that imports it. Block-level HTML comments are stripped before injection, so <!-- notes --> costs no tokens.
user (who you are), feedback (corrections it should keep), project (goals and constraints the code doesn't show), reference (where things live).~/.claude/projects/<project>/memory/, one fact per file plus a MEMORY.md index. The first 200 lines / 25 KB of the index load every session./memory to view, edit, or toggle; autoMemoryDirectory relocates it.Target under ~200 lines for CLAUDE.md. Longer files still load in full (up to 4 MiB; larger is skipped), but adherence drops — move procedures into skills, which cost nothing until invoked.
A skill is a folder with instructions Claude loads only when relevant — so long reference material costs nothing until used. Custom commands merged into skills: .claude/commands/deploy.md and .claude/skills/deploy/SKILL.md both create /deploy.
--- lines at the top of the file| Key | Effect |
|---|---|
name / description | Display name; what it does and when — this is what Claude matches on |
when_to_use | Extra trigger phrases, appended to the listing |
argument-hint / arguments | Autocomplete hint; named positional args for $name |
disable-model-invocation | true → only you can run it (/name); keeps its description out of context |
user-invocable: false | Only Claude runs it; hidden from the / menu |
allowed-tools / disallowed-tools | Grant without prompting for this turn / remove from the pool while active |
model / effort | Override for the rest of this turn only |
context: fork + agent + background | Run it in a forked subagent instead of the main context |
paths | Globs that gate when the skill is even considered |
hooks | Hooks registered on invoke, live for the rest of the session |
shell | bash (default) or powershell for inline execution |
$ARGUMENTS · $ARGUMENTS[N] / $N · $name · ${CLAUDE_SESSION_ID} · ${CLAUDE_EFFORT} · ${CLAUDE_SKILL_DIR} · ${CLAUDE_PROJECT_DIR} · ${CLAUDE_PLUGIN_ROOT} · ${CLAUDE_PLUGIN_DATA}. Backtick-bang !`cmd` injects live shell output; @file injects a file.
Write a skill the moment you notice you're pasting the same checklist twice, or a CLAUDE.md section has turned into a procedure. /reload-skills picks up changes without restarting.
A subagent gets its own context window. That's the point: it can read fifty files and hand you back one paragraph, leaving your main context clean. Use them for broad searches, independent parallel work, and reviews.
| Key | Effect |
|---|---|
name* / description* | Identifier (hooks see it as agent_type); when to delegate |
tools / disallowedTools | Allowed set (inherits all if omitted) / removals |
model | sonnet, opus, haiku, fable, a full ID, or inherit (default) |
effort / maxTurns | Reasoning depth; hard turn ceiling |
permissionMode | Any of the six modes, scoped to this agent |
skills | Skills preloaded in full at startup, not just their descriptions |
mcpServers | Named or inline MCP servers just for this agent |
isolation: worktree | Own git worktree — required if parallel agents write the same files |
memory | user / project / local → persistent learning across sessions |
background / color / hooks / initialPrompt | Keep detached · task-list color · scoped hooks · auto first turn when used as the session agent |
Scope order: --agents JSON → .claude/agents/ → ~/.claude/agents/. Built-ins include Explore (read-only fan-out search), Plan (architecture), and general-purpose. /subtask forks one that inherits the whole conversation; /list-agents shows who you can message.
Isolation costs ~200–500 ms and disk per agent — use worktree only when agents genuinely collide.
Hooks are the answer to "every time X happens, do Y." Claude can be asked to do something; a hook guarantees it. Three nesting levels: event → matcher group → one or more handlers.
command — shell command; event JSON on stdin. Set args for exec form (no shell parsing).http — POST the event JSON to a URL (gated by allowedHttpHookUrls).mcp_tool — call a tool on a connected MCP server.prompt — single-turn model evaluation against a response schema.agent — spawn a subagent that can Read/Grep/Glob before deciding.hookSpecificOutput.permissionDecision (allow/deny/ask) and updatedInput for PreToolUse, decision, additionalContext, retry: true, permission updates.async: true runs in background; asyncRewake: true also wakes Claude on exit 2.once: true (skill frontmatter) fires a single time per session.Session — SessionStart · SessionEnd · PreModelSwitch (can block a model change) · PostModelSwitch · Setup (with --init-only/--init/--maintenance) · InstructionsLoaded (CLAUDE.md or a rule loads) · ConfigChange · CwdChanged (great for direnv) · DirectoryAdded · FileChanged (watch by filename matcher).
Turn — UserPromptSubmit · UserPromptExpansion (a typed command expands; can block) · MessageDisplay · Notification · Stop (Claude finished — can force it to keep going) · StopFailure (turn died on an API error) · TeammateIdle · PreCompact · PostCompact.
Tool loop — PreToolUse (can block) · PermissionRequest · PermissionDenied · PostToolUse · PostToolUseFailure · PostToolBatch (after a whole parallel batch) · SubagentStart / SubagentStop · TaskCreated / TaskCompleted · WorktreeCreate / WorktreeRemove · Elicitation / ElicitationResult (MCP asks the user something).
The event JSON arrives on stdin; jq pulls the command out. Printing the deny object blocks the call and tells Claude why; exit 0 with nothing printed lets it through. The same shape with updatedInput rewrites a command instead of blocking it. chmod +x the script and check /hooks to confirm it registered.
"*", "", or omitted = match all. Letters, digits, _ - , | and spaces = exact string or a |/, separated list. Anything else = unanchored JavaScript regex. The separate if field takes exactly one permission rule ("Bash(git *)", "Edit(*.ts)") — no &&/||. For Bash, if checks each subcommand, strips leading assignments, and inspects $(…); it fails open when the command can't be parsed, so treat it as a filter, not a security boundary.
Hooks live in ~/.claude/settings.json, .claude/settings.json, .claude/settings.local.json, managed policy, plugin hooks/hooks.json, and skill or subagent frontmatter. They merge across levels rather than replacing, run in parallel, and also run inside subagents. Identical handlers defined twice run once.
An MCP server is a small program that exposes tools (and optionally prompts and resources) to any MCP client; Claude Code connects to it over HTTP or over stdin/stdout for a local process (stdio). Ready-made servers exist for GitHub, databases, Sentry, browsers and most SaaS APIs.
--no-browser for remote shells
claude mcp list / get <name>status; unapproved .mcp.json shows ⏸ Pending
claude mcp serveexpose Claude Code itself as an MCP server
| Scope | File | Shared? |
|---|---|---|
| local | project entry in ~/.claude.json | Just you, this project |
| project | .mcp.json at the repo root | Committed; each teammate approves once |
| user | ~/.claude.json | You, everywhere |
.mcp.json expands ${VAR} and ${VAR:-default} so secrets stay out of the repo; headersHelper names a script that returns auth headers. --strict-mcp-config ignores every other source.
ENABLE_TOOL_SEARCH=auto[:N] loads upfront while under N% of the window; false loads everything (and is forced on non-Anthropic gateways).WaitForMcpServers lets Claude wait for one still connecting instead of restarting.@server:uri.MAX_MCP_OUTPUT_TOKENS raises the output cap; per-tool overrides exist.A plugin is one distributable bundle of everything below. Install from a marketplace, a directory, or a .zip URL.
~/.claude/skills/, auto-loads next session
claude plugin install x@marketplaceinstall from a specific marketplace
claude plugin details <name>component inventory + projected token cost
claude plugin validate <path>lint the manifest, skills, agents, commands
claude plugin eval <target>run scored eval cases against a plugin
claude --plugin-dir ./pload for this session only, no install
A plugin's root CLAUDE.md is not loaded as project context — plugins contribute through skills, agents, and hooks. /reload-plugins applies changes in place.
| # | Level | File |
|---|---|---|
| 1 | Managed | managed-settings.json, MDM, or the console — your org, always wins |
| 2 | Command line | claude --settings … |
| 3 | Project local | .claude/settings.local.json — you, this project |
| 4 | Shared project | .claude/settings.json — committed, whole team |
| 5 | User | ~/.claude/settings.json — you, every project |
Scalar keys: highest level wins. Array keys like permissions.allow and hooks: combined across levels. --setting-sources user,project limits which load at all.
Settings vs. everything else: settings.json is what Claude Code enforces; CLAUDE.md is what Claude is told; hooks are what happens regardless of what Claude decides. A preference that must always hold is a hook or a setting, never a memory.
/config edits interactively (or /config key=value) · claude doctor / /doctor diagnoses and fixes · --safe-mode disables every customization for bisecting a broken config.
--include-partial-messages, --include-hook-events, --forward-subagent-text widen the stream for host UIs.--fallback-model only works with -p. So do --max-turns, --max-budget-usd, and --no-session-persistence.api_retry system events with attempt, max_retries, retry_delay_ms, and an error category — log these rather than guessing at flakiness.claude-agent-sdk for Python, @anthropic-ai/claude-agent-sdk for TypeScript) is this same harness as a library: query(prompt, options) with built-in tools, hooks, subagents, and permissions. Distinct from the API's Tool Runner.A workflow is a JavaScript script that orchestrates many subagents deterministically — loops, conditionals, fan-out — instead of leaving the structure to the model. Runs in the background; /workflows watches it.
pipeline() is the default — each item flows through all stages with no barrier, so item A can be verifying while B is still reviewing. parallel() is a barrier; use it only when a stage genuinely needs every prior result at once (dedup, early exit).agent(prompt, {schema, model, effort, label, phase, isolation}) · log() · phase() · budget.remaining() · workflow() to nest one level.min(16, cores−2) per workflow; 1000 agents lifetime; 4096 items per call.↑↓ select · Enter drill in · f filter · p pause · x stop · r restart an agent · s save the run as a reusable command./deep-research is the bundled one. ultracode effort makes Claude plan a workflow for every substantive task.Agent teams are the other axis: named teammates that message each other via SendMessage, each in its own session — in-process by default, or in tmux / iTerm2 panes with --teammate-mode. Experimental and off until CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1; roughly 7× the tokens of a single session. Workflows are for structure you can write down; teams are for work that needs conversation.
| Subagent | Workflow | Agent team | |
|---|---|---|---|
| Shape | One helper, one result back | Script you write: loops, fan-out, schemas | Peers that talk to each other |
| Who coordinates | The main session | The script, deterministically | The teammates, via a shared task list and mailbox |
| Best for | Broad reads, isolated checks, reviews | Repeatable batch work (review every file, verify every finding) | Competing hypotheses, cross-layer features, debate |
| Cost | Lowest — summary returns | Bounded by the script and budget | Highest — each teammate is a full session |
| Start with | Just ask, or Agent(…) | /workflow-authoring, /deep-research | "Spawn three teammates to…" |
cleanupPeriodDays). Esc Esc or /rewind restores the conversation, the code, or both, or summarizes from a point forward.fileCheckpointingEnabled: false or CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING=1 to turn off.claude -w <name> / EnterWorktree gives an isolated checkout so parallel sessions don't fight. --tmux puts it in its own pane (iTerm2 native panes when available).worktree.baseRef, symlinkDirectories (share node_modules), sparsePaths, bgIsolation tune the setup. WorktreeCreate/WorktreeRemove hooks replace the default git behavior.attribution.commit / .pr / .sessionUrl and includeCoAuthoredBy control the trailers Claude adds. prUrlTemplate for non-GitHub hosts./install-github-app wires up the GitHub App and Actions workflows so Claude can act on pull requests (PRs) from CI; GitLab CI and GitHub Enterprise Server are supported too.claude ultrareview [pr#|branch] runs a cloud multi-agent review non-interactively; --json for machine output./security-review audits the branch diff; /code-review [level] [--fix|--comment] reviews the local diff or a PR./sandbox runs Bash inside an OS sandbox (Seatbelt on macOS, bubblewrap on Linux) so filesystem and network access are enforced by the kernel, not by Claude's judgment. It composes with permissions rather than replacing them.
.claude/ before trusting it; allowManagedHooksOnly locks this down org-wide.Read(**/.env), Read(~/.ssh/**).--dangerously-skip-permissions is for disposable containers with no network. --allow-dangerously-skip-permissions merely makes it reachable in the mode cycle.Shift+Tab to plan mode or /plan <task>. Read the plan, correct the wrong assumption there — it is much cheaper than correcting fifteen files./run-able app. An agent that can verify converges; one that can't guesses confidently.@path autocompletion to name files, or !cmd to drop real output into context, beats describing them.Esc the moment it goes the wrong way. Letting a bad turn finish costs context and adds mistakes to imitate./clear between unrelated tasks; a stale conversation is a worse prior than an empty one./context when it feels sluggish — it names what's eating the window, usually MCP tool schemas./compact with focus instructions ("keep the API design decisions, drop the file listings") rather than bare.medium is often indistinguishable and several times cheaper./fewer-permission-prompts once a week; the allowlist it writes is derived from what you actually approve..claude/settings.json, .claude/rules/, and skills. Keep settings.local.json and CLAUDE.local.md out of git.claude --safe-mode is the bisect tool: if the problem vanishes, it's your config, not the model./insights and /team-onboarding mine your own history into a report or a guide for the team..claude directoryDon't delete ~/.claude.json, ~/.claude/settings.json, or ~/.claude/plugins/ — they hold your auth, your defaults, and your installs. CLAUDE_CONFIG_DIR relocates the whole tree.
winget install Anthropic.ClaudeCode also works)
brew install --cask claude-codeHomebrew; does not auto-update — brew upgrade claude-code
claude --versionprints 2.1.260 (Claude Code) when it worked
cd ~/projects/myapp && claudefirst run opens a browser login: Pro/Max/Team/Enterprise, or a Console (API) account
A subscription bills against plan limits; a Console account bills per token and gets a "Claude Code" workspace for cost tracking. /login switches accounts later; claude auth status shows which is active. The first session asks you to trust the folder — that gate is what lets a repo's hooks and settings run.
Trim what /init wrote to facts Claude can't infer: the test command, the deploy rule, the thing that bit you last week. Keep it under 200 lines.
attribution settings control the trailer it adds
/clearnext unrelated task starts clean; /resume finds the old one
On Pro, Max and Team the session starts in auto mode (a classifier approves most edits and commands); on API-key logins it starts in Manual and asks. Shift+Tab changes it any time. When something the classifier declines is fine, answer the prompt with "always" to write an allow rule.
Source: code.claude.com quickstart, setup and permission-modes pages; claude --help v2.1.260.
d/w for 24 h / 7 d
/cost /statsaliases for /usage
Prompt cache (main): 14 requests · 91% …the line to watch: share of input served from cache, misses, warm/cold (v2.1.251+)
claude -p … --max-budget-usd 5hard dollar ceiling for unattended runs
/usage-creditsturn on or request pay-as-you-go beyond plan limits
promptCacheTtl: "1h" forces it)./effort medium is the cheapest lever for routine work./compact is itself a large request (it reads everything it summarizes). /clear is free.modelPricing) — the Console usage page is authoritative.Order of operations when a bill surprises you: /context (what is in the window) → /usage attribution (who put it there) → /clear between tasks, model or effort down for mechanical work, subagents for verbose reads.
Source: code.claude.com costs and prompt-caching pages; platform pricing table Sep 2026.
claude won't start a session
/doctorfull checkup inside a session; proposes fixes and applies them after you confirm; trims a bloated CLAUDE.md
claude --debug=api,hooksdebug log for chosen categories (!file excludes one)
claude --debug-file ./debug.txtwrite it to a path of your choosing; /debug turns logging on mid-session
~/.claude/debug/<session-id>.txtwhere the log lands by default; CLAUDE_CODE_DEBUG_LOG_LEVEL sets verbosity
claude updatecheck for and install an update; claude install stable|latest|2.1.260 pins a version
claude --resumea hang or crash loses nothing: the transcript is on disk
/heapdumpmemory snapshot to ~/Desktop for a bug report — it contains your whole conversation, don't post it publicly
USE_BUILTIN_RIPGREP=0search or @-file completion finds nothing → install your OS's ripgrep and set this
| Symptom | Do |
|---|---|
| Settings or hooks silently ignored | claude doctor reports invalid JSON; -p mode never shows the error dialog |
| "Autocompact is thrashing" | A file or tool output refills the window each time: read it in ranges, or hand it to a subagent |
| Session started in auto mode unexpectedly | Plan default (Pro/Max/Team) — set permissions.defaultMode |
Unknown command: /schedule or /usage-credits | Needs a claude.ai login; an ANTHROPIC_API_KEY in the shell takes precedence over it |
| Garbled text in VS Code's terminal | /terminal-setup turns GPU acceleration off |
| High CPU / memory | /compact, restart between big tasks, then --safe-mode to blame a plugin or MCP server |
Source: code.claude.com troubleshooting, debug-your-config and .claude-directory pages; claude doctor --help.
The status line is a row above the footer that shows whatever a script of yours prints. Claude Code runs the script after each update and feeds it session JSON on stdin. /statusline writes one from a description (or copies your shell prompt); by hand:
model.display_name · cwd · session_id · version · cost.total_cost_usd / total_duration_ms / total_lines_added · context_window.used_percentage / remaining_percentage / context_window_size · exceeds_200k_tokens · rate_limits.five_hour.used_percentage / seven_day (subscribers, after the first response) · prompt_cache (hit ratio, misses, warm). Fields that don't apply yet are absent or null — use // 0 guards in jq.
/keybindings opens ~/.claude/keybindings.json; changes apply live. Keys are ctrl+k, shift+tab, meta+p (Option on macOS), chords as space-separated sequences (ctrl+k ctrl+s); null unbinds. Actions are context:action — the index lists them. Reserved and not rebindable: Ctrl+C, Ctrl+D, Ctrl+M, Ctrl+[, Ctrl+I. Vim motions are not in this file; use vimInsertModeRemaps for jj-style escapes.
Source: code.claude.com statusline and keybindings pages.
/loop | Desktop task | Routine (cloud) | |
|---|---|---|---|
| Runs where | This open session | Your machine, Desktop app | Anthropic cloud (or your self-hosted environment) |
| Needs | Session open and idle | Desktop app running | Laptop can be closed; claude.ai subscription |
| Minimum interval | 1 minute | 1 minute | 1 hour |
| Expiry | 7 days | — | Until paused; daily run cap |
| Triggers | Interval, or Claude-paced | Schedule | Cron, one-off time, HTTP POST, GitHub PR/release events |
s m h d units, cron granularity (1 min), rounded to a clean step
/loop check CI and address review commentsno interval → Claude picks a delay (1 min–1 h) after each pass; Esc stops it
/loop 20m /review-pr 1234re-run a skill each pass
/loopbare: the built-in maintenance prompt, or your .claude/loop.md
remind me in 30 minutes to …plain language → a one-shot task that deletes itself
/schedule daily PR review at 9amcreates a cloud routine conversationally; list · update · run manage it
/schedule in 2 weeks, remove the feature flagone-off cloud run at a time; doesn't count against the daily cap
/loop uses the CronCreate / CronList / CronDelete tools with 5-field cron expressions; ask Claude to "list my scheduled tasks" or "cancel the deploy check". CLAUDE_CODE_DISABLE_CRON=1 removes all of it./background) carries them along without a terminal./usage lists the heaviest ones.Source: code.claude.com scheduled-tasks and routines pages; /loop skill description.
| Mechanism | Where the work runs | Start it |
|---|---|---|
| Remote Control | Your machine — files, MCP servers, tools stay local; you drive it from claude.ai/code or the phone app | claude remote-control · claude --rc [name] · /rc mid-session |
| Cloud session | Anthropic's infrastructure, cloning your GitHub repo into a cloud environment | claude --cloud "fix the flaky test" · --environment ccpool_… for a self-hosted runner |
| Teleport | Pulls a cloud session's branch and conversation down into this terminal | claude --teleport [id] · /teleport picker |
| Background agent | Your machine, detached from the terminal | claude --bg "…" · claude agents · attach / logs / stop |
w toggles at runtime)
claude remote-control -creattach to the session last recorded for this directory (within ~4 h)
claude --rc "Billing refactor"ordinary interactive session, also visible in the claude.ai session list; footer shows /rc active
/remote-controltoggle on/off, or open the status panel with a QR code for your phone
claude --from-pr 142resume the session linked to a pull request
claude once first). It is off when ANTHROPIC_BASE_URL points anywhere but api.anthropic.com or on Bedrock / Google Cloud / Foundry. Team and Enterprise admins enable it per org; remoteControlAtStartup makes every session remote-controllable./remote-control in the second to move it./autofix-pr spawns one that watches a PR's CI and reviewers.Source: code.claude.com remote-control and claude-code-on-the-web pages; claude remote-control --help.
An artifact is a single self-contained web page Claude Code publishes from the session to a private URL on claude.ai, updated in place as work continues: an annotated diff, a dashboard, four layout options side by side, a checklist that ticks itself off during a migration.
o open, c copy link, Enter attach to this session
Ctrl+]reopen the latest one
update https://claude.ai/code/artifact/… with today's numbersa new session updates an existing page only if given its URL or attached via /artifacts
/design a settings screen for a banking appartboards on a canvas, opened in the Claude Design editor preview
/login), the Anthropic API (not Bedrock/Vertex/Foundry), v2.1.183+. Private until shared from the page header; public links are the only sharing on Pro/Max, and are off by default on Team/Enterprise until an Owner enables them.Ctrl+X Ctrl+K twice stops that for the rest of the session."enableArtifact": false, CLAUDE_CODE_DISABLE_ARTIFACT=1, or Artifact in permissions.deny. CLAUDE_CODE_ARTIFACT_AUTO_OPEN=0 keeps the browser closed.Source: code.claude.com artifacts page.
Every card above assumes a building full of accelerators somewhere, humming. That building is now the most contested piece of infrastructure in American local politics, and it is worth knowing both halves of the argument — you are, after all, on the demand side of it.
Where it actually gets settled: large-load tariffs that make the requesting party pay for its own interconnection, closed-loop cooling requirements, clawbacks tied to real job counts, and published water and power figures before the vote rather than after. The technical questions are mostly solved; the allocation questions are the fight. Anthropic, Google, Microsoft, Amazon, Meta and OpenAI are all building — so this argument is going to be running underneath the tooling on this page for the rest of the decade.
Figures: US Energy Information Administration (EIA) / IEA electricity projections, Gallup polling on local siting, and 2025–26 reporting on blocked and delayed projects. Treat all of them as directional — the forecasts have been revised upward repeatedly.
A large share of the public — in most 2025–26 polling, a plurality to a majority — says it is more worried than excited about AI. You use Anthropic's tools all day; it is worth being able to state the other side's case accurately, and then say why you are on this side of it anyway.
Anthropic specifically. The company's founding premise is that the technology is dangerous enough to need a safety-focused lab at the frontier — which critics read as either sincere or as the best marketing line in the industry. Its models are the ones most often cited for refusing things, which is the mirror image of the Grok complaint. And it is building data centers like everyone else: the card above is the local-politics half of this argument.
The short version for the dinner table: the concerns are mostly legitimate and mostly about who pays; the benefits are larger, broader and already measurable; and the one thing in your control is to be a user whose output earns the tool its trust.
Everything goes through one endpoint. Tools, structured output, thinking, caching, and server-side tools are all features of this call, not separate APIs.
max_tokens: ~16000 non-streaming (stays under SDK timeouts), ~64000 streaming. 128k output requires streaming.max_tokens; use .get_final_message() / .finalMessage() if you don't need per-event handling.stop_reason before reading content. A safety refusal returns HTTP 200 with stop_reason: "refusal" and a stop_details.category. On Fable 5 / Opus 5, pair it with server-side fallbacks.output_config.format or system instructions instead. Fable 5.1 also rejects forced tool choice (tool_choice: any / tool): use auto plus an instruction, or strict: true.output_config.format constrains the response shape; strict: true on a tool definition guarantees its input validates.count_tokens — never tiktoken), Models (live max_input_tokens, max_tokens, capabilities).| Model | Thinking config | If omitted |
|---|---|---|
| Fable 5.1 / Fable 5 / Mythos | {"type":"adaptive"} or omit; disabled → 400 | Adaptive (always on) |
| Opus 5 | adaptive; disabled only at effort ≤ high | Adaptive — on by default |
| Opus 4.8 / 4.7, Sonnet 5 | adaptive is the only on-mode | 4.8/4.7 run without thinking |
| Opus 4.6 / Sonnet 4.6 | adaptive recommended | No thinking |
| Haiku 4.5 and older | {"type":"enabled","budget_tokens":N} | No thinking |
budget_tokens is removed (400) on Fable 5.1 / 5, Opus 5/4.7/4.8 and Sonnet 5. Adaptive thinking + effort replaced it. So are temperature/top_p/top_k on those models.display defaults to "omitted" on Fable 5.1 / 5, Opus 5 / 4.8 / 4.7 and Sonnet 5 — a silent change from 4.6. If you stream reasoning to users, set {"type":"adaptive","display":"summarized"} or your UI shows a long blank pause.Disabling thinking on Opus 5 has two failure modes: it may write a tool call into visible text (the call silently never runs) and may leak <thinking> tags. Prefer adaptive thinking at low/medium effort — cheaper and correct.
while stop_reason == "tool_use". Full control, no beta.client.beta.messages.tool_runner() with @beta_tool / betaZodTool. You write only the functions; per-turn hooks give approval gates, retries, compaction.tool_use blocks. Return all tool_results in a single user message — splitting them silently trains Claude out of parallel calls. Failed tool → tool_result with is_error: true, never a dropped block.| Tool | type |
|---|---|
| Web search | web_search_20260209 |
| Web fetch | web_fetch_20260209 |
| Code execution | code_execution_20260521 |
| Tool search | tool_search_tool_regex_20251119 · …_bm25_… |
| Memory | memory_20250818 |
| Bash / editor | bash_20250124 · text_editor_20250728 (schema-less) |
The _20260209 search/fetch variants have dynamic filtering built in — don't also declare code_execution. Server-tool errors return HTTP 200 with an error object in the result block; they never raise.
tools → system → messages. Stable content first; timestamps, request IDs, and the varying question go after the last breakpoint.cache_control breakpoints; minimum cacheable prefix is model-dependent, 512–4096 tokens (512 on Fable 5.1). Verify with usage.cache_read_input_tokens — a persistent zero means a silent invalidator (a datetime.now() in the system prompt, unsorted JSON, a varying tool list).compact-2026-01-12) summarizes history server-side. Append the whole response.content back, not just the text — dropping the compaction blocks silently loses the state.context-management-2025-06-27) clears rather than summarizes: clear_tool_uses_20250919, clear_thinking_20251015. Different feature; don't mix the beta headers.{"role":"system",…} to messages (Opus 5, Opus 4.8, Fable 5.1 / 5; not Sonnet 5). Adds operator instructions without invalidating the cached prefix, and is the injection-safe channel.| Approach | Harness | Deployment |
|---|---|---|
| Manual loop | you | you |
| Tool Runner | SDK | you |
| Managed Agents | Anthropic | Anthropic (per-session sandbox) |
| Claude Agent SDK | Claude Code | you |
Managed Agents is the only one that hosts the loop and the container: persisted versioned agent configs, sessions streamed as server-sent events (SSE), vault credentials substituted at egress, scheduled deployments (cron), and multiagent rosters. Create the agent once, reference by ID — never in the request path.
Official SDKs: Python, TypeScript, Java (Kotlin/Scala), Go, Ruby, C#, PHP — plus raw HTTP. Use the platform's own client rather than a base_url override: AnthropicBedrockMantle (Bedrock, IDs prefixed anthropic.), AnthropicVertex (project + region, bare IDs), AnthropicFoundry.
Credentials resolve in order: ANTHROPIC_API_KEY → ANTHROPIC_AUTH_TOKEN → the OAuth profile from ant auth login → workload identity federation → the default profile. An unset key does not mean no credentials — check ant auth status before asking anyone for one.
A tool is a JSON schema you describe; Claude replies with a tool_use block naming it, you run the function and send a tool_result back, and repeat until stop_reason is end_turn.
tool_result blocks for one turn go back in one user message, each keyed by the tool_use_id it answers; a failed call is a result with is_error: true.input as JSON (b.input is already a dict in the SDK) — never string-match it.stop_reason: "pause_turn" means a server-side tool hit its iteration limit: resend the same messages to continue. "refusal" is a safety stop with HTTP 200.tools list is billed as input tokens on every request (a few hundred tokens of system prompt plus each schema) and sits first in the cache prefix — keep it stable.client.beta.messages.tool_runner with @beta_tool) once this loop is more than a demo; it adds retries, approval hooks and streaming.Source: Claude API tool-use reference and the bundled /claude-api skill (python and curl examples).