Skip to main content
MindStudio
Pricing
BlogAbout
My Workspace
Claude Code auto modeClaude Code hooksClaude Code deny rules

How to Set Up Claude Code's Auto Mode, Deny Rules, and Hooks

A practical guide to Claude Code's auto mode, deny rules, sandboxing, and hooks, based on Anthropic's own internal workflow changes.

Edited by Luis Chavez-Mattos, Director of Product RSS
How to Set Up Claude Code's Auto Mode, Deny Rules, and Hooks

What changed in how Anthropic uses Claude Code?

Anthropic’s own Claude Code team has shifted from manually steering and approving every command to running dozens of sessions in parallel and only stepping in where it actually matters. Lydia Hallie, who works on the Claude Code team, described this shift in a talk about how the team’s internal workflow has evolved alongside stronger models like Opus 4.5. The core idea: five things developers used to do by hand (steering, approving, denying, checking, and starting sessions) are now increasingly handled by the model, the harness, or the environment instead of the person typing prompts.

TL;DR

  • Claude.md files should shrink, not grow, because strong models like Opus 4.5 follow instructions well enough that all-caps “IMPORTANT” and “NEVER” lines can actually confuse them and produce worse results.
  • Auto mode is now the default behavior in the Claude Code terminal and desktop app, using a separate classifier to approve safe commands (tests, installs) automatically while blocking anything it’s unsure about, like pushes outside your trusted repo.
  • Deny rules are a hard block in your settings file, meant specifically for irreversible actions like reading a .env file, since Anthropic’s own testing found auto mode still lets roughly one in ten risky commands through.
  • Sandboxing limits blast radius by restricting which files and network destinations a command can reach, which matters because a compromised dependency can abuse a command you never explicitly denied.
  • Hooks are scripts that run automatically after specific actions (an edit, a finished task) and should exit with a specific failure code so Claude is forced to fix the problem instead of marking the task done anyway.
  • Claude Code Projects, in beta on Pro, Max, and Ultra plans, lets one orchestrator session delegate a list of tasks to separate sub-sessions and check their results, replacing the habit of juggling many manual chats.
Automation tools are the old way.Enterprises build with AI on Remy.
Zapier
n8n
Make
Airtable
RemyEnterprise-ready
  • Self-hosted
  • SOC 2
  • HIPAA
  • Audit log
  • Role-based access
Built into every app you make

How do you clean up a Claude.md file for stronger models?

The test Lydia Hallie described is simple: for every line in your Claude.md, ask whether Claude could already figure that out by reading your code. If the answer is yes, the line is probably just adding noise, or worse, actively distracting a model that no longer needs hand-holding. What should stay is information Claude has no way to infer on its own, things like where your business documentation lives, where brand assets are stored, or how your folder structure maps to different parts of a project.

You don’t have to audit this by hand. Claude Code supports a /doctor style prompt audit that checks your Claude.md and any skills files against the model you’re currently running, flagging instructions that are outdated, redundant, or no longer necessary for that model’s capabilities. Running this periodically, especially after upgrading models, keeps your instructions lean and keeps the model focused on your actual code instead of parsing excess guidance.

What does auto mode actually do?

Auto mode is now the default inside the Claude Code terminal and desktop app, replacing the old binary choice between approving every single command or skipping permissions entirely. It works through a separate classifier that evaluates each command Claude wants to run. Routine, low-risk actions like running tests or installing dependencies execute without interruption. Anything the classifier isn’t confident about gets stopped for human approval, and by default auto mode only trusts your current folder and repository, so a command trying to push to a staging or deployment repo outside that scope gets blocked automatically.

You configure auto mode in plain English in your settings, describing which repos, buckets, or domains you trust and what should always be allowed or always refused. That configuration is what gets sent to the classifier at decision time. If writing this from scratch feels like a chore, running an automode setup command will draft entries based on your project structure and recent session history.

According to internal testing Anthropic published, the gap between human and automated review is large: human reviewers caught only about 14% of clearly dangerous commands in a study, while auto mode caught around 89%. That’s a meaningful improvement, but it also means roughly one in ten bad commands can still slip through auto mode, which is why it isn’t meant to be the only safeguard.

Why do you still need deny rules if auto mode works?

Deny rules exist specifically for that remaining gap. A deny rule is a hard block written into your settings file, checked before auto mode even gets involved, and it exists for actions you cannot undo. Hallie’s framing is a useful filter: if Claude gets something wrong once, can you take it back? Bad code can be rewritten. A leaked API key or a deleted file often can’t be recovered. That asymmetry is what belongs on a deny list, things like explicitly blocking Claude from ever reading a .env file where secrets typically live.

Developers have their tools. Enterprises have Remy.
Developers · AI coding tools
Claude Code
Codex
Cursor
GitHub Copilot
Enterprises · built into Remy
⌂Self-hosted
✓SOC 2
✚HIPAA
☰Audit log

This logic extends beyond coding. For knowledge work, a rewritten draft is reversible and low-stakes, but sending an email or deleting files is not. The same test applies regardless of what kind of work Claude Code is doing for you.

The limitation is that a deny rule only sees the command itself, not everything that command triggers. If Claude runs your test suite, that suite can execute arbitrary code you didn’t write, including dependencies. A compromised package buried in that chain could try to read your .env file or SSH keys without ever being explicitly denied, because nothing in the command text looked suspicious enough to flag, and a human reviewer would likely have approved it too since there’s nothing obviously wrong to reject.

What is sandboxing and when should you use it?

Sandboxing addresses the gap deny rules can’t cover. Running a sandboxed environment restricts which files a command can open and which network destinations it can reach, regardless of what that command’s text says it’s doing. Even if a dependency is compromised, it physically can’t retrieve files or reach servers outside the sandbox’s permitted scope.

For longer-running jobs, Claude Code also supports running sessions in the cloud, where the session gets a disposable copy of your code on a separate machine, without your actual keys present, and the task continues running even if you close your laptop. The framing here is that the machine itself is expendable, but outputs that leave it (a commit, a push, a message sent through a connector) are not, so those outputs still need the same deny rules and scrutiny. Those deny rules can be committed directly into your project repository so every future session, cloud or local, picks them up automatically.

How do hooks make Claude check its own work?

Checks matter because identical prompts can produce very different results. Hallie’s example: asking Claude to migrate a login system to a new API could result in a clean migration, a migration that leaves the old API partially in place, or one that accidentally logs every user out. All three might look fine in a quick glance at the output.

The fix is giving Claude checkpoints along the way rather than only reviewing the final result. These can be literal tests, screenshots, or more subjective criteria like “does every claim in this report have a source link.” For checks that need to run automatically every time, Claude Code uses hooks: scripts triggered after specific events, like a formatting check after every edit, or a full test suite before a task is allowed to be marked complete.

The exit code a hook script returns matters. Many tools default to exiting with a 1 on failure, but Claude Code treats that as the task still completing anyway. To force Claude back into fixing the problem, the hook needs to exit with a 2. Get that wrong and your “check” is just theater, Claude ignores the failure and reports success regardless.

Developers have their tools.
Enterprises have Remy.

On Hallie’s team, every pull request gets reviewed by Claude itself before any human looks at it, using a fresh session (not the one that wrote the code) paired with separate agents specifically checking for bugs. Humans then only review what’s flagged as genuinely risky, while low-stakes changes like documentation can merge automatically once checks pass.

What are Claude Code Projects?

Claude Code Projects, currently in beta for Pro, Max, and Ultra plans, is Anthropic’s answer to the last manual task: starting and managing individual sessions. Instead of opening a dozen separate chats for a dozen tasks, you give one orchestrator session a full list of work, and it spins up separate sessions for each item, checking the results as they come back. It resembles the established pattern of an orchestrator agent delegating to sub-agents, but structured specifically around managing an entire project’s worth of tasks rather than a single multi-step job.

This isn’t limited to coding. A project list could include a client report, a research brief, and a batch of content ideas, mixed together under one coordinating session. Because the orchestrator session itself doesn’t write the output, just decides what to delegate and judges what comes back, it benefits from a model suited to planning and evaluation, while the individual task threads can run on a model suited to execution. Claude Code Projects lets you set these separately in project settings.

Frequently Asked Questions

What is auto mode in Claude Code?

Auto mode is a default behavior in the Claude Code terminal and desktop app that uses a classifier to automatically approve low-risk commands, like running tests or installing packages, while blocking anything it isn’t confident about, such as actions outside your trusted repository.

How are deny rules different from auto mode?

Auto mode makes probabilistic decisions and lets some risky commands through. Deny rules are hard blocks written into your settings file that are checked before auto mode runs, reserved for irreversible actions like reading a file containing API keys.

What exit code should a Claude Code hook use to force a fix?

Hooks should exit with a 2 code when a check fails. Exiting with a 1, the common default in many tools, causes Claude Code to mark the task as completed anyway rather than sending it back for correction.

What is Claude Code Projects used for?

It’s a beta feature on Pro, Max, and Ultra plans that lets one orchestrator session delegate a list of tasks to separate sub-sessions, checking their outputs, so you manage one coordinating chat instead of many individual ones.

Does sandboxing replace deny rules?

No. Deny rules block specific named actions outright, while sandboxing restricts what any command, including ones triggered indirectly through dependencies, can actually access on your file system or network. They address different gaps and are meant to work together.

Editorial standards

Presented by MindStudio

No spam. Unsubscribe anytime.