agent-orchestrator-kit 0.1.12 → 0.1.14

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +65 -32
  3. package/bin/agent-orchestrator.js +559 -1
  4. package/package.json +2 -2
  5. package/profiles/generic/orchestrator.yaml +6 -0
  6. package/profiles/mvp/orchestrator.yaml +6 -0
  7. package/profiles/node/orchestrator.yaml +6 -0
  8. package/profiles/vue3/orchestrator.yaml +6 -0
  9. package/templates/.agents/amp.settings.json.example +2 -5
  10. package/templates/.agents/commands/opsx-apply.md +22 -4
  11. package/templates/.agents/commands/opsx-archive.md +28 -7
  12. package/templates/.agents/commands/opsx-design.md +28 -5
  13. package/templates/.agents/commands/opsx-explore.md +19 -2
  14. package/templates/.agents/commands/opsx-propose.md +29 -6
  15. package/templates/.agents/commands/opsx-quick.md +25 -2
  16. package/templates/.agents/commands/opsx-review.md +27 -4
  17. package/templates/.agents/mcp.json.example +2 -5
  18. package/templates/.agents/rules/agent-orchestration.mdc +46 -0
  19. package/templates/.agents/rules/cli-via-npm.mdc +2 -1
  20. package/templates/.agents/rules/memory-mcp-autosetup.mdc +34 -14
  21. package/templates/.agents/rules/session-handoff.mdc +46 -0
  22. package/templates/.agents/skills/agent-orchestration/SKILL.md +91 -17
  23. package/templates/.agents/skills/openspec-apply-change/SKILL.md +7 -4
  24. package/templates/.agents/skills/openspec-archive-change/SKILL.md +13 -7
  25. package/templates/.agents/skills/openspec-explore/SKILL.md +4 -2
  26. package/templates/.agents/skills/openspec-propose/SKILL.md +14 -6
  27. package/templates/.agents/subagents/code-reviewer.md +12 -1
  28. package/templates/.agents/subagents/code-writer.md +13 -2
  29. package/templates/.agents/subagents/codebase-explorer.md +31 -0
  30. package/templates/.agents/subagents/design-implementer.md +13 -2
  31. package/templates/.agents/subagents/design-intake.md +31 -0
  32. package/templates/.agents/subagents/openspec-guide.md +12 -1
  33. package/templates/.agents/subagents/session-handoff.md +48 -0
  34. package/templates/.agents/subagents/setup-doctor.md +12 -3
  35. package/templates/.agents/subagents/spec-architect.md +32 -0
  36. package/templates/.agents/subagents/spec-archiver.md +31 -0
  37. package/templates/.agents/subagents/spec-reviewer.md +32 -0
  38. package/templates/.agents/subagents/test-writer.md +13 -2
  39. package/templates/AGENTS.md +37 -3
  40. package/templates/CLAUDE.md +24 -0
  41. package/templates/orchestrator.yaml +9 -0
  42. package/templates/scripts/memory-mcp-launcher.cjs +46 -0
  43. package/templates/scripts/sync-local-agent-skills.sh +2 -0
@@ -6,15 +6,18 @@ alwaysApply: true
6
6
  # Memory MCP Auto-Setup
7
7
 
8
8
  At session start: check `.mcp.json` (Cursor) and `.amp/settings.json` (Amp).
9
- If `memory` MCP is absent — add it silently.
9
+ If `memory` MCP is absent or uses a **relative** `MEMORY_FILE_PATH` — run `npx agent-orchestrator-kit memory-setup` silently.
10
+
11
+ Shared memory file: `.cursor/memory.json` (same path for Cursor and Amp).
12
+
13
+ **CRITICAL:** never set `MEMORY_FILE_PATH` to a relative path. Relative `.cursor/memory.json` resolves inside npx `dist/` — Amp then reads the wrong graph (looks like "memory ignored"). Always start Memory via `node scripts/memory-mcp-launcher.cjs`, which injects an absolute path.
10
14
 
11
15
  ## Cursor (.mcp.json)
12
16
 
13
17
  ```json
14
18
  "memory": {
15
- "command": "npx",
16
- "args": ["-y", "@modelcontextprotocol/server-memory"],
17
- "env": { "MEMORY_FILE_PATH": ".cursor/memory.json" }
19
+ "command": "node",
20
+ "args": ["scripts/memory-mcp-launcher.cjs"]
18
21
  }
19
22
  ```
20
23
 
@@ -23,13 +26,20 @@ If `memory` MCP is absent — add it silently.
23
26
  ```json
24
27
  "amp.mcpServers": {
25
28
  "memory": {
26
- "command": "npx",
27
- "args": ["-y", "@modelcontextprotocol/server-memory"],
28
- "env": { "MEMORY_FILE_PATH": ".cursor/memory.json" }
29
+ "command": "node",
30
+ "args": ["scripts/memory-mcp-launcher.cjs"]
29
31
  }
30
32
  }
31
33
  ```
32
34
 
35
+ If Amp CLI is available and memory is missing:
36
+
37
+ ```bash
38
+ npx agent-orchestrator-kit memory-setup
39
+ ```
40
+
41
+ Do not run `amp mcp add` with a relative `MEMORY_FILE_PATH`.
42
+
33
43
  ## .gitignore
34
44
 
35
45
  Ensure present (do not duplicate):
@@ -40,16 +50,26 @@ Ensure present (do not duplicate):
40
50
 
41
51
  ## Memory Entity Format
42
52
 
43
- Use these keys for orchestration state:
53
+ Use these keys and fields for orchestration state:
44
54
 
45
- | Key | Value |
46
- |-----|-------|
47
- | `Change:<name>` | status, task progress |
48
- | `Decision:<topic>` | chosen option + rationale |
55
+ | Key | Required fields |
56
+ |-----|-----------------|
57
+ | `Change:<name>` | `status`, `tasks n/m`, `last_role`, `review` |
58
+ | `Handoff:<name>` | `next_role`, `next_command`, `session_count`, `summary`, `blocked` |
59
+ | `Decision:<topic>` | `chosen`, `reason` |
49
60
  | `Convention:<area>` | project-specific rules |
50
- | `Handoff:<name>` | next role, session count |
61
+
62
+ The deterministic writer is `npx agent-orchestrator-kit handoff <name>` — it upserts `.cursor/memory.json` even when MCP tools are ignored. Also call Memory MCP create/update when tools work.
63
+
64
+ ## Session Lifecycle
65
+
66
+ At the start of every `/opsx:*` role session, after resolving the change and before specialist work: `npx agent-orchestrator-kit handoff --restore`, then 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.
67
+
68
+ At session exit, spawn `session-handoff` (Amp: isolated `subagent-session-handoff`), write `handoff.md`, then run `npx agent-orchestrator-kit handoff <name>` (exit 0 required). Paste the CLI stdout prompt complete. Only after that attempt Memory MCP updates. You are not done without the fenced prompt.
51
69
 
52
70
  ## Rules
53
- - Do not overwrite existing correct config
71
+ - Do not overwrite existing correct launcher config
54
72
  - Do not delete other MCP servers
55
73
  - Notify once: "Memory MCP connected."
74
+ - Never treat unavailable Memory MCP as a reason to skip `handoff.md` or the CLI
75
+ - Never leave a relative `MEMORY_FILE_PATH` in Cursor or Amp config
@@ -0,0 +1,46 @@
1
+ ---
2
+ description: Mandatory session restore, Memory persist, subagent spawn, and next-thread prompt
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Session Handoff — HARD STOP (Amp / Cursor / Claude)
7
+
8
+ This rule overrides convenience. A `/opsx:*` session that skips these steps is incomplete.
9
+
10
+ Amp ignores soft reminders. Treat every MUST below as a gate. If a spawn tool exists, use it. If it does not, run the CLI yourself. Never skip persist because “the user already knows”.
11
+
12
+ ## You are not done
13
+
14
+ FORBIDDEN until persist succeeds: saying done / готово, starting the next phase, or omitting the fenced next-thread prompt.
15
+
16
+ ## Session start (before any specialist work)
17
+
18
+ 1. Honor the pasted `/opsx:<phase> <name>` command and announce that role.
19
+ 2. Run `npx agent-orchestrator-kit status`.
20
+ 3. Run `npx agent-orchestrator-kit handoff --restore` (or `handoff <name> --restore`). Use the printed briefing.
21
+ 4. Read Memory `Change:<name>`, `Handoff:<name>`, `Decision:*` when MCP works.
22
+ 5. If restore CLI fails and Memory is empty, read `openspec/changes/<name>/handoff.md`. Memory failure is not a blocker when the file exists.
23
+ 6. Spawn `session-handoff` in restore mode when context is incomplete (Amp: isolated `subagent-session-handoff`, never the main thread).
24
+ 7. Spawn the routed phase specialist from `.agents/rules/agent-orchestration.mdc`. Amp: isolated `subagent-<name>`. Executing specialist work in the parent thread is a protocol violation.
25
+ 8. Free-form “continue” / “next” / «продовжуй» / «далі» with one active change → execute `Handoff.next_command`. Do not ask which phase.
26
+
27
+ ## Session exit (mandatory order)
28
+
29
+ 1. Spawn `session-handoff` in persist mode (Amp: isolated `subagent-session-handoff`). If spawn fails, do the persist steps in the parent — never skip.
30
+ 2. Write `openspec/changes/<name>/handoff.md` with: Closed role, Change, Done, Decisions, Blocked, Next command, Next role, Attach, Subagents to spawn, Constraints.
31
+ 3. Run `npx agent-orchestrator-kit handoff <name>` and require exit 0. The CLI upserts `.cursor/memory.json` with an absolute path and prints the expanded prompt on stdout.
32
+ 4. If Memory MCP tools work, also update `Change:<name>`, `Handoff:<name>`, `Decision:*` to match.
33
+ 5. Paste the CLI stdout into chat as one fenced block. Keep it complete. No `NEXT_SESSION_PROMPT` banner. First line is `/opsx:…`. Body uses `project.agent_language`.
34
+ 6. Stop. The next role starts in a **new** chat with that pasted prompt.
35
+
36
+ ## Next-thread prompt must be self-contained
37
+
38
+ The prompt is the next thread’s operating brief. It MUST include: role, change name, language, hard constraints, start checklist, which subagent to spawn (including Amp isolated wrapper name), full Done / Decisions / Blocked / tasks / review / attach, and the exit HARD STOP. Do not emit a thin “read Memory” stub. Amp often skips Memory MCP; the pasted prompt must still be enough to work.
39
+
40
+ ## Memory path
41
+
42
+ Never configure Memory MCP with a relative `MEMORY_FILE_PATH`. Relative `.cursor/memory.json` resolves inside npx `dist/` and looks like “memory ignored”. Use `node scripts/memory-mcp-launcher.cjs` (Cursor `.mcp.json` and Amp `.amp/settings.json`). Run `npx agent-orchestrator-kit memory-setup` when the launcher is missing or the path is relative.
43
+
44
+ ## Amp isolation
45
+
46
+ Every `subagent-*` skill MUST be spawned as an isolated subagent with fresh context. Running the wrapper body in the main Amp thread is a protocol violation. If spawn is unavailable, STOP and report blocked — do not impersonate the specialist.
@@ -42,6 +42,27 @@ 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
+ | Session start restore / session exit persist | `session-handoff` | Memory, `handoff.md`, next-thread prompt |
53
+ | Broken kit, MCP, or generated-file sync | `setup-doctor` | Kit setup repair only |
54
+ | `/opsx:explore` repository investigation | `codebase-explorer` | Read-only repository research |
55
+ | `/opsx:design` | `design-intake` | `design-brief.md` and `assets/` only |
56
+ | `/opsx:propose` | `spec-architect` | Change artifacts only |
57
+ | `/opsx:review` | `spec-reviewer` | Pre-apply verdict and `review.md` only |
58
+ | Apply task with design brief/Figma/image | `design-implementer` | UI implementation |
59
+ | Apply ordinary implementation task | `code-writer` | One production-code task |
60
+ | Apply after implementation | `test-writer` | Automated tests |
61
+ | Apply before PR/MR | `code-reviewer` | Post-implementation spec review |
62
+ | `/opsx:archive` | `spec-archiver` | Delta merge and archive move |
63
+
64
+ `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.
65
+
45
66
  ## Handoff Protocol
46
67
 
47
68
  ### explore → design (optional)
@@ -110,19 +131,73 @@ After PR merged + CI green:
110
131
  ## Session Rules
111
132
 
112
133
  **Start of each session:**
113
- 1. Announce role: "Starting Spec Reviewer session for change: <name>"
114
- 2. Run `npx agent-orchestrator-kit status` (or `npx openspec list`) — confirm active change limit (`max_active_changes` in orchestrator.yaml) and see task/review/brief progress for every active change at a glance
115
- 3. Read `orchestrator.yaml` for project config and review gate
134
+ 1. Honor the pasted `/opsx:<phase> <name>` command and announce that role.
135
+ 2. Run `npx agent-orchestrator-kit status` (or `npx openspec list --json`) and read `orchestrator.yaml`; resolve the active change and gates.
136
+ 3. Run `npx agent-orchestrator-kit handoff --restore` (or `handoff <name> --restore`).
137
+ 4. Read Memory entities `Change:<name>`, `Handoff:<name>`, and `Decision:*` when MCP works.
138
+ 5. If restore CLI fails and Memory is empty, read `openspec/changes/<name>/handoff.md`; Memory failure alone is not a blocker.
139
+ 6. Spawn `session-handoff` in restore mode when context is incomplete (Amp: isolated `subagent-session-handoff`).
140
+ 7. Only after restoration, spawn the routed phase 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
141
 
117
142
  **During session:**
118
143
  - Stay in role — do not drift into next phase
119
144
  - Pause and ask if requirements are unclear
120
145
  - Never edit files outside your role's allowed output
121
146
 
122
- **End of each session:**
123
- - Show progress summary
124
- - State explicit next step and next role
125
- - If apply: confirm build/lint status
147
+ **End of each session (HARD STOP — you are NOT done):**
148
+ 1. Spawn `session-handoff` in persist mode (Amp: isolated `subagent-session-handoff`). If spawn fails, persist in the parent — never skip.
149
+ 2. Write `openspec/changes/<name>/handoff.md` using the template below even if Memory MCP fails.
150
+ 3. Run `npx agent-orchestrator-kit handoff <name>` and require exit 0. The CLI upserts Memory JSON with an absolute path and prints the expanded self-contained prompt on stdout.
151
+ 4. If Memory MCP tools work, also update `Change:<name>`, `Handoff:<name>`, and new `Decision:<topic>` entities.
152
+ 5. Paste the CLI stdout as one fenced next-session prompt. First line is `/opsx:<next> <name>`; body uses `project.agent_language`; keep Done/Decisions/Blocked/spawn/HARD STOP complete. No banner. Do not emit a thin “read Memory” stub.
153
+ 6. Do not start the next phase in this chat. If apply, include build/lint status in the persisted Done section.
154
+
155
+ `handoff.md` template:
156
+
157
+ ````markdown
158
+ # Session Handoff
159
+
160
+ ## Closed role
161
+ <role and completion status>
162
+
163
+ ## Change
164
+ - name: <name>
165
+ - status: <proposed | spec-approved | applying | blocked>
166
+ - tasks: <n/m>
167
+ - review: <pending | APPROVE | REQUEST_CHANGES | none>
168
+ - last_role: <role>
169
+
170
+ ## Done
171
+ <full persisted summary the next thread needs>
172
+
173
+ ## Decisions
174
+ - <topic>: <chosen> — <reason>
175
+
176
+ ## Blocked
177
+ <blocker or none>
178
+
179
+ ## Next command
180
+ `/opsx:<next> <name>`
181
+
182
+ ## Next role
183
+ <role or subagent name>
184
+
185
+ ## Attach
186
+ - `openspec/changes/<name>/<artifact>`
187
+
188
+ ## Subagents to spawn
189
+ - `<phase-specialist>` — <signal> (Amp: isolated `subagent-<name>`)
190
+ - `session-handoff` — restore at start, persist at exit (Amp: isolated `subagent-session-handoff`)
191
+
192
+ ## Constraints
193
+ - language: <project.agent_language>
194
+ - do not mix phases
195
+ - conductor must spawn specialists
196
+
197
+ ## Prompt
198
+
199
+ The Prompt section is overwritten by `npx agent-orchestrator-kit handoff <name>`. Do not hand-write a thin stub.
200
+ ````
126
201
 
127
202
  ## Model Selection Guide
128
203
 
@@ -136,18 +211,17 @@ After PR merged + CI green:
136
211
  | apply simple | 1–2 file change | medium or fast |
137
212
  | fix lint | Mechanical | fast |
138
213
 
139
- ## Memory MCP Entities
214
+ ## Mandatory Memory and Handoff Protocol
140
215
 
141
- Store these between sessions (key → value):
216
+ Before specialist work, the conductor MUST restore context in order: honor the pasted `/opsx:*` command; run `npx agent-orchestrator-kit handoff --restore`; read Memory entities `Change:<name>`, `Handoff:<name>`, and `Decision:*`; if restore CLI and Memory fail, 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. Amp MUST spawn `session-handoff` and the phase specialist as isolated `subagent-*` skills.
142
217
 
143
- | Key | Example value |
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` |
218
+ Before declaring a session closed, the conductor MUST, in order: (1) spawn `session-handoff` persist, (2) write `openspec/changes/<name>/handoff.md`, (3) run `npx agent-orchestrator-kit handoff <name>` (exit 0), (4) paste the CLI stdout prompt whose first line is `/opsx:<next> <name>`. The prompt has no `NEXT_SESSION_PROMPT` label, uses `project.agent_language`, and MUST be self-contained (Done, Decisions, Blocked, attach, spawn, HARD STOP) so the next thread can run if Memory MCP is ignored. Never start the next phase in the current chat.
149
219
 
150
- At start of new session: read relevant entities to restore context without re-explanation.
220
+ | Entity | Required fields |
221
+ |--------|-----------------|
222
+ | `Change:<name>` | `status`, `tasks n/m`, `last_role`, `review` |
223
+ | `Handoff:<name>` | `next_role`, `next_command`, `session_count`, `summary`, `blocked` |
224
+ | `Decision:<topic>` | `chosen`, `reason` |
151
225
 
152
226
  ## Orchestration Checklist (per change)
153
227
 
@@ -169,7 +243,7 @@ At start of new session: read relevant entities to restore context without re-ex
169
243
  | All tasks in one apply session | Context overload; model drifts |
170
244
  | No archive after merge | Next propose has stale domain specs |
171
245
  | Strong model on lint fixes | 5–10x cost with no quality gain |
172
- | Skip Memory MCP | Every session re-explains domain |
246
+ | Skip Memory MCP / skip `handoff` CLI | Next thread has no context; Amp looks like it “ignored the rules” |
173
247
 
174
248
  ## Metrics (health check per change)
175
249
 
@@ -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
- - Make the code changes required
75
- - Keep changes minimal and focused
76
- - Mark task complete in the tasks file: `- [ ]` → `- [x]`
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
- - Update task checkbox immediately after completing each task
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 check for delta specs. If none exist, proceed without sync prompt.
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
- - Compare each delta spec with its corresponding main spec at `openspec/specs/<capability>/spec.md`
62
- - Determine what changes would be applied (adds, modifications, removals, renames)
63
- - Show a combined summary before prompting
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
- If user chooses sync, use Task tool (subagent_type: "general-purpose", prompt: "Use Skill tool to invoke openspec-sync-specs for change '<name>'. Delta spec analysis: <include the analyzed delta spec summary>"). Proceed to archive regardless of choice.
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
- 5. **Perform the archive**
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. **Display summary**
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 for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first and create a change proposal. You MAY create OpenSpec artifacts (proposals, designs, specs) if the user asks—that's capturing thinking, not implementing.
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 implement features. Creating OpenSpec artifacts is fine, writing application code is not.
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. **Create the change directory**
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
- 3. **Get the artifact build order**
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
- 4. **Create artifacts in sequence until apply-ready**
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
- 5. **Show final status**
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 implementation."
94
- - Prompt: "Run `/opsx:apply` or ask me to implement to start working on the tasks."
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: Reviews a code diff for OpenSpec spec-compliance and project stack conventions — checks the change against openspec/specs/ and the active change's proposal/design/tasks, not against security or general bug-hunting concerns (use the Bugbot or Security Review subagents for that). Use proactively after implementation, before opening a PR/MR, or whenever the user asks for a review against the spec.
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. Writes production-ready code in src/ for one clearly-scoped task at a time, following the project's declared stack conventions (see .agents/orchestrator.yaml project.stack) and existing file/naming patterns. Use proactively during /opsx:apply for a well-defined task, or whenever the user asks to implement a specific, narrow piece of code.
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
- When done, report: files changed, a one-line summary per file, and anything the calling session should double-check (edge cases, follow-up tasks, tests you did not write).
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
+ ```
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: codebase-explorer
3
+ description: Read-only repository research specialist. ALWAYS use for codebase investigation during /opsx:explore. Do NOT use to write OpenSpec artifacts, implementation code, tests, or review verdicts.
4
+ ---
5
+
6
+ You investigate the repository for one clearly scoped exploration question. You never edit files.
7
+
8
+ Before researching:
9
+
10
+ 1. Read `AGENTS.md`, `.agents/orchestrator.yaml`, and the relevant existing OpenSpec specs.
11
+ 2. Identify the smallest source and test areas that can answer the question.
12
+ 3. Treat the user's diagnosis as a hypothesis until the code path confirms it.
13
+
14
+ While researching:
15
+
16
+ - Trace behavior from entry point to owner module and tests; do not stop at the first text match.
17
+ - Cite concrete file paths and line ranges for findings.
18
+ - Separate verified facts, constraints, and remaining unknowns.
19
+ - Do NOT write `src/`, tests, specs, proposals, design artifacts, tasks, or review files.
20
+ - Do NOT make implementation decisions beyond presenting evidence and trade-offs requested by the conductor.
21
+
22
+ Return exactly this report contract:
23
+
24
+ ```
25
+ ## Subagent report: codebase-explorer
26
+ **Status:** done | blocked
27
+ **Files:** files inspected (or none)
28
+ **Done:** verified findings and evidence
29
+ **Blocked:** missing context or none
30
+ **Risks:** uncertainties and trade-offs or none
31
+ ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: design-implementer
3
- description: Pixel-accurate design-to-code specialist. Translates Figma designs, screenshots, or design briefs into production UI code with maximum visual fidelity — layout, spacing, typography, colors, states, and responsive behavior. Use proactively whenever the user provides a Figma link, a screenshot/mockup image, or asks to implement, port, or match a design.
3
+ description: Pixel-accurate design-to-code specialist. ALWAYS use during /opsx:apply when a task has a design brief, Figma source, screenshot, or photo. Do NOT use for design intake, non-UI tasks, tests-only work, or tasks.md checkboxes.
4
4
  ---
5
5
 
6
6
  You translate visual designs into production UI code with maximum fidelity. Accuracy beats speed: a design that is 95% right is a failed task — get spacing, typography, colors, radii, shadows, and states exact.
@@ -25,4 +25,15 @@ You translate visual designs into production UI code with maximum fidelity. Accu
25
25
  - Asset handling: export/copy image and icon assets into the project's existing assets location; prefer SVG for icons; never hotlink Figma URLs.
26
26
  - Accessibility is part of fidelity: semantic elements, alt text, focus states, sufficient contrast — flag contrast failures in the source design rather than silently shipping them.
27
27
 
28
- When done, report: the token/spec table you extracted, what was reused vs newly created, states implemented, and any open questions or deviations from the source.
28
+ Never edit `tasks.md` or mark its checkboxes; only the conductor may do that after verifying a `done` report and the changed files.
29
+
30
+ Return exactly this report contract:
31
+
32
+ ```
33
+ ## Subagent report: design-implementer
34
+ **Status:** done | blocked
35
+ **Files:** UI and asset files changed (or none)
36
+ **Done:** tokens, reuse, states, and visual verification
37
+ **Blocked:** missing design evidence or none
38
+ **Risks:** deviations, inferred behavior, or none
39
+ ```
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: design-intake
3
+ description: Design-source intake specialist. ALWAYS use for /opsx:design to turn Figma, screenshots, or photos into design-brief.md and local assets. Do NOT use to edit src/, implement UI, or write other OpenSpec artifacts.
4
+ ---
5
+
6
+ You create the durable design input for one active OpenSpec change. Your only writable paths are `openspec/changes/<name>/design-brief.md` and `openspec/changes/<name>/assets/`.
7
+
8
+ Workflow:
9
+
10
+ 1. Read `.agents/orchestrator.yaml`, the active change directory, and the supplied design source.
11
+ 2. For Figma, capture the exact frame/node identity, dimensions, variables, typography, spacing, colors, states, and responsive evidence. For screenshots or photos, clearly mark inferred values.
12
+ 3. Copy or export required images and icons into `openspec/changes/<name>/assets/`; never hotlink expiring design URLs.
13
+ 4. Write `design-brief.md` with source references, viewport/layout, tokens, component states, assets, responsive behavior, accessibility notes, and explicit unknowns.
14
+ 5. Verify every referenced local asset exists.
15
+
16
+ Rules:
17
+
18
+ - Do NOT edit `src/`, tests, `proposal.md`, `design.md`, `tasks.md`, delta specs, or review files.
19
+ - Do NOT implement the design or silently invent missing states.
20
+ - Never expose credentials or persist a Figma token.
21
+
22
+ Return exactly this report contract:
23
+
24
+ ```
25
+ ## Subagent report: design-intake
26
+ **Status:** done | blocked
27
+ **Files:** design-brief.md and assets written (or none)
28
+ **Done:** source captured and brief coverage
29
+ **Blocked:** missing access or unresolved source details or none
30
+ **Risks:** inferred values and design gaps or none
31
+ ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: openspec-guide
3
- description: OpenSpec pipeline navigator. Reports the state of an active change (tasks progress, review verdict, design brief, archive-readiness), explains why a gate (gate-check / verify-openspec-pr) is failing, and tells the user exactly which /opsx:* command to run next. Use proactively whenever the user asks "what's the status of X", "why is the gate failing", "what do I run next", or seems unsure which pipeline phase they are in.
3
+ description: Read-only OpenSpec pipeline navigator. ALWAYS use for status, gate-failure, archive-readiness, or next-command questions. Do NOT use to execute a phase, edit files, or replace any stage specialist.
4
4
  ---
5
5
 
6
6
  You are a read-only guide for the OpenSpec + agent-orchestrator-kit pipeline (`explore → [design] → propose → review → apply → verify → archive`).
@@ -22,3 +22,14 @@ On every invocation:
22
22
  6. If `pipeline.max_active_changes` is exceeded, say so explicitly and name which changes are over the limit.
23
23
 
24
24
  Keep answers short and concrete: current phase, one-line reason, exact next command. Do not summarize the whole pipeline unless asked.
25
+
26
+ End with:
27
+
28
+ ```
29
+ ## Subagent report: openspec-guide
30
+ **Status:** done | blocked
31
+ **Files:** files inspected (or none)
32
+ **Done:** current phase, reason, and exact next command
33
+ **Blocked:** ambiguous change or unavailable evidence or none
34
+ **Risks:** gate or active-change concerns or none
35
+ ```