Skip to content

Instantly share code, notes, and snippets.

@raine
Created April 28, 2026 20:53
Show Gist options
  • Select an option

  • Save raine/89d4e8fd4104f8aca6fc736c81155ae5 to your computer and use it in GitHub Desktop.

Select an option

Save raine/89d4e8fd4104f8aca6fc736c81155ae5 to your computer and use it in GitHub Desktop.
  You │ # Phased Implement — phase core
      │ 
      │ You are an isolated worktree agent. The coordinator spawned you to implement
      │ **only** this phase of a larger phased plan. Do not work on other phases. Do
      │ not modify the master plan.
      │ 
      │ ## Phase
      │ 
      │ - **id:** core
      │ - **description:** Wire Qwen into the agent enum, profile registry, config
      │   dir mapping, skills dir, status-tracking module, embedded resources, and
      │   Cargo.toml package include. Includes unit tests.
      │ - **depends_on:** none
      │ - **file scope (advisory):** `src/agent_setup/**`, `src/multiplexer/agent.rs`,
      │   `src/config.rs`, `src/skills.rs`, `resources/qwen/**`, `Cargo.toml`,
      │   `tests/**`
      │ - **acceptance criteria:**
      │   - `Agent::Qwen` variant exists in `src/agent_setup/mod.rs` with
      │     `name() => "Qwen Code"` and serde tag `"qwen"`. The `check_all` and
      │     `install` dispatch include Qwen. The serialization/deserialization,
      │     default-empty, and round-trip tests in `src/agent_setup/mod.rs` cover
      │     the new variant.
      │   - `src/agent_setup/qwen.rs` exists, modeled on `gemini.rs`, detecting via
      │     `~/.qwen/` directory and writing/merging into `~/.qwen/settings.json`.
      │     Tests mirror the gemini.rs test suite.
      │   - `resources/qwen/settings.json` embeds five hooks using qwen's
      │     Claude-style event names: `UserPromptSubmit` (working), `PostToolUse`
      │     (working), `Notification` with exact matcher `"permission_prompt"`
      │     (waiting), `Stop` (done), `SessionEnd` (done). All hook commands are
      │     `workmux set-window-status <state>`.
      │   - `QwenProfile` in `src/multiplexer/agent.rs`: `name() => "qwen"`,
      │     `skip_permissions_flag() => "--yolo"`, prompt_argument =>
      │     `-i "$(cat <path>)"` (NOT `-p` — interactive form, mirrors
      │     `GeminiProfile`), `continue_flag() => "--continue"`,
      │     `auto_name_command() => None`. Registered in `PROFILES`.
      │     `is_known_agent("qwen")`, `resolve_profile(Some("qwen"))`, and
      │     stem-extraction tests are added.
      │   - `src/config.rs` `resolved_agent_config_dir` maps `"qwen"` => `~/.qwen`,
      │     with a corresponding test.
      │   - `src/skills.rs` `skills_dir(Agent::Qwen)` returns `~/.qwen/skills`
      │     (Pi/Claude-style branch). Qwen is removed from the `None` branch.
      │   - `Cargo.toml` package include adds `"/resources/qwen/**/*"` so published
      │     crates ship the embedded settings.
      │   - `just check` passes (cargo check + clippy + fmt + tests).
      │ 
      │ ## Master plan
      │ 
      │ The master plan lives at `history/2026-04-28-phased-qwen-support/plan.md`.
      │ The `history/` directory is gitignored and shared across worktrees, so this
      │ path is visible from your worktree even though it is not part of your branch.
      │ Read it for cross-phase context but do **not** modify it.
      │ 
      │ The plan also contains a "Notes for phase agents" section with hard-won
      │ constraints (hook event names, exact-match matcher, `-i` not `-p`, etc.).
      │ Read it before starting.
      │ 
      │ You can also reference the cloned qwen-code repo at `/tmp/qwen-code/` for
      │ ground truth on hook event names and CLI flags.
      │ 
      │ ## What to do
      │ 
      │ 1. Run `/implement add support for qwen-code as a first-class agent
      │    (core wiring): Agent enum, profile, config dir, skills dir,
      │    status-tracking module, resources, Cargo.toml include` to plan and
      │    implement this phase. The /implement skill will write its own per-phase
      │    plan, review it, implement it, run a red-team pass, and commit on success.
      │ 2. **Do not initiate `/merge` yourself.** After your work is committed and
      │    the sentinel is written (step 3), wait. The coordinator will send you
      │    `/merge --keep` as an explicit instruction once it has verified your
      │    sentinel. When that command arrives in this session, run it — it is the
      │    coordinator-managed merge step, not a user override. Do not ask for
      │    confirmation; just run it.
      │ 3. As the very last step, write the phase result sentinel to the shared
      │    `history/` tree (do NOT commit it — `history/` is gitignored):
      │ 
      │    ```bash
      │    COMMIT=$(git rev-parse HEAD)
      │    STATUS=success     # or "failed" if /implement reported blockers
      │    VALIDATION=passed  # or "failed" if validation failed
      │    mkdir -p history/2026-04-28-phased-qwen-support/captures
      │    echo "PHASE_RESULT id=core status=$STATUS commit=$COMMIT
      │ validation=$VALIDATION" \
      │      > history/2026-04-28-phased-qwen-support/captures/core.result
      │    ```
      │ 
      │ ## Constraints
      │ 
      │ - Stay within the file scope above unless /implement's plan-drift halt is
      │   triggered (in which case follow /implement's protocol).
      │ - Do not run `git push`, do not modify other phases' files (especially do
      │   NOT touch `docker/`, `src/sandbox/`, `.github/`, `README.md`,
      │ `CHANGELOG.md`,
      │   or `docs/`).
      │ - If you cannot complete the phase, write `status=failed` in the sentinel and
      │   exit. The coordinator will halt dependent phases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment