Enable blockWritesOutsideWorkingDirectories in Claude Code permissions
Turn on permissions.blockWritesOutsideWorkingDirectories so Write, Edit, and NotebookEdit refuse paths outside working directories in every permission mode. Align sandbox.excludedCommands, worktree resume, and --setting-sources with the v2.1.314 permission and sandbox fixes.Why this loop
Claude Code v2.1.314 adds permissions.blockWritesOutsideWorkingDirectories, which makes Write, Edit, and NotebookEdit refuse paths outside the working directories in every permission mode, not only stricter modes. That is the highest-leverage control in this release for anyone who lets the agent edit files. The same release also changes nearby permission surfaces you may already rely on: sandbox protections now apply when a worktree is entered with claude -p --resume or --continue; sandbox.excludedCommands unsandboxes a call only when every command in that call matches an entry; a settings file excluded with --setting-sources no longer still supplies auto mode rules or saved permission consents; auto mode no longer reports a call as blocked when its safety check gave no verdict. Put the new write block in project and managed settings, then fix excludedCommands lists and resume/worktree habits so they match post-upgrade behavior. Cap PreCompact hook output at 10,000 characters so oversized hook stdout cannot fail or repeat compaction. Ignore the 29 omitted changes.
Proposed actions
- Add to
.claude/settings.jsonand to managed/user settings: {"permissions":{"blockWritesOutsideWorkingDirectories":true}} so Write, Edit, and NotebookEdit refuse any path outside the working directories in every permission mode. - Rewrite
sandbox.excludedCommandsso every command in a multi-command call is listed; after v2.1.314 a call runs outside the sandbox only when every command matches an entry, not when one of them does. - Keep sandbox on when entering a git worktree with
claude -p --resumeor--continue; v2.1.314 now applies sandbox protections on those entry points. - Stop using
--setting-sourcesto exclude a settings file if you still need its auto mode rules or saved permission consents; v2.1.314 no longer leaks those from excluded files. - Trim each PreCompact hook's output to 10,000 characters so oversized hook stdout cannot fail or repeat compaction.
Agent prompt
Paste into your agent or query via MCP (get_agent_prompt) — free, no extra AI costPaste into Claude Code / CLAUDE.md task
DevAgentRadar → Claude Code
You are helping me adopt a real coding-assistant change. Work only from the facts below. Do not invent features.
Context
Assistant: Claude Code Proposal: Enable blockWritesOutsideWorkingDirectories in Claude Code permissions Summary: Turn on permissions.blockWritesOutsideWorkingDirectories so Write, Edit, and NotebookEdit refuse paths outside working directories in every permission mode. Align sandbox.excludedCommands, worktree resume, and --setting-sources with the v2.1.314 permission and sandbox fixes. Primary source: https://github.com/anthropics/claude-code/releases/tag/v2.1.314
Why it matters
Claude Code v2.1.314 adds permissions.blockWritesOutsideWorkingDirectories, which makes Write, Edit, and NotebookEdit refuse paths outside the working directories in every permission mode, not only stricter modes. That is the highest-leverage control in this release for anyone who lets the agent edit files. The same release also changes nearby permission surfaces you may already rely on: sandbox protections now apply when a worktree is entered with claude -p --resume or --continue; sandbox.excludedCommands unsandboxes a call only when every command in that call matches an entry; a settings file excluded with --setting-sources no longer still supplies auto mode rules or saved permission consents; auto mode no longer reports a call as blocked when its safety check gave no verdict. Put the new write block in project and managed settings, then fix excludedCommands lists and resume/worktree habits so they match post-upgrade behavior. Cap PreCompact hook output at 10,000 characters so oversized hook stdout cannot fail or repeat compaction. Ignore the 29 omitted changes.
Suggested actions
- Add to
.claude/settings.jsonand to managed/user settings: {"permissions":{"blockWritesOutsideWorkingDirectories":true}} so Write, Edit, and NotebookEdit refuse any path outside the working directories in every permission mode. - Rewrite
sandbox.excludedCommandsso every command in a multi-command call is listed; after v2.1.314 a call runs outside the sandbox only when every command matches an entry, not when one of them does. - Keep sandbox on when entering a git worktree with
claude -p --resumeor--continue; v2.1.314 now applies sandbox protections on those entry points. - Stop using
--setting-sourcesto exclude a settings file if you still need its auto mode rules or saved permission consents; v2.1.314 no longer leaks those from excluded files. - Trim each PreCompact hook's output to 10,000 characters so oversized hook stdout cannot fail or repeat compaction.
Config surfaces this release may change
- MCP servers (high confidence) — check your repo before applying
- skills (high confidence) — check your repo before applying
- background and headless runs — check your repo before applying
- slash commands — check your repo before applying
- context and compaction settings — check your repo before applying
- agent context files — check your repo before applying
- permission rules — check your repo before applying
- sandbox settings — check your repo before applying
- subagent definitions — check your repo before applying
After you finish
Do not report this as applied to DevAgentRadar. You cannot write the visitor's loop.
Tell the human: open https://devagentradar.com/proposals/claude-code-v2-1-314-enable-blockwritesoutsideworkingdirectories-in-clau and mark Applied, Skipped, or Failed. Proposal id: 73a4fd0d-f299-45c8-a19e-f57793a6646b
Your job
- Restate the change in one sentence.
- Propose a minimal plan for my repo (or a throwaway pilot).
- Implement only what I approve; prefer small diffs and tests.
- Call out risks (permissions, breaking APIs, cost).
Start by confirming you understood the proposal.
Your loop
This browser · no sign-in · not shared as “you”After you run the prompt
Only you can mark this. Agents cannot write your loop.
Your decision stays on this device. A public tally appears after a few votes.