feat(skills): teach ce-plan/ce-work/ce-code-review the Fusion step conventions (U5)

In a Fusion workflow step (FUSION_WORKFLOW_STEP set), the skills now:
- emit a ===FUSION_AWAIT_INPUT=== block instead of calling AskUserQuestion
  into the void (Fusion pauses the task + surfaces it on the card; U6/U7),
  and take the assumptions path when FUSION_HEADLESS is set;
- dispatch sub-agents via fn_spawn_agent with systemPromptOverride read
  from FUSION_CE_AGENTS_DIR/<persona>.md (U2/U3), falling back to inline
  single-agent work when the dir/def is absent.

This is the keystone that makes the U1/U2/U3 plumbing actually used.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-06-13 08:59:35 -07:00
parent 5104e67935
commit e24a3e8150
3 changed files with 36 additions and 0 deletions

View File

@@ -16,6 +16,10 @@ Reviews code changes using dynamically selected reviewer personas. Spawns parall
- Can be invoked standalone
- Can run as a read-only or autofix review step inside larger workflows
### Running inside Fusion (autonomous workflow step)
When `FUSION_WORKFLOW_STEP` is set, you run as a Fusion workflow step (no synchronous user). Dispatch the reviewer personas with `fn_spawn_agent`, not `Task`: for each persona, read its def from `${FUSION_CE_AGENTS_DIR}/<persona>.md` (e.g. `ce-correctness-reviewer.md`), strip the frontmatter, and pass the body as `fn_spawn_agent`'s `systemPromptOverride` with `role: "reviewer"` and the review scope as `task`. If `FUSION_CE_AGENTS_DIR` is unset or a def is missing, run that persona's review inline rather than failing. Do not call `AskUserQuestion`; this step's verdict is its output (the gate consumes it).
## Argument Parsing
Parse `$ARGUMENTS` for the following optional tokens. Strip each recognized token before interpreting the remainder as the PR number, GitHub URL, or branch name.

View File

@@ -20,6 +20,22 @@ When asking the user a question, use the platform's blocking question tool: `Ask
Ask one question at a time. Prefer a concise single-select choice when natural options exist.
### Running inside Fusion (autonomous workflow step)
When the environment variable `FUSION_WORKFLOW_STEP` is set, you are running as a **Fusion workflow step**, not an interactive session. There is no synchronous blocking-question tool — `AskUserQuestion` has no listener here and must NOT be called. Adapt as follows:
- **Asking the user a question:** emit a single await-input block in your output and stop. Fusion parses it, pauses the task (`awaiting-user-input`), and surfaces it to a human via the task card; when they answer, this step re-runs with their reply available as the latest steering comment. Emit at most one question per run, exactly in this form:
```
===FUSION_AWAIT_INPUT===
<your single clear question, including any options as a short list>
===END_FUSION_AWAIT_INPUT===
```
On the re-run, read the most recent steering comment as the answer and continue. Only emit the block for questions that genuinely block planning (per Phase 0.5 / Phase 2). If `FUSION_HEADLESS` is also set, do **not** emit questions at all — take the headless path (record assumptions in a `## Assumptions` section and proceed).
- **Spawning sub-agents (research / reviewer personas):** Fusion's spawn primitive is `fn_spawn_agent`, not `Task`. To run a named `ce-*` persona, read its definition from the directory in `FUSION_CE_AGENTS_DIR` (e.g. `${FUSION_CE_AGENTS_DIR}/ce-repo-research-analyst.md`), strip the YAML frontmatter, and pass the remaining body as `fn_spawn_agent`'s `systemPromptOverride` (with `role: "reviewer"` for review personas, `role: "executor"` otherwise) and the task scope as `task`. If `FUSION_CE_AGENTS_DIR` is unset or the def is missing, fall back to running the analysis inline yourself (single-agent) rather than failing.
## Feature Description
<feature_description> #$ARGUMENTS </feature_description>

View File

@@ -12,6 +12,22 @@ Execute work efficiently while maintaining quality and finishing features.
This command takes a work document (plan or specification) or a bare prompt describing the work, and executes it systematically. The focus is on **shipping complete features** by understanding requirements quickly, following existing patterns, and maintaining quality throughout.
### Running inside Fusion (autonomous workflow step)
When the environment variable `FUSION_WORKFLOW_STEP` is set, you are running as a **Fusion workflow step**, not an interactive session:
- **No synchronous user.** Do not call `AskUserQuestion` (no listener). If you must ask a genuinely blocking question, emit a single await-input block and stop — Fusion pauses the task and surfaces it on the task card, then re-runs this step with the reply as the latest steering comment:
```
===FUSION_AWAIT_INPUT===
<your single clear question>
===END_FUSION_AWAIT_INPUT===
```
If `FUSION_HEADLESS` is also set, do not ask — proceed on reasonable assumptions and note them.
- **Sub-agent dispatch uses `fn_spawn_agent`, not `Task`.** To run a `ce-*` persona, read its def from `${FUSION_CE_AGENTS_DIR}/<persona>.md`, strip the frontmatter, and pass the body as `fn_spawn_agent`'s `systemPromptOverride` (with an appropriate `role`) and the unit scope as `task`. If `FUSION_CE_AGENTS_DIR` is unset or the def is missing, run the unit inline (single-agent) rather than failing. Parallel/worktree dispatch still applies — each `fn_spawn_agent` child already runs in its own worktree.
## Input Document
<input_document> #$ARGUMENTS </input_document>