Skip to content

Commit 5d76cae

Browse files
committed
Add Qwen Code external agent
1 parent d308ea8 commit 5d76cae

17 files changed

Lines changed: 2212 additions & 7 deletions

File tree

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ External agents communicate with Entire CLI via subcommands that accept and retu
1818
|-------|-----------|--------|
1919
| [Kiro](agents/entire-agent-kiro/) | `agents/entire-agent-kiro/` | Implemented — hooks + transcript analysis |
2020
| [Amp](agents/entire-agent-amp/) | `agents/entire-agent-amp/` | Implemented — hooks + transcript analysis + token calculation + compact transcripts |
21+
| [Qwen Code](agents/entire-agent-qwen/) | `agents/entire-agent-qwen/` | Implemented — hooks + transcript analysis + compact transcripts |
2122

2223
See each agent's own README for setup and usage instructions.
2324

@@ -33,6 +34,22 @@ External agent discovery is opt-in. Once an `entire-agent-<name>` binary is on y
3334

3435
Without this flag, Entire ignores external agent binaries even when they're installed.
3536

37+
### Qwen Code
38+
39+
Qwen support targets the terminal `qwen` coding agent:
40+
41+
```bash
42+
cd agents/entire-agent-qwen
43+
mise run build
44+
cp entire-agent-qwen /usr/local/bin/
45+
46+
cd /path/to/your/repo
47+
entire enable --agent qwen --telemetry=false
48+
qwen -p "Create hello.txt with hello world" --yolo
49+
```
50+
51+
The adapter installs Qwen command hooks in `.qwen/settings.json` and stores a stable Entire sidecar transcript in `.entire/tmp/qwen/`.
52+
3653
## Building a New External Agent
3754

3855
This repo includes a skill that guides you through building a new external agent with two test layers:
@@ -104,13 +121,15 @@ The lifecycle harness auto-discovers and builds all agents in `agents/` via `Tes
104121
| `E2E_ARTIFACT_DIR` | Override lifecycle artifact output directory |
105122
| `E2E_KEEP_REPOS` | Preserve temp repos for debugging |
106123
| `E2E_CONCURRENT_TEST_LIMIT` | Override the per-agent lifecycle concurrency limit |
124+
| `QWEN_E2E` | Set to `1` with `E2E_AGENT=qwen` to run live Qwen Code lifecycle tests |
107125

108126
## Repository Layout
109127

110128
```
111129
agents/ # Standalone external agent projects
112130
entire-agent-kiro/ # Kiro agent (Go binary)
113131
entire-agent-amp/ # Amp agent (Go binary)
132+
entire-agent-qwen/ # Qwen Code agent (Go binary)
114133
e2e/ # Lifecycle integration harness
115134
.github/workflows/ # CI, including protocol compliance via external-agents-tests
116135
.claude/skills/entire-external-agent/ # Skill files (research, test-writer, implementer)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
entire-agent-qwen

agents/entire-agent-qwen/AGENT.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Qwen Code — External Agent Research
2+
3+
## Verdict: Compatible
4+
5+
Qwen Code exposes command hooks in `.qwen/settings.json` and stores project-scoped JSONL sessions under the Qwen runtime directory. The first integration uses Qwen hooks as the lifecycle source of truth and writes an Entire-owned sidecar transcript under a repo-scoped OS temp directory so Entire can read stable session data even if Qwen's native transcript evolves.
6+
7+
## Static Checks
8+
9+
| Check | Result | Notes |
10+
|-------|--------|-------|
11+
| Binary present | Optional | `qwen` on `PATH`; protocol commands still run without it |
12+
| Help available | PASS | Qwen Code documents `qwen -p`, `--continue`, and `--resume` |
13+
| Hooks available | PASS | `SessionStart`, `UserPromptSubmit`, `Stop`, `StopFailure`, `SessionEnd`, `PreCompact`, `PostToolUse`, `PostToolUseFailure` |
14+
| Config directory | PASS | Workspace `.qwen/settings.json` |
15+
| Session storage | PASS | Native JSONL under Qwen runtime; Entire sidecar in `/tmp/entire-qwen/<repo-hash>/` plus `.entire/tmp/<session_id>.json` marker |
16+
17+
## Protocol Mapping
18+
19+
| Protocol | Qwen Concept | Implementation |
20+
|----------|--------------|----------------|
21+
| `info` | Static metadata | Name `qwen`, type `Qwen Code`, preview |
22+
| `detect` | CLI availability | Checks `qwen` on `PATH` |
23+
| `get-session-id` | Hook `session_id` | Returns input session ID or stub |
24+
| `get-session-dir` | Entire sidecar dir | Repo-scoped OS temp directory outside `.entire/tmp` |
25+
| `resolve-session-file` | Entire sidecar file | `<session_id>.jsonl` |
26+
| `read-session` | Sidecar JSONL | Returns native bytes and computed modified files |
27+
| `write-session` | Sidecar JSONL | Writes `native_data` to `session_ref` |
28+
| `read-transcript` | Sidecar JSONL | Reads bytes directly |
29+
| `chunk-transcript` | Raw bytes | Fixed-size byte chunks |
30+
| `reassemble-transcript` | Raw bytes | Concatenates chunks |
31+
| `format-resume-command` | Qwen resume | `qwen --resume <session_id>` |
32+
| `parse-hook` | Qwen hooks | Maps lifecycle hooks to Entire event objects |
33+
| `install-hooks` | `.qwen/settings.json` | Read-modify-write command hooks |
34+
| `are-hooks-installed` | `.qwen/settings.json` | Requires all Entire Qwen hooks |
35+
| `uninstall-hooks` | `.qwen/settings.json` | Removes only Entire hook entries |
36+
| `extract-modified-files` | Tool inputs | Reads path fields and simple shell write patterns |
37+
| `extract-prompts` | `UserPromptSubmit` | Reads sidecar prompt records |
38+
| `extract-summary` | `Stop`/failure | Reads final assistant/error message |
39+
| `compact-transcript` | Sidecar JSONL | Emits base64 Entire Transcript Format JSONL |
40+
41+
## Lifecycle Mapping
42+
43+
| Qwen Hook | Entire Hook Verb | Entire Event |
44+
|-----------|------------------|--------------|
45+
| `SessionStart` | `session-start` | `SessionStart` |
46+
| `UserPromptSubmit` | `user-prompt-submit` | `TurnStart` |
47+
| `Stop` | `stop` | `TurnEnd` |
48+
| `StopFailure` | `stop-failure` | `TurnEnd` with error metadata |
49+
| `SessionEnd` | `session-end` | `SessionEnd` |
50+
| `PreCompact` | `pre-compact` | `Compaction` |
51+
| `PostToolUse` | `post-tool-use` | sidecar metadata only |
52+
| `PostToolUseFailure` | `post-tool-use-failure` | sidecar metadata only |
53+
54+
## Test Notes
55+
56+
Default CI does not require Qwen credentials. Real lifecycle testing is gated with `QWEN_E2E=1 E2E_AGENT=qwen`.

agents/entire-agent-qwen/README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# entire-agent-qwen
2+
3+
External agent binary that teaches the Entire CLI how to work with Qwen Code.
4+
5+
## Capabilities
6+
7+
| Capability | Status |
8+
|------------|--------|
9+
| hooks | Yes, command hooks in `.qwen/settings.json` |
10+
| transcript_analyzer | Yes, via Entire sidecar JSONL |
11+
| compact_transcript | Yes, emits Entire compact transcript JSONL |
12+
| transcript_preparer | No |
13+
| token_calculator | No |
14+
15+
## Installation
16+
17+
```bash
18+
cd agents/entire-agent-qwen
19+
mise run build
20+
cp entire-agent-qwen /usr/local/bin/
21+
```
22+
23+
Qwen Code itself must also be installed as `qwen` for real sessions:
24+
25+
```bash
26+
npm install -g @qwen-code/qwen-code
27+
```
28+
29+
## Enable In A Repo
30+
31+
```bash
32+
cd /path/to/repo
33+
entire enable --agent qwen --telemetry=false
34+
```
35+
36+
This writes command hooks to `.qwen/settings.json`. Hooks call:
37+
38+
```bash
39+
entire hooks qwen <hook-name>
40+
```
41+
42+
The hook commands are wrapped so a missing `entire` binary never breaks a Qwen session.
43+
44+
## Usage
45+
46+
```bash
47+
qwen -p "Create hello.txt with hello world" --yolo
48+
git add .
49+
git commit -m "qwen checkpoint test"
50+
entire checkpoint list
51+
```
52+
53+
Entire stores Qwen sidecar transcripts in a repo-scoped OS temp directory such as `/tmp/entire-qwen/<repo-hash>/<session_id>.jsonl`, preserving Qwen's native `transcript_path` as metadata. A small `.entire/tmp/<session_id>.json` marker is also written so Entire's shared session persistence tooling can discover the session without making the transcript path collide with other external agents.
54+
55+
## Development
56+
57+
```bash
58+
mise run build
59+
mise run test
60+
external-agents-tests verify ./entire-agent-qwen
61+
62+
cd ../../
63+
QWEN_E2E=1 E2E_AGENT=qwen mise run test:e2e:lifecycle
64+
```

agents/entire-agent-qwen/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module github.com/entireio/external-agents/agents/entire-agent-qwen
2+
3+
go 1.26.0

0 commit comments

Comments
 (0)