@mmmbuto/qwen-code-termux 0.14.3-termux → 0.15.5-termux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +1 -1
  2. package/bundled/batch/SKILL.md +304 -0
  3. package/bundled/loop/SKILL.md +1 -0
  4. package/bundled/qc-helper/SKILL.md +1 -0
  5. package/bundled/qc-helper/docs/configuration/auth.md +13 -6
  6. package/bundled/qc-helper/docs/configuration/settings.md +158 -109
  7. package/bundled/qc-helper/docs/features/_meta.ts +4 -0
  8. package/bundled/qc-helper/docs/features/arena.md +3 -2
  9. package/bundled/qc-helper/docs/features/commands.md +67 -11
  10. package/bundled/qc-helper/docs/features/dual-output.md +593 -0
  11. package/bundled/qc-helper/docs/features/headless.md +61 -0
  12. package/bundled/qc-helper/docs/features/hooks.md +408 -120
  13. package/bundled/qc-helper/docs/features/mcp.md +100 -14
  14. package/bundled/qc-helper/docs/features/memory.md +168 -0
  15. package/bundled/qc-helper/docs/features/sandbox.md +9 -1
  16. package/bundled/qc-helper/docs/features/status-line.md +36 -10
  17. package/bundled/qc-helper/docs/features/sub-agents.md +126 -7
  18. package/bundled/qc-helper/docs/features/tips.md +54 -0
  19. package/bundled/qc-helper/docs/features/tool-use-summaries.md +178 -0
  20. package/bundled/qc-helper/docs/overview.md +4 -4
  21. package/bundled/qc-helper/docs/quickstart.md +15 -9
  22. package/bundled/qc-helper/docs/support/tos-privacy.md +1 -1
  23. package/bundled/qc-helper/docs/support/troubleshooting.md +9 -3
  24. package/bundled/review/SKILL.md +3 -2
  25. package/cli.js +241845 -206771
  26. package/locales/ca.js +2143 -0
  27. package/locales/de.js +82 -8
  28. package/locales/en.js +91 -8
  29. package/locales/fr.js +2099 -0
  30. package/locales/ja.js +81 -8
  31. package/locales/pt.js +83 -8
  32. package/locales/ru.js +81 -8
  33. package/locales/zh-TW.js +1678 -0
  34. package/locales/zh.js +88 -8
  35. package/package.json +2 -2
  36. package/bundled/qc-helper/docs/configuration/memory.md +0 -0
@@ -153,6 +153,84 @@ qwen mcp add --transport sse sseServer http://localhost:8080/sse --timeout 30000
153
153
 
154
154
  - **Server trust** (`trust: true`): bypasses confirmation prompts for that server (use sparingly).
155
155
 
156
+ ### OAuth authentication
157
+
158
+ Qwen Code supports OAuth 2.0 authentication for MCP servers. This is useful when accessing remote servers that require authentication.
159
+
160
+ #### Basic usage
161
+
162
+ When you add an MCP server with OAuth credentials, Qwen Code will automatically handle the authentication flow:
163
+
164
+ ```bash
165
+ qwen mcp add --transport sse oauth-server https://api.example.com/sse/ \
166
+ --oauth-client-id your-client-id \
167
+ --oauth-redirect-uri https://your-server.com/oauth/callback \
168
+ --oauth-authorization-url https://provider.example.com/authorize \
169
+ --oauth-token-url https://provider.example.com/token
170
+ ```
171
+
172
+ #### Important: Redirect URI configuration
173
+
174
+ The OAuth flow requires a redirect URI where the authorization provider sends the authentication code.
175
+
176
+ - **Local development**: By default, Qwen Code uses `http://localhost:7777/oauth/callback`. This works when running Qwen Code on your local machine with a local browser.
177
+
178
+ - **Remote/cloud deployments**: When running Qwen Code on remote servers, cloud IDEs, or web terminals, the default `localhost` redirect will NOT work. You MUST configure `--oauth-redirect-uri` to point to a publicly accessible URL that can receive the OAuth callback.
179
+
180
+ Example for remote servers:
181
+
182
+ ```bash
183
+ qwen mcp add --transport sse remote-server https://api.example.com/sse/ \
184
+ --oauth-redirect-uri https://your-remote-server.example.com/oauth/callback
185
+ ```
186
+
187
+ #### Manual configuration via settings.json
188
+
189
+ You can also configure OAuth by editing `settings.json` directly:
190
+
191
+ ```json
192
+ {
193
+ "mcpServers": {
194
+ "oauthServer": {
195
+ "url": "https://api.example.com/sse/",
196
+ "oauth": {
197
+ "enabled": true,
198
+ "clientId": "your-client-id",
199
+ "clientSecret": "your-client-secret",
200
+ "authorizationUrl": "https://provider.example.com/authorize",
201
+ "tokenUrl": "https://provider.example.com/token",
202
+ "redirectUri": "https://your-server.com/oauth/callback",
203
+ "scopes": ["read", "write"]
204
+ }
205
+ }
206
+ }
207
+ }
208
+ ```
209
+
210
+ OAuth configuration properties:
211
+
212
+ | Property | Description |
213
+ | ------------------ | --------------------------------------------------------------------------------------------------------------------- |
214
+ | `enabled` | Enable OAuth for this server (boolean) |
215
+ | `clientId` | OAuth client identifier (string, optional with dynamic registration) |
216
+ | `clientSecret` | OAuth client secret (string, optional for public clients) |
217
+ | `authorizationUrl` | OAuth authorization endpoint (string, auto-discovered if omitted) |
218
+ | `tokenUrl` | OAuth token endpoint (string, auto-discovered if omitted) |
219
+ | `scopes` | Required OAuth scopes (array of strings) |
220
+ | `redirectUri` | Custom redirect URI (string). **Critical for remote deployments**. Defaults to `http://localhost:7777/oauth/callback` |
221
+ | `tokenParamName` | Query parameter name for tokens in SSE URLs (string) |
222
+ | `audiences` | Audiences the token is valid for (array of strings) |
223
+
224
+ #### Token management
225
+
226
+ OAuth tokens are automatically:
227
+
228
+ - **Stored securely** in `~/.qwen/mcp-oauth-tokens.json`
229
+ - **Refreshed** when expired (if refresh tokens are available)
230
+ - **Validated** before each connection attempt
231
+
232
+ Use the `/mcp auth` command within Qwen Code to manage OAuth authentication interactively.
233
+
156
234
  ### Tool filtering (allow/deny tools per server)
157
235
 
158
236
  Use `includeTools` / `excludeTools` to restrict tools exposed by a server (from Qwen Code’s perspective).
@@ -259,20 +337,28 @@ You can always configure MCP servers by manually editing `settings.json`, but th
259
337
  qwen mcp add [options] <name> <commandOrUrl> [args...]
260
338
  ```
261
339
 
262
- | Argument/Option | Description | Default | Example |
263
- | ------------------- | ------------------------------------------------------------------- | ------------------ | ----------------------------------------- |
264
- | `<name>` | A unique name for the server. | — | `example-server` |
265
- | `<commandOrUrl>` | The command to execute (for `stdio`) or the URL (for `http`/`sse`). | — | `/usr/bin/python` or `http://localhost:8` |
266
- | `[args...]` | Optional arguments for a `stdio` command. | — | `--port 5000` |
267
- | `-s`, `--scope` | Configuration scope (user or project). | `project` | `-s user` |
268
- | `-t`, `--transport` | Transport type (`stdio`, `sse`, `http`). | `stdio` | `-t sse` |
269
- | `-e`, `--env` | Set environment variables. | — | `-e KEY=value` |
270
- | `-H`, `--header` | Set HTTP headers for SSE and HTTP transports. | — | `-H "X-Api-Key: abc123"` |
271
- | `--timeout` | Set connection timeout in milliseconds. | — | `--timeout 30000` |
272
- | `--trust` | Trust the server (bypass all tool call confirmation prompts). | — (`false`) | `--trust` |
273
- | `--description` | Set the description for the server. | — | `--description "Local tools"` |
274
- | `--include-tools` | A comma-separated list of tools to include. | all tools included | `--include-tools mytool,othertool` |
275
- | `--exclude-tools` | A comma-separated list of tools to exclude. | none | `--exclude-tools mytool` |
340
+ | Argument/Option | Description | Default | Example |
341
+ | --------------------------- | ------------------------------------------------------------------- | -------------------------------------- | ------------------------------------------------------------------ |
342
+ | `<name>` | A unique name for the server. | — | `example-server` |
343
+ | `<commandOrUrl>` | The command to execute (for `stdio`) or the URL (for `http`/`sse`). | — | `/usr/bin/python` or `http://localhost:8` |
344
+ | `[args...]` | Optional arguments for a `stdio` command. | — | `--port 5000` |
345
+ | `-s`, `--scope` | Configuration scope (user or project). | `project` | `-s user` |
346
+ | `-t`, `--transport` | Transport type (`stdio`, `sse`, `http`). | `stdio` | `-t sse` |
347
+ | `-e`, `--env` | Set environment variables. | — | `-e KEY=value` |
348
+ | `-H`, `--header` | Set HTTP headers for SSE and HTTP transports. | — | `-H "X-Api-Key: abc123"` |
349
+ | `--timeout` | Set connection timeout in milliseconds. | — | `--timeout 30000` |
350
+ | `--trust` | Trust the server (bypass all tool call confirmation prompts). | — (`false`) | `--trust` |
351
+ | `--description` | Set the description for the server. | — | `--description "Local tools"` |
352
+ | `--include-tools` | A comma-separated list of tools to include. | all tools included | `--include-tools mytool,othertool` |
353
+ | `--exclude-tools` | A comma-separated list of tools to exclude. | none | `--exclude-tools mytool` |
354
+ | `--oauth-client-id` | OAuth client ID for MCP server authentication. | — | `--oauth-client-id your-client-id` |
355
+ | `--oauth-client-secret` | OAuth client secret for MCP server authentication. | — | `--oauth-client-secret your-client-secret` |
356
+ | `--oauth-redirect-uri` | OAuth redirect URI for authentication callback. | `http://localhost:7777/oauth/callback` | `--oauth-redirect-uri https://your-server.com/oauth/callback` |
357
+ | `--oauth-authorization-url` | OAuth authorization URL. | — | `--oauth-authorization-url https://provider.example.com/authorize` |
358
+ | `--oauth-token-url` | OAuth token URL. | — | `--oauth-token-url https://provider.example.com/token` |
359
+ | `--oauth-scopes` | OAuth scopes (comma-separated). | — | `--oauth-scopes scope1,scope2` |
360
+
361
+ > `--oauth-*` flags apply only to `--transport sse` and `--transport http`. Combining them with `--transport stdio` is rejected.
276
362
 
277
363
  #### Removing a server (`qwen mcp remove`)
278
364
 
@@ -0,0 +1,168 @@
1
+ # Memory
2
+
3
+ Every Qwen Code session starts with a fresh context window. Two mechanisms carry knowledge across sessions so you don't have to re-explain yourself every time:
4
+
5
+ - **QWEN.md** — instructions _you_ write once and Qwen reads every session
6
+ - **Auto-memory** — notes Qwen writes itself based on what it learns from you
7
+
8
+ ---
9
+
10
+ ## QWEN.md: your instructions to Qwen
11
+
12
+ QWEN.md is a plain text file where you write things Qwen should always know about your project or your preferences. Think of it as a permanent briefing that loads at the start of every conversation.
13
+
14
+ ### What to put in QWEN.md
15
+
16
+ Add things you'd otherwise have to repeat every session:
17
+
18
+ - Build and test commands (`npm run test`, `make build`)
19
+ - Coding conventions your team follows ("all new files must have JSDoc comments")
20
+ - Architectural decisions ("we use the repository pattern, never call the database directly from controllers")
21
+ - Personal preferences ("always use pnpm, not npm")
22
+
23
+ Don't include things Qwen can figure out by reading your code. QWEN.md works best when it's short and specific — the longer it gets, the less reliably Qwen follows it.
24
+
25
+ ### Where to create QWEN.md
26
+
27
+ | File | Who it applies to |
28
+ | ----------------------------- | --------------------------------------------- |
29
+ | `~/.qwen/QWEN.md` | You, across all your projects |
30
+ | `QWEN.md` in the project root | Your whole team (commit it to source control) |
31
+
32
+ You can have both. Qwen loads all QWEN.md files it finds when you start a session — your personal one plus any in the project.
33
+
34
+ If your repository already has an `AGENTS.md` file for other AI tools, Qwen reads that too. No need to duplicate instructions.
35
+
36
+ ### Generate one automatically with `/init`
37
+
38
+ Run `/init` and Qwen will analyze your codebase to create a starter QWEN.md with build commands, test instructions, and conventions it finds. If one already exists, it suggests additions instead of overwriting.
39
+
40
+ ### Reference other files
41
+
42
+ You can point QWEN.md at other files so Qwen reads them too:
43
+
44
+ ```markdown
45
+ See @README.md for project overview.
46
+
47
+ # Conventions
48
+
49
+ - Git workflow: @docs/git-workflow.md
50
+ ```
51
+
52
+ Use `@path/to/file` anywhere in QWEN.md. Relative paths resolve from the QWEN.md file itself.
53
+
54
+ ---
55
+
56
+ ## Auto-memory: what Qwen learns about you
57
+
58
+ Auto-memory runs in the background. After each of your conversations, Qwen quietly saves useful things it learned — your preferences, feedback you gave, project context — so it can use them in future sessions without you repeating yourself.
59
+
60
+ This is different from QWEN.md: you don't write it, Qwen does.
61
+
62
+ ### What Qwen saves
63
+
64
+ Qwen looks for four kinds of things worth remembering:
65
+
66
+ | What | Examples |
67
+ | ----------------------- | -------------------------------------------------------- |
68
+ | **About you** | Your role, background, how you like to work |
69
+ | **Your feedback** | Corrections you made, approaches you confirmed |
70
+ | **Project context** | Ongoing work, decisions, goals not obvious from the code |
71
+ | **External references** | Dashboards, ticket trackers, docs links you mentioned |
72
+
73
+ Qwen doesn't save everything — only things that would actually be useful next time.
74
+
75
+ ### Where it's stored
76
+
77
+ Auto-memory files live at `~/.qwen/projects/<project>/memory/`. All branches and worktrees of the same repository share the same memory folder, so what Qwen learns in one branch is available in others.
78
+
79
+ Everything saved is plain markdown — you can open, edit, or delete any file at any time.
80
+
81
+ ### Periodic cleanup
82
+
83
+ Qwen periodically goes through its saved memories to remove duplicates and clean up outdated entries. This runs automatically in the background once a day after enough sessions have accumulated. You can trigger it manually with `/dream` if you want it to run now.
84
+
85
+ While cleanup is running, **✦ dreaming** appears in the corner of the screen. Your session continues normally.
86
+
87
+ ### Turning it on or off
88
+
89
+ Auto-memory is on by default. To toggle it, open `/memory` and use the switches at the top. You can turn off just the automatic saving, just the periodic cleanup, or both.
90
+
91
+ You can also set them in `~/.qwen/settings.json` (applies to all projects) or `.qwen/settings.json` (this project only):
92
+
93
+ ```json
94
+ {
95
+ "memory": {
96
+ "enableManagedAutoMemory": true,
97
+ "enableManagedAutoDream": true
98
+ }
99
+ }
100
+ ```
101
+
102
+ ---
103
+
104
+ ## Commands
105
+
106
+ ### `/memory`
107
+
108
+ Opens the Memory panel. From here you can:
109
+
110
+ - Turn auto-memory saving on or off
111
+ - Turn periodic cleanup (dream) on or off
112
+ - Open your personal QWEN.md (`~/.qwen/QWEN.md`)
113
+ - Open the project QWEN.md
114
+ - Browse the auto-memory folder
115
+
116
+ ### `/init`
117
+
118
+ Generates a starter QWEN.md for your project. Qwen reads your codebase and fills in build commands, test instructions, and conventions it discovers.
119
+
120
+ ### `/remember <text>`
121
+
122
+ Immediately saves something to auto-memory without waiting for Qwen to pick it up automatically:
123
+
124
+ ```
125
+ /remember always use snake_case for Python variable names
126
+ /remember the staging environment is at staging.example.com
127
+ ```
128
+
129
+ ### `/forget <text>`
130
+
131
+ Removes auto-memory entries that match your description:
132
+
133
+ ```
134
+ /forget old workaround for the login bug
135
+ ```
136
+
137
+ ### `/dream`
138
+
139
+ Runs the memory cleanup now instead of waiting for the automatic schedule:
140
+
141
+ ```
142
+ /dream
143
+ ```
144
+
145
+ ---
146
+
147
+ ## Troubleshooting
148
+
149
+ ### Qwen isn't following my QWEN.md
150
+
151
+ Open `/memory` to see which files are loaded. If your file isn't listed, Qwen can't see it — make sure it's in the project root or `~/.qwen/`.
152
+
153
+ Instructions work better when they're specific:
154
+
155
+ - ✓ `Use 2-space indentation for TypeScript files`
156
+ - ✗ `Format code nicely`
157
+
158
+ If you have multiple QWEN.md files with conflicting instructions, Qwen may behave inconsistently. Review them and remove any contradictions.
159
+
160
+ ### I want to see what Qwen has saved
161
+
162
+ Run `/memory` and select **Open auto-memory folder**. All saved memories are readable markdown files you can browse, edit, or delete.
163
+
164
+ ### Qwen keeps forgetting things
165
+
166
+ If auto-memory is on but Qwen doesn't seem to remember things across sessions, try running `/dream` to force a cleanup pass. Also check `/memory` to confirm both toggles are enabled.
167
+
168
+ For things you always want Qwen to remember, add them to QWEN.md instead — auto-memory is best-effort, QWEN.md is guaranteed.
@@ -103,8 +103,16 @@ qwen -p "run the test suite"
103
103
 
104
104
  - **CLI flag**: `--sandbox-image <image>`
105
105
  - **Environment variable**: `QWEN_SANDBOX_IMAGE=<image>`
106
+ - **Settings file**: `tools.sandboxImage` in your `settings.json` (e.g., `{"tools": {"sandboxImage": "ghcr.io/qwenlm/qwen-code:0.14.1"}}`)
106
107
 
107
- If you don’t set either, Qwen Code uses the default image configured in the CLI package (for example `ghcr.io/qwenlm/qwen-code:<version>`).
108
+ Priority order (highest to lowest):
109
+
110
+ 1. `--sandbox-image`
111
+ 2. `QWEN_SANDBOX_IMAGE`
112
+ 3. `tools.sandboxImage`
113
+ 4. Built-in default image from the CLI package (for example `ghcr.io/qwenlm/qwen-code:<version>`)
114
+
115
+ `settings.env.QWEN_SANDBOX_IMAGE` also works as a generic env injection mechanism, but `tools.sandboxImage` is the preferred persistent setting.
108
116
 
109
117
  ### macOS Seatbelt profiles
110
118
 
@@ -5,14 +5,21 @@
5
5
  The status line lets you run a shell command whose output is displayed in the footer's left section. The command receives structured JSON context via stdin, so it can show session-aware information like the current model, token usage, git branch, or anything else you can script.
6
6
 
7
7
  ```
8
- With status line (default approval mode — 1 row):
8
+ Single-line status (default approval mode — 1 row):
9
9
  ┌─────────────────────────────────────────────────────────────────┐
10
10
  │ user@host ~/project (main) ctx:34% 🔒 docker | Debug | 67% │ ← status line
11
11
  └─────────────────────────────────────────────────────────────────┘
12
12
 
13
- With status line + non-default mode (2 rows):
13
+ Multi-line status (up to 2 lines 2 rows):
14
14
  ┌─────────────────────────────────────────────────────────────────┐
15
- │ user@host ~/project (main) ctx:34% 🔒 docker | Debug | 67% │ ← status line
15
+ │ user@host ~/project (main) ctx:34% 🔒 docker | Debug | 67% │ ← status line 1
16
+ │ ████████░░░░░░░░░░ 34% context │ ← status line 2
17
+ └─────────────────────────────────────────────────────────────────┘
18
+
19
+ Multi-line status + non-default mode (3 rows max):
20
+ ┌─────────────────────────────────────────────────────────────────┐
21
+ │ user@host ~/project (main) ctx:34% 🔒 docker | Debug | 67% │ ← status line 1
22
+ │ ████████░░░░░░░░░░ 34% context │ ← status line 2
16
23
  │ auto-accept edits (shift + tab to cycle) │ ← mode indicator
17
24
  └─────────────────────────────────────────────────────────────────┘
18
25
  ```
@@ -53,10 +60,11 @@ Add a `statusLine` object under the `ui` key in `~/.qwen/settings.json`:
53
60
  }
54
61
  ```
55
62
 
56
- | Field | Type | Required | Description |
57
- | --------- | ----------- | -------- | ------------------------------------------------------------------------------------- |
58
- | `type` | `"command"` | Yes | Must be `"command"` |
59
- | `command` | string | Yes | Shell command to execute. Receives JSON via stdin, first line of stdout is displayed. |
63
+ | Field | Type | Required | Description |
64
+ | ----------------- | ----------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- |
65
+ | `type` | `"command"` | Yes | Must be `"command"` |
66
+ | `command` | string | Yes | Shell command to execute. Receives JSON via stdin, stdout is displayed (up to 2 lines). |
67
+ | `refreshInterval` | number | No | Re-run the command every N seconds (minimum 1). Useful for data that changes without an Agent state event (clock, quota, uptime). |
60
68
 
61
69
  ## JSON input
62
70
 
@@ -181,6 +189,24 @@ Output: `my-project (main)`
181
189
 
182
190
  Output: `+120/-30 lines`
183
191
 
192
+ ### Live clock and git branch
193
+
194
+ Use `refreshInterval` when the statusline shows data that changes without an Agent event (e.g. the clock, uptime, or rate-limit counters):
195
+
196
+ ```json
197
+ {
198
+ "ui": {
199
+ "statusLine": {
200
+ "type": "command",
201
+ "command": "input=$(cat); branch=$(echo \"$input\" | jq -r '.git.branch // \"no-git\"'); echo \"$(date +%H:%M:%S) ($branch)\"",
202
+ "refreshInterval": 1
203
+ }
204
+ }
205
+ }
206
+ ```
207
+
208
+ Output (refreshed every second): `14:32:07 (main)`
209
+
184
210
  ### Script file for complex commands
185
211
 
186
212
  For longer commands, save a script file at `~/.qwen/statusline-command.sh`:
@@ -218,9 +244,9 @@ Then reference it in settings:
218
244
 
219
245
  ## Behavior
220
246
 
221
- - **Update triggers**: The status line updates when the model changes, a new message is sent (token count changes), vim mode is toggled, git branch changes, tool calls complete, or file changes occur. Updates are debounced (300ms).
247
+ - **Update triggers**: The status line updates when the model changes, a new message is sent (token count changes), vim mode is toggled, git branch changes, tool calls complete, or file changes occur. Updates are debounced (300ms). Set `refreshInterval` (seconds) to additionally re-run the command on a timer — useful for data that changes without an Agent event (clock, rate limits, build status).
222
248
  - **Timeout**: Commands that take longer than 5 seconds are killed. The status line clears on failure.
223
- - **Output**: Only the first line of stdout is used. The text is rendered with dimmed colors in the footer's left section and truncated if it exceeds the available width.
249
+ - **Output**: Multi-line output is supported (up to 2 lines; extra lines are discarded). Each line is rendered as a separate row with dimmed colors in the footer's left section. Lines that exceed the available width are truncated.
224
250
  - **Hot reload**: Changes to `ui.statusLine` in settings take effect immediately — no restart required.
225
251
  - **Shell**: Commands run via `/bin/sh` on macOS/Linux. On Windows, `cmd.exe` is used by default — wrap POSIX commands with `bash -c "..."` or point to a bash script (e.g. `bash ~/.qwen/statusline-command.sh`).
226
252
  - **Removal**: Delete the `ui.statusLine` key from settings to disable. The "? for shortcuts" hint returns.
@@ -231,5 +257,5 @@ Then reference it in settings:
231
257
  | ----------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
232
258
  | Status line not showing | Config at wrong path | Must be under `ui.statusLine`, not root-level `statusLine` |
233
259
  | Empty output | Command fails silently | Test manually: `echo '{"session_id":"test","version":"0.14.1","model":{"display_name":"test"},"context_window":{"context_window_size":0,"used_percentage":0,"remaining_percentage":100,"current_usage":0,"total_input_tokens":0,"total_output_tokens":0},"workspace":{"current_dir":"/tmp"},"metrics":{"models":{},"files":{"total_lines_added":0,"total_lines_removed":0}}}' \| sh -c 'your_command'` |
234
- | Stale data | No trigger fired | Send a message or switch models to trigger an update |
260
+ | Stale data | No trigger fired | Send a message or switch models to trigger an update — or set `refreshInterval` to re-run the command on a timer |
235
261
  | Command too slow | Complex script | Optimize the script or move heavy work to a background cache |
@@ -12,10 +12,46 @@ Subagents are independent AI assistants that:
12
12
  - **Work autonomously** - Once given a task, they work independently until completion or failure
13
13
  - **Provide detailed feedback** - You can see their progress, tool usage, and execution statistics in real-time
14
14
 
15
+ ## Fork Subagent (Implicit Fork)
16
+
17
+ In addition to named subagents, Qwen Code supports **implicit forking** — when the AI omits the `subagent_type` parameter, it triggers a fork that inherits the parent's full conversation context.
18
+
19
+ ### How Fork Differs from Named Subagents
20
+
21
+ | | Named Subagent | Fork Subagent |
22
+ | ------------- | --------------------------------- | ----------------------------------------------------- |
23
+ | Context | Starts fresh, no parent history | Inherits parent's full conversation history |
24
+ | System prompt | Uses its own configured prompt | Uses parent's exact system prompt (for cache sharing) |
25
+ | Execution | Blocks the parent until done | Runs in background, parent continues immediately |
26
+ | Use case | Specialized tasks (testing, docs) | Parallel tasks that need the current context |
27
+
28
+ ### When Fork is Used
29
+
30
+ The AI automatically uses fork when it needs to:
31
+
32
+ - Run multiple research tasks in parallel (e.g., "investigate module A, B, and C")
33
+ - Perform background work while continuing the main conversation
34
+ - Delegate tasks that require understanding of the current conversation context
35
+
36
+ ### Prompt Cache Sharing
37
+
38
+ All forks share the parent's exact API request prefix (system prompt, tools, conversation history), enabling DashScope prompt cache hits. When 3 forks run in parallel, the shared prefix is cached once and reused — saving 80%+ token costs compared to independent subagents.
39
+
40
+ ### Recursive Fork Prevention
41
+
42
+ Fork children cannot create further forks. This is enforced at runtime — if a fork attempts to spawn another fork, it receives an error instructing it to execute tasks directly.
43
+
44
+ ### Current Limitations
45
+
46
+ - **No result feedback**: Fork results are reflected in the UI progress display but are not automatically fed back into the main conversation. The parent AI sees a placeholder message and cannot act on the fork's output.
47
+ - **No worktree isolation**: Forks share the parent's working directory. Concurrent file modifications from multiple forks may conflict.
48
+
15
49
  ## Key Benefits
16
50
 
17
51
  - **Task Specialization**: Create agents optimized for specific workflows (testing, documentation, refactoring, etc.)
18
52
  - **Context Isolation**: Keep specialized work separate from your main conversation
53
+ - **Context Inheritance**: Fork subagents inherit the full conversation for context-heavy parallel tasks
54
+ - **Prompt Cache Sharing**: Fork subagents share the parent's cache prefix, reducing token costs
19
55
  - **Reusability**: Save and reuse agent configurations across projects and sessions
20
56
  - **Controlled Access**: Limit which tools each agent can use for security and focus
21
57
  - **Progress Visibility**: Monitor agent execution with real-time progress updates
@@ -23,7 +59,7 @@ Subagents are independent AI assistants that:
23
59
  ## How Subagents Work
24
60
 
25
61
  1. **Configuration**: You create Subagents configurations that define their behavior, tools, and system prompts
26
- 2. **Delegation**: The main AI can automatically delegate tasks to appropriate Subagents
62
+ 2. **Delegation**: The main AI can automatically delegate tasks to appropriate Subagents — or implicitly fork when no specific subagent type is needed
27
63
  3. **Execution**: Subagents work independently, using their configured tools to complete tasks
28
64
  4. **Results**: They return results and execution summaries back to the main conversation
29
65
 
@@ -99,10 +135,12 @@ Subagents are configured using Markdown files with YAML frontmatter. This format
99
135
  name: agent-name
100
136
  description: Brief description of when and how to use this agent
101
137
  model: inherit # Optional: inherit or model-id
102
- tools:
103
- - tool1
104
- - tool2
105
- - tool3 # Optional
138
+ approvalMode: auto-edit # Optional: default, plan, auto-edit, yolo
139
+ tools: # Optional: allowlist of tools
140
+ - tool1
141
+ - tool2
142
+ disallowedTools: # Optional: blocklist of tools
143
+ - tool3
106
144
  ---
107
145
 
108
146
  System prompt content goes here.
@@ -118,6 +156,87 @@ Use the optional `model` frontmatter field to control which model a subagent use
118
156
  - `glm-5`: Use that model ID with the main conversation's auth type
119
157
  - `openai:gpt-4o`: Use a different provider (resolves credentials from env vars)
120
158
 
159
+ #### Permission Mode
160
+
161
+ Use the optional `approvalMode` frontmatter field to control how a subagent's tool calls are approved. Valid values:
162
+
163
+ - `default`: Tools require interactive approval (same as the main session default)
164
+ - `plan`: Analyze-only mode — the agent plans but does not execute changes
165
+ - `auto-edit`: Tools are auto-approved without prompting (recommended for most agents)
166
+ - `yolo`: All tools auto-approved, including potentially destructive ones
167
+
168
+ If you omit this field, the subagent's permission mode is determined automatically:
169
+
170
+ - If the parent session is in **yolo** or **auto-edit** mode, the subagent inherits that mode. A permissive parent stays permissive.
171
+ - If the parent session is in **plan** mode, the subagent stays in plan mode. An analyze-only session cannot mutate files through a delegated agent.
172
+ - If the parent session is in **default** mode (in a trusted folder), the subagent gets **auto-edit** so it can work autonomously.
173
+
174
+ When you do set `approvalMode`, the parent's permissive modes still take priority. For example, if the parent is in yolo mode, a subagent with `approvalMode: plan` will still run in yolo mode.
175
+
176
+ ```
177
+ ---
178
+ name: cautious-reviewer
179
+ description: Reviews code without making changes
180
+ approvalMode: plan
181
+ tools:
182
+ - read_file
183
+ - grep_search
184
+ - glob
185
+ ---
186
+
187
+ You are a code reviewer. Analyze the code and report findings.
188
+ Do not modify any files.
189
+ ```
190
+
191
+ #### Tool Configuration
192
+
193
+ Use `tools` and `disallowedTools` to control which tools a subagent can access.
194
+
195
+ **`tools` (allowlist):** When specified, the subagent can only use the listed tools. When omitted, the subagent inherits all available tools from the parent session.
196
+
197
+ ```
198
+ ---
199
+ name: reader
200
+ description: Read-only agent for code exploration
201
+ tools:
202
+ - read_file
203
+ - grep_search
204
+ - glob
205
+ - list_directory
206
+ ---
207
+ ```
208
+
209
+ **`disallowedTools` (blocklist):** When specified, the listed tools are removed from the subagent's tool pool. This is useful when you want "everything except X" without listing every permitted tool.
210
+
211
+ ```
212
+ ---
213
+ name: safe-worker
214
+ description: Agent that cannot modify files
215
+ disallowedTools:
216
+ - write_file
217
+ - edit
218
+ - run_shell_command
219
+ ---
220
+ ```
221
+
222
+ If both `tools` and `disallowedTools` are set, the allowlist is applied first, then the blocklist removes from that set.
223
+
224
+ **MCP tools** follow the same rules. If a subagent has no `tools` list, it inherits all MCP tools from the parent session. If a subagent has an explicit `tools` list, it only gets MCP tools that are explicitly named in that list.
225
+
226
+ The `disallowedTools` field supports MCP server-level patterns:
227
+
228
+ - `mcp__server__tool_name` — blocks a specific MCP tool
229
+ - `mcp__server` — blocks all tools from that MCP server
230
+
231
+ ```
232
+ ---
233
+ name: no-slack
234
+ description: Agent without Slack access
235
+ disallowedTools:
236
+ - mcp__slack
237
+ ---
238
+ ```
239
+
121
240
  #### Example Usage
122
241
 
123
242
  ```
@@ -214,7 +333,6 @@ tools:
214
333
  - read_file
215
334
  - write_file
216
335
  - read_many_files
217
- - web_search
218
336
  ---
219
337
 
220
338
  You are a technical documentation specialist.
@@ -500,7 +618,8 @@ Always follow these standards:
500
618
 
501
619
  ## Security Considerations
502
620
 
503
- - **Tool Restrictions**: Subagents only have access to their configured tools
621
+ - **Tool Restrictions**: Use `tools` to limit which tools a subagent can access, or `disallowedTools` to block specific tools while inheriting everything else
622
+ - **Permission Mode**: Subagents inherit their parent's permission mode by default. Plan-mode sessions cannot escalate to auto-edit through delegated agents. Privileged modes (auto-edit, yolo) are blocked in untrusted folders.
504
623
  - **Sandboxing**: All tool execution follows the same security model as direct tool use
505
624
  - **Audit Trail**: All Subagents actions are logged and visible in real-time
506
625
  - **Access Control**: Project and user-level separation provides appropriate boundaries
@@ -0,0 +1,54 @@
1
+ # Contextual Tips
2
+
3
+ Qwen Code includes a contextual tips system that helps you discover features and stay aware of session state.
4
+
5
+ ## Startup Tips
6
+
7
+ Each time you launch Qwen Code, a tip is shown in the header area. Tips are selected by priority first, then rotated across sessions using LRU (least-recently-used) scheduling among tips of the same priority, so you see a different tip each time.
8
+
9
+ New users see onboarding-focused tips during their first sessions:
10
+
11
+ | Sessions | Example tips |
12
+ | -------- | ---------------------------------------------------- |
13
+ | < 5 | Slash commands (`/`), Tab autocomplete |
14
+ | < 10 | `QWEN.md` project context, `--continue` / `--resume` |
15
+ | < 15 | Shell commands with `!` prefix |
16
+
17
+ After that, tips rotate through general features like `/compress`, `/approval-mode`, `/insight`, `/btw`, and more.
18
+
19
+ ## Post-Response Tips
20
+
21
+ During a conversation, Qwen Code monitors your context window usage and shows tips when action may be needed:
22
+
23
+ | Context usage | Condition | Tip |
24
+ | ------------- | ------------------------------ | ------------------------------------------------- |
25
+ | 50-80% | After a few prompts in session | Suggests `/compress` to free up context |
26
+ | 80-95% | — | Warns context is getting full |
27
+ | >= 95% | — | Urgent: run `/compress` now or `/new` to continue |
28
+
29
+ Post-response tips have per-tip cooldowns to avoid being repetitive.
30
+
31
+ ## Tip History
32
+
33
+ Tip display history is persisted at `~/.qwen/tip_history.json`. This file tracks:
34
+
35
+ - Session count (used for new-user tip selection)
36
+ - Which tips have been shown and when (used for LRU rotation and cooldown)
37
+
38
+ You can safely delete this file to reset tip history.
39
+
40
+ ## Disabling Tips
41
+
42
+ To hide all tips (both startup and post-response), set `ui.hideTips` to `true` in `~/.qwen/settings.json`:
43
+
44
+ ```json
45
+ {
46
+ "ui": {
47
+ "hideTips": true
48
+ }
49
+ }
50
+ ```
51
+
52
+ You can also toggle this in the settings dialog via the `/settings` command.
53
+
54
+ Tips are also automatically hidden when screen reader mode is enabled.