← Claude Code Hub
Jul 18, 2026 · 6 min read ✦ Tip #138

Claude Code auto mode now protects you from yourself

You already trust auto mode to stop a `git push` to main. Over the last few weeks it learned to block three subtler, nastier things, and one is the `rm -rf` that quietly becomes a wipe of your home folder.

Auto mode blocks three destructive commands: git reset --hard, an rm -rf on an unresolved variable, and a write to the session transcript

TL;DR Three new or widened soft_deny rules in the auto mode classifier: local destructive git (git reset --hard, git clean -fd, git stash drop), an rm -rf on a variable the classifier can't resolve, and writes to the session transcript. All three block by default and open the moment your intent is explicit. Inspect them with claude auto-mode defaults.

Update, November 20, 2026: the classifier no longer judges your working tree blind: before a command that discards work, Claude Code can hand it the output of git status, and since v2.1.329 it runs it less often, so that command may stay blocked until the tree has been checked. Section 1 explains how.

Auto mode doesn't run your tool calls blind. It routes them through a classifier that blocks anything irreversible, destructive, or aimed outside your environment. That classifier has four tiers: hard_deny blocks unconditionally, soft_deny blocks but opens if your message describes the exact action, allow holds the exceptions, and your explicit intent sits above all of it.

The three protections that landed over the last few weeks are all soft_deny. They block by default, and asking for the action in concrete terms is enough to clear them. "Clean up the repo" doesn't authorize a git reset --hard. "Discard my local changes" does.

What it now stops

> Shift+Tab → mode: ⚡ auto

✗ git reset --hard origin/main
  soft_deny · Irreversible Local Destruction
  (you didn't ask to discard local working-tree changes)

✗ rm -rf "$BUILD_DIR"/*
  soft_deny · Unverifiable Deletion Target
  ($BUILD_DIR doesn't resolve in the transcript; blast radius unknown)

✗ echo '{"meta":{...}}' >> ~/.claude/projects/foo/session.jsonl
  soft_deny · Session Transcript Tampering
  (write to the session history)

1. Local destructive git (widened rule)

The Irreversible Local Destruction rule already existed: it blocked deleting files that predated the session. In the week of June 15 (v2.1.178 through 183) it widened to name the git commands that throw away working-tree work explicitly: git reset --hard, git clean -fd, git stash drop, git checkout -- ., git restore ., git worktree remove --force.

The classifier assumes your working tree is dirty, but it doesn't have to guess: before a command that can discard work (git reset --hard, git checkout ., git clean -f, rm -rf), Claude Code can run git status itself and place the result right above the command. If it says the tree is clean, there's nothing to lose and the assumption drops. If there are changes, it blocks unless you named the operation: "discard my changes" or "reset to origin" clear it; a vague "tidy up the repo" doesn't.

Since v2.1.329 it doesn't run it on every request, so you don't wait in large repositories, which means a command that discards work can be blocked before the classifier has seen the tree. The block's reason says so: Auto mode judged this without the repository's git status, and on your next three requests it does see it. If git status shows nothing the command would lose, Claude may send it once more, on its own.

2. rm -rf on a variable that won't resolve (new rule)

This is the visceral one, and it's new (week of July 6, v2.1.202 through 206). rm -rf shows up in the previous rule too, but there the blast radius is known and you just have to name the target. This is different: the target is a variable ($VAR, ${VAR}) or a glob rooted in one ("$VAR"/*) whose value isn't anywhere in the transcript. With no in-window assignment (VAR=…, export VAR=…, read VAR), the value came only from earlier output the classifier never saw. The blast radius is unknown.

The textbook case: $VAR comes back empty and rm -rf "$VAR"/* becomes a wipe of your $HOME or the filesystem root. The Unverifiable Deletion Target rule fails closed and blocks it.

It clears two ways: you name the exact path, or you rewrite the command with the resolved literal path in it. Watch the obvious shortcut: an echo "$VAR" first doesn't help, because its output doesn't reach the classifier either.

3. Tampering with the session transcript (new rule)

Also new in v2.1.202 through 206. The session transcript (the .jsonl files under ~/.claude/projects/) isn't an ordinary working file. It's the state the classifier reads as ground truth on every check. It's where your conversational boundaries live ("don't push"), where the evidence of your intent lives, even the signal for whether a repo is public.

If an action could write to that history, or forge the {"meta":{…}} lines the classifier treats as harness-injected, it could manufacture its own authorization. A tampered entry feeds every later classification once the session resumes. The Session Transcript Tampering rule blocks those writes. Reading the transcript stays routine.

This is the asymmetric one of the three. A legitimate git reset --hard or rm -rf is part of normal work, which is why they open when you're explicit. Writing to the session transcript almost never has a legitimate reason. Blocking it by default is exactly what you want.

4. See the exact rules

The full text of each rule lives in the classifier defaults:

claude auto-mode defaults

As of v2.1.208 you can read a single one by its label, without piping through jq:

claude auto-mode defaults --label 'Session Transcript Tampering'

The match is a case-insensitive prefix on the label. On older versions, plain claude auto-mode defaults prints all four lists in full.

Reference

Rule (soft_deny) What it stops Clears when Status
Irreversible Local Destruction git reset --hard, git clean -fd, git stash drop, rm -rf on pre-session files you name the target or ask to discard it Widened (v2.1.178)
Unverifiable Deletion Target rm -rf "$VAR"/* with $VAR unresolved in the transcript you name the path or write it literally into the command New (v2.1.202)
Session Transcript Tampering writes to the session .jsonl files or forging {"meta"} lines almost never (false positive only) New (v2.1.202)

When one of these blocks you, the reason shows up next to the action in the transcript, in the denial notification, and in /permissions under the "Recently denied" tab. That's where you decide whether the fix is rewriting the command or retrying with explicit intent.

Requirements

Auto mode enabled. The destructive-git widening landed in v2.1.178; the unresolved rm -rf and the transcript protection in v2.1.202. The --label flag needs v2.1.208 or later.

New to auto mode? Start with Escape Claude Code's permission fatigue without going YOLO. To place it among the six modes, see Control How Much Autonomy Claude Code Gets with 6 Permission Modes. To add rules of your own next to these, see Claude Code auto mode rules: write your own in one plain sentence.

These guardrails belong to one of five levers for approving less without losing control; all five are in this guide.

Official docs: Configure auto mode | Permission modes

Found this useful? See more of wmedia.es in your Google results.

Add wmedia.es as a preferred source on Google
FREE GUIDE

You don't need Opus every time.

Model and effort are two settings, not one. 8 pages with the settings that actually move your bill, a three-question diagnostic for when something fails, and the price ladder.

  • 1. What "better" means capability, time and money
  • 2. Model who you send
  • 3. Effort how much rope you give
  • 4. Diagnostic three questions when something fails
  • 5. The bill where it comes from
Are you a professional Web developer?

You'll receive the guide by email · Unsubscribe anytime

of 8
#

Wmedia · 8 pages
FREE GUIDE · 8 pages · 2 dials

You don't need Opus every time.

Model and effort are two settings, not one. 8 pages with the settings that actually move your bill, a three-question diagnostic for when something fails, and the price ladder.

Are you a professional Web developer? · Unsubscribe anytime

Using Opus for everything? See when you don't need it.