Skip to content

Commit 1ad9642

Browse files
authored
Merge pull request #6 from GCGH159/main
feat(host): add Qwen Code host adapter
2 parents 305ee58 + 5af2afb commit 1ad9642

45 files changed

Lines changed: 1439 additions & 71 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/ARCHITECTURE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ reference is `docs/adrs/directory-structure.md`.
6666
in the capability-owned agent-customize and session-analysis providers. The Codex shell
6767
owns local install/discovery metadata only; Codex evidence collection remains
6868
in the capability-owned provider and session-analysis modules. The public npm
69-
package ships all four plugin metadata roots, while the Qoder runtime bundle
69+
package ships all five plugin metadata roots, while the Qoder runtime bundle
7070
includes only `.qoder-plugin/`.
7171

7272
## Template Boundaries

docs/adapters/README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# Host Adapter Matrix
22

3-
This is the single entry point for Claude Code, Codex, Qoder, and Cursor host
4-
boundaries. Do not create `docs/adapters/claude-code.md`,
5-
`docs/adapters/codex.md`, `docs/adapters/qoder.md`, or
6-
`docs/adapters/cursor.md` by default.
3+
This is the single entry point for Claude Code, Codex, Qoder, Cursor, and Qwen
4+
host boundaries. Do not create `docs/adapters/claude-code.md`,
5+
`docs/adapters/codex.md`, `docs/adapters/qoder.md`, `docs/adapters/cursor.md`,
6+
or `docs/adapters/qwen.md` by default.
77

88
Host differences enter only this matrix, capability-local configured-asset
99
providers, real session-evidence adapters, and output modes. Canonical product
1010
judgment stays in `skills/`, `models/`, `references/`, `templates/`, and
1111
`scripts/<capability>/`.
1212

1313
The `@qoderai/better-harness` npm package includes the Qoder, Claude Code,
14-
Codex, and Cursor plugin metadata roots. The generated Qoder runtime bundle
15-
includes only the Qoder shell, `.qoder-plugin/`; non-Qoder generated host
14+
Codex, Cursor, and Qwen plugin metadata roots. The generated Qoder runtime
15+
bundle includes only the Qoder shell, `.qoder-plugin/`; non-Qoder generated host
1616
artifacts remain source-local. Claude Code installs its shell through the
1717
repository's native marketplace manifest.
1818

@@ -22,6 +22,7 @@ repository's native marketplace manifest.
2222
| Codex | Analysis-capable source-local host | `.codex-plugin/` | `scripts/agent-customize/providers/codex.mjs` | `scripts/session-analysis/platforms/codex.mjs` | self-contained HTML + Markdown | `.codex` + `.agents` + `AGENTS.md` | `harness prepare --platform codex` -> finalize with `html-report` validation |
2323
| Qoder | First-class product host | `.qoder-plugin/` | `scripts/agent-customize/providers/qoder.mjs` | `scripts/session-analysis/platforms/qoder.mjs` | `better-harness` | `.qoder/rules` + `AGENTS.md` + output templates | `better-harness harness render --mode qoder-canvas --validate` |
2424
| Cursor | Analysis-capable source-local host | `.cursor-plugin/` | `scripts/agent-customize/providers/cursor.mjs` | `scripts/session-analysis/platforms/cursor.mjs` | self-contained HTML + Markdown | `.cursor` + `.codex` compatibility + `AGENTS.md` | `agent --plugin-dir . --mode ask --print` -> Cursor evidence bundle -> validated `html` render |
25+
| Qwen Code | Analysis-capable source-local host | `qwen-extension.json` | `scripts/agent-customize/providers/qwen.mjs` | `scripts/session-analysis/platforms/qwen.mjs` | self-contained HTML + Markdown | `.qwen` + `QWEN.md` + `AGENTS.md` | `harness prepare --platform qwen` -> finalize with `html-report` validation |
2526

2627
## Discovery And Evidence
2728

@@ -48,14 +49,20 @@ repository's native marketplace manifest.
4849
evidence comes from
4950
`scripts/session-analysis/platforms/cursor.mjs`, which keeps transcript,
5051
metadata, and audit coverage explicit when local identities do not join.
52+
- Qwen Code configured assets are inventoried through
53+
`scripts/agent-customize/providers/qwen.mjs`. Session evidence comes from
54+
`scripts/session-analysis/platforms/qwen.mjs`, which reads workspace-matching
55+
JSONL transcripts under `~/.qwen/projects/<slug>/chats/`. The `qwen-extension.json`
56+
manifest is native Qwen install/discovery metadata included in the public npm package; it
57+
does not own Qwen evidence collection.
5158

5259
## Output Modes
5360

5461
Canonical templates live under `templates/reporting/`.
5562

5663
- `qoder-canvas.md`: Qoder Canvas output contract, covering renderer-owned
5764
`findings.json`, Canvas-only `canvas.json`, and `report.canvas.tsx`.
58-
- `html-visual.md`: portable Claude Code/Codex/Cursor visual output contract, covering
65+
- `html-visual.md`: portable Claude Code/Codex/Cursor/Qwen visual output contract, covering
5966
`findings.json`, `report.md`, and `report.html`.
6067
- Markdown-only output has no visual companion.
6168

docs/adrs/directory-structure.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ scripts/
7171
core-change-watch/ # [active] static structure/core-path/history evidence
7272
session-analysis.mjs # [active] thin shim; new exports -> scripts/session-analysis/
7373
session-analysis/ # [active] session evidence collection/normalization
74-
platforms/<host>.mjs # Qoder/Codex/Claude/Cursor host adapters
74+
platforms/<host>.mjs # Qoder/Codex/Claude/Cursor/Qwen host adapters
7575
ides/<ide>/ # target editor-local evidence not covered by host adapters
7676
<business-capability>/ # [target] new capability owner
7777
cli.mjs # use cli.mjs for new capabilities
@@ -208,7 +208,7 @@ Use the tree first. These rules resolve common collisions:
208208
- Host plugin directories such as `.claude-plugin/`, `.qoder-plugin/`,
209209
`.cursor-plugin/`, and `.codex-plugin/` are install/discovery shells for one
210210
host. Existing active shells may be hand-maintained narrowly, but the Qoder
211-
public npm package ships all four plugin metadata roots, while the Qoder
211+
public npm package ships all five plugin metadata roots, while the Qoder
212212
runtime bundle ships only `.qoder-plugin/`. New host shells start from the
213213
`docs/adapters/README.md` matrix; split to `docs/adapters/<host>.md` and add a
214214
source-local `scripts/packaging/` builder only for an accepted host-artifact

docs/community.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ This is the complete reference. For the common cases, see Start Here above.
3232
| Style grammar | Yes | `templates/style/` | Directive-only visual language; no runnable skeletons | Selected by report/style routing | Style-template tests and no copied runtime skeletons |
3333
| Structured knowledge | Candidate only | `knowledge-base/{official,community}/...` | `knowledge.md`, interim `schema.json`, fixtures, namespace uniqueness | Docs-only until registry spec, compiler, and binding tests exist | Namespace check, schema/fixture review, migration note |
3434
| Examples and operating models | Yes | `case-studies/` | Named example, scope, evidence boundary, non-runtime status | Reference material only unless separately bound | Link/path check; no runtime-policy claims |
35-
| Host shell and packaging | Thin, or generated only after a split trigger | `.claude-plugin/`, `.qoder-plugin/`, `.cursor-plugin/`, `.codex-plugin/`, future lifecycle shells | Install/discovery metadata and pointers to canonical owners | Public npm package includes all four current metadata roots; the Qoder runtime bundle includes only `.qoder-plugin/`, and generated host artifacts stay source-local | `scripts/npm-package/` verification, or split adapter note plus target builder |
35+
| Host shell and packaging | Thin, or generated only after a split trigger | `.claude-plugin/`, `.qoder-plugin/`, `.cursor-plugin/`, `.codex-plugin/`, `qwen-extension.json`, future lifecycle shells | Install/discovery metadata and pointers to canonical owners | Public npm package includes all five current metadata roots; the Qoder runtime bundle includes only `.qoder-plugin/`, and generated host artifacts stay source-local | `scripts/npm-package/` verification, or split adapter note plus target builder |
3636

3737
## Non-Extension Boundaries
3838

docs/concepts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ until you need diagnosis. See [../models/routing.md](../models/routing.md).
7373
| Project evidence | `better-harness core-change-watch` | Project, history, core-path, and diff signals |
7474
| Change confidence | `hooks/git-scripts/blast-radius` | Symbol-graph blast radius of a change |
7575
| Dependency governance | `better-harness dependency-governance` | Update automation, audit, stale-dep signals |
76-
| Session evidence | `better-harness session-analysis` | Normalize Qoder, Codex, Claude, or Cursor session behavior |
76+
| Session evidence | `better-harness session-analysis` | Normalize Qoder, Codex, Claude, Cursor, or Qwen session behavior |
7777
| Agent assets | `better-harness coding-agent-practices inventory` | Inventory configured agent surfaces |
7878
| Guardrails | `hooks/`, `scripts/agent-guardrails` | Secret scanning and lifecycle checks |
7979

docs/glossary.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ for extension surfaces, read [community.md](community.md).
6060
| `core-change-watch` | Project, history, core-path, and current-diff evidence collection. | [scripts/core-change-watch](../scripts/core-change-watch) |
6161
| Blast radius | The symbol-graph reach of a change, computed with tree-sitter (JS/TS, Go, Python) as a git hook. | [hooks/git-scripts/blast-radius](../hooks/git-scripts/blast-radius) |
6262
| `dependency-governance` | Update-automation, audit, and stale-dependency signals. | [scripts/dependency-governance](../scripts/dependency-governance) |
63-
| `session-analysis` | Normalizes Qoder, Codex, Claude, or Cursor agent session behavior into evidence. | [scripts/session-analysis](../scripts/session-analysis) |
63+
| `session-analysis` | Normalizes Qoder, Codex, Claude, Cursor, or Qwen agent session behavior into evidence. | [scripts/session-analysis](../scripts/session-analysis) |
6464
| Guardrails | Change-time enforcement: secret scanning and lifecycle hook checks. | [hooks](../hooks), [scripts/agent-guardrails](../scripts/agent-guardrails) |
6565

6666
## The Action Loop (Report → Change)
@@ -79,7 +79,7 @@ for extension surfaces, read [community.md](community.md).
7979
|---|---|---|
8080
| Skill | A repeatable agent workflow defined by `SKILL.md` frontmatter plus a concise workflow. | [community.md](community.md); report use: [report contract](../skills/better-harness/SKILL.md#report-output) |
8181
| Host adapter | Per-host discovery and evidence-shape glue (e.g. Qoder, Codex); keeps the engine host-neutral. | [adapters/README.md](adapters/README.md) |
82-
| Host shell | Thin host metadata (`.claude-plugin/`, `.qoder-plugin/`, `.cursor-plugin/`, `.codex-plugin/`, or a future lifecycle shell) that exposes canonical behavior without owning product logic; the public npm package ships all four current metadata roots, while the Qoder runtime bundle includes only `.qoder-plugin/`. | [ARCHITECTURE.md](ARCHITECTURE.md) |
82+
| Host shell | Thin host metadata (`.claude-plugin/`, `.qoder-plugin/`, `.cursor-plugin/`, `.codex-plugin/`, `qwen-extension.json`, or a future lifecycle shell) that exposes canonical behavior without owning product logic; the public npm package ships all five current metadata roots, while the Qoder runtime bundle includes only `.qoder-plugin/`. | [ARCHITECTURE.md](ARCHITECTURE.md) |
8383
| Canonical owner | The single directory that owns a behavior's product judgment; host shells and mirrors point back to it. | [ARCHITECTURE.md](ARCHITECTURE.md) |
8484

8585
## "I Want To… → Use"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
".codex-plugin/",
3131
".cursor-plugin/",
3232
".qoder-plugin/",
33+
"qwen-extension.json",
3334
"AGENTS.md",
3435
"CHANGELOG.md",
3536
"CODE_OF_CONDUCT.md",

qwen-extension.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "better-harness",
3+
"version": "0.3.0",
4+
"displayName": "Better Harness",
5+
"description": "Build an AI-ready engineering system for safe coding-agent delivery and continuous software improvement.",
6+
"contextFileName": "QWEN.md",
7+
"skills": "./skills/"
8+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Qwen Code Best Practices
2+
3+
Use this file for Qwen Code-specific operating practice. Use `../routing.md`
4+
for host-neutral owner selection and `codex.md`/`claude.md` for other host
5+
references. Do not copy Qwen-only workflow advice into shared docs unless there
6+
is matching surface evidence.
7+
8+
## Operating Frame
9+
10+
Treat Qwen Code as a configured teammate, not a one-off assistant. Start with
11+
the right task context, move repeated guidance into `QWEN.md` and `AGENTS.md`,
12+
configure Qwen Code for the real workflow, connect external systems through
13+
MCP, turn repeated work into Skills and extensions, and automate only stable
14+
workflows.
15+
16+
## Prompt Shape
17+
18+
A strong first prompt has four parts:
19+
20+
- **Goal**: the change, bug, review, artifact, or decision needed.
21+
- **Context**: files, folders, docs, examples, logs, errors, or other material
22+
Qwen Code should inspect.
23+
- **Constraints**: architecture rules, safety limits, review standards, platform
24+
requirements, and do-not-touch boundaries.
25+
- **Done when**: tests, checks, behavior, output files, or review evidence that
26+
prove the task is complete.
27+
28+
## Durable Guidance
29+
30+
Use `QWEN.md` and `AGENTS.md` for repository guidance that should load
31+
automatically:
32+
33+
- repo layout and important directories
34+
- build, test, lint, and local run commands
35+
- engineering conventions and review expectations
36+
- safety constraints and do-not rules
37+
- what "done" means and how to verify work
38+
39+
Keep context files short and practical. Put large or conditional detail in
40+
linked references. Use project-level `.qwen/settings.json` for repo-specific
41+
behavior and global `~/.qwen/settings.json` for personal defaults.
42+
43+
When Qwen Code repeats a mistake, update durable guidance only when the lesson
44+
is reusable.
45+
46+
## Configuration
47+
48+
Qwen Code configuration should match the actual environment:
49+
50+
- Use `~/.qwen/settings.json` for personal defaults (model, approval mode,
51+
permissions).
52+
- Use `<project>/.qwen/settings.json` for repo-specific behavior.
53+
- Use `.qwen/` for project-scoped skills, agents, hooks, and worktrees.
54+
- Keep approval and sandbox settings tight until a trusted workflow needs more
55+
access.
56+
57+
## Skills and Extensions
58+
59+
Turn a repeated workflow into a Skill when it has stable triggers, inputs,
60+
steps, outputs, and validation. Install extensions from marketplaces or local
61+
sources; each extension records its install marker under
62+
`~/.qwen/extensions/<name>/.qwen-extension-install.json` with a `source`
63+
pointer to the real plugin root.
64+
65+
## External Context
66+
67+
Use MCP when Qwen Code needs context or actions outside the repository. MCP
68+
servers are configured in `~/.qwen/settings.json` under `mcpServers` (user) or
69+
`<project>/.mcp.json` (project). Project-level `.qwen/settings.json` can also
70+
carry `mcpServers`. Start with one or two MCP tools that remove a real repeated
71+
manual step.
72+
73+
## Session Controls
74+
75+
Keep one Qwen Code session per coherent unit of work. Session transcripts are
76+
recorded as JSONL under `~/.qwen/projects/<workspace-slug>/chats/`. The slug
77+
replaces every non-alphanumeric character with `-` (matching Qwen's native
78+
`sanitizeCwd`; on Windows the path is lowercased first). Use worktrees when
79+
concurrent
80+
sessions could edit the same files. Use subagents for bounded exploration,
81+
testing, or independent review.
82+
83+
## Harness Projection
84+
85+
For readiness reports, separate static presence from quality and execution:
86+
87+
- `QWEN.md`, `AGENTS.md`, `.qwen/settings.json`, Skills, extensions, MCP config,
88+
and hooks are configured-surface evidence.
89+
- Test output, build logs, reviewed diffs, session transcripts, and automation
90+
histories are execution evidence.
91+
- Do not claim a Qwen Code practice is effective from file presence alone.

references/agent-customize/routing.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,3 +310,29 @@ Inspect configured surfaces before projecting readiness evidence:
310310
`memory-review.md` before treating it as a user preference, applied lesson,
311311
or current project fact.
312312
- Session, diff, test, build, and review evidence for observed execution.
313+
314+
## Qwen Asset Route
315+
316+
For Qwen Code-specific actions, use `platforms/qwen.md` as the operating
317+
practice reference for prompt shape, `QWEN.md`, `.qwen` config, testing and
318+
review loops, MCP, Skills, automations, worktrees, and subagents. Presence is
319+
not execution proof.
320+
321+
Inspect configured surfaces before projecting readiness evidence:
322+
323+
- `QWEN.md` and `AGENTS.md` for durable repo context.
324+
- `.qwen/settings.json` and user settings for model, approval, sandbox, MCP
325+
servers, and defaults.
326+
- `.qwen/skills`, project skills, user skills, and extension skills for
327+
repeatable workflows.
328+
- MCP configuration (`~/.mcp.json` and project `.mcp.json`) and connector
329+
availability for external context.
330+
- Qwen extensions under `~/.qwen/extensions/` for installed plugin metadata;
331+
each extension carries a `.qwen-extension-install.json` marker with a
332+
`source` pointer to the real plugin root.
333+
- Session, diff, test, build, and review evidence for observed execution.
334+
335+
Use the Global/User Asset Pass from `global-assets.md` when the user asks about
336+
Qwen global assets such as `~/.qwen/skills` or `~/.qwen/hooks`, installed
337+
extensions, or memories. Keep configured inventory evidence separate from
338+
observed session behavior.

0 commit comments

Comments
 (0)