Swarm Invocation Designer
This is a static contract architect, not a launcher. A planning graph proposes
work; only an external controller can admit attempts, consume reservations,
issue fenced leases, and open effect channels.
Decision procedure
- Scope: return
OUT_OF_SCOPE_LIVE_OPERATION for requests to launch,
supervise, kill, or settle live agents.
- Seal intent: bind objective, completion predicate, excluded effects, plan
digest/revision, and immutable limit digest.
- Separate topologies: record planning and runtime topologies. A projection
is
EXACT, NARROWED, OMITTED, or BLOCKED; non-exact support needs an
attributable acceptance reference.
- Close the graph: require unique nodes, acyclic dependencies, sealed gather
membership, declared reducers, reachable work, and bounded review. Rework is
a new attempt, not a graph cycle.
- Separate owners: identify admission, capacity, lifecycle, effect,
evidence, and review owners. Workers may propose changes but cannot create
children, enlarge limits, issue leases, or settle reservations.
- Reserve first: bind every attempt, renewal, elastic slot, rework, and
resource-consuming gather to plan, revision, node, attempt, body generation,
route, resource vector, expiry, and idempotency key.
- Consume and fence: the controller consumes one reservation commit before
one monotonically generated, externally fenced lease.
- Persist intent: durable dispatch intent precedes transmission. Unknown
transmission becomes
AMBIGUOUS; retain capacity and reconcile before an
authorized retry. A new key must never disguise the same uncertain effect.
- Gather exactly: membership is sealed. Semantic partial closure never
implies cancellation or capacity settlement for absent members.
- Reduce and review: reducers consume ordered artifact hashes and are
version/digest bound. A producer cannot decide its terminal review. One
REWORK creates a fresh attempt; a second escalates or halts.
- Cancel as protocol: request, acknowledgement deadline, fence,
termination witness, provider reconciliation, and reservation disposition
are separate facts.
- Settle then replay: every attempt has an explicit disposition. Only
witnessed settlement or release permits capacity reuse;
HELD_AMBIGUOUS
continues to consume its reservation. Replay reconstructs projections with
effects denied.
flowchart TD
I[Sealed intent] --> P[Planning topology proposal]
P --> R[Runtime support projection]
R --> E[Closed execution plan]
E --> C[Capacity reservation commit]
C --> X[Controller exact-once consume]
X --> D[Durable dispatch intent]
D --> L[Fenced body lease]
L --> W[Bounded worker]
W --> G[Sealed gather]
G --> V[Versioned deterministic reducer]
V --> J{Independent review}
J -->|Approve| T[Terminal disposition]
J -->|One rework| C
J -->|Escalate or halt| T
T --> S[Settle release or hold reservation]
W --> Q[Append-only events]
Q --> Y[Effect-denied replay]
P -. no admission authority .-> C
W -. cannot spawn reserve or lease .-> C
Invariants
maxRecursiveBirths is zero; topology expansion requires a new reviewed plan.
- Reservation commit precedes lease; lease and durable intent precede dispatch.
- A stale generation cannot produce accepted state or effects.
- Aggregate resource vectors stay under the plan ceiling; native resources are
not silently converted into one scalar budget.
- Gather membership is immutable and dissent remains visible.
- Cancellation messages do not prove termination, provider state, or release.
- Replay never invokes a provider, tool, hook, or effect broker.
STATIC_VALID means the implemented shape and relationship checks passed.
It does not prove the completion predicate, capacity enforcement, deterministic
execution, receipt authenticity, or runtime readiness.
Lost-ack procedure
Persist an immutable operation key and intent before transmission. Give each observation
its own event identity; several observations can concern the same operation. CloudEvents
source plus id identifies an event, not a command's execution count
(v1.0.2).
If an acknowledgement is absent, retain the reservation and mark the attempt
AMBIGUOUS. Query the authoritative destination for that exact operation. A terminal
receipt determines what happened; it permits settlement only after the controller checks
outcome, provider accounting, and reservation disposition. A current “not found” answer
alone does not prevent the original request committing later.
An authorized retry requires either authoritative noncommit plus a fence that prevents
late commit, or validated destination deduplication for the same operation key.
Both routes require current authority and remaining budget. A deduplicated retransmission
retains the operation key while recording its separate attempt/generation and cost.
Unknown outcomes without either route remain held. Compensation is a separate authorized
effect, not evidence that the original effect is absent. Every relevant sink must enforce
a generation fence; a stored generation number alone does nothing.
flowchart TD
U[Missing acknowledgement: hold reservation] --> Q[Query exact operation at destination]
Q --> T{Terminal outcome witnessed?}
T -->|yes| S[Check outcome and accounting before settlement]
T -->|no| N{Noncommit plus late-commit fence?}
N -->|yes| A[Check retry authority and remaining budget]
N -->|no| D{Validated same-operation deduplication?}
D -->|yes| A
D -->|no| H[Keep held and escalate]
A -->|permitted| R[Record bounded new attempt]
A -->|missing| H
Static worked case
review-17 reserves one slot and records operation key k17. The controller loses the
acknowledgement after sending; its latest observation says AMBIGUOUS. A second “not
found” observation remains insufficient while the original send could arrive. A terminal
absence receipt bound to k17 plus a target-enforced fence closes that possibility.
Only then, with authority and budget, can the controller create a new attempt. If the
destination instead supplies proven same-key deduplication, that route may permit a
retransmission without creating a new logical operation. Neither path has run here.
Validation contract
The JSON contract records design declarations. The validator checks its supported
schema, bounded counts, graph dependencies, gather membership/reducer links, policy
fields, and selected status contradictions. It cannot evaluate natural-language
completion predicates, grant authority, enforce resources, prove a reducer deterministic,
or verify remote deduplication. Keep those as explicit review and runtime obligations.
The trace schema is a structural envelope; passing it does not validate an execution.
Gather policies require different design parameters: ALL uses the sealed member set;
QUORUM states its threshold; DEADLINE_PARTIAL states its deadline relative to the
invocation. Missing members retain lifecycle/accounting obligations after partial closure.
One rework round is this bundle's chosen profile, not a result about optimal team design.
Anti-patterns
Prompt-shaped fanout
Bad: prose directly creates workers. Detection: no admitted plan,
reservation commit, or controller lease exists.
Planning diagram as authority
Bad: a manager node may dispatch because it appears in a graph. Detection:
planning topology names an admission, capacity, lifecycle, or effect owner.
Cancellation by message
Bad: cancel sent releases capacity. Detection: no fence, termination
witness, provider reconciliation, or terminal reservation disposition.
Replay by re-execution
Bad: replay calls external effects. Detection: effectsDenied is false or
absent.
Outputs
Return only STATIC_VALID, STATIC_INVALID, INCOMPLETE_STATIC,
OUT_OF_SCOPE, or OUT_OF_SCOPE_LIVE_OPERATION.
node skills/swarm-invocation-designer/scripts/validate-swarm-invocation.mjs <contract.json>
node skills/swarm-invocation-designer/scripts/test-bundle.mjs
Load on demand
| File |
Load when |
references/authority-admission-lifecycle.md |
Designing owner, reservation, lease, cancellation, or settlement seams. |
references/gathers-reducers-and-replay.md |
Designing gather, reducer, review, or replay semantics. |
schemas/swarm-invocation.schema.json |
Producing the static contract. |
schemas/swarm-invocation-trace.schema.json |
Designing a future runtime trace without claiming one exists. |
examples/valid-static-contract.json |
Starting a bounded static design. |
tests/activation.md |
Testing routing boundaries. |
scripts/validate-swarm-invocation.mjs |
Validating one contract. |
scripts/test-bundle.mjs |
Running adversarial mutations. |
agents/openai.yaml |
Delegating static contract design. |
Imported bundle navigation
These references extend the static contract design.
- examples/expected-output.md — Constructed review fixture with unknown outcomes and evidence obligations.
- references/fast-agent-bus.md — Separate replaceable observations from durable commands.
- references/invocation-patterns.md — Map four team patterns onto this contract.
- references/exactly-once-decomposition.md — Transport and effect boundaries.
1---2name: swarm-invocation-designer3description: >-4 Designs and audits controller-owned multi-agent invocation contracts:5 capacity reservation, single-use leases, generation fences, idempotent6 dispatch, typed gathers, deterministic reduction, bounded rework,7 cancellation, settlement, and effect-denied replay. Use when projecting an8 approved execution plan onto bounded concurrent work. NOT for task9 decomposition, choosing a planning topology, context partitioning, IPC or10 framework selection, dialogue design, live agent operation, or granting11 runtime authority.12license: Apache-2.013allowed-tools: Read,Write,Edit,Grep,Glob,Bash(node:*)14metadata:15 source: https://skillmd.com/skills/curiositech/swarm-invocation-designer16 version: 2.0.017 category: Agent & Orchestration18 tags: [invocation-governance, capacity, leases, fencing, gather, replay]19 provenance:20 kind: first-party21 owners: [port-daddy]22 pairs-with:23 - skill: pilot-hypertree-execution24 reason: Supplies the sealed planning graph this skill projects.25 - skill: agent-conversation-protocols26 reason: Supplies bounded message semantics after admission.27 - skill: circuit-breakers-and-retries28 reason: Supplies retry and trip policy without creating admission authority.29 io-contract:30 kind: deliverable31 consumes:32 - kind: sealed-execution-plan33 format: json34 - kind: capacity-ceiling35 format: json36 produces:37 - kind: controller-owned-invocation-contract38 format: json39 - kind: static-validation-report40 format: json41---4243# Swarm Invocation Designer4445This is a static contract architect, not a launcher. A planning graph proposes46work; only an external controller can admit attempts, consume reservations,47issue fenced leases, and open effect channels.4849## Decision procedure50511. **Scope:** return `OUT_OF_SCOPE_LIVE_OPERATION` for requests to launch,52 supervise, kill, or settle live agents.532. **Seal intent:** bind objective, completion predicate, excluded effects, plan54 digest/revision, and immutable limit digest.553. **Separate topologies:** record planning and runtime topologies. A projection56 is `EXACT`, `NARROWED`, `OMITTED`, or `BLOCKED`; non-exact support needs an57 attributable acceptance reference.584. **Close the graph:** require unique nodes, acyclic dependencies, sealed gather59 membership, declared reducers, reachable work, and bounded review. Rework is60 a new attempt, not a graph cycle.615. **Separate owners:** identify admission, capacity, lifecycle, effect,62 evidence, and review owners. Workers may propose changes but cannot create63 children, enlarge limits, issue leases, or settle reservations.646. **Reserve first:** bind every attempt, renewal, elastic slot, rework, and65 resource-consuming gather to plan, revision, node, attempt, body generation,66 route, resource vector, expiry, and idempotency key.677. **Consume and fence:** the controller consumes one reservation commit before68 one monotonically generated, externally fenced lease.698. **Persist intent:** durable dispatch intent precedes transmission. Unknown70 transmission becomes `AMBIGUOUS`; retain capacity and reconcile before an71 authorized retry. A new key must never disguise the same uncertain effect.729. **Gather exactly:** membership is sealed. Semantic partial closure never73 implies cancellation or capacity settlement for absent members.7410. **Reduce and review:** reducers consume ordered artifact hashes and are75 version/digest bound. A producer cannot decide its terminal review. One76 `REWORK` creates a fresh attempt; a second escalates or halts.7711. **Cancel as protocol:** request, acknowledgement deadline, fence,78 termination witness, provider reconciliation, and reservation disposition79 are separate facts.8012. **Settle then replay:** every attempt has an explicit disposition. Only81 witnessed settlement or release permits capacity reuse; `HELD_AMBIGUOUS`82 continues to consume its reservation. Replay reconstructs projections with83 effects denied.8485```mermaid86flowchart TD87 I[Sealed intent] --> P[Planning topology proposal]88 P --> R[Runtime support projection]89 R --> E[Closed execution plan]90 E --> C[Capacity reservation commit]91 C --> X[Controller exact-once consume]92 X --> D[Durable dispatch intent]93 D --> L[Fenced body lease]94 L --> W[Bounded worker]95 W --> G[Sealed gather]96 G --> V[Versioned deterministic reducer]97 V --> J{Independent review}98 J -->|Approve| T[Terminal disposition]99 J -->|One rework| C100 J -->|Escalate or halt| T101 T --> S[Settle release or hold reservation]102 W --> Q[Append-only events]103 Q --> Y[Effect-denied replay]104 P -. no admission authority .-> C105 W -. cannot spawn reserve or lease .-> C106```107108## Invariants109110- `maxRecursiveBirths` is zero; topology expansion requires a new reviewed plan.111- Reservation commit precedes lease; lease and durable intent precede dispatch.112- A stale generation cannot produce accepted state or effects.113- Aggregate resource vectors stay under the plan ceiling; native resources are114 not silently converted into one scalar budget.115- Gather membership is immutable and dissent remains visible.116- Cancellation messages do not prove termination, provider state, or release.117- Replay never invokes a provider, tool, hook, or effect broker.118- `STATIC_VALID` means the implemented shape and relationship checks passed.119 It does not prove the completion predicate, capacity enforcement, deterministic120 execution, receipt authenticity, or runtime readiness.121122## Lost-ack procedure123124Persist an immutable operation key and intent before transmission. Give each observation125its own event identity; several observations can concern the same operation. CloudEvents126`source` plus `id` identifies an event, not a command's execution count127([v1.0.2](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md)).128129If an acknowledgement is absent, retain the reservation and mark the attempt130`AMBIGUOUS`. Query the authoritative destination for that exact operation. A terminal131receipt determines what happened; it permits settlement only after the controller checks132outcome, provider accounting, and reservation disposition. A current “not found” answer133alone does not prevent the original request committing later.134135An authorized retry requires either **authoritative noncommit plus a fence that prevents136late commit**, or **validated destination deduplication for the same operation key**.137Both routes require current authority and remaining budget. A deduplicated retransmission138retains the operation key while recording its separate attempt/generation and cost.139Unknown outcomes without either route remain held. Compensation is a separate authorized140effect, not evidence that the original effect is absent. Every relevant sink must enforce141a generation fence; a stored generation number alone does nothing.142143```mermaid144flowchart TD145 U[Missing acknowledgement: hold reservation] --> Q[Query exact operation at destination]146 Q --> T{Terminal outcome witnessed?}147 T -->|yes| S[Check outcome and accounting before settlement]148 T -->|no| N{Noncommit plus late-commit fence?}149 N -->|yes| A[Check retry authority and remaining budget]150 N -->|no| D{Validated same-operation deduplication?}151 D -->|yes| A152 D -->|no| H[Keep held and escalate]153 A -->|permitted| R[Record bounded new attempt]154 A -->|missing| H155```156157## Static worked case158159`review-17` reserves one slot and records operation key `k17`. The controller loses the160acknowledgement after sending; its latest observation says `AMBIGUOUS`. A second “not161found” observation remains insufficient while the original send could arrive. A terminal162absence receipt bound to `k17` plus a target-enforced fence closes that possibility.163Only then, with authority and budget, can the controller create a new attempt. If the164destination instead supplies proven same-key deduplication, that route may permit a165retransmission without creating a new logical operation. Neither path has run here.166167## Validation contract168169The JSON contract records design declarations. The validator checks its supported170schema, bounded counts, graph dependencies, gather membership/reducer links, policy171fields, and selected status contradictions. It cannot evaluate natural-language172completion predicates, grant authority, enforce resources, prove a reducer deterministic,173or verify remote deduplication. Keep those as explicit review and runtime obligations.174The trace schema is a structural envelope; passing it does not validate an execution.175176Gather policies require different design parameters: `ALL` uses the sealed member set;177`QUORUM` states its threshold; `DEADLINE_PARTIAL` states its deadline relative to the178invocation. Missing members retain lifecycle/accounting obligations after partial closure.179One rework round is this bundle's chosen profile, not a result about optimal team design.180181## Anti-patterns182183### Prompt-shaped fanout184185**Bad:** prose directly creates workers. **Detection:** no admitted plan,186reservation commit, or controller lease exists.187188### Planning diagram as authority189190**Bad:** a manager node may dispatch because it appears in a graph. **Detection:**191planning topology names an admission, capacity, lifecycle, or effect owner.192193### Cancellation by message194195**Bad:** `cancel sent` releases capacity. **Detection:** no fence, termination196witness, provider reconciliation, or terminal reservation disposition.197198### Replay by re-execution199200**Bad:** replay calls external effects. **Detection:** `effectsDenied` is false or201absent.202203## Outputs204205Return only `STATIC_VALID`, `STATIC_INVALID`, `INCOMPLETE_STATIC`,206`OUT_OF_SCOPE`, or `OUT_OF_SCOPE_LIVE_OPERATION`.207208```bash209node skills/swarm-invocation-designer/scripts/validate-swarm-invocation.mjs <contract.json>210node skills/swarm-invocation-designer/scripts/test-bundle.mjs211```212213## Load on demand214215| File | Load when |216|---|---|217| `references/authority-admission-lifecycle.md` | Designing owner, reservation, lease, cancellation, or settlement seams. |218| `references/gathers-reducers-and-replay.md` | Designing gather, reducer, review, or replay semantics. |219| `schemas/swarm-invocation.schema.json` | Producing the static contract. |220| `schemas/swarm-invocation-trace.schema.json` | Designing a future runtime trace without claiming one exists. |221| `examples/valid-static-contract.json` | Starting a bounded static design. |222| `tests/activation.md` | Testing routing boundaries. |223| `scripts/validate-swarm-invocation.mjs` | Validating one contract. |224| `scripts/test-bundle.mjs` | Running adversarial mutations. |225| `agents/openai.yaml` | Delegating static contract design. |226227## Imported bundle navigation228229These references extend the static contract design.230231- [examples/expected-output.md](examples/expected-output.md) — Constructed review fixture with unknown outcomes and evidence obligations.232- [references/fast-agent-bus.md](references/fast-agent-bus.md) — Separate replaceable observations from durable commands.233- [references/invocation-patterns.md](references/invocation-patterns.md) — Map four team patterns onto this contract.234- [references/exactly-once-decomposition.md](references/exactly-once-decomposition.md) — Transport and effect boundaries.