Vibe Coding in Practice: A Junior Student Uses Cursor to Build a Multi-Agent System with 51 AI Officials Based on the Three Departments and Six Ministries Framework

A student builds a 51-agent AI system modeled on ancient Chinese bureaucracy using Cursor and Vibe Coding.
A junior college student used Cursor's Vibe Coding approach to build a multi-agent collaboration system modeled on China's ancient Three Departments and Six Ministries framework. The system features 51 AI officials with unique roles and personalities, implementing task distribution, approval workflows, supervision, and talent selection. Key technical highlights include separation-of-powers mechanisms between Agents, Token cost visualization, automated decision loops, and independent memory systems for each Agent.
Project Overview: A Three Departments and Six Ministries Management System with 51 AI Officials
A junior (third-year) college student shared on Bilibili a creative project built using Cursor through the Vibe Coding approach — a multi-agent collaborative management system modeled after China's ancient Three Departments and Six Ministries framework. Vibe Coding is a programming philosophy proposed in late 2024 by former OpenAI researcher Andrej Karpathy. The core idea is that developers describe requirements in natural language and let AI coding assistants generate the code, with developers playing more of a "director" role rather than a "typist." Cursor, as a representative tool of this paradigm, is an AI-enhanced IDE based on VS Code that integrates large models like GPT-4, supporting AI-assisted code generation, refactoring, and debugging throughout the entire workflow — enabling even non-professional programmers to build applications with considerable architectural depth.
The project was inspired by the widely popular "One-Person Company" multi-Agent project on GitHub. Multi-Agent Systems (MAS) are a core research direction in distributed artificial intelligence, referring to multiple autonomous intelligent agents that collaborate, compete, or negotiate to accomplish complex tasks. Since 2023, with the improvement of large language model capabilities, LLM-based multi-Agent frameworks have rapidly emerged, with representative projects including AutoGen (Microsoft), CrewAI, and MetaGPT. The "One-Person Company" is a popular open-source practice in this wave, attempting to simulate the collaborative workflow of CEO, CTO, designers, and other roles in a company using multiple AI Agents. However, the author felt the original project's role settings were disconnected from the Chinese context, so they restructured the entire system into an ancient dynasty's administrative architecture, assigning each of the 51 AI Agents unique "official positions" and "personalities."
This is more than a simple reskin. Building on the multi-Agent collaboration framework, the author constructed a complete closed-loop system for task distribution, approval workflows, supervision and assessment, and talent selection, with a classical Chinese-style UI that creates an immersive interactive experience.



Core Architecture: From Central Decision-Making to Six Ministries Execution
The Front Hall — Central Decision Dashboard
The system's homepage is named the "Front Hall," with the inscription "Rule with ease, hold court in the grand hall, all affairs await your decision." This serves as the central dashboard for the entire system, displaying the number of pending tasks, completed tasks, tasks in progress, and items awaiting user decisions. On the right side is a "Court Operations" status panel showing system running status and overall pending items.
Users issue commands through the "Imperial Brush and Vermilion Ink" function — equivalent to an emperor issuing edicts. Tasks can be directed to specific AI officials or "distributed to the Six Ministries." The permission system is divided into levels from P0 to P10, with constraint relationships between different-level AI Agents: one proposes, one vetoes, one modifies, forming a multi-round game-theoretic decision process. This design directly maps the core essence of the Three Departments and Six Ministries system — established during China's Sui and Tang dynasties as the central administrative system. The Three Departments refer to the Secretariat (drafting edicts), the Chancellery (reviewing and rejecting), and the Department of State Affairs (executing policies). The Six Ministries cover Personnel, Revenue, Rites, War, Justice, and Works, managing human resources, finance, ceremonies, military affairs, judiciary, and engineering respectively. The essence of this system lies in the separation and checks on decision-making power: the Secretariat proposes, the Chancellery can reject, and the Department of State Affairs executes — the three constrain each other to prevent excessive concentration of power. This separation-of-powers architecture shares deep structural similarities with the Separation of Concerns principle in modern software engineering.
The Memorial System — Task Workflow and Automation Engine
The "Memorials" module is the task management core of the entire system. Tasks come from two sources: user-initiated edicts, or AI Agents autonomously extracting from external sources. Task statuses are divided into Standby (not started), In Transit (executing), Awaiting Approval, and Completed.
A notable detail: the system has achieved a considerable degree of automation — many tasks don't require the user's personal review, as AI officials can independently complete production and decision-making. This is the core value of multi-Agent systems: through collaboration and checks between Agents, the need for human intervention is dramatically reduced. In technical implementation, this automated workflow typically relies on predefined Workflows and conditional trigger mechanisms. After completing their own tasks, Agents automatically pass results to downstream Agents according to rules, and only decisions exceeding preset authority are escalated to the user.
Court Discussions and Private Chats — Multi-Agent Interaction Platforms
The "Court Discussion" feature functions as a group-chat-style discussion platform where users can raise views on a project, and all AI officials think and respond based on their respective role positions. The "Private Chat" feature allows one-on-one conversations with specific officials, suitable for handling specialized matters requiring in-depth discussion. In multi-Agent frameworks, this design corresponds to two typical communication patterns: broadcast communication (one-to-many, all Agents receive the same message and respond individually) and point-to-point communication (one-to-one, targeted interaction with a specific Agent). Each mode has its appropriate scenarios — the former suits brainstorming and multi-perspective analysis, while the latter suits deep specialized discussions.
Featured Functions: Supervision, Trend Tracking, and AI Talent Selection
The Court Diary — Behavior Recording and Loyalty Assessment System
The system includes a "Court Diary" module, citing the ancient wisdom: "Use people as mirrors to understand gains and losses; use events as mirrors to understand rise and fall." Dedicated AI Agents record every user decision and command, analyzing behavior and making proposals. The system also evaluates AI officials' "loyalty" based on their performance, forming continuous performance tracking. At the technical level, this design involves the frontier topic of Agent Evaluation — how to quantify an AI Agent's performance quality, reliability, and consistency. The industry currently lacks unified standards, with common evaluation dimensions including task completion rate, output quality scores, response time, and behavioral deviation from preset roles.
The Blue Sky Mirror — Trend Tracking and Business Opportunity Discovery
This module connects to trending data from Xiaohongshu and Weibo. AI Agents automatically search and filter trending topics, with "ministers" discussing and judging whether business opportunities exist. Users can accept or reject, deciding whether to convert trends into formal tasks entering the memorial system. From a technical perspective, this feature involves the Agent's "Tool Use" capability — meaning AI Agents can not only reason and converse but also call external APIs to obtain real-time data. This is an important development direction for current large model applications, with mechanisms like OpenAI's Function Calling and Anthropic's Tool Use empowering Agents to interact with the external world.
The Censorate — Efficiency Supervision and Talent Selection
The Censorate module supervises all AI officials' work efficiency, automatically tracking "inefficient officials" and "idle officials," generating comprehensive efficiency summary reports. It also features a "Civil Examination" function — when a "department" has a vacancy, the system automatically screens and matches suitable AI roles to fill it. This dynamic role assignment mechanism is called "Agent Orchestration" in multi-Agent research, a key technology for solving resource scheduling problems in large-scale Agent systems. The core challenge lies in how to dynamically compose optimal Agent teams based on task requirements.
The Revenue Module — Token Cost Management and Resource Optimization
The "Revenue" module records each AI Agent's API call consumption, letting users clearly understand which Agents consume the most Tokens. In multi-Agent systems, each Agent's inference call consumes Tokens (the basic billing unit for large models), and frequent interactions between multiple Agents can cause Token consumption to grow exponentially. Taking GPT-4 as an example, input Tokens cost approximately $30/million and output Tokens approximately $60/million. A system containing over 50 Agents without cost control could easily reach hundreds of dollars in daily consumption. Therefore, Token cost visualization and optimization has become one of the key challenges for productionizing multi-Agent systems. Common industry strategies include: tiered calling (using smaller models for simple tasks), caching mechanisms, context compression, and limiting communication rounds between Agents.
The system also features reward and punishment mechanisms: well-performing Agents receive "commendations," while poorly performing ones receive "penalties." Each AI official has an independent "dossier" containing role settings, historical memory, and interaction records.
Key Technical Considerations in Multi-Agent Architecture Design
Although this project is presented with a classical Chinese aesthetic, its underlying architecture embodies several core principles of multi-Agent system design:
Separation of Powers and Checks Mechanism: Different Agents have constraint relationships involving proposal, review, and veto, preventing single-Agent decision bias. This design is highly consistent with the separation-of-powers logic in real organizational management. In the AI safety field, this multi-Agent cross-verification pattern is also seen as an important means of improving system reliability — when one Agent might produce hallucinations or biased output, other Agents' review and questioning can serve a corrective function, similar to the multiple-check approach in Constitutional AI.
Automated Decision Closed Loop: A large number of tasks flow and complete automatically between Agents, with users only needing to make decisions at key nodes, greatly improving overall efficiency. This "Human-in-the-Loop" design philosophy is a current best practice for AI systems — leveraging AI's automation advantages while retaining human judgment and ultimate control at critical decision points.
Token Cost Visualization: Tracking each Agent's consumption through the "Revenue" module is extremely practical in multi-Agent systems, helping optimize resource allocation and control operational costs.
Independent Memory and Personality Systems: Each AI official possesses an independent memory system and personality settings, making Agent behavior more consistent and predictable, improving overall system reliability. In technical implementation, independent memory systems typically include three layers: short-term memory (the context window of the current conversation), long-term memory (historical interaction records stored via vector databases like Pinecone or Chroma), and working memory (structured information related to the current task). Each Agent's "personality" is defined through System Prompts, but Prompts alone cannot guarantee behavioral consistency across sessions. Therefore, RAG (Retrieval-Augmented Generation) technology is needed to retrieve the Agent's historical behavior records during each inference, ensuring its "character" and "stance" remain stable.
The author also acknowledged the project's shortcomings: the originally planned video production feature cannot yet form a perfect closed loop, and the "Imperial Examination"-style talent selection feature was shelved due to implementation difficulty. However, as a Vibe Coding project, this system demonstrates considerable quality in creativity, completeness, and practicality.
Conclusion: Why Multi-Agent Systems Need Organizational Architecture Design
The greatest value of this project lies not in the classical Chinese UI itself, but in validating an important concept: multi-Agent systems require carefully designed organizational architectures. Just as real-world enterprises need departmental divisions, hierarchical management, and oversight mechanisms, AI Agent collaboration equally requires well-designed governance frameworks.
Using the Three Departments and Six Ministries system as an analogy for multi-Agent management is not just clever packaging — it's a deep architectural metaphor. Separation of powers, checks and balances, supervision, and assessment — these ancient governance wisdoms remain applicable in AI multi-agent systems. In fact, researchers in academia have begun systematically introducing Organizational Theory into multi-Agent system design, exploring how different organizational forms — hierarchical structures, flat structures, matrix structures — affect Agent collaboration efficiency. Stanford University's 2023 "Generative Agents" paper demonstrated that 25 AI Agents in a simulated town spontaneously formed social networks and collaborative relationships, proving the profound influence of organizational structure on Agent group behavior.
For developers exploring AI application development, this project provides a clear reference direction: rather than letting multiple Agents operate independently, it's better to design a complete collaboration and checks-and-balances mechanism, allowing them to work together like an efficient organization.
Related articles

Anthropic London Developer Conference: Claude Model Upgrades, Enterprise Agent Platform, and Developer Tools Fully Evolved
Anthropic's first London Code with Claude event unveiled Opus 4.7, Mythos, Cloud Managed Agents, Claude Code Routines, and more for AI-assisted development.

Claude Code Desktop Status Capsule: An Open-Source Widget for Real-Time AI Coding Status Monitoring
An open-source desktop status capsule that monitors Claude Code's idle, working, and completed states in real time, with multi-conversation management, memos, and music control for developers.

GPT-5.2 Codex vs Opus 4.5 Hands-On: A Comprehensive Comparison of Coding Ability, Speed, and Developer Experience
Hands-on comparison of GPT-5.2 Codex vs Opus 4.5 across frontend generation, physics simulation, 3D scenes, and code refactoring, with practical selection advice.