docs/users/features/auto-mode.md
Auto Mode uses an LLM classifier to evaluate each tool call and decide whether to auto-approve it. It sits between Auto-Edit (which only auto-approves file edits) and YOLO (which auto-approves everything).
This page is the reference for configuring and troubleshooting Auto Mode. For an introduction, see the Approval Mode overview.
When you're in Auto Mode and the agent tries to run a tool, Qwen Code walks three layers in order:
{ shouldBlock } only. Around ~300ms.
If shouldBlock is false, the action is allowed and the call
proceeds.reason on block.The classifier uses your configured fast model
(/model --fast). If no fast model is configured, the main session
model is used instead.
Auto Mode does not replace hard permission rules. Before the classifier runs:
permissions.deny rules block the action with the rule's reason. The
classifier never sees it.permissions.allow rules with specific specifiers (e.g.
Bash(git status), Read(./docs/**)) still auto-allow without the
classifier.permissions.ask rules force manual confirmation even in Auto Mode.Rules like the following would let the agent execute arbitrary code without classifier review:
Bash / Bash(*) / Bash() — auto-allow every shell commandBash(python:*), Bash(node*), Bash(bash*) — interpreter wildcardsAgent / Agent(coder) — any allow on the Agent toolSkill / Skill(pdf) — any allow on the Skill toolWhen you enter Auto Mode, Qwen Code temporarily removes these rules from
the active permission set and prints a notice listing them. The rules
come back the moment you leave Auto Mode. settings.json is never
modified.
If you genuinely need these broad rules, use YOLO mode instead.
Auto Mode reads permissions.autoMode from your settings.json. The
entries are natural-language descriptions, not rule patterns — they are
injected additively into the classifier's system prompt alongside the
built-in defaults.
{
"permissions": {
"autoMode": {
"hints": {
"allow": [
"Running poetry install and poetry update in this Python project",
"Cleaning build artifacts under ./dist or ./build",
"Reading any file under /Users/me/code/"
],
"deny": [
"Any network call to intranet.example.com endpoints",
"Modifying anything under ~/.ssh or ~/.aws",
"Running migration scripts that touch the production DB"
]
},
"environment": [
"This is a private monorepo with strict commit signing",
"Production credentials live in 1Password, never in plain files"
]
}
}
}
To keep the classifier system prompt small:
hints.allow and hints.deny accept up to 50 entries each.environment accepts up to 20 entries.autoMode is merged across system / user / workspace settings the same
way other permission settings are: arrays are concatenated and
de-duplicated.
When the classifier blocks an action, the tool call fails with one of the following error texts:
Blocked by auto mode policy: <reason> — the classifier judged
the action unsafe. The reason comes from Stage 2 of the classifier.Auto mode classifier unavailable; action blocked for safety —
the classifier API was unreachable, timed out, or returned an
un-parseable response. This is fail-closed behavior: when in doubt,
block.The main LLM sees the same message in the tool result and adjusts its approach (asks you, switches tactic, gives up).
Classifier reasons are produced by the LLM and are not translated. If you
want non-English reasons, add a hint like
Respond reasons in Chinese to permissions.autoMode.environment.
Auto Mode protects you from getting stuck:
The session itself stays in Auto Mode — only the single fallback call goes through manual approval. The counters reset when you approve the fallback call or switch modes.
If you find yourself constantly hitting fallback, the most likely causes are an outage on the classifier API or hints that need tuning. Switch to Default Mode while you investigate.
"Auto mode keeps blocking my commands"
Look at the reason in the error message. If the classifier is being too
conservative for your context, add an entry to
permissions.autoMode.hints.allow describing the pattern in
natural-language. Examples:
"Building Docker images for this project (docker build ...)""Running database migrations against the local test DB""Auto mode classifier unavailable"
The classifier API didn't respond. Possible causes:
/model --fast.While diagnosing, switch back to Default Mode: /approval-mode default.
"Falling back to manual approval"
You've hit either the 3-consecutive-block or 2-consecutive-unavailable guard. Approve or reject the prompt as you normally would. After one approved fallback the consecutive counter resets.
The classifier sees sensitive data in my prompts
Tool inputs are projected through each tool's toAutoClassifierInput
method before they reach the classifier. Long edit content, web fetch
prompts, and sub-agent prompts are truncated. Tool results (file
contents, web pages) are never sent to the classifier — only the user's
text and assistant tool-use calls go through.
If a specific tool is exposing fields you'd rather redact, file an issue with the tool name; the projection is per-tool and is meant to be tightened over time.
run_shell_command typically adds
~300ms (fast classifier path) or ~3-5s (slow path with thinking
review).deny rules. The classifier is best-effort.
For commands you're sure should never run, put them in
permissions.deny.mcp__*) opt-in to argument forwarding via the
toAutoClassifierInput override. Tools that have not opted in expose
only their name to the classifier — most such calls are
conservatively blocked unless you've written an explicit allow
rule. This is fail-closed by design (credentials and voluminous
content do not leak into the classifier LLM). If you trust a
specific MCP tool, add permissions.allow: ["mcp__server__tool"] so
it bypasses the classifier entirely.Does Auto Mode send my code to a third party?
Auto Mode reuses your existing model configuration — same endpoint as the main agent. If you've configured Qwen Code to use a self-hosted model, the classifier runs against that endpoint too.
Will my secrets / .env contents reach the classifier?
The classifier sees only what each tool's toAutoClassifierInput
projection exposes:
read_file and other read-only tools: not invoked (they're on the
fast-path allowlist).edit / write_file: file_path plus the first 80 characters of
old/new content. Full content is not forwarded.run_shell_command: the full command (it has to — that's what the
classifier judges).web_fetch: the URL only. The prompt field is not forwarded.agent: subagent type plus the full prompt. The prompt is the
instruction the sub-agent will follow, so the classifier needs it
in full to detect attacks that would steer the sub-agent toward
destructive actions — same reason run_shell_command forwards the
full command.Tool results (the actual content returned by tools) are stripped from the classifier transcript entirely.
MCP tools (mcp__*) follow a stricter default: their parameters are
not forwarded unless the MCP tool author explicitly opted in via the
toAutoClassifierInput override. The classifier sees the tool name
but no arguments, so most MCP calls will be conservatively blocked
unless the user has written an explicit allow rule. This is fail-
closed by design — third-party tools should not leak credentials or
voluminous file content into the classifier LLM without intent.
Can I disable the first-time information message?
It only shows once per user-settings file. After dismissal,
ui.autoModeAcknowledged: true is set in your user settings.
How is this different from Auto-Edit?
Auto-Edit auto-approves file edits and nothing else — shell commands still ask. Auto Mode uses a classifier to also auto-approve safe shell commands and other tool calls while still blocking risky ones.
How is this different from YOLO?
YOLO auto-approves everything without any review. Auto Mode has the classifier in the loop and blocks risky actions.