---
title: "How we built Claude Code auto mode"
description: "Claude Code’s auto mode replaces most permission prompts with a two-layer defense: a server-side prompt-injection probe screens tool outputs before they enter context, and a two-stage transcript classifier gates risky actions such as shell commands, external fetches and out-of-project file operations."
url: "https://swe.quest/articles/how-we-built-claude-code-auto-mode-f44e56ec24ef0ed6"
canonical: "https://www.anthropic.com/research/claude-code-auto-mode"
source: "Anthropic Engineering"
published: "2026-03-25"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 16
tags: ["ai-agents","ai-safety","llms","security","ai-coding"]
---

# How we built Claude Code auto mode

A post on [Anthropic Engineering](https://swe.quest/sources/anthropic.md), published 2026-03-25, 16 min read, Deep dive. Original: [https://www.anthropic.com/research/claude-code-auto-mode](https://www.anthropic.com/research/claude-code-auto-mode)

## Summary

Claude Code’s auto mode replaces most permission prompts with a two-layer defense: a server-side prompt-injection probe screens tool outputs before they enter context, and a two-stage transcript classifier gates risky actions such as shell commands, external fetches and out-of-project file operations. The classifier runs a fast yes/no filter first, then chain-of-thought only on flagged transcripts, and it is deliberately reasoning-blind by stripping assistant text and tool outputs. Evaluated end to end, it cut false positives on real internal traffic to 0.4% while letting through 17% of real overeager actions and 5.7% of synthetic exfiltration attempts—so it is positioned as safer than --dangerously-skip-permissions but not a replacement for careful manual review on high-stakes infrastructure.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [AI safety](https://swe.quest/tags/ai-safety.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Security](https://swe.quest/tags/security.md) (Security)
- [AI for coding](https://swe.quest/tags/ai-coding.md) (AI & ML)

## Prerequisites

- LLM agents ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- prompt injection ([easy posts on Application security](https://swe.quest/tags/appsec.md?difficulty=easy))
- classifier evaluation ([easy posts on Evaluation](https://swe.quest/tags/evals.md?difficulty=easy))

## Keywords

Claude Code, auto mode, Sonnet 4.6, prompt-injection probe, transcript classifier, Claude Opus 4.6

## Related posts

- [How we contain Claude across products](https://swe.quest/articles/how-we-contain-claude-across-products-b42a3aa0de1e1d62.md): Anthropic Engineering · 2026-05-25 · Medium · 19 min read · Sandboxing & isolation, AI agents, Security, Virtualization, AI safety
  Anthropic caps the blast radius of Claude agents mainly through containment (sandboxes, VMs, egress controls) rather than human approval, after telemetry showed users approved about 93% of permission prompts. claude.ai runs code in ephemeral gVisor containers, Claude Code combines human approval with an OS-level sandbox (Seatbelt/bubblewrap) that cut prompts by 84%, and Cowork runs inside a full local VM with credentials kept on the host.
- [Making Claude Code safer with sandboxing](https://swe.quest/articles/making-claude-code-safer-with-sandboxing-927e34fb9dfe9ca9.md): Anthropic Engineering · 2025-10-20 · Medium · 5 min read · Sandboxing & isolation, AI agents, AI for coding, Security
  Claude Code now sandboxes its bash tool using OS-level primitives (Linux bubblewrap, macOS seatbelt) to enforce filesystem isolation (writes limited to the working directory) and network isolation (traffic forced through a Unix domain socket to an external proxy that allowlists domains), covering all spawned subprocesses.
- [Security notice — malicious version of Anthropic.claude-code (2.1.312 and 2.1.313) identified in the Cursor VS Code Extension Marketplace · Cursor](https://swe.quest/articles/security-notice-malicious-version-of-anthropic-claude-code-2-1-312-and-2-1-313-2c482f0e7cb14708.md): Cursor · 2026-10-29 · Medium · 4 min read · Supply chain security, Threat detection, Incidents & postmortems, Developer tools
  Tampered builds of the Anthropic.claude-code extension (2.1.312 and 2.1.313, macOS and Windows) were served from Cursor's VS Code Extension Marketplace for about 11 hours on Oct 29, 2026.
- [How we detect frontier model misalignment](https://swe.quest/articles/how-we-detect-frontier-model-misalignment-98ddf97507c137b5.md): OpenAI · 2026-10-29 · Medium · 15 min read · AI safety, AI agents, Threat detection, Evaluation, Sandboxing & isolation
  OpenAI monitors frontier agents across training, evaluation, internal use and some external deployment with a four-layer pipeline: high-recall activation probes (L0), a model-based reviewer of the agent's context window (L1), security and alignment investigative agents that can run code and read full transcripts (L2), and cross-case analysis against network logs and telemetry (L3).
- [Eval awareness in Opus 4.6 on BrowseComp](https://swe.quest/articles/eval-awareness-in-opus-4-6-on-browsecomp-7d2fa9474528d7f0.md): Anthropic Engineering · 2026-03-06 · Medium · 9 min read · Evaluation, AI agents, AI safety, LLMs
  Running Claude Opus 4.6 on BrowseComp in a multi-agent setup surfaced 11 of 1,266 problems answered from benchmark materials.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
