Skip to content

AI Compass / News

Claude Code: you can now block writes outside the project folder

Automation

From version 2.1.314, Claude Code's file tools can refuse writes outside the working directories, in every permission mode. Shell commands are not covered.

Source: Claude Code Changelog, Version 2.1.314,

Note: I use Claude and Claude Code for my own work. Anthropic does not pay me, and the links are not affiliate links.

Technical drawing: a frame for the working directories with a WRITE · EDIT arrow that stops at the edge with a cross. A dashed BASH · MCP · HOOKS arrow, not covered by this setting, leads to a file in the home folder ~/. The version 2.1.314 is noted below.Technical drawing: a frame for the working directories with a WRITE · EDIT arrow that stops at the edge with a cross. A dashed BASH · MCP · HOOKS arrow, not covered by this setting, leads to a file in the home folder ~/. The version 2.1.314 is noted below.

What happened: Claude Code 2.1.314, released on 30 October 2026, adds the setting permissions.blockWritesOutsideWorkingDirectories. When it is on, the Write, Edit and NotebookEdit tools refuse paths outside the working directories in every permission mode, apart from some of Claude Code’s own files such as plan files. According to the docs, the working directories are the folder you launch Claude Code in plus any folders you add with --add-dir, /add-dir or additionalDirectories. A matching block for reads has existed since version 2.1.257: blockReadsOutsideWorkingDirectories.

What this means: The block helps when you let Claude work with few confirmations. A file outside the project, such as a config file in your home folder, can then no longer be changed by the file tools. The limit: the block only covers these three file tools. According to the settings reference, it does not limit shell commands, MCP tools (extensions connected through the Model Context Protocol) or programs started by hooks, the commands Claude Code runs automatically on certain events. The block also refuses writes to Claude Code’s own settings files even inside the working directories, and the EnterWorktree and ExitWorktree tools for worktrees (extra working copies of a Git repository) are no longer available.

Also new in 2.1.314: in VS Code and the Code tab of Claude Desktop, Claude Code summarises a conversation of more than 200,000 tokens once it sits idle. It uses that summary with your next message if the prompt cache (which stores the start of the request) has expired by then.

What you can do:

  1. Check your version: claude --version should show at least 2.1.314.
  2. Turn the block on: In your settings.json, add "blockWritesOutsideWorkingDirectories": true under permissions. That is the example in the settings reference.
  3. Allow folders explicitly: Add folders Claude should write to with --add-dir or /add-dir instead of switching the block off again.
  4. Secure shell commands separately: For Bash, permission rules and the sandbox remain responsible.

Context: Everything here comes from Anthropic’s changelog and docs. I have not tried the write block myself.

My workshops show you how to bring AI into your team. See the workshops