# AI Court (Danghuangshang)

> A ready-made team of OpenClaw agents organised like an imperial Chinese court — you issue the decree in Discord or Feishu, the ministries do the work

- Category: Agents & Automation / Multi-Agent Systems
- Language: TypeScript
- Licence: MIT
- Repository: https://github.com/wanikua/danghuangshang
- Website: https://danghuangshang.com
- Canonical page: https://ai-tldr.dev/tools/danghuangshang/
- Updated: 2026-03-12

## In short

AI Court (Danghuangshang) is a ready-made team of OpenClaw agents organised like an imperial Chinese court — you issue the decree in Discord or Feishu, the ministries do the work. It sits in the Multi-Agent Systems category of the Agents & Automation tools and is open-source, written in TypeScript and licensed MIT.

## Overview

AI Court — 当皇上, "be the emperor", in the original Chinese — is a pre-configured multi-agent system built on the OpenClaw agent framework. Rather than a library you program against, it is a set of install scripts, agent personas and OpenClaw configuration that turn one server into a standing team of AI agents. You play the emperor; the agents are your ministers. Mention one in Discord or Feishu (Lark) and it gets to work, and the project also documents Slack, Telegram and a browser-only WebUI path that needs nothing but an API key.

The team is shaped by a choice of three "regimes" picked at install time. The default Ming cabinet system (18 agents) routes a request through a Chief Steward (司礼监) that receives the order, a Cabinet (内阁) that rewrites the prompt and drafts a plan, and six ministries that execute it — War for software engineering, Revenue for cost and budget analysis, Rites for marketing copy, Works for DevOps, Personnel for project management and Justice for legal and compliance — while a Censorate (都察院) automatically reviews code pushed to GitHub. The Tang three-departments system (14 agents) adds a drafting → review → execution chain in which a proposal can be sent back, and a modern-corporate system (14 agents) swaps the court for a CEO, a Board and CTO/CFO/CMO-style roles working in English. In multi-bot Discord mode every department is its own bot, so you can also skip the dispatcher and give an order straight to one ministry.

Each agent has its own workspace and memory directory and can run on its own model — the FAQ suggests strong models for heavy work and fast ones for light tasks, and lists Anthropic, OpenAI, Gemini, DeepSeek and OpenAI-compatible endpoints such as Ollama. Through OpenClaw the agents get more than 60 skills (GitHub, Notion, browser automation, web search, cron, TTS, tmux and shell), optional Docker sandboxing for code execution, and scheduled jobs such as daily reports. An optional Hanlin Academy module adds five agents that collaborate on writing a novel, and a separate installer runs the same court on Nous Research's Hermes Agent runtime instead of OpenClaw. The project is MIT-licensed; a sibling repository, Become CEO, packages the same architecture with corporate roles.

## What it does

- Three selectable org structures — Ming cabinet (18 agents), Tang three departments (14) and modern corporate (14) — switchable after install with one script
- Dispatcher → planner → specialist flow: a steward takes the order, a cabinet agent enhances the prompt and writes a plan, ministries execute, and a review agent checks code pushed to GitHub
- One bot per department in Discord, so you can mention a single ministry directly; Feishu, Slack, Telegram and a pure WebUI are also supported
- Per-agent workspace, memory and model choice, plus a backup script for every agent's SQLite memory with daily, weekly and monthly retention
- 60+ OpenClaw skills (GitHub, Notion, browser, web search, cron, TTS, tmux, shell), Docker sandbox isolation and scheduled jobs for reports and health checks
- A built-in React + TypeScript web dashboard with a court overview, chat with departments, session and token statistics, cron management and system health

## Getting started

The README recommends installing on a cloud server rather than a personal computer. You need an LLM API key and, for the Discord path, a bot token; the installer asks for both.

1. Clone and run the full installer

   The local install is the recommended path: it lets you read every script, includes the full persona setup, and asks which regime to use (Ming cabinet, Tang three departments or modern corporate). Fill in your LLM API key and Discord bot token when prompted, then mention your bot in Discord.

```bash
git clone https://github.com/wanikua/danghuangshang.git
cd danghuangshang
bash scripts/full-install.sh
```

2. Already running OpenClaw? Use the lite installer

   If OpenClaw is installed, the lite script only lays down the court templates and personas. The README's English quick start then has you add keys to the OpenClaw config and start the gateway.

```bash
bash <(curl -fsSL https://raw.githubusercontent.com/wanikua/danghuangshang/main/install-lite.sh)
nano ~/.openclaw/openclaw.json
systemctl --user start openclaw-gateway
```

3. Keep the bots from talking in circles

   In multi-bot Discord mode each agent's config must let bots answer other bots only when mentioned. The README warns that true makes the bots trigger each other in a message storm, and false stops the steward from reaching the ministries. Newer installers set this by default.

```json
"discord": {
  "allowBots": "mentions"
}
```

4. Switch regimes later

   From the cloned repository, one script swaps the whole team's structure.

```bash
bash scripts/switch-regime.sh tang-sansheng  # Tang three departments
bash scripts/switch-regime.sh modern-ceo     # modern corporate
bash scripts/switch-regime.sh ming-neige     # Ming cabinet
```

5. Optional: start the web dashboard

   The dashboard in gui/ is built with Vite and served by a small Node backend on port 18795. For production the README suggests putting it behind an Nginx reverse proxy with HTTPS. If something misbehaves, openclaw doctor or the project's doctor.sh checks config, keys, tokens and routing.

```bash
cd danghuangshang/gui && npm install && npm run build
cd server && npm install
BOLUO_AUTH_TOKEN=your-password node index.js
```

## When to use it

- Run a standing team of specialised agents — coding, cost tracking, marketing copy, DevOps — that you direct from your phone through Discord or Feishu
- Put a planning and review step in front of every task, so a request is clarified and planned before it is executed and code is reviewed when it is pushed to GitHub
- Automate recurring work such as daily and weekly reports to Notion, health checks and code backups with cron-driven agents
- Get a working multi-agent setup from configuration files and an install script instead of writing orchestration code

## Version history

- 2026-03-12 v3.0: v3.0 slimmed the README into a short guide with the tutorials moved into docs/, published a Docker image (boluobobo/ai-court) with Node.js 22, OpenClaw, Chromium, gh CLI and Python, added the doctor.sh diagnostic tool, a single-bot Feishu entry point that dispatches to every department in the background, a browser-only WebUI path and a Windows WSL2 guide.
