Qwen Code cheat sheet
Every command, flag and slash command for qwen — Alibaba's terminal agent — forked from Gemini CLI but now its own tool, with ~60 slash commands. 17+ commands, verified July 2026.
Qwen Code hard-forked from Gemini CLI at its own v0.1 and diverged: the --all-files / -a flag is gone (use --include-directories), and the Qwen free tier was discontinued 2026-04-15 — use any OpenAI-compatible key or the Alibaba Cloud Coding Plan.
npm install -g @qwen-code/qwen-code@latest # npm (needs Node 22+)
brew install qwen-code # Homebrew
npx @qwen-code/qwen-code # run without installing
qwen # interactive terminal UI
qwen -p "fix the failing tests" # headless
qwen -m qwen3-coder-plus -p "…" # pick the model
qwen --include-directories src,tests -p "…" # add dirs to context
qwen sessions list # list recent sessions
Key flags
| Flag | What it does |
|---|---|
-m, --model <id> | Model (e.g. qwen3-coder-plus) |
-p, --prompt <text> | Headless one-shot prompt |
-i, --prompt-interactive | Interactive with an initial prompt |
-y, --yolo | Auto-approve all actions |
--approval-mode <m> | plan · default · auto-edit · auto · yolo |
-s, --sandbox | Sandbox (docker / podman / sandbox-exec) |
--include-directories <a,b> | Extra dirs (the --all-files replacement) |
-o, --output-format <fmt> | text · json · stream-json |
-c, --continue / -r, --resume | Resume sessions |
Slash · @file · !shell
| Command | What it does |
|---|---|
/help · /clear (/new) | Help · clear context |
/compress (/summarize) | Summarize history to save tokens |
/stats · /context | Usage · context-window breakdown |
/memory · /remember · /forget | Memory manager |
/model [id] · /approval-mode | Switch model · change approval mode |
/init | Analyze the dir and create a QWEN.md |
/review [PR] | Code review with parallel agents |
@file · !cmd | Inject a file · run a shell command |
~/.qwen/settings.json · ./.qwen/settings.json # user / project
QWEN.md # project context (/init to scaffold)
export OPENAI_API_KEY="…" # any OpenAI-compatible provider
export OPENAI_BASE_URL="https://openrouter.ai/api/v1" # e.g. OpenRouter / Ollama / vLLM
export OPENAI_MODEL="qwen3-coder-plus"
qwen -p "Write a concise commit message" --output-format json | jq -r '.result'
OPENAI_BASE_URL="http://localhost:11434/v1" OPENAI_API_KEY="ollama" \
qwen -p "refactor utils.py" # local Ollama, one run
qwen -m qwen3-coder-plus --include-directories src,tests -p "fix the flaky test"
git diff origin/main...HEAD | qwen -p "Review these changes for bugs"
More CLI cheat sheets
Stop memorizing flags
Run Qwen Code — and every other agent — from one app
TheVibeFather orchestrates Qwen Code alongside every other coding CLI in one native macOS app. Bring the models you already pay for; keep your keys.
Claude Code
Gemini CLI
Aider
Goose
Crush
Grok CLI
OpenHands CLI
Cline CLI
Roo Code CLI
Continue CLI