Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ Thumbs.db
frontend/
gui/dist/
SECURITY-AUDIT.md

# CivAgent v5 rewrite artifacts
regimes/**/*.rejected
regimes/**/*.v4.bak
regimes/**/*.new
905 changes: 277 additions & 628 deletions README.md

Large diffs are not rendered by default.

105 changes: 105 additions & 0 deletions docs/IDENTITY-TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Canonical IDENTITY.md Template

All 57 regimes conform to this structure. The validator (`npm run validate:regimes`) enforces presence of each H2 section.

## Rationale

v4 IDENTITY.md files ranged from 49 to 106 lines with inconsistent sections — some had org charts, others lacked role mapping tables. The runtime (`engine/regime-to-cc.mjs`) parses the role mapping table; regimes without it fall back to defaults, losing governance authenticity.

v5 canonicalizes the structure so the Agent Team reliably mirrors each civilization's actual governance architecture.

## Required structure

```markdown
# <Chinese name> — <Governance System Name>

> ⚠️ Attribution block (preserved from upstream when applicable).

## 制度简介 / System Overview

2–4 sentences on the governance system's era, duration, historical significance.
Both Chinese and English should appear when the regime is non-Chinese.

## 组织架构图 / Organization Chart

ASCII diagram showing the decision hierarchy. Must include:
- A top authority (emperor / assembly / consul / etc.)
- 3–10 distinct organs/offices with names in the original language
- Arrows indicating command / review / report flow

Example (Tang):
\```
┌──────────┐
│ 皇帝 │
└────┬─────┘
│ 圣旨
┌────────────┼────────────┐
▼ ▼ ▼
[中书省] [门下省] [尚书省]
起草 审核 执行
┌───┬───┬───┬───┬─┴─┬───┐
▼ ▼ ▼ ▼ ▼ ▼
吏部 户部 礼部 兵部 刑部 工部
\```

## 角色映射表 / Role Mapping Table

Required columns, parsed by `engine/regime-to-cc.mjs`:

| 历史角色 / Historical Role | Agent ID | AI 职责 / AI Responsibility | 推荐模型 / Recommended Model |
|---|---|---|---|
| 皇帝 | emperor | coordinator | sonnet |
| 中书舍人 | zhongshu-drafter | engineering (draft code/policy) | opus |
| 门下给事中 | menxia-reviewer | review | opus |
| ... | ... | ... | ... |

Each row must have a non-empty `Agent ID` (lowercase kebab-case) and one of the canonical AI roles:
**coordinator, engineering, review, research, data, devops, content, legal, management**

## 决策流程 / Decision Flow

3–7 step narrative describing how a typical governance decision moves through the org chart. Reference the Agent IDs from the mapping table.

Example:
1. **emperor** receives a petition about frontier famine.
2. **emperor** issues an edict to **zhongshu-drafter**.
3. **zhongshu-drafter** produces a draft plan.
4. **menxia-reviewer** rejects or amends the draft (iteration allowed).
5. On approval, **shangshu-executor** dispatches to the 6 ministries in parallel.
6. Each ministry reports back with concrete measurable outputs.

## 制度特点 / Characteristics

Bullet list of 3–6 defining features. Each feature should be a specific mechanism, not a platitude:
- "Three-stage checks-and-balances: drafting, reviewing, and executing are strictly separated" ✓
- "Good governance" ✗

## Pattern 映射

Single line naming the orchestration pattern from `engine/modes/`:

> **Orchestration pattern**: `checks-and-balances`

One of: `centralized`, `checks-and-balances`, `democratic`, `dual-track`, `federation`, `theocratic`
(aliases accepted: see `engine/regime-to-cc.mjs` PATTERN_ALIASES).

## 历史参考 / Historical Sources

3–5 primary or authoritative references. Shortest acceptable form:
- 《旧唐书·职官志》
- Tang Liu Dian (唐六典), ed. Li Linfu (733 CE)
- Wang Gungwu, *The Structure of Power in North China during the Five Dynasties*

---

## Checklist for new / rewritten regimes

- [ ] System Overview section ≥ 2 sentences
- [ ] Org chart with labeled hierarchy
- [ ] Role mapping table ≥ 5 rows with valid Agent IDs
- [ ] Decision flow references Agent IDs
- [ ] Characteristics are mechanism-level, not vague
- [ ] Orchestration pattern is one of 6 canonical (or documented alias)
- [ ] ≥ 3 historical sources
- [ ] Passes `npm run validate:regimes`
21 changes: 21 additions & 0 deletions regimes/REVIEW-FINDINGS-v5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# L-Stage Review Findings (Codex)

Codex audit of 5 sample regimes after PR #6 auto-generation. Actionable items for v5.1.

## Fixed in this commit

- **china/tang**: 司礼监 (Ming-Qing eunuch agency) was misplaced in Tang architecture. Replaced with 中书舍人 (Zhongshu Sheren, Tang drafter). "运行超过 1300 年" overclaim clarified — only the three-省 framework persisted, not the specific Tang configuration.

## Deferred to v5.1

- **global/byzantine**: Patriarch depicted as routine ethics veto — overstated. `theokrator` is literary, not a standard office title.
- **global/roman-republic**: Chart too linear. Assemblies (Comitia) should sit more prominently above consuls and senate. Censor placed too actively in day-to-day flow (role was periodic, not continuous).
- **global/prussia**: Compresses 1701-1918 into one snapshot. `Ober-Kriegsrat` may be invented. `Kammerdirektor` is too generic. Recommend splitting into `prussia-frederick` (18c) and `prussia-bismarck` (19c).
- **global/ottoman**: `Nişancı` miscast as 大法官 (should be pen-bearer/tuğra authenticator). Janissary Aga's direct-to-Sultan reporting path overcentralized — ignores parallel ulema channel. One source citation (`Patrick Balfour`) format nonstandard.

## Not yet reviewed (other sampling rounds failed)

- Gemini second-round review blocked on CodeAssist OAuth (API-key mode was not picked up by this invocation — known intermittent issue).
- cc-mimo third-round review hit `--max-turns 1` limit mid-output; re-run needed.

v5.1 plan: complete Gemini + Mimo rounds on a dedicated branch, fix Byzantine/Roman/Prussian/Ottoman per above.
102 changes: 48 additions & 54 deletions regimes/china/five-dynasties/IDENTITY.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,58 @@
# 五代十国 — 组织架构

## 制度简介

五代十国(907-960)是唐朝灭亡到北宋建立之间的大分裂时代。中原先后经历后梁、后唐、后晋、
后汉、后周五个短命王朝,南方则有吴、南唐、吴越、闽、楚、南汉、前蜀、后蜀、南平、北汉十国并立。
各地节度使拥兵自重,实际上是独立的军阀政权。朝廷名义上是中央,但对地方控制力极弱。
这一体制适合模拟多团队竞争、去中心化协作的场景。
五代十国(907-960)是唐朝藩镇割据的延续与加剧。中原五朝速迭,南方十国并立,节度使拥兵自重、各自为政。名义上有朝廷,实际权力高度分散,是中国历史上最混乱的时期之一,适合模拟去中心化协作、多团队竞争场景。

## 组织架构图

```
┌─────────────────────┐
│ 主公(你) │
│ 谁有实力谁是主 │
└──────────┬──────────┘
│ 号令(有限约束力)
┌──────────────────────┐
│ 朝廷(名义中央) │
│ chaoting │
└──────────┬──────────┘
│ 政令(各方可选择执行)
┌──────────────────┼──────────────────┐
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ 节度使A │ │ 节度使B │ │ 节度使C │
│ 独立团队A │ │ 独立团队B │ │ 独立团队C │
│ jiedushi_a │ │ jiedushi_b │ │ jiedushi_c │
└──────────────┘ └──────────────┘ └──────────────┘
▲ ▲ ▲
└──────────────────┼───────────────────┘
│ 文书协调
┌──────────────────────┐
│ 掌书记 │
│ zhangshji │
└──────────────────────┘
┌─────────────┐
│ 名义朝廷 │
│ (朝廷天子) │
└──────┬──────┘
│ 政令(约束力弱)
┌────────────────┼────────────────┐
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ 节度使A │ │ 节度使B │ │ 节度使C │
│ (独立军阀)│ │ (独立军阀)│ │ (独立军阀)│
└──────────┘ └──────────┘ └──────────┘
│ │ │
└────────────────┼────────────────┘
│ 协调文书
┌──────┴──────┐
│ 掌书记 │
│ (文官协调) │
└─────────────┘
```

## 角色映射表

| 古代角色 | Agent ID | AI 职责 | 推荐模型 |
| 历史角色 | Agent ID | AI 职责 | 推荐模型 |
|---|---|---|---|
| 朝廷·天子 | `chaoting` | 名义中央:发布政令、协调各方、名义统筹 | 快速模型 |
| 节度使A | `jiedushi_a` | 军阀A / 团队A:独立运作,擅长特定领域 | 强力模型 |
| 节度使B | `jiedushi_b` | 军阀B / 团队B:独立运作,与他方竞争 | 强力模型 |
| 节度使C | `jiedushi_c` | 军阀C / 团队C:独立运作,各有专长 | 强力模型 |
| 掌书记 | `zhangshji` | 文书协调:传递信息、记录决策、协调冲突 | 快速模型 |

## 协作流程

1. **主公下令** → 用户发送任务(可指定单个或所有节度使)
2. **朝廷传令** → `chaoting` 转达政令(节度使可选择执行方式)
3. **竞争执行** → 多个节度使可同时执行同一任务,各自拿出方案
4. **掌书记记录** → `zhangshji` 记录各方进展、协调资源冲突
5. **主公裁决** → 用户比较各方成果,选择最优方案
6. **合纵连横** → 节度使之间可自由协作或竞争

## 适用场景

- **多团队竞争**:多个团队同时为同一目标提供方案
- **A/B 测试**:不同方案并行实施,对比效果
- **去中心化开发**:各团队独立开发,最终整合
- **创意竞标**:多方案竞争,择优录用
| 朝廷天子 | imperial-court | coordinator | sonnet |
| 节度使A | jiedushi-alpha | management | opus |
| 节度使B | jiedushi-beta | engineering | opus |
| 节度使C | jiedushi-gamma | devops | opus |
| 节度使D | jiedushi-delta | research | opus |
| 掌书记 | zhangshu-secretary | content | sonnet |

## 决策流程
1. **imperial-court** 发布名义政令(各方可选择性执行)
2. 诸 **jiedushi** 并行独立研判,各自制定方案
3. **zhangshu-secretary** 传递文书、记录各方进展、协调冲突
4. 节度使间可自由合纵连横,结盟或竞争
5. 最终方案由实力最强的节度使主导,或多方协作完成

## 制度特点
- 实力至上:兵强马壮者为天子,政权更迭频繁
- 高度自治:节度使独立决策,朝廷政令约束力极弱
- 并行竞争:多方同时执行任务,择优录用
- 动态联盟:节度使间可自由结盟或对立

## Pattern 映射
> **Orchestration pattern**: `federated`

## 历史参考
- 《旧五代史·职官志》
- 《新五代史·职方考》
- 欧阳修《五代史记》
- 钱穆《中国历代政治得失》
Loading
Loading