I modeled an AI multi-agent system after China's 1,300-year-old imperial governance.
Turns out, ancient bureaucracy understood separation of powers better than modern AI frameworks.
12 AI agents (11 business roles + 1 compatibility role) form the Three Departments & Six Ministries: Crown Prince triages, Planning proposes, Review vetoes, Dispatch assigns, Ministries execute.
Built-in institutional review gates that CrewAI doesn't have. A real-time dashboard that AutoGen doesn't have.
๐ฌ Demo ยท ๐ Quick Start ยท ๐๏ธ Architecture ยท ๐ Features ยท ไธญๆ ยท ๆฅๆฌ่ช ยท Contributing
๐ฅ Full demo: AI Multi-Agent collaboration with Three Departments & Six Ministries
๐ธ GIF Preview (loads faster)
Issue edict โ Crown Prince triage โ Planning โ Review โ Ministries execute โ Report back (30s)
๐ณ No OpenClaw? Run
docker run -p 7891:7891 cft0808/edictto try the full dashboard with simulated data.
Most multi-agent frameworks let AI agents talk freely, producing opaque results you can't audit or intervene in. Edict takes a radically different approach โ borrowing the governance system that ran China for 1,400 years:
You (Emperor) โ Crown Prince (Triage) โ Planning Dept โ Review Dept โ Dispatch Dept โ 6 Ministries โ Report Back
็ไธ ๅคชๅญ ไธญไนฆ็ ้จไธ็ ๅฐไนฆ็ ๅ
ญ้จ ๅๅฅ
This isn't a cute metaphor. It's real separation of powers for AI:
- Crown Prince (ๅคชๅญ) triages messages โ casual chat gets auto-replied, real commands become tasks
- Planning (ไธญไนฆ็) breaks your command into actionable sub-tasks
- Review (้จไธ็) audits the plan โ can reject and force re-planning
- Dispatch (ๅฐไนฆ็) assigns approved tasks to specialist ministries
- 7 Ministries execute in parallel, each with distinct expertise
- Data sanitization auto-strips file paths, metadata, and junk from task titles
- Everything flows through a real-time dashboard you can monitor and intervene
"Instead of one AI doing everything wrong, 9 specialized agents check each other's work."
| CrewAI | MetaGPT | AutoGen | Edict | |
|---|---|---|---|---|
| Built-in review/veto | โ | โ Dedicated reviewer | ||
| Real-time Kanban | โ | โ | โ | โ 10-panel dashboard |
| Task intervention | โ | โ | โ | โ Stop / Cancel / Resume |
| Full audit trail | โ | โ Memorial archive | ||
| Agent health monitoring | โ | โ | โ | โ Heartbeat detection |
| Hot-swap LLM models | โ | โ | โ | โ From the dashboard |
| Skill management | โ | โ | โ | โ View / Add skills |
| News aggregation | โ | โ | โ | โ Daily digest + webhook |
| Setup complexity | Med | High | Med | Low ยท One-click / Docker |
Core differentiator: Institutional review + Full observability + Real-time intervention
๐ Why the "Review Department" is the killer feature (click to expand)
CrewAI and AutoGen agents work in a "done, ship it" mode โ no one checks output quality. It's like a company with no QA department where engineers push code straight to production.
Edict's Review Department (้จไธ็) exists specifically for this:
- ๐ Audit plan quality โ Is the Planning Department's decomposition complete and sound?
- ๐ซ Veto subpar output โ Not a warning. A hard reject that forces re-planning.
- ๐ Mandatory rework loop โ Nothing passes until it meets standards.
This isn't an optional plugin โ it's part of the architecture. Every command must pass through Review. No exceptions.
This is why Edict produces reliable results on complex tasks: there's a mandatory quality gate before anything reaches execution. Emperor Taizong figured this out 1,300 years ago โ unchecked power inevitably produces errors.
- Crown Prince (ๅคชๅญ) message triage โ auto-reply casual chat, create tasks for real commands
- Three Departments (Planning ยท Review ยท Dispatch) for governance
- Seven Ministries (Finance ยท Docs ยท Engineering ยท Compliance ยท Infrastructure ยท HR + Briefing) for execution
- Strict permission matrix โ who can message whom is enforced
- Each agent: own workspace, own skills, own LLM model
- Data sanitization โ auto-strips file paths, metadata, invalid prefixes from titles/remarks
| Panel | Description |
|---|---|
| ๐ Edicts Kanban | Task cards by state, filters, search, heartbeat badges, stop/cancel/resume |
| ๐ญ Department Monitor | Pipeline visualization, distribution charts, health cards |
| ๐ Memorial Archive | Auto-generated archives with 5-phase timeline |
| ๐ Edict Templates | 9 presets with parameter forms, cost estimates, one-click dispatch |
| ๐ฅ Officials Overview | Token leaderboard, activity stats |
| ๐ฐ Daily Briefing | Auto-curated news, subscription management, Feishu push |
| โ๏ธ Model Config | Per-agent LLM switching, automatic Gateway restart |
| ๐ ๏ธ Skills Config | View installed skills, add new ones |
| ๐ฌ Sessions | Live session monitoring with channel labels |
| ๐ฌ Court Ceremony | Immersive daily opening animation with stats |
๐ธ More screenshots
docker run -p 7891:7891 cft0808/edictPrerequisites: OpenClaw ยท Python 3.9+ ยท macOS/Linux
git clone https://github.com/cft0808/edict.git
cd edict
chmod +x install.sh && ./install.shThe installer automatically:
- Creates workspaces for all departments (
~/.openclaw/workspace-*, including Crown Prince/HR/Briefing) - Writes SOUL.md personality files for each department
- Registers agents + permission matrix in
openclaw.json - Initializes data directory + first sync
- Restarts Gateway
# Option 1: One-click launch (recommended)
chmod +x start.sh && ./start.sh
# Option 2: Manual launch
bash scripts/run_loop.sh & # Data sync loop
python3 dashboard/server.py # Dashboard server
# Open browser
open http://127.0.0.1:7891๐ฅ๏ธ Production deployment (systemd)
# Install systemd service
sudo cp edict.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable edict
sudo systemctl start edict
# Or use management script
bash edict.sh start # Start
bash edict.sh status # Check status
bash edict.sh restart # Restart
bash edict.sh stop # Stop๐ See Getting Started Guide for detailed walkthrough.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ Emperor (You) โ
โ Feishu ยท Telegram ยท Signal โ
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโ
โ Issue edict
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโ
โ ๐ Crown Prince (ๅคชๅญ) โ
โ Triage: chat โ reply / cmd โ task โ
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโ
โ Forward edict
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโ
โ ๐ Planning Dept (ไธญไนฆ็) โ
โ Receive โ Plan โ Decompose โ
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโ
โ Submit for review
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโ
โ ๐ Review Dept (้จไธ็) โ
โ Audit โ Approve / Reject ๐ซ โ
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโ
โ Approved โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโ
โ ๐ฎ Dispatch Dept (ๅฐไนฆ็) โ
โ Assign โ Coordinate โ Collect โ
โโโโโฌโโโโโโโฌโโโโโโโฌโโโโโโโฌโโโโโโโฌโโโโ
โ โ โ โ โ
โโโโโโโผโ โโโโโผโโโโ โโผโโโโโโ โโโโโผโโ โโผโโโโโโ
โ๐ฐ Fin.โ โ๐ Docsโ โโ๏ธ Eng.โ โโ๏ธ Lawโ โ๐ง Opsโ
โ ๆท้จ โ โ ็คผ้จ โ โ ๅ
ต้จ โ โ ๅ้จ โ โ ๅทฅ้จ โ
โโโโโโโโ โโโโโโโโ โโโโโโโโ โโโโโโโ โโโโโโโโ
โโโโโโโโ
โ๐ HR โ
โ ๅ้จ โ
โโโโโโโโ
| Dept | Agent ID | Role | Expertise |
|---|---|---|---|
| ๐ Crown Prince | taizi |
Triage, summarize | Chat detection, intent extraction |
| ๐ Planning | zhongshu |
Receive, plan, decompose | Requirements, architecture |
| ๐ Review | menxia |
Audit, gatekeep, veto | Quality, risk, standards |
| ๐ฎ Dispatch | shangshu |
Assign, coordinate, collect | Scheduling, tracking |
| ๐ฐ Finance | hubu |
Data, resources, accounting | Data processing, reports |
| ๐ Documentation | libu |
Docs, standards, reports | Tech writing, API docs |
| โ๏ธ Engineering | bingbu |
Code, algorithms, checks | Development, code review |
| โ๏ธ Compliance | xingbu |
Security, compliance, audit | Security scanning |
| ๐ง Infrastructure | gongbu |
CI/CD, deploy, tooling | Docker, pipelines |
| ๐ HR | libu_hr |
Agent management, training | Registration, permissions |
| ๐ Briefing | zaochao |
Daily briefing, news | Scheduled reports, summaries |
| From โ \ To โ | Prince | Planning | Review | Dispatch | Ministries |
|---|---|---|---|---|---|
| Crown Prince | โ | โ | |||
| Planning | โ | โ | โ | โ | |
| Review | โ | โ | โ | ||
| Dispatch | โ | โ | โ | โ all | |
| Ministries | โ |
Emperor โ Prince Triage โ Planning โ Review โ Assigned โ Executing โ โ
Done
โ โ โ
โโโ Veto โโโ Blocked โโ
edict/
โโโ agents/ # 12 agent personality templates (SOUL.md)
โ โโโ taizi/ # Crown Prince (triage)
โ โโโ zhongshu/ # Planning Dept
โ โโโ menxia/ # Review Dept
โ โโโ shangshu/ # Dispatch Dept
โ โโโ hubu/ libu/ bingbu/ # Finance / Docs / Engineering
โ โโโ xingbu/ gongbu/ # Compliance / Infrastructure
โ โโโ libu_hr/ # HR Dept
โ โโโ zaochao/ # Morning Briefing
โโโ dashboard/
โ โโโ dashboard.html # Dashboard (single file, zero deps, works out of the box)
โ โโโ dist/ # Pre-built React frontend (included in Docker image)
โ โโโ auth.py # Dashboard login authentication
โ โโโ court_discuss.py # Court discussion (multi-agent LLM debate engine)
โ โโโ server.py # API server (stdlib, zero deps)
โโโ edict/backend/ # Async backend services (SQLAlchemy + Redis)
โ โโโ app/models/
โ โ โโโ task.py # Task model + state machine
โ โ โโโ audit.py # Audit log model
โ โ โโโ outbox.py # Outbox message model
โ โโโ app/services/
โ โ โโโ event_bus.py # Redis Streams EventBus
โ โ โโโ task_service.py # Task service layer
โ โโโ app/workers/
โ โโโ dispatch_worker.py # Parallel dispatch + retry + resource lock
โ โโโ orchestrator_worker.py # DAG orchestrator
โ โโโ outbox_relay.py # Transactional Outbox Relay
โโโ agents/
โ โโโ <agent_id>/SOUL.md # Agent personality templates
โ โโโ GLOBAL.md # Global agent config
โ โโโ groups/ # Agent groups (sansheng / liubu)
โโโ scripts/ # Data sync & automation scripts
โ โโโ kanban_update.py # Kanban CLI with data sanitization + state machine
โ โโโ agentrec_advisor.py # Agent model recommendation (merit + cost optimization)
โ โโโ linucb_router.py # LinUCB smart routing
โ โโโ refresh_watcher.py # Data change watcher
โ โโโ ... # fetch_morning_news, sync, etc.
โโโ tests/
โ โโโ test_e2e_kanban.py # Kanban sanitization tests (17 assertions)
โ โโโ test_state_machine_consistency.py # State machine consistency tests
โโโ data/ # Runtime data (gitignored)
โโโ docs/ # Documentation + screenshots
โโโ install.sh # One-click installer
โโโ start.sh # One-click launch (Dashboard + data sync)
โโโ edict.service # systemd service config (production deploy)
โโโ edict.sh # Service management (start/stop/restart/status)
โโโ LICENSE # MIT
| React 18 Frontend | TypeScript + Vite + Zustand, 13 components |
| stdlib Backend | server.py on http.server, zero dependencies |
| EventBus | Redis Streams pub/sub for decoupled service communication |
| Outbox Relay | Transactional outbox pattern for reliable event delivery (at-least-once) |
| State Machine Audit | Strict lifecycle transitions + full audit logging (audit.py) |
| Parallel Dispatch | Dispatch Worker with parallel execution, exponential backoff retry, resource locking |
| DAG Orchestrator | Task decomposition and dependency resolution via DAG |
| Agent Thinking Visible | Real-time display of agent thinking, tool calls, results |
| One-click Install / Launch | install.sh auto-configures, start.sh launches all services |
| systemd Production Deploy | edict.service for daemon process, auto-restart on boot |
| 15s Auto-sync | Live data refresh with countdown |
| Dashboard Auth | auth.py provides login authentication |
| Daily Ceremony | Immersive opening animation |
Full roadmap with contribution opportunities: ROADMAP.md
- Twelve-department agent architecture + permissions
- Crown Prince triage layer (chat vs task auto-routing)
- Real-time dashboard (10 panels)
- Task stop / cancel / resume
- Memorial archive (5-phase timeline)
- Edict template library (9 presets)
- Court ceremony animation
- Daily news + Feishu webhook push
- Hot-swap LLM models + skill management
- Officials overview + token stats
- Session monitoring
- Edict data sanitization (title/remark cleaning, dirty data rejection)
- Duplicate task overwrite protection
- E2E kanban tests (17 assertions)
- Imperial approval mode (human-in-the-loop)
- Merit/demerit ledger (agent scoring + model recommendation + cost optimization)
- EventBus (Redis Streams decoupled communication)
- Outbox Relay (transactional event delivery)
- State machine audit (strict lifecycle + audit logging)
- Parallel dispatch engine (exponential backoff retry + resource lock)
- DAG orchestrator (task decomposition + dependency resolution)
- Dashboard authentication (login auth)
- One-click launch / systemd production deploy
- Express courier (inter-agent message visualization)
- Imperial Archives (knowledge base + citation)
- Docker Compose + demo image
- Notion / Linear adapters
- Annual review (yearly performance reports)
- Mobile responsive + PWA
- ClawHub marketplace listing
All contributions welcome! See CONTRIBUTING.md
- ๐จ UI โ themes, responsiveness, animations
- ๐ค New agents โ specialized roles
- ๐ฆ Skills โ ministry-specific packages
- ๐ Integrations โ Notion ยท Jira ยท Linear ยท GitHub Issues
- ๐ i18n โ Japanese ยท Korean ยท Spanish
- ๐ฑ Mobile โ responsive, PWA
The examples/ directory contains real end-to-end use cases:
| Example | Command | Departments |
|---|---|---|
| Competitive Analysis | "Analyze CrewAI vs AutoGen vs LangGraph" | PlanningโReviewโFinance+Engineering+Docs |
| Code Review | "Review this FastAPI code for security issues" | PlanningโReviewโEngineering+Compliance |
| Weekly Report | "Generate this week's engineering team report" | PlanningโReviewโFinance+Docs |
Each case includes: Full command โ Planning proposal โ Review feedback โ Ministry outputs โ Final report.
MIT ยท Built by the OpenClaw community
In ancient China, the โDวbร oโ (imperial gazette) delivered edicts across the empire. Today we have a WeChat account.
What youโll find:
- ๐๏ธ Architecture deep-dives โ how 12 agents achieve separation of powers
- ๐ฅ War stories โ when agents fight, burn tokens, or go on strike
- ๐ก Token-saving tricks โ run the full pipeline at 1/10 the cost
- ๐ญ Behind the SOUL.md โ how to write prompts that make AI agents stay in character
โ๏ธ Governing AI with the wisdom of ancient empires
ไปฅๅคๅถๅพกๆฐๆ๏ผไปฅๆบๆ
ง้ฉพ้ฉญ AI











