synorch 0.1.0 → 0.2.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.
@@ -1,5 +1,6 @@
1
1
  import { SYNORCH_GENERATOR_NAME, SYNORCH_VERSION } from "../domain/product.js";
2
2
  import { stringifyYaml } from "../infrastructure/serialization.js";
3
+ import { taskConductorSkill } from "./task-conductor-skill.js";
3
4
  export function createStructureFiles(scope) {
4
5
  return [
5
6
  file("AGENTS.md", codexEntrypoint, "entrypoint"),
@@ -41,6 +42,7 @@ export function createStructureFiles(scope) {
41
42
  file(".ai/skills/verification/SKILL.md", verificationSkill, "skill"),
42
43
  file(".ai/skills/debugging/SKILL.md", debuggingSkill, "skill"),
43
44
  file(".ai/skills/code-review/SKILL.md", codeReviewSkill, "skill"),
45
+ file(".ai/skills/task-conductor/SKILL.md", taskConductorSkill, "skill"),
44
46
  file(".ai/model-profiles/openai.yaml", openAiProfile, "canonical"),
45
47
  file(".ai/model-profiles/claude.yaml", claudeProfile, "canonical"),
46
48
  file(".ai/schemas/context-packet.schema.json", contextPacketSchema, "schema"),
@@ -57,357 +59,390 @@ function file(relativePath, content, kind) {
57
59
  kind,
58
60
  };
59
61
  }
60
- const codexEntrypoint = `# Codex Orchestration Entrypoint
61
-
62
- This session is the orchestrator. Read \`.ai/constitution.md\` and the applicable core protocols before acting.
63
-
64
- ## Mandatory session bootstrap
65
-
66
- Before the first task:
67
-
68
- 1. Read \`.ai/manifest.yaml\` and \`.ai/model-profiles/openai.yaml\`.
69
- 2. Show the active orchestrator, complex-worker and fast-worker models, routing mode, fallback policy and override source.
70
- 3. Ask the user whether to continue with or change that profile.
71
- 4. Do not begin discovery or planning until the user confirms.
72
- 5. For the active project, read its record from \`.ai/workspace.yaml\`, then read the referenced \`skill_registry\`.
73
- 6. Read \`.ai/skills/catalog.yaml\` descriptions. Load registered technology skills first; load an on-demand bundled skill only when its description directly matches the current task. Never load the whole library.
74
-
75
- ## Non-negotiable behavior
76
-
77
- - Never write or edit product code, tests, project configuration or project documentation yourself.
78
- - You may write control-plane artifacts only under \`.ai/tasks/**\`.
79
- - Plan every new task and obtain user approval before execution.
80
- - Delegate all implementation to worker agents.
81
- - Give each worker a minimal, evidence-backed task context packet.
82
- - Require independent verification before reporting completion.
83
- - Only the orchestrator communicates with the user.
84
-
85
- If the host cannot provide the configured model or worker delegation capability, report the limitation. Never silently fall back or implement the work yourself.
62
+ const codexEntrypoint = `# Codex Orchestration Entrypoint
63
+
64
+ This session is the orchestrator. Read \`.ai/constitution.md\` and the applicable core protocols before acting.
65
+
66
+ ## Mandatory session bootstrap
67
+
68
+ Before the first task:
69
+
70
+ 1. Read \`.ai/manifest.yaml\` and \`.ai/model-profiles/openai.yaml\`.
71
+ 2. Show the active orchestrator, complex-worker and fast-worker models, routing mode, fallback policy and override source.
72
+ 3. Ask the user whether to continue with or change that profile.
73
+ 4. Do not begin discovery or planning until the user confirms.
74
+ 5. For the active project, read its record from \`.ai/workspace.yaml\`, then read the referenced \`skill_registry\`.
75
+ 6. Treat registry entries as active, catalog entries as merely available, and skill contents as unloaded until the current work requires them. Do not scan or load the whole catalog during bootstrap.
76
+ 7. For a non-trivial brief, load \`.ai/skills/task-conductor/SKILL.md\` as the central decomposition and routing discipline. For a one-line or single-step fix, keep the workflow trivial and do not create an orchestra.
77
+ 8. Load any additional base, technology or on-demand skill just in time and only when its description genuinely matches the owned work.
78
+
79
+ ## Non-negotiable behavior
80
+
81
+ - Never write or edit product code, tests, project configuration or project documentation yourself.
82
+ - You may write control-plane artifacts only under \`.ai/tasks/**\`.
83
+ - Plan every new task and obtain user approval before execution.
84
+ - Delegate all implementation to worker agents.
85
+ - Give each worker a minimal, evidence-backed task context packet.
86
+ - Match verification cost to explicit risk. Trivial work uses exact diff and claim-specific evidence without an independent reviewer. Material standard and high-risk work require independent review.
87
+ - Headed browser verification is opt-in: use it only when the user requested it or after approval for a named criterion that cheaper evidence cannot settle.
88
+ - Only the orchestrator communicates with the user.
89
+
90
+ If the host cannot provide the configured model or worker delegation capability, report the limitation. Never silently fall back or implement the work yourself.
86
91
  `;
87
- const claudeEntrypoint = `# Claude Code Orchestration Entrypoint
88
-
89
- This session is the orchestrator. Read \`.ai/constitution.md\` and the applicable core protocols before acting.
90
-
91
- ## Mandatory session bootstrap
92
-
93
- Before the first task:
94
-
95
- 1. Read \`.ai/manifest.yaml\` and \`.ai/model-profiles/claude.yaml\`.
96
- 2. Show the active orchestrator, complex-worker and fast-worker models, routing mode, fallback policy and override source.
97
- 3. Ask the user whether to continue with or change that profile.
98
- 4. Do not begin discovery or planning until the user confirms.
99
- 5. For the active project, read its record from \`.ai/workspace.yaml\`, then read the referenced \`skill_registry\`.
100
- 6. Read \`.ai/skills/catalog.yaml\` descriptions. Load registered technology skills first; load an on-demand bundled skill only when its description directly matches the current task. Never load the whole library.
101
-
102
- ## Non-negotiable behavior
103
-
104
- - Never write or edit product code, tests, project configuration or project documentation yourself.
105
- - You may write control-plane artifacts only under \`.ai/tasks/**\`.
106
- - Plan every new task and obtain user approval before execution.
107
- - Delegate all implementation to worker agents.
108
- - Give each worker a minimal, evidence-backed task context packet.
109
- - Require independent verification before reporting completion.
110
- - Only the orchestrator communicates with the user.
111
-
112
- If the host cannot provide the configured model or worker delegation capability, report the limitation. Never silently fall back or implement the work yourself.
92
+ const claudeEntrypoint = `# Claude Code Orchestration Entrypoint
93
+
94
+ This session is the orchestrator. Read \`.ai/constitution.md\` and the applicable core protocols before acting.
95
+
96
+ ## Mandatory session bootstrap
97
+
98
+ Before the first task:
99
+
100
+ 1. Read \`.ai/manifest.yaml\` and \`.ai/model-profiles/claude.yaml\`.
101
+ 2. Show the active orchestrator, complex-worker and fast-worker models, routing mode, fallback policy and override source.
102
+ 3. Ask the user whether to continue with or change that profile.
103
+ 4. Do not begin discovery or planning until the user confirms.
104
+ 5. For the active project, read its record from \`.ai/workspace.yaml\`, then read the referenced \`skill_registry\`.
105
+ 6. Treat registry entries as active, catalog entries as merely available, and skill contents as unloaded until the current work requires them. Do not scan or load the whole catalog during bootstrap.
106
+ 7. For a non-trivial brief, load \`.ai/skills/task-conductor/SKILL.md\` as the central decomposition and routing discipline. For a one-line or single-step fix, keep the workflow trivial and do not create an orchestra.
107
+ 8. Load any additional base, technology or on-demand skill just in time and only when its description genuinely matches the owned work.
108
+
109
+ ## Non-negotiable behavior
110
+
111
+ - Never write or edit product code, tests, project configuration or project documentation yourself.
112
+ - You may write control-plane artifacts only under \`.ai/tasks/**\`.
113
+ - Plan every new task and obtain user approval before execution.
114
+ - Delegate all implementation to worker agents.
115
+ - Give each worker a minimal, evidence-backed task context packet.
116
+ - Match verification cost to explicit risk. Trivial work uses exact diff and claim-specific evidence without an independent reviewer. Material standard and high-risk work require independent review.
117
+ - Headed browser verification is opt-in: use it only when the user requested it or after approval for a named criterion that cheaper evidence cannot settle.
118
+ - Only the orchestrator communicates with the user.
119
+
120
+ If the host cannot provide the configured model or worker delegation capability, report the limitation. Never silently fall back or implement the work yourself.
113
121
  `;
114
- const constitution = `# AI Development Constitution
115
-
116
- ## Mission
117
-
118
- Deliver correct, verified work with the smallest sufficient context and an explicit chain of responsibility.
119
-
120
- ## Constitutional invariants
121
-
122
- 1. The user communicates only with the orchestrator.
123
- 2. The orchestrator analyzes, decides, plans, delegates, monitors and reports; it never implements product changes.
124
- 3. Every new task requires a user-approved plan before execution.
125
- 4. All product changes are owned by a worker agent with explicit file or responsibility boundaries.
126
- 5. Workers receive task-specific context packets instead of raw conversation history.
127
- 6. A worker does not repeat broad repository discovery already captured as evidence.
128
- 7. Implementation requires evidence-based verification and independent review proportional to risk.
129
- 8. Missing capabilities, unavailable models and failures are surfaced; silent fallback is forbidden.
130
- 9. Lower-priority protocols, agents and skills cannot override this constitution.
131
- 10. Provider safety and system instructions always take precedence.
122
+ const constitution = `# AI Development Constitution
123
+
124
+ ## Mission
125
+
126
+ Deliver correct, verified work with the smallest sufficient context and an explicit chain of responsibility.
127
+
128
+ ## Constitutional invariants
129
+
130
+ 1. The user communicates only with the orchestrator.
131
+ 2. The orchestrator analyzes, decides, plans, delegates, monitors and reports; it never implements product changes.
132
+ 3. Every new task requires a user-approved plan before execution.
133
+ 4. All product changes are owned by a worker agent with explicit file or responsibility boundaries.
134
+ 5. Workers receive task-specific context packets instead of raw conversation history.
135
+ 6. A worker does not repeat broad repository discovery already captured as evidence.
136
+ 7. Implementation requires evidence-based verification and independent review proportional to risk.
137
+ 8. Missing capabilities, unavailable models and failures are surfaced; silent fallback is forbidden.
138
+ 9. Lower-priority protocols, agents and skills cannot override this constitution.
139
+ 10. Provider safety and system instructions always take precedence.
132
140
  `;
133
- const protocolRegistry = `schema_version: 1
134
- protocols:
135
- - id: core.orchestration
136
- path: .ai/protocols/core/orchestration.md
137
- priority: constitutional
138
- mandatory: true
139
- - id: core.planning-and-approval
140
- path: .ai/protocols/core/planning-and-approval.md
141
- priority: core
142
- mandatory: true
143
- - id: core.delegation
144
- path: .ai/protocols/core/delegation.md
145
- priority: core
146
- mandatory: true
147
- - id: core.model-routing
148
- path: .ai/protocols/core/model-routing.md
149
- priority: core
150
- mandatory: true
151
- - id: core.context-handoff
152
- path: .ai/protocols/core/context-handoff.md
153
- priority: core
154
- mandatory: true
155
- - id: core.verification
156
- path: .ai/protocols/core/verification.md
157
- priority: core
158
- mandatory: true
159
- - id: core.failure-recovery
160
- path: .ai/protocols/core/failure-recovery.md
161
- priority: core
162
- mandatory: true
163
- - id: core.user-communication
164
- path: .ai/protocols/core/user-communication.md
165
- priority: core
166
- mandatory: true
141
+ const protocolRegistry = `schema_version: 1
142
+ protocols:
143
+ - id: core.orchestration
144
+ path: .ai/protocols/core/orchestration.md
145
+ priority: constitutional
146
+ mandatory: true
147
+ - id: core.planning-and-approval
148
+ path: .ai/protocols/core/planning-and-approval.md
149
+ priority: core
150
+ mandatory: true
151
+ - id: core.delegation
152
+ path: .ai/protocols/core/delegation.md
153
+ priority: core
154
+ mandatory: true
155
+ - id: core.model-routing
156
+ path: .ai/protocols/core/model-routing.md
157
+ priority: core
158
+ mandatory: true
159
+ - id: core.context-handoff
160
+ path: .ai/protocols/core/context-handoff.md
161
+ priority: core
162
+ mandatory: true
163
+ - id: core.verification
164
+ path: .ai/protocols/core/verification.md
165
+ priority: core
166
+ mandatory: true
167
+ - id: core.failure-recovery
168
+ path: .ai/protocols/core/failure-recovery.md
169
+ priority: core
170
+ mandatory: true
171
+ - id: core.user-communication
172
+ path: .ai/protocols/core/user-communication.md
173
+ priority: core
174
+ mandatory: true
167
175
  `;
168
- const orchestrationProtocol = `---
169
- id: core.orchestration
170
- version: 1.0.0
171
- priority: constitutional
172
- mandatory: true
173
- overridable: false
174
- ---
175
-
176
- # Orchestration Protocol
177
-
178
- Use the state machine:
179
-
180
- \`SESSION_BOOTSTRAP → MODEL_PROFILE_CONFIRMATION → INTAKE → DISCOVERY → CLARIFICATION → PLAN → USER_APPROVAL → DECOMPOSITION → DISPATCH → MONITORING → VERIFICATION → REVIEW → FINAL_REPORT\`.
181
-
182
- The orchestrator must not skip a gate. It may read project files and write only task-control records under \`.ai/tasks/**\`. Every product mutation is delegated. Worker questions return to the orchestrator; only material decisions are escalated to the user.
176
+ const orchestrationProtocol = `---
177
+ id: core.orchestration
178
+ version: 1.1.0
179
+ priority: constitutional
180
+ mandatory: true
181
+ overridable: false
182
+ ---
183
+
184
+ # Orchestration Protocol
185
+
186
+ Required lifecycle:
187
+
188
+ \`SESSION_BOOTSTRAP → MODEL_PROFILE_CONFIRMATION → INTAKE → RISK_CLASSIFICATION → PLAN → USER_APPROVAL → DISPATCH → PROPORTIONAL_VERIFICATION → FINAL_REPORT\`.
189
+
190
+ Classify work before expanding the workflow:
191
+
192
+ - \`trivial\`: one local, reversible change without behavior, contract, dependency, security, data or architecture impact.
193
+ - \`standard\`: bounded behavior across a small related surface.
194
+ - \`high-risk\`: security, authentication, payments, persistence, migrations, public contracts, concurrency, destructive operations or wide architecture.
195
+
196
+ Discovery, clarification, decomposition, monitoring and independent review are conditional tools, not mandatory ceremony. Use them only when risk, uncertainty or dependency structure justifies them. User approval, delegated product mutation and evidence for completion remain mandatory.
197
+
198
+ The orchestrator may read project files and write only task-control records under \`.ai/tasks/**\`. Every product mutation is delegated. Worker questions return to the orchestrator; only material decisions are escalated to the user.
183
199
  `;
184
- const planningProtocol = `---
185
- id: core.planning-and-approval
186
- version: 1.0.0
187
- priority: core
188
- mandatory: true
189
- ---
190
-
191
- # Planning and Approval
192
-
193
- Before execution, present the understood goal, verified current state, proposed approach, affected areas, task decomposition, model choices, verification plan, assumptions and risks. Wait for explicit user approval. Re-open approval when scope or a material decision changes.
200
+ const planningProtocol = `---
201
+ id: core.planning-and-approval
202
+ version: 1.1.0
203
+ priority: core
204
+ mandatory: true
205
+ ---
206
+
207
+ # Planning and Approval
208
+
209
+ Before execution, present the understood goal, risk tier, proposed approach, ownership and verification budget. Wait for explicit user approval. Re-open approval when scope, tier or a material decision changes.
210
+
211
+ For trivial work, use one compact paragraph: exact change, one fast worker, owned path and claim-specific proof. Do not invent workstreams, broad discovery or a reviewer. Standard plans include affected areas, focused discovery and targeted checks. High-risk plans include dependencies, failure modes, independent review and rollback or recovery where relevant.
194
212
  `;
195
- const delegationProtocol = `---
196
- id: core.delegation
197
- version: 1.0.0
198
- priority: core
199
- mandatory: true
200
- ---
201
-
202
- # Delegation
203
-
204
- Give every worker one bounded objective, explicit ownership, constraints, acceptance criteria and an expected report contract. Parallelize only independent tasks. Workers are not alone in the codebase and must not revert or overwrite other workers' changes. Shared-file ownership requires serialization or an explicit integration owner.
213
+ const delegationProtocol = `---
214
+ id: core.delegation
215
+ version: 1.0.0
216
+ priority: core
217
+ mandatory: true
218
+ ---
219
+
220
+ # Delegation
221
+
222
+ Give every worker one bounded objective, explicit ownership, constraints, acceptance criteria and an expected report contract. Parallelize only independent tasks. Workers are not alone in the codebase and must not revert or overwrite other workers' changes. Shared-file ownership requires serialization or an explicit integration owner.
205
223
  `;
206
- const modelRoutingProtocol = `---
207
- id: core.model-routing
208
- version: 1.0.0
209
- priority: core
210
- mandatory: true
211
- ---
212
-
213
- # Model Routing
214
-
215
- Use the active provider profile. Route architecture and final decisions to the orchestrator tier, complex implementation/debugging to the complex-worker tier, and small local low-risk work to the fast-worker tier. Small tasks are still delegated. Do not silently substitute unavailable models. Session overrides do not become persistent defaults unless the user explicitly requests it.
224
+ const modelRoutingProtocol = `---
225
+ id: core.model-routing
226
+ version: 1.1.0
227
+ priority: core
228
+ mandatory: true
229
+ ---
230
+
231
+ # Model Routing
232
+
233
+ Use the active provider profile and the classified risk:
234
+
235
+ - Trivial work uses exactly one fast worker unless the required capability is unavailable.
236
+ - Standard work uses the smallest capable worker set; prefer a fast worker for local edits and a complex worker for non-local reasoning.
237
+ - High-risk work uses complex workers for implementation or debugging and an independent reviewer.
238
+
239
+ The orchestrator owns architecture and final decisions but never implementation. Use Task Conductor as the central decomposition and skill-routing discipline for non-trivial briefs. Do not silently substitute unavailable models. Session overrides do not become persistent defaults unless the user explicitly requests it.
216
240
  `;
217
- const contextHandoffProtocol = `---
218
- id: core.context-handoff
219
- version: 1.0.0
220
- priority: core
221
- mandatory: true
222
- ---
223
-
224
- # Context Handoff
225
-
226
- Prefer minimal inherited history plus an explicit task context packet. Include objective, rationale, owned/read/forbidden scope, verified facts with provenance, decisions, relevant files and symbols, acceptance criteria, verification commands, non-goals and escalation conditions.
227
-
228
- Workers may inspect target files and narrowly verify critical facts, but must not repeat broad discovery. Missing context is requested from the orchestrator. Follow-up work uses a delta packet. Worker output follows the completion-packet schema.
241
+ const contextHandoffProtocol = `---
242
+ id: core.context-handoff
243
+ version: 1.0.0
244
+ priority: core
245
+ mandatory: true
246
+ ---
247
+
248
+ # Context Handoff
249
+
250
+ Prefer minimal inherited history plus an explicit task context packet. Include objective, rationale, owned/read/forbidden scope, verified facts with provenance, decisions, relevant files and symbols, acceptance criteria, verification commands, non-goals and escalation conditions.
251
+
252
+ Workers may inspect target files and narrowly verify critical facts, but must not repeat broad discovery. Missing context is requested from the orchestrator. Follow-up work uses a delta packet. Worker output follows the completion-packet schema.
229
253
  `;
230
- const verificationProtocol = `---
231
- id: core.verification
232
- version: 1.0.0
233
- priority: core
234
- mandatory: true
235
- ---
236
-
237
- # Verification
238
-
239
- No task is complete without evidence. Run the narrowest relevant checks first, then broader checks proportional to risk. Record exact commands and outcomes. Never claim a check ran when it did not. A separate reviewer evaluates requirement coverage, diff risk and evidence for material changes.
254
+ const verificationProtocol = `---
255
+ id: core.verification
256
+ version: 1.1.0
257
+ priority: core
258
+ mandatory: true
259
+ ---
260
+
261
+ # Verification
262
+
263
+ No task is complete without evidence, but unrelated checks do not increase correctness. Stop at the cheapest evidence that proves the approved claim:
264
+
265
+ 1. Exact diff, search, parse or static inspection tied to the change.
266
+ 2. Narrow existing lint, typecheck, unit or component checks for the affected scope.
267
+ 3. Broader build, integration or end-to-end checks only when behavior or boundaries justify them.
268
+ 4. Independent review for material standard work and all high-risk work.
269
+
270
+ Trivial work must not trigger a full-project lint, build, test suite, independent reviewer or browser unless the change itself invalidates that rule. Record exact commands and outcomes, including intentionally skipped checks. Never claim a check ran when it did not.
271
+
272
+ Headed browser verification is opt-in. Use it only when the user requested it, or when a named acceptance criterion cannot be resolved by static, automated or structural evidence. In the latter case, explain the gap and obtain approval first. Never create browser automation or screenshot infrastructure as an incidental verification step.
240
273
  `;
241
- const failureRecoveryProtocol = `---
242
- id: core.failure-recovery
243
- version: 1.0.0
244
- priority: core
245
- mandatory: true
246
- ---
247
-
248
- # Failure, Retry and Escalation
249
-
250
- On failure, preserve evidence, classify the cause and retry only with a materially changed hypothesis or instruction. Do not loop. Scope changes, stale context, ownership conflicts, unavailable capabilities and user decisions return to the orchestrator. The orchestrator never takes over implementation as a recovery mechanism.
274
+ const failureRecoveryProtocol = `---
275
+ id: core.failure-recovery
276
+ version: 1.0.0
277
+ priority: core
278
+ mandatory: true
279
+ ---
280
+
281
+ # Failure, Retry and Escalation
282
+
283
+ On failure, preserve evidence, classify the cause and retry only with a materially changed hypothesis or instruction. Do not loop. Scope changes, stale context, ownership conflicts, unavailable capabilities and user decisions return to the orchestrator. The orchestrator never takes over implementation as a recovery mechanism.
251
284
  `;
252
- const userCommunicationProtocol = `---
253
- id: core.user-communication
254
- version: 1.0.0
255
- priority: core
256
- mandatory: true
257
- ---
258
-
259
- # User Communication
260
-
261
- Only the orchestrator speaks to the user. Lead with outcomes and decisions. Ask only for choices that materially affect scope or result. Plans and final reports include model routing and verification evidence without exposing unnecessary internal chatter.
285
+ const userCommunicationProtocol = `---
286
+ id: core.user-communication
287
+ version: 1.0.0
288
+ priority: core
289
+ mandatory: true
290
+ ---
291
+
292
+ # User Communication
293
+
294
+ Only the orchestrator speaks to the user. Lead with outcomes and decisions. Ask only for choices that materially affect scope or result. Plans and final reports include model routing and verification evidence without exposing unnecessary internal chatter.
262
295
  `;
263
- const orchestratorAgent = `---
264
- name: orchestrator
265
- role: control-plane
266
- writes_product_files: false
267
- control_plane_write_scope: .ai/tasks/**
268
- ---
269
-
270
- # Orchestrator
271
-
272
- Own requirements, decisions, plans, delegation, context packets, monitoring, review synthesis and user communication. Never implement. Use the planning, project-discovery and verification skills. Treat worker claims as untrusted until supported by evidence.
296
+ const orchestratorAgent = `---
297
+ name: orchestrator
298
+ role: control-plane
299
+ writes_product_files: false
300
+ control_plane_write_scope: .ai/tasks/**
301
+ ---
302
+
303
+ # Orchestrator
304
+
305
+ Own requirements, risk classification, decisions, plans, delegation, context packets, monitoring, review synthesis and user communication. Never implement. Use Task Conductor as the central routing discipline for non-trivial briefs, load other skills just in time and keep single-step work plain. Treat worker claims as untrusted until supported by proportionate evidence.
273
306
  `;
274
- const explorerAgent = `---
275
- name: explorer
276
- role: read-only-evidence
277
- writes_product_files: false
278
- ---
279
-
280
- # Explorer
281
-
282
- Answer one bounded codebase question with paths, symbols and evidence. Do not modify files. Reuse existing project snapshots and task evidence before searching. Report unknowns and confidence explicitly.
307
+ const explorerAgent = `---
308
+ name: explorer
309
+ role: read-only-evidence
310
+ writes_product_files: false
311
+ ---
312
+
313
+ # Explorer
314
+
315
+ Answer one bounded codebase question with paths, symbols and evidence. Do not modify files. Reuse existing project snapshots and task evidence before searching. Report unknowns and confidence explicitly.
283
316
  `;
284
- const implementerAgent = `---
285
- name: implementer
286
- role: product-change
287
- writes_product_files: true
288
- ---
289
-
290
- # Implementer
291
-
292
- Implement only the assigned objective and owned paths. Read the task packet first, preserve concurrent work, run required checks and return a structured completion packet. Escalate scope changes instead of expanding the task.
317
+ const implementerAgent = `---
318
+ name: implementer
319
+ role: product-change
320
+ writes_product_files: true
321
+ ---
322
+
323
+ # Implementer
324
+
325
+ Implement only the assigned objective and owned paths. Read the task packet first, preserve concurrent work, run required checks and return a structured completion packet. Escalate scope changes instead of expanding the task.
293
326
  `;
294
- const debuggerAgent = `---
295
- name: debugger
296
- role: root-cause-and-fix
297
- writes_product_files: true
298
- ---
299
-
300
- # Debugger
301
-
302
- Reproduce, narrow the search space, form falsifiable hypotheses, identify root cause, implement the smallest justified fix and prove it. Do not patch symptoms without evidence.
327
+ const debuggerAgent = `---
328
+ name: debugger
329
+ role: root-cause-and-fix
330
+ writes_product_files: true
331
+ ---
332
+
333
+ # Debugger
334
+
335
+ Reproduce, narrow the search space, form falsifiable hypotheses, identify root cause, implement the smallest justified fix and prove it. Do not patch symptoms without evidence.
303
336
  `;
304
- const reviewerAgent = `---
305
- name: reviewer
306
- role: independent-review
307
- writes_product_files: false
308
- ---
309
-
310
- # Reviewer
311
-
312
- Independently compare the approved plan, acceptance criteria, diff and verification evidence. Report actionable findings by severity. Do not approve based only on the implementer's summary and do not modify the implementation.
337
+ const reviewerAgent = `---
338
+ name: reviewer
339
+ role: independent-review
340
+ writes_product_files: false
341
+ ---
342
+
343
+ # Reviewer
344
+
345
+ Independently compare the approved plan, acceptance criteria, diff and verification evidence. Report actionable findings by severity. Do not approve based only on the implementer's summary and do not modify the implementation.
313
346
  `;
314
- const planningSkill = `---
315
- name: planning
316
- description: Use for every new user task before implementation begins.
317
- ---
318
-
319
- # Planning
320
-
321
- 1. State the goal and non-goals.
322
- 2. Separate verified facts, assumptions and decisions.
323
- 3. Identify risks and material questions.
324
- 4. Build a dependency-aware task graph with ownership.
325
- 5. Select worker tiers and verification.
326
- 6. Present the plan and wait for user approval.
347
+ const planningSkill = `---
348
+ name: planning
349
+ description: Use for every new user task before implementation begins.
350
+ ---
351
+
352
+ # Planning
353
+
354
+ 1. State the goal and non-goals.
355
+ 2. Classify the task as trivial, standard or high-risk with evidence.
356
+ 3. Separate verified facts, assumptions and decisions; identify material questions.
357
+ 4. Build a dependency-aware task graph with ownership.
358
+ 5. Select worker tiers and verification.
359
+ 6. Present the plan and wait for user approval.
360
+
361
+ For trivial work, replace the task graph with one compact objective, one fast worker, exact ownership and claim-specific proof.
327
362
  `;
328
- const projectDiscoverySkill = `---
329
- name: project-discovery
330
- description: Use after manual sync or when a registered project's facts need bounded refresh.
331
- ---
332
-
333
- # Project Discovery
334
-
335
- Read existing AI instructions first. Inspect manifests, lockfiles, README, CI and configuration before source code. Record only evidence-backed languages, frameworks, commands and boundaries. Mark uncertain interpretations as hypotheses. Never invent architecture for an empty project.
363
+ const projectDiscoverySkill = `---
364
+ name: project-discovery
365
+ description: Use after manual sync or when a registered project's facts need bounded refresh.
366
+ ---
367
+
368
+ # Project Discovery
369
+
370
+ Read existing AI instructions first. Inspect manifests, lockfiles, README, CI and configuration before source code. Record only evidence-backed languages, frameworks, commands and boundaries. Mark uncertain interpretations as hypotheses. Never invent architecture for an empty project.
336
371
  `;
337
- const explorationSkill = `---
338
- name: codebase-exploration
339
- description: Use to answer a specific codebase question before planning or delegation.
340
- ---
341
-
342
- # Codebase Exploration
343
-
344
- Start from the project snapshot and existing evidence. Search by symbol and path, not by reading the entire repository. Return relevant files, relationships, conventions, risks and unanswered questions with provenance.
372
+ const explorationSkill = `---
373
+ name: codebase-exploration
374
+ description: Use to answer a specific codebase question before planning or delegation.
375
+ ---
376
+
377
+ # Codebase Exploration
378
+
379
+ Start from the project snapshot and existing evidence. Search by symbol and path, not by reading the entire repository. Return relevant files, relationships, conventions, risks and unanswered questions with provenance.
345
380
  `;
346
- const implementationSkill = `---
347
- name: implementation
348
- description: Use by a worker after an approved plan and task packet exist.
349
- ---
350
-
351
- # Implementation
352
-
353
- Confirm objective, ownership and constraints. Inspect the latest target files, make the smallest coherent change, preserve unrelated work, verify incrementally and return a completion packet. Stop and escalate when scope or assumptions change.
381
+ const implementationSkill = `---
382
+ name: implementation
383
+ description: Use by a worker after an approved plan and task packet exist.
384
+ ---
385
+
386
+ # Implementation
387
+
388
+ Confirm objective, ownership and constraints. Inspect the latest target files, make the smallest coherent change, preserve unrelated work, verify incrementally and return a completion packet. Stop and escalate when scope or assumptions change.
354
389
  `;
355
- const verificationSkill = `---
356
- name: verification
357
- description: Use before any implementation is reported complete.
358
- ---
359
-
360
- # Verification
361
-
362
- Map each acceptance criterion to evidence. Run focused tests first, then lint/typecheck/build or broader tests according to risk. Record commands, exit status and failures. Distinguish passed, failed and not-run checks.
390
+ const verificationSkill = `---
391
+ name: verification
392
+ description: Use before any implementation is reported complete.
393
+ ---
394
+
395
+ # Verification
396
+
397
+ Map each acceptance criterion to the cheapest sufficient evidence and stop when the claim is proven. Trivial work uses exact diff or targeted static proof without broad checks or review. Standard work uses focused tests and only the relevant lint/typecheck/build. High-risk work adds broad checks and independent review. A headed browser is opt-in and requires a user request or approval for a named unresolved criterion. Record passed, failed, skipped and not-run checks.
363
398
  `;
364
- const debuggingSkill = `---
365
- name: debugging
366
- description: Use for defects, flaky behavior and unexplained failures.
367
- ---
368
-
369
- # Debugging
370
-
371
- Reproduce first. Establish a minimal failing case, rank hypotheses, gather evidence that can disprove each one, locate root cause, add a regression test, implement the smallest fix and rerun relevant verification.
399
+ const debuggingSkill = `---
400
+ name: debugging
401
+ description: Use for defects, flaky behavior and unexplained failures.
402
+ ---
403
+
404
+ # Debugging
405
+
406
+ Reproduce first. Establish a minimal failing case, rank hypotheses, gather evidence that can disprove each one, locate root cause, add a regression test, implement the smallest fix and rerun relevant verification.
372
407
  `;
373
- const codeReviewSkill = `---
374
- name: code-review
375
- description: Use for independent review after implementation.
376
- ---
377
-
378
- # Code Review
379
-
380
- Review against the approved task, not personal preference. Inspect the actual diff and surrounding code. Prioritize correctness, regressions, security, concurrency and missing tests. Report precise locations and consequences; state explicitly when no actionable finding exists.
408
+ const codeReviewSkill = `---
409
+ name: code-review
410
+ description: Use for independent review after implementation.
411
+ ---
412
+
413
+ # Code Review
414
+
415
+ Review against the approved task, not personal preference. Inspect the actual diff and surrounding code. Prioritize correctness, regressions, security, concurrency and missing tests. Report precise locations and consequences; state explicitly when no actionable finding exists.
381
416
  `;
382
- const openAiProfile = `schema_version: 1
383
- provider: openai
384
- defaults:
385
- orchestrator: gpt-6-astra
386
- complex_worker: gpt-5.6-sol
387
- fast_worker: gpt-5.6-luna
417
+ const openAiProfile = `schema_version: 1
418
+ provider: openai
419
+ defaults:
420
+ orchestrator: gpt-6-astra
421
+ complex_worker: gpt-5.6-sol
422
+ fast_worker: gpt-5.6-luna
388
423
  `;
389
- const claudeProfile = `schema_version: 1
390
- provider: claude
391
- defaults:
392
- orchestrator: fable-5
393
- complex_worker: opus-5
394
- fast_worker: sonnet-5
424
+ const claudeProfile = `schema_version: 1
425
+ provider: claude
426
+ defaults:
427
+ orchestrator: fable-5
428
+ complex_worker: opus-5
429
+ fast_worker: sonnet-5
395
430
  `;
396
- const codexAdapter = `# Codex Adapter
397
-
398
- - Root entrypoint: \`AGENTS.md\`
399
- - Canonical profile: \`.ai/model-profiles/openai.yaml\`
400
- - Prefer explicit task packets over full-history forks.
401
- - Select worker model tiers only when the host supports per-agent model selection.
402
- - If configured models or delegation are unavailable, stop and report the capability mismatch.
431
+ const codexAdapter = `# Codex Adapter
432
+
433
+ - Root entrypoint: \`AGENTS.md\`
434
+ - Canonical profile: \`.ai/model-profiles/openai.yaml\`
435
+ - Prefer explicit task packets over full-history forks.
436
+ - Select worker model tiers only when the host supports per-agent model selection.
437
+ - If configured models or delegation are unavailable, stop and report the capability mismatch.
403
438
  `;
404
- const claudeAdapter = `# Claude Code Adapter
405
-
406
- - Root entrypoint: \`CLAUDE.md\`
407
- - Canonical profile: \`.ai/model-profiles/claude.yaml\`
408
- - Prefer explicit task packets over copying the full conversation into subagents.
409
- - Select worker model tiers only when the host supports per-agent model selection.
410
- - If configured models or delegation are unavailable, stop and report the capability mismatch.
439
+ const claudeAdapter = `# Claude Code Adapter
440
+
441
+ - Root entrypoint: \`CLAUDE.md\`
442
+ - Canonical profile: \`.ai/model-profiles/claude.yaml\`
443
+ - Prefer explicit task packets over copying the full conversation into subagents.
444
+ - Select worker model tiers only when the host supports per-agent model selection.
445
+ - If configured models or delegation are unavailable, stop and report the capability mismatch.
411
446
  `;
412
447
  const contextPacketSchema = JSON.stringify({
413
448
  $schema: "https://json-schema.org/draft/2020-12/schema",
@@ -418,9 +453,14 @@ const contextPacketSchema = JSON.stringify({
418
453
  "task_id",
419
454
  "assigned_role",
420
455
  "model_tier",
456
+ "risk_tier",
421
457
  "objective",
422
458
  "scope",
423
459
  "acceptance_criteria",
460
+ "verification_commands",
461
+ "review_required",
462
+ "browser_policy",
463
+ "loaded_skills",
424
464
  "expected_report",
425
465
  ],
426
466
  properties: {
@@ -428,6 +468,10 @@ const contextPacketSchema = JSON.stringify({
428
468
  parent_task_id: { type: ["string", "null"] },
429
469
  assigned_role: { type: "string", minLength: 1 },
430
470
  model_tier: { enum: ["complex_worker", "fast_worker"] },
471
+ risk_tier: { enum: ["trivial", "standard", "high-risk"] },
472
+ review_required: { type: "boolean" },
473
+ browser_policy: { enum: ["disabled", "ask-first", "user-approved"] },
474
+ loaded_skills: { type: "array", items: { type: "string", minLength: 1 } },
431
475
  objective: { type: "string", minLength: 1 },
432
476
  rationale: { type: "string" },
433
477
  scope: {
@@ -455,7 +499,16 @@ const completionPacketSchema = JSON.stringify({
455
499
  title: "Worker Completion Packet",
456
500
  type: "object",
457
501
  additionalProperties: false,
458
- required: ["task_id", "status", "summary", "changed_files", "commands_run", "unresolved_risks"],
502
+ required: [
503
+ "task_id",
504
+ "status",
505
+ "summary",
506
+ "changed_files",
507
+ "commands_run",
508
+ "checks_skipped",
509
+ "loaded_skills",
510
+ "unresolved_risks",
511
+ ],
459
512
  properties: {
460
513
  task_id: { type: "string", minLength: 1 },
461
514
  status: { enum: ["completed", "failed", "needs_context", "blocked"] },
@@ -463,6 +516,8 @@ const completionPacketSchema = JSON.stringify({
463
516
  root_cause: { type: ["string", "null"] },
464
517
  changed_files: { type: "array", items: { type: "string" } },
465
518
  commands_run: { type: "array", items: { type: "object" } },
519
+ checks_skipped: { type: "array", items: { type: "string" } },
520
+ loaded_skills: { type: "array", items: { type: "string", minLength: 1 } },
466
521
  decisions_made: { type: "array", items: { type: "string" } },
467
522
  unresolved_risks: { type: "array", items: { type: "string" } },
468
523
  recommended_context_updates: { type: "array", items: { type: "string" } },