Follow Discord
Sweep 20 Nov 2026 · 19:55Z Build v2.1.330 547 read Stable v2.1.323 Latest v2.1.330 Next v2.1.330 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · claude-code

Automate actions with hooks changedhooks-guide

Nearest release: v2.1.325, published 5 hours before upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Upstream edited this page at 14 Nov 2026 01:38 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 14 Nov 2026 02:07 UTC.

Upstream edited
Recorded here
Lines+5added
Lines−1removed
From line 238 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits61to this page, all time

The whole hunk

from line 238, old and new numbered
/
lines
from line 238
238238 
239239### Block edits to protected files
240240 
241Prevent Claude from modifying sensitive files like `.env`, `package-lock.json`, or anything in `.git/`. Claude receives feedback explaining why the edit was blocked, so it can adjust its approach.
241Stop Claude's `Edit` and `Write` tools from modifying sensitive files like `.env`, `package-lock.json`, or anything in `.git/`. Claude receives feedback explaining why the edit was blocked, so it can adjust its approach.
242242 
243243This example uses a separate script file that the hook calls. The script checks the target file path against a list of protected patterns and exits with code 2 to block the edit.
244244 
from line 301
301301**4. Test the hook**
302302 
303303Ask Claude to add a comment to your `.env` file. Claude Code blocks the edit before it runs and passes the script's `Blocked:` message to Claude as feedback.
304 
305Claude can still change the protected files with shell commands. To block some of those commands, add an [`Edit` deny rule](https://code.claude.com/docs/en/permissions#what-read-and-edit-rules-cover) per path under `permissions.deny` in `.claude/settings.json`, like `Edit(/.env)` for the project root's `.env`.
306 
307Even with those rules, Claude can change `.env` in other ways. To limit which files commands can write to, see [Configure sandboxing](https://code.claude.com/docs/en/sandboxing.md#configure-sandboxing).
304308 
305309### Re-inject context after compaction
306310 
Feedback