role-os 2.2.1 → 2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.3.0
4
+
5
+ ### Added
6
+
7
+ #### Dogfood Swarm Mission — Multi-Pass Health + Feature Convergence
8
+
9
+ - **Dogfood swarm mission** — 9th mission in the library. Three-stage health pass (bug/security → proactive → humanization) then iterative feature pass with exclusive file ownership, build gates, and user checkpoints. Moves a repo from "works" to "production-ready." Proven on claude-collaborate (35→129 tests, 106 findings fixed, v1.1.0 shipped).
10
+ - **7 new roles** — Swarm Coordinator, Swarm Backend Agent, Swarm Bridge Agent, Swarm Tests Agent, Swarm Infra Agent, Swarm Frontend Agent, Swarm Synthesizer (61 total roles)
11
+ - **Swarm team pack** — 10th pack, 8 roles (7 swarm + Critic Reviewer), with mismatch guards and trial evidence
12
+ - **Two new mission primitives**:
13
+ - `waveLoops` — iterative convergence with exit conditions, max iterations, build gates, and user approval flags
14
+ - `exclusiveOwnership` — strict domain file boundaries enforced by manifest
15
+ - **Dynamic domain dispatch** — scales agent count based on repo structure via `swarm-manifest.json`
16
+ - **`roleos swarm` CLI** — first-class entry point with subcommands: `swarm`, `swarm manifest`, `swarm manifest --generate`, `swarm status`, `swarm findings`, `swarm approve`, `swarm verify`
17
+ - **Domain detection** (`src/swarm/domain-detect.mjs`) — auto-detects repo type (CLI, web, desktop, MCP, monorepo) and generates domain manifests with non-overlapping file ownership
18
+ - **Build gate** (`src/swarm/build-gate.mjs`) — auto-detects build system (Node, Rust, Python, Go) and runs lint → typecheck → test verification after every wave
19
+ - **Evidence persistence bridge** (`src/swarm/persist-bridge.mjs`) — optional connection back to dogfood-labs, converts wave results to dogfood submission + audit DB payloads
20
+ - **7 artifact contracts** — `swarm-gate`, `wave-report` (×5 with domain-specific sections), `swarm-final-report`
21
+ - **Pack handoff contract** for swarm flow
22
+
23
+ ### Tests
24
+ - 97 new tests (swarm core, domain detection, build gate, persist bridge) — total: 1150
25
+
3
26
  ## 2.2.1
4
27
 
5
28
  ### Added
package/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  <a href="https://mcp-tool-shop-org.github.io/role-os/"><img src="https://img.shields.io/badge/Landing_Page-live-brightgreen" alt="Landing Page"></a>
14
14
  </p>
15
15
 
16
- A multi-Claude operating system that staffs, routes, validates, and runs work through 54 specialized role contracts. Creates task packets, assembles the right team from scored role matching, detects broken chains before execution, auto-routes recovery when work is blocked or rejected, and requires structured evidence in every verdict. Includes dynamic dispatch for manifest-scaled missions — a 10-component repo automatically becomes 28 auditor steps, not 6.
16
+ A multi-Claude operating system that staffs, routes, validates, and runs work through 61 specialized role contracts. Creates task packets, assembles the right team from scored role matching, detects broken chains before execution, auto-routes recovery when work is blocked or rejected, and requires structured evidence in every verdict. Includes dynamic dispatch for manifest-scaled missions — a 10-component repo automatically becomes 28 auditor steps, not 6. The dogfood swarm mission runs multi-pass convergence: three health stages then iterative feature delivery with exclusive file ownership and build gates.
17
17
 
18
18
  ## What it does
19
19
 
@@ -44,9 +44,9 @@ roleos start "something completely novel"
44
44
 
45
45
  **The fallback ladder:**
46
46
 
47
- 1. **Mission** — when the task matches a proven recurring workflow (bugfix, treatment, feature-ship, docs, security, research, brainstorm, deep-audit). Known role chain, artifact flow, escalation branches, and honest-partial definitions.
48
- 2. **Pack** — when the task is a known family but not a full mission shape. 9 calibrated team packs with auto-selection and mismatch guards.
49
- 3. **Free routing** — when the task is novel, mixed, or uncertain. Scores all 54 roles against packet content and assembles a dynamic chain.
47
+ 1. **Mission** — when the task matches a proven recurring workflow (bugfix, treatment, feature-ship, docs, security, research, brainstorm, deep-audit, dogfood-swarm). Known role chain, artifact flow, escalation branches, and honest-partial definitions.
48
+ 2. **Pack** — when the task is a known family but not a full mission shape. 10 calibrated team packs with auto-selection and mismatch guards.
49
+ 3. **Free routing** — when the task is novel, mixed, or uncertain. Scores all 61 roles against packet content and assembles a dynamic chain.
50
50
 
51
51
  The system never forces work through the wrong abstraction. It explains why it chose each level and offers alternatives.
52
52
 
@@ -103,7 +103,7 @@ Full treatment is a canonical 7-phase protocol defined in Claude project memory
103
103
 
104
104
  Order: Shipcheck first, then full treatment. No v1.0.0 without passing hard gates.
105
105
 
106
- ## 54 roles across 9 packs
106
+ ## 61 roles across 10 packs
107
107
 
108
108
  | Pack | Roles |
109
109
  |------|-------|
@@ -116,6 +116,7 @@ Order: Shipcheck first, then full treatment. No v1.0.0 without passing hard gate
116
116
  | **Research** (4) | UX Researcher, Competitive Analyst, Trend Researcher, User Interview Synthesizer |
117
117
  | **Growth** (4) | Launch Strategist, Content Strategist, Community Manager, Support Triage Lead |
118
118
  | **Deep Audit** (4) | Component Auditor, Test Truth Auditor, Seam Auditor, Audit Synthesizer |
119
+ | **Swarm** (7) | Swarm Coordinator, Swarm Backend Agent, Swarm Bridge Agent, Swarm Tests Agent, Swarm Infra Agent, Swarm Frontend Agent, Swarm Synthesizer |
119
120
 
120
121
  Every role has a full contract: mission, use when, do not use when, expected inputs, required outputs, quality bar, and escalation triggers. Every role is routable — `roleos route` can recommend any of them based on packet content.
121
122
 
@@ -140,6 +141,13 @@ roleos audit # Start component-level deep audit
140
141
  roleos audit status # Check audit progress
141
142
  roleos audit verify # Verify manifest and outputs
142
143
 
144
+ # Dogfood swarm:
145
+ roleos swarm manifest --generate # Auto-detect domains from repo structure
146
+ roleos swarm # Start multi-pass convergence swarm
147
+ roleos swarm status # Check swarm progress by stage
148
+ roleos swarm findings # List findings by severity
149
+ roleos swarm approve # Approve feature gate
150
+
143
151
  # Or go manual:
144
152
  roleos start "fix the crash" # Entry decision only (no run)
145
153
  roleos packet new feature
@@ -213,12 +221,14 @@ role-os/
213
221
  entry-cmd.mjs ← `roleos start` CLI command
214
222
  run.mjs ← Persistent run engine: create → step → pause → resume → report
215
223
  run-cmd.mjs ← `roleos run/resume/next/explain/complete/fail` + interventions
216
- mission.mjs ← 8 named mission types (feature, bugfix, treatment, docs, security, research, brainstorm, deep-audit)
224
+ mission.mjs ← 9 named mission types (feature, bugfix, treatment, docs, security, research, brainstorm, deep-audit, dogfood-swarm)
217
225
  mission-run.mjs ← Mission runner: create → step → complete → report
218
226
  mission-cmd.mjs ← `roleos mission` CLI commands
219
227
  audit-cmd.mjs ← `roleos audit` — deep audit entry point with manifest generation
220
- route.mjs 54-role routing + dynamic chain builder
221
- packs.mjs 9 calibrated team packs + auto-selection
228
+ swarm-cmd.mjs `roleos swarm` dogfood swarm entry point with domain detection
229
+ swarm/ Domain detection, build gate, evidence persistence bridge
230
+ route.mjs ← 61-role routing + dynamic chain builder
231
+ packs.mjs ← 10 calibrated team packs + auto-selection
222
232
  conflicts.mjs ← 4-pass conflict detection
223
233
  escalation.mjs ← Auto-routing for blocked/rejected/split
224
234
  evidence.mjs ← Structured evidence + role-aware requirements
@@ -235,7 +245,7 @@ role-os/
235
245
  brainstorm.mjs ← Evidence modes, request validation, finding/synthesis/judge schemas
236
246
  brainstorm-roles.mjs ← Role-native schemas, input partitioning, blindspot enforcement, cross-exam
237
247
  brainstorm-render.mjs ← Two-layer rendering: lexical bans, render schemas, debate transcript
238
- test/ ← 954 tests across 33 test files
248
+ test/ ← 1150 tests across 37 test files
239
249
  starter-pack/ ← Drop-in role contracts, policies, schemas, workflows
240
250
  ```
241
251
 
@@ -247,14 +257,14 @@ Role OS operates **locally only**. It copies markdown templates and writes packe
247
257
 
248
258
  | Layer | What it does | Status |
249
259
  |-------|-------------|--------|
250
- | **Routing** | Scores all 54 roles against packet content, explains recommendations, assesses confidence | ✓ Shipped |
260
+ | **Routing** | Scores all 61 roles against packet content, explains recommendations, assesses confidence | ✓ Shipped |
251
261
  | **Chain builder** | Assembles phase-ordered chains from scored roles, packet-type biased not template-locked | ✓ Shipped |
252
262
  | **Conflict detection** | 4-pass validation: hard conflicts, sequence, redundancy, coverage gaps. Repair suggestions. | ✓ Shipped |
253
263
  | **Escalation** | Auto-routes blocked/rejected/split work to the right resolver with reason + required artifact | ✓ Shipped |
254
264
  | **Evidence** | Role-aware structured evidence in verdicts. Sufficiency checks. 12 evidence kinds. | ✓ Shipped |
255
265
  | **Dispatch** | Generates execution manifests for multi-claude. Per-role tool profiles, system prompts, budgets. | ✓ Shipped |
256
266
  | **Trials** | Full roster proven: 30/30 gold-task + 5/5 negative trials. 7 pack trials complete. | ✓ Complete |
257
- | **Team Packs** | 9 calibrated packs with auto-selection, mismatch guards, and free-routing fallback. | ✓ Shipped |
267
+ | **Team Packs** | 10 calibrated packs with auto-selection, mismatch guards, and free-routing fallback. | ✓ Shipped |
258
268
  | **Outcome calibration** | Records run outcomes, tunes pack/role weights from results, adjusts confidence thresholds. | ✓ Shipped |
259
269
  | **Mixed-task decomposition** | Detects composite work, splits into child packets, assigns packs, preserves dependencies. | ✓ Shipped |
260
270
  | **Composite execution** | Runs child packets in dependency order with artifact passing, branch recovery, and synthesis. | ✓ Shipped |
@@ -262,14 +272,15 @@ Role OS operates **locally only**. It copies markdown templates and writes packe
262
272
  | **Session spine** | `roleos init claude` scaffolds CLAUDE.md, /roleos-route, /roleos-review, /roleos-status. `roleos doctor` verifies wiring. Route cards prove engagement. | ✓ Shipped |
263
273
  | **Hook spine** | 5 lifecycle hooks (SessionStart, PromptSubmit, PreToolUse, SubagentStart, Stop). Advisory enforcement: route card reminders, write-tool gating, subagent role injection, completion audit. | ✓ Shipped |
264
274
  | **Artifact spine** | Per-role artifact contracts. Pack handoff contracts. Structural validation. Chain completeness checks. Downstream roles never guess what they received. | ✓ Shipped |
265
- | **Mission library** | 8 named missions (feature-ship, bugfix, treatment, docs-release, security-hardening, research-launch, brainstorm, deep-audit). Each declares pack, role chain, artifact flow, escalation branches, honest-partial definition. | ✓ Shipped |
275
+ | **Mission library** | 9 named missions (feature-ship, bugfix, treatment, docs-release, security-hardening, research-launch, brainstorm, deep-audit, dogfood-swarm). Each declares pack, role chain, artifact flow, escalation branches, honest-partial definition. | ✓ Shipped |
266
276
  | **Mission runner** | Create runs, step through with tracked state, complete/fail with honest reporting. Blocked-step propagation, out-of-chain escalation warnings, last-step re-opening. | ✓ Shipped |
267
277
  | **Unified entry** | `roleos start` decides mission vs pack vs free routing automatically. Fallback ladder with confidence scores, alternatives, and composite detection. | ✓ Shipped |
268
278
  | **Persistent runs** | `roleos run` creates disk-backed runs. `resume`, `next`, `explain`, `complete`, `fail`. Interventions: reroute, escalate, retry, block, reopen. Step-local guidance. Friction measurement. | ✓ Shipped |
269
279
  | **Brainstorm** | Two-layer architecture: truth (role-native schemas, provenance atoms, cross-exam dispute graph) + render (5 distinct voices, lexical bans, debate transcript). Trace links prove every rendered claim maps to a truth atom. Golden run proven. | ✓ Shipped |
270
280
  | **Deep Audit** | Manifest-scaled repo audit: decompose repo into components, dispatch N auditors + M test truth auditors + K seam auditors from dependency graph, synthesize into ranked verdict and action plan. Dynamic dispatch scales with repo size (2N + K + 3 formula). Runner-native with artifact validation at every step. | ✓ Shipped |
281
+ | **Dogfood Swarm** | Multi-pass convergence: three health stages (bug/security → proactive → humanization) then feature pass. Exclusive file ownership, build gates after every wave, user checkpoints. Domain auto-detection generates manifests. Evidence bridge to dogfood-labs. | ✓ Shipped |
271
282
 
272
- ## 8 missions
283
+ ## 9 missions
273
284
 
274
285
  | Mission | Pack | Roles | When to use |
275
286
  |---------|------|-------|-------------|
@@ -281,6 +292,7 @@ Role OS operates **locally only**. It copies markdown templates and writes packe
281
292
  | `research-launch` | research | 4 | Frame question, research, document findings, decide |
282
293
  | `brainstorm` | brainstorm | 9 | Structured multi-perspective inquiry with traceable disagreement and verdict |
283
294
  | `deep-audit` | deep-audit | 5 (scales) | Manifest-backed repo audit — worker count scales with repo graph via dynamic dispatch |
295
+ | `dogfood-swarm` | swarm | 8 (scales) | Multi-pass convergence: health-a → health-b → health-c → feature → final synthesis |
284
296
 
285
297
  Each mission includes honest-partial definitions — when work stalls, the system documents what was completed and what remains instead of bluffing completion.
286
298
 
@@ -324,6 +336,28 @@ roleos run "deep audit this repo" --manifest=audit-manifest.json
324
336
 
325
337
  **Proven:** Runner-native proof run — 18 tests against real manifest, full lifecycle verified including escalation re-opening and partial failure. Scaling formula verified for 3/6/10/15-component manifests.
326
338
 
339
+ ### Dogfood swarm mission
340
+
341
+ Not a one-pass linter. The dogfood swarm mission **runs a multi-pass convergence protocol that moves a repo from "works" to "production-ready" through three health stages and iterative feature delivery.**
342
+
343
+ ```bash
344
+ roleos swarm
345
+ # → MISSION: Dogfood Swarm (Multi-Pass Convergence)
346
+ # Stages: Health-A → Health-B → Health-C → Feature → Final
347
+ # Domain agents: 3-5 parallel per wave (exclusive file ownership)
348
+ ```
349
+
350
+ **What makes it different:**
351
+
352
+ - **Three-stage health pass** — Stage A fixes bugs and security issues (loop until 0 CRITICAL + 0 HIGH). Stage B applies proactive hardening (user reviews findings). Stage C humanizes the codebase — error messages that help users, reconnection feedback, loading states, accessibility. Each stage is a distinct lens, not the same scan repeated.
353
+ - **Exclusive file ownership** — every domain agent owns specific files via `swarm-manifest.json`. No two agents edit the same file. No merge conflicts. No coordination overhead.
354
+ - **Build gates** — lint + typecheck + test must pass after every wave. The system auto-detects the build system (Node, Rust, Python, Go) and runs the right commands.
355
+ - **User checkpoints** — Health-B and the feature pass require explicit user approval before execution. The system presents findings, the user decides what to build.
356
+ - **Iterative convergence** — stages loop with wave loops until exit conditions are met or max iterations reached. Each wave re-audits from scratch to catch regressions introduced by previous fixes.
357
+ - **Domain auto-detection** — `roleos swarm manifest --generate` detects repo type (CLI, web, desktop, MCP, monorepo) and generates non-overlapping domain assignments.
358
+
359
+ **Proven:** claude-collaborate (2026-03-28) — 35→129 tests, 106 health findings fixed, v1.1.0 shipped. Protocol v2.0 with 9 phases.
360
+
327
361
  ## Status
328
362
 
329
363
  - v0.1–v0.4: Foundation — trials, adoption, treatment pack, starter pack
@@ -342,6 +376,7 @@ roleos run "deep audit this repo" --manifest=audit-manifest.json
342
376
  - **v2.0.1**: Handbook audit, beginner docs, test count corrections. 617 tests.
343
377
  - **v2.1.0**: Brainstorm mission (v0.4) — specialized roles under law, traceable disagreement, verdict-bearing output. Two-layer architecture (truth + render), cross-exam permission matrix, dispute graph, golden run proof. 7 missions, 50 roles, 8 packs. 894 tests.
344
378
  - **v2.2.0**: Deep Audit mission — manifest-scaled repo audit with dynamic dispatch. 4 new audit roles (Component Auditor, Test Truth Auditor, Seam Auditor, Audit Synthesizer). Worker count scales with repo graph (2N + K + 3 formula). Artifact validation wired at both execution boundaries. Runner-native proof run green. accept/approve truth fix in evidence layer. 8 missions, 54 roles, 9 packs. 936 tests.
379
+ - **v2.3.0**: Dogfood Swarm mission — multi-pass convergence (health-a → health-b → health-c → feature → final). 7 new swarm roles (Swarm Coordinator, 5 domain agents, Swarm Synthesizer). Two new mission primitives: waveLoops (iterative convergence) and exclusiveOwnership (domain file boundaries). Dynamic domain dispatch, build gates, `roleos swarm` CLI, domain auto-detection, evidence persistence bridge. 9 missions, 61 roles, 10 packs. 1150 tests.
345
380
 
346
381
  ## License
347
382
 
package/bin/roleos.mjs CHANGED
@@ -13,6 +13,7 @@ import { scaffoldClaude, doctor, formatDoctor } from "../src/session.mjs";
13
13
  import { artifactsCommand } from "../src/artifacts-cmd.mjs";
14
14
  import { missionCommand } from "../src/mission-cmd.mjs";
15
15
  import { auditCommand } from "../src/audit-cmd.mjs";
16
+ import { swarmCommand } from "../src/swarm-cmd.mjs";
16
17
  import { startCommand } from "../src/entry-cmd.mjs";
17
18
  import {
18
19
  runCommand, resumeCommand, nextCommand, explainCommand,
@@ -65,6 +66,13 @@ Usage:
65
66
  roleos audit manifest --generate Generate a skeleton manifest from src/
66
67
  roleos audit status Show audit run progress
67
68
  roleos audit verify Verify manifest and audit outputs
69
+ roleos swarm Start a dogfood swarm on the current repo
70
+ roleos swarm manifest Show the swarm manifest
71
+ roleos swarm manifest --generate Auto-detect domains and generate manifest
72
+ roleos swarm status Show swarm run progress
73
+ roleos swarm findings List findings by severity
74
+ roleos swarm approve Approve the current feature gate
75
+ roleos swarm verify Verify manifest and run state
68
76
  roleos mission list List all missions
69
77
  roleos mission show <key> Show full mission detail
70
78
  roleos mission suggest <text> Suggest a mission for a task
@@ -190,6 +198,9 @@ try {
190
198
  case "audit":
191
199
  await auditCommand(args);
192
200
  break;
201
+ case "swarm":
202
+ await swarmCommand(args);
203
+ break;
193
204
  case "mission":
194
205
  await missionCommand(args);
195
206
  break;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "role-os",
3
- "version": "2.2.1",
4
- "description": "Role OS — a multi-Claude operating system where 54 specialized roles execute work through contracts, conflict detection, escalation, and structured evidence. 9 team packs, 8 missions including deep audit with manifest-scaled dynamic dispatch and brainstorm with traceable disagreement.",
3
+ "version": "2.3.0",
4
+ "description": "Role OS — a multi-Claude operating system where 61 specialized roles execute work through contracts, conflict detection, escalation, and structured evidence. 10 team packs, 9 missions including dogfood swarm (multi-pass convergence), deep audit with manifest-scaled dynamic dispatch, and brainstorm with traceable disagreement.",
5
5
  "homepage": "https://mcp-tool-shop-org.github.io/role-os/",
6
6
  "bugs": {
7
7
  "url": "https://github.com/mcp-tool-shop-org/role-os/issues"
package/src/artifacts.mjs CHANGED
@@ -298,6 +298,64 @@ export const ROLE_ARTIFACT_CONTRACTS = {
298
298
  consumedBy: ["Critic Reviewer"],
299
299
  completionRule: "Reconciles findings across parcels. Cross-cutting findings reference source parcels. Contradictions adjudicated. Action plan groups by root cause and leverage.",
300
300
  },
301
+
302
+ // ── Dogfood Swarm ───────────────────────────────────────────────────────────
303
+ "Swarm Coordinator": {
304
+ artifactType: "swarm-gate",
305
+ requiredSections: ["phase", "stage", "wave-count", "findings-summary", "severity-breakdown", "exit-condition-status", "decision"],
306
+ optionalSections: ["build-gate-results", "user-approval-status"],
307
+ requiredEvidence: ["wave-report"],
308
+ consumedBy: ["Swarm Backend Agent", "Swarm Bridge Agent", "Swarm Tests Agent", "Swarm Infra Agent", "Swarm Frontend Agent", "Swarm Synthesizer"],
309
+ completionRule: "Exit condition evaluated against accumulated findings. Decision is one of: loop (re-run wave), advance (next stage), or halt (max iterations or build gate failure).",
310
+ },
311
+ "Swarm Backend Agent": {
312
+ artifactType: "wave-report",
313
+ requiredSections: ["findings", "remediations", "files-touched", "build-status"],
314
+ optionalSections: ["architecture-notes"],
315
+ requiredEvidence: [],
316
+ consumedBy: ["Swarm Coordinator"],
317
+ completionRule: "Every file in assigned scope inspected. Findings severity-triaged. Remediations applied in severity order. Build passes after changes.",
318
+ },
319
+ "Swarm Bridge Agent": {
320
+ artifactType: "wave-report",
321
+ requiredSections: ["findings", "remediations", "files-touched", "build-status"],
322
+ optionalSections: ["integration-notes"],
323
+ requiredEvidence: [],
324
+ consumedBy: ["Swarm Coordinator"],
325
+ completionRule: "Every file in assigned scope inspected. Findings severity-triaged. Remediations applied in severity order. Build passes after changes.",
326
+ },
327
+ "Swarm Tests Agent": {
328
+ artifactType: "wave-report",
329
+ requiredSections: ["findings", "remediations", "files-touched", "build-status", "coverage-delta"],
330
+ optionalSections: ["test-health-notes"],
331
+ requiredEvidence: [],
332
+ consumedBy: ["Swarm Coordinator"],
333
+ completionRule: "Test suite audited for gaps, ceremonial tests, and fixture quality. Coverage delta reported. Build passes after changes.",
334
+ },
335
+ "Swarm Infra Agent": {
336
+ artifactType: "wave-report",
337
+ requiredSections: ["findings", "remediations", "files-touched", "build-status"],
338
+ optionalSections: ["ci-notes", "doc-freshness"],
339
+ requiredEvidence: [],
340
+ consumedBy: ["Swarm Coordinator"],
341
+ completionRule: "CI workflows, config files, and docs inspected. Findings severity-triaged. Build passes after changes.",
342
+ },
343
+ "Swarm Frontend Agent": {
344
+ artifactType: "wave-report",
345
+ requiredSections: ["findings", "remediations", "files-touched", "build-status", "accessibility-issues"],
346
+ optionalSections: ["ux-improvements", "responsive-notes"],
347
+ requiredEvidence: [],
348
+ consumedBy: ["Swarm Coordinator"],
349
+ completionRule: "UI layer audited for bugs, accessibility, and UX. Accessibility issues listed separately. Build passes after changes.",
350
+ },
351
+ "Swarm Synthesizer": {
352
+ artifactType: "swarm-final-report",
353
+ requiredSections: ["executive-summary", "stage-results", "total-findings-fixed", "remaining-items", "test-verification", "recommendation"],
354
+ optionalSections: ["metrics-comparison", "evidence-links"],
355
+ requiredEvidence: ["swarm-gate", "wave-report"],
356
+ consumedBy: ["Critic Reviewer"],
357
+ completionRule: "All stages summarized. Total findings fixed vs remaining tallied. Final test suite run. Recommendation is ship, hold, or re-swarm.",
358
+ },
301
359
  };
302
360
 
303
361
  // ── Artifact validation ───────────────────────────────────────────────────────
@@ -449,6 +507,18 @@ export const PACK_HANDOFF_CONTRACTS = {
449
507
  { role: "Critic Reviewer", produces: "verdict", consumedBy: null },
450
508
  ],
451
509
  },
510
+ swarm: {
511
+ flow: [
512
+ { role: "Swarm Coordinator", produces: "swarm-gate", consumedBy: "Swarm Backend Agent" },
513
+ { role: "Swarm Backend Agent", produces: "wave-report", consumedBy: "Swarm Coordinator" },
514
+ { role: "Swarm Bridge Agent", produces: "wave-report", consumedBy: "Swarm Coordinator" },
515
+ { role: "Swarm Tests Agent", produces: "wave-report", consumedBy: "Swarm Coordinator" },
516
+ { role: "Swarm Infra Agent", produces: "wave-report", consumedBy: "Swarm Coordinator" },
517
+ { role: "Swarm Frontend Agent", produces: "wave-report", consumedBy: "Swarm Coordinator" },
518
+ { role: "Swarm Synthesizer", produces: "swarm-final-report", consumedBy: "Critic Reviewer" },
519
+ { role: "Critic Reviewer", produces: "verdict", consumedBy: null },
520
+ ],
521
+ },
452
522
  };
453
523
 
454
524
  /**
package/src/dispatch.mjs CHANGED
@@ -17,6 +17,7 @@ import { existsSync, mkdirSync, writeFileSync, readFileSync } from "node:fs";
17
17
  import { join, resolve } from "node:path";
18
18
  import { resolveBlocked, resolveRejected } from "./escalation.mjs";
19
19
  import { TOOL_PROFILES } from "./tool-profiles.mjs";
20
+ import { renderKnowledgeBlock, knowledgeManifestSummary } from "./knowledge/render-knowledge-block.mjs";
20
21
 
21
22
  // ── Default role config ─────────────────────────────────────────────────────
22
23
 
@@ -42,7 +43,9 @@ export const EXEC_STATES = [
42
43
 
43
44
  // ── System prompt builder ─────────────────────────────────────────────────────
44
45
 
45
- function buildRolePrompt(roleName, packetContent, chainContext) {
46
+ function buildRolePrompt(roleName, packetContent, chainContext, packetKnowledge) {
47
+ const knowledgeBlock = renderKnowledgeBlock(packetKnowledge);
48
+
46
49
  return `You are operating as ${roleName} in a Role-OS managed chain.
47
50
 
48
51
  ## Your Role Contract
@@ -55,7 +58,7 @@ ${packetContent}
55
58
  You are step ${chainContext.stepNumber} of ${chainContext.totalSteps} in this chain.
56
59
  ${chainContext.previousRole ? `Previous role: ${chainContext.previousRole} (${chainContext.previousStatus})` : "You are the first role in this chain."}
57
60
  ${chainContext.nextRole ? `Next role: ${chainContext.nextRole}` : "You are the last role before Critic review."}
58
-
61
+ ${knowledgeBlock ? `\n${knowledgeBlock}\n` : ""}
59
62
  ## Handoff Requirements
60
63
  When you finish, produce a structured handoff:
61
64
  1. Summary of what you did
@@ -84,7 +87,7 @@ When you finish, produce a structured handoff:
84
87
  * @param {Object} [options.overrides] - Per-role config overrides
85
88
  * @returns {DispatchManifest}
86
89
  */
87
- export function buildDispatchManifest({ packetFile, packetContent, chainRoles, cwd, overrides = {} }) {
90
+ export function buildDispatchManifest({ packetFile, packetContent, chainRoles, cwd, overrides = {}, packetKnowledge = null }) {
88
91
  const runId = `run-${Date.now()}`;
89
92
  const steps = [];
90
93
 
@@ -106,7 +109,7 @@ export function buildDispatchManifest({ packetFile, packetContent, chainRoles, c
106
109
  role: role.name,
107
110
  pack: role.pack,
108
111
  tools: TOOL_PROFILES[role.name] || ["Read", "Glob", "Grep"],
109
- systemPrompt: buildRolePrompt(role.name, packetContent, chainContext),
112
+ systemPrompt: buildRolePrompt(role.name, packetContent, chainContext, packetKnowledge),
110
113
  model: roleOverrides.model || DEFAULTS.model,
111
114
  maxTurns: roleOverrides.maxTurns || DEFAULTS.maxTurns,
112
115
  maxBudgetUsd: roleOverrides.maxBudgetUsd || DEFAULTS.maxBudgetUsd,
@@ -117,6 +120,7 @@ export function buildDispatchManifest({ packetFile, packetContent, chainRoles, c
117
120
  from: i > 0 ? chainRoles[i - 1].role.name : null,
118
121
  to: i < chainRoles.length - 1 ? chainRoles[i + 1].role.name : null,
119
122
  },
123
+ knowledge: knowledgeManifestSummary(packetKnowledge),
120
124
  });
121
125
  }
122
126