@llblab/pi-actors 0.46.1 → 0.48.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/AGENTS.md +7 -5
- package/BACKLOG.md +0 -582
- package/CHANGELOG.md +16 -0
- package/README.md +8 -1
- package/banner.jpg +0 -0
- package/dist/lib/prompts.d.ts +6 -5
- package/dist/lib/prompts.js +22 -23
- package/dist/lib/recipes-discovery.d.ts +4 -0
- package/dist/lib/recipes-discovery.js +13 -1
- package/dist/lib/recipes-references.js +10 -6
- package/dist/lib/registry.d.ts +15 -11
- package/dist/lib/registry.js +195 -25
- package/dist/lib/runtime.js +37 -2
- package/dist/lib/tools-inspect.js +156 -12
- package/dist/lib/tools-register.js +2 -1
- package/dist/lib/tools-response.js +5 -1
- package/dist/scripts/conformance.mjs +1 -0
- package/dist/skills/actors/SKILL.md +87 -65
- package/dist/skills/actors/references/diagnostics.md +44 -0
- package/dist/skills/actors/references/persistent-tools.md +74 -0
- package/dist/skills/actors/references/recipes.md +51 -0
- package/dist/skills/actors/references/runs.md +39 -0
- package/dist/skills/artifacts/SKILL.md +24 -7
- package/dist/skills/media/SKILL.md +35 -7
- package/dist/skills/project-work/SKILL.md +28 -7
- package/dist/skills/recipe-memory/SKILL.md +27 -7
- package/dist/skills/swarm/SKILL.md +56 -437
- package/dist/skills/swarm/references/development-swarm.md +118 -525
- package/dist/skills/swarm/references/review-swarms.md +115 -0
- package/docs/README.md +5 -5
- package/docs/recipe-library.md +15 -10
- package/docs/tool-registry.md +10 -4
- package/lib/prompts.ts +24 -24
- package/lib/recipes-discovery.ts +22 -1
- package/lib/recipes-references.ts +14 -6
- package/lib/registry.ts +288 -51
- package/lib/runtime.ts +41 -2
- package/lib/tools-inspect.ts +202 -10
- package/lib/tools-register.ts +4 -3
- package/lib/tools-response.ts +5 -1
- package/package.json +1 -1
- package/scripts/conformance.mjs +1 -0
- package/skills/actors/SKILL.md +87 -65
- package/skills/actors/references/diagnostics.md +44 -0
- package/skills/actors/references/persistent-tools.md +74 -0
- package/skills/actors/references/recipes.md +51 -0
- package/skills/actors/references/runs.md +39 -0
- package/skills/artifacts/SKILL.md +24 -7
- package/skills/media/SKILL.md +35 -7
- package/skills/project-work/SKILL.md +28 -7
- package/skills/recipe-memory/SKILL.md +27 -7
- package/skills/swarm/SKILL.md +56 -437
- package/skills/swarm/references/development-swarm.md +118 -525
- package/skills/swarm/references/review-swarms.md +115 -0
package/skills/swarm/SKILL.md
CHANGED
|
@@ -1,465 +1,84 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: swarm
|
|
3
|
-
description:
|
|
3
|
+
description: Use when work needs multiple actors or subagents for independent implementation, artifact generation, review, delegated audit, research, or coordinated decomposition and integration.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Swarm
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Use multi-actor execution only when at least two scopes or evidence lenses are meaningfully independent and parallelism, clean-context judgement, or quorum confidence is worth the coordination overhead. Do not swarm a task that one bounded agent can complete safely, a task whose architecture is still unsettled, or concurrent mutations of one shared contract.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Read `actors` first for generic Recipe, spawn, Run, Trace, Control, artifact, and lifecycle operation. This Skill owns only multi-actor methodology: decomposition, scope ownership, independence, synthesis, integration, and completion proof.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## Coordinator topology
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
A swarm can be coordinated without an external gateway. In this model the current host agent is the declarative control plane, the actor kernel creates explicit participant Runs, and companion transports provide ingress or presence without owning hidden agent creation. The coordinator retains user authority, global context, decomposition, shared-surface ownership, integration, and final validation; participants own bounded concrete tasks and report evidence.
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
This resembles gateway orchestration in dependency direction but not in ownership: the coordinator is itself an agent instance with inspectable Runs, not an infrastructure service that implicitly creates sessions. Preserve that distinction in prompts, docs, recovery, and target routing.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Once work is delegated, keep the coordinator available for decisions and integration instead of duplicating participant implementation. Wait for terminal follow-up by default; use meaningful attention or evidence-based timers for overdue work rather than a tight inspection loop.
|
|
19
19
|
|
|
20
|
-
##
|
|
20
|
+
## Reasoning allocation
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
- `Subagent`: Bounded delegated model call for review, audit, merge, or scoped implementation.
|
|
24
|
-
- `Scope`: File, directory, module, or logical domain that a subagent operates on.
|
|
25
|
-
- `Lock`: Read or write ownership of a scope for bounded time.
|
|
26
|
-
- `Quorum`: Multiple independent subagents reviewing the same target.
|
|
27
|
-
- `Merger`: Clean-context fifth subagent that synthesizes raw quorum outputs.
|
|
28
|
-
- `Reviewer`: Post-merge reviewer that checks report quality, not the original domain by default.
|
|
29
|
-
- `Async Run Adapter`: Local async binding that starts, tracks, lists, tails, and cancels swarm runs through a generic lifecycle runtime.
|
|
30
|
-
- `Async Run`: A local lifecycle envelope around a command-template swarm composer or utility. It owns state, logs, status, cancellation, and observability, not swarm semantics.
|
|
31
|
-
- `Lens`: A deliberately narrow cognitive role assigned to one subagent, such as security, tests, architecture, economics, or operator UX.
|
|
32
|
-
- `Task Card`: A bounded implementation assignment with goal, allowed files, avoided files, expected output, and validation gates.
|
|
33
|
-
- `Component Capability`: An abstract adapter operation such as launcher, reviewer, verifier, merger, quorum, checkpoint, follow-up, judge, or normalizer. Swarm may target these capabilities, but local adapters bind them to concrete tools, recipes, draft recipes, command templates, async runs, or services.
|
|
34
|
-
- `Draft Recipe`: A reusable but non-registered recipe captured from a successful inline actor spawn under `~/.pi/agent/recipes/drafts`. It can be replayed by an explicit `.json` / `.md` path (relative entry paths use invocation `cwd`) and later promoted into the active tool Recipe root after enough dogfood.
|
|
35
|
-
- `Coordinator Checkpoint`: A deliberate subagent pause where the subagent preserves its working context, sends a bounded question or status to the orchestrator, receives a coordinator reply, and continues in the same subagent context.
|
|
36
|
-
- `Evidence Checkpoint`: A deliberate stop where a subagent records sources, assumptions, confidence, contradictions, or blocking evidence gaps before synthesis.
|
|
37
|
-
- `Integrator`: The human or agent that merges isolated branches/worktrees into the shared target and owns conflict resolution.
|
|
22
|
+
Allocate reasoning by role instead of making one long thread implement and judge itself:
|
|
38
23
|
|
|
39
|
-
|
|
24
|
+
- Bounded implementation/authorship participants default to reasoning off when the task card fixes scope, invariants, checks, and escalation. Enable reasoning only when unresolved diagnosis or local design judgement is part of their assignment.
|
|
25
|
+
- Reviewers default to independent medium reasoning and clean context. For consequential work, several reviewers with distinct lenses or repeated independent judgement usually provide better error discovery than increasing one author's reasoning and relying on self-review.
|
|
26
|
+
- Synthesizers and integrators use medium reasoning because they reconcile evidence, conflicts, shared contracts, and retained state.
|
|
27
|
+
- The coordinator decides whether review fanout is worth its cost, preserves dissent, and never treats reviewer count as evidence quality by itself.
|
|
40
28
|
|
|
41
|
-
|
|
29
|
+
Do not change a running participant's profile merely because policy changed. Replace or add a later independent review only when fresh evidence is still needed.
|
|
42
30
|
|
|
43
|
-
|
|
31
|
+
## Choose the shape
|
|
44
32
|
|
|
45
|
-
|
|
33
|
+
| Need | Shape | Primary Recipe |
|
|
34
|
+
| --- | --- | --- |
|
|
35
|
+
| Different risk lenses on one target | Lens swarm | `swarm/lens-review` |
|
|
36
|
+
| Independent judges for one exact claim | Quorum | `swarm/quorum-review` |
|
|
37
|
+
| Evidence map plus contradiction-preserving synthesis | Research swarm | `swarm/research-synthesis` |
|
|
38
|
+
| Competing architecture directions and one smallest next slice | Architecture swarm | `swarm/architect` |
|
|
39
|
+
| Bounded implementation assignment with scope critique | Development tasking | `swarm/development-tasking` |
|
|
40
|
+
| Multi-lens ship/readiness verdict | Readiness review | `swarm/review-readiness` |
|
|
46
41
|
|
|
47
|
-
|
|
42
|
+
Use different lenses for breadth and repeated independent judges for confidence. Combine both only for high-stakes work where the added cost is justified. `swarm/subagent-*` Recipes are maintained composition components; start from a primary Recipe unless building an intentional custom composition.
|
|
48
43
|
|
|
49
|
-
|
|
44
|
+
## Coordinator protocol
|
|
50
45
|
|
|
51
|
-
|
|
52
|
-
Lens Swarm = different lenses on one object
|
|
53
|
-
Quorum = one lens, multiple independent judges
|
|
54
|
-
```
|
|
46
|
+
The coordinator owns the whole result even when participants choose local implementation details.
|
|
55
47
|
|
|
56
|
-
|
|
48
|
+
1. State the goal, non-goals, evidence standard, integration owner, and stop condition.
|
|
49
|
+
2. Partition work into disjoint read or write scopes. Give shared contracts one owner.
|
|
50
|
+
3. Give each participant a bounded task card with allowed scope, avoided scope, expected artifact, checks, and escalation rule.
|
|
51
|
+
4. Assign each participant an explicit execution profile and isolation mode under the reasoning-allocation contract.
|
|
52
|
+
5. Preflight required model/tool access before expensive fanout.
|
|
53
|
+
6. Launch independent work without cross-contaminating lenses. Do not let participants silently expand scope.
|
|
54
|
+
7. Preserve every terminal result, including failures, disagreements, and partial evidence; avoid doing participant work in the coordinator while a valid owner remains active.
|
|
55
|
+
8. Merge through one named synthesizer or integrator. Resolve conflicts from explicit intent and invariants, not textual convenience.
|
|
56
|
+
9. Run fresh integrated validation and, for consequential outputs, an independent post-merge review.
|
|
57
|
+
10. Report complete, degraded, or insufficient-data status honestly; name residual owners and next actions.
|
|
57
58
|
|
|
58
|
-
|
|
59
|
+
## Scope and coordination rules
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
- One writable scope has one owner. Parallel readers may share a stable target.
|
|
62
|
+
- Public contracts, schemas, central configuration, and integration surfaces require exclusive ownership.
|
|
63
|
+
- Concurrent writers use disjoint paths, isolated worktrees, or declared patch/artifact outputs.
|
|
64
|
+
- Shared ledgers, lockfiles, generated contracts, metadata, schemas, release surfaces, and cross-domain configuration belong to one named integrator unless a task card transfers one surface to another exclusive owner.
|
|
65
|
+
- Participants record shared-surface and other out-of-scope needs in handoff instead of editing them opportunistically.
|
|
66
|
+
- Reasoning and model profiles are task-card inputs, not implicit properties of the whole swarm.
|
|
67
|
+
- Coordinator checkpoints are bounded decision requests, not free-form actor chat.
|
|
68
|
+
- Locks support scope ownership but do not replace coordinator judgement. Every lock must be bounded and releasable.
|
|
69
|
+
- One integrator owns merge order, conflict resolution, and final validation.
|
|
70
|
+
- A zero-conflict merge is not proof of semantic compatibility.
|
|
61
71
|
|
|
62
|
-
|
|
72
|
+
## Evidence and quorum rules
|
|
63
73
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
74
|
+
- Every material finding traces to inspected evidence or explicit uncertainty.
|
|
75
|
+
- Preserve minority high-impact findings and contradictions; consensus does not erase them.
|
|
76
|
+
- Keep reviewer evidence separate from merger findings.
|
|
77
|
+
- If successful evidence is below the requested threshold, return degraded or insufficient data instead of inventing quorum.
|
|
78
|
+
- Use a clean-context merger for serious quorum work. Use a fresh post-merge reviewer when the result drives code, security, architecture, money, governance, migrations, or release decisions.
|
|
69
79
|
|
|
70
|
-
|
|
80
|
+
See [review swarms](./references/review-swarms.md) for lens, quorum, synthesis, and conflict-evidence detail. See [development swarms](./references/development-swarm.md) for task cards, write ownership, handoffs, conflict reports, and integration.
|
|
71
81
|
|
|
72
|
-
|
|
82
|
+
## Stop rules
|
|
73
83
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
Purpose: turn many possible futures into one recommended direction.
|
|
77
|
-
|
|
78
|
-
Typical lenses:
|
|
79
|
-
|
|
80
|
-
- Product/user value
|
|
81
|
-
- Operator UX
|
|
82
|
-
- Protocol or platform cleanliness
|
|
83
|
-
- Implementation pragmatism
|
|
84
|
-
- Adoption/growth
|
|
85
|
-
- Skeptic/failure modes
|
|
86
|
-
- Constraints and portability
|
|
87
|
-
|
|
88
|
-
Merger output:
|
|
89
|
-
|
|
90
|
-
- Recommended direction
|
|
91
|
-
- Alternatives considered and rejected
|
|
92
|
-
- Open questions
|
|
93
|
-
- First implementation slice
|
|
94
|
-
- Risks and validation gates
|
|
95
|
-
|
|
96
|
-
Brainstorm swarms should not vote mechanically. They should preserve creative tension and synthesize a direction that fits constraints.
|
|
97
|
-
|
|
98
|
-
### Research Swarm
|
|
99
|
-
|
|
100
|
-
Purpose: turn a broad question into evidence-backed synthesis without letting one agent's search path dominate the answer.
|
|
101
|
-
|
|
102
|
-
Typical lenses:
|
|
103
|
-
|
|
104
|
-
- Question/scope formulation
|
|
105
|
-
- Source discovery
|
|
106
|
-
- Source verification
|
|
107
|
-
- Synthesis and contradiction mapping
|
|
108
|
-
- Devil's advocate / counter-evidence
|
|
109
|
-
- Ethics, policy, or stakeholder impact when relevant
|
|
110
|
-
|
|
111
|
-
Research swarm rules:
|
|
112
|
-
|
|
113
|
-
1. Scope first: the coordinator defines the question, non-goals, source classes, and stop condition before launching evidence work.
|
|
114
|
-
2. Search and verification are separate lenses when stakes are high; the searcher finds candidates, the verifier checks quality and support.
|
|
115
|
-
3. Every material claim in synthesis must trace to a source note, inspected artifact, or explicit uncertainty statement.
|
|
116
|
-
4. Contradictory evidence is preserved as a first-class output, not hidden by consensus language.
|
|
117
|
-
5. Evidence checkpoints block synthesis when sources are insufficient, unverifiable, conflicted, or ethically unsafe to use.
|
|
118
|
-
|
|
119
|
-
Merger output:
|
|
120
|
-
|
|
121
|
-
- Bounded research question
|
|
122
|
-
- Evidence map with confidence and source quality
|
|
123
|
-
- Areas of convergence and contradiction
|
|
124
|
-
- Limitations and not-checkable claims
|
|
125
|
-
- Recommended decision or next evidence slice
|
|
126
|
-
|
|
127
|
-
Research swarms are for inquiry and synthesis, not automatic publication pipelines. Keep report formatting local to the caller's domain.
|
|
128
|
-
|
|
129
|
-
### Development Swarm
|
|
130
|
-
|
|
131
|
-
Purpose: turn one accepted direction into coordinated slices.
|
|
132
|
-
|
|
133
|
-
Recommended flow:
|
|
134
|
-
|
|
135
|
-
```text
|
|
136
|
-
Planner → Lens Swarm → Merger → Scoped Implementers → Integrator → Review Swarm
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
Use scoped write locks or a repository-local soft-lock manifest when multiple implementers may edit files. Keep implementation agents bounded by module, artifact, or responsibility: code, tests, docs, examples, migration, or release notes. Prefer one owner per writable scope and run verification with fresh reviewers after implementation.
|
|
140
|
-
|
|
141
|
-
### Consensus-First Build Swarm
|
|
142
|
-
|
|
143
|
-
Purpose: create one coherent artifact from several expert lenses without making every participant write the artifact.
|
|
144
|
-
|
|
145
|
-
Recommended flow:
|
|
146
|
-
|
|
147
|
-
```text
|
|
148
|
-
Lens proposers → shared room consensus → named implementer → QA reviewer → finalizer
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
Use this shape for creative/product artifacts, demos, single-file deliverables, docs, specs, prompts, and other work where parallel implementation would fragment the result. Lens proposers should post concrete constraints, proposals, and handoff notes to the shared room but should not mutate files. One named implementer inspects the room transcript and owns the first artifact write. A fresh QA reviewer inspects the artifact plus room evidence and reports issues back to the room. The implementer/finalizer then applies only the review-grounded fixes and emits the final artifact message.
|
|
152
|
-
|
|
153
|
-
Failure mode: if the runner only asks all lenses to chat and then writes a report, it can "succeed" without producing the requested artifact. Guard against this with explicit artifact assertions, role-specific write permissions, and a finalizer that checks artifact existence/size/content before `run.done`.
|
|
154
|
-
|
|
155
|
-
### Small-Team Development Swarm
|
|
156
|
-
|
|
157
|
-
For 2–4 implementation agents, prefer the dedicated MAWP reference instead of expanding the general Swarm skill. The portable idea is simple: isolate writable work surfaces, give each agent a bounded task card, preserve handoff evidence, and merge through one integrator.
|
|
158
|
-
|
|
159
|
-
Use [`references/development-swarm.md`](./references/development-swarm.md) for concrete worktree/branch flow, task-card templates, soft-lock manifests, conflict reports, coordinator checkpoints, and merge rules.
|
|
160
|
-
|
|
161
|
-
### Review Swarm
|
|
162
|
-
|
|
163
|
-
Purpose: turn one result into many risk lenses and a decision-grade verdict.
|
|
164
|
-
|
|
165
|
-
Use lens swarm for broad coverage, quorum for confidence on one critical judgement, or both for high-stakes releases. In adapters that expose current session model/thinking policy, default ordinary same-policy review swarms to that current policy and require explicit args only when intentionally varying models or thinking levels. Run a cheap model/tool preflight before launching expensive reviewer fanout; if it fails, use the `ACTOR_PREFLIGHT_FAILED` stage/model/error-class/prompt-file diagnostic to choose explicit override args instead of rerunning blindly. For Skill-owned review swarms, tune `min_successful_reviewers`, `reviewer_concurrency`, `subagent_ttl_ms`, and `merge_policy` instead of manual reruns; preserve partial reports and label the outcome `complete`, `degraded`, or `insufficient_data`. The final report should separate consensus findings, minority findings, merger findings, risks, and recommended next actions.
|
|
166
|
-
|
|
167
|
-
A review swarm synthesis must not fabricate claims. Every final finding should trace to a reviewer note, checked artifact, command output, source, or explicit merger rationale. Devil's Advocate critical findings must be preserved or explicitly disproved with evidence.
|
|
168
|
-
|
|
169
|
-
## Lens Catalog
|
|
170
|
-
|
|
171
|
-
Choose lenses by risk. Do not run every lens by default; select the smallest set that covers the failure modes of the work.
|
|
172
|
-
|
|
173
|
-
### General Software Lenses
|
|
174
|
-
|
|
175
|
-
- `Architecture`: module boundaries, dependency direction, cohesion, coupling, extensibility, and long-term ownership.
|
|
176
|
-
- `Correctness`: functional behavior, edge cases, invariants, state transitions, and input/output contracts.
|
|
177
|
-
- `Bug Hunter`: likely defects, race conditions, null/empty cases, off-by-one errors, and broken assumptions.
|
|
178
|
-
- `Security`: injection, privilege boundaries, path handling, secrets, deserialization, unsafe shell/process use, and abuse cases.
|
|
179
|
-
- `Tests`: coverage quality, missing regressions, fixture realism, flaky risk, and validation gates.
|
|
180
|
-
- `Performance`: algorithmic cost, latency, memory, IO, batching, backpressure, and hot paths.
|
|
181
|
-
- `Concurrency`: locks, cancellation, timeouts, idempotency, retries, ordering, and stale state.
|
|
182
|
-
- `Data Integrity`: migrations, schema compatibility, durability, rollback, deduplication, and corruption risk.
|
|
183
|
-
- `API Compatibility`: public contract drift, backwards compatibility, versioning, deprecation, and client impact.
|
|
184
|
-
- `Operator UX`: observability, error messages, status, logs, recovery paths, safe defaults, and support burden.
|
|
185
|
-
- `Developer UX`: onboarding, local setup, naming, examples, docs, type ergonomics, and debugging clarity.
|
|
186
|
-
- `Product UX`: user journey, surprising behavior, accessibility, copy, affordances, and feedback loops.
|
|
187
|
-
- `Release`: changelog truth, version bump, package contents, CI gates, publish risk, and rollback readiness.
|
|
188
|
-
- `Documentation`: README accuracy, examples, conceptual consistency, and stale references.
|
|
189
|
-
- `Compliance/Policy`: licenses, privacy, retention, consent, audit trails, and organizational constraints.
|
|
190
|
-
- `Incident Response`: blast radius, detection, containment, rollback, forensics, and runbook quality.
|
|
191
|
-
- `SRE/Reliability`: availability, graceful degradation, monitoring, quotas, rate limits, and dependency failure.
|
|
192
|
-
- `Maintainability`: simplicity, naming, duplication, dead code, testability, and future change cost.
|
|
193
|
-
- `Spec Consistency`: whether code, docs, tests, prompts, and changelog describe the same behavior.
|
|
194
|
-
|
|
195
|
-
### Complex System / Blockchain Lenses
|
|
196
|
-
|
|
197
|
-
Use these for blockchain, distributed systems, financial protocols, governance, or adversarial environments.
|
|
198
|
-
|
|
199
|
-
- `Protocol Invariants`: conservation laws, supply rules, ledger consistency, finality assumptions, and impossible states.
|
|
200
|
-
- `Consensus Safety`: fork choice, quorum thresholds, validator behavior, equivocation, reorg handling, and liveness tradeoffs.
|
|
201
|
-
- `Economic Security`: incentives, MEV, griefing, sybil cost, fee dynamics, slashing, reward leakage, and manipulation paths.
|
|
202
|
-
- `Smart Contract Safety`: reentrancy, authorization, upgradeability, storage layout, oracle trust, token standards, and invariant tests.
|
|
203
|
-
- `Cryptography`: key management, signature/domain separation, nonce use, randomness, hash commitments, and proof assumptions.
|
|
204
|
-
- `Cross-Chain/Bridge`: message replay, finality mismatch, validator set drift, withdrawal delays, and custody assumptions.
|
|
205
|
-
- `Governance`: proposal lifecycle, quorum rules, timelocks, emergency powers, capture risk, and voter/operator UX.
|
|
206
|
-
- `Treasury/Accounting`: balance reconciliation, fee distribution, rounding, precision, reserves, and auditability.
|
|
207
|
-
- `Adversarial Simulation`: attacker goals, cheapest exploit path, denial-of-service vectors, sandwiching, and liquidation games.
|
|
208
|
-
- `Network/P2P`: peer discovery, gossip propagation, eclipse risk, bandwidth limits, spam resistance, and partition behavior.
|
|
209
|
-
- `Node Operations`: sync, snapshots, pruning, backups, observability, upgrades, config safety, and rollback.
|
|
210
|
-
- `Formal Methods`: invariant specification, model checking candidates, property tests, and proof gaps.
|
|
211
|
-
- `Regulatory Surface`: custody, KYC/AML implications, sanctions, securities risk, data retention, and jurisdictional assumptions.
|
|
212
|
-
|
|
213
|
-
## Tool Contracts
|
|
214
|
-
|
|
215
|
-
These are abstract tool contracts. Register them in whatever local tool layer exists. Concrete syntax is an adapter detail outside this skill.
|
|
216
|
-
|
|
217
|
-
- `swarm_review`: single subagent review.
|
|
218
|
-
- `swarm_quorum`: multi-model independent review.
|
|
219
|
-
- `swarm_claim`: acquire a scoped read/write lock.
|
|
220
|
-
- `swarm_release`: release a scoped lock.
|
|
221
|
-
- `swarm_merge`: synthesize raw quorum outputs.
|
|
222
|
-
- `swarm_post_merge_review`: review the merged report quality.
|
|
223
|
-
|
|
224
|
-
## File Handoff
|
|
225
|
-
|
|
226
|
-
Prefer path handoff over attachment syntax. Put the target path directly in the subagent prompt:
|
|
227
|
-
|
|
228
|
-
```text
|
|
229
|
-
Review this local file: /path/to/file.md. First read it from disk.
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
Attachment syntax is optional local optimization, not a swarm contract. Path handoff keeps the skill portable across wrappers without attachment arguments.
|
|
233
|
-
|
|
234
|
-
## `swarm_review`
|
|
235
|
-
|
|
236
|
-
Single subagent review.
|
|
237
|
-
|
|
238
|
-
`Inputs`:
|
|
239
|
-
|
|
240
|
-
- `scope`: file path, directory, module, or logical domain.
|
|
241
|
-
- `model`: model identifier in the local environment.
|
|
242
|
-
- `prompt`: optional review lens or task-specific instructions.
|
|
243
|
-
- `thinking`: optional reasoning depth.
|
|
244
|
-
- `tools`: optional local tool allowlist.
|
|
245
|
-
- `timeout`: timeout in seconds.
|
|
246
|
-
|
|
247
|
-
`Behavior`:
|
|
248
|
-
|
|
249
|
-
1. Optionally claim a read lock for the scope.
|
|
250
|
-
2. Spawn one subagent with a prompt that includes the scope path.
|
|
251
|
-
3. Require the subagent to read the target from disk before judging it.
|
|
252
|
-
4. Return the subagent's raw output.
|
|
253
|
-
5. Release the lock if one was claimed.
|
|
254
|
-
|
|
255
|
-
`Reference prompt`:
|
|
256
|
-
|
|
257
|
-
```text
|
|
258
|
-
Review this local scope: <scope>.
|
|
259
|
-
First read it from disk.
|
|
260
|
-
Use the local review protocol if available.
|
|
261
|
-
Report white spots, contradictions, evidence, and risks.
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
## Run Adapter
|
|
265
|
-
|
|
266
|
-
Detached execution is an adapter concern, not a portable Swarm-script requirement. When the host offers Runs, launch the composed Recipe, return its id, and rely on terminal follow-up rather than blocking or polling.
|
|
267
|
-
|
|
268
|
-
`Progress contract`: expose bounded structured Trace, logs, artifacts, status, timestamps, and final result evidence. Treat Trace as a retained suffix and attention as a wake hint; write durable task cards, checkpoints, and large evidence to artifacts before signaling attention. Read completeness and Control capacity through existing Run inspection rather than scraping output. Artifact size/lifecycle remains separate from Trace/Control quotas.
|
|
269
|
-
|
|
270
|
-
`Resumable checkpoint goal`: a controlled agent-backed Run may preserve context and accept a declared Control. Control saturation rejects before admission and admitted work does not expire; lifecycle recovery remains host-owned. When the host cannot preserve context, write a handoff artifact and launch a clean-context Run while marking the context loss explicitly.
|
|
271
|
-
|
|
272
|
-
`Cancellation boundary`: terminate only an owned active generation whose process identity the runtime can prove. Stale pid reuse must fail closed.
|
|
273
|
-
|
|
274
|
-
## Stable Multi-Agent Review Rules
|
|
275
|
-
|
|
276
|
-
- Prefer independent read-only reviewers so they do not converge before synthesis.
|
|
277
|
-
- Treat Trace, artifacts, and immutable reviewer results as methodology evidence.
|
|
278
|
-
- Smoke-test provider/model availability before expensive fanout.
|
|
279
|
-
- Keep methodology and runtime split: Swarm chooses decomposition, quorum, lenses, lock discipline, and merge shape; the Run kernel supplies execution, Trace, Control, artifacts, and lifecycle safety.
|
|
280
|
-
|
|
281
|
-
## Persistent Implementer Pattern
|
|
282
|
-
|
|
283
|
-
Use long-lived controlled services only when repeated assignments justify them. Keep task selection with the orchestrator and use explicit artifacts or task cards for claims/results. Resource exclusion may use the optional `resource-locker`; it does not become swarm authority. Prefer multiple scoped Runs over a peer protocol.
|
|
284
|
-
|
|
285
|
-
## `swarm_quorum`
|
|
286
|
-
|
|
287
|
-
Multi-model review by independent subagents.
|
|
288
|
-
|
|
289
|
-
`Inputs`:
|
|
290
|
-
|
|
291
|
-
- `scope`: target path or domain.
|
|
292
|
-
- `models`: 2-6 model identifiers.
|
|
293
|
-
- `prompt`: shared review lens.
|
|
294
|
-
- `thinking`: per-model or shared reasoning depth.
|
|
295
|
-
- `timeout`: per-subagent or whole-quorum timeout.
|
|
296
|
-
- `merge_mode`: merge behavior, default `consensus-first`.
|
|
297
|
-
- `merger_model`: explicit model for the clean merger.
|
|
298
|
-
|
|
299
|
-
`Behavior`:
|
|
300
|
-
|
|
301
|
-
1. Claim a shared read lock when the target is local and stable.
|
|
302
|
-
2. Spawn one subagent per model concurrently unless a local rate limit requires throttling.
|
|
303
|
-
3. Give every subagent the same target path and review lens.
|
|
304
|
-
4. Preserve every raw output.
|
|
305
|
-
5. Release the lock.
|
|
306
|
-
6. Run a clean-context merger subagent.
|
|
307
|
-
7. Store or return the merged report.
|
|
308
|
-
8. Optionally run post-merge review.
|
|
309
|
-
|
|
310
|
-
`Reference binding`: Implement this contract through a local adapter such as a command-template composer, registered tool, or async run. The portable Swarm skill intentionally does not ship a runtime-specific quorum runner.
|
|
311
|
-
|
|
312
|
-
`Serious quorum rule`: For high-stakes review, the merger is not the current orchestrator. The merger is a fifth clean-context subagent.
|
|
313
|
-
|
|
314
|
-
## Lock Protocol
|
|
315
|
-
|
|
316
|
-
Locks prevent subagents from interfering with shared scopes. Locks are optional for read-only review, but required for concurrent mutation.
|
|
317
|
-
|
|
318
|
-
### Lock Fields
|
|
319
|
-
|
|
320
|
-
- `scope`: Scope identifier, usually a path or domain label.
|
|
321
|
-
- `owner`: Subagent or quorum run that owns the lock.
|
|
322
|
-
- `type`: `read` or `write`.
|
|
323
|
-
- `acquired`: Acquisition time.
|
|
324
|
-
- `ttl`: Time-to-live in seconds.
|
|
325
|
-
- `expires`: Expiry time derived from acquisition plus TTL.
|
|
326
|
-
|
|
327
|
-
### Conflict Rules
|
|
328
|
-
|
|
329
|
-
- `read` request with no lock: allow.
|
|
330
|
-
- `read` request with existing `read`: allow.
|
|
331
|
-
- `read` request with existing `write`: conflict unless stale.
|
|
332
|
-
- `write` request with no lock: allow.
|
|
333
|
-
- `write` request with existing `read` or `write`: conflict unless stale.
|
|
334
|
-
|
|
335
|
-
### Lifecycle
|
|
336
|
-
|
|
337
|
-
1. `acquire`: prune stale locks, then check conflicts.
|
|
338
|
-
2. `hold`: run the bounded subagent task.
|
|
339
|
-
3. `release`: remove the entry.
|
|
340
|
-
4. `expire`: any later lock operation may prune stale entries.
|
|
341
|
-
|
|
342
|
-
`TTL rule`: Every lock must have a TTL. A lock without expiry is invalid.
|
|
343
|
-
|
|
344
|
-
`Adapter implementation`: Use a local actor/runtime adapter when automation, TTL enforcement, or machine-readable lock state is needed. The portable Swarm skill defines lock semantics but does not ship a lock runtime.
|
|
345
|
-
|
|
346
|
-
## Validation
|
|
347
|
-
|
|
348
|
-
After changing Swarm adapter contracts or Skill documentation, validate the local distribution with whatever checks the host project provides. At minimum, review the text for boundary drift:
|
|
349
|
-
|
|
350
|
-
- no dependency on a specific extension, actor runtime, registry, recipe store, or CLI runner;
|
|
351
|
-
- no bundled broad coordinator or lock runtime as portable Swarm core;
|
|
352
|
-
- no hard-coded model names, private paths, or transport-specific message syntax in the methodology contract;
|
|
353
|
-
- adapter examples remain examples, not requirements.
|
|
354
|
-
|
|
355
|
-
If a host package ships a Swarm self-test, treat it as a local packaging gate rather than part of the portable methodology.
|
|
356
|
-
|
|
357
|
-
## Merge Protocol
|
|
358
|
-
|
|
359
|
-
The merger is not a passive formatter. The merger is the final synthesis agent and can materially affect the output by choosing labels, grouping findings, deciding severity, preserving minority signals, and adding grounded judgement.
|
|
360
|
-
|
|
361
|
-
`Merger influence`: High.
|
|
362
|
-
|
|
363
|
-
`Merger role`: Read all raw outputs, deduplicate, rank, preserve dissent, and produce one decision-grade artifact. The merger may add its own finding only as `merger finding` and only when grounded in evidence.
|
|
364
|
-
|
|
365
|
-
`Merger isolation`: For serious quorum work, the merger should be a dedicated clean-context subagent with explicit model, thinking level, and minimal access. The orchestrator provides the input bundle and writes the final artifact after the merger returns.
|
|
366
|
-
|
|
367
|
-
`Orchestrator merge exception`: The orchestrator may merge quick, low-stakes, or exploratory quorum runs. The report must say the merge was not isolated.
|
|
368
|
-
|
|
369
|
-
### Merge Parameters
|
|
370
|
-
|
|
371
|
-
- `merger_model`: Explicit synthesis model. Required for quorum reports.
|
|
372
|
-
- `merger_context`: Clean or inherited context. Default `clean` for serious quorum.
|
|
373
|
-
- `merger_tools`: Tool access granted to merger. Prefer none if raw text is embedded; otherwise read-only access to raw outputs.
|
|
374
|
-
- `merger_thinking`: Reasoning depth. Use `medium` normally, `high` for architecture, security, money, governance, migrations, or specs.
|
|
375
|
-
- `merge_mode`: Synthesis style. Default `consensus-first`.
|
|
376
|
-
- `consensus_threshold`: Votes needed to promote. Use `3/4` for critical promotion and `2/4` for major discussion by default.
|
|
377
|
-
- `minority_policy`: Treatment of unique findings. Preserve high-impact, evidence-backed minority findings.
|
|
378
|
-
- `attribution`: Which model found what. Required for quorum reports.
|
|
379
|
-
- `raw_retention`: Keep raw outputs until the final report is accepted.
|
|
380
|
-
|
|
381
|
-
### Merge Modes
|
|
382
|
-
|
|
383
|
-
- `faithful`: Minimal editing; preserves subagent wording and uncertainty.
|
|
384
|
-
- `consensus-first`: Groups by agreement and preserves dissent separately.
|
|
385
|
-
- `risk-first`: Promotes high-impact minority findings even without consensus.
|
|
386
|
-
- `design-synthesis`: Converts findings into decisions and repair order.
|
|
387
|
-
|
|
388
|
-
### Merge Guardrails
|
|
389
|
-
|
|
390
|
-
- Preserve raw outputs until the final report is accepted.
|
|
391
|
-
- Do not hide model disagreement.
|
|
392
|
-
- Do not drop high-impact minority findings only for lack of consensus.
|
|
393
|
-
- Do not over-promote repeated low-value nitpicks.
|
|
394
|
-
- Keep model attribution for every major finding.
|
|
395
|
-
- Keep merger identity explicit: model, context, thinking, and tools.
|
|
396
|
-
- Separate `consensus finding`, `minority finding`, and `merger finding`.
|
|
397
|
-
- Separate current-quorum votes from prior-run corroboration.
|
|
398
|
-
|
|
399
|
-
## Post-Merge Review
|
|
400
|
-
|
|
401
|
-
Run a reviewer on the merged report when the output will drive code, architecture, security, money, governance, migrations, or specifications.
|
|
402
|
-
|
|
403
|
-
`Purpose`: Review the review. The reviewer checks whether the merger preserved evidence, ranked severity honestly, avoided hallucinated synthesis, kept minority high-impact findings, and produced an actionable artifact.
|
|
404
|
-
|
|
405
|
-
`Reviewer input`:
|
|
406
|
-
|
|
407
|
-
- Target scope
|
|
408
|
-
- Raw subagent outputs
|
|
409
|
-
- Merged report
|
|
410
|
-
- Merge parameters
|
|
411
|
-
- Intended use of the report
|
|
412
|
-
|
|
413
|
-
`Reviewer output`: Meta-findings about report quality, not a second domain review unless explicitly requested.
|
|
414
|
-
|
|
415
|
-
### Post-Merge Review Lens
|
|
416
|
-
|
|
417
|
-
- `Evidence`: Does each major finding trace to raw outputs or clearly marked merger evidence?
|
|
418
|
-
- `Severity`: Are labels justified by failure impact?
|
|
419
|
-
- `Consensus`: Was agreement counted honestly?
|
|
420
|
-
- `Purity`: Is current quorum separate from prior context?
|
|
421
|
-
- `Minority`: Were unique high-impact findings preserved?
|
|
422
|
-
- `Bias`: Did the merger impose an unsupported narrative?
|
|
423
|
-
- `Actionability`: Are repair order, scope, and gates named?
|
|
424
|
-
- `Consistency`: Do maps, headers, and attribution agree?
|
|
425
|
-
- `Compression`: Were caveats or disagreements lost?
|
|
426
|
-
|
|
427
|
-
### Post-Merge Decisions
|
|
428
|
-
|
|
429
|
-
- `Accept`: Report is decision-grade.
|
|
430
|
-
- `Accept with notes`: Report is useful, with caveats.
|
|
431
|
-
- `Revise merge`: Rerun merger with adjusted parameters.
|
|
432
|
-
- `Rerun quorum`: Raw outputs are too weak, divergent, or under-scoped.
|
|
433
|
-
- `Escalate`: Run cross-merge with another clean merger.
|
|
434
|
-
|
|
435
|
-
## Error Handling
|
|
436
|
-
|
|
437
|
-
- `LOCK_CONFLICT`: Retry, back off, or choose another scope.
|
|
438
|
-
- `SUBAGENT_TIMEOUT`: Keep partial results and release locks by TTL.
|
|
439
|
-
- `COORDINATOR_INPUT_REQUIRED`: Pause only if the adapter can preserve subagent context; otherwise write a checkpoint artifact and stop degraded for coordinator replanning.
|
|
440
|
-
- `MODEL_FAILURE`: Continue with fewer votes and mark degraded quorum.
|
|
441
|
-
- `MERGE_FAILURE`: Return `INSUFFICIENT_DATA` or rerun merger.
|
|
442
|
-
- `REVIEW_FAILURE`: Keep merged report and mark post-review missing.
|
|
443
|
-
|
|
444
|
-
## Composition Contract
|
|
445
|
-
|
|
446
|
-
This skill composes with capabilities, not concrete sibling skills:
|
|
447
|
-
|
|
448
|
-
- Local tool registry for reusable command-template adapters
|
|
449
|
-
- Local review and implementation protocols
|
|
450
|
-
- Scoped lock standard with TTL
|
|
451
|
-
- Subagent runner with file-read access
|
|
452
|
-
- Artifact writer owned by the orchestrator
|
|
453
|
-
|
|
454
|
-
Do not make swarm depend on a specific sibling skill, repository, model alias, or tool registry. The orchestrator may tell subagents to use the local review protocol when one exists.
|
|
455
|
-
|
|
456
|
-
## Portability Lens
|
|
457
|
-
|
|
458
|
-
- `Lock protocol`: Mandatory kernel.
|
|
459
|
-
- `Quorum review`: Optional capability.
|
|
460
|
-
- `Clean merger`: Mandatory for serious quorum.
|
|
461
|
-
- `Post-merge review`: Required for high-stakes outputs.
|
|
462
|
-
- `Command templates`: Local adapter.
|
|
463
|
-
- `Test scripts`: Protocol validation aid.
|
|
464
|
-
|
|
465
|
-
Operational tools, recipes, transport bindings, and runtime-specific adapters belong to the host project documentation, not this methodology skill.
|
|
84
|
+
Stop or replan when scopes overlap, a participant needs an undeclared shared contract, evidence cannot meet the threshold, provider/tool preflight fails, conflict changes the architecture, no integrator owns the result, or integrated validation is unavailable. Do not compensate with extra agents, repeated blind retries, shared mutable work, or coordinator-written consensus unsupported by participant evidence.
|