agent-orchestrator-kit 0.2.0 → 0.3.0

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 (31) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +50 -16
  3. package/bin/agent-orchestrator.js +405 -3
  4. package/package.json +1 -1
  5. package/profiles/generic/orchestrator.yaml +2 -1
  6. package/profiles/mvp/openspec-config.yaml.example +2 -0
  7. package/profiles/mvp/orchestrator.yaml +2 -1
  8. package/profiles/node/orchestrator.yaml +2 -1
  9. package/profiles/vue3/openspec-config.yaml.example +2 -0
  10. package/profiles/vue3/orchestrator.yaml +2 -1
  11. package/templates/.agents/commands/opsx-apply.md +18 -46
  12. package/templates/.agents/commands/opsx-archive.md +10 -163
  13. package/templates/.agents/commands/opsx-design.md +3 -10
  14. package/templates/.agents/commands/opsx-explore.md +3 -10
  15. package/templates/.agents/commands/opsx-propose.md +14 -10
  16. package/templates/.agents/commands/opsx-quick.md +3 -10
  17. package/templates/.agents/commands/opsx-review.md +27 -55
  18. package/templates/.agents/commands/opsx-sync.md +2 -0
  19. package/templates/.agents/rules/agent-orchestration.mdc +15 -16
  20. package/templates/.agents/rules/session-handoff.mdc +18 -16
  21. package/templates/.agents/skills/agent-orchestration/SKILL.md +27 -28
  22. package/templates/.agents/skills/openspec-apply-change/SKILL.md +15 -20
  23. package/templates/.agents/skills/openspec-archive-change/SKILL.md +12 -99
  24. package/templates/.agents/skills/openspec-propose/SKILL.md +11 -0
  25. package/templates/.agents/subagents/session-handoff.md +5 -5
  26. package/templates/.agents/subagents/spec-architect.md +1 -1
  27. package/templates/.agents/subagents/spec-archiver.md +1 -1
  28. package/templates/.agents/subagents/spec-reviewer.md +11 -7
  29. package/templates/AGENTS.md +3 -3
  30. package/templates/CLAUDE.md +2 -2
  31. package/templates/orchestrator.yaml +2 -1
@@ -15,6 +15,7 @@ pipeline:
15
15
  max_active_changes: 3
16
16
  archive_after_merge: false
17
17
  quick_mode_enabled: true
18
+ task_contract: off
18
19
 
19
20
  roles:
20
21
  explorer:
@@ -55,7 +56,7 @@ handoff:
55
56
  persist_on_exit: true
56
57
  emit_next_session_prompt: true
57
58
  prompt_self_contained: true
58
- spawn_handoff_subagent: true
59
+ spawn_handoff_subagent: false
59
60
 
60
61
  memory:
61
62
  enabled: true
@@ -13,6 +13,7 @@ pipeline:
13
13
  require_design_brief: false
14
14
  max_active_changes: 1
15
15
  archive_after_merge: true
16
+ task_contract: warn
16
17
 
17
18
  roles:
18
19
  explorer:
@@ -53,7 +54,7 @@ handoff:
53
54
  persist_on_exit: true
54
55
  emit_next_session_prompt: true
55
56
  prompt_self_contained: true
56
- spawn_handoff_subagent: true
57
+ spawn_handoff_subagent: false
57
58
 
58
59
  memory:
59
60
  enabled: true
@@ -15,6 +15,8 @@ rules:
15
15
  - Описуй зміни на рівні компонентів, stores, API
16
16
  tasks:
17
17
  - Розбивай на задачі до ~2 годин
18
+ - "Контракт таска: індентовані поля Files: (реальні шляхи; нові — з префіксом new file:), Do: (конкретна зміна, 1–3 рядки), Done-when: (перевірна умова або команда)"
19
+ - Таск самодостатній без design.md; без неконкретних формулювань («as needed», «if necessary», «за потреби»)
18
20
  - Останній пункт: build + lint без помилок
19
21
  specs:
20
22
  - Delta format: ADDED / MODIFIED / REMOVED
@@ -13,6 +13,7 @@ pipeline:
13
13
  require_design_brief: false
14
14
  max_active_changes: 1
15
15
  archive_after_merge: true
16
+ task_contract: warn
16
17
 
17
18
  roles:
18
19
  explorer:
@@ -52,7 +53,7 @@ handoff:
52
53
  persist_on_exit: true
53
54
  emit_next_session_prompt: true
54
55
  prompt_self_contained: true
55
- spawn_handoff_subagent: true
56
+ spawn_handoff_subagent: false
56
57
 
57
58
  memory:
58
59
  enabled: true
@@ -5,15 +5,17 @@ category: Workflow
5
5
  description: Implement tasks from an OpenSpec change (Experimental)
6
6
  ---
7
7
 
8
- ## Session Start (Before Any Work)
8
+ ## Session Start
9
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`.
10
+ Follow the canonical Session Start protocol in `.agents/rules/session-handoff.mdc`, then announce the Implementer role.
11
11
 
12
12
  Implement tasks from an OpenSpec change.
13
13
 
14
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.
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`; 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.
16
+ **Parent-driven apply:** the parent reads `tasks.md` + `apply-notes.md` (open `design.md`/`proposal.md` only when a task explicitly references them or a contract field is incomplete) and writes code and tests itself, task by task, checking its own `tasks.md` checkboxes. Subagents are optional: spawn `code-writer`/`test-writer` for 2 independent tasks with no shared files (parallelization) or on explicit user request. `design-implementer` remains mandatory for tasks with a design-brief/Figma signal.
17
+
18
+ **Escape valve (STOP — improvisation is forbidden):** if a task requires information beyond its Files/Do/Done-when + `apply-notes.md` + artifacts it explicitly references, STOP: record the gap in `handoff.md`, set the next command to `/opsx:propose <name>` (plan amendment), and end the session. Do not guess.
17
19
 
18
20
  **Steps**
19
21
 
@@ -28,16 +30,7 @@ Implement tasks from an OpenSpec change.
28
30
 
29
31
  1.5. **Check review gate**
30
32
 
31
- Read `.agents/orchestrator.yaml` → `pipeline.require_spec_review`.
32
-
33
- If `true` (default for generic/vue3/node):
34
- - Look for `openspec/changes/<name>/review.md` with `Verdict: APPROVE`
35
- - OR explicit **APPROVE ✓** from `/opsx:review <name>` in this session (user pasted verdict)
36
- - OR Memory MCP entity `Change:<name>` with `status: spec-approved`
37
- - If none found → **STOP**. Tell user:
38
- > "Spec review required. Run `/opsx:review <name>` in a separate read-only session, then start a new apply session after **Approve ✓`."
39
-
40
- If `false` (mvp profile) or user confirms quick/demo mode → proceed.
33
+ Read `.agents/orchestrator.yaml` → `pipeline.require_spec_review`. If `true` (default for generic/vue3/node), require one of: `review.md` with `Verdict: APPROVE`, a pasted **APPROVE ✓** verdict from `/opsx:review <name>`, or Memory `Change:<name>` with `status: spec-approved`. If none found → **STOP** and tell the user to run `/opsx:review <name>` in a separate read-only session first. If `false` (mvp profile) or quick/demo mode is confirmed → proceed.
41
34
 
42
35
  2. **Check status to understand the schema**
43
36
  ```bash
@@ -67,12 +60,9 @@ Implement tasks from an OpenSpec change.
67
60
 
68
61
  **Workspace guard:** If status JSON reports `actionContext.mode: "workspace-planning"` and `allowedEditRoots` is empty, explain that full workspace apply is not supported in this slice. Treat linked repos and folders as read-only context, ask the user to select an affected area through an explicit implementation workflow, and STOP before editing files.
69
62
 
70
- 4. **Read context files**
63
+ 4. **Read the working set**
71
64
 
72
- Read every file path listed under `contextFiles` from the apply instructions output.
73
- The files depend on the schema being used:
74
- - **spec-driven**: proposal, specs, design, tasks
75
- - Other schemas: follow the contextFiles from CLI output
65
+ Read `tasks.md` and `apply-notes.md` they are the primary input for apply. Open `design.md`, `proposal.md`, or delta specs only when a task explicitly references them or a contract field is incomplete. For non-spec-driven schemas, follow `contextFiles` from the CLI output.
76
66
 
77
67
  5. **Show current progress**
78
68
 
@@ -86,17 +76,12 @@ Implement tasks from an OpenSpec change.
86
76
 
87
77
  For each pending task:
88
78
  - Show which task is being worked on
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]`
79
+ - Implement it in the parent session from its Files/Do/Done-when contract (subagent rules: see "Parent-driven apply" above)
80
+ - Verify the task's Done-when condition actually holds
81
+ - Mark the task complete in the tasks file: `- [ ]` → `- [x]`
93
82
  - Continue to next task
94
83
 
95
- **Pause if:**
96
- - Task is unclear → ask for clarification
97
- - Implementation reveals a design issue → suggest updating artifacts
98
- - Error or blocker encountered → report and wait for guidance
99
- - User interrupts
84
+ **STOP if:** the escape valve triggers (see above), an error or blocker is encountered (report and wait), or the user interrupts.
100
85
 
101
86
  7. **On completion or pause, show status**
102
87
 
@@ -114,10 +99,6 @@ Implement tasks from an OpenSpec change.
114
99
  Working on task 3/7: <task description>
115
100
  [...implementation happening...]
116
101
  ✓ Task complete
117
-
118
- Working on task 4/7: <task description>
119
- [...implementation happening...]
120
- ✓ Task complete
121
102
  ```
122
103
 
123
104
  **Output On Completion**
@@ -159,24 +140,15 @@ What would you like to do?
159
140
 
160
141
  ## Session Exit (HARD STOP)
161
142
 
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.
143
+ Close via the canonical Session Exit protocol in `.agents/rules/session-handoff.mdc`. Include task and build/lint status in Done. Never start archive in this apply chat.
170
144
 
171
145
  **Guardrails**
172
146
  - Keep going through tasks until done or blocked
173
- - Always read context files before starting (from the apply instructions output)
174
- - If task is ambiguous, pause and ask before implementing
175
- - If implementation reveals issues, pause and suggest artifact updates
176
- - Keep code changes minimal and scoped to each task
177
- - Never let a specialist update `tasks.md`; the conductor updates a checkbox only after a verified `done` report
178
- - Pause on errors, blockers, or unclear requirements - don't guess
179
- - Use contextFiles from CLI output, don't assume specific file names
147
+ - Always read `tasks.md` + `apply-notes.md` before starting
148
+ - If a task contract is insufficient, STOP via the escape valve — don't guess or improvise
149
+ - Keep code changes minimal and scoped to each task's `Files:` list
150
+ - Never let a spawned specialist update `tasks.md`; the parent checks a box only after verifying Done-when
151
+ - Pause on errors and blockers
180
152
 
181
153
  **Fluid Workflow Integration**
182
154
 
@@ -2,180 +2,27 @@
2
2
  name: /opsx-archive
3
3
  id: opsx-archive
4
4
  category: Workflow
5
- description: Archive a completed change in the experimental workflow
5
+ description: Archive a completed change via the agent-orchestrator-kit CLI
6
6
  ---
7
7
 
8
- ## Session Start (Before Any Work)
8
+ Session Start / Session Exit: follow the protocol in `.agents/rules/session-handoff.mdc`. Announce the Archiver role.
9
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
-
12
- Archive a completed change in the experimental workflow.
13
-
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.
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.
10
+ Archive is fully deterministic one CLI call, no phase subagents.
17
11
 
18
12
  **Steps**
19
13
 
20
- 1. **If no change name provided, prompt for selection**
21
-
22
- Run `npx openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
23
-
24
- Show only active changes (not already archived).
25
- Include the schema used for each change if available.
26
-
27
- **IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
28
-
29
- 2. **Check artifact completion status**
30
-
31
- Run `npx openspec status --change "<name>" --json` to check artifact completion.
32
-
33
- Parse the JSON to understand:
34
- - `schemaName`: The workflow being used
35
- - `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context
36
- - `artifacts`: List of artifacts with their status (`done` or other)
37
-
38
- If status reports `actionContext.mode: "workspace-planning"`, explain that workspace archive is not supported in this slice and STOP. Do not move workspace changes into repo-local archives or edit linked repos.
39
-
40
- **If any artifacts are not `done`:**
41
- - Display warning listing incomplete artifacts
42
- - Prompt user for confirmation to continue
43
- - Proceed if user confirms
44
-
45
- 3. **Check task completion status**
46
-
47
- Read the tasks file (typically `tasks.md`) to check for incomplete tasks.
48
-
49
- Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete).
50
-
51
- **If incomplete tasks found:**
52
- - Display warning showing count of incomplete tasks
53
- - Prompt user for confirmation to continue
54
- - Proceed if user confirms
55
-
56
- **If no tasks file exists:** Proceed without task-related warning.
57
-
58
- 4. **Assess delta spec sync state**
59
-
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.
61
-
62
- **If delta specs exist:**
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
66
-
67
- **Prompt options:**
68
- - If changes needed: "Sync now (recommended)", "Archive without syncing"
69
- - If already synced: "Archive now", "Sync anyway", "Cancel"
70
-
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**
74
-
75
- Spawn `spec-archiver`, require `## Subagent report: spec-archiver`, and delegate the sync/archive operations below. Do not run them in the parent session.
76
-
77
- Create an `archive` directory under `planningHome.changesDir` if it doesn't exist:
78
- ```bash
79
- mkdir -p "<planningHome.changesDir>/archive"
80
- ```
14
+ 1. **Resolve the change name.** Use the name after `/opsx:archive`. If omitted or ambiguous, run `npx openspec list --json` and use the **AskUserQuestion tool** to let the user pick an active change. Never guess.
81
15
 
82
- Generate target name using current date: `YYYY-MM-DD-<change-name>`
16
+ 2. **Decide on delta-spec sync.** If the change has delta specs, ask the user: merge them into main specs (`--sync`, recommended) or archive without merging (`--no-sync --force`).
83
17
 
84
- **Check if target already exists:**
85
- - If yes: Fail with error, suggest renaming existing archive or using different date
86
- - If no: Move `changeRoot` to the archive directory
18
+ 3. **Run the CLI:**
87
19
 
88
20
  ```bash
89
- mv "<changeRoot>" "<planningHome.changesDir>/archive/YYYY-MM-DD-<name>"
21
+ npx agent-orchestrator-kit archive <name> [--sync | --no-sync --force]
90
22
  ```
91
23
 
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.
95
-
96
- Show archive completion summary including:
97
- - Change name
98
- - Schema that was used
99
- - Archive location
100
- - Spec sync status (synced / sync skipped / no delta specs)
101
- - Note about any warnings (incomplete artifacts/tasks)
102
-
103
- **Output On Success**
104
-
105
- ```
106
- ## Archive Complete
107
-
108
- **Change:** <change-name>
109
- **Schema:** <schema-name>
110
- **Archived to:** the archive path derived from `planningHome.changesDir`/YYYY-MM-DD-<name>/
111
- **Specs:** ✓ Synced to main specs
112
-
113
- All artifacts complete. All tasks complete.
114
- ```
115
-
116
- **Output On Success (No Delta Specs)**
117
-
118
- ```
119
- ## Archive Complete
120
-
121
- **Change:** <change-name>
122
- **Schema:** <schema-name>
123
- **Archived to:** the archive path derived from `planningHome.changesDir`/YYYY-MM-DD-<name>/
124
- **Specs:** No delta specs
125
-
126
- All artifacts complete. All tasks complete.
127
- ```
128
-
129
- **Output On Success With Warnings**
130
-
131
- ```
132
- ## Archive Complete (with warnings)
133
-
134
- **Change:** <change-name>
135
- **Schema:** <schema-name>
136
- **Archived to:** the archive path derived from `planningHome.changesDir`/YYYY-MM-DD-<name>/
137
- **Specs:** Sync skipped (user chose to skip)
138
-
139
- **Warnings:**
140
- - Archived with 2 incomplete artifacts
141
- - Archived with 3 incomplete tasks
142
- - Delta spec sync was skipped (user chose to skip)
143
-
144
- Review the archive if this was not intentional.
145
- ```
146
-
147
- **Output On Error (Archive Exists)**
148
-
149
- ```
150
- ## Archive Failed
151
-
152
- **Change:** <change-name>
153
- **Target:** the archive path derived from `planningHome.changesDir`/YYYY-MM-DD-<name>/
154
-
155
- Target archive directory already exists.
156
-
157
- **Options:**
158
- 1. Rename the existing archive
159
- 2. Delete the existing archive if it's a duplicate
160
- 3. Wait until a different date to archive
161
- ```
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.
24
+ The CLI checks gates (review APPROVE, all tasks `[x]`, no existing target), merges delta specs on `--sync`, moves the change to `openspec/changes/archive/YYYY-MM-DD-<name>`, runs `npx openspec validate --all --strict` with full rollback on failure, and writes the final `handoff.md` (`next_command: none`) plus memory upsert.
166
25
 
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.
26
+ 4. **Show the CLI stdout as-is.** On exit 0, report the failed gate from stderr and stopdo not merge or move anything manually.
173
27
 
174
- **Guardrails**
175
- - Always prompt for change selection if not provided
176
- - Use artifact graph (openspec status --json) for completion checking
177
- - Don't block archive on warnings - just inform and confirm
178
- - Preserve .openspec.yaml when moving to archive (it moves with the directory)
179
- - Show clear summary of what happened
180
- - If sync is requested, use the Skill tool to invoke `openspec-sync-specs` (agent-driven)
181
- - If delta specs exist, always run the sync assessment and show the combined summary before prompting
28
+ The pipeline ends here: no next-thread prompt is required after a successful archive.
@@ -5,9 +5,9 @@ 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)
8
+ ## Session Start
9
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`.
10
+ Follow the canonical Session Start protocol in `.agents/rules/session-handoff.mdc`, then announce the Design Intake role.
11
11
 
12
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.
13
13
 
@@ -130,14 +130,7 @@ For non-UI changes: do not invent a brief. Tell the Architect to add a line `Des
130
130
 
131
131
  ## Session Exit (HARD STOP)
132
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.
133
+ Close via the canonical Session Exit protocol in `.agents/rules/session-handoff.mdc`. First line of the pasted prompt is `/opsx:propose <name>`. Do not start propose in this chat.
141
134
 
142
135
  ## Guardrails
143
136
 
@@ -5,9 +5,9 @@ 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)
8
+ ## Session Start
9
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`.
10
+ Follow the canonical Session Start protocol in `.agents/rules/session-handoff.mdc`, then announce the Explorer role.
11
11
 
12
12
  Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
13
13
 
@@ -168,14 +168,7 @@ When things crystallize, you might offer a summary - but it's optional. Sometime
168
168
 
169
169
  ## Session Exit (HARD STOP)
170
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.
171
+ Close via the canonical Session Exit protocol in `.agents/rules/session-handoff.mdc`. First line of the pasted prompt is `/opsx:design <name>` or `/opsx:propose <name>`. Do not start that phase in this chat.
179
172
 
180
173
  ## Guardrails
181
174
 
@@ -5,9 +5,9 @@ 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)
8
+ ## Session Start
9
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`.
10
+ Follow the canonical Session Start protocol in `.agents/rules/session-handoff.mdc`, then announce the Architect role.
11
11
 
12
12
  Propose a new change - create the change and generate all artifacts in one step.
13
13
 
@@ -24,6 +24,17 @@ When ready to implement, run /opsx:apply
24
24
 
25
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
26
 
27
+ **Task contract (mandatory tasks.md format):** every task must carry indented `Files:`, `Do:`, `Done-when:` fields:
28
+
29
+ ```markdown
30
+ - [ ] 2.1 Short title
31
+ Files: src/router/index.js, new file: src/stores/auth.js
32
+ Do: concrete change in 1–3 lines — no vague wording ("as needed", "if necessary", "as appropriate")
33
+ Done-when: verifiable condition or command
34
+ ```
35
+
36
+ Each task must be self-contained for a blind implementer — executable without reading design.md. `Files:` paths must exist unless prefixed with `new file:`. Lint: `npx agent-orchestrator-kit gate-check --tasks <name>` (mode via `pipeline.task_contract: warn|strict|off`).
37
+
27
38
  **Steps**
28
39
 
29
40
  1. **If no input provided, ask what they want to build**
@@ -103,14 +114,7 @@ After completing all artifacts, summarize:
103
114
 
104
115
  ## Session Exit (HARD STOP)
105
116
 
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.
117
+ Close via the canonical Session Exit protocol in `.agents/rules/session-handoff.mdc`. First line of the pasted prompt is `/opsx:review <name>`. Do not start review in this chat.
114
118
 
115
119
  **Artifact Creation Guidelines**
116
120
 
@@ -5,9 +5,9 @@ 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)
8
+ ## Session Start
9
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`.
10
+ Follow the canonical Session Start protocol in `.agents/rules/session-handoff.mdc`, then announce the Quick conductor role.
11
11
 
12
12
  Quick mode for **small changes, demos, and hypothesis testing**. Combines propose + apply in one session.
13
13
 
@@ -75,14 +75,7 @@ Quick mode for **small changes, demos, and hypothesis testing**. Combines propos
75
75
 
76
76
  ## Session Exit (HARD STOP)
77
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.
78
+ Close via the canonical Session Exit protocol in `.agents/rules/session-handoff.mdc` at the end of the whole quick session only no mid-session prompt between propose and apply. Include task and build/lint status in Done. Paste exactly one fenced prompt (verify/archive). Do not start archive in this chat.
86
79
 
87
80
  **Guardrails**
88
81
  - Max ~3 hours of work — if bigger, switch to full pipeline