Sweep 19 Sep 2026 · 02:36Z Build v2.1.278 500 read Stable v2.1.267 Latest v2.1.278 Next v2.1.280 Feeds RSS JSON llms.txt Unofficial
Reading a new release v2.1.280 First look · 1/6 0 findings $0.00 so far
One change · claude-code

Hooks reference changed

hooks

Nearest release: v2.1.273, published 3 hours before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Recorded here
Lines+32added
Lines−2removed
From line 1,131 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits53to this page, all time

The whole hunk

from line 1131, old and new numbered
/
lines

This page is larger than the 256 KiB this site keeps, so one side of the diff below stops where the stored text does.

from line 1131
11311131 
11321132Before v2.1.214, forked sessions reported source `"resume"`.
11331133 
1134When you run `/clear` in an interactive session, the matching SessionStart hooks run in the background and the prompt accepts input again right away. Claude's first response still waits for the hooks to finish, so their context reaches Claude. If you run `/clear` again or switch to another conversation with a command such as `/resume` while those hooks are still running, Claude Code cancels them and discards their output.
1134When you start an interactive session, resume a conversation at launch with `--continue` or `--resume`, or run `/clear`, SessionStart hooks run in the background. You can type right away, and a conversation you resumed appears without waiting for the hooks. Claude's first response still waits for the hooks to finish, so their context reaches Claude.
11351135 
1136When you switch conversations with `/resume` inside a session, the switch waits for the hooks to finish instead. If you run `/clear` or switch to another conversation while background hooks are still running, nothing they return applies to the session.
1137 
11361138The same wait applies at launch, including a resumed session: a prompt you send while SessionStart hooks are still running doesn't reach Claude until they finish.
11371139 
11381140During either wait, press `Esc` to take the prompt back into the input without sending it. The hooks keep running.
from line 1615
16131615 
16141616The `tool_input` fields depend on the tool:
16151617 
1618<a id="bash" />
1619 
16161620##### Bash
16171621 
16181622Executes shell commands.
from line 1628
16241628| `timeout` | number | `120000` | Optional timeout in milliseconds. Values above the [maximum](/docs/en/tools-reference#bash-tool-behavior) are reduced to the maximum rather than rejected |
16251629| `run_in_background` | boolean | `false` | Whether to run the command in background |
16261630 
1631When a Bash command changes files in a Git repository, Claude Code can record what changed. It records the changes in every permission mode when the [`bashEditDiffEnabled`](/docs/en/settings-reference#basheditdiffenabled) setting turns recording on; that setting's entry says which files can set it. Otherwise it records them only in auto mode and `bypassPermissions` mode, and only when Claude Code directs Claude to edit files through Bash. Set `bashEditDiffEnabled` to `false` to turn the recording off. Background commands and read-only commands carry no diff.
1632 
1633Your [PostToolUse hook](#posttooluse) then receives the changed files in `tool_response.bashEditDiff`. The list covers what changed under the repository while the command ran. Files that Git ignores and files in submodules aren't listed. Requires Claude Code v2.1.269 or later.
1634 
1635<Note>
1636 The list is best effort and in public beta. Claude Code can miss a change, include a file that another process changed at the same time, or stop at its size limits. The field shape may change. Use the list to find what to review, not to enforce a policy.
1637</Note>
1638 
1639`changedFiles` and `files` list what the command changed; the remaining fields say how complete and how reliable that list is.
1640 
1641| Field | Type | Example | Description |
1642| :------------- | :------ | :------------------------------------------------------ | :----------------------------------------------------------------------------------------------------------------------------------------------- |
1643| `changedFiles` | array | `["/path/to/src/app.ts"]` | Absolute paths of the files the command changed, at most 200. Present whenever `files` holds a diff or `moreFiles` is above zero |
1644| `files` | array | `[{"filePath": "/path/to/src/app.ts", "hunks": [...]}]` | Diffs of up to 5 changed files, for display. `created` or `deleted` is `true` for a file the command added or removed |
1645| `moreFiles` | number | `2` | Count of changed files with no diff in `files` |
1646| `unavailable` | boolean | `true` | Set when the diff is incomplete or couldn't be taken |
1647| `skipped` | boolean | `true` | Set for a Git command that moves the working tree, such as `git checkout` or `git stash`, so Claude Code takes no diff |
1648| `shared` | boolean | `true` | Set when another Bash tool call, such as a subagent's, ran in the same repository at the same time, so some listed changes may be that command's |
1649 
16271650<a id="powershell" />
16281651 
16291652##### PowerShell
from line 2743
27202743 "cwd": "/Users/...",
27212744 "hook_event_name": "ConfigChange",
27222745 "source": "project_settings",
2723 "file_path": "/Users/.../my-project/.claude/settings.json"
2724}
2725```
2726 
2727#### ConfigChange decision control
2728 
2729ConfigChange hooks can block configuration changes from taking effect. Use exit code 2 or a JSON `decision` to prevent the change. When blocked, the new settings are not applied to the running session.
2730 
2731| Field | Description |
2732| :--------- | :--------------------------------------------------------------------------------------- |
2733| `decision` | `"block"` prevents the configuration change from being applied. Omit to allow the change |
2734| `reason` | Accepted but never shown |
2735 
2736```json theme={null}
2737{
2738 "decision": "block",
2739 "reason": "Configuration changes to project settings require admin approval"
2740}
2741```
2742 
2743`policy_settings` changes can't be blocked. Hooks still fire for `policy_settings` sources when a managed settings file on the machine changes, so you can use them to log those edits, but any blocking decision is ignored. This ensures enterprise-managed settings always take effect. Claude Code doesn't run `ConfigChange` hooks when [server-managed settings](/docs/en/server-managed-settings) arrive or refresh.
2744 
2745Claude Code acts on the blocking decision from a ConfigChange hook's JSON output and discards `systemMessage` and `continue`. A blocked change surfaces no message to you or to Claude, whether you block with `reason` or with stderr on exit 2. Claude Code only writes a line to the debug log.
2746 
2747### CwdChanged
2748 
2749Runs when a shell command in the main conversation changes the working directory, for example when Claude executes a `cd` command. Use this to react to directory changes: reload environment variables, activate project-specific toolchains, or run setup scripts automatically. Pairs with [FileChanged](#filechanged) for tools like [direnv](https://direnv.net/) that manage per-directory environment.
2750 
2751CwdChanged hooks have access to [`CLAUDE_ENV_FILE`](#persist-environment-variables). Variables written to that file persist into subsequent Bash commands until the next CwdChanged event, when Claude Code clears them.
2752 
2753CwdChanged doesn't support matchers and fires on every occurrence.
2754 
2755#### CwdChanged input
2756 
2757In addition to the [common input fields](#common-input-fields), CwdChanged hooks receive `old_cwd` and `new_cwd`.
2758 
2759```json theme={null}
2760{
2761 "session_id": "abc123",
2762 "transcript_path": "/Users/.../.claude/projects/.../transcript.jsonl",
2763 "cwd": "/Users/my-project/src",
2764 "hook_event_name": "CwdChanged",
2765 "old_cwd": "/Users/my-project",
2766 "new_cwd": "/Users/my-project/src"
2767}
2768```
2769 
2770#### CwdChanged output
2771 
2772In addition to the [JSON output fields](#json-output) available to all hooks, CwdChanged hooks can return `watchPaths` to dynamically set which file paths [FileChanged](#filechanged) watches:
2773 
2774| Field | Description |
2775| :----------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2746 "file_path": "/User