LLM decision-making frameworks based on centuries-old human institutional patterns
Turn your LLM into a courtroom, peer review panel, red team, design studio, and 22 other battle-tested decision-making systems.
Humans developed sophisticated multi-party reasoning systems over centuries:
- Courts use adversarial evaluation for life-or-death decisions
- Academia uses peer review to validate research
- Military uses red/blue teams to test security
- Medicine uses tumor boards for complex diagnoses
This library implements 26 of these systems as multi-agent LLM frameworks.
# Install
bun install
# Run a framework
bun cli.ts courtroom examples/courtroom/merge-pr.json --verbose
bun cli.ts six-hats examples/six-hats/decision.md
bun cli.ts pre-mortem examples/pre-mortem/launch.md
bun cli.ts war-gaming scenario.json
bun cli.ts writers-workshop manuscript.md
# Or use as MCP server in Claude Code
# See mcp-server/SETUP.md| Framework | Use Case | Agents |
|---|---|---|
| Courtroom | Binary decisions under uncertainty | Prosecutor, Defense, Jury (5), Judge |
| Peer Review | Validation with author response | Reviewers (3), Author, Editor |
| Red-Blue Team | Security stress-testing | Blue (defender), Red (attacker), Observer |
| Pre-mortem | Identify failure modes | Pessimists (5), Facilitator |
| Studio Critique | Creative work feedback | Peers (3), Creator, Instructor |
| Framework | Use Case | Pattern |
|---|---|---|
| Devil's Advocate | Challenge assumptions | Opposition β Rebuttal β Arbiter |
| AAR | Learn from execution | Blameless post-mortem analysis |
| Six Thinking Hats | Multi-perspective analysis | 6 hats examine from different angles |
| PhD Defense | Rigorous validation | Committee (5) probes deeply |
| Architecture Review | System design validation | 5 specialist domains review |
| Framework | Use Case | Key Feature |
|---|---|---|
| Grant Panel | Prioritize under constraints | Comparative scoring + budget allocation |
| Intelligence Analysis | Diagnostic reasoning | Competing hypotheses (CIA method) |
| Delphi | Expert consensus | Anonymous iterative rounds |
| Design Critique | Design feedback | Peers + stakeholders + facilitator |
| Consensus Circle | Unity without voting | Quaker-style blocking concerns |
| Framework | Use Case | Specialty |
|---|---|---|
| Differential Diagnosis | Systematic troubleshooting | Medical diagnostic reasoning |
| Socratic | Test assumptions | Probing questions expose gaps |
| SWOT | Strategic assessment | Internal + External + Strategy synthesis |
| Tumor Board | Multi-specialty decisions | Specialists from 5 domains |
| Parliamentary | Policy discussion | Formal debate structure + vote |
| Framework | Use Case | Origin |
|---|---|---|
| War Gaming | Strategic scenario testing | Military planning |
| Writers' Workshop | Manuscript feedback | Clarion/Clarion West |
| Regulatory Impact | Policy analysis | Government assessment |
| Hegelian Dialectic | Resolve contradictions | Philosophy |
| Talmudic Dialectic | Multi-interpretation | Religious textual analysis |
| Dissertation Committee | Academic validation | Graduate education |
# Basic usage
bun cli.ts <framework> <input-file> [options]
# Examples
bun cli.ts courtroom case.json --verbose
bun cli.ts peer-review paper.md --reviewers 4 --output results.json
bun cli.ts red-blue system.md --rounds 5
bun cli.ts six-hats decision.md
bun cli.ts differential-diagnosis symptoms.json
bun cli.ts war-gaming scenario.json --max-turns 10
bun cli.ts writers-workshop manuscript.md --peer-count 5
# See all options
bun cli.ts --help# Setup
cd mcp-server
bun install
# Configure Claude Code - see mcp-server/SETUP.md
# Now use in Claude Code:
"Use the courtroom framework to decide: Should I merge this PR?"
"Run a pre-mortem on my launch plan"
"Apply six-hats thinking to this architecture decision"
"Simulate a war game for our market entry strategy"Use Institutional Reasoning directly within OpenCode for AI-assisted decision-making:
# In your OpenCode project, the frameworks are available as CLI tools
# Just reference them in your prompts:
"@opencode Run a courtroom evaluation on whether we should refactor this module"
"@opencode Use six-hats to analyze our database migration strategy"
"@opencode Run a pre-mortem on the Q4 product launch plan"Setup:
- Ensure you have an API key set (
ANTHROPIC_API_KEY,OPENAI_API_KEY, orOPENROUTER_API_KEY) - The CLI is automatically available in OpenCode's environment
- Reference any of the 26 frameworks directly in your prompts
Example workflow:
User: "@opencode Should we use TypeScript for this new service?"
OpenCode: "I'll run a courtroom evaluation to analyze this decision..."
[Runs courtroom framework with prosecution/defense/jury]
"Based on the evaluation: The jury voted 4-1 in favor. Key factors..."
See individual framework READMEs in frameworks/<name>/README.md for specific usage patterns and input formats.
import { run as courtroom } from "./frameworks/courtroom";
import { run as sixHats } from "./frameworks/six-hats";
import { run as warGaming } from "./frameworks/war-gaming";
// Run courtroom
const verdict = await courtroom({
question: "Should we migrate to microservices?",
context: [
"Current monolith has scaling issues",
"Team lacks microservices experience"
]
});
// Run six hats
const analysis = await sixHats({
question: "Should we build vs. buy this feature?",
context: "B2B SaaS with 50 customers"
});
// Run war gaming
const simulation = await warGaming({
description: "Market entry against established competitor",
context: ["Competitor has 70% market share", "Our product superior"]
});institutionalized/
βββ cli.ts # Unified CLI
βββ core/ # Shared infrastructure
β βββ orchestrator.ts # Parallel/sequential/iterative execution
β βββ providers.ts # Multi-provider LLM support
β βββ observability.ts # Audit trails & cost tracking
β βββ validators.ts # Common validation patterns
βββ frameworks/ # 26 framework implementations
β βββ courtroom/
β βββ peer-review/
β βββ red-blue/
β βββ war-gaming/
β βββ writers-workshop/
β βββ ... (21 more)
βββ mcp-server/ # MCP integration
βββ test/ # E2E tests for all frameworks
βββ benchmark/ # Performance benchmarks
βββ website/ # Landing page
βββ examples/ # Working examples
Every framework follows this structure:
frameworks/<name>/
βββ types.ts # TypeScript interfaces
βββ index.ts # run() function + orchestration
βββ package.json # Workspace package
βββ README.md # Framework documentation
- β Multi-provider LLM support (Anthropic, OpenAI, OpenRouter)
- β Full audit trails with replay capability
- β Cost tracking per framework run
- β Parallel agent execution
- β JSON extraction from LLM responses
- β Configurable models per role
- β Validation & error handling
- β 100% TypeScript with full type safety
- β 20 E2E test suites covering all frameworks
- β Individual READMEs for every framework
Binary decisions: Courtroom, Devil's Advocate
Validation: Peer Review, PhD Defense, Studio Critique, Dissertation Committee
Risk assessment: Pre-mortem, Red/Blue Team, War Gaming
Diagnosis/troubleshooting: Differential Diagnosis, Intelligence Analysis
Consensus building: Delphi, Consensus Circle, Tumor Board
Creative feedback: Studio Critique, Design Critique, Writers' Workshop
Strategic planning: Six Hats, SWOT, Parliamentary, War Gaming
Learning from execution: AAR, Socratic
Policy analysis: Regulatory Impact, Parliamentary
Philosophical reasoning: Hegelian Dialectic, Talmudic Dialectic, Socratic
Set environment variables or pass via config:
export ANTHROPIC_API_KEY=sk-ant-...
export OPENAI_API_KEY=sk-...
export OPENROUTER_API_KEY=sk-or-...const result = await run(input, {
provider: "anthropic",
config: {
models: {
prosecutor: "claude-3-7-sonnet-20250219",
defense: "claude-3-7-sonnet-20250219",
judge: "claude-3-7-sonnet-20250219"
},
parameters: {
temperature: 0.7,
jurySize: 5
}
},
verbose: true
});- 26 frameworks implemented (100% of catalog)
- Unified CLI
- MCP server integration
- Core infrastructure (orchestration, observability)
- Working examples
- Test suite (20 E2E test suites)
- Comprehensive documentation (26 READMEs)
- CI/CD pipeline
- Performance benchmarks
- Website/landing page
- npm package publication
- Tutorial videos
- OSS release
See CONTRIBUTING.md for guidelines on:
- Adding new frameworks
- Improving existing frameworks
- Writing tests
- Documentation contributions
MIT
Inspired by centuries of human institutional wisdom:
- Legal systems (courtroom)
- Academic publishing (peer review, PhD defense, dissertation committee)
- Military doctrine (red/blue, AAR, war gaming)
- Medical practice (differential diagnosis, tumor boards)
- Religious tradition (consensus circle, Socratic dialogue, Talmudic dialectic)
- Business strategy (SWOT, Delphi, pre-mortem)
- Democratic governance (parliamentary, regulatory impact)
- Philosophy (Hegelian dialectic)
- Creative arts (studio critique, writers' workshop)
ARCHITECTURE.md- Technical deep diveframeworks-catalog.md- All 26 cataloged frameworks with detailed descriptionsmcp-server/SETUP.md- MCP integration guidePROGRESS.md- Implementation progress and milestonesSTATUS.md- Current project statusbenchmark/run-benchmarks.ts- Performance benchmarkingwebsite/index.html- Landing page
Built with Bun + TypeScript
26 frameworks β’ 1 unified interface β’ Infinite possibilities