Edict: The Complete Guide to Multi-Agent AI Orchestration Inspired by 1,300 Years of Imperial Governance
What if the best framework for managing AI agents wasn't invented in Silicon Valley — but in 7th-century China? Edict (三省六部) takes the Three Departments and Six Ministries system that governed the Tang Dynasty for over 1,300 years and transforms it into a modern multi-agent AI orchestration framework. The result? 12 specialized AI agents with mandatory quality review gates, a real-time Kanban dashboard, full audit trails, and a level of accountability that most AI frameworks simply don't have.
Built on top of the OpenClaw platform, Edict stands apart from frameworks like CrewAI and AutoGen by enforcing institutional oversight — every plan must be reviewed before execution, every task is fully traceable, and every agent has strictly defined responsibilities and communication permissions. With 4,200+ GitHub stars, 331 forks, Docker one-click deployment, and integrations with Feishu, Telegram, and Signal, Edict is gaining serious traction among developers who want their AI agents to be reliable, auditable, and controllable.
Why the Three Departments and Six Ministries?
Most multi-agent AI frameworks follow a simple pattern: "Here are some AI agents, let them talk to each other, and give me the result." This sounds elegant in theory. In practice, you get outputs that are impossible to reproduce, impossible to audit, and impossible to intervene in mid-process.
The Three Departments and Six Ministries (三省六部制) was the core administrative system of imperial China, established during the Sui Dynasty and perfected under the Tang Dynasty. It survived for 1,400 years because of one fundamental design principle: separation of powers with checks and balances.
Here's how Edict maps this ancient system to modern AI orchestration:
You (Emperor) → Taizi (Sorting) → Zhongshu (Planning) → Menxia (Review) → Shangshu (Dispatch) → Six Ministries (Execution) → Report Back
This isn't a cute metaphor — it's a genuine architectural pattern that solves real problems:
- Zhongshu (中书省) creates the plan and breaks it into subtasks
- Menxia (门下省) reviews the plan for quality — and has the power to reject it entirely
- Shangshu (尚书省) dispatches approved tasks to the appropriate ministries
- Six Ministries execute in parallel, each in their own specialized domain
The critical difference from other frameworks is the mandatory review gate. In CrewAI or AutoGen, agents produce output and it's accepted as-is — like a company with no QA department. In Edict, the Menxia Province (门下省) acts as a mandatory quality checkpoint. If the plan isn't good enough, it's sent back for replanning. No exceptions. Emperor Taizong figured this out 1,300 years ago: unchecked power always produces errors.
The 12-Agent Architecture
Edict deploys 12 specialized AI agents organized into a hierarchical structure:
The Three Departments (三省)
| Agent | Chinese Name | Role |
|---|---|---|
| Taizi (太子) | Crown Prince | Message sorting — casual chat gets auto-replied, imperial edicts create tasks |
| Zhongshu (中书省) | Department of State Affairs | Planning hub — receives edicts, creates plans, breaks tasks into subtasks |
| Menxia (门下省) | Chancellery | Review and veto — scrutinizes plans, approves or rejects with feedback |
| Shangshu (尚书省) | Department of State | Dispatch center — distributes approved tasks, coordinates ministries, compiles reports |
The Seven Ministries (七部)
| Agent | Chinese Name | Specialty |
|---|---|---|
| Hubu (户部) | Ministry of Revenue | Data and resource management |
| Libu (礼部) | Ministry of Rites | Documentation and standards |
| Bingbu (兵部) | Ministry of War | Engineering implementation |
| Xingbu (刑部) | Ministry of Justice | Compliance and auditing |
| Gongbu (工部) | Ministry of Works | Infrastructure and DevOps |
| Libu HR (吏部) | Ministry of Personnel | HR and personnel management |
| Zaochao (早朝官) | Morning Court Official | Intelligence and news aggregation |
Key Architectural Properties
- Each agent has its own workspace — isolated memory, tools, and model configuration
- Strict permission matrix — not every agent can communicate with every other agent. Communication paths are defined like bureaucratic reporting lines
- SOUL.md personality files — each agent has a personality definition file (SOUL.md) that defines its role, workflow rules, and data governance standards
- Independent model selection — each agent can use a different LLM (Claude for analysis, GPT for coding, Gemini for visual tasks)
The Military Intelligence Dashboard (军机处看板)
Edict includes a comprehensive real-time dashboard with 10 functional panels:
📋 Kanban Board
- All tasks displayed by status columns
- Ministry filter + full-text search
- Heartbeat badges (🟢 Active, 🟡 Stalled, 🔴 Alert)
- Task details with complete workflow chain
- Stop / Cancel / Resume operations
🔭 Province Monitor
- Visual breakdown of tasks by status
- Department distribution bar charts
- Real-time agent health status cards
📜 Memorial Archive (奏折阁)
- Completed tasks automatically archived as "memorials"
- Five-stage timeline: Edict → Zhongshu → Menxia → Six Ministries → Report
- One-click copy as Markdown
- Status filtering
📜 Edict Template Library (旨库)
- 9 preset edict templates for common tasks
- Category filtering with parameter forms, estimated time and cost
- Preview edict → one-click dispatch
Available templates include: Weekly Report Generation, Code Review, API Design, Competitive Analysis, Data Report, Blog Article, Deployment Plan, Email Copy, and Standup Summary.
👥 Officials Overview
- Token consumption leaderboard
- Activity metrics, completion counts, session statistics
📰 World News
- Daily automated tech/finance news aggregation
- Category subscription management + Feishu push notifications
⚙️ Model Configuration
- Per-agent LLM switching
- Auto-restart Gateway on apply (~5 seconds to take effect)
🛠️ Skills Configuration
- View installed skills per ministry
- Add new skills from the official Skills Hub or custom sources
💬 Sessions Monitor
- Real-time OC-* session monitoring
- Source channel, heartbeat status, message preview
🎬 Morning Court Ceremony
- Daily first-open animation
- Today's statistics summary, auto-dismiss after 3.5 seconds
Getting Started
Docker One-Click Demo
The fastest way to experience Edict is through Docker:
docker run -p 7891:7891 cft0808/sansheng-demo
Open http://localhost:7891 to access the dashboard with pre-loaded demo data.
Note for x86/amd64 machines (Ubuntu, WSL2): If you see
exec format error, use the platform flag:docker run --platform linux/amd64 -p 7891:7891 cft0808/sansheng-demo
Full Installation
Prerequisites:
- OpenClaw installed
- Python 3.9+
- macOS or Linux
git clone https://github.com/cft0808/edict.git
cd edict
chmod +x install.sh && ./install.sh
The install script automatically:
- ✅ Creates all 12 Agent Workspaces (with Taizi, Libu HR, and Zaochao)
- ✅ Writes SOUL.md personality files for each ministry
- ✅ Registers agents and permission matrix to
openclaw.json - ✅ Builds the React frontend (requires Node.js 18+)
- ✅ Initializes data directories and performs first sync
- ✅ Restarts Gateway to apply configuration
Starting the System
# Terminal 1: Data refresh loop (every 15 seconds)
bash scripts/run_loop.sh
# Terminal 2: Dashboard server
python3 dashboard/server.py
# Open browser
open http://127.0.0.1:7891
The dashboard server (server.py) is a zero-dependency Python standard library implementation (~1,200 lines) that serves both the API and the React frontend.
How to Issue an Edict
Natural Language Commands
Send a message to Zhongshu Province via Feishu, Telegram, or Signal:
Design a user registration system with:
1. RESTful API (FastAPI)
2. PostgreSQL database
3. JWT authentication
4. Complete test cases
5. Deployment documentation
Then sit back and watch:
- 📜 Zhongshu receives the edict, plans subtask assignments
- 🔍 Menxia reviews the plan — approves or rejects for replanning
- 📮 Shangshu dispatches to Bingbu (Engineering) + Gongbu (Infrastructure) + Libu (Documentation)
- ⚔️ Ministries execute in parallel — progress visible in real-time
- 📮 Shangshu compiles results and reports back to you
The entire process is visible on the dashboard. You can stop, cancel, or resume any task at any point.
Using Edict Templates
Navigate to the Template Library in the dashboard:
- Select a template (e.g., "Code Review")
- Fill in the parameter form
- Preview the generated edict
- One-click dispatch
Customizing Agents
Edit agents/<id>/SOUL.md to modify any agent's personality, responsibilities, and output specifications. This is how you tailor the system to your specific workflow.
Skills Management
Edict supports extensible skills that can be added to any ministry through three methods:
1. Dashboard UI (Easiest)
Navigate to Skills Configuration → + Add Remote Skill → Enter agent ID, skill name, and GitHub URL → Confirm.
2. CLI Commands (Most Flexible)
# Add code_review skill to Zhongshu from GitHub
python3 scripts/skill_manager.py add-remote \
--agent zhongshu \
--name code_review \
--source https://raw.githubusercontent.com/openclaw-ai/skills-hub/main/code_review/SKILL.md \
--description "Code review skill"
# Import the entire official skills hub
python3 scripts/skill_manager.py import-official-hub \
--agents zhongshu,menxia,shangshu,bingbu,xingbu
# List all remote skills
python3 scripts/skill_manager.py list-remote
3. API Requests (Automation)
curl -X POST http://localhost:7891/api/add-remote-skill \
-H "Content-Type: application/json" \
-d '{
"agentId": "zhongshu",
"skillName": "code_review",
"sourceUrl": "https://raw.githubusercontent.com/...",
"description": "Code review"
}'
The official Skills Hub includes: code_review, api_design, security_audit, data_analysis, doc_generation, and test_framework.
Task Lifecycle and State Machine
Every edict follows a deterministic state machine:
Emperor → Taizi Sorting → Zhongshu Planning → Menxia Review → Dispatched → Executing → Pending Review → ✅ Completed
↑ │
└── Reject ──┘
Blocked
Key states:
- Taizi Sorting — Crown Prince decides if the message is casual chat (auto-reply) or an official edict (create task)
- Zhongshu Planning — Plans are created with subtask breakdowns
- Menxia Review — Plans are approved (准奏) or rejected (封驳) with feedback
- Dispatched — Shangshu has assigned tasks to specific ministries
- Executing — Ministries are working in parallel
- Completed — All subtasks done, results compiled into a "memorial" (奏折)
- Blocked — Task is stuck, requires intervention
The memorial system (奏折阁) automatically archives completed tasks with a five-stage timeline, making it easy to review the full history of any task.
Edict vs Alternatives
Each multi-agent framework has genuine strengths depending on your needs:
| Feature | Edict (三省六部) | CrewAI | AutoGen | LangGraph | MetaGPT |
|---|---|---|---|---|---|
| Quality Review Gate | ✅ Menxia Province | ❌ | ✅ Human-in-loop | ❌ | ✅ Review role |
| Agent Architecture | 12 predefined | ✅ Flexible crews | ✅ Flexible | ✅ Graph-based | Predefined roles |
| Dashboard/Monitoring | ✅ 10 panels | ✅ CrewAI+ | ✅ AutoGen Studio | ✅ LangSmith | ❌ |
| Audit Trails | ✅ Memorial system | Partial | Partial | ✅ Full state graph | Partial |
| Task Control | ✅ Stop/Cancel/Resume | ❌ | ❌ | ✅ Breakpoints | ❌ |
| Per-Agent Model Config | ✅ | Limited | ✅ | ✅ | ✅ |
| Permission Matrix | ✅ Strict | ❌ | ❌ | ✅ Edge-based | ✅ Role-based |
| Docker One-Click | ✅ | ✅ | ✅ | ❌ | ✅ |
| Chat Integration | ✅ Feishu/Telegram/Signal | ❌ | ❌ | ❌ | ❌ |
| Community & Enterprise | 4.2K ⭐ | Large enterprise adoption | Microsoft-backed | LangChain ecosystem | 8K+ ⭐ |
| Documentation | Good | ✅ Excellent | ✅ Excellent | ✅ Excellent | Good |
| Production Readiness | Phase 1 complete | ✅ Production-grade | ✅ Production-grade | ✅ Production-grade | Growing |
When to choose Edict: You need reliable, auditable multi-agent orchestration with mandatory quality gates, a real-time 10-panel dashboard, and chat platform integration — especially if you value the structured oversight model.
When to choose CrewAI: You want a mature, production-ready framework with flexible crew composition, strong enterprise adoption, and a Python-native API that's easy to get started with.
When to choose AutoGen: You need Microsoft-backed, conversation-driven agent collaboration with AutoGen Studio for visual design, strong model flexibility, and human-in-the-loop support.
When to choose LangGraph: You want fine-grained graph-based control over agent state transitions, breakpoints for debugging, full state audit trails, and tight integration with LangChain's massive ecosystem.
When to choose MetaGPT: You need a software-development-focused multi-agent framework with predefined roles (PM, Architect, Engineer), structured output formats, and a built-in review step.
Technical Highlights
- Zero-dependency dashboard server —
server.pyuses only Python standard library (http.server), ~1,200 lines - Zero-dependency frontend —
dashboard.htmlis a single file, ~2,500 lines, works standalone - React 18 frontend — TypeScript + Vite + Zustand, 13 components (optional, Docker includes pre-built)
- File locking — Prevents concurrent write conflicts when multiple agents access shared data
- One-click install —
install.shhandles everything from agent creation to Gateway restart - Data cleaning — Automatic stripping of file paths, metadata, and invalid prefixes from edict titles
- Duplicate protection — Prevents re-creation of existing tasks and protects completed tasks
- End-to-end tests — 17 assertions covering the full pipeline
Roadmap
Phase 1 — Core Architecture ✅
- 12-agent architecture with permission matrix
- 10-panel real-time dashboard
- Task stop/cancel/resume
- Memorial system with five-stage timeline
- 9 edict templates with parameter forms
- Morning court ceremony animation
- World news + Feishu push
- Model hot-switching + skills management
- Officials overview + token consumption stats
- React 18 frontend with TypeScript + Vite + Zustand
- Agent thinking process visualization
Phase 2 — Institutional Deepening 🚧
- Imperial approval mode (manual review + one-click approve/reject)
- Merit/demerit ledger (agent performance scoring)
- Express courier (real-time inter-agent message flow visualization)
- National archives (knowledge base retrieval + citation tracking)
Phase 3 — Ecosystem Expansion
- Docker Compose + demo images
- Notion / Linear adapters
- Annual review (agent annual performance report)
- Mobile adaptation + PWA
- ClawHub marketplace listing
FAQ
What is Edict?
Edict is a multi-agent AI orchestration system built on the OpenClaw platform. It uses the historical Chinese "Three Departments and Six Ministries" (三省六部制) system as its architectural model, providing 12 specialized AI agents with mandatory quality review gates and full audit trails.
How many agents does it have?
12 agents: 1 sorting agent (Taizi), 3 department heads (Zhongshu, Menxia, Shangshu), 7 ministry specialists (Hubu, Libu, Bingbu, Xingbu, Gongbu, Libu HR, Zaochao), plus an optional early-morning intelligence agent.
What makes it different from CrewAI or AutoGen?
The mandatory quality review gate (Menxia Province), the real-time 10-panel dashboard, strict agent communication permissions, full audit trails, and the ability to stop/cancel/resume tasks at any point.
Does it require OpenClaw?
For the full multi-agent orchestration, yes — Edict runs on top of OpenClaw. However, the Docker demo image includes everything needed to explore the dashboard and architecture without installing OpenClaw.
What LLMs does it support?
Any LLM supported by OpenClaw — including Claude, GPT, Gemini, and local models. Each agent can be configured to use a different model.
How do I add custom skills?
Through the dashboard UI, CLI commands (skill_manager.py), or direct API calls. The official Skills Hub provides skills like code review, API design, security audit, and more.
Is it production-ready?
Phase 1 (core architecture) is complete and stable. Phase 2 (institutional deepening) is in progress. The framework is actively maintained with 68 open issues being addressed.
Is it free?
Yes. MIT licensed — free for commercial and personal use.
Conclusion
Edict represents a fundamentally different approach to multi-agent AI orchestration. While most frameworks treat agent collaboration as a free-form conversation, Edict imposes the same institutional structure that governed one of history's most successful civilizations. The mandatory quality review gate (Menxia Province), strict permission matrix, and full audit trail system address the three biggest problems in multi-agent AI: unpredictable outputs, lack of accountability, and inability to intervene.
With 4,200+ GitHub stars, a comprehensive 10-panel dashboard, Docker one-click deployment, and a clear three-phase roadmap, Edict is a compelling choice for teams that need their AI agents to be reliable, traceable, and controllable. The system elegantly proves that when it comes to managing complex collaborative systems — whether human or AI — the ancients had it figured out.
