Content
# Social System Modeling Multi-Agent Framework
## Introduction
A lightweight multi-agent collaboration framework for deriving complete social system models from basic assumptions. Through the collaborative analysis of 7 specialized Agents (Systems/Econ/Socio/Governance/Culture/Risk/Validation), a structured and verifiable social system model is generated.
**Key Features**:
- 🔬 **7 Specialized Agents**: Covering systems thinking, economics, sociology, governance, culture, risk analysis, and validation
- 🔄 **6-Step Workflow**: Hypothesis validation → Parallel reasoning → Conflict alignment → Decision synthesis → Evidence validation → Iterative convergence
- ⚡ **Lightweight Implementation**: TypeScript + Bun, can be directly called by Claude/AI
- 🛠️ **MCP Protocol Support**: Standard Model Context Protocol, seamlessly integrated with Claude Desktop
- 📊 **Structured Output**: 9-layer architecture model (Overall Structure/Workflow/Institutions/Governance/Culture/Innovation/Risk/Metrics/Optimization)
## Quick Start
### Installation
```bash
# Clone the project
git clone <repository-url>
cd SocialGuessSkills
# Install dependencies
bun install
```
### Run Example
```bash
# Run end-to-end example (community governance model)
bun run examples/run-example.ts
```
**Expected Output**:
- Iterations: 2
- Confidence: 0.79
- Agent Output Count: 7 (each Agent generates analysis)
- Conflicts: 7 (logical contradictions, priority conflicts, risk superposition)
### MCP Integration (Recommended)
**Configure in Claude Desktop**:
1. Edit `claude_desktop_config.json`:
```json
{
"mcpServers": {
"social-modeling": {
"command": "bun",
"args": ["run", "/absolute/path/to/src/server.ts"]
}
}
}
```
2. Restart Claude Desktop
3. Use in Claude:
```
Please help me analyze: a community of 1000 people with limited resources. How to establish a stable and cooperative social system?
```
Claude will automatically call the MCP Server to generate a complete social system model.
**📖 Detailed Integration Guide**: See [docs/MCP_INTEGRATION.md](docs/MCP_INTEGRATION.md) for:
- Complete Claude Desktop configuration steps
- OpenCode CLI integration status
- Troubleshooting guide
- More usage examples and Prompt templates
## Usage Examples
### 1. Full Reasoning (reasoning tool)
**Input**:
```json
{
"hypothesis": {
"assumptions": [
"Community of 1000 people, limited resources (food, housing, tools)",
"Collaboration can increase total output by 30%",
"No external intervention, isolated environment"
],
"constraints": [
"Communication cost: face-to-face communication is free, indirect communication has attenuation",
"Incomplete information: individuals only know the status of the nearest 50 people"
],
"goals": [
"Ensure basic survival for everyone (food, shelter)",
"Establish a sustainable resource production and distribution mechanism",
"Conflict resolution mechanism is enforceable"
]
},
"maxIterations": 3
}
```
**Output**: Complete social system model, including:
- Analysis from 7 Agents (conclusions/evidence/risks/recommendations/falsifiable points)
- Detected conflicts (type/description/severity/solution)
- 9-layer structured model (Overall Structure/Workflow/Institutions/Governance/Culture/Innovation/Risk/Metrics/Optimization)
- Metadata (iterations/confidence/generation time)
### 2. Single Agent Query (query_agent tool)
**Input**:
```json
{
"agentType": "risk",
"hypothesis": {
"assumptions": ["Resource scarcity", "Limited rationality"],
"constraints": [],
"goals": ["Stable order"]
}
}
```
**Output**: Professional analysis from the Risk Agent, focusing on vulnerabilities, extreme scenarios, and resilience strategies.
### 3. Model Validation (validate_model tool)
**Input**:
```json
{
"modelJson": "{...complete model JSON string...}"
}
```
**Output**: Validation results, including:
- isValid: Whether the validation passed
- checks: Detailed checks (hasAllAgents, hasStructure, hasHypothesis, etc.)
- issues: List of discovered issues
- warnings: Warning messages (such as too many conflicts, low confidence)
## Architecture Overview
```
┌─────────────────────────────────────────────────────┐
│ User Input Hypothesis │
│ (assumptions/constraints/goals) │
└──────────────────────┬──────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ 1. Hypothesis Validation (Systems Agent) │
│ - Check structural integrity, identify key variables │
└──────────────────────┬──────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ 2. Parallel Agent Reasoning (7 Agents) │
│ ┌────────┐ ┌────────┐ ┌────────┐ ┌───────┐ │
│ │Systems │ │ Econ │ │ Socio │ │Govern │ │
│ │ Agent │ │ Agent │ │ Agent │ │ Agent │ │
│ └────────┘ └────────┘ └────────┘ └───────┘ │
│ ┌────────┐ ┌────────┐ │
│ │Culture │ │ Risk │ │
│ │ Agent │ │ Agent │ │
│ └────────┘ └────────┘ │
└──────────────────────┬──────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ 3. Conflict Alignment (Risk Agent Lead) │
│ - Detect logical contradictions, priority conflicts, risk superposition │
│ - Mark Agents that need to be re-reasoned │
└──────────────────────┬──────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ 4. Decision Synthesis (Governance Agent Lead) │
│ - Apply decision synthesis rules: hierarchical weighting, conflict priority │
│ - Extract 9-layer structured model │
└──────────────────────┬──────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ 5. Evidence Validation (Validation Agent) │
│ - Falsifiable hypothesis testing, historical case comparison, counterfactual reasoning │
└──────────────────────┬──────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ 6. Iterative Convergence (Return to Step 2 if Conflicts Exist) │
│ - Maximum Iterations: 3 (configurable) │
│ - Termination Condition: No New Conflicts OR Maximum Iterations Reached │
└──────────────────────┬──────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ Final Social System Model │
│ - Agent Outputs (7) │
│ - Conflict List │
│ - 9-Layer Structured Model │
│ - Metadata (Iterations/Confidence/Time) │
└─────────────────────────────────────────────────────┘
```
## API Reference
### Tool 1: reasoning
Complete reasoning process, from hypothesis to complete model.
**Input**:
```json
{
"hypothesis": {
"assumptions": ["Assumption 1", "Assumption 2"],
"constraints": ["Constraint 1", "Constraint 2"],
"goals": ["Goal 1", "Goal 2"]
},
"maxIterations": 3
}
```
**Output**:
```json
{
"hypothesis": {...},
"agentOutputs": [...],
"conflicts": [...],
"structure": {
"overall": {...},
"workflow": {...},
"institutions": {...},
"governance": {...},
"culture": {...},
"innovation": {...},
"risks": {...},
"metrics": {...},
"optimization": {...}
},
"metadata": {
"iterations": 2,
"confidence": 0.79,
"generatedAt": "2026-02-03T14:30:00Z"
}
}
```
### Tool 2: query_agent
Query the analysis of a single Agent.
**Input**:
```json
{
"agentType": "systems|econ|socio|governance|culture|risk|validation",
"hypothesis": {...}
}
```
**Output**: Complete analysis of a single Agent (conclusions/evidence/risks/recommendations/falsifiable points)
### Tool 3: validate_model
Validate the consistency of an existing model.
**Input**:
```json
{
"modelJson": "{...model JSON string...}"
}
```
**Output**:
```json
{
"isValid": true,
"checks": {
"hasAllAgents": true,
"hasStructure": true,
"hasHypothesis": true,
"hasMetadata": true,
"agentTypesAreValid": true
},
"issues": [],
"warnings": []
}
```
## Extension Guide
### Customize Agent Prompt
1. Edit `src/agents/prompts/{agent}-agent.md`
2. Follow the unified format:
- `## Role Definition`
- `## Core Responsibilities`
- `## Analysis Framework`
- `## Output Format` (CRITICAL)
- `## Key Constraints`
3. No restart required after modification, AI will automatically load the latest Prompt
### Add a New Agent Type
1. Add a new AgentType in `src/types.ts`
2. Create `src/agents/prompts/{new-agent}-agent.md`
3. Register in `createAllAgents()` in `src/agents/agent-factory.ts`
4. Add corresponding test cases
### Customize Conflict Detection Rules
Add a new detection function in `src/workflow/conflict-resolver.ts`:
```typescript
function detectCustomConflict(outputs: AgentOutput[]): Conflict[] {
const conflicts: Conflict[] = [];
// Your detection logic
return conflicts;
}
```
Then call the new function in `detectConflicts()`.
## Project Structure
```
SocialGuessSkills/
├── src/
│ ├── agents/
│ │ ├── prompts/ # Prompt templates for 7 Agents
│ │ ├── agent-factory.ts # Agent factory
│ │ └── agent-executor.ts # Agent executor
│ ├── workflow/
│ │ ├── orchestrator.ts # Workflow orchestrator
│ │ └── conflict-resolver.ts # Conflict detection
│ ├── types.ts # Core type definitions
│ ├── server.ts # MCP Server entry point
│ └── __tests__/ # Test cases
├── examples/
│ ├── community-governance.json # Example input
│ └── run-example.ts # Example execution script
├── package.json
├── tsconfig.json
└── README.md
```
## Testing
Run all tests:
```bash
bun test
```
Test coverage:
- Agent Prompt file integrity
- Agent factory and execution
- Conflict detection (3 types of rules)
- Workflow orchestrator (6-step process)
- End-to-end example
- Execution time benchmark (<60 seconds)
## Contribution
Contributions are welcome! Please follow:
1. Fork the project
2. Create a feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit changes (`git commit -m 'feat: Add AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Create a Pull Request
**Commit Specifications**:
- `feat:` New feature
- `fix:` Bug fix
- `docs:` Documentation update
- `refactor:` Code refactoring
- `test:` Test related
## License
MIT
## Contact Information
- Issue Feedback: GitHub Issues
- Discussion and Communication: GitHub Discussions
MCP Config
Below is the configuration for this MCP Server. You can copy it directly to Cursor or other MCP clients.
mcp.json
Connection Info
You Might Also Like
firecrawl
Firecrawl MCP Server enables web scraping, crawling, and content extraction.
Filesystem
Node.js MCP Server for filesystem operations with dynamic access control.
Sequential Thinking
A structured MCP server for dynamic problem-solving and reflective thinking.
Fetch
Retrieve and process content from web pages by converting HTML into markdown format.
context7-mcp
Context7 MCP Server provides natural language access to documentation for...
Context 7
Context7 MCP provides up-to-date code documentation for any prompt.