Skip to content

Agent Architecture

Qwen CLI

Qwen Code is a broad open-source terminal agent row with Auto-Memory, Auto-Skills, SubAgents, Agent Teams, hooks, MCP, IDE plugins, desktop, daemon mode, SDKs, and IM channels visible in the public repository.

Source reviewed #25Checked 2026-07-06
Run type
CLI
Adapter
json-stdio
Source
OSS · QwenLM/qwen-code
Stars
★ 28k

Archive Context

This page is one host entry inside the full architecture archive and keeps multi-surface products visible instead of collapsing them into a single run type.

42 host archive
Host page
qwen-code
Run cohort
CLI: 30
Archive route
/agents

Host Surface Perspectives

The host is the primary architecture boundary. Each runnable surface below separates what the host owns from what agent-connector can safely install for Qwen CLI.

1 surface entry

CLI

cli
Host entry
A terminal command owns the process, current working directory, stdin/stdout, shell environment, and project file discovery.
Host owns
The CLI host owns agent loop timing, approval prompts, tool execution, session files, and how hook or MCP subprocesses are launched.
Connector role
agent-connector can only write the host's documented CLI config, prompt, memory, hook, MCP, or package files and point them at the home binary. Current wired connector surfaces: MCP server, Hooks, Commands, Skills, Subagents, Memory, Statusline handler.
Implementation consequence
A CLI surface is byte-addressable and smoke-testable from a temporary HOME, but terminal UI behavior still belongs to the host process. No visible host-native gap is currently tracked for this surface.

Verified Architecture

Source-checked on 2026-07-06. These notes are intentionally separate from the generated surface matrix below.

Sequence #25

Source pass

Current source review findings are kept as the first architecture section so readers can separate external evidence from the generated local coverage model.

  • Qwen Code is an open-source terminal AI coding agent with auto-memory, auto-skills, subagents, agent teams, dynamic workflows, and MCP.
  • The same product line also documents IDE plugins, a desktop app, daemon mode, SDKs, and IM bots, so the CLI row must avoid leaking those surfaces.
  • The capability table claims hooks and Claude Code parity, making Qwen Code a rich json-stdio host rather than an MCP-only integration.

Runtime boundary

The adapter target is the `qwen` terminal surface, not every Qwen ecosystem client. Qwen Code also advertises IDE plugins, desktop, daemon, SDK, and IM bot surfaces, so the page must distinguish the CLI adapter from the larger multi-platform product.

  • Interactive mode runs as `qwen`; headless mode uses `qwen -p` for scripts and batch processing.
  • The README documents daemon mode over HTTP+SSE as experimental ACP, which is an adjacent host surface rather than this adapter's primary target.

MCP registration

MCP is a first-class Qwen Code capability in the public feature matrix. agent-connector should treat MCP as part of the broad terminal-agent surface while keeping provider and protocol switching separate from server registration.

  • The README groups MCP with Plan Mode and LSP Integration.
  • Multi-protocol model support covers OpenAI, Anthropic, Gemini, Qwen, third-party providers, and local models; that is not the same as MCP transport.

Hook bridge

Qwen Code publicly claims hooks alongside Auto-Memory and Auto-Skills. agent-connector therefore treats it as a rich json-stdio host, but event-specific claims should remain tied to adapter tests and current Qwen docs.

  • The README states Qwen Code has been brought toward Claude Code feature parity.
  • The hook surface should be documented as host-native and wired, while exact event vocabulary should not be invented from Claude Code by analogy.

Content surfaces

Qwen Code's public feature list includes Auto-Memory, Auto-Skills, SubAgents, Agent Teams, built-in skills, dynamic workflows, and slash-command style interactive use. These surfaces make it one of the broadest CLI rows in the archive.

  • The repository includes `.qwen` content, which supports a Qwen-specific local convention rather than a generic `.agent` folder.
  • Agent Teams and SubAgents are host affordances that should be kept separate in the inventory.

Marketplace and host-only affordances

Qwen Code's ecosystem reaches beyond the terminal through desktop, IDE plugins, SDKs, IM bots, and Qwen Code Claw delegation. These make it a frontier host for multi-surface study even when the adapter row remains CLI.

  • Computer Use, sandbox, git worktrees, Agent Arena, daemon mode, and IM channels are host-only affordances.
  • The adapter should avoid treating those surfaces as connector support unless a concrete write or runtime contract exists.

Host-specific shape

Qwen CLI is one of the broadest json-stdio hosts: MCP, hooks, commands, skills, subagents, memory, and statusline are wired.

  • Form factor: CLI.
  • Native surfaces: MCP server, Hooks, Commands, Skills, Subagents, Memory, Statusline handler.
  • Wired surfaces: MCP server, Hooks, Commands, Skills, Subagents, Memory, Statusline handler.
  • Visible gaps: none.

Hooks

Hooks enter through a host-launched command that exchanges event JSON over stdio.

MCP

The adapter writes this host's native MCP registration dialect, including its root key, scope, transport fields, and environment syntax.

Memory

Managed memory text is written into the rules or memory file this host actually reads, with ownership markers for reversible uninstall.

Marketplace and affordances

A marketplace or plugin-driver path is wired, so install/update/uninstall can be driven rather than only emitted as files.

  • Runtime handlers: Statusline handler.
  • User-visible affordances: Users see managed commands + skills + subagents + statusline + memory surfaces after install; runtime-only surfaces stay behind the host boundary..

Known Limits

  • The current adapter row is CLI-scoped despite Qwen Code's desktop, IDE, daemon, SDK, and IM surfaces.
  • Feature-parity language should not be used to import Claude Code event details without Qwen-specific evidence.
  • Daemon and ACP behavior need separate verification before they become install targets.

Architecture Diagram

Host-specific flow for the CLI surface.

json-stdio
Host-owned architecture flowHost surfaceCLIRuntimejson-stdioNative artifactsMCP + hooks + content + memory + handlersConnector boundarystdio eventsUser surfacecmds + skills + agents + memoryagent-connector writes only documented host artifacts; the host owns the agent loop.
  1. 1
    Entry point: CLI

    Terminal agent process reads user/project config and invokes the connector home binary for runtime callbacks.

  2. 2
    Connector package

    defineConnector package declares server, hooks, content, memory, and actions.

  3. 3
    Adapter module: qwen-code

    json-stdio renderer at src/adapters/qwen-code/index.ts.

  4. 4
    Native host artifacts

    Adapter writes MCP config + hook config + content files + memory/rules + statusline + marketplace bundle through this host's native file, package, or marketplace surface.

  5. 5
    Runtime boundary

    host launches JSON-stdio hook command

  6. 6
    User-visible surface

    Users see managed commands + skills + subagents + statusline + memory surfaces after install; runtime-only surfaces stay behind the host boundary.

  7. 7
    Coverage ceiling

    7/7 native surfaces wired. No visible host-native gap in the current coverage matrix.

Component Diagram

Static parts of the Qwen CLI integration and which side owns each one.

Components and ownershipQwen CLI hosthostagent-connector packageconnectorqwen-code adapterjson-stdioNative artifactsartifactsRuntime bridgeruntimeUser-visible surfaceuser
  • Qwen CLI host

    CLI surface owns the model loop, UI shell, config discovery, and native lifecycle for this integration.

  • agent-connector package

    Normalizes connector declarations into MCP, hook, memory, content, and action payloads before delegating to a host adapter.

  • qwen-code adapter

    Implements the json-stdio translation layer in src/adapters/qwen-code/index.ts.

  • Native artifacts

    Adapter writes MCP config + hook config + content files + memory/rules + statusline + marketplace bundle through this host's native file, package, or marketplace surface.

  • Runtime bridge

    host launches JSON-stdio hook command

  • User-visible surface

    Users see managed commands + skills + subagents + statusline + memory surfaces after install; runtime-only surfaces stay behind the host boundary.

Runtime Sequence Flow

Message order from install to runtime for the CLI surface.

User / projectagent-connectorqwen-code adapterQwen CLIAgent runtimeCoverage matrix1. Choose host adapter2. Resolve connector declaration3. Render host-native shape4. Host loads artifacts5. Run through host boundary6. Expose remaining ceiling
  1. 1 · User / project
    Choose host adapter

    Install or update starts against Qwen CLI; the selected surface is CLI.

  2. 2 · agent-connector
    Resolve connector declaration

    The package reads connector metadata and routes it to the qwen-code adapter instead of exposing a generic host contract.

  3. 3 · qwen-code adapter
    Render host-native shape

    Adapter writes MCP config + hook config + content files + memory/rules + statusline + marketplace bundle through this host's native file, package, or marketplace surface.

  4. 4 · Qwen CLI
    Host loads artifacts

    host launches JSON-stdio hook command

  5. 5 · Agent runtime
    Run through host boundary

    Users see managed commands + skills + subagents + statusline + memory surfaces after install; runtime-only surfaces stay behind the host boundary.

  6. 6 · Coverage matrix
    Expose remaining ceiling

    7/7 native surfaces wired. No visible host-native gap in the current coverage matrix.

Architecture Archive

The same five study axes are rendered for every host: runtime shape, hooks, MCP, memory, and host-only affordances.

Host-specific shape

Qwen CLI is one of the broadest json-stdio hosts: MCP, hooks, commands, skills, subagents, memory, and statusline are wired.

  • Form factor: CLI.
  • Native surfaces: MCP server, Hooks, Commands, Skills, Subagents, Memory, Statusline handler.
  • Wired surfaces: MCP server, Hooks, Commands, Skills, Subagents, Memory, Statusline handler.
  • Visible gaps: none.

Hooks

Hooks enter through a host-launched command that exchanges event JSON over stdio.

MCP

The adapter writes this host's native MCP registration dialect, including its root key, scope, transport fields, and environment syntax.

Memory

Managed memory text is written into the rules or memory file this host actually reads, with ownership markers for reversible uninstall.

Marketplace and affordances

A marketplace or plugin-driver path is wired, so install/update/uninstall can be driven rather than only emitted as files.

  • Runtime handlers: Statusline handler.
  • User-visible affordances: Users see managed commands + skills + subagents + statusline + memory surfaces after install; runtime-only surfaces stay behind the host boundary..

Special Feature Inventory

Host-specific capabilities separated from the generic surface matrix: lifecycle hooks, MCP registration, memory/rules, marketplace delivery, and UI or content affordances owned by the host.

Lifecycle hooks

Wired

Hooks enter through a host-launched command that exchanges event JSON over stdio.

MCP registration

Wired

The adapter writes this host's native MCP registration dialect, including its root key, scope, transport fields, and environment syntax.

Memory and rules

Wired

Managed memory text is written into the rules or memory file this host actually reads, with ownership markers for reversible uninstall.

Marketplace delivery

Driver wired

A marketplace or plugin-driver path is wired, so install/update/uninstall can be driven rather than only emitted as files.

Host-only affordances

4/4 wired

Wired host affordances: Commands, Skills, Subagents, Statusline handler. Host-native gaps: none. Not confirmed: Action affordances.

Source Review Notes

Latest source pass for host-specific architecture details. This is separate from generated adapter coverage and local drift guards.

Checked 2026-07-06Open review source
QwenLM/qwen-code repository
  • Qwen Code is an open-source terminal AI coding agent with auto-memory, auto-skills, subagents, agent teams, dynamic workflows, and MCP.
  • The same product line also documents IDE plugins, a desktop app, daemon mode, SDKs, and IM bots, so the CLI row must avoid leaking those surfaces.
  • The capability table claims hooks and Claude Code parity, making Qwen Code a rich json-stdio host rather than an MCP-only integration.

Evidence Map

Each host page ties public source evidence to the local adapter and drift guards that keep the rendered archive aligned with code.

Public source: QwenLM/qwen-code

Primary public repository or product source used for current host status and source links.

external
Open source

Local adapter implementation

Defines the install/uninstall behavior, native config rendering, capability flags, and any runtime parse/format bridge for this host.

local
src/adapters/qwen-code/index.ts

Platform metadata and host-native matrix

Records the form factor, public source target, ranking source, native host surfaces, and current agent-connector coverage cells.

local
site/src/platform-data.ts

Architecture drift guard

Asserts that every registered host has a page, diagram, host-specific brief, source link, form-factor band, and adapter-aligned surface data.

local
tests/docs/platform-drift.test.ts

Marketplace driver registry

Shows this host has a drivable package/plugin install path beyond direct native-file writes.

local
src/core/marketplace-drivers/registry.ts

Runtime Shape

Hooks are dispatched through a host-launched command. The adapter parses host JSON, calls the connector handler, and formats the reply back to the host contract.

MCP registration
Wired through this adapter
Hook bridge
Wired

Connector Surfaces

Static content

MCP server, Hooks, Commands, Skills, Subagents, Memory

Runtime handlers

Statusline handler

Surface Matrix

Wired means agent-connector installs it now. Host native marks support we know about but have not wired yet.

SurfaceStatus
MCP server
Static content
agent-connector installs this surface today.
Wired
Hooks
Static content
agent-connector installs this surface today.
Wired
Commands
Static content
agent-connector installs this surface today.
Wired
Skills
Static content
agent-connector installs this surface today.
Wired
Subagents
Static content
agent-connector installs this surface today.
Wired
Memory
Static content
agent-connector installs this surface today.
Wired
Statusline handler
Runtime handler
agent-connector installs this surface today.
Wired
Action affordances
Runtime handler
No confirmed host-native surface.
N/A