Files
CST-agent/docs/parliament.md
T
WHCandCursor a3e115539e feat: /realm in TUI, daemon instance takeover (0.9.16)
Pidfile records instance+port; login restarts the service when the seat
changes. TUI /realm status|login|stop; prompts discourage filler chatter.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-29 11:00:34 +08:00

75 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Parliament(议会)快速上手
密码串派生 Realm → 登录夺主席 → 常驻服务同步上下文。同一时刻只有一个主席;换项目清空全部议会上下文。
## 一次性初始化
```bash
# 交互输入密码,或事先 export CST_REALM_PASSWORD=…
cst-agent --realm-password-init
```
磁盘只存 salt + 公钥,**不存私钥**。
## 日常:登录即夺主席
```bash
export CST_INSTANCE_ID=laptop-a # 可选;默认 chair-local
cst-agent --login --realm-label "thinkpad"
# 也可:CST_REALM_PASSWORD=… cst-agent --login
```
效果:
1. 用密码解锁 Realm,本机成为**唯一主席**(上一主席被交接)
2. 写入本地登录票(24h)
3. 拉起后台议会服务(发现 + 按 revision 同步 `parliament.context`)
查看状态:
```bash
cst-agent # TUI: /status 或 /realm
# /realm login # TUI 内登录并启服务
# /realm stop # 停服务
cst-agent --service-stop
```
密码 Realm 开启后,直接打开 agent 会要求登录(TTY 下可当场输入密码)。
## 协作模式
`settings.json` 里 `"collaboration": "parliament"`(或环境变量 `CST_COLLABORATION=parliament`)时:
- 提示词不再鼓动 `task` / `worker_start`
- 本机用工具直接干活;跨设备靠 Realm peer 席位,而不是进程内子 agent
密码 Realm 存在时也会按议会模式注入 Environment(chair / 共享 context / 设备席位)。
## 换项目(清场)
```bash
cst-agent --new-project my-app
```
清空共享上下文、撤销主席与登录票,并停止本机服务。Realm 密钥保留。
## Docker 冒烟
```bash
bash scripts/docker_parliament_test.sh
```
Alpine 内构建,chair↔member 握手。
## 相关标志
| 标志 | 作用 |
|------|------|
| `--realm-password-init` | 创建密码 Realm |
| `--login` | 登录 + 夺主席 + 启服务 |
| `--service` / `--service-fg` | 仅启服务 |
| `--service-stop` | 停服务 |
| `--new-project ID` | 清场换项目 |
| `--peer-port N` | 登录/服务用的 TCP 端口(默认 9100) |
| `--instance ID` | 实例 id(也可用 `CST_INSTANCE_ID`) |