You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(cli,core): add Auto approval mode with LLM classifier (#auto-mode)
Add a fifth approval mode positioned between Auto-Edit and YOLO that uses
an LLM classifier to evaluate each tool call and auto-approve safe ones
while blocking risky ones — letting agents work autonomously on long
sessions without forcing users to confirm every shell/network call.
Three-layer filter when L4 returns 'ask'/'default':
L5.1 acceptEdits fast-path: Edit/Write inside workspace -> allow
L5.2 safe-tool allowlist: Read/Grep/LS/TodoWrite/... -> allow
L5.3 LLM classifier: two-stage (fast/thinking) via sideQuery
Anti-injection: assistant text and tool results are stripped from the
classifier transcript; each tool projects its args through a new
`toAutoClassifierInput` method to redact sensitive/voluminous fields.
Pending action is rendered as a user-role text turn so it survives the
OpenAI Chat Completions converter (which drops orphan tool_calls).
Safety: fail-closed on classifier failure; denial-tracking caps
3 consecutive blocks / 2 consecutive unavailable before falling back
to manual confirmation; dangerous allow rules (Bash interpreter
wildcards, any Agent/Skill allow) are temporarily stripped while in
AUTO and restored on exit — settings.json is never modified.
Config:
--approval-mode auto # CLI flag
tools.approvalMode: "auto" # settings.json
permissions.autoMode.hints.{allow,deny}: string[] # natural-lang
permissions.autoMode.environment: string[]
Copy file name to clipboardExpand all lines: docs/users/features/approval-mode.md
+117-2Lines changed: 117 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Approval Mode
2
2
3
-
Qwen Code offers four distinct permission modes that allow you to flexibly control how AI interacts with your code and system based on task complexity and risk level.
3
+
Qwen Code offers five distinct permission modes that allow you to flexibly control how AI interacts with your code and system based on task complexity and risk level.
4
4
5
5
## Permission Modes Comparison
6
6
@@ -9,19 +9,23 @@ Qwen Code offers four distinct permission modes that allow you to flexibly contr
|**Default** | ✅ Manual approval required | ✅ Manual approval required | • New/unfamiliar codebases <br>• Critical systems <br>• Team collaboration <br>• Learning and teaching | Low |
11
11
|**Auto-Edit** | ✅ Auto-approved | ❌ Manual approval required | • Daily development tasks <br>• Refactoring and code improvements <br>• Safe automation | Medium |
12
+
|**Auto** | ✅ Classifier-evaluated | ✅ Classifier-evaluated | • Long autonomous sessions <br>• When Auto-Edit is too cautious but YOLO is too risky | Medium |
-**Start in Plan Mode**: Great for understanding before making changes
17
18
-**Work in Default Mode**: The balanced choice for most development work
18
19
-**Switch to Auto-Edit**: When you're making lots of safe code changes
20
+
-**Try Auto Mode**: When you want fewer interruptions but still want safety on shell commands and network calls — an LLM classifier evaluates each call
19
21
-**Use YOLO sparingly**: Only for trusted automation in controlled environments
20
22
21
23
> [!tip]
22
24
>
23
25
> You can quickly cycle through modes during a session using **Shift+Tab** (or **Tab** on Windows). The terminal status bar shows your current mode, so you always know what permissions Qwen Code has.
24
26
27
+
> The cycle order is: **plan → default → auto-edit → auto → yolo → plan → ...**
28
+
25
29
## 1. Use Plan Mode for safe code analysis
26
30
27
31
Plan Mode instructs Qwen Code to create a plan by analyzing the codebase with **read-only** operations, perfect for exploring codebases, planning complex changes, or reviewing code safely.
@@ -182,7 +186,118 @@ Shift+Tab (or Tab on Windows) # Switch from other modes
182
186
3.**Automatically** applies all file changes without confirmation
183
187
4. If tests need to be run, it will **request approval** to execute `npm test`
184
188
185
-
## 4. YOLO Mode - Full Automation
189
+
## 4. Auto Mode - Classifier-Driven Approval
190
+
191
+
Auto Mode sits between Auto-Edit and YOLO. An LLM classifier evaluates each
192
+
shell command, network call, and out-of-workspace edit and auto-approves
193
+
the ones it judges safe while blocking risky ones. Most read-only operations
194
+
and in-workspace edits skip the classifier for speed.
195
+
196
+
See [auto-mode.md](./auto-mode.md) for the full reference (hints
197
+
configuration, troubleshooting, FAQ).
198
+
199
+
### When to use Auto Mode
200
+
201
+
-**Long autonomous sessions**: When Default Mode interrupts too often but
202
+
YOLO is too risky.
203
+
-**Trusted projects**: Internal codebases where the agent should keep
204
+
moving but you still want a guardrail on destructive shell commands and
205
+
outbound network calls.
206
+
-**Headless / scheduled runs**: Where Auto-Edit isn't enough (the agent
207
+
needs to run shell commands too) but you want safety on `rm -rf /`,
208
+
`curl ... | sh`, credential exfiltration, etc.
209
+
210
+
### How to use Auto Mode
211
+
212
+
**Turn on Auto Mode during a session**
213
+
214
+
Press **Shift+Tab** (or **Tab** on Windows) to cycle into Auto Mode. The
215
+
status bar shows the active mode.
216
+
217
+
**Use the `/approval-mode` command**
218
+
219
+
```
220
+
/approval-mode auto
221
+
```
222
+
223
+
The first time you enter Auto Mode, an information message explains how it
224
+
works. The notice does not appear again.
225
+
226
+
**Start a new session in Auto Mode**
227
+
228
+
```jsonc
229
+
// .qwen/settings.json
230
+
{
231
+
"tools": {
232
+
"approvalMode":"auto",
233
+
},
234
+
}
235
+
```
236
+
237
+
### What Auto Mode auto-approves vs blocks
238
+
239
+
The classifier is biased toward blocking when uncertain. Defaults:
0 commit comments