中文版 | 🏢 Corporate Edition: Become CEO
Modeled after the Ming Dynasty's Three Departments and Six Ministries (三省六部制), built on the OpenClaw framework. One server + OpenClaw = A 24/7 AI imperial court at your command.
AI Court is a ready-to-use multi-AI-agent collaboration system that maps China's ancient Three Departments and Six Ministries (中书省 Zhongshu · 门下省 Menxia · 尚书省 Shangshu → 吏部 Personnel · 户部 Revenue · 礼部 Rites · 兵部 War · 刑部 Justice · 工部 Works) onto a modern AI agent organization.
In plain terms: You are the Emperor 👑, and AI agents are your ministers. Each minister has a clear role — one writes code, one manages finances, one handles marketing, one runs DevOps — all you do is issue an "imperial decree" (@mention an agent in Discord), and they execute immediately.
The Three Departments and Six Ministries system was one of the longest-running organizational frameworks in human history (Sui/Tang to Qing dynasty, over 1,300 years). Its core design principles:
These concepts map perfectly to modern multi-agent system design needs. Ancient governance wisdom is the best practice for modern AI team management.
| Capability | Description |
|---|---|
| 🤖 Multi-Agent Collaboration | 7 independent AI Agents (Six Ministries + Chief Steward), each specialized, working in concert |
| 🧠 Independent Memory | Each agent has its own workspace and memory files — the more you use it, the better it knows you |
| 🛠️ 60+ Built-in Skills | GitHub, Notion, Browser, Cron, TTS and more, ready out of the box |
| ⏰ Automated Tasks | Cron scheduling + heartbeat self-checks, 24/7 unattended operation |
| 🔒 Sandbox Isolation | Docker container isolation, agent code runs independently |
| 💬 Native Discord | Works on phone & desktop, @mention to invoke, zero learning curve |
| 🖥️ Web Dashboard | React + TypeScript dashboard for visual management |
| 🌐 OpenClaw Ecosystem | Built on OpenClaw, access the OpenClaw Hub Skill ecosystem |
If you're more familiar with modern corporate management concepts, we have an English corporate version:
👉 Become CEO — Same architecture, using CEO / CTO / CFO / CMO roles instead of imperial ministries
| 🏛️ Court Role | 🏢 Corporate Role | Responsibility |
|---|---|---|
| Emperor 👑 | CEO | Ultimate decision maker |
| 司礼监 Chief Steward | COO | Daily coordination, task delegation |
| 兵部 War Ministry | CTO / VP Engineering | Software engineering, architecture |
| 户部 Revenue Ministry | CFO / VP Finance | Financial analysis, cost management |
| 礼部 Rites Ministry | CMO / VP Marketing | Brand marketing, content strategy |
| 工部 Works Ministry | VP Infra / SRE | DevOps, infrastructure |
| 吏部 Personnel Ministry | VP Product / PMO | Project management, team coordination |
| 刑部 Justice Ministry | General Counsel | Legal compliance, contract review |
💡 Both projects are built on the same OpenClaw framework with identical architecture — only the role names and cultural context differ. Pick the style you prefer!

📌 About Originality — This project was first committed on 2026-02-22 (commit history) and represents the original implementation of the concept "modeling AI multi-agent collaboration after China's imperial court system." We noticed that cft0808/edict (first committed 2026-02-23, approximately 21 hours later) shares striking similarities with this project in framework selection, SOUL.md persona files, install.sh deployment approach, and competitor comparison tables — see Issue #55 for details.
Reposts welcome — please credit the source.
📕 Original Xiaohongshu series: Day 3 of Being an AI Emperor — I'm Already Hooked | Life of a Cyber Emperor: Give Orders Before Bed, AI Cranks Out Code Overnight
| ChatGPT & Web UIs | AutoGPT / CrewAI / MetaGPT | AI Court (This Project) | |
|---|---|---|---|
| Multi-agent collaboration | ❌ Single generalist | ✅ Requires Python orchestration | ✅ Config files only, zero code |
| Persistent memory | ⚠️ Single shared memory | ⚠️ BYO vector database | ✅ Each agent has its own workspace + memory files |
| Tool integrations | ⚠️ Limited plugins | ⚠️ Build your own | ✅ 60+ built-in Skills (GitHub / Notion / Browser / Cron …) |
| Interface | Web | CLI / Self-hosted UI | ✅ Native Discord (works on phone & desktop) |
| Deployment difficulty | No deployment needed | Docker + coding required | ✅ One-line script, up in 5 minutes |
| 24h availability | ❌ Manual conversations only | ✅ | ✅ Cron jobs + heartbeat self-checks |
| Organizational metaphor | ❌ None | ❌ None | ✅ Six Ministries system, clear separation of duties |
| Framework ecosystem | Closed | Build your own | ✅ OpenClaw Hub Skill ecosystem |
The key advantage: it's not a framework — it's a finished product. Run a script, start chatting in Discord by @mentioning your agents.
┌───────────────────────────┐ │ 👑 Emperor (You) │ │ Discord / Web UI │ └─────────────┬─────────────┘ │ Imperial Decree (@mention) ▼ ┌──────────────────────────────────────┐ │ OpenClaw Gateway (Zhongshu Province)│ │ Node.js Daemon │ │ ┌────────────────────────────────┐ │ │ │ 📨 Message Routing (Menxia) │ │ │ │ @mention → match → dispatch │ │ │ │ Session isolation · Auto-Thread │ │ │ │ Cron scheduling · Heartbeat │ │ │ └────────────────────────────────┘ │ └───┬────┬────┬────┬────┬────┬─────────┘ │ │ │ │ │ │ ┌────────────┘ │ │ │ │ └────────────┐ ▼ ▼ ▼ ▼ ▼ ▼ ┌──────────┐ ┌──────┐ ┌────┐ ┌────┐ ┌──────┐ ┌──────────┐ │ Steward │ │ War │ │Rev.│ │Rite│ │Works │ │ Justice │ │ 司礼监 │ │ 兵部 │ │户部│ │礼部│ │ 工部 │ │ 刑部 │ │Scheduler │ │Code │ │$$$│ │Mktg│ │DevOps│ │ Legal │ └──────────┘ └──────┘ └────┘ └────┘ └──────┘ └──────────┘ │ │ │ │ │ │ └──────────┴───────┴──────┴───────┴────────────┘ │ ┌──────────────┴──────────────┐ │ Shangshu Province (Exec) │ │ 60+ Built-in Skills │ │ GitHub · Notion · Browser │ │ Cron · TTS · Screenshot │ │ OpenClaw Hub Extensions │ └──────────────────────────────┘
Each agent is a standalone Discord Bot bound to its own AI identity:
memory/ directory — the more you use it, the better it knows your projects👑 Emperor: @bingbu Write me a user login REST API with Node.js + Express 🏛️ 兵部 bingbu: As Your Majesty commands. I'll get to work immediately. 📁 Created auth-api/ project structure ✅ POST /api/login — JWT authentication ✅ POST /api/register — User registration ✅ middleware/auth.js — Token verification middleware ✅ Pushed to GitHub: wanikua/auth-api#1 The work is complete. Please review, Your Majesty. 👑 Emperor: @hubu How much did we spend on APIs this month? 🏛️ 户部 hubu: Your Majesty, here is this month's API expenditure: 💰 Total: $23.47 ├── 兵部 bingbu (Power Model): $15.20 (142 coding tasks) ├── 礼部 libu (Fast Model): $3.80 (89 copywriting tasks) ├── 司礼监 silijian (Fast Model): $2.12 (203 daily conversations) └── Others: $2.35 📊 Down 12% month-over-month, mainly due to bingbu optimizing prompt length. 👑 Emperor: @libu Write a Xiaohongshu post recommending AI tool setups 🏛️ 礼部 libu: As you wish! Here's the copy: 📝 Title: "Regular People Can Be AI Emperors? I Manage My Whole Team with 6 AIs" Body: Still chatting with AI one conversation at a time? I built an entire AI court... 🏷️ #AITools #Productivity #MultiAgent #AICourt #SixMinistries 👑 Emperor: @everyone Meeting tomorrow at 3 PM — all departments prepare weekly reports 🏛️ 司礼监: As commanded. Meeting scheduled. 🏛️ 兵部: Acknowledged. Will compile this week's code output. 🏛️ 户部: Acknowledged. Will prepare financial statements. 🏛️ 礼部: Acknowledged. Will summarize marketing metrics. 🏛️ 工部: Acknowledged. Will prepare server status report.
| Scenario | Description | Departments Involved |
|---|---|---|
| 🚀 Solo Developer | One person, complete tech team — coding + DevOps + marketing covered | 兵部 + 工部 + 礼部 |
| 🏫 Student Learning | AI tutor team — different subjects, different agents, each with memory | All Six customizable |
| 🏢 Startup Team | Low-cost AI assistant matrix covering product, tech, and operations | All Six Ministries |
| 📱 Content Creator | Content creation + data analytics + finance management all-in-one | 礼部 + 户部 |
| 🔬 Research Project | Literature search + code experiments + paper writing | 兵部 + 礼部 |
| 🎮 AI Experiments | Agent-to-agent conversations, simulated court sessions | All Six Ministries |
Grab a Linux server and SSH in. Recommended providers:
| Provider | Config | Cost |
|---|---|---|
| Alibaba Cloud | ECS 2C4G / ARM | Free trial / from ¥40/mo |
| Tencent Cloud | Lighthouse 2C4G | Free trial / from ¥40/mo |
| Huawei Cloud | HECS 2C4G | Free trial |
| AWS | t4g.medium (ARM) | Free Tier 12 months |
| GCP | e2-medium | Free Trial 90 days |
| Oracle Cloud | ARM 4C24G | Always Free |
| Local Mac | M1/M2/M3/M4 | No server needed |
Then run:
bash <(curl -fsSL https://raw.githubusercontent.com/wanikua/boluobobo-ai-court-tutorial/main/install.sh)
The script automatically handles:
The install script features color-coded output with progress indicators and ✓ success markers for each step.
💡 Already have OpenClaw/Clawdbot installed? Use the lite script — skips system dependencies, only initializes workspace and config templates:
bash <(curl -fsSL https://raw.githubusercontent.com/wanikua/boluobobo-ai-court-tutorial/main/install-lite.sh)Supports two modes: Discord multi-Bot mode or pure WebUI mode (no Discord needed).
🍎 macOS user? Use the Mac-specific script — installs all dependencies via Homebrew:
bash <(curl -fsSL https://raw.githubusercontent.com/wanikua/boluobobo-ai-court-tutorial/main/install-mac.sh)Supports both Intel and Apple Silicon (M1/M2/M3/M4), auto-detects architecture.
After the script finishes, you just need two things:
# Edit config — fill in API Key and Bot Tokens
# Full install uses ~/.openclaw/openclaw.json; lite install uses ~/.clawdbot/clawdbot.json
nano ~/.openclaw/openclaw.json
# Start the court
systemctl --user start openclaw-gateway
# Verify
systemctl --user status openclaw-gateway
@mention your Bot in Discord and say something. If it replies, you're live.
@bingbu Write me a user login API → 兵部 bingbu (Power Model): Complete code + architecture suggestions, large tasks auto-spawn Threads @hubu How much did we spend on APIs this month? → 户部 hubu (Power Model): Cost breakdown + optimization recommendations @libu Write a Xiaohongshu post about AI tool recommendations → 礼部 libu (Fast Model): Copy + hashtag suggestions @everyone Tomorrow's meeting at 3 PM — all departments prepare weekly reports → All agents acknowledge individually
Set up automated daily reports:
# Get the Gateway Token
openclaw gateway token
# Auto-generate daily report at 22:00 Beijing time
openclaw cron add \
--name "Daily Report" --agent main \
--cron "0 22 * * *" --tz "Asia/Shanghai" \
--message "Generate today's daily report, write to Notion and post to Discord" \
--session isolated --token <your-token>

The Three Departments and Six Ministries (三省六部制) was the central government system of imperial China:
Under Shangshu Province were the Six Ministries, each managing its own domain. In this project, OpenClaw Gateway plays the role of the Three Departments, while six AI Agents correspond to the Six Ministries:
| Ministry | Historical Role | AI Role | Recommended Model | Typical Use Cases |
|---|---|---|---|---|
| 司礼监 silijian — Chief Steward | Emperor's attendant, imperial review | Central coordination | Fast Model | Daily chat, task delegation, automated reporting |
| 兵部 bingbu — War | Military affairs | Software engineering | Power Model | Coding, architecture design, code review, debugging |
| 户部 hubu — Revenue | Census & taxation | Finance & operations | Power Model | Cost analysis, budgeting, e-commerce operations |
| 礼部 libu — Rites | Ceremonies & diplomacy | Brand & marketing | Fast Model | Copywriting, social media, content strategy |
| 工部 gongbu — Works | Engineering & construction | Infrastructure | Fast Model | DevOps, CI/CD, server management |
| 吏部 libu2 — Personnel | Official selection | Project management | Fast Model | Startup incubation, task tracking, team coordination |
| 刑部 xingbu — Justice | Law & punishment | Legal & compliance | Fast Model | Contract review, intellectual property, compliance checks |
💡 Model tiering strategy: Use power models for heavy tasks (coding/analysis), fast models for light tasks (copywriting/management) — saves roughly 5× on costs. You can also plug in economy models for further savings.
Each department is its own Bot. @mention one and it responds; @everyone triggers all of them. Large tasks automatically spawn Threads to keep channels tidy.
⚠️ To enable Bot-to-Bot interactions (e.g., word chain games, multi-Bot discussions), add
"allowBots": truein thechannels.discordsection ofopenclaw.json. Without this, Bots ignore messages from other Bots by default. Each account also needs"groupPolicy": "open", otherwise group messages will be silently dropped.
Each agent has its own workspace and memory/ directory. Project knowledge accumulated through conversations is persisted to files and retained across sessions. The more you use an agent, the better it understands your project.
It's not just a chatbot — the built-in toolset covers the entire development lifecycle, and you can extend with more Skills from OpenClaw Hub:
| Category | Skills |
|---|---|
| Development | GitHub (Issues/PRs/CI), Coding Agent |
| Documentation | Notion (databases/pages/automated reporting) |
| Information | Browser automation, Web search, Web scraping |
| Automation | Cron scheduled tasks, Heartbeat self-checks |
| Media | TTS voice, Screenshots, Video frame extraction |
| Operations | tmux remote control, Shell command execution |
| Communication | Discord, Slack, Lark (Feishu), Telegram, WhatsApp, Signal… |
| Extensions | OpenClaw Hub community Skills, Custom Skills |
Built-in Cron scheduler lets agents run tasks on autopilot:
Invite friends to your Discord server — everyone can @mention department Bots to issue commands. No interference between users, and results are visible to all.
Agents can run inside Docker sandboxes with isolated code execution. Supports configurable isolation levels for networking, filesystem, and environment variables.
Beyond Discord command-line interaction, the AI Court also offers multiple graphical interface (GUI) management options:
This project includes a built-in Web management dashboard (in the gui/ directory), built with React + TypeScript + Vite:
Court Overview — Throne, Six Ministries, and Auxiliary Offices with live status
Session Management — 88 sessions, 9008 messages, 87.34M tokens tracked in real-time
Features include:
How to start:
# Build the frontend
cd gui && npm install && npm run build
# Start the backend API server (default port 18790)
cd server && npm install && node index.js
Access at: http://your-server-ip:18790
💡 For production, use Nginx reverse proxy + HTTPS instead of exposing the port directly.
Discord itself is the best GUI management interface:
Through OpenClaw's Notion Skill integration, court data auto-syncs to Notion:
💡 Three-tier GUI: Web Dashboard for system status → Discord for issuing commands → Notion for reports and historical data.
For the basics (server provisioning → installation → configuration → first run) and advanced topics (tmux, GitHub, Notion, Cron, Discord, prompt engineering tips), check out the Xiaohongshu tutorial series.
Q: Do I need to know how to code? No. The one-line install script handles setup, and configuration is just filling in a few keys. All interaction happens through natural language in Discord.
Q: How is this different from just using ChatGPT? ChatGPT is a single generalist that forgets everything when you close the tab. This system gives you multiple specialists — each agent has its own domain expertise, persistent memory, and tool permissions. They can automatically commit code to GitHub, write docs to Notion, and run tasks on a schedule.
Q: Can I use other models?
Yes. OpenClaw supports Anthropic, OpenAI, Google Gemini, and any other provider compatible with the OpenAI API format. Just change the model config in openclaw.json. Different departments can use different models.
Q: How much does the API cost per month? Depends on usage intensity. Light usage: 20–30/month. Cost-saving tip: use power models for heavy tasks, fast models for light tasks (roughly 5× cheaper), and plug in economy models for simple tasks to save even more.
Q: What's the relationship with Become CEO? Become CEO is the English corporate edition of this project, using the same OpenClaw framework and architecture but with modern corporate roles (CTO, CFO, etc.) instead of imperial court titles. Prefer ancient Chinese aesthetics? Choose AI Court. Prefer modern corporate style? Choose Become CEO.
Q: @everyone doesn't trigger agent responses? In the Discord Developer Portal, each Bot needs Message Content Intent and Server Members Intent enabled. The Bot's role in the server also needs View Channels permission. OpenClaw treats @everyone as an explicit mention for every Bot — once permissions are set correctly, it will trigger responses.
Q: Agent reports permission errors after enabling sandbox?
Sandbox mode set to all runs the agent inside a Docker container with a read-only filesystem, no network access, and no inherited environment variables by default. Fix:
"sandbox": {
"mode": "all",
"workspaceAccess": "rw",
"docker": {
"network": "bridge",
"env": { "LLM_API_KEY": "your-LLM-API-KEY" }
}
}
workspaceAccess: "rw" — Allows the sandbox to read/write the working directorydocker.network: "bridge" — Enables network accessdocker.env — Passes in API keys (sandbox doesn't inherit host environment variables)Q: Will multiple users @mentioning the same agent cause conflicts? No. OpenClaw maintains independent sessions for each user × agent combination. Multiple people can @mention 兵部 bingbu simultaneously — their conversations won't interfere with each other.
Q: Can agents call each other?
Yes. Agents can use sessions_spawn to delegate sub-tasks to other agents, or sessions_send to message another agent's session. For example, 司礼监 (Chief Steward) can assign coding tasks to 兵部 bingbu.
Q: How do I create custom Skills?
OpenClaw has a built-in Skill Creator tool for creating custom Skills. Each Skill is a directory containing SKILL.md (instructions) + scripts + resources. Place it in the skills/ directory of your workspace, and agents can use it immediately. You can also find community-shared Skills on OpenClaw Hub.
Q: How do I connect private models (Ollama, etc.)?
Add an OpenAI API-compatible provider in the models.providers section of openclaw.json, pointing baseUrl to your Ollama address. Local Ollama models have zero API costs.
Q: How do I troubleshoot Gateway startup failures?
# Check detailed logs
journalctl --user -u openclaw-gateway --since today --no-pager
# Run diagnostics
openclaw doctor
# Common causes: missing API Key, malformed JSON, invalid Bot Token
| Xiaohongshu (小红书) | WeChat Official: 菠言菠语 | WeChat Group: OpenClaw Emperors |
|---|---|---|
![]() | ![]() | |
| @菠萝菠菠🍍 | Follow for tutorials & updates | If QR expired, follow the official account for latest link |
本项目按"原样"提供,不承担任何直接或间接责任。/ This project is provided "as is" without any warranties.
使用前请注意 / Please note:
AI 生成内容仅供参考 / AI-generated content is for reference only
代码安全 / Code Security
API 密钥安全 / API Key Security
服务器费用 / Server Costs
数据备份 / Data Backup
v3.5 | MIT License
📜 This project is licensed under MIT. If you create derivative works or projects inspired by this architecture, please credit the original: boluobobo-ai-court-tutorial by @wanikua