diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9bea433 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +.DS_Store diff --git a/README.md b/README.md index 002dc44..d027089 100644 --- a/README.md +++ b/README.md @@ -1 +1,84 @@ # pi-quorum + +> Multi-perspective **deliberation** for [Pi coding agent](https://pi.dev/) — a +> prompt-only skill that spawns 3-5 adversarially-roled subagents for 2-3 +> structured rounds, then synthesizes a decision landscape. Human-steered, not +> automated. + +**Not** a reasoning engine (single strong models win there now), **not** a port +of a heavy debate engine (no script, no runtime), **not** a crew/task +orchestrator (that's plan/execute; this is debate/decide). See +[SKILL.md](SKILL.md) for the full scope. + +## What it does + +`/quorum "question"` runs: + +1. **Compose** — one call designs a roster of 3-5 personas *for this specific + question* (diversity of framing over diversity of title). +2. **Position** — each agent forms an independent position (parallel, blind). +3. **Cross-examine: Probe** — each agent probes the others' reasoning (parallel). + Probing-for-reasoning is the strongest predictor of group performance gain. +4. **Cross-examine: Reflect** *(standard/deep)* — each revises confidence and + notes concessions and what would close remaining gaps. +5. **Synthesis** — your orchestrating session produces a **decision landscape**: + confidence dispersion (groupthink detector), shared concerns, genuine + disagreement, assumptions, risk vectors, principal's path. No forced + consensus — the tension is the output. + +Between rounds, control returns to your session so you can **steer**: press a +specific argument, reframe, add a constraint, or stop early. That turn-based +human checkpoint is the differentiator. + +## Why this shape + +- **Value saturates fast.** Round 1 = breadth, round 2 = collision, round 3 = + refinement. Past that, marginal value dies unless a human steer changes the + state. Default 2-3 rounds, not 15. +- **LLMs agree too easily.** Adversarial stances are structural. Rising + confidence + narrowing dispersion after debate is a groupthink red flag, and + the synthesis flags it explicitly. +- **The baseline is strong.** "Ask the main agent twice" is the real + competitor. Quorum only earns its ~13 subagent calls when one perspective + would miss genuine disagreement. + +## Install + +This is a skill, not an extension. Drop the directory into a skill location Pi +scans: + +```bash +# user scope +ln -s "$(pwd)" ~/.pi/agent/skills/pi-quorum +# or project scope (after the project is trusted) +ln -s "$(pwd)" .pi/skills/pi-quorum +``` + +Requires `pi-subagents` (for chain/parallel spawning). Optionally +`pi-intercom`/`pi-messenger` if you later want multi-session room transport — +not needed for the default in-session flow. + +Then `/skill:pi-quorum "question"` or just describe a council-worthy decision +and the agent will load it. + +## Structure + +``` +pi-quorum/ +├── SKILL.md # protocol, prompts, synthesis format +├── README.md # this +└── references/ + └── composition-guide.md # worked roster examples, anti-patterns +``` + +No `scripts/`, no runtime, no state file. Deliberate. + +## Status + +48-hour-test version. The real validation: after building it, wait one week and +notice whether you reach for it a second time on a real decision. If you don't, +the habit doesn't exist and no polish creates it. + +## License + +MIT diff --git a/SKILL.md b/SKILL.md new file mode 100644 index 0000000..2fe1deb --- /dev/null +++ b/SKILL.md @@ -0,0 +1,268 @@ +--- +name: pi-quorum +description: >- + Convene a short multi-perspective deliberation on a question, decision, or + design. Spawns 3-5 adversarially-roled subagents for 2-3 structured rounds + (position → cross-examine → reflect), then synthesizes a decision landscape. + Human-steered: the orchestrating session reads each round and can steer the + next before it runs. Use when a single-agent answer would miss genuine + disagreement or diverse framing — architecture forks, "is this approach dumb", + naming, design under uncertainty. NOT for reasoning tasks a strong single model + handles alone, and NOT for plan/execute task work (that's crew/worker flows). +--- + +# pi-quorum — Multi-Perspective Deliberation + +## What this is — and is not + +`/quorum` runs a **deliberation**: a few adversarially-roled subagents take +positions, probe each other's reasoning, reflect, and you get back a map of the +disagreement — not a forced consensus. + +It is **not**: + +- A reasoning engine. 2025-2026 research shows single frontier/reasoning models + match or beat multi-agent debate on logic at equal compute. The value here is + **diverse framing and surfaced disagreement**, not "smarter answers." +- A port of a heavy debate engine. This is a prompt-only skill: no script, no + runtime, no state file. It orchestrates `pi-subagents` chain steps directly. + The human's own session is the steerer and the Judge. +- A crew/task orchestrator. Crew is plan → parallel work waves → review. + Quorum is debate → cross-examine → synthesis. Different job entirely. + +## When to use / When NOT to + +**Use when** the cost of a one-perspective answer is high relative to ~10-16 +subagent calls: + +- Architecture or framework forks where you suspect you're anchored. +- "Is this whole approach wrong?" sanity checks before committing. +- Naming, scoping, or design decisions under genuine uncertainty. +- Stress-testing a plan before handing to a worker. + +**Do NOT use for**: pure reasoning, math, debugging a known error, implementing +an approved plan, or anything where "ask the main agent, maybe twice" already +gives you the answer. That baseline is your real competitor — quorum must beat +*asking twice*, or don't run it. + +## MANDATORY: delegate, don't answer + +When triggered, **do not answer the question yourself.** You are the +**orchestrator and Judge**, not a participant. Your job: + +1. Compose the roster (one subagent call). +2. Run the rounds (parallel subagent calls per round). +3. Read each round, present it, and steer the next. +4. Synthesize the decision landscape at close. + +If you answer from your own knowledge, you defeated the point. + +## The protocol + +Three roles, three phases. Defaults are tuned for the value-saturation curve: +round 1 = breadth, round 2 = collision, round 3 = refinement. Past that, +marginal value dies unless new evidence or a human steer changes the state. + +### Phase 0 — Compose (1 call, ~minutes) + +A single subagent designs the roster for **this specific question**. Never use +generic archetypes. Prioritize **diversity of initial position over diversity of +expertise** — research (Karadzhov et al. 2024) shows four distinct framings beat +four experts with shared framing. + +Composition rules (encode in the compose prompt): + +- **3-5 agents**, 4 is the sweet spot. Below 3 lacks diversity; above 5 hits + coordination cost. +- **At least one structurally skeptical member** (light red team) whose job is to + stress-test the leading direction. +- **At least one fundamentally different cognitive frame** — first-principles + when others are pragmatic, or vice versa. Prevents groupthink. +- **Task conflict, not relationship conflict.** Disagree on conclusions, never on + competence. Every position must be defensible. +- Each agent gets: name, one-paragraph background, expertise, analytical + approach, the bias/experience they bring, and their assigned stance seed. + +Return JSON, e.g.: + +```json +{ + "roster": [ + { "name": "...", "background": "...", "approach": "...", "bias": "...", "stance_seed": "advocate | skeptic | simplifier | user-proxy | ..." } + ] +} +``` + +### Phase 1 — Position (parallel calls, one per agent) + +Each agent forms an **independent** initial position, blind to the others. +Prompt each with only: the question, their persona, and "state your position, +your key argument, your confidence 0-1, and the single assumption you most +rely on." No transcript. + +### Phase 2 — Cross-examine: Probe (parallel, one per agent) + +Each agent now sees **all round-1 positions** and probes for reasoning: "why do +you believe X? what would change your mind?" Probing-for-reasoning is the +strongest predictor of group performance gain (R=0.41). This is where value is +created — don't skip it. + +### Phase 3 — Cross-examine: Reflect (parallel, optional, default on) + +Each agent reflects: concessions made, disagreements that held, what evidence +would close each gap, and their **revised** confidence 0-1. The pre-vs-post +confidence shift is your groupthink detector (see synthesis). + +**Stop after round 2-3.** Do not run a 4th round by default. If the human +steers ("push harder on the security angle"), that's a valid reason to extend. +Otherwise synthesize. + +### Phase 4 — Synthesis (YOU, the orchestrator) + +You read all rounds and produce a **decision landscape**, not a recommendation. +The principal (the human) converges internally by reading the map. + +## Running it + +Use `pi-subagents` chain/parallel primitives. The parent session IS the +orchestrator — no script needed. One clean shape: + +```typescript +// Phase 0: compose roster (structured output so you can fan out from it) +subagent({ + agent: "delegate", + task: " ... return JSON roster.", + outputSchema: { /* roster shape */ }, + output: "quorum/roster.json", + context: "fresh" +}) +``` + +Then fan out per phase using `expand` from the roster, with parallel children: + +```typescript +subagent({ + chain: [ + { parallel: [ /* one delegate per roster agent, Phase 1 position */ ] }, + { parallel: [ /* Phase 2 probe — feed {previous} round-1 positions */ ] }, + { parallel: [ /* Phase 3 reflect — feed round-2 probes */ ] } + ], + context: "fresh" +}) +``` + +**Between rounds, control returns to you.** Read the round output, show the +human the positions and the friction, and either let the next round proceed or +inject a steer ("the skeptic raised dependency risk — make round 2 about that +specifically"). This turn-based checkpoint is the whole interaction model. It is +**not** a live chat room; subagents are stateless LLM calls and "real-time +riffing" with them is not coherent. Human-steered turns is what works. + +**Memory across rounds is the transcript fed forward via `{previous}` / named +outputs** — not re-deriving context. Feed round N-1's collected positions into +round N's prompt. That is the round-to-round memory; there is no other. + +### Effort modes + +| Mode | Agents | Rounds | Calls | Use | +|------|--------|--------|-------|-----| +| `quick` | 3 | position → probe | ~7 | low-stakes sanity check | +| `standard` (default) | 4 | position → probe → reflect | ~13 | normal decisions | +| `deep` | 5 | + assumption-map round | ~16 | architecture, high-friction | + +Default to `standard`. Reach for `deep` only on architecture or when the +question genuinely warrants the extra round. + +## Synthesis format — the decision landscape + +Produce exactly this shape. The **Confidence Dispersion** section is mandatory — +it's how the human knows whether quorum did its job or collapsed to mush. + +``` +Quorum Synthesis: [topic] +Mode: [quick/standard/deep] · Agents: [names] · Rounds: [list] + +── Confidence Dispersion ── + Agent Pre Post Δ + ───────────────── ───── ───── ─── + [name] 0.82 0.65 -0.17 most shifted by [argument] + ... + Mean 0.80 0.70 -0.10 + Dispersion 0.04 0.13 +0.09 + + Diagnostic: + • Mean dropped + dispersion widened → genuine doubt surfaced. ✓ healthy + • Mean rose + dispersion narrowed → possible false convergence/groupthink. ⚠ + +── Shared Concerns ── +• What multiple agents independently worry about + +── Genuine Disagreement ── +• Where positions diverge and the specific reasoning that separates camps + +── Assumptions Per Position ── +• What would need to be true for each position to hold; where evidence is thin + +── Risk Vectors ── +• Failure modes each position carries that others don't +• The one signal each agent would watch to know if they're wrong + +── Principal's Path ── +• The available choices and the tradeoff each entails +• No forced consensus — the tension IS the output +``` + +## Steering and interruption (human-in-the-loop) + +Between rounds, after you present a round's results, the human may: + +- **Let it run** the next phase as-is. +- **Steer**: name a specific agent or argument to press, reframe the question, + add a constraint, or inject new context. Encode the steer into the next + round's prompts. +- **Stop early**: if round 2 already converges or the disagreement is exhausted, + skip to synthesis. Don't run rounds for the sake of rounds. +- **Change the roster**: drop or add an agent between rounds if a voice is + missing (rare, but allowed). + +This steering is the differentiator from a fully-automated debate. If you run +all rounds with no human input, you've built a slower `roast` — so make the +between-round checkpoint real, not ceremonial. + +## Config / inference + +Quorum agents inherit the default model unless overridden. For cheaper rounds +(common — position/probe are not frontier-demanding), override per-run: + +```typescript +{ agent: "delegate", model: "anthropic/claude-haiku-4-5", task: "..." } +``` + +Or persist via `subagents.agentOverrides.delegate` in settings. Keep the +synthesis step (your own session) on the strong model — that's where judgment +matters. + +## Pitfalls + +- **Consensus mush.** LLMs love to agree. Adversarial stances are structural, + not hoped-for. If round 2 converges to mush with rising confidence and + narrowing dispersion, that's a groupthink red flag — surface it, don't + celebrate it. +- **Transcript-replay tax.** Don't re-derive context each round; feed forward. + Quadratic token spend for simulated memory is how this dies. +- **Over-rounding.** Default 2-3. A 5-round quorum is almost always + over-engineered for brainstorming. +- **Using it when you shouldn't.** If "ask the main agent twice" gets you there, + quorum wasted your tokens. The baseline is strong. +- **Generic rosters.** "Architect / Engineer / PM" is the failure mode. Compose + for the specific question; diversity of framing over diversity of title. + +## What's NOT here (deliberately) + +- No Chair state machine, no faction tracking, no TTS, no HTML deck, no + Excalidraw map. Those are v2+ vanity that delay launch for zero adoption + signal. Ship the protocol; add richness only if a real user asks. +- No persistent room / presence. That's `pi-messenger`'s job. If a later version + wants the genuine room experience, this skill's *protocol* layers onto + messenger's *transport* — they don't compete. +- No new runtime. Pure `SKILL.md` + `pi-subagents`. Zero infrastructure. diff --git a/references/composition-guide.md b/references/composition-guide.md new file mode 100644 index 0000000..85c15ba --- /dev/null +++ b/references/composition-guide.md @@ -0,0 +1,74 @@ +# Composition Guide + +Worked examples for Phase 0 (roster composition). The principle, always: +**diversity of initial position beats diversity of expertise.** Compose for the +specific question, never generic archetypes. + +## The compose prompt shape + +> For the question "[Q]", design N expert debating agents. +> +> Critical directive: prioritize **diversity of initial position** over +> diversity of expertise. Research (Karadzhov et al. 2024) shows four distinct +> framings — none individually correct — outperform four experts with shared +> framing. +> +> For each agent: name, one-paragraph career background, specific expertise, +> analytical approach, and the bias/experience they bring to THIS question. +> At least one must be structurally skeptical (light red team). At least one +> must approach from a fundamentally different cognitive frame than the others. +> +> Design for task conflict, not relationship conflict. Every position must be +> defensible. Return JSON. + +## Worked examples + +### "Should we migrate from SQLite to Postgres?" + +Don't use: DBA / DevOps / Backend Eng / PM. Use: + +- **Ex-Uber SRE** burned by a botched migration — skeptical of "migrate early." +- **YC founder** who ran 50K-row SQLite for 3 years and shipped — skeptical of "migrate at all." +- **Postgres committer** who values correctness above all — leans migrate. +- **Startup CTO** who regrets their last premature migration — pragmatic middle, different frame (shipping speed vs. correctness). + +Four defensible positions, four framings, genuine friction. + +### "Is this feature worth building?" + +- **The user-proxy**: argues from the target customer's actual pain, first person. +- **The simplifier**: "what's the 20% that gets 80%? do we even need this?" +- **The skeptic / red team**: "how does this die? what's the fatal assumption?" +- **The opportunist**: "what's the 10x adjacent version we're missing?" + +### "Pick a name for X" + +- **The clarity maximalist**: optimize for instant comprehension. +- **The brand/SEO pragmatist**: ownability, search, trademark. +- **The contrarian**: stress-test the leading candidate's failure modes. +- **The audience-proxy**: reacts as the actual target reader/user would. + +## Anti-patterns + +- **Generic roles** (Architect / Engineer / PM / Reviewer) → shared framing, + groupthink, mush. +- **Caricatures** ("Captain Hindsight") → relationship conflict, not task + conflict; undermines credibility. +- **>5 agents** → coordination cost degrades deliberation (inverted-U). +- **All same stance seed** → no friction, expensive consensus theater. +- **No red-team member** → unchallenged leading direction. + +## Stance seeds (starting palette) + +Compose assigns one to each agent; the position prompt uses it as a seed, not +a straitjacket: + +- `advocate` — strongest case FOR the leading direction +- `skeptic` / `red-team` — stress-test, find the fatal flaw +- `simplifier` — what can we cut? YAGNI lens +- `user-proxy` — react as the real target user/customer +- `first-principles` — strip to fundamentals, ignore convention +- `pragmatist` — shipping/feasibility lens +- `opportunist` — adjacent/10x upside others miss + +Pick 3-5 that maximize framing diversity for the specific question.