skip to content

A Claude Code migration-writer subagent sets `permissionMode: acceptEdits`, yet it runs in auto mode in your session — when does Claude Code honour that field?

level: seniorimportance: should knowfreq 7%

answer

  1. the parent's mode decides
  2. three modes that override
  3. three modes that defer
  4. bypass never escalates
  5. auto is the terminal default now

basics

~20 s

Only when the main session is in default (Manual), dontAsk or plan mode. In auto, acceptEdits or bypassPermissions the subagent runs in the parent's mode, and since 2.1.267 a declared bypassPermissions is never honoured unless the parent already uses it.

solid answer

~40 s

With `permissionMode` unset, a subagent inherits the main conversation's mode. When it is set, the main session's mode decides whether it counts. If the parent is in `bypassPermissions`, `acceptEdits` or `auto`, the subagent runs in that same mode and the field is ignored; under auto, the classifier also checks the task at spawn, each action, and the final report. If the parent is in `default`, `dontAsk` or `plan`, the subagent runs in its declared mode, except that a declared `bypassPermissions` keeps the parent's mode (v2.1.267 and later). Since 2.1.283 interactive terminal sessions start in auto when it is available, so a migration writer's `acceptEdits` often has no effect at all. Plugin subagents ignore the field entirely.

code

yaml · 7 lines
yaml
---
name: migration-writer
description: Writes reversible database migrations under db/migrations. Use when a schema change is requested.
tools: Read, Grep, Glob, Edit, Write
# Honoured only while the main session is in default, dontAsk or plan mode
permissionMode: acceptEdits
---

go deeper

for a junior

Remember that an unset permissionMode means the subagent inherits the main session's mode, and that the main session's mode can override what the file says.

for a middle

Name the three parent modes that override the field and the three that defer to it, plus the bypassPermissions exception.

for a senior

Diagnose a field that stopped working after 2.1.283 made auto the terminal starting mode, and pick between acceptEdits, dontAsk and deny rules for an unattended migration writer.

for a principal

Explain why a definition file must never escalate a session, and how mode inheritance plus deny rules keep delegated work inside what the user approved.

## The field and its values `permissionMode` in a subagent's frontmatter names the **permission mode** the subagent should run in. It takes the modes' config values: | Value | Behaviour | |---|---| | `default` | Manual mode: prompts for permission (`manual` is an alias, from v2.1.200) | | `acceptEdits` | Auto-accepts file edits and common filesystem commands in the working directory | | `auto` | A background classifier reviews commands and protected-directory writes | | `dontAsk` | Auto-denies anything that would prompt; explicitly allowed tools still work | | `bypassPermissions` | Skips permission prompts | | `plan` | Read-only exploration | What each mode does is the permission-modes material; this answer is about **when the subagent's field takes effect**. ## The parent's mode decides Leaving the field **unset** means the subagent **inherits** the main conversation's current mode. Setting it is a request, and the main session's mode decides whether Claude Code grants it: 1. **Parent in `bypassPermissions`, `acceptEdits` or `auto`**: the subagent runs in that **same mode** and the field is ignored. Under auto mode the classifier evaluates the subagent at three points: the delegated task at spawn, each tool call with the parent's block and allow rules, and the subagent's work and final report before the parent reads it. 2. **Parent in `default`, `dontAsk` or `plan`**: the subagent runs in the **mode it declares**, with one exception. 3. **The exception**: a subagent that declares `bypassPermissions` **keeps the parent's mode** instead. A definition file cannot escalate a cautious session to "skip all checks". This rule requires Claude Code v2.1.267 or later; a subagent runs in bypass only when the main conversation already does. The asymmetry is deliberate. When the user picked a **permissive** mode, the subagent follows it, so a definition file cannot step outside auto mode's classifier. When the user picked a **prompting** mode, the subagent may choose its own, except the one mode that would skip every check. ## Why the migration writer runs in auto The scenario in the question comes from a default that changed. Since **v2.1.283**, an interactive terminal or VS Code session starts in **auto mode** when auto mode is available and nothing else sets a mode. A parent in auto falls under rule 1, so the subagent's `acceptEdits` is ignored and the classifier reviews its actions instead. Someone who wrote the definition when sessions started in Manual sees the field "stop working" without any change to the file. What to do depends on what you want: - **Fewer prompts for migration files while you run Manual**: keep `permissionMode: acceptEdits`; it applies when the parent is in `default`, `dontAsk` or `plan`. - **Running in auto anyway**: accept that the classifier governs the subagent, and make the dangerous operations explicit with deny rules (dropping tables, running migrations against production) that hold in every mode. - **A subagent that must never prompt in automation**: `dontAsk` in a Manual parent denies anything not explicitly allowed, which pairs with allow rules for exactly the commands it needs. ## A worked comparison | Main session mode | Subagent declares | Subagent runs in | |---|---|---| | `auto` | `acceptEdits` | `auto` (field ignored, classifier reviews) | | `acceptEdits` | `plan` | `acceptEdits` (field ignored) | | `default` | `acceptEdits` | `acceptEdits` | | `plan` | `dontAsk` | `dontAsk` | | `default` | `bypassPermissions` | `default` (no escalation) | | `bypassPermissions` | anything | `bypassPermissions` | | any mode | nothing | the main session's current mode | The last row is the one most definitions rely on without realising it: leaving the field out is usually the right choice, because the subagent then tracks whatever the user switches the session to mid-task. ## Other limits on the field - **Plugin subagents ignore `permissionMode`** (along with `hooks` and `mcpServers`). Copy the file into `.claude/agents/` or `~/.claude/agents/` to use it. - **Permission rules still apply.** A mode decides how un-ruled actions are handled; `permissions.deny` rules from settings still block matching calls inside subagents. - **`plan` keeps ExitPlanMode.** Subagents normally never get `ExitPlanMode`; a subagent whose `permissionMode` is `plan` keeps it. - **Background subagents surface prompts in the main session**, naming the subagent; answering with a session-wide grant applies to the whole session. ## How to verify Watch the prompts the subagent raises, and check the main session's mode in the status bar before blaming the definition. If the parent shows auto mode on, the subagent's field is not in play.

  • Can a project subagent declare `bypassPermissions` to run unattended in a Manual session?
    No. On v2.1.267 and later a subagent that declares `bypassPermissions` keeps the main conversation's mode unless the main conversation is itself in `bypassPermissions`. A definition file cannot escalate the session past what the user chose.
  • Under auto mode, what does the classifier check for a subagent?
    Three points: the delegated task description before the subagent starts, each of the subagent's actions with the parent's block and allow rules, and the subagent's work and final report before the parent reads it. Any `permissionMode` in the subagent's frontmatter is ignored throughout.

  • A subagent's permissionMode always overrides the main session's mode.
  • Declaring bypassPermissions lets a subagent skip prompts in a Manual session.
  • With permissionMode unset, a subagent always starts in Manual mode.
  • A plugin can ship a subagent with permissionMode: bypassPermissions to skip prompts.
  • Auto mode stops at the parent; subagents it spawns run unreviewed.

Assumes Claude Code 2.1.286: auto is the built-in terminal starting mode since 2.1.283, and a subagent's declared bypassPermissions defers to the parent since 2.1.267.