* feat(cli): show follow-up suggestion in input placeholder
When enableFollowupSuggestions is true, display the generated
follow-up suggestion as the input placeholder text (replacing
the default "Type your message..."). Tab/Enter/Right arrow
accepts the suggestion; typing dismisses it.
Also change the default of enableFollowupSuggestions from false
to true so the feature is on by default.
Key changes:
- AppContainer: dismissPromptSuggestion no longer clears
promptSuggestion state, preserving it for placeholder restore
after user types then deletes
- InputPrompt: Tab/Enter/Right arrow/typing handlers check
promptSuggestion prop as fallback when followup.state is not
visible (e.g. after 300ms delay or user dismissed)
- Composer: placeholder shows suggestion text when available
- hasTabConsumer: include promptSuggestion to prevent Windows
bare Tab from cycling approval mode
* chore: update settings.schema.json (enableFollowupSuggestions default: false → true)
* test(cli): add tests for promptSuggestion prop fallback paths (#5145)
- Add unit tests for Tab/Right arrow/Enter accepting promptSuggestion
when followup.state.suggestion is null (type-then-delete path).
- Add unit test for hasTabConsumer reporting true immediately when
promptSuggestion prop is set (no followup debounce needed).
- Update stale comment on speculation abort useEffect in AppContainer.
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
* fix(cli): address PR #5145 review feedback for promptSuggestion
- Fix Enter key to fill buffer instead of submitting suggestion (matches
Tab/Right-arrow behavior and Claude Code design)
- Add suggestionDismissed state to hasTabConsumer for Windows Tab cycling
- Fix suggestionDismissed to be set to true on user input (paste/typing)
- Add speculation abort to dismissPromptSuggestion callback
- Remove dead placeholder branch from Composer.tsx
- Update tests to reflect Enter no longer auto-submits suggestion
* fix(cli): address PR #5145 review from wenshao + telemetry gap
wenshao's review (posted after the previous fixes) flagged two issues,
both still valid against the current code; doudouOUC's telemetry gap
is addressed too.
- settings description: replace stale "Enter to accept and submit" with
"Press Tab, Right Arrow, or Enter to accept into the input buffer" in
both settingsSchema.ts and settings.schema.json (Enter now only fills
the buffer, and the feature defaults to enabled).
- hasTabConsumer / handler consistency: drop the redundant
`suggestionDismissed` state and gate hasTabConsumer on
`buffer.text.length === 0` — the exact condition the Tab/Right/Enter
handlers already use. Fixes the type-then-delete desync where Windows
bare Tab would both insert the suggestion and cycle approval mode
(regression of #4171).
- fallback telemetry: add a `fallbackText` option to the followup
controller's accept() so the prop-fallback path (no live suggestion,
e.g. within the show delay or after type-then-delete) routes through
accept() and logs onOutcome instead of silently bypassing telemetry.
Tab/Right/Enter handlers now call accept(method, { fallbackText }).
- tests: add core-level coverage for accept() with/without fallbackText,
and fix the InputPrompt "fallback" tests that advanced 700ms (which
silently exercised the normal visible-suggestion path) to advance only
100ms so followup.state.suggestion truly stays null.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* feat(cli): add accept_source telemetry + tests for promptSuggestion fallback
Follow-up to wenshao's second review pass on #5145.
- accept_source telemetry: fallback accepts report time_to_accept_ms: 0
(the suggestion was never shown via the timer), which is indistinguishable
from an instant accept. Add an `accept_source: 'live' | 'fallback'` field to
the followup controller's onOutcome and PromptSuggestionEvent so analytics
can tell the two apart. The controller derives it from whether a live
`currentState.suggestion` was present before applying `fallbackText`.
- tests: assert accept_source on the fallback accept; add a test that a live
suggestion takes priority over fallbackText (guards the `?? fallbackText`
ordering); add an InputPrompt test pinning the new buffer.text.length === 0
gate — hasTabConsumer reports false when a promptSuggestion is set but the
buffer is non-empty (the old Boolean(promptSuggestion) gate wrongly reported
true). The empty-buffer → true direction stays covered by the existing test.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* refactor(cli): address doudouOUC review on #5145 (dedupe, rename, telemetry)
Three [Suggestion]-level items from the latest review pass.
- Extract `availableSuggestion`: the compound condition
`(followup.state.isVisible || promptSuggestion) && (followup.state.suggestion ?? promptSuggestion)`
was copy-pasted across the Tab/Right/Enter accept guards, both
typing-dismiss guards, and the placeholder prop. Collapse them into one
derived value so the sites can't drift apart. Behavior is unchanged
(the controller keeps `isVisible` and `suggestion` in lockstep).
- Rename `dismissPromptSuggestion` -> `abortPromptSuggestion` across the
UIState context, AppContainer, Composer, and the MainContent mock. The
function only aborts in-flight generation/speculation and deliberately
does NOT clear `promptSuggestion` (so the placeholder can restore it);
the "dismiss" name implied the suggestion was gone.
- Omit `time_to_first_keystroke_ms` for fallback accepts. With
`accept_source: 'fallback'` the suggestion was never shown via the timer
(shownAt stayed 0), so `prevShownAtRef` still holds a previous
suggestion's timestamp and the delta would be meaningless.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* feat(cli): actually enable followup suggestions by default
PR #5145 changed the schema default to `true`, but `mergeSettings` never
applies SETTINGS_SCHEMA defaults, so the runtime `=== true` gates left the
feature off while the settings panel read it as on (verified by wenshao).
- Flip both runtime gates to treat an unset value as enabled — only an
explicit `false` opts out: `AppContainer.tsx` and the ACP `Session.ts`
(`#maybeEmitFollowupSuggestion`).
- Add a Session test for the unset/default-on path.
- Fix the stale `UIStateContext` JSDoc left over from the dismiss→abort
rename (it no longer clears state).
- Docs: mark the feature on-by-default, correct Enter (fills the input,
does not submit), ghost-text → placeholder text, and add a cost note that
`fastModel` forks to a separate cache and can cost more than the default
main-model + shared-cache path on long conversations.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(core): reject control chars and ANSI escapes in prompt suggestions
The follow-up suggestion is influenceable through conversation history
(tool/file/web output) and is rendered verbatim in the input placeholder
now that enableFollowupSuggestions defaults to on. Raw control bytes (CR,
ESC/CSI, C1) reached the terminal because getFilterReason only rejected
newlines and asterisks. Reject them at the source so the displayed and
inserted text always match.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(cli): clear promptSuggestion on submit and accept paths
Addresses doudouOUC review on #5145. Since abortPromptSuggestion was
changed to preserve `promptSuggestion` for type-then-delete restore, the
submit and accept paths leaked stale suggestion text:
- handleSubmitAndClear only called followup.dismiss(); after a synchronous
command (/clear, /help) that never triggers AppContainer's streaming
transition, the placeholder kept showing the old suggestion.
- Tab/Right/Enter accept never cleared the prop, so clearing the buffer
without submitting (Ctrl+U) made the accepted suggestion reappear as a
ghost placeholder.
Both now call onPromptSuggestionDismiss?.() after the followup action. Also
reuse the availableSuggestion single-source-of-truth in hasTabConsumer
instead of an inlined parallel expression, and add useFollowupSuggestions
tests asserting the accept_source guard suppresses time_to_first_keystroke_ms
on fallback accepts.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* test(cli): assert promptSuggestion is cleared on accept and submit
Regression coverage for the state-leak fixed in
|
||
|---|---|---|
| .github | ||
| .husky | ||
| .qwen | ||
| .vscode | ||
| docs | ||
| docs-site | ||
| eslint-rules | ||
| integration-tests | ||
| packages | ||
| patches | ||
| scripts | ||
| .dockerignore | ||
| .editorconfig | ||
| .gitattributes | ||
| .gitignore | ||
| .npmrc | ||
| .nvmrc | ||
| .prettierignore | ||
| .prettierrc.json | ||
| .yamllint.yml | ||
| AGENTS.md | ||
| CHANGELOG.md | ||
| CLAUDE.md | ||
| CONTRIBUTING.md | ||
| Dockerfile | ||
| esbuild.config.js | ||
| eslint.config.js | ||
| LICENSE | ||
| Makefile | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| SECURITY.md | ||
| tsconfig.json | ||
| vitest.config.ts | ||
The open-source AI coding agent that lives in your terminal.
中文 | Deutsch | français | 日本語 | Русский | Português (Brasil)
Why Qwen Code?
- Agentic out of the box — Auto-Memory, Auto-Skills, SubAgents, Agent Teams, and MCP. Dynamic workflows, zero setup.
- Open-source, inside and out — The framework and the Qwen models are open-source. They evolve together. No vendor lock-in.
- Multi-protocol — Supports OpenAI, Anthropic, Gemini, and Qwen APIs. Any third-party provider or local model (Ollama / vLLM). Switch at runtime.
- Beyond the terminal — IDE plugins, Desktop app, daemon mode, SDKs, and IM bots (Telegram / DingTalk / WeChat / Feishu).
Tip
Qwen Code is actively iterating on itself — using its own agent and models to file issues, submit PRs, review code, and run tests. Powered by the community, driven by AI.
Installation
Linux / macOS:
curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.sh | bash
Windows:
irm https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.ps1 | iex
Restart your terminal after installation to ensure environment variables take effect.
NPM / Homebrew
NPM (requires Node.js 22+):
npm install -g @qwen-code/qwen-code@latest
Homebrew (macOS / Linux):
brew install qwen-code
Quick Start
qwen # Launch interactive terminal UI
# Inside the session:
/auth # Configure your provider and API key
See the Authentication Guide and Settings Reference for detailed setup.
How to Use Qwen Code
| Mode | Command | Use Case |
|---|---|---|
| Interactive | qwen |
Terminal UI with rich rendering, @file references, slash commands |
| Headless | qwen -p "..." |
Scripts, CI/CD, batch processing — no UI |
| IDE | — | VS Code, Zed, JetBrains |
| Desktop | — | Qwen Code Desktop — GUI for macOS, Windows, Linux |
| Daemon | qwen serve |
Shared agent session over HTTP+SSE (ACP). Multiple clients, one agent. (experimental) Docs |
| SDK | — | TypeScript, Python, Java |
| IM Bot | qwen channel |
Connect to Telegram, DingTalk, WeChat, or Feishu |
SDK example (Python)
import asyncio
from qwen_code_sdk import is_sdk_result_message, query
async def main() -> None:
result = query(
"Summarize the repository layout.",
{
"cwd": "/path/to/project",
"path_to_qwen_executable": "qwen",
},
)
async for message in result:
if is_sdk_result_message(message):
print(message["result"])
asyncio.run(main())
Capabilities
If you know Claude Code, you already know Qwen Code — and then some. We've put significant effort into bringing Qwen Code to feature parity with Claude Code, improving both breadth and reliability across the board.
| Feature | Qwen Code | Claude Code |
|---|---|---|
| SubAgents, Agent Teams, Dynamic Workflows | ✓ | ✓ |
| Auto-Memory, Auto-Skills, Hooks | ✓ | ✓ |
| Built-in Skills (/review, /batch, /loop, /bugfix…) | ✓ | ✓ |
| MCP, Plan Mode, LSP Integration | ✓ | ✓ |
| Auto Mode, Sandbox, Git Worktrees | ✓ | ✓ |
| Computer Use (desktop automation) | ✓ | ✓ |
| IDE Plugins (VS Code / JetBrains / Zed) | ✓ | ✓ |
| SDK | ✓ | ✓ |
| Headless Mode, Session Management | ✓ | ✓ |
| Open-source — model and framework | ✓ | — |
| Multi-protocol (OpenAI / Anthropic / Gemini / Qwen + any provider) | ✓ | — |
| Agent Arena (multi-model head-to-head on same task) | ✓ | — |
Daemon Mode — qwen serve (multi-client shared agent) |
✓ | — |
| IM Channels (Telegram / DingTalk / WeChat / Feishu) | ✓ | — |
Ecosystem
-
Qwen Code Desktop — Official desktop app for macOS, Windows, and Linux
-
AionUi — A modern GUI for command-line AI tools including Qwen Code
-
Gemini CLI Desktop — A cross-platform desktop/web/mobile UI for Qwen Code
-
🦞 Qwen Code Claw — Let other agents (Claude, Codex, etc.) delegate coding tasks to Qwen Code via ACP. Paste this prompt into your agent:
Use Qwen Code as a coding agent. First, fetch and read this skill reference:
https://raw.githubusercontent.com/QwenLM/qwen-code/refs/heads/main/.qwen/skills/qwen-code-claw/SKILL.md
Then follow the instructions inside to install, authenticate, and use Qwen Code via acpx for all coding tasks.
Contributing
Contributions are welcome! See CONTRIBUTING.md for guidelines.
Acknowledgments
This project was originally based on Google Gemini CLI v0.8.2. We gratefully acknowledge the Gemini CLI team's excellent work. Starting from Qwen Code v0.1, we stopped syncing with upstream and began independent development as a multi-protocol, multi-platform agent framework with deep integrations for Qwen models and beyond.
