// LLM knowledge base for Anthropic's terminal-native coding agent — CLI · hooks · skills · MCP · subagents · settings · permissions · memory
#id, type badge, one-paragraph description, dep chips. Load this page as context when an LLM needs to reason about Claude Code configuration, hooks, skills, or the agent loop without scanning docs.claude.com. Source of truth for behaviour is always the live Anthropic docs + this repo's CLAUDE.md.
v / V with selection, operators, and visual feedback./usage replaces /cost + /stats (both remain as typing shortcuts)./theme — named custom themes; JSON in ~/.claude/themes/; plugins can ship a themes/ directory./color syncs session accent to claude.ai/code when Remote Control is connected./fork now writes a pointer instead of the full parent conversation — forks are cheap.--continue/--resume now find sessions that added the current directory via /add-dir.type: "mcp_tool" — no shell shim./mcp menu hiding OAuth Authenticate/Re-authenticate for headersHelper servers.expires_in.Stop / SubagentStop.DISABLE_UPDATES env var blocks all update paths including manual claude update (stricter than DISABLE_AUTOUPDATER).wslInheritsWindowsSettings."$defaults" in autoMode.allow / soft_deny / environment to compose rather than replace.claude plugin tag — create release git tags for plugins with version validation.--dangerously-skip-permissions.~/.claude/.credentials.json — fixed./login now clears CLAUDE_CODE_OAUTH_TOKEN so disk credentials take effect.SendMessage now restore their explicit cwd.model in ~/.claude/settings.json.
┌────────────── USER TURN ──────────────┐
│ prompt · slash command · file ref │
└───────────────────┬───────────────────┘
│ UserPromptSubmit hook fires
▼
┌───────────────────────────────────────┐
│ claude CLI · the-loop · model tier │
│ Opus 4.7 (default) · Sonnet · Haiku │
└───────────────────┬───────────────────┘
▼
┌────────────┴────────────┐
▼ ▼
built-in tools MCP servers
Read · Write · Edit stdio · http · OAuth
Bash · Glob · Grep plugin ecosystem
Agent · TaskCreate user + project scope
ScheduleWakeup · Skill
│ │
│ PreToolUse hook │
▼ ▼
execute tool execute MCP call
│ │
│ PostToolUse hook │
└────────────┬────────────┘
▼
SessionStart · Stop · SubagentStop hooks
│
▼
response rendered · memory updated
The claude command. Installs via npm install -g @anthropic-ai/claude-code (or the installer script). Interactive TUI by default; non-interactive via --print. Ships on macOS, Linux, Windows (via WSL2), and integrates with VS Code + JetBrains IDEs.
Per turn: read message + CLAUDE.md context → plan → call tools (parallel when independent) → observe results → respond. Stops when the model emits no further tool calls. Hooks fire at well-defined points inside the loop.
Opus 4.7 (1M-context) default for Claude Code today. /fast toggles Claude Opus 4.6 with lower latency (same weight class, streamed faster — not a smaller model). Sonnet 4.6 and Haiku 4.5 available via /model. Model IDs include claude-opus-4-7, claude-sonnet-4-6, claude-haiku-4-5-20251001.
Key flags: --print (one-shot, stdout only) · --dangerously-skip-permissions (bypass approval prompts, for YOLO / sandboxed runs) · --model <id> · --mcp-config <path> · --continue (resume last session) · --resume <session-id>. Combine with shell redirection for scripting.
Conversation state persisted on disk. Each session has an id, a project directory, a message history, and a set of enabled tools / MCPs. --continue resumes the most recent session in the current project; /resume or claude --resume <id> picks a specific one. History lives under ~/.claude/projects/<encoded-path>/*.jsonl.
Assistant output streams token-by-token. Esc interrupts the current turn gracefully — the model sees the interruption as a "user stop" and can be steered mid-reply. Any text typed while streaming is queued as the next user turn.
Read any file by absolute path. Supports text, images (PNG/JPG shown visually), PDFs (page ranges required for >10pp), and Jupyter notebooks (cells + outputs). Returns cat -n formatted text with line numbers.
Create or overwrite a file at an absolute path. Prefers Edit on existing files. Requires a prior Read on the same path before overwrite — the harness tracks file state to avoid clobbering.
Exact-string replacement on an existing file. old_string must be unique in the file (or pass replace_all). Preserves indentation/whitespace character-for-character. Fails closed if the file wasn't Read first.
File-pattern match (**/*.ts, src/**/*.tsx). Returns paths sorted by modification time. Faster than shelling out to find and the recommended first step for codebase exploration.
Ripgrep-backed content search. Supports full regex, glob filter, file-type filter, multiline mode, and three output modes: files_with_matches, content, count. Respects .gitignore by default.
Executes shell commands. Two-minute default timeout, extendable to 10m. Supports run_in_background for long-running processes (tail output with Monitor). CWD persists between commands; shell state (env exports, aliases) does not.
Spawns a subagent to handle a scoped task. subagent_type selects capabilities: general-purpose, Explore (codebase search), Plan (implementation planning), plus repo-defined agents. Optional isolation: "worktree" runs the subagent in a git worktree. Optional run_in_background returns immediately and notifies on completion.
Progress-tracking primitives for multi-step work. in_progress / completed / cancelled states. One task in_progress at a time is the convention. Persist across turns so status is legible to the user.
Fetches schemas for deferred tools listed by name in system reminders. Search by keyword ("slack search") or by exact name ("select:mcp__slack__send"). Returns the matched tools' JSONSchema so they become callable for the rest of the session.
Invokes a user-authored skill by name. The skill's SKILL.md defines the behaviour; Claude Code loads it into context and follows its instructions. Used for reproducible multi-step procedures.
In-process self-pacing for the /loop skill's dynamic mode. delaySeconds [60, 3600] + a prompt to re-fire. Critical nuance: the Anthropic prompt cache has a 5-minute TTL, so 60–270s keeps cache warm; 300–3600s pays a cache-miss once but amortises across a longer wait.
Stream output from a background process started with Bash run_in_background or Agent run_in_background. Each stdout line fires a notification. Supports until-loop polling patterns.
Targeted cell-level edits on .ipynb files. Insert / replace / delete a cell by id or source match. Preserves outputs for neighbouring cells.
Fetch a specific URL or run a web search. Results are distilled, not raw HTML. Cached within a session. User can disable either tool in settings for offline-only work.
Inline help — lists built-in slashes + registered user commands. First stop when the command surface is unclear.
Wipes the visible transcript and the session context window. Fresh start without quitting the CLI. Settings + permissions + MCPs stay loaded.
Summarises the conversation into a compact digest and replaces the working context with it. Preserves task continuity while reclaiming tokens. Triggers automatically on context-window pressure.
Toggles Fast mode — Claude Opus 4.6 with faster streamed output. Same weight class as 4.7; not a smaller model. Only available when 4.7 is configured. Recommended for conversational work that doesn't need the 1M-context extended reasoning.
Switch models mid-session. Accepts aliases (opus, sonnet, haiku) or exact IDs (claude-sonnet-4-6). Changes context going forward only; prior turns keep the originating model's output.
Runs a prompt or command on a recurring interval — /loop 5m /foo every 5 min, or /loop /foo for self-paced. Dynamic pacing uses ScheduleWakeup to pick appropriate delays. Good for polling, watchers, or any "check again in a bit" pattern.
Creates, updates, lists, or runs scheduled remote agents (triggers) that execute on a cron schedule. Managed agents live outside the current session so they survive CLI exit.
Bootstraps a CLAUDE.md for the current repository — codebase overview, conventions, commands, invariants. Run once per project on first launch.
Review a pull request or scan pending changes for security issues. Uses the current branch's diff vs the base. Output is a structured risk summary, not a blanket approval.
Any .claude/skills/<name>/SKILL.md registers as /<name>. Project-local skills live in the repo; user-global skills live in ~/.claude/skills/. Trigger via the slash OR via auto-match on a user message.
Fires before Claude sees the user's message. Use it to inject context, block a prompt, or redirect to a different command. Payload: prompt text + cwd. Script output is treated as additional context the model then reads.
Fires once per session, after CLAUDE.md loads but before the first turn. Ideal for priming the environment: setting env vars, warming caches, printing a status banner. Output goes into the session's initial context.
Fires just before any tool call. Can block (exit non-zero) or allow. Matchers filter by tool name or pattern. Typical use: enforce an allowlist, rewrite arguments, or log the intended call.
Fires after a tool call returns. Payload includes the tool name + result. Use for logging, post-edit formatters (run Biome after Edit), test runs, or audit trails. Non-blocking — failure doesn't cancel the turn.
Fires when the main turn ends (Stop) or when a subagent finishes (SubagentStop). Use for cleanup, summary notifications, or triggering a next-step job. The hook can request Claude re-open by returning a continuation prompt.
Configured in .claude/settings.json (project) or ~/.claude/settings.json (user). Shape: hooks: { UserPromptSubmit: [{matcher, hooks: [{type:"command", command:"./script.sh"}]}] }. Output / exit codes drive blocking vs. advisory behaviour.
One markdown file per skill. Frontmatter declares name, description, optional trigger patterns. Body is the instruction set Claude follows when the skill activates. Live under .claude/skills/<name>/SKILL.md (project) or ~/.claude/skills/<name>/SKILL.md (user).
Two invocation paths. Auto-trigger: the skill's description matches the user's intent — Claude invokes it via the Skill tool. User-invoked: user types /<skill-name>. Both end in the same thing — skill body loaded into context.
Three loading scopes. Project: ./.claude/skills/ — versioned with the repo. User: ~/.claude/skills/ — available across all projects. Global/marketplace: distributed via the plugin system (see skills-lock.json).
A skill folder can include supporting assets — helper scripts, templates, prompts, static data. The skill's SKILL.md references these by relative path; Claude reads them on demand. Keeps the SKILL.md itself short.
Pin versions of installed skills at the repo root. Locks marketplace or shared skills to a specific revision so the project behaves the same across machines. Similar role to package-lock.json.
Three transports supported: stdio (spawn a subprocess), HTTP (hosted), OAuth 2.1 (hosted with user authentication). Tool calls travel as JSON-RPC over whichever transport the server declares.
Declared in .claude/settings.json (project) or ~/.claude/settings.json (user). Each entry: name, transport, command/url, optional env. Claude spawns stdio servers on session start; http/oauth servers are reached on demand.
filesystem (@modelcontextprotocol/server-filesystem), GitHub, Slack, Gmail, Google Drive, Notion, Cloudflare, Vercel, Stripe. Many come with OAuth flows baked in. Custom servers are straightforward — MCP spec is small and implementation SDKs exist in Python + TypeScript.
Large tool libraries use deferred registration: the tool names appear in system reminders but schemas aren't loaded until ToolSearch fetches them. Keeps the initial prompt small; schemas load on demand. Call ToolSearch "select:<name>" before invoking a deferred tool.
Selects the spawned agent's persona + tool surface. Built-ins: general-purpose, Explore, Plan, statusline-setup, keybindings-help. Projects define custom agents by dropping a .claude/agents/<name>.md file.
Agent option that runs the subagent inside a fresh git worktree. Temporary branch; auto-cleaned if the agent makes no changes. Returns the worktree path + branch name so you can diff/merge. Ideal for risky refactors or parallel exploration.
Agent or Bash option. Returns immediately. Progress streams to the Monitor tool; completion fires a notification event. Use when work is genuinely parallel — builds, test suites, scheduled checks. Avoid for serial work where you need the result next.
Subagents start with zero context. The prompt must be self-contained — state goal, give needed file paths, explicitly request a response length. Terse command-style prompts produce shallow work; brief-your-colleague prompts produce substance.
Instead of spawning a fresh agent, continue a previously-named or still-running one via SendMessage({to: name, …}). Preserves the prior agent's full context. Prefer this over Agent() when iterating on a multi-turn investigation.
Three-file config system. Project (.claude/settings.json) — committed with the repo. User (~/.claude/settings.json) — machine-wide. Local (.claude/settings.local.json) — gitignored, overrides project. Merge order: local > project > user.
Declares allow / deny rules for tools. Rule shape: "Bash(git status)", "Bash(git diff:*)", "Read(/etc/**)". Match glob + wildcard. Most restrictive rule wins. Supplementary to the runtime permission mode.
Per-hook-type arrays of {matcher, hooks}. Each hooks item has a type (command), a command string, and optional timeout. Multiple hooks per event fire in declaration order.
Environment variables injected into the Claude Code process. Common keys: ANTHROPIC_API_KEY, CLAUDE_CODE_USE_BEDROCK, CLAUDE_CODE_USE_VERTEX, DISABLE_TELEMETRY.
Custom keybindings — rebind submit, add chord shortcuts, remap interrupt. Separate from settings.json because changes are personal/ergonomic.
Configurable line above the input showing context — token budget, active model, working directory, custom commands. Scripts produce the line via stdout. Configured via /statusline or settings.json.
Runtime modes that gate tool execution. default: prompt per tool · acceptEdits: auto-approve file edits · auto: auto-approve most tools · plan: planning only, no execution · bypassPermissions: nothing prompts · dontAsk: reject everything not explicitly allowed.
Read-only planning mode. Claude can Read, Grep, Glob, WebFetch — can't Write, Edit, Bash-with-side-effects, or call a destructive MCP. Exit via the ExitPlanMode tool with a concrete plan the user approves.
Per-tool allow/deny in settings.json. Rules use a mini-glob: Bash(git status) (exact), Bash(git diff:*) (prefix), Read(**/node_modules/**) (glob). Most-specific match wins; tie-breaker is deny-over-allow.
CLI flag that disables the runtime permission prompt entirely. Intended for sandboxed runs (Docker, isolated worktrees, CI). Does not bypass settings.json deny rules.
Project-level primer. Lives at the repo root. Auto-loaded into every session in that project. Conventional contents: project overview, machine + paths, tech stack, key commands, conventions, phase runbook. /init bootstraps one.
Per-project memory under ~/.claude/projects/<encoded-path>/. Contains session logs (*.jsonl), optional auto-memory notes under memory/*.md, and cached project state.
A ~/.claude/projects/<path>/memory/ directory keyed by topic. MEMORY.md is an index of pointers to typed memory files (user.md, feedback_*.md, project_*.md, reference_*.md). Each file has frontmatter (name, description, type). Written and consulted by the agent across sessions.
Four canonical types. user: role, goals, knowledge. feedback: corrections + confirmations from past sessions. project: who's doing what, by when, why. reference: pointers to external systems (Linear project id, Slack channel, Grafana dashboard URL).
Optional user-level CLAUDE.md loaded into every session across every project. Tone preferences, global constraints, favourite idioms. Merges with (never overrides) project-level CLAUDE.md.
Human-readable operator guide. 11 tabs — Overview · Install · CLI · Slash · Skills · Hooks · MCP & Tools · Subagents · Settings · Permissions · Memory.
Official Anthropic documentation. Source of truth for behaviour changes, new flags, model releases. Always check here first when this wiki and the docs disagree.
OpenAI Codex. Same product class as Claude Code. Useful for comparing hook models, skill systems, and CLI ergonomics across vendors.
Anthropic Claude Desktop. Same Claude model family, different surface — artifacts, projects, drag-drop files, MCP. Worth reading when building an MCP server that targets both.
Cloudflare-edge session orchestrator for Claude Code. Shows one pattern for hosting Claude Code agents as always-on services behind a web UI.