Agent Upstart

Cool things people are building with agents — and practical help getting the most out of them.

Playbooks · Coding tasks

Confine Claude Code writes to your project

Written November 2, 2026

One setting makes Write, Edit, and NotebookEdit refuse paths outside your working directories in every permission mode. Idle compaction now reaches VS Code too.

What changed

Claude Code 2.1.314, dated 30 October 2026 in the changelog, added a setting called permissions.blockWritesOutsideWorkingDirectories. With it on, the Write, Edit and NotebookEdit tools refuse paths outside the working directories in every permission mode. That last part is the point of the setting: permission modes are about whether Claude Code asks before acting, and the permissive modes skip asking. This setting is a boundary, not an approval. It applies whether the session asks, auto-accepts edits, or skips prompts altogether. It pairs with the read-side setting, permissions.blockReadsOutsideWorkingDirectories, which fences reads in the same way. Set both and the file tools' reach no longer depends on which mode the session happens to be running in.

The same release added idle compaction to VS Code and the Code tab in Claude Desktop. The changelog wording is: a conversation of 200K or more tokens, left idle, is summarized, and the summary is used on the next message if the prompt cache has expired. The same release also widened idle compaction to subscribers who have turned telemetry off, and to Bedrock, Vertex, Foundry and LLM gateways once the one-hour prompt cache is on. Before this release, idle compaction was a terminal feature. If you work in VS Code or the desktop app, a long session left open over a break can now come back summarized, where before it came back with its full history.

Set the setting

First check the version you are running, since the setting arrived in 2.1.314:

If the version is older than 2.1.314, update Claude Code first. The setting does nothing on a version that does not have it, and nothing will tell you it was ignored. Then add the setting to a settings file, under permissions:

Put it in your user settings file (~/.claude/settings.json) to fence every session, or in a project's .claude/settings.json to fence that project. The project file can be committed to version control, so a team can share the fence. Do not put the key at the top level of the file, outside permissions: the setting's name starts with permissions., and that is where it belongs. Restart the session after changing settings, or start a new one, so the change takes effect.

Test the fence yourself

Do this test in a throwaway folder, not in a live project, and do it in each permission mode you actually use, including any permissive mode. A fence that holds in the mode that asks and fails in the mode that does not ask is not a fence.

  1. Make two throwaway folders. One inside your working directory, one outside it — for example, a folder next to the project, not inside it. Put nothing valuable in either.
  2. Ask Claude Code to write the same small file to both. Ask for a write inside the working directory first, then a write to the outside folder. The inside write should succeed. The outside write should be refused.
  3. Repeat for Edit and NotebookEdit. Ask Claude Code to edit a file that already exists in the outside folder, and, if you use notebooks, to edit a notebook outside the working directory. All three tools are named in the changelog entry; all three should refuse.
  4. Repeat in each mode you use. Run the same outside write in the default mode, in the mode that auto-accepts edits, and, only inside the throwaway setup, in the mode that skips prompts. The refusal should be the same in each. If any mode lets the outside write through, that mode is not fenced on your version, and the fence cannot be relied on there.
  5. Check what counts as inside. If Claude Code refuses a write you expected to succeed, check which directories the session treats as working directories — the folder you opened, plus any additional directories you added. A write to a folder you meant to include but did not add is refused by design, not by mistake. Add the directory properly rather than turning the setting off to get past it.

What the fence does not cover

The changelog names three tools: Write, Edit and NotebookEdit. It does not name the Bash tool. A shell command that writes a file — sed -i, cp, mv, a redirect — is not fenced by this setting. If Claude Code can run shell commands in the session, it can still write outside the working directory through the shell, subject to whatever permission rules and sandbox settings govern shell commands. The fence closes the file-tool route. It does not close the shell route. Do not treat a refused Write call as proof that nothing in the session can write outside the project.

Reads are a separate setting. Turning on the write fence alone does not stop Claude Code reading files outside the working directory. Set blockReadsOutsideWorkingDirectories alongside it if reads outside the project are also unwanted. And the fence is about paths, not about content: it says nothing about what Claude Code may do with files inside the working directory. A destructive command inside the project is still inside the fence.

Idle compaction: what to expect

Idle compaction summarizes a long conversation while it sits idle, so the next message works from the summary instead of the full history. In VS Code and the desktop Code tab, the conditions in the 2.1.314 changelog entry are: a conversation of 200K or more tokens, left idle, summarized, with the summary used on the next message if the prompt cache has expired. If the cache has not expired when you return, the summary is not used. A summary is not the conversation: detail that was only in the full history may not survive it. If a session holds decisions, file paths, or error text you will need verbatim later, write those down outside the session before leaving it idle, or turn idle compaction off for that session.

In the terminal, idle compaction arrived earlier. The changelog entry dated 14 October 2026 describes it there as: a conversation of 200K or more tokens, left idle for about 54 minutes, compacted before its one-hour prompt cache expires. That entry also names two controls: the environment variable CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS changes the 200K minimum, and "idleCompaction": false in a settings file turns idle compaction off. Both need version 2.1.290 or later. Do not carry the 54-minute figure over to VS Code or the desktop app: the 2.1.314 entry for those surfaces gives the token figure and the cache condition, and no idle-time figure.

Turn idle compaction off

To turn it off, add this to a settings file:

The changelog entry dated 16 October 2026 also adds an Idle compaction row to /config, for turning idle compaction off or back on without editing a file, and says the notices shown after an idle compaction say how to turn it off. Turning idle compaction off does not turn off compaction at the context limit: a conversation that grows to the limit still compacts. It only stops the idle-time summary. If you turn it off because a summary lost detail you needed, the fix for next time is the note outside the session, not only the setting: the next long idle session on another machine will still compact unless it is fenced there too.

What can go wrong

Limits

Related playbooks

Sources

Back to: Coding playbooks hub · Also: Check for planted instruction files before you start an agent in a folder you did not fill yourself · Audit a repository's git config before any agent opens it · Check where your coding agents store API keys on your own machine