Skip to content
Apothem
Harnesses

Qwen Code

Apothem harness adapter for Qwen Code (Beta).

Vendor: Alibaba Cloud Install name: qwen-code Status: Beta Native config: ~/.qwen/

Installation

apothem install --harness qwen-code

The adapter writes Qwen Code settings, installs a QWEN.md context anchor, registers Apothem hook dispatchers, converts Apothem commands to Qwen Markdown command files, installs skills as SKILL.md directories, and adapts helper definitions as Qwen subagents.

Files written:

~/.qwen/settings.json
~/.qwen/QWEN.md
~/.qwen/apothem/rules/00-apothem-profile.md
~/.qwen/commands/
~/.qwen/skills/
~/.qwen/agents/
~/.qwen/.apothem/support/{rules,templates,hooks}/

The file ~/.qwen/apothem/rules/00-apothem-profile.md is the profile document. It carries your identity and preferences from the shared profile.

Profile-to-native-config mapping

The adapter renders documented settings.json keys for context and hooks, writes QWEN.md, and weaves Apothem commands, skills, and helper definitions through Qwen Code's native discovery directories. Rules, templates, and hook source material remain support material under ~/.qwen/.apothem/support/.

Compatibility notes

~/.qwen/.apothem/support/ is support material referenced by QWEN.md and the settings hook commands; it is not a vendor-owned discovery namespace. The Apothem block in QWEN.md ends with an Apothem support files section that names the absolute directory under ~/.qwen/.apothem/support/ each repository-style citation (rules/<name>.md, templates/..., hooks/...) resolves against.

Skill tool lists. Qwen Code reads a skill's tool allow-list from the camelCase allowedTools frontmatter key, and the value must be a YAML list. It ignores the hyphenated allowed-tools key written for other agents. Installed skills therefore carry allowedTools as a list, one entry per line, in place of the source corpus's comma-separated allowed-tools string. Each entry keeps the source's spelling, including patterns such as Bash(git status *). Every other skill key, and the skill body, install unchanged.

Skill folders. The adapter writes skills to ~/.qwen/skills/. Qwen Code also reads ~/.agents/skills/ and, inside a project, .qwen/skills/ and .agents/skills/. When two folders hold a skill with the same name, the one under .qwen wins, so an Apothem skill in ~/.qwen/skills/ takes precedence over a same-named skill another adapter wrote to ~/.agents/skills/.

Hook events. The adapter wires SessionStart, PreToolUse, PreCompact, PostCompact, and Stop. Qwen Code defines 22 hook events and each of these five is one of them. Three of the 22 (SessionDelete, TodoCreated, and TodoCompleted) have no Claude Code event of the same name (Claude Code names the todo events TaskCreated and TaskCompleted); the adapter wires none of them.

Verification

apothem verify --harness qwen-code

The verify command confirms that:

  1. The native config exists at the expected path.
  2. Each managed target exists; managed files are non-empty, and JSON or YAML configs parse. Add --profile PATH to also confirm that the installed files match that profile.
  3. The adapter-specific verification routine reports success.

Updating

apothem update --harness qwen-code

Refreshes settings.json, QWEN.md, native commands, skills, subagents, and the Apothem support tree.

Uninstalling

apothem uninstall --harness qwen-code

Removes the entries the adapter added to ~/.qwen/settings.json (your own keys, MCP servers, and hook handlers stay, and the file is deleted only when Apothem created it and nothing of yours is left). Removes the Apothem block from ~/.qwen/QWEN.md and from the profile document ~/.qwen/apothem/rules/00-apothem-profile.md and keeps any other text in them; each file is deleted only when nothing else remains in it. Also removes the Apothem files in ~/.qwen/commands/, ~/.qwen/skills/, ~/.qwen/agents/, and ~/.qwen/.apothem/support/; other files in those folders stay. Each file is backed up under ~/.apothem/backups/ before it is changed or removed. The shared profile YAML and Apothem engine are unaffected.

Conformity gate

python -m apothem.conformity.gate --all .

Troubleshooting

SymptomFix
Config file not foundRe-run apothem install --harness qwen-code
Verification failedRun apothem update --harness qwen-code, then verify again
Unexpected config contentCheck ~/.config/apothem/profile.yaml or --profile PATH, then re-run apothem update --harness qwen-code

Configuration knobs

FlagDefaultDescription
--dry-runfalsePreview install without writing files.

See also

On this page