{
  "schema": "leumas.docs.page/1",
  "id": "how-to:consensus-groups",
  "slug": "how-to/consensus-groups",
  "kind": "pages",
  "bucket": "how-to",
  "title": "Consensus Groups (@leumas/consensus)",
  "name": "Consensus Groups",
  "eyebrow": null,
  "chip": "@leumas/consensus",
  "summary": "Panels of AI members that deliberate and synthesize ONE answer. Generalizes the legacy ollama-consensus pipeline over every provider, and ports the MIT council-of-high-intelligence deliberation...",
  "keywords": [
    "consensus-groups",
    "ollama-consensus",
    "council-of-high-intelligence",
    "generalizes",
    "deliberation",
    "leumas consensus groups",
    "how to consensus groups",
    "synthesize"
  ],
  "audience": "both",
  "funnel": {
    "product": null,
    "cta": null
  },
  "body": "# Consensus Groups (@leumas/consensus)\n\nPanels of AI members that deliberate and synthesize ONE answer. Generalizes the legacy\n`ollama-consensus` pipeline over every provider, and ports the MIT `council-of-high-intelligence`\ndeliberation protocol as code.\n\n## Model\n\nA group (`/db/consensus_groups`, zero-backend CRUD) = `members[]` + `chairman` + `mode` + `settings`.\n- Member = a `chatbots` row (`kind:'chatbot'`, e.g. the 18 seeded `council-*` personas) or inline\n  `{ provider, model, system }`. Optional per member: `domainSeat` (×1.5 vote weight),\n  `research: { enabled, loops, searchApi }` (runs @leumas/research before answering).\n- Chairman = the synthesizer; **never a panelist** (enforced).\n- Modes: `panel` (parallel + judge; fast) · `council` (restate gate → blind Round 1 → ANONYMIZED\n  Round 2 cross-exam → Round 3 `STANCE: x | CONFIDENCE: high|med|low | DEALBREAKER: yes|no` →\n  confidence-weighted vote: consensus iff ≥⅔ of total BASE weight, else the honest split →\n  Chairman verdict leading with unknowns) · `quick` (2 rounds + vote) · `duo` (dialectic).\n\n## How agents call it\n\n| Surface | How |\n|---|---|\n| Chatbot / Leviathan | attach the `run_consensus` functioncall (executor `action:run-consensus`) |\n| Automation rule | action `run-consensus` `{ groupId, prompt, mode? }` |\n| MCP client | `functioncalls` server → `run_consensus` tool |\n| HTTP | `POST /api/consensus/run[/stream]` with `{ groupId }` OR an inline `{ group }` (ad-hoc panels — AiLab does this) |\n| Studio | Intelligence → Consensus Groups / Group Chat; Builder → AI Lab (inline local panels) |\n| Code | `runConsensus({ group, prompt, mode, onEvent, signal, providerRegistry, getBot, research, connector })` |\n\n## SSE vocabulary\n\n`start · phase(restate|round1|round2|round3|vote|synthesis|panel) · member_start · member_done ·\nresearch (nested per-member) · stance · vote · synth_start · consensus · done · error`.\nRuns persist to `/db/consensus_runs`, checkpointed per phase (dropped streams lose nothing).\n\n## Gotchas\n\n- Panel synthesis imports `buildConsensusPrompt` + `CONSENSUS_SYSTEM` from `@leumas/a-ollama` — never copy them.\n- All-Ollama panels default to concurrency 2 (one GPU serializes); Studio prewarms via `/api/ollama/prewarm`.\n- Stance labels are cleaned of markdown/quote decoration before tallying (models emit `** monorepo`).\n- Providers without a step `adapter` (cursor-agent, codex, slm) answer one-shot — fine for members.\n- Council cost ≈ members × 4 calls + chairman; Group Chat shows the projected call count pre-run.\n\n## Gating\n\n`requireAuth` + `requireMembership('intelligence')` (admins bypass) + PassNode guard\n`feature:consensus.run` (author a `passnode_rules` doc to meter). Smoke: `pnpm smoke:consensus`.\n",
  "source": {
    "path": "shared/services/knowledge/build-knowledge/consensus-groups.md",
    "blobSha": "",
    "commit": "",
    "committedAt": "",
    "provenance": "no-git",
    "bytes": 2988,
    "hash": "b5618b01e1ba783c6042280a3afe3e60685262ed"
  },
  "urls": {
    "html": "/p/how-to/consensus-groups",
    "json": "/docs/how-to/consensus-groups.json",
    "md": "/docs/how-to/consensus-groups.md"
  },
  "links": {
    "composes": [],
    "usedBy": [],
    "product": [],
    "howTo": [],
    "skills": []
  }
}
