agent-orchestrator-kit 0.1.11 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +60 -28
- package/bin/agent-orchestrator.js +37 -10
- package/package.json +2 -2
- package/profiles/generic/orchestrator.yaml +3 -0
- package/profiles/mvp/orchestrator.yaml +3 -0
- package/profiles/node/orchestrator.yaml +3 -0
- package/profiles/vue3/orchestrator.yaml +3 -0
- package/templates/.agents/commands/opsx-apply.md +15 -4
- package/templates/.agents/commands/opsx-archive.md +21 -7
- package/templates/.agents/commands/opsx-design.md +21 -5
- package/templates/.agents/commands/opsx-explore.md +12 -2
- package/templates/.agents/commands/opsx-propose.md +22 -6
- package/templates/.agents/commands/opsx-quick.md +18 -2
- package/templates/.agents/commands/opsx-review.md +20 -4
- package/templates/.agents/rules/agent-orchestration.mdc +39 -0
- package/templates/.agents/rules/memory-mcp-autosetup.mdc +13 -6
- package/templates/.agents/skills/agent-orchestration/SKILL.md +72 -15
- package/templates/.agents/skills/openspec-apply-change/SKILL.md +7 -4
- package/templates/.agents/skills/openspec-archive-change/SKILL.md +13 -7
- package/templates/.agents/skills/openspec-explore/SKILL.md +4 -2
- package/templates/.agents/skills/openspec-propose/SKILL.md +14 -6
- package/templates/.agents/subagents/code-reviewer.md +12 -1
- package/templates/.agents/subagents/code-writer.md +13 -2
- package/templates/.agents/subagents/codebase-explorer.md +31 -0
- package/templates/.agents/subagents/design-implementer.md +13 -2
- package/templates/.agents/subagents/design-intake.md +31 -0
- package/templates/.agents/subagents/openspec-guide.md +12 -1
- package/templates/.agents/subagents/setup-doctor.md +11 -2
- package/templates/.agents/subagents/spec-architect.md +32 -0
- package/templates/.agents/subagents/spec-archiver.md +31 -0
- package/templates/.agents/subagents/spec-reviewer.md +32 -0
- package/templates/.agents/subagents/test-writer.md +13 -2
- package/templates/AGENTS.md +32 -3
- package/templates/CLAUDE.md +21 -0
- package/templates/orchestrator.yaml +3 -0
- package/templates/scripts/sync-local-agent-skills.sh +2 -0
|
@@ -5,6 +5,10 @@ category: Workflow
|
|
|
5
5
|
description: Propose a new change - create it and generate all artifacts in one step
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## Session Start (Before Any Work)
|
|
9
|
+
|
|
10
|
+
Honor the pasted command and announce the Architect role. Run `npx agent-orchestrator-kit status` or `npx openspec list --json`, then read Memory `Change:<name>`, `Handoff:<name>`, and `Decision:*`. If Memory is unavailable or empty, read `openspec/changes/<name>/handoff.md`; this fallback is not a blocker. For free-form “continue” / “next” with one active change, execute its `Handoff.next_command` instead of asking for the phase. Only then continue and spawn specialists.
|
|
11
|
+
|
|
8
12
|
Propose a new change - create the change and generate all artifacts in one step.
|
|
9
13
|
|
|
10
14
|
I'll create a change with artifacts:
|
|
@@ -18,6 +22,8 @@ When ready to implement, run /opsx:apply
|
|
|
18
22
|
|
|
19
23
|
**Input**: The argument after `/opsx:propose` is the change name (kebab-case), OR a description of what the user wants to build.
|
|
20
24
|
|
|
25
|
+
**Conductor delegation is mandatory:** spawn `spec-architect` with the resolved name, decision brief, design brief if present, and artifact instructions. The parent MUST NOT create or edit proposal/design/specs/tasks; after the structured report it may only verify files, run status, and run strict validation.
|
|
26
|
+
|
|
21
27
|
**Steps**
|
|
22
28
|
|
|
23
29
|
1. **If no input provided, ask what they want to build**
|
|
@@ -29,13 +35,17 @@ When ready to implement, run /opsx:apply
|
|
|
29
35
|
|
|
30
36
|
**IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
|
|
31
37
|
|
|
32
|
-
2. **
|
|
38
|
+
2. **Spawn the specialist**
|
|
39
|
+
|
|
40
|
+
Spawn `spec-architect` with a self-contained prompt and require `## Subagent report: spec-architect`. Delegate steps 3–5 to it; do not perform artifact creation in the parent session.
|
|
41
|
+
|
|
42
|
+
3. **Create the change directory**
|
|
33
43
|
```bash
|
|
34
44
|
npx openspec new change "<name>"
|
|
35
45
|
```
|
|
36
46
|
This creates a scaffolded change in the planning home resolved by the CLI with `.openspec.yaml`.
|
|
37
47
|
|
|
38
|
-
|
|
48
|
+
4. **Get the artifact build order**
|
|
39
49
|
```bash
|
|
40
50
|
npx openspec status --change "<name>" --json
|
|
41
51
|
```
|
|
@@ -44,7 +54,7 @@ When ready to implement, run /opsx:apply
|
|
|
44
54
|
- `artifacts`: list of all artifacts with their status and dependencies
|
|
45
55
|
- `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
|
|
46
56
|
|
|
47
|
-
|
|
57
|
+
5. **Create artifacts in sequence until apply-ready**
|
|
48
58
|
|
|
49
59
|
Use the **TodoWrite tool** to track progress through the artifacts.
|
|
50
60
|
|
|
@@ -76,7 +86,9 @@ When ready to implement, run /opsx:apply
|
|
|
76
86
|
- Use **AskUserQuestion tool** to clarify
|
|
77
87
|
- Then continue with creation
|
|
78
88
|
|
|
79
|
-
|
|
89
|
+
6. **Verify the report and show final status**
|
|
90
|
+
|
|
91
|
+
The conductor verifies `Status: done` and each reported artifact path, then runs:
|
|
80
92
|
```bash
|
|
81
93
|
npx openspec status --change "<name>"
|
|
82
94
|
```
|
|
@@ -86,8 +98,12 @@ When ready to implement, run /opsx:apply
|
|
|
86
98
|
After completing all artifacts, summarize:
|
|
87
99
|
- Change name and location
|
|
88
100
|
- List of artifacts created with brief descriptions
|
|
89
|
-
- What's ready: "All artifacts created! Ready for
|
|
90
|
-
- Prompt: "Run `/opsx:
|
|
101
|
+
- What's ready: "All artifacts created and validated! Ready for spec review."
|
|
102
|
+
- Prompt: "Run `/opsx:review <name>` in a fresh session."
|
|
103
|
+
|
|
104
|
+
## Session Exit (Mandatory Order)
|
|
105
|
+
|
|
106
|
+
After strict validation passes: (1) attempt to update Memory `Change:<name>`, `Handoff:<name>`, and new `Decision:*`; (2) write `openspec/changes/<name>/handoff.md` using the orchestration skill template even if Memory fails; (3) print one fenced prompt beginning `/opsx:review <name>`. Use `project.agent_language`, tell the next session to read Memory and the file fallback, omit banner labels and the full summary. Do not start review in this chat.
|
|
91
107
|
|
|
92
108
|
**Artifact Creation Guidelines**
|
|
93
109
|
|
|
@@ -5,6 +5,10 @@ category: Workflow
|
|
|
5
5
|
description: Fast path for MVP/demo — propose artifacts and apply in one session (skips review gate)
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## Session Start (Before Any Work)
|
|
9
|
+
|
|
10
|
+
Honor the pasted command and announce the Quick conductor role. Run `npx agent-orchestrator-kit status` or `npx openspec list --json`, then read Memory `Change:<name>`, `Handoff:<name>`, and `Decision:*`. If Memory is unavailable or empty, read `openspec/changes/<name>/handoff.md`; this fallback is not a blocker. For free-form “continue” / “next” with one active change, execute its `Handoff.next_command` instead of asking for the phase. Only then continue and spawn specialists.
|
|
11
|
+
|
|
8
12
|
Quick mode for **small changes, demos, and hypothesis testing**. Combines propose + apply in one session.
|
|
9
13
|
|
|
10
14
|
**Use when:**
|
|
@@ -20,6 +24,8 @@ Quick mode for **small changes, demos, and hypothesis testing**. Combines propos
|
|
|
20
24
|
|
|
21
25
|
**Input**: Change name (kebab-case) or description. Example: `/opsx:quick add-export-button`
|
|
22
26
|
|
|
27
|
+
**Conductor delegation is mandatory inside this one session:** spawn `spec-architect` for minimal artifacts, then `design-implementer` or `code-writer` per implementation task, `test-writer` for tests, and `code-reviewer` before merge. The parent MUST NOT write specialist artifacts/code/tests itself. Specialists never edit `tasks.md`; the conductor verifies each `Status: done` report and marks checkboxes. Do not emit a next-session prompt between propose and apply.
|
|
28
|
+
|
|
23
29
|
**Steps**
|
|
24
30
|
|
|
25
31
|
1. **Check orchestrator config**
|
|
@@ -30,6 +36,8 @@ Quick mode for **small changes, demos, and hypothesis testing**. Combines propos
|
|
|
30
36
|
|
|
31
37
|
2. **Create change (minimal artifacts)**
|
|
32
38
|
|
|
39
|
+
Spawn `spec-architect` with the quick-mode scope and require its structured report. Do not create the artifacts in the parent session.
|
|
40
|
+
|
|
33
41
|
```bash
|
|
34
42
|
npx openspec new change "<name>"
|
|
35
43
|
```
|
|
@@ -51,10 +59,13 @@ Quick mode for **small changes, demos, and hypothesis testing**. Combines propos
|
|
|
51
59
|
|
|
52
60
|
Follow `/opsx:apply` steps for the same change:
|
|
53
61
|
- Read tasks.md
|
|
54
|
-
-
|
|
55
|
-
-
|
|
62
|
+
- Spawn `design-implementer` for design-led work, otherwise `code-writer`, one task per prompt
|
|
63
|
+
- Spawn `test-writer` for required tests
|
|
64
|
+
- Verify each structured report and reported file, then let only the conductor mark `[x]`
|
|
56
65
|
- Run build/lint from `orchestrator.yaml` verifier commands
|
|
57
66
|
|
|
67
|
+
Continue directly from propose to apply in this session. Do not print or ask the user to paste a mid-session handoff prompt.
|
|
68
|
+
|
|
58
69
|
5. **Exit**
|
|
59
70
|
|
|
60
71
|
- If demo done and no merge planned → optionally skip archive
|
|
@@ -62,8 +73,13 @@ Quick mode for **small changes, demos, and hypothesis testing**. Combines propos
|
|
|
62
73
|
|
|
63
74
|
---
|
|
64
75
|
|
|
76
|
+
## Session Exit (Mandatory Order)
|
|
77
|
+
|
|
78
|
+
At the end of the whole quick session: (1) attempt to update Memory `Change:<name>`, `Handoff:<name>`, and new `Decision:*`, including task and build/lint status; (2) write `openspec/changes/<name>/handoff.md` using the orchestration skill template even if Memory fails; (3) print exactly one fenced prompt for the verify/archive continuation using `project.agent_language`, Memory keys, and the file fallback, without a banner label or duplicated summary. This is the session's only next-session prompt. Do not start archive in this chat.
|
|
79
|
+
|
|
65
80
|
**Guardrails**
|
|
66
81
|
- Max ~3 hours of work — if bigger, switch to full pipeline
|
|
67
82
|
- Still run build/lint before declaring done
|
|
68
83
|
- Do not skip OpenSpec entirely — at minimum proposal + tasks
|
|
69
84
|
- For vue3: use vue-core, vue-pinia skills during implementation
|
|
85
|
+
- Never emit or request paste of a next-session prompt between quick propose and apply; emit exactly one only at final exit
|
|
@@ -5,12 +5,18 @@ category: Workflow
|
|
|
5
5
|
description: Read-only spec review of an OpenSpec change — approve or request changes before apply
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## Session Start (Before Any Work)
|
|
9
|
+
|
|
10
|
+
Honor the pasted command and announce the Spec Reviewer role. Run `npx agent-orchestrator-kit status` or `npx openspec list --json`, then read Memory `Change:<name>`, `Handoff:<name>`, and `Decision:*`. If Memory is unavailable or empty, read `openspec/changes/<name>/handoff.md`; this fallback is not a blocker. For free-form “continue” / “next” with one active change, execute its `Handoff.next_command` instead of asking for the phase. Only then continue and spawn specialists.
|
|
11
|
+
|
|
8
12
|
Review an OpenSpec change. Read artifacts, validate structure, output Approve or Request Changes.
|
|
9
13
|
|
|
10
14
|
**IMPORTANT: This is a read-only mode. You must NEVER edit any file in `src/` or any source code. You may not mark tasks `[x]`. Your only output is a structured review verdict.**
|
|
11
15
|
|
|
12
16
|
**Input**: Optionally specify a change name (e.g., `/opsx:review add-auth`). If omitted, auto-select if one active change exists, otherwise list and ask.
|
|
13
17
|
|
|
18
|
+
**Conductor delegation is mandatory:** after selecting the change, spawn `spec-reviewer` with the complete change paths and project constraints. The parent MUST NOT review artifacts or write `review.md`; it only verifies the structured report and that `review.md` contains the reported verdict. Never substitute `code-reviewer`.
|
|
19
|
+
|
|
14
20
|
---
|
|
15
21
|
|
|
16
22
|
## Steps
|
|
@@ -24,7 +30,11 @@ If name provided — use it. Otherwise:
|
|
|
24
30
|
|
|
25
31
|
Announce: "Reviewing change: **<name>**"
|
|
26
32
|
|
|
27
|
-
### 2.
|
|
33
|
+
### 2. Spawn the specialist
|
|
34
|
+
|
|
35
|
+
Spawn `spec-reviewer` and delegate steps 3–6 below. Require `## Subagent report: spec-reviewer`. Do not perform the review in the parent session.
|
|
36
|
+
|
|
37
|
+
### 3. Validate structure
|
|
28
38
|
|
|
29
39
|
```bash
|
|
30
40
|
npx openspec validate <name> --strict --type change
|
|
@@ -32,7 +42,7 @@ npx openspec validate <name> --strict --type change
|
|
|
32
42
|
|
|
33
43
|
If ✗ — list each error and immediately output **Request Changes** with the validation errors. Stop here.
|
|
34
44
|
|
|
35
|
-
###
|
|
45
|
+
### 4. Read all artifacts
|
|
36
46
|
|
|
37
47
|
```bash
|
|
38
48
|
npx openspec status --change "<name>" --json
|
|
@@ -46,7 +56,7 @@ Read every file from `artifactPaths`:
|
|
|
46
56
|
|
|
47
57
|
Also read related `openspec/specs/` domain files to check consistency.
|
|
48
58
|
|
|
49
|
-
###
|
|
59
|
+
### 5. Review checklist
|
|
50
60
|
|
|
51
61
|
Evaluate each item. Mark ✓ or ✗:
|
|
52
62
|
|
|
@@ -81,7 +91,7 @@ Evaluate each item. Mark ✓ or ✗:
|
|
|
81
91
|
- [ ] Tasks reference concrete component/store paths under `src/`
|
|
82
92
|
- [ ] No scope creep into unrelated UI refactors
|
|
83
93
|
|
|
84
|
-
###
|
|
94
|
+
### 6. Write and report the verdict
|
|
85
95
|
|
|
86
96
|
#### If all ✓ (or only minor notes):
|
|
87
97
|
|
|
@@ -125,6 +135,8 @@ For **REQUEST CHANGES**, write the same file with `Verdict: REQUEST CHANGES` and
|
|
|
125
135
|
|
|
126
136
|
This is the **only file** you may write during review (not `src/`, not `tasks.md` checkboxes).
|
|
127
137
|
|
|
138
|
+
The conductor verifies the subagent's `Status: done`, checks that `review.md` exists with the reported verdict, and relays the result without editing it.
|
|
139
|
+
|
|
128
140
|
#### If any ✗:
|
|
129
141
|
|
|
130
142
|
```
|
|
@@ -148,6 +160,10 @@ Fix the above, then re-run `/opsx:review <name>`.
|
|
|
148
160
|
|
|
149
161
|
---
|
|
150
162
|
|
|
163
|
+
## Session Exit (Mandatory Order)
|
|
164
|
+
|
|
165
|
+
After writing the verdict: (1) attempt to update Memory `Change:<name>`, `Handoff:<name>`, and new `Decision:*`; (2) write `openspec/changes/<name>/handoff.md` using the orchestration skill template even if Memory fails; (3) print one fenced prompt beginning with the next `/opsx:*` command (`/opsx:apply <name>` only after APPROVE). Use `project.agent_language`, tell the next session to read Memory and the file fallback, omit banner labels and the full summary. Do not start the next phase in this chat.
|
|
166
|
+
|
|
151
167
|
## Guardrails
|
|
152
168
|
|
|
153
169
|
- **Never** edit source code, `src/`, or `tasks.md` checkboxes
|
|
@@ -16,6 +16,45 @@ This project uses a spec-driven role pipeline. Read `.agents/orchestrator.yaml`
|
|
|
16
16
|
- `/opsx:quick <name>` → MVP: propose + apply in one session (when `require_spec_review: false`)
|
|
17
17
|
- `/opsx:archive` → merges delta specs, moves change to archive
|
|
18
18
|
|
|
19
|
+
## Conductor Routing (Mandatory and Exclusive)
|
|
20
|
+
|
|
21
|
+
The parent `/opsx:*` session is the conductor. For specialist work it MUST spawn the one subagent selected below with a self-contained prompt, MUST verify the structured report, and MUST NOT perform that specialist's work itself. One signal maps to one primary subagent; do not substitute a generic agent.
|
|
22
|
+
|
|
23
|
+
| Phase / signal | MUST spawn | Specialist scope the conductor MUST NOT do |
|
|
24
|
+
|----------------|------------|--------------------------------------------|
|
|
25
|
+
| Status, gate failure, next command | `openspec-guide` | Pipeline diagnosis |
|
|
26
|
+
| Broken kit, MCP, or generated-file sync | `setup-doctor` | Kit setup repair |
|
|
27
|
+
| `/opsx:explore` repository investigation | `codebase-explorer` | Repository research; no specs or code |
|
|
28
|
+
| `/opsx:design` | `design-intake` | `design-brief.md` and `assets/` |
|
|
29
|
+
| `/opsx:propose` | `spec-architect` | Change proposal/design/specs/tasks |
|
|
30
|
+
| `/opsx:review` | `spec-reviewer` | Pre-apply spec verdict and `review.md` |
|
|
31
|
+
| Apply task with design brief/Figma/image | `design-implementer` | UI implementation |
|
|
32
|
+
| Apply ordinary implementation task | `code-writer` | One task's production code |
|
|
33
|
+
| Apply after implementation | `test-writer` | Automated tests |
|
|
34
|
+
| Apply before PR/MR | `code-reviewer` | Post-implementation spec review |
|
|
35
|
+
| `/opsx:archive` | `spec-archiver` | Delta merge and archive move |
|
|
36
|
+
|
|
37
|
+
`spec-reviewer` is never interchangeable with `code-reviewer`. During apply, only the conductor may mark a `tasks.md` checkbox, and only after a subagent reports `Status: done` and the conductor verifies the reported files.
|
|
38
|
+
|
|
39
|
+
## Session Start Protocol (Before Any Specialist Work)
|
|
40
|
+
|
|
41
|
+
1. Honor the pasted `/opsx:<phase> <name>` command and announce that role.
|
|
42
|
+
2. Run `npx agent-orchestrator-kit status` or `npx openspec list --json`; resolve the active change without exceeding `max_active_changes`.
|
|
43
|
+
3. Read Memory entities `Change:<name>`, `Handoff:<name>`, and `Decision:*`.
|
|
44
|
+
4. If Memory MCP is unavailable or those entities are empty, read `openspec/changes/<name>/handoff.md`. Memory failure alone MUST NOT block the session.
|
|
45
|
+
5. Only after context is restored, spawn the routed specialist.
|
|
46
|
+
|
|
47
|
+
If the user says “continue” / “next” without a command and exactly one active change has `Handoff.next_command` (from Memory or `handoff.md`), execute that command instead of asking which phase to run.
|
|
48
|
+
|
|
49
|
+
## Session Exit Protocol (Mandatory Order)
|
|
50
|
+
|
|
51
|
+
A phase is not closed until the conductor performs these steps in order:
|
|
52
|
+
|
|
53
|
+
1. Attempt to update Memory: `Change:<name>` (`status`, `tasks n/m`, `last_role`, `review`), `Handoff:<name>` (`next_role`, `next_command`, `session_count`, `summary`, `blocked`), and each new `Decision:<topic>` (`chosen`, `reason`).
|
|
54
|
+
2. Write the same state to `openspec/changes/<name>/handoff.md` with sections **Closed role**, **Done**, **Decisions**, **Blocked**, **Next command**, **Attach**, **Subagents to spawn**, and **Prompt**. Do this even if Memory is unavailable.
|
|
55
|
+
3. Print one fenced copy/paste prompt. Its first line MUST be `/opsx:<next> <name>`; its body MUST use `.agents/orchestrator.yaml` → `project.agent_language`, instruct the next session to read `Change:<name>`, `Handoff:<name>`, and `Decision:*`, and mention the `handoff.md` fallback. Do not add a service/banner label or duplicate the session summary.
|
|
56
|
+
4. Do NOT start the next phase in this chat.
|
|
57
|
+
|
|
19
58
|
## Session Rules
|
|
20
59
|
- One active change at a time (unless mvp profile: up to 3)
|
|
21
60
|
- Each role = new chat session (except `/opsx:quick` combines propose+apply)
|
|
@@ -40,16 +40,23 @@ Ensure present (do not duplicate):
|
|
|
40
40
|
|
|
41
41
|
## Memory Entity Format
|
|
42
42
|
|
|
43
|
-
Use these keys for orchestration state:
|
|
43
|
+
Use these keys and fields for orchestration state:
|
|
44
44
|
|
|
45
|
-
| Key |
|
|
46
|
-
|
|
47
|
-
| `Change:<name>` | status
|
|
48
|
-
| `
|
|
45
|
+
| Key | Required fields |
|
|
46
|
+
|-----|-----------------|
|
|
47
|
+
| `Change:<name>` | `status`, `tasks n/m`, `last_role`, `review` |
|
|
48
|
+
| `Handoff:<name>` | `next_role`, `next_command`, `session_count`, `summary`, `blocked` |
|
|
49
|
+
| `Decision:<topic>` | `chosen`, `reason` |
|
|
49
50
|
| `Convention:<area>` | project-specific rules |
|
|
50
|
-
|
|
51
|
+
|
|
52
|
+
## Session Lifecycle
|
|
53
|
+
|
|
54
|
+
At the start of every `/opsx:*` role session, after resolving the change and before specialist work, read `Change:<name>`, `Handoff:<name>`, and `Decision:*`. If Memory MCP is unavailable or those entities are empty, read `openspec/changes/<name>/handoff.md` and continue; Memory failure is not a blocker.
|
|
55
|
+
|
|
56
|
+
At session exit, first attempt to update `Change:<name>`, `Handoff:<name>`, and every new `Decision:<topic>`. Then always mirror the state to `openspec/changes/<name>/handoff.md`, even when the Memory write fails. Only after that attempt may the conductor emit the next-session prompt.
|
|
51
57
|
|
|
52
58
|
## Rules
|
|
53
59
|
- Do not overwrite existing correct config
|
|
54
60
|
- Do not delete other MCP servers
|
|
55
61
|
- Notify once: "Memory MCP connected."
|
|
62
|
+
- Never treat unavailable Memory MCP as a reason to stop when `handoff.md` can restore or persist state
|
|
@@ -42,6 +42,26 @@ Read `.agents/orchestrator.yaml` for project-specific config (language, flags, M
|
|
|
42
42
|
| Quick (MVP) | `/opsx:quick <name>` | specs+code | strong | `openspec/changes/` + `src/` |
|
|
43
43
|
| Verifier | CI / local scripts | — | — | exit codes |
|
|
44
44
|
|
|
45
|
+
## Conductor Routing (Mandatory and Exclusive)
|
|
46
|
+
|
|
47
|
+
The parent `/opsx:*` session is the conductor. It MUST spawn the selected specialist with a self-contained prompt, MUST verify the structured report, and MUST NOT do the specialist's work itself. Each signal has exactly one primary subagent.
|
|
48
|
+
|
|
49
|
+
| Phase / signal | MUST spawn | Specialist scope |
|
|
50
|
+
|----------------|------------|------------------|
|
|
51
|
+
| Status, gate failure, next command | `openspec-guide` | Read-only pipeline diagnosis |
|
|
52
|
+
| Broken kit, MCP, or generated-file sync | `setup-doctor` | Kit setup repair only |
|
|
53
|
+
| `/opsx:explore` repository investigation | `codebase-explorer` | Read-only repository research |
|
|
54
|
+
| `/opsx:design` | `design-intake` | `design-brief.md` and `assets/` only |
|
|
55
|
+
| `/opsx:propose` | `spec-architect` | Change artifacts only |
|
|
56
|
+
| `/opsx:review` | `spec-reviewer` | Pre-apply verdict and `review.md` only |
|
|
57
|
+
| Apply task with design brief/Figma/image | `design-implementer` | UI implementation |
|
|
58
|
+
| Apply ordinary implementation task | `code-writer` | One production-code task |
|
|
59
|
+
| Apply after implementation | `test-writer` | Automated tests |
|
|
60
|
+
| Apply before PR/MR | `code-reviewer` | Post-implementation spec review |
|
|
61
|
+
| `/opsx:archive` | `spec-archiver` | Delta merge and archive move |
|
|
62
|
+
|
|
63
|
+
`spec-reviewer` is not `code-reviewer`. During apply, specialists MUST NOT edit `tasks.md`; only the conductor may mark a checkbox after a `Status: done` report and verification that the reported files exist.
|
|
64
|
+
|
|
45
65
|
## Handoff Protocol
|
|
46
66
|
|
|
47
67
|
### explore → design (optional)
|
|
@@ -110,9 +130,11 @@ After PR merged + CI green:
|
|
|
110
130
|
## Session Rules
|
|
111
131
|
|
|
112
132
|
**Start of each session:**
|
|
113
|
-
1.
|
|
114
|
-
2. Run `npx agent-orchestrator-kit status` (or `npx openspec list`)
|
|
115
|
-
3. Read
|
|
133
|
+
1. Honor the pasted `/opsx:<phase> <name>` command and announce that role.
|
|
134
|
+
2. Run `npx agent-orchestrator-kit status` (or `npx openspec list --json`) and read `orchestrator.yaml`; resolve the active change and gates.
|
|
135
|
+
3. Read Memory entities `Change:<name>`, `Handoff:<name>`, and `Decision:*`.
|
|
136
|
+
4. If Memory MCP is unavailable or those entities are empty, read `openspec/changes/<name>/handoff.md`; Memory failure alone is not a blocker.
|
|
137
|
+
5. Only after restoration, spawn the routed specialist. If the user said “continue” / “next” and exactly one active change has `Handoff.next_command`, execute it instead of asking for a phase.
|
|
116
138
|
|
|
117
139
|
**During session:**
|
|
118
140
|
- Stay in role — do not drift into next phase
|
|
@@ -120,9 +142,45 @@ After PR merged + CI green:
|
|
|
120
142
|
- Never edit files outside your role's allowed output
|
|
121
143
|
|
|
122
144
|
**End of each session:**
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
-
|
|
145
|
+
1. Attempt to update Memory: `Change:<name>` (`status`, `tasks n/m`, `last_role`, `review`), `Handoff:<name>` (`next_role`, `next_command`, `session_count`, `summary`, `blocked`), and new `Decision:<topic>` entities (`chosen`, `reason`).
|
|
146
|
+
2. Even if Memory fails, write `openspec/changes/<name>/handoff.md` using the template below.
|
|
147
|
+
3. Print exactly one fenced next-session prompt after the write attempt. The first line is `/opsx:<next> <name>`; the body uses `project.agent_language`, tells the next session to read Memory and the file fallback, has no banner label, and does not repeat the summary.
|
|
148
|
+
4. Do not start the next phase in this chat. If apply, include build/lint status in the persisted summary.
|
|
149
|
+
|
|
150
|
+
`handoff.md` template:
|
|
151
|
+
|
|
152
|
+
````markdown
|
|
153
|
+
# Session Handoff
|
|
154
|
+
|
|
155
|
+
## Closed role
|
|
156
|
+
<role and completion status>
|
|
157
|
+
|
|
158
|
+
## Done
|
|
159
|
+
<concise persisted summary>
|
|
160
|
+
|
|
161
|
+
## Decisions
|
|
162
|
+
- <decision or none>
|
|
163
|
+
|
|
164
|
+
## Blocked
|
|
165
|
+
<blocker or none>
|
|
166
|
+
|
|
167
|
+
## Next command
|
|
168
|
+
`/opsx:<next> <name>`
|
|
169
|
+
|
|
170
|
+
## Attach
|
|
171
|
+
- `openspec/changes/<name>/<artifact>`
|
|
172
|
+
|
|
173
|
+
## Subagents to spawn
|
|
174
|
+
- `<subagent>` — <signal>
|
|
175
|
+
|
|
176
|
+
## Prompt
|
|
177
|
+
|
|
178
|
+
```text
|
|
179
|
+
/opsx:<next> <name>
|
|
180
|
+
|
|
181
|
+
<Localized start instruction in project.agent_language. Read Memory Change:<name>, Handoff:<name>, Decision:* before work. If Memory is unavailable, read openspec/changes/<name>/handoff.md. Act as conductor and do not mix phases.>
|
|
182
|
+
```
|
|
183
|
+
````
|
|
126
184
|
|
|
127
185
|
## Model Selection Guide
|
|
128
186
|
|
|
@@ -136,18 +194,17 @@ After PR merged + CI green:
|
|
|
136
194
|
| apply simple | 1–2 file change | medium or fast |
|
|
137
195
|
| fix lint | Mechanical | fast |
|
|
138
196
|
|
|
139
|
-
## Memory
|
|
197
|
+
## Mandatory Memory and Handoff Protocol
|
|
140
198
|
|
|
141
|
-
|
|
199
|
+
Before specialist work, the conductor MUST restore context in order: honor the pasted `/opsx:*` command; read Memory entities `Change:<name>`, `Handoff:<name>`, and `Decision:*`; if Memory is unavailable or empty, read `openspec/changes/<name>/handoff.md`. Memory failure is not a blocker when the file exists. With one active change, free-form “continue” uses `Handoff.next_command` instead of asking for the phase.
|
|
142
200
|
|
|
143
|
-
|
|
144
|
-
|-----|---------------|
|
|
145
|
-
| `Change:<name>` | `status: spec-approved, tasks: 3/7` |
|
|
146
|
-
| `Decision:<topic>` | `chosen: xlsx over csv, reason: ...` |
|
|
147
|
-
| `Convention:<area>` | `api errors: use ApiError class` |
|
|
148
|
-
| `Handoff:<name>` | `next_role: implementer, session_count: 2` |
|
|
201
|
+
Before declaring a session closed, the conductor MUST, in order: (1) update Memory, (2) mirror state to `openspec/changes/<name>/handoff.md`, (3) print one fenced next-session prompt whose first line is `/opsx:<next> <name>`. The prompt has no `NEXT_SESSION_PROMPT` label, tells the next session to read Memory, uses `project.agent_language`, and does not duplicate the full summary. Never start the next phase in the current chat.
|
|
149
202
|
|
|
150
|
-
|
|
203
|
+
| Entity | Required fields |
|
|
204
|
+
|--------|-----------------|
|
|
205
|
+
| `Change:<name>` | `status`, `tasks n/m`, `last_role`, `review` |
|
|
206
|
+
| `Handoff:<name>` | `next_role`, `next_command`, `session_count`, `summary`, `blocked` |
|
|
207
|
+
| `Decision:<topic>` | `chosen`, `reason` |
|
|
151
208
|
|
|
152
209
|
## Orchestration Checklist (per change)
|
|
153
210
|
|
|
@@ -13,6 +13,8 @@ Implement tasks from an OpenSpec change.
|
|
|
13
13
|
|
|
14
14
|
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
|
15
15
|
|
|
16
|
+
**Conductor delegation is mandatory:** the parent MUST NOT implement code or tests. For each task spawn `design-implementer` when a design brief/Figma/image signal exists, otherwise `code-writer`; then spawn `test-writer` for required tests and `code-reviewer` before PR/MR. Require each structured report. Only the conductor may edit `tasks.md` checkboxes.
|
|
17
|
+
|
|
16
18
|
**Steps**
|
|
17
19
|
|
|
18
20
|
1. **Select the change**
|
|
@@ -71,9 +73,10 @@ Implement tasks from an OpenSpec change.
|
|
|
71
73
|
|
|
72
74
|
For each pending task:
|
|
73
75
|
- Show which task is being worked on
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
76
|
+
- Spawn the routed implementation subagent with one self-contained task; do not make code changes in the parent
|
|
77
|
+
- Verify `Status: done` and that every reported file exists
|
|
78
|
+
- Spawn `test-writer` for required tests and verify its report
|
|
79
|
+
- Only then, as conductor, mark the task complete in the tasks file: `- [ ]` → `- [x]`
|
|
77
80
|
- Continue to next task
|
|
78
81
|
|
|
79
82
|
**Pause if:**
|
|
@@ -147,7 +150,7 @@ What would you like to do?
|
|
|
147
150
|
- If task is ambiguous, pause and ask before implementing
|
|
148
151
|
- If implementation reveals issues, pause and suggest artifact updates
|
|
149
152
|
- Keep code changes minimal and scoped to each task
|
|
150
|
-
-
|
|
153
|
+
- Never let a specialist update `tasks.md`; the conductor updates a checkbox only after a verified `done` report
|
|
151
154
|
- Pause on errors, blockers, or unclear requirements - don't guess
|
|
152
155
|
- Use contextFiles from CLI output, don't assume specific file names
|
|
153
156
|
|
|
@@ -13,6 +13,8 @@ Archive a completed change in the experimental workflow.
|
|
|
13
13
|
|
|
14
14
|
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
|
15
15
|
|
|
16
|
+
**Conductor delegation is mandatory:** after resolving the change and confirming archive gates, spawn `spec-archiver` with a self-contained prompt. The parent MUST NOT compare/merge main specs or move the change itself; it only verifies the structured report, archive path, and validation result.
|
|
17
|
+
|
|
16
18
|
**Steps**
|
|
17
19
|
|
|
18
20
|
1. **If no change name provided, prompt for selection**
|
|
@@ -55,20 +57,22 @@ Archive a completed change in the experimental workflow.
|
|
|
55
57
|
|
|
56
58
|
4. **Assess delta spec sync state**
|
|
57
59
|
|
|
58
|
-
Use `artifactPaths.specs.existingOutputPaths` from status JSON to
|
|
60
|
+
Use `artifactPaths.specs.existingOutputPaths` from status JSON to identify delta specs. Pass these paths and the user's sync preference to `spec-archiver`; the parent MUST NOT compare or merge specs itself.
|
|
59
61
|
|
|
60
62
|
**If delta specs exist:**
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
63
|
+
- Ask whether main specs should be synced before archive
|
|
64
|
+
- Include the delta and main spec paths in the `spec-archiver` prompt
|
|
65
|
+
- Have `spec-archiver` return the combined sync summary in its report
|
|
64
66
|
|
|
65
67
|
**Prompt options:**
|
|
66
68
|
- If changes needed: "Sync now (recommended)", "Archive without syncing"
|
|
67
69
|
- If already synced: "Archive now", "Sync anyway", "Cancel"
|
|
68
70
|
|
|
69
|
-
|
|
71
|
+
The `spec-archiver` performs any requested comparison and sync as part of its isolated work; do not spawn a generic sync agent.
|
|
72
|
+
|
|
73
|
+
5. **Spawn the specialist and perform the archive**
|
|
70
74
|
|
|
71
|
-
|
|
75
|
+
Spawn `spec-archiver`, require `## Subagent report: spec-archiver`, and delegate the sync/archive operations below. Do not run them in the parent session.
|
|
72
76
|
|
|
73
77
|
Create an `archive` directory under `planningHome.changesDir` if it doesn't exist:
|
|
74
78
|
```bash
|
|
@@ -85,7 +89,9 @@ Archive a completed change in the experimental workflow.
|
|
|
85
89
|
mv "<changeRoot>" "<planningHome.changesDir>/archive/YYYY-MM-DD-<name>"
|
|
86
90
|
```
|
|
87
91
|
|
|
88
|
-
6. **
|
|
92
|
+
6. **Verify the report and display summary**
|
|
93
|
+
|
|
94
|
+
The conductor verifies `Status: done`, the reported archive path, and modified main specs before reporting completion.
|
|
89
95
|
|
|
90
96
|
Show archive completion summary including:
|
|
91
97
|
- Change name
|
|
@@ -11,7 +11,9 @@ metadata:
|
|
|
11
11
|
|
|
12
12
|
Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
|
|
13
13
|
|
|
14
|
-
**IMPORTANT: Explore mode is
|
|
14
|
+
**IMPORTANT: Explore mode is read-only thinking, not implementation or artifact authoring.** You must NEVER write code or OpenSpec artifacts.
|
|
15
|
+
|
|
16
|
+
**Conductor delegation is mandatory:** for repository investigation, spawn `codebase-explorer` with a self-contained question and require its structured report. Do not search or trace the codebase in the parent session; synthesize the report into the conversation.
|
|
15
17
|
|
|
16
18
|
**This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
|
|
17
19
|
|
|
@@ -277,7 +279,7 @@ But this summary is optional. Sometimes the thinking IS the value.
|
|
|
277
279
|
|
|
278
280
|
## Guardrails
|
|
279
281
|
|
|
280
|
-
- **Don't implement** - Never write code or
|
|
282
|
+
- **Don't implement or author artifacts** - Never write code or OpenSpec files in explore.
|
|
281
283
|
- **Don't fake understanding** - If something is unclear, dig deeper
|
|
282
284
|
- **Don't rush** - Discovery is thinking time, not task time
|
|
283
285
|
- **Don't force structure** - Let patterns emerge naturally
|
|
@@ -22,6 +22,8 @@ When ready to implement, run /opsx:apply
|
|
|
22
22
|
|
|
23
23
|
**Input**: The user's request should include a change name (kebab-case) OR a description of what they want to build.
|
|
24
24
|
|
|
25
|
+
**Conductor delegation is mandatory:** spawn `spec-architect` with the resolved name, decision brief, design brief if present, and artifact instructions. The parent MUST NOT create or edit proposal/design/specs/tasks; after the structured report it may only verify paths, run status, and run strict validation.
|
|
26
|
+
|
|
25
27
|
**Steps**
|
|
26
28
|
|
|
27
29
|
1. **If no clear input provided, ask what they want to build**
|
|
@@ -33,13 +35,17 @@ When ready to implement, run /opsx:apply
|
|
|
33
35
|
|
|
34
36
|
**IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
|
|
35
37
|
|
|
36
|
-
2. **
|
|
38
|
+
2. **Spawn the specialist**
|
|
39
|
+
|
|
40
|
+
Spawn `spec-architect` with a self-contained prompt and require `## Subagent report: spec-architect`. Delegate steps 3–5 to it; do not perform artifact creation in the parent session.
|
|
41
|
+
|
|
42
|
+
3. **Create the change directory**
|
|
37
43
|
```bash
|
|
38
44
|
npx openspec new change "<name>"
|
|
39
45
|
```
|
|
40
46
|
This creates a scaffolded change in the planning home resolved by the CLI with `.openspec.yaml`.
|
|
41
47
|
|
|
42
|
-
|
|
48
|
+
4. **Get the artifact build order**
|
|
43
49
|
```bash
|
|
44
50
|
npx openspec status --change "<name>" --json
|
|
45
51
|
```
|
|
@@ -48,7 +54,7 @@ When ready to implement, run /opsx:apply
|
|
|
48
54
|
- `artifacts`: list of all artifacts with their status and dependencies
|
|
49
55
|
- `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
|
|
50
56
|
|
|
51
|
-
|
|
57
|
+
5. **Create artifacts in sequence until apply-ready**
|
|
52
58
|
|
|
53
59
|
Use the **TodoWrite tool** to track progress through the artifacts.
|
|
54
60
|
|
|
@@ -80,7 +86,9 @@ When ready to implement, run /opsx:apply
|
|
|
80
86
|
- Use **AskUserQuestion tool** to clarify
|
|
81
87
|
- Then continue with creation
|
|
82
88
|
|
|
83
|
-
|
|
89
|
+
6. **Verify the report and show final status**
|
|
90
|
+
|
|
91
|
+
The conductor verifies `Status: done` and each reported artifact path, then runs:
|
|
84
92
|
```bash
|
|
85
93
|
npx openspec status --change "<name>"
|
|
86
94
|
```
|
|
@@ -90,8 +98,8 @@ When ready to implement, run /opsx:apply
|
|
|
90
98
|
After completing all artifacts, summarize:
|
|
91
99
|
- Change name and location
|
|
92
100
|
- List of artifacts created with brief descriptions
|
|
93
|
-
- What's ready: "All artifacts created! Ready for
|
|
94
|
-
- Prompt: "Run `/opsx:
|
|
101
|
+
- What's ready: "All artifacts created and validated! Ready for spec review."
|
|
102
|
+
- Prompt: "Run `/opsx:review <name>` in a fresh session."
|
|
95
103
|
|
|
96
104
|
**Artifact Creation Guidelines**
|
|
97
105
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: code-reviewer
|
|
3
|
-
description:
|
|
3
|
+
description: Post-implementation spec-compliance reviewer. ALWAYS use during /opsx:apply after code and tests, before a PR/MR. Do NOT use for the pre-apply /opsx:review gate, security review, general bug hunting, or file edits.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
You are a read-only reviewer. You never edit files. Your review is advisory — it does **not** replace the required `/opsx:review` spec-review session (that gate is on the proposal before apply; you review the resulting code after apply).
|
|
@@ -30,3 +30,14 @@ Output format:
|
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
Be specific — cite file and line/region for every issue. If everything is fine, say so briefly instead of inventing nitpicks.
|
|
33
|
+
|
|
34
|
+
End with:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
## Subagent report: code-reviewer
|
|
38
|
+
**Status:** done | blocked
|
|
39
|
+
**Files:** files reviewed (or none)
|
|
40
|
+
**Done:** spec-compliance verdict
|
|
41
|
+
**Blocked:** missing diff/spec context or none
|
|
42
|
+
**Risks:** remaining implementation concerns or none
|
|
43
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: code-writer
|
|
3
|
-
description: Implementation specialist.
|
|
3
|
+
description: Implementation specialist. ALWAYS use during /opsx:apply for one clearly scoped non-design task. Do NOT use to choose architecture, write OpenSpec artifacts, tests-only work, review code, or mark tasks.md checkboxes.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
You implement one scoped unit of work at a time. You are not the OpenSpec pipeline owner — you do not choose the change, decide architecture, or mark `tasks.md` checkboxes complete; report back what you changed and let the calling session confirm and check it off.
|
|
@@ -18,4 +18,15 @@ While writing code:
|
|
|
18
18
|
- Match the project's existing patterns for state management, HTTP calls, and component structure rather than inventing new ones.
|
|
19
19
|
- If the task is ambiguous or the codebase has no established pattern to follow, stop and ask instead of guessing.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Never edit `tasks.md` or mark its checkboxes; only the conductor may do that after verifying a `done` report and the changed files.
|
|
22
|
+
|
|
23
|
+
Return exactly this report contract:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
## Subagent report: code-writer
|
|
27
|
+
**Status:** done | blocked
|
|
28
|
+
**Files:** files changed (or none)
|
|
29
|
+
**Done:** one-line summary per file
|
|
30
|
+
**Blocked:** unresolved implementation issue or none
|
|
31
|
+
**Risks:** edge cases, follow-up tests, or none
|
|
32
|
+
```
|