This skill orchestrates multi-expert swarm discussions to surface blind spots and converge on unresolved problems using structured roles and tension maps.
npx playbooks add skill ischca/swarm-discussion-skill --skill swarm-discussion
"Deep-dive into problems as if multiple experts were debating"
> "When there's no clear answer, expose blind spots by confronting diverse perspectives."
For unsolved problems or unprecedented challenges, multiple experts participate as a team,
engaging in "true discussions" through messaging where they challenge and supplement each other.
┌─────────────────────────────────────────────────────────────────┐
│ Discussion Team │
│ team_name: discussion-{id} │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌────────────┐ ┌────────────┐ ┌────────────┐ ┌────────────┐ │
│ │ Expert 1 │ │ Expert 2 │ │ Contrarian │ │Cross-Domain│ │
│ │ │◄──────────────►│ │◄─────────────►│ │
│ │ inbox ◄───┼──── messages ──┼──► inbox │ messages │ │
│ └─────┬──────┘ └─────┬──────┘ └─────┬──────┘ └─────┬──────┘ │
│ │ │ │ │ │
│ └──────────────┴──────┬───────┴──────────────┘ │
│ │ │
│ ┌─────────▼─────────┐ │
│ │ Moderator │ │
│ │ - Present topics │ │
│ │ - Quality gates │ │
│ │ - Convergence │ │
│ └─────────┬─────────┘ │
│ │ │
│ ┌─────────▼─────────┐ │
│ │ Historian │ │
│ │ - Argument graph │ │
│ │ - Synthesize │ │
│ └───────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
Choose based on problem complexity and budget:
| Mode | Experts | Rounds | Calls/Round | Use When |
|------|---------|--------|-------------|----------|
| Deep | 3-4 dynamic + 4 fixed | 3-5 | 8-12 | Unprecedented problems, high-stakes decisions |
| Standard | 2-3 dynamic + 4 fixed | 2-3 | 5-8 | Typical design decisions, tradeoff analysis |
| Lightweight | 2 dynamic + 2 fixed (Moderator, Contrarian) | 1-2 | 3-5 | Quick sanity checks, idea validation |
Default: Standard. Specify mode with /swarm-discussion --mode deep "topic".
| Role | Responsibility | Quality Function |
|------|----------------|------------------|
| Moderator | Facilitate discussion, enforce quality gates, determine convergence | Prevents premature consensus; ensures all perspectives are heard |
| Historian | Build argument graph, synthesize, generate summaries | Maintains traceability; prevents circular arguments |
| Contrarian | Question assumptions, present counterarguments | Prevents echo chambers; stress-tests ideas |
| Cross-Domain | Provide analogies from other fields | Prevents domain-locked thinking; seeds novel approaches |
Analyze the topic and define appropriate experts. Each expert has the following attributes:
{
"id": "database-expert",
"name": "Database Expert",
"expertise": ["RDB", "NoSQL", "Distributed DB"],
"thinkingStyle": "pragmatic",
"bias": "Prioritizes practicality and performance",
"replyTendency": "Shows concrete implementation examples",
"stakes": "Owns the data layer; bad decisions mean data loss or inconsistency",
"blindSpots": ["Tends to underestimate application-level complexity"]
}
New fields:
stakes: What this expert stands to lose if the wrong decision is made. Drives genuine engagement.blindSpots: Known limitations of this perspective. Enables other experts to target these.When generating personas, the Moderator MUST design a tension map — pairs of experts with naturally opposing viewpoints:
{
"tensionMap": [
{
"between": ["database-expert", "api-designer"],
"axis": "Data consistency vs. API flexibility",
"description": "Database Expert wants strict schemas; API Designer wants loose coupling"
},
{
"between": ["security-engineer", "ml-practitioner"],
"axis": "Control vs. Autonomy",
"description": "Security Engineer restricts; ML Practitioner needs freedom to experiment"
}
]
}
Why this matters: Without designed tension, AI agents tend toward premature agreement. The tension map ensures that at least some expert pairs have structurally opposing incentives, producing genuine debate rather than a series of "I agree, and also..." statements.
AI agents playing expert roles naturally tend to:
1. Mandatory Position Declaration
Before the discussion begins, each expert MUST declare a preliminary position:
{
"from": "database-expert",
"type": "position_declaration",
"position": "Saga pattern with orchestration",
"confidence": 0.7,
"conditions": "Assuming < 10 services involved",
"wouldChangeIf": "Someone shows orchestration overhead exceeds 30% of request latency"
}
The wouldChangeIf field is critical — it forces each expert to pre-commit to what evidence would change their mind, preventing unfalsifiable positions.
2. Steel-Manning Requirement
Before disagreeing, an expert MUST demonstrate understanding of the opposing view:
Before I present my counterargument, let me confirm I understand the position:
[Restate the argument in the strongest possible form]
My concern with this is: [counterargument]
3. Disagreement Budget
The Moderator tracks a "disagreement score" for each round:
4. Position Shift Tracking
The Historian records when experts change their positions:
{
"type": "position_shift",
"expert": "database-expert",
"from": "Saga pattern with orchestration",
"to": "Event sourcing with compensating actions",
"trigger": "Message #msg-007 from operations-engineer",
"reasoning": "Operational complexity of orchestrator convinced me"
}
// 1. Generate discussion ID
const discussionId = slugify(topic); // e.g., "microservice-transaction"
// 2. Determine mode (deep / standard / lightweight)
const mode = parseMode(userInput); // default: "standard"
// 3. Create team
Teammate({
operation: "spawnTeam",
team_name: `discussion-${discussionId}`
})
// 4. Create directory structure
Bash({
command: `mkdir -p ~/.claude/discussions/${discussionId}/{personas,rounds,artifacts,context}`
})
// 5. Analyze topic and define experts with tension map
const topicAnalysis = analyzeTopicAndDefineExperts(topic, mode);
// → {
// experts: [{ id, name, expertise, thinkingStyle, bias, replyTendency, stakes, blindSpots }],
// tensionMap: [{ between, axis, description }],
// problemDefinition: { statement, scope, successCriteria }
// }
// 6. Add fixed roles (based on mode)
const fixedRoles = mode === "lightweight"
? [
{ id: "moderator", name: "Moderator", role: "Discussion facilitator" },
{ id: "contrarian", name: "Contrarian", role: "Devil's advocate" }
]
: [
{ id: "moderator", name: "Moderator", role: "Discussion facilitator" },
{ id: "historian", name: "Historian", role: "Record keeper" },
{ id: "contrarian", name: "Contrarian", role: "Devil's advocate" },
{ id: "cross-domain", name: "Cross-Domain", role: "Alternative perspective" }
];
const allExperts = [...topicAnalysis.experts, ...fixedRoles];
// 7. Confirm expert composition with user (show tension map)
AskUserQuestion({
questions: [{
question: `Start discussion with the following experts?\n\n` +
`**Dynamic Experts:**\n${topicAnalysis.experts.map(e =>
`- ${e.name} (${e.thinkingStyle}) — Stakes: ${e.stakes}`
).join('\n')}\n\n` +
`**Designed Tensions:**\n${topicAnalysis.tensionMap.map(t =>
`- ${t.between[0]} vs ${t.between[1]}: ${t.axis}`
).join('\n')}\n\n` +
`**Mode:** ${mode}`,
header: "Confirm Experts & Tensions",
options: [
{ label: "Start (Recommended)", description: "Begin with this composition" },
{ label: "Modify", description: "Add or change experts" },
{ label: "Change Mode", description: "Switch between deep/standard/lightweight" }
],
multiSelect: false
}]
})
// 8. Save manifest.json (includes tension map)
Write(`~/.claude/discussions/${discussionId}/manifest.json`, {
id: discussionId,
title: topic,
created: new Date().toISOString(),
status: "active",
mode: mode,
currentPhase: "initial",
currentRound: 0,
team_name: `discussion-${discussionId}`,
personas: allExperts,
tensionMap: topicAnalysis.tensionMap,
problemDefinition: topicAnalysis.problemDefinition
})
// 9. Save each expert definition
for (const expert of allExperts) {
Write(`~/.claude/discussions/${discussionId}/personas/${expert.id}.json`, expert)
}
During round execution, the orchestrator MUST report progress to the user after each
major step completes. This serves two purposes:
so the user sees what's happening in real-time, without waiting for the full round.
~/.claude/discussions/{id}/progress.md so the usercan check the file at any time (e.g., from another terminal).
Progress format (output directly to the user after each step):
### 📍 Round {N} — Step {step}: {step_name}
{1-3 sentence summary of what just happened}
**Key takeaway**: {most important point from this step}
The orchestrator MUST NOT silently proceed through all steps. Each step's result
must be surfaced to the user immediately.
async function executeRound(discussionId, roundNum, roundTopic) {
const teamName = `discussion-${discussionId}`;
const manifest = loadManifest(discussionId);
const experts = loadPersonas(discussionId);
const mode = manifest.mode;
// Live progress file path
const progressFile = `~/.claude/discussions/${discussionId}/progress.md`;
// Helper: Report progress to user and append to progress file
function reportProgress(step, stepName, summary, keyTakeaway) {
const progressEntry = `### Round ${roundNum} — Step ${step}: ${stepName}\n\n` +
`${summary}\n\n` +
`**Key takeaway**: ${keyTakeaway}\n\n---\n\n`;
// 1. Print directly to user (output as text in the conversation)
output(progressEntry);
// 2. Append to progress file for async checking
Bash({ command: `echo '${escapeForShell(progressEntry)}' >> ${progressFile}` });
}
// Track argument graph for this round
const argumentGraph = [];
let messageCounter = 0;
function nextMsgId() { return `r${roundNum}-msg-${String(++messageCounter).padStart(3, '0')}`; }
// Array to store all messages
const allMessages = [];
// ========== Step 1: Position Declaration (NEW) ==========
// Each dynamic expert declares their preliminary position BEFORE seeing others
// This prevents anchoring bias from the first speaker
const positionDeclarations = [];
for (const expert of getDynamicExperts(experts)) {
Task({
team_name: teamName,
name: expert.id,
subagent_type: "general-purpose",
prompt: buildPositionDeclarationPrompt(expert, roundTopic),
run_in_background: true
})
}
// Collect position declarations
for (const expert of getDynamicExperts(experts)) {
const declaration = await collectStatement(expert.id);
const msgId = nextMsgId();
positionDeclarations.push({
id: msgId,
from: expert.id,
type: "position_declaration",
content: declaration, // { position, confidence, conditions, wouldChangeIf }
timestamp: new Date().toISOString()
});
allMessages.push(positionDeclarations[positionDeclarations.length - 1]);
}
// >>> PROGRESS REPORT: Position Declarations <<<
reportProgress(1, "Position Declarations",
positionDeclarations.map(d =>
`**${d.from}**: "${d.content.position}" (confidence: ${d.content.confidence})`
).join('\n'),
`${positionDeclarations.length} experts declared positions. ` +
`Confidence range: ${Math.min(...positionDeclarations.map(d => d.content.confidence))}–${Math.max(...positionDeclarations.map(d => d.content.confidence))}`
);
// ========== Step 2: Moderator Opening ==========
// Moderator now has ALL positions and can frame the discussion
// around actual disagreements rather than generic angles
const moderatorOpening = await Task({
team_name: teamName,
name: "moderator",
subagent_type: "general-purpose",
prompt: `
You are the Moderator. Frame this round's discussion.
【Topic】
${roundTopic}
【Position Declarations】
${formatPositionDeclarations(positionDeclarations)}
【Tension Map】
${JSON.stringify(manifest.tensionMap, null, 2)}
【Previous Discussion】
${previousRoundsSummary || "(New discussion)"}
【Task】
1. Identify where positions actually diverge (not where they superficially differ)
2. Frame 2-3 specific questions that target the real disagreements
3. Direct questions to specific experts based on the tension map
4. Set the disagreement budget for this round (target: 3-6 on a 0-10 scale)
Do NOT present generic angles. Use the position declarations to find genuine fault lines.
`
});
const moderatorMsgId = nextMsgId();
allMessages.push({
id: moderatorMsgId,
from: "moderator",
type: "opening",
content: moderatorOpening,
timestamp: new Date().toISOString()
});
// Broadcast to all
broadcastMessage(teamName, "moderator", moderatorOpening, experts);
// >>> PROGRESS REPORT: Moderator Opening <<<
reportProgress(2, "Moderator Framing",
`Moderator identified key fault lines and framed ${mode === "lightweight" ? "1-2" : "2-3"} targeted questions for the experts.`,
moderatorOpening.substring(0, 200) + "..."
);
// ========== Step 3: Argumentation Phase ==========
// Dynamic experts argue their positions with CITATIONS
// Must reference prior messages by ID
for (const expert of getDynamicExperts(experts)) {
Task({
team_name: teamName,
name: expert.id,
subagent_type: "general-purpose",
prompt: buildExpertPrompt(expert, {
phase: "argumentation",
topic: roundTopic,
positionDeclarations: positionDeclarations,
moderatorOpening: moderatorOpening,
tensionMap: manifest.tensionMap,
instruction: `
Argue your position. You MUST:
1. Reference at least one other expert's position by message ID (e.g., "Regarding ${positionDeclarations[0]?.id}...")
2. Steel-man any position you disagree with before countering it
3. Identify what evidence would change your mind
4. Be specific — cite concrete scenarios, numbers, or code examples
Do NOT simply agree with others. If you agree, explain what ADDITIONAL risk or nuance they missed.
`
}),
run_in_background: true
})
}
// Collect arguments and build argument graph
const arguments = [];
for (const expert of getDynamicExperts(experts)) {
const argument = await collectStatement(expert.id);
const msgId = nextMsgId();
const msg = {
id: msgId,
from: expert.id,
type: "argument",
content: argument,
references: extractReferences(argument), // Parse referenced message IDs
timestamp: new Date().toISOString()
};
arguments.push(msg);
allMessages.push(msg);
// Build argument graph edge
for (const ref of msg.references) {
argumentGraph.push({
from: msgId,
to: ref.targetId,
relation: ref.type // "supports", "counters", "extends", "questions"
});
}
broadcastMessage(teamName, expert.id, argument, experts);
}
// >>> PROGRESS REPORT: Argumentation <<<
reportProgress(3, "Expert Arguments",
arguments.map(a =>
`**${a.from}**: "${a.content.position}" — references: ${a.references.map(r => r.targetId).join(', ') || 'none'}`
).join('\n'),
`${arguments.length} arguments filed with ${argumentGraph.length} cross-references. ` +
`${argumentGraph.filter(e => e.relation === 'counters').length} counterarguments, ` +
`${argumentGraph.filter(e => e.relation === 'supports').length} supporting arguments.`
);
// ========== Step 4: Contrarian Stress Test ==========
// Contrarian targets the STRONGEST consensus, not the weakest argument
const contrarianResponse = await Task({
team_name: teamName,
name: "contrarian",
subagent_type: "general-purpose",
prompt: `
You are the Contrarian.
【Topic】
${roundTopic}
【All Arguments So Far】
${formatMessagesWithIds(allMessages)}
【Argument Graph】
${JSON.stringify(argumentGraph, null, 2)}
【Task】
1. Identify the point where most experts AGREE — this is your primary target
2. Challenge this consensus: What assumption does it rest on? What if that assumption is wrong?
3. Find the WEAKEST evidence cited in support of the consensus
4. Present a concrete scenario where the consensus leads to failure
5. If there's genuine disagreement already, amplify the minority position with new arguments
Do NOT be contrarian for its own sake. Target the most dangerous blind spot.
Reference prior messages by ID when challenging them.
`
});
const contrarianMsgId = nextMsgId();
allMessages.push({
id: contrarianMsgId,
from: "contrarian",
type: "stress_test",
content: contrarianResponse,
references: extractReferences(contrarianResponse),
timestamp: new Date().toISOString()
});
broadcastMessage(teamName, "contrarian", contrarianResponse, experts);
// >>> PROGRESS REPORT: Contrarian Stress Test <<<
reportProgress(4, "Contrarian Stress Test",
`Contrarian targeted the emerging consensus and challenged ${extractReferences(contrarianResponse).length} prior arguments.`,
typeof contrarianResponse === 'string'Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.