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
@@ -48,10 +48,16 @@ handoff:
48
48
  propose_to_review: validate_strict
49
49
  review_to_apply: explicit_approve
50
50
  apply_to_verify: all_tasks_checked
51
+ restore_on_start: true
52
+ persist_on_exit: true
53
+ emit_next_session_prompt: true
54
+ prompt_self_contained: true
55
+ spawn_handoff_subagent: true
51
56
 
52
57
  memory:
53
58
  enabled: true
54
59
  file: .cursor/memory.json
60
+ launcher: scripts/memory-mcp-launcher.cjs
55
61
 
56
62
  mcp:
57
63
  baseline:
@@ -1,11 +1,8 @@
1
1
  {
2
2
  "amp.mcpServers": {
3
3
  "memory": {
4
- "command": "npx",
5
- "args": ["-y", "@modelcontextprotocol/server-memory"],
6
- "env": {
7
- "MEMORY_FILE_PATH": ".cursor/memory.json"
8
- }
4
+ "command": "node",
5
+ "args": ["scripts/memory-mcp-launcher.cjs"]
9
6
  },
10
7
  "figma": {
11
8
  "command": "node",
@@ -5,10 +5,16 @@ category: Workflow
5
5
  description: Implement tasks from an OpenSpec change (Experimental)
6
6
  ---
7
7
 
8
+ ## Session Start (Before Any Work)
9
+
10
+ Honor the pasted command and announce the Implementer role. Run `npx agent-orchestrator-kit status` or `npx openspec list --json`, then `npx agent-orchestrator-kit handoff --restore` (or `handoff <name> --restore`). Read Memory `Change:<name>`, `Handoff:<name>`, and `Decision:*` when MCP works. If restore CLI fails and Memory is empty, read `openspec/changes/<name>/handoff.md`; this fallback is not a blocker. Spawn `session-handoff` in restore mode when context is incomplete (Amp: isolated `subagent-session-handoff`). For free-form “continue” / “next” with one active change, execute its `Handoff.next_command` instead of asking for the phase. Only then spawn the routed phase specialist (Amp: isolated `subagent-<name>`, never the main thread). Follow `.agents/rules/session-handoff.mdc`.
11
+
8
12
  Implement tasks from an OpenSpec change.
9
13
 
10
14
  **Input**: Optionally specify a change name (e.g., `/opsx:apply add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
11
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`; after implementation spawn `test-writer` when tests are required, and before PR/MR spawn `code-reviewer`. Require each structured report. Only the conductor may edit `tasks.md` checkboxes.
17
+
12
18
  **Steps**
13
19
 
14
20
  1. **Select the change**
@@ -80,9 +86,10 @@ Implement tasks from an OpenSpec change.
80
86
 
81
87
  For each pending task:
82
88
  - Show which task is being worked on
83
- - Make the code changes required
84
- - Keep changes minimal and focused
85
- - Mark task complete in the tasks file: `- [ ]` → `- [x]`
89
+ - Spawn the routed implementation subagent with one self-contained task; do not make code changes in the parent
90
+ - Verify `Status: done` and that every reported file exists
91
+ - Spawn `test-writer` for required test work and verify its report
92
+ - Only then, as conductor, mark the task complete in the tasks file: `- [ ]` → `- [x]`
86
93
  - Continue to next task
87
94
 
88
95
  **Pause if:**
@@ -150,13 +157,24 @@ All tasks complete! You can archive this change with `/opsx:archive`.
150
157
  What would you like to do?
151
158
  ```
152
159
 
160
+ ## Session Exit (HARD STOP)
161
+
162
+ You have NOT finished until every step succeeds. Do not say done/готово, do not start archive, and do not omit the fenced next-thread prompt.
163
+
164
+ 1. Spawn `session-handoff` in persist mode (Amp: isolated `subagent-session-handoff`). If spawn fails, persist in the parent — never skip.
165
+ 2. Write `openspec/changes/<name>/handoff.md` with: Closed role, Change, Done, Decisions, Blocked, Next command, Next role, Attach, Subagents to spawn, Constraints. Include task and build/lint status in Done.
166
+ 3. Run `npx agent-orchestrator-kit handoff <name>` and require exit 0. The CLI upserts Memory JSON (absolute path) and prints the expanded self-contained prompt on stdout.
167
+ 4. If Memory MCP tools work, also update `Change:<name>`, `Handoff:<name>`, and new `Decision:*`.
168
+ 5. Paste CLI stdout into chat as one fenced block beginning with the next `/opsx:*` role command. Keep it complete. No banner.
169
+ 6. Stop. Never start archive in this apply chat.
170
+
153
171
  **Guardrails**
154
172
  - Keep going through tasks until done or blocked
155
173
  - Always read context files before starting (from the apply instructions output)
156
174
  - If task is ambiguous, pause and ask before implementing
157
175
  - If implementation reveals issues, pause and suggest artifact updates
158
176
  - Keep code changes minimal and scoped to each task
159
- - Update task checkbox immediately after completing each task
177
+ - Never let a specialist update `tasks.md`; the conductor updates a checkbox only after a verified `done` report
160
178
  - Pause on errors, blockers, or unclear requirements - don't guess
161
179
  - Use contextFiles from CLI output, don't assume specific file names
162
180
 
@@ -5,10 +5,16 @@ category: Workflow
5
5
  description: Archive a completed change in the experimental workflow
6
6
  ---
7
7
 
8
+ ## Session Start (Before Any Work)
9
+
10
+ Honor the pasted command and announce the Archiver role. Run `npx agent-orchestrator-kit status` or `npx openspec list --json`, then `npx agent-orchestrator-kit handoff --restore` (or `handoff <name> --restore`). Read Memory `Change:<name>`, `Handoff:<name>`, and `Decision:*` when MCP works. If restore CLI fails and Memory is empty, read `openspec/changes/<name>/handoff.md`; this fallback is not a blocker. Spawn `session-handoff` in restore mode when context is incomplete (Amp: isolated `subagent-session-handoff`). For free-form “continue” / “next” with one active change, execute its `Handoff.next_command` instead of asking for the phase. Only then spawn the routed phase specialist (Amp: isolated `subagent-<name>`, never the main thread). Follow `.agents/rules/session-handoff.mdc`.
11
+
8
12
  Archive a completed change in the experimental workflow.
9
13
 
10
14
  **Input**: Optionally specify a change name after `/opsx:archive` (e.g., `/opsx:archive add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
11
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 merge main specs or move the change itself; it only verifies the structured report, archive path, and validation result.
17
+
12
18
  **Steps**
13
19
 
14
20
  1. **If no change name provided, prompt for selection**
@@ -51,20 +57,22 @@ Archive a completed change in the experimental workflow.
51
57
 
52
58
  4. **Assess delta spec sync state**
53
59
 
54
- 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.
55
61
 
56
62
  **If delta specs exist:**
57
- - Compare each delta spec with its corresponding main spec at `openspec/specs/<capability>/spec.md`
58
- - Determine what changes would be applied (adds, modifications, removals, renames)
59
- - 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
60
66
 
61
67
  **Prompt options:**
62
68
  - If changes needed: "Sync now (recommended)", "Archive without syncing"
63
69
  - If already synced: "Archive now", "Sync anyway", "Cancel"
64
70
 
65
- 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**
66
74
 
67
- 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.
68
76
 
69
77
  Create an `archive` directory under `planningHome.changesDir` if it doesn't exist:
70
78
  ```bash
@@ -81,7 +89,9 @@ Archive a completed change in the experimental workflow.
81
89
  mv "<changeRoot>" "<planningHome.changesDir>/archive/YYYY-MM-DD-<name>"
82
90
  ```
83
91
 
84
- 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.
85
95
 
86
96
  Show archive completion summary including:
87
97
  - Change name
@@ -150,6 +160,17 @@ Target archive directory already exists.
150
160
  3. Wait until a different date to archive
151
161
  ```
152
162
 
163
+ ## Session Exit (HARD STOP)
164
+
165
+ You have NOT finished until every step succeeds. Do not say done/готово and do not omit the fenced next-thread prompt when another role is required.
166
+
167
+ 1. Spawn `session-handoff` in persist mode (Amp: isolated `subagent-session-handoff`). If spawn fails, persist in the parent — never skip.
168
+ 2. Write the final handoff state at the archived change path with: Closed role, Change, Done, Decisions, Blocked, Next command, Next role, Attach, Subagents to spawn, Constraints.
169
+ 3. Run `npx agent-orchestrator-kit handoff <name>` from the archived path context when possible, or write Memory JSON via the same CLI against the active name before the move. Require exit 0 when the change dir still exists.
170
+ 4. If Memory MCP tools work, also update `Change:<name>`, `Handoff:<name>`, and new `Decision:*`.
171
+ 5. When another role is required, paste CLI stdout as one fenced `/opsx:*` prompt. Keep it complete. No banner.
172
+ 6. Stop. Do not start another phase in this chat.
173
+
153
174
  **Guardrails**
154
175
  - Always prompt for change selection if not provided
155
176
  - Use artifact graph (openspec status --json) for completion checking
@@ -5,12 +5,18 @@ category: Workflow
5
5
  description: Capture design from any source into a durable design brief for an OpenSpec change
6
6
  ---
7
7
 
8
+ ## Session Start (Before Any Work)
9
+
10
+ Honor the pasted command and announce the Design Intake role. Run `npx agent-orchestrator-kit status` or `npx openspec list --json`, then `npx agent-orchestrator-kit handoff --restore` (or `handoff <name> --restore`). Read Memory `Change:<name>`, `Handoff:<name>`, and `Decision:*` when MCP works. If restore CLI fails and Memory is empty, read `openspec/changes/<name>/handoff.md`; this fallback is not a blocker. Spawn `session-handoff` in restore mode when context is incomplete (Amp: isolated `subagent-session-handoff`). For free-form “continue” / “next” with one active change, execute its `Handoff.next_command` instead of asking for the phase. Only then spawn the routed phase specialist (Amp: isolated `subagent-<name>`, never the main thread). Follow `.agents/rules/session-handoff.mdc`.
11
+
8
12
  Capture design into a durable brief for an OpenSpec change. One-shot intake from Figma, exports, screenshots, or photos — then apply never needs live design tools.
9
13
 
10
14
  **IMPORTANT: You must NEVER edit any file in `src/` or any source code. You may write only `openspec/changes/<name>/design-brief.md` and files under `openspec/changes/<name>/assets/`.**
11
15
 
12
16
  **Input**: Optionally specify a change name (e.g., `/opsx:design add-login-form`). If omitted, auto-select if one active change exists, otherwise list and ask. If the change does not exist yet, create the change directory when writing the brief (after explore chose the name).
13
17
 
18
+ **Conductor delegation is mandatory:** after resolving the change and source, spawn `design-intake` with a self-contained prompt. The parent MUST NOT inspect the design source or write the brief/assets itself; it only verifies the structured report and reported files.
19
+
14
20
  ---
15
21
 
16
22
  ## Steps
@@ -24,7 +30,11 @@ If name provided — use it. Otherwise:
24
30
 
25
31
  Announce: "Design intake for change: **<name>**"
26
32
 
27
- ### 2. Choose source (fallback ladder)
33
+ ### 2. Spawn the specialist
34
+
35
+ Spawn `design-intake` and delegate steps 3–6 below. Require `## Subagent report: design-intake`. Do not perform those steps in the parent session.
36
+
37
+ ### 3. Choose source (fallback ladder)
28
38
 
29
39
  Use the first available source; do not climb the ladder twice:
30
40
 
@@ -35,14 +45,14 @@ Use the first available source; do not climb the ladder twice:
35
45
 
36
46
  Ask the user for the source if unclear. Prefer Figma when a `figma.com` URL is given.
37
47
 
38
- ### 3. Capture into assets/
48
+ ### 4. Capture into assets/
39
49
 
40
50
  Save reference images under `openspec/changes/<name>/assets/`:
41
51
  - Prefer compressed PNG; ~1–2 images per breakpoint
42
52
  - Do not commit raw video, PSD, or huge originals
43
53
  - Name files clearly: `desktop.png`, `mobile.png`, `hero-detail.png`
44
54
 
45
- ### 4. Write design-brief.md
55
+ ### 5. Write design-brief.md
46
56
 
47
57
  Create or overwrite `openspec/changes/<name>/design-brief.md` using this template:
48
58
 
@@ -89,14 +99,16 @@ Create or overwrite `openspec/changes/<name>/design-brief.md` using this templat
89
99
  - Inferred (screenshot/photo): mark each inferred value with a confidence marker, e.g. `~8px (medium confidence)` or `color ≈ #1a1a1a (low confidence)`
90
100
  ```
91
101
 
92
- ### 5. Confidence markers for raster sources
102
+ ### 6. Confidence markers for raster sources
93
103
 
94
104
  When the source is a **screenshot** or **photo** (not Figma MCP / vector export):
95
105
  - Do not present guessed spacing, colors, or type sizes as facts
96
106
  - Mark every inferred token/value with a confidence note in **Confidence notes** and inline in **Tokens** where useful
97
107
  - Prefer ranges or approximations over fake precision
98
108
 
99
- ### 6. Handoff
109
+ ### 7. Verify report and handoff
110
+
111
+ The conductor verifies `Status: done` and that every reported brief/asset path exists, then outputs the handoff summary.
100
112
 
101
113
  Output a short summary:
102
114
 
@@ -116,6 +128,17 @@ For non-UI changes: do not invent a brief. Tell the Architect to add a line `Des
116
128
 
117
129
  ---
118
130
 
131
+ ## Session Exit (HARD STOP)
132
+
133
+ You have NOT finished until every step succeeds. Do not say done/готово, do not start propose, and do not omit the fenced next-thread prompt.
134
+
135
+ 1. Spawn `session-handoff` in persist mode (Amp: isolated `subagent-session-handoff`). If spawn fails, persist in the parent — never skip.
136
+ 2. Write `openspec/changes/<name>/handoff.md` with: Closed role, Change, Done, Decisions, Blocked, Next command, Next role, Attach, Subagents to spawn, Constraints.
137
+ 3. Run `npx agent-orchestrator-kit handoff <name>` and require exit 0. The CLI upserts Memory JSON (absolute path) and prints the expanded self-contained prompt on stdout.
138
+ 4. If Memory MCP tools work, also update `Change:<name>`, `Handoff:<name>`, and new `Decision:*`.
139
+ 5. Paste CLI stdout into chat as one fenced block beginning `/opsx:propose <name>`. Keep it complete. No banner.
140
+ 6. Stop. Do not start propose in this chat.
141
+
119
142
  ## Guardrails
120
143
 
121
144
  - **Never** edit source code or `src/`
@@ -5,9 +5,15 @@ category: Workflow
5
5
  description: "Enter explore mode - think through ideas, investigate problems, clarify requirements"
6
6
  ---
7
7
 
8
+ ## Session Start (Before Any Work)
9
+
10
+ Honor the pasted command and announce the Explorer role. Run `npx agent-orchestrator-kit status` or `npx openspec list --json`, then `npx agent-orchestrator-kit handoff --restore` (or `handoff <name> --restore`). Read Memory `Change:<name>`, `Handoff:<name>`, and `Decision:*` when MCP works. If restore CLI fails and Memory is empty, read `openspec/changes/<name>/handoff.md`; this fallback is not a blocker. Spawn `session-handoff` in restore mode when context is incomplete (Amp: isolated `subagent-session-handoff`). For free-form “continue” / “next” with one active change, execute its `Handoff.next_command` instead of asking for the phase. Only then spawn the routed phase specialist (Amp: isolated `subagent-<name>`, never the main thread). Follow `.agents/rules/session-handoff.mdc`.
11
+
8
12
  Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
9
13
 
10
- **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 may discuss evidence returned by the specialist, but you must NEVER write code or OpenSpec artifacts. If the user asks you to implement or formalize the change, end explore with a handoff to a fresh propose session.
15
+
16
+ **Conductor delegation is mandatory:** for any 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, and do not let the subagent write specs or code. The parent may synthesize the report and continue the exploratory conversation.
11
17
 
12
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.
13
19
 
@@ -160,9 +166,20 @@ When things crystallize, you might offer a summary - but it's optional. Sometime
160
166
 
161
167
  ---
162
168
 
169
+ ## Session Exit (HARD STOP)
170
+
171
+ You have NOT finished until every step succeeds. Do not say done/готово, do not start the next phase, and do not omit the fenced next-thread prompt.
172
+
173
+ 1. Spawn `session-handoff` in persist mode (Amp: isolated `subagent-session-handoff`). If spawn fails, persist in the parent — never skip.
174
+ 2. Write `openspec/changes/<name>/handoff.md` with: Closed role, Change, Done, Decisions, Blocked, Next command, Next role, Attach, Subagents to spawn, Constraints.
175
+ 3. Run `npx agent-orchestrator-kit handoff <name>` and require exit 0. The CLI upserts Memory JSON (absolute path) and prints the expanded self-contained prompt on stdout.
176
+ 4. If Memory MCP tools work, also update `Change:<name>`, `Handoff:<name>`, and new `Decision:*`.
177
+ 5. Paste CLI stdout into chat as one fenced block. Keep it complete. No banner. First line is `/opsx:design <name>` or `/opsx:propose <name>`.
178
+ 6. Stop. Do not start that phase in this chat.
179
+
163
180
  ## Guardrails
164
181
 
165
- - **Don't implement** - Never write code or implement features. Creating OpenSpec artifacts is fine, writing application code is not.
182
+ - **Don't implement or author artifacts** - Never write code or OpenSpec files in explore.
166
183
  - **Don't fake understanding** - If something is unclear, dig deeper
167
184
  - **Don't rush** - Discovery is thinking time, not task time
168
185
  - **Don't force structure** - Let patterns emerge naturally
@@ -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 `npx agent-orchestrator-kit handoff --restore` (or `handoff <name> --restore`). Read Memory `Change:<name>`, `Handoff:<name>`, and `Decision:*` when MCP works. If restore CLI fails and Memory is empty, read `openspec/changes/<name>/handoff.md`; this fallback is not a blocker. Spawn `session-handoff` in restore mode when context is incomplete (Amp: isolated `subagent-session-handoff`). For free-form “continue” / “next” with one active change, execute its `Handoff.next_command` instead of asking for the phase. Only then spawn the routed phase specialist (Amp: isolated `subagent-<name>`, never the main thread). Follow `.agents/rules/session-handoff.mdc`.
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. **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**
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
- 3. **Get the artifact build order**
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
- 4. **Create artifacts in sequence until apply-ready**
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
- 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:
80
92
  ```bash
81
93
  npx openspec status --change "<name>"
82
94
  ```
@@ -86,8 +98,19 @@ 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 implementation."
90
- - Prompt: "Run `/opsx:apply` to start implementing."
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 (HARD STOP)
105
+
106
+ You have NOT finished until every step succeeds. Do not say done/готово, do not start review, and do not omit the fenced next-thread prompt.
107
+
108
+ 1. Spawn `session-handoff` in persist mode (Amp: isolated `subagent-session-handoff`). If spawn fails, persist in the parent — never skip.
109
+ 2. Write `openspec/changes/<name>/handoff.md` with: Closed role, Change, Done, Decisions, Blocked, Next command, Next role, Attach, Subagents to spawn, Constraints.
110
+ 3. Run `npx agent-orchestrator-kit handoff <name>` and require exit 0. The CLI upserts Memory JSON (absolute path) and prints the expanded self-contained prompt on stdout.
111
+ 4. If Memory MCP tools work, also update `Change:<name>`, `Handoff:<name>`, and new `Decision:*`.
112
+ 5. Paste CLI stdout into chat as one fenced block beginning `/opsx:review <name>`. Keep it complete. No banner.
113
+ 6. Stop. Do not start review in this chat.
91
114
 
92
115
  **Artifact Creation Guidelines**
93
116
 
@@ -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 `npx agent-orchestrator-kit handoff --restore` (or `handoff <name> --restore`). Read Memory `Change:<name>`, `Handoff:<name>`, and `Decision:*` when MCP works. If restore CLI fails and Memory is empty, read `openspec/changes/<name>/handoff.md`; this fallback is not a blocker. Spawn `session-handoff` in restore mode when context is incomplete (Amp: isolated `subagent-session-handoff`). For free-form “continue” / “next” with one active change, execute its `Handoff.next_command` instead of asking for the phase. Only then spawn the routed phase specialist (Amp: isolated `subagent-<name>`, never the main thread). Follow `.agents/rules/session-handoff.mdc`.
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
- - Implement 1–3 tasks per pass
55
- - Mark `[x]`
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,20 @@ Quick mode for **small changes, demos, and hypothesis testing**. Combines propos
62
73
 
63
74
  ---
64
75
 
76
+ ## Session Exit (HARD STOP)
77
+
78
+ At the end of the whole quick session you have NOT finished until every step succeeds. Do not emit a mid-session next-thread prompt between propose and apply. Do not start archive in this chat.
79
+
80
+ 1. Spawn `session-handoff` in persist mode (Amp: isolated `subagent-session-handoff`). If spawn fails, persist in the parent — never skip.
81
+ 2. Write `openspec/changes/<name>/handoff.md` with: Closed role, Change, Done, Decisions, Blocked, Next command, Next role, Attach, Subagents to spawn, Constraints. Include task and build/lint status.
82
+ 3. Run `npx agent-orchestrator-kit handoff <name>` and require exit 0. The CLI upserts Memory JSON (absolute path) and prints the expanded self-contained prompt on stdout.
83
+ 4. If Memory MCP tools work, also update `Change:<name>`, `Handoff:<name>`, and new `Decision:*`.
84
+ 5. Paste exactly one fenced prompt for verify/archive. Keep it complete. No banner.
85
+ 6. Stop. This is the session's only next-session prompt.
86
+
65
87
  **Guardrails**
66
88
  - Max ~3 hours of work — if bigger, switch to full pipeline
67
89
  - Still run build/lint before declaring done
68
90
  - Do not skip OpenSpec entirely — at minimum proposal + tasks
69
91
  - For vue3: use vue-core, vue-pinia skills during implementation
92
+ - 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 `npx agent-orchestrator-kit handoff --restore` (or `handoff <name> --restore`). Read Memory `Change:<name>`, `Handoff:<name>`, and `Decision:*` when MCP works. If restore CLI fails and Memory is empty, read `openspec/changes/<name>/handoff.md`; this fallback is not a blocker. Spawn `session-handoff` in restore mode when context is incomplete (Amp: isolated `subagent-session-handoff`). For free-form “continue” / “next” with one active change, execute its `Handoff.next_command` instead of asking for the phase. Only then spawn the routed phase specialist (Amp: isolated `subagent-<name>`, never the main thread). Follow `.agents/rules/session-handoff.mdc`.
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. Validate structure
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
- ### 3. Read all artifacts
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
- ### 4. Review checklist
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
- ### 5. Output verdict
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,17 @@ Fix the above, then re-run `/opsx:review <name>`.
148
160
 
149
161
  ---
150
162
 
163
+ ## Session Exit (HARD STOP)
164
+
165
+ You have NOT finished until every step succeeds. Do not say done/готово, do not start apply, and do not omit the fenced next-thread prompt.
166
+
167
+ 1. Spawn `session-handoff` in persist mode (Amp: isolated `subagent-session-handoff`). If spawn fails, persist in the parent — never skip.
168
+ 2. Write `openspec/changes/<name>/handoff.md` with: Closed role, Change, Done, Decisions, Blocked, Next command, Next role, Attach, Subagents to spawn, Constraints.
169
+ 3. Run `npx agent-orchestrator-kit handoff <name>` and require exit 0. The CLI upserts Memory JSON (absolute path) and prints the expanded self-contained prompt on stdout.
170
+ 4. If Memory MCP tools work, also update `Change:<name>`, `Handoff:<name>`, and new `Decision:*`.
171
+ 5. Paste CLI stdout into chat as one fenced block beginning with the next `/opsx:*` command (`/opsx:apply <name>` only after APPROVE). Keep it complete. No banner.
172
+ 6. Stop. Do not start the next phase in this chat.
173
+
151
174
  ## Guardrails
152
175
 
153
176
  - **Never** edit source code, `src/`, or `tasks.md` checkboxes
@@ -1,11 +1,8 @@
1
1
  {
2
2
  "mcpServers": {
3
3
  "memory": {
4
- "command": "npx",
5
- "args": ["-y", "@modelcontextprotocol/server-memory"],
6
- "env": {
7
- "MEMORY_FILE_PATH": ".cursor/memory.json"
8
- }
4
+ "command": "node",
5
+ "args": ["scripts/memory-mcp-launcher.cjs"]
9
6
  },
10
7
  "figma": {
11
8
  "command": "node",
@@ -16,6 +16,52 @@ 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
+ | Session start restore / session exit persist | `session-handoff` | Memory, `handoff.md`, next-thread prompt |
27
+ | Broken kit, MCP, or generated-file sync | `setup-doctor` | Kit setup repair |
28
+ | `/opsx:explore` repository investigation | `codebase-explorer` | Repository research; no specs or code |
29
+ | `/opsx:design` | `design-intake` | `design-brief.md` and `assets/` |
30
+ | `/opsx:propose` | `spec-architect` | Change proposal/design/specs/tasks |
31
+ | `/opsx:review` | `spec-reviewer` | Pre-apply spec verdict and `review.md` |
32
+ | Apply task with design brief/Figma/image | `design-implementer` | UI implementation |
33
+ | Apply ordinary implementation task | `code-writer` | One task's production code |
34
+ | Apply after implementation | `test-writer` | Automated tests |
35
+ | Apply before PR/MR | `code-reviewer` | Post-implementation spec review |
36
+ | `/opsx:archive` | `spec-archiver` | Delta merge and archive move |
37
+
38
+ `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.
39
+
40
+ ## Session Start Protocol (Before Any Specialist Work)
41
+
42
+ 1. Honor the pasted `/opsx:<phase> <name>` command and announce that role.
43
+ 2. Run `npx agent-orchestrator-kit status` or `npx openspec list --json`; resolve the active change without exceeding `max_active_changes`.
44
+ 3. Run `npx agent-orchestrator-kit handoff --restore` (or `handoff <name> --restore`). Use the printed briefing.
45
+ 4. Read Memory entities `Change:<name>`, `Handoff:<name>`, and `Decision:*` when MCP works.
46
+ 5. If restore CLI fails and Memory is empty, read `openspec/changes/<name>/handoff.md`. Memory failure alone MUST NOT block the session when the file exists.
47
+ 6. Spawn `session-handoff` in restore mode when context is incomplete (Amp: isolated `subagent-session-handoff`, never the main thread).
48
+ 7. Only after context is restored, spawn the routed phase specialist. Amp MUST spawn `subagent-<name>` isolated.
49
+
50
+ If the user says “continue” / “next” / «продовжуй» / «далі» without a command and exactly one active change has `Handoff.next_command` (from Memory, CLI restore, or `handoff.md`), execute that command instead of asking which phase to run.
51
+
52
+ Follow `.agents/rules/session-handoff.mdc`.
53
+
54
+ ## Session Exit Protocol (HARD STOP)
55
+
56
+ A phase is not closed until the conductor performs these steps in order. FORBIDDEN: saying done/готово, starting the next phase, or omitting the fenced prompt.
57
+
58
+ 1. Spawn `session-handoff` in persist mode (Amp: isolated `subagent-session-handoff`). If spawn fails, persist in the parent — never skip.
59
+ 2. Write `openspec/changes/<name>/handoff.md` with sections **Closed role**, **Change**, **Done**, **Decisions**, **Blocked**, **Next command**, **Next role**, **Attach**, **Subagents to spawn**, and **Constraints**. Do this even if Memory MCP is unavailable.
60
+ 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 self-contained next-session prompt on stdout.
61
+ 4. If Memory MCP tools work, also update `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`).
62
+ 5. Paste the CLI stdout as one fenced copy/paste prompt. First line MUST be `/opsx:<next> <name>`; body MUST use `project.agent_language`; MUST keep Done/Decisions/Blocked/spawn/HARD STOP complete. Do not add a banner or shorten the prompt. Amp often skips Memory MCP — the pasted prompt is the next thread's operating brief.
63
+ 6. Do NOT start the next phase in this chat.
64
+
19
65
  ## Session Rules
20
66
  - One active change at a time (unless mvp profile: up to 3)
21
67
  - Each role = new chat session (except `/opsx:quick` combines propose+apply)
@@ -13,7 +13,8 @@ Amp Code і багато агентських shell **не мають** глоб
13
13
  | Замість (ламає Amp) | Використовуй |
14
14
  |---------------------|--------------|
15
15
  | `agent-orchestrator-kit status` | `npx agent-orchestrator-kit status` (або `npm run agent:status`, якщо script є) |
16
- | `agent-orchestrator-kit gate-check` | `npx agent-orchestrator-kit gate-check` (або `npm run agent:gate-check`) |
16
+ | `agent-orchestrator-kit handoff` | `npx agent-orchestrator-kit handoff <name>` |
17
+ | `agent-orchestrator-kit memory-setup` | `npx agent-orchestrator-kit memory-setup` |
17
18
  | `openspec list` | `npx openspec list` (або `npm run openspec:list`) |
18
19
  | `openspec validate --strict` | **ніколи без цілі** → `npx openspec validate <name> --strict --type change` |
19
20
  | `openspec validate --all --strict` | `npx openspec validate --all --strict` (або `npm run openspec:validate` / `verify:openspec`) |