06 -Concepts
The synthesis
After every round, Agent Swarm folds the panel's work into a single deterministic synthesis - one recommendation, one confidence level, one list of shared risks. No model decides the final word. The same agent notes always produce the same synthesis.
What the synthesis computes
The synthesis is built by buildOrchestratorSynthesis in
src/lib/synthesis.ts. It reads the structured JSON output each
agent returns and runs six deterministic computations - no LLM call, no
sampling, no randomness:
-
Consensus. Whether all agents in the final round landed
on the same stance. Computed as
stanceTally.length === 1- true only when every agent emits an identical stance string. -
Stance tally. A breakdown of how many agents held each
stance, sorted by count descending. Stances come from each agent's
stancefield in the last round's output; the tally groups agents by the exact string they reported. - Top recommendation. The recommendation text from the highest-confidence agent in the final round. On ties in confidence, the alphabetically first agent name wins - so the result is always deterministic.
- Shared risks. Risks raised across all rounds, deduplicated in appearance order. A risk counts as shared when it appears in more than one agent's output across any round.
- Open and deferred questions. Open questions are deduplicated from the final round's packet. Deferred questions are collected and deduplicated across all rounds - questions the panel flagged but did not resolve.
-
Overall confidence. Each agent reports
low,medium, orhigh. These are mapped to numeric ranks (1, 2, 3), averaged across all agents in the final round, then rounded back to a level: average ≥ 2.5 →high; ≥ 1.5 →medium; below that →low.
Key objections are also collected and deduplicated across all rounds, and the reasoning behind the top recommendation is gathered from every successful agent in the final round.
Reading the synthesis card
Every synthesis surfaces as a card - in the terminal at the end of a run,
in synthesis.md in the run directory, and in the machine-readable
synthesis.json. Here is what each row means:
Fix now - onboarding hides the one action that shows value.
The verdict word - Fix now above - comes from the preset's
--decision vocabulary, not from the model. An agent outputs a
stance string, and that string must match one of the words the preset
defines. The model never invents a verdict word of its own.
Confidence is reported as a level: low, medium,
or high. It is a rounded average of what the agents reported
- never a fabricated decimal like 0.78.
The consensus row shows how many agents agreed on the same stance in the final round. When all agents converge, consensus is true; when they split, the tally shows each stance and who held it.
The "Still open" row lists questions that were raised but not resolved by any round. These are the deferred questions you may want to answer before acting on the recommendation.
Determinism in depth
The synthesis has no LLM step. Given identical agent outputs, it will always produce identical synthesis fields. The properties that make it deterministic are:
- No sampling. All computations are arithmetic or string operations on the agent JSON. There is no temperature, no token generation, no model call.
- Alphabetical tie-breaking. When two agents report the same highest confidence, the recommendation is taken from the agent whose name sorts first alphabetically. The output is stable across re-runs.
- Deduplication by first appearance. Risks, objections, open questions, and deferred questions are deduplicated in the order they first appear - identical strings are dropped, order is preserved.
- Preset-controlled vocabulary. The stance string each agent reports must come from the preset's decision vocabulary. The synthesis surfaces that string as-is; it never renames or reinterprets it.
Because the synthesis is deterministic, you can check synthesis.json into version control and diff it across runs to see exactly what changed in the panel's output.
The synthesis fields
synthesis.json in the run directory contains the full machine-readable
output. The top-level fields map directly to what was computed:
| Field | Type | What it holds |
|---|---|---|
consensus |
boolean | True when all agents in the final round share the same stance. |
stanceTally |
array | Each distinct stance, the agents who held it, and their count - sorted by count descending. |
topRecommendation |
string | Recommendation text from the highest-confidence agent (alphabetical tie-break). |
topRecommendationBasis |
string[] | Reasoning collected from all successful agents in the final round. |
sharedRisks |
string[] | Risks raised across all rounds, deduplicated in appearance order. |
keyObjections |
string[] | Objections raised across all rounds, deduplicated in appearance order. |
openQuestions |
string[] | Questions still open at the end of the final round. |
deferredQuestions |
string[] | Questions flagged as deferred across all rounds, deduplicated. |
overallConfidence |
low | medium | high |
Rounded average of each agent's confidence level from the final round. |
Where next
- Quickstart - run a ready-made swarm and read your first synthesis end to end.
- CLI reference - every command, flag, preset, and run artifact.
- Architecture - how the pipeline flows from agents to synthesis.