@protolabsai/proto 0.14.0

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 (85) hide show
  1. package/LICENSE +203 -0
  2. package/README.md +286 -0
  3. package/dist/bundled/adversarial-verification/SKILL.md +98 -0
  4. package/dist/bundled/brainstorming/SKILL.md +171 -0
  5. package/dist/bundled/coding-agent-standards/SKILL.md +67 -0
  6. package/dist/bundled/dispatching-parallel-agents/SKILL.md +193 -0
  7. package/dist/bundled/executing-plans/SKILL.md +77 -0
  8. package/dist/bundled/finishing-a-development-branch/SKILL.md +213 -0
  9. package/dist/bundled/loop/SKILL.md +61 -0
  10. package/dist/bundled/qc-helper/SKILL.md +151 -0
  11. package/dist/bundled/qc-helper/docs/_meta.ts +30 -0
  12. package/dist/bundled/qc-helper/docs/common-workflow.md +571 -0
  13. package/dist/bundled/qc-helper/docs/configuration/_meta.ts +10 -0
  14. package/dist/bundled/qc-helper/docs/configuration/auth.md +366 -0
  15. package/dist/bundled/qc-helper/docs/configuration/memory.md +0 -0
  16. package/dist/bundled/qc-helper/docs/configuration/model-providers.md +542 -0
  17. package/dist/bundled/qc-helper/docs/configuration/qwen-ignore.md +55 -0
  18. package/dist/bundled/qc-helper/docs/configuration/settings.md +652 -0
  19. package/dist/bundled/qc-helper/docs/configuration/themes.md +160 -0
  20. package/dist/bundled/qc-helper/docs/configuration/trusted-folders.md +61 -0
  21. package/dist/bundled/qc-helper/docs/extension/_meta.ts +9 -0
  22. package/dist/bundled/qc-helper/docs/extension/extension-releasing.md +121 -0
  23. package/dist/bundled/qc-helper/docs/extension/getting-started-extensions.md +299 -0
  24. package/dist/bundled/qc-helper/docs/extension/introduction.md +303 -0
  25. package/dist/bundled/qc-helper/docs/features/_meta.ts +18 -0
  26. package/dist/bundled/qc-helper/docs/features/approval-mode.md +263 -0
  27. package/dist/bundled/qc-helper/docs/features/arena.md +218 -0
  28. package/dist/bundled/qc-helper/docs/features/checkpointing.md +77 -0
  29. package/dist/bundled/qc-helper/docs/features/commands.md +312 -0
  30. package/dist/bundled/qc-helper/docs/features/headless.md +318 -0
  31. package/dist/bundled/qc-helper/docs/features/hooks.md +343 -0
  32. package/dist/bundled/qc-helper/docs/features/language.md +139 -0
  33. package/dist/bundled/qc-helper/docs/features/lsp.md +453 -0
  34. package/dist/bundled/qc-helper/docs/features/mcp.md +281 -0
  35. package/dist/bundled/qc-helper/docs/features/sandbox.md +241 -0
  36. package/dist/bundled/qc-helper/docs/features/scheduled-tasks.md +139 -0
  37. package/dist/bundled/qc-helper/docs/features/skills.md +289 -0
  38. package/dist/bundled/qc-helper/docs/features/sub-agents.md +307 -0
  39. package/dist/bundled/qc-helper/docs/features/token-caching.md +29 -0
  40. package/dist/bundled/qc-helper/docs/ide-integration/_meta.ts +4 -0
  41. package/dist/bundled/qc-helper/docs/ide-integration/ide-companion-spec.md +182 -0
  42. package/dist/bundled/qc-helper/docs/ide-integration/ide-integration.md +144 -0
  43. package/dist/bundled/qc-helper/docs/integration-github-action.md +241 -0
  44. package/dist/bundled/qc-helper/docs/integration-jetbrains.md +81 -0
  45. package/dist/bundled/qc-helper/docs/integration-vscode.md +39 -0
  46. package/dist/bundled/qc-helper/docs/integration-zed.md +72 -0
  47. package/dist/bundled/qc-helper/docs/overview.md +64 -0
  48. package/dist/bundled/qc-helper/docs/quickstart.md +273 -0
  49. package/dist/bundled/qc-helper/docs/reference/_meta.ts +4 -0
  50. package/dist/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +72 -0
  51. package/dist/bundled/qc-helper/docs/reference/sdk-api.md +524 -0
  52. package/dist/bundled/qc-helper/docs/support/Uninstall.md +42 -0
  53. package/dist/bundled/qc-helper/docs/support/_meta.ts +6 -0
  54. package/dist/bundled/qc-helper/docs/support/tos-privacy.md +112 -0
  55. package/dist/bundled/qc-helper/docs/support/troubleshooting.md +123 -0
  56. package/dist/bundled/receiving-code-review/SKILL.md +226 -0
  57. package/dist/bundled/requesting-code-review/SKILL.md +115 -0
  58. package/dist/bundled/review/SKILL.md +123 -0
  59. package/dist/bundled/subagent-driven-development/SKILL.md +292 -0
  60. package/dist/bundled/subagent-driven-development/code-quality-reviewer-prompt.md +27 -0
  61. package/dist/bundled/subagent-driven-development/implementer-prompt.md +113 -0
  62. package/dist/bundled/subagent-driven-development/spec-reviewer-prompt.md +61 -0
  63. package/dist/bundled/systematic-debugging/SKILL.md +305 -0
  64. package/dist/bundled/test-driven-development/SKILL.md +396 -0
  65. package/dist/bundled/using-git-worktrees/SKILL.md +223 -0
  66. package/dist/bundled/using-superpowers/SKILL.md +117 -0
  67. package/dist/bundled/verification-before-completion/SKILL.md +147 -0
  68. package/dist/bundled/writing-plans/SKILL.md +159 -0
  69. package/dist/bundled/writing-skills/SKILL.md +716 -0
  70. package/dist/cli.js +483432 -0
  71. package/dist/sandbox-macos-permissive-closed.sb +32 -0
  72. package/dist/sandbox-macos-permissive-open.sb +27 -0
  73. package/dist/sandbox-macos-permissive-proxied.sb +37 -0
  74. package/dist/sandbox-macos-restrictive-closed.sb +93 -0
  75. package/dist/sandbox-macos-restrictive-open.sb +96 -0
  76. package/dist/sandbox-macos-restrictive-proxied.sb +98 -0
  77. package/dist/vendor/ripgrep/COPYING +3 -0
  78. package/dist/vendor/ripgrep/arm64-darwin/rg +0 -0
  79. package/dist/vendor/ripgrep/arm64-linux/rg +0 -0
  80. package/dist/vendor/ripgrep/x64-darwin/rg +0 -0
  81. package/dist/vendor/ripgrep/x64-linux/rg +0 -0
  82. package/dist/vendor/ripgrep/x64-win32/rg.exe +0 -0
  83. package/dist/vendor/tree-sitter/tree-sitter-bash.wasm +0 -0
  84. package/dist/vendor/tree-sitter/tree-sitter.wasm +0 -0
  85. package/package.json +143 -0
@@ -0,0 +1,218 @@
1
+ # Agent Arena
2
+
3
+ > Dispatch multiple AI models simultaneously to execute the same task, compare their solutions side-by-side, and select the best result to apply to your workspace.
4
+
5
+ > [!warning]
6
+ > Agent Arena is experimental. It has [known limitations](#limitations) around display modes and session management.
7
+
8
+ Agent Arena lets you pit multiple AI models against each other on the same task. Each model runs as a fully independent agent in its own isolated Git worktree, so file operations never interfere. When all agents finish, you compare results and select a winner to merge back into your main workspace.
9
+
10
+ Unlike [subagents](/users/features/sub-agents), which delegate focused subtasks within a single session, Arena agents are complete, top-level agent instances — each with its own model, context window, and full tool access.
11
+
12
+ This page covers:
13
+
14
+ - [When to use Agent Arena](#when-to-use-agent-arena)
15
+ - [Starting an arena session](#start-an-arena-session)
16
+ - [Interacting with agents](#interact-with-agents), including display modes and navigation
17
+ - [Comparing results and selecting a winner](#compare-results-and-select-a-winner)
18
+ - [Best practices](#best-practices)
19
+
20
+ ## When to use Agent Arena
21
+
22
+ Agent Arena is most effective when you want to **evaluate or compare** how different models tackle the same problem. The strongest use cases are:
23
+
24
+ - **Model benchmarking**: Evaluate different models' capabilities on real tasks in your actual codebase, not synthetic benchmarks
25
+ - **Best-of-N selection**: Get multiple independent solutions and pick the best implementation
26
+ - **Exploring approaches**: See how different models reason about and solve the same problem — useful for learning and insight
27
+ - **Risk reduction**: For critical changes, validate that multiple models converge on a similar approach before committing
28
+
29
+ Agent Arena uses significantly more tokens than a single session (each agent has its own context window and model calls). It works best when the value of comparison justifies the cost. For routine tasks where you trust your default model, a single session is more efficient.
30
+
31
+ ## Start an arena session
32
+
33
+ Use the `/arena` slash command to launch a session. Specify the models you want to compete and the task:
34
+
35
+ ```
36
+ /arena --models qwen3.5-plus,glm-5,kimi-k2.5 "Refactor the authentication module to use JWT tokens"
37
+ ```
38
+
39
+ If you omit `--models`, an interactive model selection dialog appears, letting you pick from your configured providers.
40
+
41
+ ### What happens when you start
42
+
43
+ 1. **Worktree setup**: Qwen Code creates isolated Git worktrees for each agent at `~/.qwen/arena/<session-id>/worktrees/<model-name>/`. Each worktree mirrors your current working directory state exactly — including staged changes, unstaged changes, and untracked files.
44
+ 2. **Agent spawning**: Each agent starts in its own worktree with full tool access and its configured model. Agents are launched sequentially but execute in parallel.
45
+ 3. **Execution**: All agents work on the task independently with no shared state or communication. You can monitor their progress and interact with any of them.
46
+ 4. **Completion**: When all agents finish (or fail), you enter the result comparison phase.
47
+
48
+ ## Interact with agents
49
+
50
+ ### Display modes
51
+
52
+ Agent Arena currently supports **in-process mode**, where all agents run asynchronously within the same terminal process. A tab bar at the bottom of the terminal lets you switch between agents.
53
+
54
+ > [!note]
55
+ > **Split-pane display modes are planned for the future.** We intend to support tmux-based and iTerm2-based split-pane layouts, where each agent gets its own terminal pane for true side-by-side viewing. Currently, only in-process tab switching is available.
56
+
57
+ ### Navigate between agents
58
+
59
+ In in-process mode, use keyboard shortcuts to switch between agent views:
60
+
61
+ | Shortcut | Action |
62
+ | :------- | :-------------------------------- |
63
+ | `Right` | Switch to the next agent tab |
64
+ | `Left` | Switch to the previous agent tab |
65
+ | `Up` | Switch focus to the input box |
66
+ | `Down` | Switch focus to the agent tab bar |
67
+
68
+ The tab bar shows each agent's current status:
69
+
70
+ | Indicator | Meaning |
71
+ | :-------- | :--------------------- |
72
+ | `●` | Running or idle |
73
+ | `✓` | Completed successfully |
74
+ | `✗` | Failed |
75
+ | `○` | Cancelled |
76
+
77
+ ### Interact with individual agents
78
+
79
+ When viewing an agent's tab, you can:
80
+
81
+ - **Send messages** — type in the input area to give the agent additional instructions
82
+ - **Approve tool calls** — if an agent requests tool approval, the confirmation dialog appears in its tab
83
+ - **View full history** — scroll through the agent's complete conversation, including model output, tool calls, and results
84
+
85
+ Each agent is a full, independent session. Anything you can do with the main agent, you can do with an arena agent.
86
+
87
+ ## Compare results and select a winner
88
+
89
+ When all agents complete, the Arena enters the result comparison phase. You'll see:
90
+
91
+ - **Status summary**: Which agents succeeded, failed, or were cancelled
92
+ - **Execution metrics**: Duration, rounds of reasoning, token usage, and tool call counts for each agent
93
+
94
+ A selection dialog presents the successful agents. Choose one to apply its changes to your main workspace, or discard all results.
95
+
96
+ ### What happens when you select a winner
97
+
98
+ 1. The winning agent's changes are extracted as a diff against the baseline
99
+ 2. The diff is applied to your main working directory
100
+ 3. All worktrees and temporary branches are cleaned up automatically
101
+
102
+ If you want to inspect results before deciding, each agent's full conversation history is available via the tab bar while the selection dialog is active.
103
+
104
+ ## Configuration
105
+
106
+ Arena behavior can be customized in [settings.json](/users/configuration/settings):
107
+
108
+ ```json
109
+ {
110
+ "arena": {
111
+ "worktreeBaseDir": "~/.qwen/arena",
112
+ "maxRoundsPerAgent": 50,
113
+ "timeoutSeconds": 600
114
+ }
115
+ }
116
+ ```
117
+
118
+ | Setting | Description | Default |
119
+ | :------------------------ | :--------------------------------- | :-------------- |
120
+ | `arena.worktreeBaseDir` | Base directory for arena worktrees | `~/.qwen/arena` |
121
+ | `arena.maxRoundsPerAgent` | Maximum reasoning rounds per agent | `50` |
122
+ | `arena.timeoutSeconds` | Timeout for each agent in seconds | `600` |
123
+
124
+ ## Best practices
125
+
126
+ ### Choose models that complement each other
127
+
128
+ Arena is most valuable when you compare models with meaningfully different strengths. For example:
129
+
130
+ ```
131
+ /arena --models qwen3.5-plus,glm-5,kimi-k2.5 "Optimize the database query layer"
132
+ ```
133
+
134
+ Comparing three versions of the same model family yields less insight than comparing across providers.
135
+
136
+ ### Keep tasks self-contained
137
+
138
+ Arena agents work independently with no communication. Tasks should be fully describable in the prompt without requiring back-and-forth:
139
+
140
+ **Good**: "Refactor the payment module to use the strategy pattern. Update all tests."
141
+
142
+ **Less effective**: "Let's discuss how to improve the payment module" — this benefits from conversation, which is better suited to a single session.
143
+
144
+ ### Limit the number of agents
145
+
146
+ Up to 5 agents can run simultaneously. In practice, 2-3 agents provide the best balance of comparison value to resource cost. More agents means:
147
+
148
+ - Higher token costs (each agent has its own context window)
149
+ - Longer total execution time
150
+ - More results to compare
151
+
152
+ Start with 2-3 and scale up only when the comparison value justifies it.
153
+
154
+ ### Use Arena for high-impact decisions
155
+
156
+ Arena shines when the stakes justify running multiple models:
157
+
158
+ - Choosing an architecture for a new module
159
+ - Selecting an approach for a complex refactor
160
+ - Validating a critical bug fix from multiple angles
161
+
162
+ For routine changes like renaming a variable or updating a config file, a single session is faster and cheaper.
163
+
164
+ ## Troubleshooting
165
+
166
+ ### Agents failing to start
167
+
168
+ - Verify that each model in `--models` is properly configured with valid API credentials
169
+ - Check that your working directory is a Git repository (worktrees require Git)
170
+ - Ensure you have write access to the worktree base directory (`~/.qwen/arena/` by default)
171
+
172
+ ### Worktree creation fails
173
+
174
+ - Run `git worktree list` to check for stale worktrees from previous sessions
175
+ - Clean up stale worktrees with `git worktree prune`
176
+ - Ensure your Git version supports worktrees (`git --version`, requires Git 2.5+)
177
+
178
+ ### Agent takes too long
179
+
180
+ - Increase the timeout: set `arena.timeoutSeconds` in settings
181
+ - Reduce task complexity — Arena tasks should be focused and well-defined
182
+ - Lower `arena.maxRoundsPerAgent` if agents are spending too many rounds
183
+
184
+ ### Applying winner fails
185
+
186
+ - Check for uncommitted changes in your main working directory that might conflict
187
+ - The diff is applied as a patch — merge conflicts are possible if your working directory changed during the session
188
+
189
+ ## Limitations
190
+
191
+ Agent Arena is experimental. Current limitations:
192
+
193
+ - **In-process mode only**: Split-pane display via tmux or iTerm2 is not yet available. All agents run within a single terminal window with tab switching.
194
+ - **No diff preview before selection**: You can view each agent's conversation history, but there is no unified diff viewer to compare solutions side-by-side before picking a winner.
195
+ - **No worktree retention**: Worktrees are always cleaned up after selection. There is no option to preserve them for further inspection.
196
+ - **No session resumption**: Arena sessions cannot be resumed after exiting. If you close the terminal mid-session, worktrees remain on disk and must be cleaned up manually via `git worktree prune`.
197
+ - **Maximum 5 agents**: The hard limit of 5 concurrent agents cannot be changed.
198
+ - **Git repository required**: Arena requires a Git repository for worktree isolation. It cannot be used in non-Git directories.
199
+
200
+ ## Comparison with other multi-agent modes
201
+
202
+ Agent Arena is one of several planned multi-agent modes in Qwen Code. **Agent Team** and **Agent Swarm** are not yet implemented — the table below describes their intended design for reference.
203
+
204
+ | | **Agent Arena** | **Agent Team** (planned) | **Agent Swarm** (planned) |
205
+ | :---------------- | :----------------------------------------------------- | :------------------------------------------------- | :------------------------------------------------------- |
206
+ | **Goal** | Competitive: Find the best solution to the _same_ task | Collaborative: Tackle _different_ aspects together | Batch parallel: Dynamically spawn workers for bulk tasks |
207
+ | **Agents** | Pre-configured models compete independently | Teammates collaborate with assigned roles | Workers spawned on-the-fly, destroyed on completion |
208
+ | **Communication** | No inter-agent communication | Direct peer-to-peer messaging | One-way: results aggregated by parent |
209
+ | **Isolation** | Full: separate Git worktrees | Independent sessions with shared task list | Lightweight ephemeral context per worker |
210
+ | **Output** | One selected solution applied to workspace | Synthesized results from multiple perspectives | Aggregated results from parallel processing |
211
+ | **Best for** | Benchmarking, choosing between model approaches | Research, complex collaboration, cross-layer work | Batch operations, data processing, map-reduce tasks |
212
+
213
+ ## Next steps
214
+
215
+ Explore related approaches for parallel and delegated work:
216
+
217
+ - **Lightweight delegation**: [Subagents](/users/features/sub-agents) handle focused subtasks within your session — better when you don't need model comparison
218
+ - **Manual parallel sessions**: Run multiple Qwen Code sessions yourself in separate terminals with [Git worktrees](https://git-scm.com/docs/git-worktree) for full manual control
@@ -0,0 +1,77 @@
1
+ # Checkpointing
2
+
3
+ Qwen Code includes a Checkpointing feature that automatically saves a snapshot of your project's state before any file modifications are made by AI-powered tools. This allows you to safely experiment with and apply code changes, knowing you can instantly revert back to the state before the tool was run.
4
+
5
+ ## How It Works
6
+
7
+ When you approve a tool that modifies the file system (like `write_file` or `edit`), the CLI automatically creates a "checkpoint." This checkpoint includes:
8
+
9
+ 1. **A Git Snapshot:** A commit is made in a special, shadow Git repository located in your home directory (`~/.qwen/history/<project_hash>`). This snapshot captures the complete state of your project files at that moment. It does **not** interfere with your own project's Git repository.
10
+ 2. **Conversation History:** The entire conversation you've had with the agent up to that point is saved.
11
+ 3. **The Tool Call:** The specific tool call that was about to be executed is also stored.
12
+
13
+ If you want to undo the change or simply go back, you can use the `/restore` command. Restoring a checkpoint will:
14
+
15
+ - Revert all files in your project to the state captured in the snapshot.
16
+ - Restore the conversation history in the CLI.
17
+ - Re-propose the original tool call, allowing you to run it again, modify it, or simply ignore it.
18
+
19
+ All checkpoint data, including the Git snapshot and conversation history, is stored locally on your machine. The Git snapshot is stored in the shadow repository while the conversation history and tool calls are saved in a JSON file in your project's temporary directory, typically located at `~/.qwen/tmp/<project_hash>/checkpoints`.
20
+
21
+ ## Enabling the Feature
22
+
23
+ The Checkpointing feature is disabled by default. To enable it, you can either use a command-line flag or edit your `settings.json` file.
24
+
25
+ ### Using the Command-Line Flag
26
+
27
+ You can enable checkpointing for the current session by using the `--checkpointing` flag when starting Qwen Code:
28
+
29
+ ```bash
30
+ qwen --checkpointing
31
+ ```
32
+
33
+ ### Using the `settings.json` File
34
+
35
+ To enable checkpointing by default for all sessions, you need to edit your `settings.json` file.
36
+
37
+ Add the following key to your `settings.json`:
38
+
39
+ ```json
40
+ {
41
+ "general": {
42
+ "checkpointing": {
43
+ "enabled": true
44
+ }
45
+ }
46
+ }
47
+ ```
48
+
49
+ ## Using the `/restore` Command
50
+
51
+ Once enabled, checkpoints are created automatically. To manage them, you use the `/restore` command.
52
+
53
+ ### List Available Checkpoints
54
+
55
+ To see a list of all saved checkpoints for the current project, simply run:
56
+
57
+ ```
58
+ /restore
59
+ ```
60
+
61
+ The CLI will display a list of available checkpoint files. These file names are typically composed of a timestamp, the name of the file being modified, and the name of the tool that was about to be run (e.g., `2025-06-22T10-00-00_000Z-my-file.txt-write_file`).
62
+
63
+ ### Restore a Specific Checkpoint
64
+
65
+ To restore your project to a specific checkpoint, use the checkpoint file from the list:
66
+
67
+ ```
68
+ /restore <checkpoint_file>
69
+ ```
70
+
71
+ For example:
72
+
73
+ ```
74
+ /restore 2025-06-22T10-00-00_000Z-my-file.txt-write_file
75
+ ```
76
+
77
+ After running the command, your files and conversation will be immediately restored to the state they were in when the checkpoint was created, and the original tool prompt will reappear.
@@ -0,0 +1,312 @@
1
+ # Commands
2
+
3
+ This document details all commands supported by Qwen Code, helping you efficiently manage sessions, customize the interface, and control its behavior.
4
+
5
+ Qwen Code commands are triggered through specific prefixes and fall into three categories:
6
+
7
+ | Prefix Type | Function Description | Typical Use Case |
8
+ | -------------------------- | --------------------------------------------------- | ---------------------------------------------------------------- |
9
+ | Slash Commands (`/`) | Meta-level control of Qwen Code itself | Managing sessions, modifying settings, getting help |
10
+ | At Commands (`@`) | Quickly inject local file content into conversation | Allowing AI to analyze specified files or code under directories |
11
+ | Exclamation Commands (`!`) | Direct interaction with system Shell | Executing system commands like `git status`, `ls`, etc. |
12
+
13
+ ## 1. Slash Commands (`/`)
14
+
15
+ Slash commands are used to manage Qwen Code sessions, interface, and basic behavior.
16
+
17
+ ### 1.1 Session and Project Management
18
+
19
+ These commands help you save, restore, and summarize work progress.
20
+
21
+ | Command | Description | Usage Examples |
22
+ | ----------- | --------------------------------------------------------- | ------------------------------------ |
23
+ | `/init` | Analyze current directory and create initial context file | `/init` |
24
+ | `/summary` | Generate project summary based on conversation history | `/summary` |
25
+ | `/compress` | Replace chat history with summary to save Tokens | `/compress` |
26
+ | `/resume` | Resume a previous conversation session | `/resume` |
27
+ | `/restore` | Restore files to state before tool execution | `/restore` (list) or `/restore <ID>` |
28
+
29
+ ### 1.2 Interface and Workspace Control
30
+
31
+ Commands for adjusting interface appearance and work environment.
32
+
33
+ | Command | Description | Usage Examples |
34
+ | ------------ | ---------------------------------------- | ----------------------------- |
35
+ | `/clear` | Clear terminal screen content | `/clear` (shortcut: `Ctrl+L`) |
36
+ | `/context` | Show context window usage breakdown | `/context` |
37
+ | `/theme` | Change Qwen Code visual theme | `/theme` |
38
+ | `/vim` | Turn input area Vim editing mode on/off | `/vim` |
39
+ | `/directory` | Manage multi-directory support workspace | `/dir add ./src,./tests` |
40
+ | `/editor` | Open dialog to select supported editor | `/editor` |
41
+
42
+ ### 1.3 Language Settings
43
+
44
+ Commands specifically for controlling interface and output language.
45
+
46
+ | Command | Description | Usage Examples |
47
+ | --------------------- | -------------------------------- | -------------------------- |
48
+ | `/language` | View or change language settings | `/language` |
49
+ | → `ui [language]` | Set UI interface language | `/language ui zh-CN` |
50
+ | → `output [language]` | Set LLM output language | `/language output Chinese` |
51
+
52
+ - Available built-in UI languages: `zh-CN` (Simplified Chinese), `en-US` (English), `ru-RU` (Russian), `de-DE` (German)
53
+ - Output language examples: `Chinese`, `English`, `Japanese`, etc.
54
+
55
+ ### 1.4 Tool and Model Management
56
+
57
+ Commands for managing AI tools and models.
58
+
59
+ | Command | Description | Usage Examples |
60
+ | ---------------- | --------------------------------------------- | --------------------------------------------- |
61
+ | `/mcp` | List configured MCP servers and tools | `/mcp`, `/mcp desc` |
62
+ | `/tools` | Display currently available tool list | `/tools`, `/tools desc` |
63
+ | `/skills` | List and run available skills | `/skills`, `/skills <name>` |
64
+ | `/approval-mode` | Change approval mode for tool usage | `/approval-mode <mode (auto-edit)> --project` |
65
+ | →`plan` | Analysis only, no execution | Secure review |
66
+ | →`default` | Require approval for edits | Daily use |
67
+ | →`auto-edit` | Automatically approve edits | Trusted environment |
68
+ | →`yolo` | Automatically approve all | Quick prototyping |
69
+ | `/model` | Switch model used in current session | `/model` |
70
+ | `/extensions` | List all active extensions in current session | `/extensions` |
71
+ | `/memory` | Manage AI's instruction context | `/memory add Important Info` |
72
+
73
+ ### 1.5 Information, Settings, and Help
74
+
75
+ Commands for obtaining information and performing system settings.
76
+
77
+ | Command | Description | Usage Examples |
78
+ | ----------- | ----------------------------------------------- | -------------------------------- |
79
+ | `/help` | Display help information for available commands | `/help` or `/?` |
80
+ | `/about` | Display version information | `/about` |
81
+ | `/stats` | Display detailed statistics for current session | `/stats` |
82
+ | `/settings` | Open settings editor | `/settings` |
83
+ | `/auth` | Change authentication method | `/auth` |
84
+ | `/bug` | Submit issue about Qwen Code | `/bug Button click unresponsive` |
85
+ | `/copy` | Copy last output content to clipboard | `/copy` |
86
+ | `/quit` | Exit Qwen Code immediately | `/quit` or `/exit` |
87
+
88
+ ### 1.6 Common Shortcuts
89
+
90
+ | Shortcut | Function | Note |
91
+ | ------------------ | ----------------------- | ---------------------- |
92
+ | `Ctrl/cmd+L` | Clear screen | Equivalent to `/clear` |
93
+ | `Ctrl/cmd+T` | Toggle tool description | MCP tool management |
94
+ | `Ctrl/cmd+C`×2 | Exit confirmation | Secure exit mechanism |
95
+ | `Ctrl/cmd+Z` | Undo input | Text editing |
96
+ | `Ctrl/cmd+Shift+Z` | Redo input | Text editing |
97
+
98
+ ### 1.7 CLI Auth Subcommands
99
+
100
+ In addition to the in-session `/auth` slash command, Qwen Code provides standalone CLI subcommands for managing authentication directly from the terminal:
101
+
102
+ | Command | Description |
103
+ | ---------------------------------------------------- | ------------------------------------------------- |
104
+ | `qwen auth` | Interactive authentication setup |
105
+ | `qwen auth qwen-oauth` | Authenticate with Qwen OAuth |
106
+ | `qwen auth coding-plan` | Authenticate with Alibaba Cloud Coding Plan |
107
+ | `qwen auth coding-plan --region china --key sk-sp-…` | Non-interactive Coding Plan setup (for scripting) |
108
+ | `qwen auth status` | Show current authentication status |
109
+
110
+ > [!tip]
111
+ >
112
+ > These commands run outside of a Qwen Code session. Use them to configure authentication before starting a session, or in scripts and CI environments. See the [Authentication](../configuration/auth) page for full details.
113
+
114
+ ## 2. @ Commands (Introducing Files)
115
+
116
+ @ commands are used to quickly add local file or directory content to the conversation.
117
+
118
+ | Command Format | Description | Examples |
119
+ | ------------------- | -------------------------------------------- | ------------------------------------------------ |
120
+ | `@<file path>` | Inject content of specified file | `@src/main.py Please explain this code` |
121
+ | `@<directory path>` | Recursively read all text files in directory | `@docs/ Summarize content of this document` |
122
+ | Standalone `@` | Used when discussing `@` symbol itself | `@ What is this symbol used for in programming?` |
123
+
124
+ Note: Spaces in paths need to be escaped with backslash (e.g., `@My\ Documents/file.txt`)
125
+
126
+ ## 3. Exclamation Commands (`!`) - Shell Command Execution
127
+
128
+ Exclamation commands allow you to execute system commands directly within Qwen Code.
129
+
130
+ | Command Format | Description | Examples |
131
+ | ------------------ | ------------------------------------------------------------------ | -------------------------------------- |
132
+ | `!<shell command>` | Execute command in sub-Shell | `!ls -la`, `!git status` |
133
+ | Standalone `!` | Switch Shell mode, any input is executed directly as Shell command | `!`(enter) → Input command → `!`(exit) |
134
+
135
+ Environment Variables: Commands executed via `!` will set the `QWEN_CODE=1` environment variable.
136
+
137
+ ## 4. Custom Commands
138
+
139
+ Save frequently used prompts as shortcut commands to improve work efficiency and ensure consistency.
140
+
141
+ > [!note]
142
+ >
143
+ > Custom commands now use Markdown format with optional YAML frontmatter. TOML format is deprecated but still supported for backwards compatibility. When TOML files are detected, an automatic migration prompt will be displayed.
144
+
145
+ ### Quick Overview
146
+
147
+ | Function | Description | Advantages | Priority | Applicable Scenarios |
148
+ | ---------------- | ------------------------------------------ | -------------------------------------- | -------- | ---------------------------------------------------- |
149
+ | Namespace | Subdirectory creates colon-named commands | Better command organization | | |
150
+ | Global Commands | `~/.qwen/commands/` | Available in all projects | Low | Personal frequently used commands, cross-project use |
151
+ | Project Commands | `<project root directory>/.qwen/commands/` | Project-specific, version-controllable | High | Team sharing, project-specific commands |
152
+
153
+ Priority Rules: Project commands > User commands (project command used when names are same)
154
+
155
+ ### Command Naming Rules
156
+
157
+ #### File Path to Command Name Mapping Table
158
+
159
+ | File Location | Generated Command | Example Call |
160
+ | ---------------------------------------- | ----------------- | --------------------- |
161
+ | `~/.qwen/commands/test.md` | `/test` | `/test Parameter` |
162
+ | `<project>/.qwen/commands/git/commit.md` | `/git:commit` | `/git:commit Message` |
163
+
164
+ Naming Rules: Path separator (`/` or `\`) converted to colon (`:`)
165
+
166
+ ### Markdown File Format Specification (Recommended)
167
+
168
+ Custom commands use Markdown files with optional YAML frontmatter:
169
+
170
+ ```markdown
171
+ ---
172
+ description: Optional description (displayed in /help)
173
+ ---
174
+
175
+ Your prompt content here.
176
+ Use {{args}} for parameter injection.
177
+ ```
178
+
179
+ | Field | Required | Description | Example |
180
+ | ------------- | -------- | ---------------------------------------- | ------------------------------------------ |
181
+ | `description` | Optional | Command description (displayed in /help) | `description: Code analysis tool` |
182
+ | Prompt body | Required | Prompt content sent to model | Any Markdown content after the frontmatter |
183
+
184
+ ### TOML File Format (Deprecated)
185
+
186
+ > [!warning]
187
+ >
188
+ > **Deprecated:** TOML format is still supported but will be removed in a future version. Please migrate to Markdown format.
189
+
190
+ | Field | Required | Description | Example |
191
+ | ------------- | -------- | ---------------------------------------- | ------------------------------------------ |
192
+ | `prompt` | Required | Prompt content sent to model | `prompt = "Please analyze code: {{args}}"` |
193
+ | `description` | Optional | Command description (displayed in /help) | `description = "Code analysis tool"` |
194
+
195
+ ### Parameter Processing Mechanism
196
+
197
+ | Processing Method | Syntax | Applicable Scenarios | Security Features |
198
+ | ---------------------------- | ------------------ | ------------------------------------ | -------------------------------------- |
199
+ | Context-aware Injection | `{{args}}` | Need precise parameter control | Automatic Shell escaping |
200
+ | Default Parameter Processing | No special marking | Simple commands, parameter appending | Append as-is |
201
+ | Shell Command Injection | `!{command}` | Need dynamic content | Execution confirmation required before |
202
+
203
+ #### 1. Context-aware Injection (`{{args}}`)
204
+
205
+ | Scenario | TOML Configuration | Call Method | Actual Effect |
206
+ | ---------------- | --------------------------------------- | --------------------- | ------------------------ |
207
+ | Raw Injection | `prompt = "Fix: {{args}}"` | `/fix "Button issue"` | `Fix: "Button issue"` |
208
+ | In Shell Command | `prompt = "Search: !{grep {{args}} .}"` | `/search "hello"` | Execute `grep "hello" .` |
209
+
210
+ #### 2. Default Parameter Processing
211
+
212
+ | Input Situation | Processing Method | Example |
213
+ | --------------- | ------------------------------------------------------ | ---------------------------------------------- |
214
+ | Has parameters | Append to end of prompt (separated by two line breaks) | `/cmd parameter` → Original prompt + parameter |
215
+ | No parameters | Send prompt as is | `/cmd` → Original prompt |
216
+
217
+ 🚀 Dynamic Content Injection
218
+
219
+ | Injection Type | Syntax | Processing Order | Purpose |
220
+ | --------------------- | -------------- | ------------------- | -------------------------------- |
221
+ | File Content | `@{file path}` | Processed first | Inject static reference files |
222
+ | Shell Commands | `!{command}` | Processed in middle | Inject dynamic execution results |
223
+ | Parameter Replacement | `{{args}}` | Processed last | Inject user parameters |
224
+
225
+ #### 3. Shell Command Execution (`!{...}`)
226
+
227
+ | Operation | User Interaction |
228
+ | ------------------------------- | -------------------- |
229
+ | 1. Parse command and parameters | - |
230
+ | 2. Automatic Shell escaping | - |
231
+ | 3. Show confirmation dialog | ✅ User confirmation |
232
+ | 4. Execute command | - |
233
+ | 5. Inject output to prompt | - |
234
+
235
+ Example: Git Commit Message Generation
236
+
237
+ ````markdown
238
+ ---
239
+ description: Generate Commit message based on staged changes
240
+ ---
241
+
242
+ Please generate a Commit message based on the following diff:
243
+
244
+ ```diff
245
+ !{git diff --staged}
246
+ ```
247
+ ````
248
+
249
+ #### 4. File Content Injection (`@{...}`)
250
+
251
+ | File Type | Support Status | Processing Method |
252
+ | ------------ | ---------------------- | --------------------------- |
253
+ | Text Files | ✅ Full Support | Directly inject content |
254
+ | Images/PDF | ✅ Multi-modal Support | Encode and inject |
255
+ | Binary Files | ⚠️ Limited Support | May be skipped or truncated |
256
+ | Directory | ✅ Recursive Injection | Follow .gitignore rules |
257
+
258
+ Example: Code Review Command
259
+
260
+ ```markdown
261
+ ---
262
+ description: Code review based on best practices
263
+ ---
264
+
265
+ Review {{args}}, reference standards:
266
+
267
+ @{docs/code-standards.md}
268
+ ```
269
+
270
+ ### Practical Creation Example
271
+
272
+ #### "Pure Function Refactoring" Command Creation Steps Table
273
+
274
+ | Operation | Command/Code |
275
+ | ----------------------------- | ----------------------------------------- |
276
+ | 1. Create directory structure | `mkdir -p ~/.qwen/commands/refactor` |
277
+ | 2. Create command file | `touch ~/.qwen/commands/refactor/pure.md` |
278
+ | 3. Edit command content | Refer to the complete code below. |
279
+ | 4. Test command | `@file.js` → `/refactor:pure` |
280
+
281
+ ```markdown
282
+ ---
283
+ description: Refactor code to pure function
284
+ ---
285
+
286
+ Please analyze code in current context, refactor to pure function.
287
+ Requirements:
288
+
289
+ 1. Provide refactored code
290
+ 2. Explain key changes and pure function characteristic implementation
291
+ 3. Maintain function unchanged
292
+ ```
293
+
294
+ ### Custom Command Best Practices Summary
295
+
296
+ #### Command Design Recommendations Table
297
+
298
+ | Practice Points | Recommended Approach | Avoid |
299
+ | -------------------- | ----------------------------------- | ------------------------------------------- |
300
+ | Command Naming | Use namespaces for organization | Avoid overly generic names |
301
+ | Parameter Processing | Clearly use `{{args}}` | Rely on default appending (easy to confuse) |
302
+ | Error Handling | Utilize Shell error output | Ignore execution failure |
303
+ | File Organization | Organize by function in directories | All commands in root directory |
304
+ | Description Field | Always provide clear description | Rely on auto-generated description |
305
+
306
+ #### Security Features Reminder Table
307
+
308
+ | Security Mechanism | Protection Effect | User Operation |
309
+ | ---------------------- | -------------------------- | ---------------------- |
310
+ | Shell Escaping | Prevent command injection | Automatic processing |
311
+ | Execution Confirmation | Avoid accidental execution | Dialog confirmation |
312
+ | Error Reporting | Help diagnose issues | View error information |