opencode-onboard 0.4.5 → 0.4.7

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 (35) hide show
  1. package/README.md +58 -19
  2. package/content/.agents/agents/basic-engineer.md +5 -5
  3. package/content/.agents/agents/devops-manager.md +14 -10
  4. package/content/.agents/skills/ob-global/SKILL.md +9 -7
  5. package/content/.opencode/commands/ob-create-architecture.md +76 -0
  6. package/content/.opencode/commands/ob-create-design.md +53 -0
  7. package/content/.opencode/commands/{create-engineer.md → ob-create-engineer.md} +9 -8
  8. package/content/.opencode/commands/ob-init.md +8 -0
  9. package/content/.opencode/commands/{main.md → ob-main.md} +2 -2
  10. package/content/.opencode/commands/{plan.md → ob-plan.md} +2 -2
  11. package/content/.opencode/commands/opsx-apply.md +212 -193
  12. package/content/.opencode/skills/openspec-apply-change/SKILL.md +234 -176
  13. package/content/AGENTS.md +152 -49
  14. package/content/ARCHITECTURE.md +16 -327
  15. package/content/DESIGN.md +16 -26
  16. package/package.json +1 -1
  17. package/src/commands/join.js +6 -1
  18. package/src/commands/single.js +1 -1
  19. package/src/presets/models.json +2 -2
  20. package/src/presets/platforms.json +4 -0
  21. package/src/steps/copy/agents.js +200 -3
  22. package/src/steps/copy/agents.test.js +45 -0
  23. package/src/steps/copy/copy.test.js +15 -2
  24. package/src/steps/copy/index.js +2 -1
  25. package/src/steps/metadata/index.js +6 -5
  26. package/src/steps/metadata/metadata.test.js +16 -8
  27. package/src/steps/models/write.js +17 -4
  28. package/src/steps/models/write.test.js +57 -56
  29. package/src/steps/openspec/ensemble.js +81 -54
  30. package/src/steps/openspec/ensemble.test.js +40 -8
  31. package/src/steps/optimization/global.js +21 -1
  32. package/src/steps/optimization/global.test.js +3 -0
  33. package/src/steps/platform/index.js +8 -1
  34. package/src/steps/platform/platform.test.js +19 -0
  35. package/content/.opencode/commands/init.md +0 -8
@@ -1,98 +1,119 @@
1
- ---
2
- name: openspec-apply-change
3
- description: Implement tasks from an OpenSpec change via ensemble agent team. Use when the user wants to start implementing, continue implementation, or work through tasks.
4
- license: MIT
5
- compatibility: Requires openspec CLI and opencode-ensemble plugin.
6
- metadata:
7
- author: openspec-onboard
8
- version: "2.0"
9
- ---
10
-
11
- Implement tasks from an OpenSpec change using the ensemble agent team.
12
-
13
- **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.
14
-
15
- **Steps**
16
-
17
- 1. **Select the change**
18
-
19
- If a name is provided, use it. Otherwise:
20
- - Infer from conversation context if the user mentioned a change
21
- - Auto-select if only one active change exists
22
- - If ambiguous, run `openspec list --json` to get available changes and use the **AskUserQuestion tool** to let the user select
23
-
24
- Always announce: "Using change: <name>" and how to override (e.g., `/opsx-apply <other>`).
25
-
26
- 2. **Check status to understand the schema**
27
-
28
- ```bash
29
- openspec status --change "<name>" --json
30
- ```
31
-
32
- Parse the JSON to understand:
33
- - `schemaName`: The workflow being used (e.g., "spec-driven")
34
- - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
35
-
36
- 3. **Get apply instructions**
37
-
38
- ```bash
39
- openspec instructions apply --change "<name>" --json
40
- ```
41
-
42
- This returns:
43
- - `contextFiles`: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
44
- - Progress (total, complete, remaining)
45
- - Task list with status
46
- - Dynamic instruction based on current state
47
-
48
- **Handle states:**
49
- - If `state: "blocked"` (missing artifacts): show message, suggest using openspec-continue-change
50
- - If `state: "all_done"`: congratulate, suggest archive with `/opsx-archive`
51
- - Otherwise: proceed to implementation
52
-
53
- 4. **Read context files**
54
-
55
- Read every file path listed under `contextFiles` from the apply instructions output.
56
- Do NOT tell agents to read files themselves, summarize the content here and pass it in spawn prompts.
57
-
58
- 5. **Show current progress**
59
-
60
- Display:
61
- - Schema being used
62
- - Progress: "N/M tasks complete"
63
- - Remaining tasks overview
64
-
65
- 6. **Implement via ensemble team**
66
-
67
- NEVER implement tasks directly. Always delegate to engineer workers via ensemble.
68
- Do NOT touch any source files before the team is running, not even a single edit.
69
-
70
- Steps MUST be followed in order. Do not skip any step.
71
-
72
- **Step 6a.** Create feature branch if not already on one: `feature/{id}-{slug}`
73
-
74
- **Step 6b.** Create the team:
75
- ```
76
- team_create "<change-name>-<random 4 digit number>"
77
- ```
78
- Announce: "Team running. Monitor at http://localhost:4747/"
79
-
80
- **Step 6c.** Add ALL tasks to the shared board BEFORE spawning anyone.
1
+ ---
2
+ name: openspec-apply-change
3
+ description: Implement tasks from an OpenSpec change via ensemble agent team. Use when the user wants to start implementing, continue implementation, or work through tasks.
4
+ license: MIT
5
+ compatibility: Requires openspec CLI and opencode-ensemble plugin.
6
+ metadata:
7
+ author: openspec-onboard
8
+ version: "2.0"
9
+ ---
10
+
11
+ Implement tasks from an OpenSpec change using the ensemble agent team.
12
+
13
+ **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.
14
+
15
+ **Steps**
16
+
17
+ 1. **Select the change**
18
+
19
+ If a name is provided, use it. Otherwise:
20
+ - Infer from conversation context if the user mentioned a change
21
+ - Auto-select if only one active change exists
22
+ - If ambiguous, run `openspec list --json` to get available changes and use the **AskUserQuestion tool** to let the user select
23
+
24
+ Always announce: "Using change: <name>" and how to override (e.g., `/opsx-apply <other>`).
25
+
26
+ 2. **Check status to understand the schema**
27
+
28
+ ```bash
29
+ openspec status --change "<name>" --json
30
+ ```
31
+
32
+ Parse the JSON to understand:
33
+ - `schemaName`: The workflow being used (e.g., "spec-driven")
34
+ - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
35
+
36
+ 3. **Get apply instructions**
37
+
38
+ ```bash
39
+ openspec instructions apply --change "<name>" --json
40
+ ```
41
+
42
+ This returns:
43
+ - `contextFiles`: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
44
+ - Progress (total, complete, remaining)
45
+ - Task list with status
46
+ - Dynamic instruction based on current state
47
+
48
+ **Handle states:**
49
+ - If `state: "blocked"` (missing artifacts): show message, suggest using openspec-continue-change
50
+ - If `state: "all_done"`: congratulate, suggest archive with `/opsx-archive`
51
+ - Otherwise: proceed to implementation
52
+
53
+ 4. **Read context files**
54
+
55
+ Read every file path listed under `contextFiles` from the apply instructions output.
56
+ Do NOT tell agents to read files themselves, summarize the content here and pass it in spawn prompts.
57
+
58
+ 5. **Show current progress**
59
+
60
+ Display:
61
+ - Schema being used
62
+ - Progress: "N/M tasks complete"
63
+ - Remaining tasks overview
64
+
65
+ 5b. **Scope & cost confirmation gate**
66
+
67
+ Before spawning any agents, always run this check:
68
+
69
+ 1. Count remaining (incomplete) tasks from the apply instructions output.
70
+ 2. Classify cost tier:
71
+ - **Low**: 1–3 tasks — short session, fast models likely sufficient
72
+ - **Medium**: 4–7 tasks meaningful cost, consider splitting across sessions
73
+ - **High**: 8+ tasks — significant cost, strongly consider splitting the change
74
+ 3. Run `/quota` if the opencode-quota plugin is available to surface current budget state.
75
+ 4. **Always announce** before proceeding: cost tier, remaining task count, and current quota (if available).
76
+ 5. If cost tier is **Medium or High** (≥ 4 remaining tasks): use **AskUserQuestion tool** to ask the user: "About to spawn agents for N tasks (cost tier: MEDIUM/HIGH). Continue with implementation? (yes/no)"
77
+ - If **no**: stop here. Suggest splitting the change into smaller pieces with `openspec` or reducing scope. Do not proceed to step 6.
78
+ - If **yes**: proceed to step 6.
79
+ 6. If cost tier is **Low** (≤ 3 tasks): proceed automatically to step 6 (no confirmation needed).
80
+
81
+ 6. **Implement via ensemble team**
82
+
83
+ NEVER implement tasks directly. Always delegate to engineer workers via ensemble.
84
+ Do NOT touch any source files before the team is running, not even a single edit.
85
+
86
+ Steps MUST be followed in order. Do not skip any step.
87
+
88
+ **Step 6a.** Create feature branch if not already on one: `feature/{id}-{slug}`
89
+
90
+ **Step 6b.** Create the team:
91
+ ```
92
+ team_create "<change-name>-<random 4 digit number>"
93
+ ```
94
+ Announce: "Team running. Monitor at http://localhost:4747/"
95
+
96
+ **Step 6c.** Add ALL tasks to the shared board BEFORE spawning anyone, using as many `team_tasks_add` calls as needed to wire dependencies correctly.
81
97
  Schema: { content: string, priority: "high"|"medium"|"low", depends_on?: string[] }
82
- Use depends_on to block tasks that require other tasks first, pass the IDs returned by team_tasks_add.
98
+ You cannot reference returned task IDs until an earlier `team_tasks_add` call finishes, so add tasks in dependency order.
83
99
  ```
84
100
  team_tasks_add tasks:[
85
101
  { content: "1.1 <exact task text from tasks.md>", priority: "high" },
86
- { content: "1.2 <exact task text>", priority: "high" },
87
- { content: "3.1 <task that needs 1.x done first>", priority: "medium", depends_on: ["<id-of-1.1>"] },
88
- ...every task, one entry each...
102
+ { content: "1.2 <exact task text>", priority: "high" }
89
103
  ]
90
104
  ```
91
- Save the task IDs returned. Pass them to agents in step 6d.
105
+ Save the returned IDs for root tasks.
106
+ ```
107
+ team_tasks_add tasks:[
108
+ { content: "2.1 <task that depends on 1.1>", priority: "high", depends_on: ["<real-id-of-1.1>"] },
109
+ { content: "3.1 <task that depends on 1.2>", priority: "medium", depends_on: ["<real-id-of-1.2>"] }
110
+ ]
111
+ ```
112
+ Repeat until every OpenSpec task is on the board, then pass the literal IDs returned by those calls to agents in step 6d.
92
113
  DO NOT call team_claim yourself, only agents claim tasks.
93
114
  DO NOT proceed to 6d until team_tasks_add succeeds.
94
-
95
- **Step 6d.** Discover available agents, assign an INITIAL BATCH of tasks, then spawn workers.
115
+
116
+ **Step 6d.** Discover available engineers, assign an INITIAL BATCH of tasks, then spawn workers.
96
117
 
97
118
  **ROLLING BATCH MODEL:**
98
119
  Agents do NOT receive all their tasks upfront. Instead:
@@ -101,123 +122,160 @@ Implement tasks from an OpenSpec change using the ensemble agent team.
101
122
  - Repeat until no pending tasks remain on the board.
102
123
  - Only shut down an agent when the board has no more tasks for its domain.
103
124
 
104
- Agent discovery and assignment rule:
105
- - Read `.agents/agents/*.md` and use each agent's `description` and `## Abilities` to understand specialization.
106
- - For each task ID, choose the best-fit agent based on task domain (backend, frontend, infra, testing, etc.).
107
- - Prefer specialized agents when available; use `basic-engineer` as fallback only.
108
- - Only spawn agents that have assigned task IDs.
109
-
110
- REQUIRED assignment algorithm (do not skip):
111
- 1. Build candidate list from `.agents/agents/*.md` excluding `devops-manager`.
112
- 2. Classify each task by domain using task text (api/backend, ui/frontend, infra/devops, testing/qa).
113
- 3. For each task, score every candidate agent:
114
- - +3 if agent description explicitly matches domain
115
- - +2 if agent `## Abilities` include domain-relevant skills
116
- - +1 if prior tasks of same domain already assigned to that agent (cohesion)
117
- 4. Assign task to highest-score agent.
118
- 5. Use `basic-engineer` ONLY when no specialized agent has positive score.
119
- 6. If all tasks go to `basic-engineer`, you MUST explain why no specialist matched.
120
-
125
+ Before spawning:
126
+ - scan `.agents/agents/` and list the engineers that actually exist in this project
127
+ - exclude `devops-manager` from implementation selection
128
+ - read each engineer's description and abilities
129
+ - prefer the most specialized custom engineer whose description and abilities match the task
130
+ - use `basic-engineer` only when no custom engineer is a clear fit or as a recovery fallback
131
+ - never spawn an engineer name that is not present in `.agents/agents/`
132
+
133
+ REQUIRED assignment algorithm (do not skip):
134
+ 1. Build candidate list from `.agents/agents/*.md` excluding `devops-manager`.
135
+ 2. Classify each task by domain using task text (api/backend, ui/frontend, infra/devops, testing/qa).
136
+ 3. For each task, score every candidate agent:
137
+ - +3 if agent description explicitly matches domain
138
+ - +2 if agent `## Abilities` include domain-relevant skills
139
+ - +1 if prior tasks of same domain already assigned to that agent (cohesion)
140
+ 4. Assign task to highest-score agent.
141
+ 5. Use `basic-engineer` ONLY when no specialized agent has positive score.
142
+ 6. If all tasks go to `basic-engineer`, you MUST explain why no specialist matched.
143
+
121
144
  HARD RULES:
122
145
  - NEVER assign a task to `basic-engineer` if a specialized agent has higher score.
123
146
  - NEVER skip agent discovery from `.agents/agents/*.md`.
124
- - ALWAYS include assignment rationale in spawn prompt: "Selected because <domain match>".
125
-
126
- Skill loading is worker-driven:
127
- - The spawned agent MUST load `@ob-global` first.
128
- - Then it MUST load skills from its own `## Abilities` for the claimed task domain.
129
-
130
- Each team_spawn MUST include the agent field (required, causes NOT NULL error if omitted).
131
-
132
- The spawn prompt must contain exactly:
133
- 1. Their name and role on this team
134
- 1.1 Why they were selected for those tasks (domain/abilities match)
135
- 2. Their initial batch of tasks (up to 3): list the LITERAL task IDs and content from the board.
136
- 3. Key context they need (summarized from context files, do NOT tell them to read files themselves)
137
- 4. The 6 OpenCode tools they have available (these are OpenCode tools, NOT shell commands, call them directly as tools, never via bash):
138
- team_claim, team_tasks_complete, team_tasks_list, team_tasks_add, team_message, team_broadcast
139
- 5. How to proceed: call team_claim tool with the task_id to claim a task before starting it, call team_tasks_complete tool after finishing it, repeat until all listed tasks are done, then call team_message tool to notify lead with results. Lead may assign more tasks, do NOT shut down until lead confirms no more tasks.
140
- 6. Which skills to load: list the skill names and paths they MUST read before implementing. Example: "Before starting, read `.agents/skills/next-best-practices/SKILL.md` and follow its rules for all Next.js code."
141
-
142
- Keep spawn prompts under 600 tokens. Do not describe team internals or how ensemble works.
147
+ - ALWAYS include assignment rationale only when it changes task routing or is needed to justify using `basic-engineer`.
148
+
149
+ Skill loading is worker-driven:
150
+ - The spawned agent MUST load `@ob-global` first.
151
+ - Then it MUST load skills from its own `## Abilities` for the claimed task domain.
152
+
153
+ Each team_spawn MUST include the agent field (required, causes NOT NULL error if omitted).
154
+
155
+ The spawn prompt must be short and operational. It must contain:
156
+ 1. Their name and engineer file on this team
157
+ 2. Their initial batch of tasks (up to 3): include the LITERAL task IDs AND the task content. Copy them verbatim from the IDs returned by `team_tasks_add`. Do NOT paraphrase or omit IDs.
158
+ 3. Key context they need, summarized from context files
159
+ 4. Exact verification commands or acceptance checks
160
+ 5. Only the mandatory skill names or repo-specific rules they still need after claim
161
+
162
+ Keep spawn prompts short and concrete. Prefer 120-220 tokens. Do NOT paste a generic tool list or long workflow boilerplate the plugin and agent file already provide.
163
+ ALWAYS set `claim_task` to the first unblocked task in that agent's initial batch.
143
164
  Only spawn agents whose tasks are actually needed by this change. Skip agents with no tasks.
144
165
 
145
- Spawn one or more best-fit workers (parallel when dependencies allow):
166
+ Prompt shape:
146
167
  ```
147
- team_spawn name:"eng-1" agent:"backend-engineer" prompt:"..."
148
- team_spawn name:"eng-2" agent:"frontend-engineer" prompt:"..."
149
- team_spawn name:"eng-3" agent:"basic-engineer" prompt:"..."
168
+ You are <worker-name>, <engineer-file>.
169
+ Claim this task immediately as your first action:
170
+ - [task-<id1>] <task text>
171
+ <optional more tasks in the batch>
172
+
173
+ Key context:
174
+ - <short bullets>
175
+
176
+ After claiming:
177
+ 1. Load @ob-global
178
+ 2. Load only the relevant abilities/skills for this task
179
+ 3. Implement the task
180
+ 4. Call team_tasks_complete for the same task ID
181
+ 5. Send a short team_message with files changed and checks run
150
182
  ```
151
183
 
152
- Then immediately send each spawned worker a start message with exact task IDs:
184
+ Spawn sequentially, waiting for each result:
153
185
  ```
154
- team_message to:"eng-1" text:"Start now. Load @ob-global first, then use your agent `## Abilities` for these tasks: [task-<id1>] ... Claim each task ID before starting."
155
- team_message to:"eng-2" text:"Start now. Load @ob-global first, then use your agent `## Abilities` for these tasks: [task-<id2>] ... Claim each task ID before starting."
156
- team_message to:"eng-3" text:"Start now. Load @ob-global first, then use your agent `## Abilities` for these tasks: [task-<id3>] ... Claim each task ID before starting."
186
+ team_spawn name:"ui1" agent:"frontend-engineer" prompt:"..."
187
+ (wait for result)
188
+ team_spawn name:"api1" agent:"backend-engineer" prompt:"..."
189
+ (wait for result)
157
190
  ```
191
+ Replace example agent names with REAL engineers that exist in this project.
158
192
 
193
+ Then send each spawned worker a short start message that repeats their exact task IDs if needed:
194
+ ```
195
+ team_message to:"ui1" text:"Claim now: [task-<id1>] <task text>."
196
+ ```
197
+ Never send a generic "claim your first task" message without the actual IDs.
198
+ If `claim_task` already covers the first task, keep the start message minimal. Use follow-up messages mainly for additional tasks in the batch or recovery.
199
+
159
200
  **Step 6e.** After sending start messages, tell the user what is running, then STOP and wait.
160
201
  Do NOT call team_results, team_status, or team_broadcast in a loop.
161
202
  Teammates will message you when done or blocked. Wait for those messages.
203
+ Tell the user exactly how to inspect progress:
204
+ - `team_status` for team snapshot
205
+ - `team_tasks_list` for board state
206
+ - `team_view member:"<name>"` for a teammate live session
207
+ - `team_results from:"<name>"` for full teammate report text
162
208
 
163
209
  **Step 6f.** When a teammate messages back (rolling re-assignment loop):
164
210
  1. Call `team_results from:"<name>"` to read full message.
165
211
  2. Call `team_tasks_list` to check remaining pending/unassigned tasks on the board.
166
- 3. **If there are more unassigned tasks matching this agent's domain:**
212
+ 3. If the teammate is idle and has not claimed any assigned task:
213
+ - resend one short claim-only message with the same literal task IDs
214
+ - if they still do not claim, `team_shutdown member:"<name>" force:true`
215
+ - respawn once with a shorter prompt and the same first `claim_task`
216
+ - if the second spawn also stays idle, stop forcing ensemble for this change and continue in the main session or ask the user whether to retry later
217
+ 4. **If there are more unassigned tasks matching this agent's domain:**
167
218
  - Pick up to 3 unassigned, unblocked tasks for this agent's domain.
168
- - Send them via `team_message to:"<name>" text:"Next tasks: [task-<id1>] <desc>, [task-<id2>] <desc>. Claim each with team_claim before starting."`
219
+ - Send them via `team_message to:"<name>" text:"Claim next: [task-<id1>] <desc>, [task-<id2>] <desc>."`
169
220
  - Do NOT shut down the agent. Go back to waiting (step 6e).
170
- 4. **If no more tasks for this agent:**
221
+ 5. **If no more tasks for this agent:**
171
222
  - `team_shutdown member:"<name>"`
172
223
  - `team_merge member:"<name>"`
173
224
  - If team_merge blocks on local changes: `git stash`, retry merge, `git stash pop`.
174
- 5. **If ALL agents are shut down and tasks remain unassigned:**
175
- - Spawn new agents for the remaining tasks (back to step 6d).
176
- 6. **If ALL tasks are done:** proceed to step 7.
177
-
178
- **ZERO PENDING TASKS GUARANTEE:** Before proceeding to step 7, call `team_tasks_list` and verify EVERY task is either `done` or `blocked`. If any task is `pending` and unassigned, assign it to an agent or spawn a new one. Never leave pending tasks orphaned.
179
-
225
+ 6. **If ALL agents are shut down and tasks remain unassigned** (new domain, dependencies unblocked):
226
+ - Discover the remaining matching engineers from `.agents/agents/` and spawn a new wave (back to step 6d).
227
+ 7. **If ALL tasks are done:** proceed to step 7.
228
+
229
+ **ZERO PENDING TASKS GUARANTEE:** Before proceeding to step 7, call `team_tasks_list` and verify EVERY task is either `done` or `blocked`. If any task is `pending` and unassigned, assign it to an agent or spawn a new one. Never leave pending tasks orphaned.
230
+
180
231
  7. **Verification check**
181
232
 
182
- Run verification tasks (tests/build/lint) using a worker suited for verification scope:
183
- - either same engineer workers
184
- - or a dedicated verifier worker if your project defines one
185
-
186
- Wait for results fix blockers.
187
-
188
- 8. **Mark tasks complete in openspec**
189
-
190
- Update tasks.md: `- [ ]` → `- [x]` for each completed task.
191
- Run `openspec status --change "<name>" --json` to confirm.
192
-
193
- 9. **Show status, then cleanup**
194
-
195
- Display:
196
- - Tasks completed this session
197
- - Overall progress: "N/M tasks complete"
198
- - If all done: suggest archive with `/opsx-archive`
199
- - If paused: explain why and wait for guidance
200
-
201
- Then run `team_cleanup`.
202
-
203
- **Guardrails**
204
- - NEVER skip or reorder steps 6a-6f
205
- - NEVER implement tasks directly. Always use team_create + team_spawn, no exceptions
206
- - NEVER touch source files before team_create is called, not even one edit
207
- - NEVER call team_spawn without the agent field, it is required and will fail without it
208
- - NEVER call team_spawn before team_tasks_add, tasks must exist before agents are spawned
209
- - NEVER poll team_results or team_status in a loop, wait for teammates to message you
233
+ Spawn the best available verification-capable engineer with `worktree:false` (for example, a testing-focused custom engineer or `basic-engineer` if no better verifier exists):
234
+ ```
235
+ team_spawn name:"verify" agent:"<real-verifier-engineer>" worktree:false prompt:"<verification scope, context summary, run tests + build + lint + verify acceptance criteria, no task claiming required in this phase, send results to lead when done>"
236
+ ```
237
+ Wait for message -> team_results -> fix blockers -> team_shutdown (no team_merge needed, worktree:false)
238
+
239
+ 8. **Mark tasks complete in openspec**
240
+
241
+ Update tasks.md: `- [ ]` → `- [x]` for each completed task.
242
+ Run `openspec status --change "<name>" --json` to confirm.
243
+
244
+ 9. **Show status, then cleanup**
245
+
246
+ Display:
247
+ - Tasks completed this session
248
+ - Overall progress: "N/M tasks complete"
249
+ - If all done: suggest archive with `/opsx-archive`
250
+ - If paused: explain why and wait for guidance
251
+
252
+ Then run `team_cleanup`.
253
+
254
+ **Guardrails**
255
+ - NEVER skip or reorder steps 6a-6f
256
+ - NEVER skip step 5b scope & cost check before spawning
257
+ - NEVER spawn agents for Medium or High cost sessions (≥4 tasks) without explicit user confirmation from step 5b
258
+ - ALWAYS run `/quota` at session start (step 5b) when the opencode-quota plugin is available
259
+ - NEVER implement tasks directly. Always use team_create + team_spawn, no exceptions
260
+ - NEVER touch source files before team_create is called, not even one edit
261
+ - NEVER call team_spawn without the agent field, it is required and will fail without it
262
+ - NEVER call team_spawn before all tasks are on the board; use multiple `team_tasks_add` calls when dependencies require real IDs from earlier calls
263
+ - NEVER poll team_results or team_status in a loop, wait for teammates to message you
210
264
  - NEVER call team_claim or team_tasks_complete as lead, only agents call these tools
211
265
  - NEVER leave pending tasks orphaned, always verify board is empty before proceeding to step 7
266
+ - ALWAYS pass the LITERAL task IDs returned by team_tasks_add into each agent's spawn prompt, copy the exact IDs, never paraphrase
212
267
  - ALWAYS assign initial batch of up to 3 tasks per agent; re-assign next batch (up to 3) via team_message when agent reports done
213
268
  - ALWAYS call team_tasks_list after each agent reports done to check for remaining unassigned tasks
269
+ - ALWAYS repeat the same literal task IDs in any task assignment message, never send a generic "claim your first task" without the actual IDs
270
+ - NEVER send a start message that omits task IDs; if a task ID is missing from the start message, the agent cannot claim
214
271
  - NEVER edit files between team_spawn and team_merge, team_merge blocks on overlapping local changes
215
- - ALWAYS add every task to the board with team_tasks_add before spawning
216
- - ALWAYS spawn workers based on dependencies: parallel when safe, sequential when required
217
- - ALWAYS instruct agents to call team_claim before each task and team_tasks_complete after
272
+ - ALWAYS add every task to the board before spawning, using multiple `team_tasks_add` calls when dependency wiring requires it
273
+ - ALWAYS discover engineers from `.agents/agents/` and prefer matching custom engineers over `basic-engineer`
274
+ - ALWAYS spawn agents sequentially (wait for each team_spawn result before the next), then send start messages to all of them together
275
+ - ALWAYS set `claim_task` for the first unblocked task in each initial batch and instruct agents to claim before any other work
218
276
  - ALWAYS shut down + merge agents only when no more tasks remain for their domain
219
- - If teammates are stuck, use team_message to resend tasks, then wait, never implement directly
220
- - Mark tasks complete in openspec AFTER worker implementation and verification finish, not before
221
- - Pause on errors, blockers, or unclear requirements. Do not guess
222
- - Use contextFiles from CLI output, do not assume specific file paths
223
- - Follow CLI rules from `@ob-global` when present
277
+ - If teammates are stuck, use one short claim-only message, then one respawn with a shorter prompt. If repeated idle/stall continues, stop forcing ensemble and continue outside it.
278
+ - Mark tasks complete in openspec AFTER worker implementation and verification finish, not before
279
+ - Pause on errors, blockers, or unclear requirements. Do not guess
280
+ - Use contextFiles from CLI output, do not assume specific file paths
281
+ - Follow CLI rules from `@ob-global` when present