Source Intelligence
Sweep 28 Aug 2026 ยท 16:06Z Build v2.1.251 479 read Stable v2.1.236 Latest v2.1.251 Next v2.1.251 Feeds RSS JSON llms.txt

DisclaimerUnofficial, and not affiliated with Anthropic. Nearly all of this is read straight out of what ships: npm bundles, captured prompts, published docs. Anthropic's own notes go in verbatim, marked as theirs. The rest is my reading, and every entry carries the strings behind it. If one looks wrong, vote it down and say why.

Search the documentation

50 pages for /hooks.

Titles and paths first, then pages whose text carries it. Each row opens that page as this site last read it. Cut at 50, so a narrower query shows the rest.

Intercept and control agent behavior with hooks Claude Code CLI · path agent-sdk/hooks How the agent loop works Claude Code CLI · in the page agent-sdk/agent-loop …o Claude for the next decision. You can use [hooks](/docs/en/agent-sdk/hooks) to intercept, modify, or block tool calls before they run. 4. **Repeat.** Steps 2 and 3 repeat as a cycle. Each full cycle… Use Claude Code features in the SDK Claude Code CLI · in the page agent-sdk/claude-code-features …hooks you'd configure for [interactive Claude Code sessions](/docs/en/hooks-guide). * **Programmatic hooks:** callback functions passed directly to `query()`. These run in your application process an… Modifying system prompts Claude Code CLI · in the page agent-sdk/modifying-system-prompts …hoose. [Skills](/docs/en/agent-sdk/skills), [hooks](/docs/en/agent-sdk/hooks), and [permissions](/docs/en/agent-sdk/permissions) also shape behavior outside the system prompt and are covered on their… Observability with OpenTelemetry Claude Code CLI · in the page agent-sdk/observability …tion`). * **`claude_code.hook`:** wraps each [hook](/docs/en/agent-sdk/hooks) execution. Requires detailed beta tracing (`ENABLE_BETA_TRACING_DETAILED=1` and `BETA_TRACING_ENDPOINT`) in addition to th… Agent SDK overview Claude Code CLI · in the page agent-sdk/overview …e | [Hooks](/docs/en/agent-sdk/hooks)… Configure permissions Claude Code CLI · in the page agent-sdk/permissions …er: <Steps> <Step title="Hooks"> Run [hooks](/docs/en/agent-sdk/hooks) first. A hook can deny the call outright or pass it on. A hook that returns `allow` does not skip the deny and ask rules b… Agent SDK reference - Python Claude Code CLI · in the page agent-sdk/python …To gate every tool call, use a [`PreToolUse` hook](/docs/en/agent-sdk/hooks) instead. An allow rule doesn't pre-approve the [actions no mode auto-approves](/docs/en/permission-modes#actions-no-mode-… Quickstart Claude Code CLI · in the page agent-sdk/quickstart …agent can do and when it needs approval * **[Hooks](/docs/en/agent-sdk/hooks)**: run custom code before or after tool calls * **[Sessions](/docs/en/agent-sdk/sessions)**: build multi-turn agents that… Agent SDK reference - TypeScript Claude Code CLI · in the page agent-sdk/typescript …sponseMessage` only when a hook [that runs in the background](/docs/en/hooks#run-hooks-in-the-background) finishes… Handle approvals and user input Claude Code CLI · in the page agent-sdk/user-input …n reasonably stay running, return the [`defer` hook decision](/docs/en/hooks#defer-a-tool-call-for-later), which lets the process exit and resume later from the persisted session. This guide shows yo… Orchestrate teams of Claude Code sessions Claude Code CLI · in the page agent-teams …Created`, `TaskCompleted`, and `TeammateIdle` [hook payloads](/docs/en/hooks#taskcreated) carries the session-derived name and is deprecated. </Note> ## When to use agent teams Agent teams are most… Manage multiple agents with agent view Claude Code CLI · in the page agent-view …as the rest of Claude Code and fire the [`Notification` hook](/docs/en/hooks#notification) with the `agent_needs_input` or `agent_completed` type. Background sessions don't need any terminal open to… Configure auto mode Claude Code CLI · in the page auto-mode-config …ese denials programmatically, add a [`PermissionDenied` hook](/docs/en/hooks#permissiondenied), which receives it as `tool_input`. The text beneath the call tells you whether there is anything to fix… Best practices for Claude Code Claude Code CLI · in the page best-practices …aluation-works). * **As a deterministic gate**: a [Stop hook](/docs/en/hooks#stop) runs your check as a script and blocks the turn from ending until it passes. Claude Code overrides the hook and ends… Champion kit Claude Code CLI · in the page champion-kit …notification when a long-running task completes. See [Hooks](/docs/en/hooks-guide). | | Recover from an incorrect result | Rather than rephrasing the request, p… Claude Code changelog Claude Code CLI · in the page changelog …Fixed Linux sandbox failing to start when `.claude/skills` or `.claude/hooks` is a symlink * Fixed `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE=1` preventing fresh marketplace installs from cloni… Claude apps gateway configuration Claude Code CLI · in the page claude-apps-gateway-config …| CLI | Org-wide [hooks](/docs/en/hooks)… Use Claude Code on the web Claude Code CLI · in the page claude-code-on-the-web …call, or in response to GitHub events * [Hooks configuration](/docs/en/hooks): run scripts at session lifecycle events * [Settings reference](/docs/en/settings-reference): all configuration options *… Explore the .claude directory Claude Code CLI · in the page claude-directory …e <C>.claude/</C></>, <>Git-only: if you configure a <A href="/docs/en/hooks#worktreecreate">WorktreeCreate hook</A> for a different VCS, this file is not read. Copy files inside your hook script inst… CLI reference Claude Code CLI · in the page cli-reference …t` | Run [Setup hooks](/docs/en/hooks#setup) with the `init` matcher before the session (print mode only)… Configure cloud environments Claude Code CLI · in the page cloud-environments …[pre-installed](#installed-tools). Use a [SessionStart hook](/docs/en/hooks#sessionstart) for project setup that should run everywhere, cloud and local, like `npm install`. Setup scripts and Session… Commands Claude Code CLI · in the page commands …irectory. A successful add runs your [`DirectoryAdded` hooks](/docs/en/hooks#directoryadded). When you run it while Claude is responding, Claude Code asks you to confirm the directory right away, and… Communications kit Claude Code CLI · in the page communications-kit …cript and wire it up. ๐Ÿ“– Hooks guide โ†’ https://code.claude.com/docs/en/hooks-guide ``` ### Day-to-day development **Screenshots and images** ```markdown theme={null} ๐Ÿ“ธ *Tip: Stop describing the err… Explore the context window Claude Code CLI · in the page context-window …t concise since it enters context without truncation.', link: '/en/hooks-guide' }, { t: 0.62, kind: 'claude', label: 'Edit auth.test.ts', tokens: 600, color: '#D97757', v… Manage costs effectively Claude Code CLI · in the page costs …. ### Offload processing to hooks and skills Custom [hooks](/docs/en/hooks) can preprocess data before Claude sees it. Instead of Claude reading a 10,000-line log file to find errors, a hook can gre… Message your other Claude Code sessions Claude Code CLI · in the page cross-session-messaging …is prefixed with `uds:`. * Claude Code exports it to [hooks](/docs/en/hooks) and Bash commands as the [`CLAUDE_CODE_MESSAGING_SOCKET`](/docs/en/env-vars#variables) environment variable: * In a sess… Debug your configuration Claude Code CLI · in the page debug-your-config …, MCP servers, or skills aren't taking effect. Use /context, /doctor, /hooks, and /mcp to see what actually loaded. When Claude ignores an instruction or a feature you configured doesn't appear, the… Desktop application Claude Code CLI · in the page desktop …d in `~/.claude.json` or `.mcp.json` work in both * **[Hooks](/docs/en/hooks)** and **[skills](/docs/en/skills)** defined in settings apply to both * **[Settings](/docs/en/settings)** in `~/.claude.js… Environment variables Claude Code CLI · in the page env-vars …Code spawns (Bash and PowerShell tools, tmux sessions, [hook](/docs/en/hooks) commands, [status line](/docs/en/statusline) commands, stdio [MCP server](/docs/en/mcp) subprocesses). IDE extensions also… Error reference Claude Code CLI · in the page errors …ssion rules set for this session only`: a [permission update](/docs/en/hooks#permission-update-entries) from a hook or SDK caller added deny or ask rules with the `session` destination. Session-scoped… Feature availability Claude Code CLI · in the page feature-availability …rains) extensions * [Subagents](/docs/en/sub-agents), [hooks](/docs/en/hooks-guide), [commands](/docs/en/commands), and [skills](/docs/en/skills) * [CLAUDE.md memory](/docs/en/memory), [plugins](/docs… Extend Claude Code Claude Code CLI · in the page features-overview …ss a message from one of your sessions to another * **[Hooks](/docs/en/hooks-guide)** run your script, HTTP request, MCP tool call, prompt, or subagent when Claude Code reaches a lifecycle event * **[… Fullscreen rendering Claude Code CLI · in the page fullscreen …s) * Deny or ask rules that a [hook or SDK permission update](/docs/en/hooks#permission-update-entries) added for this session only In that case Claude Code prints [`Cannot switch renderers in this s… Glossary Claude Code CLI · in the page glossary …ok handler**: what runs Learn more: [Get started with hooks](/docs/en/hooks-guide) ยท [Hooks reference](/docs/en/hooks) ## M ### Managed settings Settings enforced org-wide by IT or DevOps, deliver… Keep Claude working toward a goal Claude Code CLI · in the page goal …| | [Stop hook](/docs/en/hooks-guide#prompt-based-hooks) | The previous turn finishes… Run Claude Code programmatically Claude Code CLI · in the page headless …is still running. Claude Code then runs [`SessionEnd` hooks](/docs/en/hooks#sessionend) and exits. While exiting, Claude Code starts no new tool call, sends no new model request, and runs no hook oth… Hooks reference Claude Code CLI · in the page hooks …kstart guide with examples, see [Automate actions with hooks](/docs/en/hooks-guide). </Tip> Hooks are user-defined shell commands, HTTP endpoints, or LLM prompts that execute automatically at specifi… Automate actions with hooks Claude Code CLI · in the page hooks-guide …ike async hooks and MCP tool hooks, see the [Hooks reference](/docs/en/hooks). </Tip> ## Set up your first hook To create a hook, add a `hooks` block to a [settings file](#configure-hook-location).… How Claude Code works Claude Code CLI · in the page how-claude-code-works …ces with [MCP](/docs/en/mcp), automate workflows with [hooks](/docs/en/hooks), and offload tasks to [subagents](/docs/en/sub-agents). These extensions form a layer on top of the core agentic loop. See… Interactive mode Claude Code CLI · in the page interactive-mode …**The continuation is blocked**: a [`UserPromptSubmit` hook](/docs/en/hooks#userpromptsubmit) that blocks the continuation prompt, or a failure before it reaches the model, ends the wait. Claude Code… JetBrains IDEs Claude Code CLI · in the page jetbrains …to configure. If your organization uses a [`PreToolUse` hook](/docs/en/hooks#pretooluse) to allowlist MCP tools, though, you'll need to know it exists. **Selection and open-file context.** While conn… Set up Claude Code in a monorepo or large codebase Claude Code CLI · in the page large-codebases …* **Add a Stop hook that proposes updates**: a [`Stop` hook](/docs/en/hooks#stop) receives the path to the session transcript when Claude finishes responding, so a script can review the session and p… Connect Claude Code to tools via MCP Claude Code CLI · in the page mcp …ld](/docs/en/sub-agents#available-tools), or a [hook matcher](/docs/en/hooks#match-mcp-tools). A hook matcher written against the bare server key, such as `mcp__database-tools__.*`, never fires for a… How Claude remembers your project Claude Code CLI · in the page memory …on regardless of what Claude decides, use a [PreToolUse hook](/docs/en/hooks-guide) instead. The more specific and concise your instructions, the more consistently Claude follows them. |… Overview Claude Code CLI · in the page overview …n share, like `/review-pr` or `/deploy-staging`. [Hooks](/docs/en/hooks) let you run shell commands before or after Claude Code actions, like auto-formatting after every file edit or running lint… Choose a permission mode Claude Code CLI · in the page permission-modes …ules](/docs/en/permissions#manage-permissions) or by a [hook](/docs/en/hooks#pretooluse-decision-control), because auto mode still shows you those prompts, so switching wouldn't remove them. **At… Configure permissions Claude Code CLI · in the page permissions …nonical name `TaskStop`. Permission rules and [hook matchers](/docs/en/hooks) match the canonical name only, so a rule written as `Stop Task` doesn't match. For deny and ask rules, the startup warning… Recommend your plugin from your CLI Claude Code CLI · in the page plugin-hints …it runs through the Bash and PowerShell tools, and for [hook](/docs/en/hooks) commands. From v2.1.172 it also sets [`CLAUDE_CODE_CHILD_SESSION`](/docs/en/env-vars) to `1` in those same subprocesses. W… Create and distribute a plugin marketplace Claude Code CLI · in the page plugin-marketplaces …| `plugin.json`, `hooks/hooks.json`, and the `skills`, `agents`, and `commands` directories at the plugin root…