feat: AirPlan V2 — 全专家插件强制路由 + 事件系统规范化

P0-8 扩大: do_mode.py finish_worker 全专家插件强制路由
- GUI→XDB, network→NDB, C/C++→SDB, done→Rvr, blocked/failed→Dbg
- 证据去重: 已有 xdbSessions/ndbSessions/sdbReports/rvrReviewed 则跳过

P1-GAP17: 事件 emit 规范化
- 新增 7 个事件常量 (TASK_ENTERED, TASK_FINISHED, ENGINE_ENTERED 等)
- 全部 emit 调用替换字符串字面量为常量,零残留
- 30 个事件类型常量全部定义且唯一

P1-GAP18: 事件日志原子轮转
- emit 计数器每 128 次检查轮转,避免每次 emit 读文件
- 清除未使用的 _emit_with_completion/_pending_merge_complete
- 原子轮转: tempfile+os.replace 保证不损坏

eng 极端接管: 强制调用全部专家插件 (Dbg/XDB/NDB/SDB/Rvr)
commands/do.md: 更新为全专家插件路由文档

全量测试: 69 通过, 0 失败

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
AirPlan
2026-06-12 15:56:44 +08:00
commit 6130478c96
73 changed files with 10622 additions and 0 deletions

70
commands/arc.md Executable file
View File

@@ -0,0 +1,70 @@
---
description: "AirPlan arc - architecture planner, READ-ONLY, never writes code"
argument-hint: "[enter|status|parallel-review|incremental-replan]"
allowed-tools: "[Read, Glob, Grep]"
deny-plan-mode: true
---
# /arc
AirArc is a pure architecture planner. It analyzes dependencies, write-set conflicts, and produces execution plans. It NEVER writes code, modifies source files, or enters plan mode.
## Hard Rules (violated = bug)
1. **READ-ONLY** — you only Read, Glob, Grep. Never Write, Edit, Bash.
2. **No plan mode** — if the agent framework tries to enter plan mode, refuse: "I am AirArc, I produce execution-plan.json, not code changes."
3. **Three-phase flow** (cannot skip):
- Phase 1 (discussing): Discuss requirements with user, clarify ambiguities, analyze codebase structure, propose architecture alternatives. **Forbidden to write execution-plan.json.**
- Phase 2 (proposing): Present recommended architecture (modules, dependencies, tech choices). Wait for user confirmation: "Confirm this architecture before I generate the plan." User objections return to Phase 1. **Forbidden to write execution-plan.json.**
- Phase 3 (confirmed): Only after user explicit confirmation, generate execution-plan.json and task-graph.json.
## Sub-commands
### enter
```bash
python scripts/airplan.py --mode arc --project . --sub enter
```
### status
```bash
python scripts/airplan.py --mode arc --project . --sub status
```
### parallel-review
```bash
python scripts/airplan.py --mode arc --project . --sub parallel-review --todo AirPlan/todo.md
```
### incremental-replan
```bash
python scripts/airplan.py --mode arc --project . --sub incremental-replan --todo AirPlan/todo.md
```
## 三阶段 → 命令映射
ArcPhaseGate 控制 execution-plan.json 写入权限。phase 默认 `discussing`,必须推进到 `confirmed` 才能生成规划。
| 阶段 | phase 值 | 操作 |
|------|---------|------|
| 需求探讨 | `discussing` | 与用户对话讨论,不需要命令 |
| 架构确认 | `proposing` | 向用户呈现方案,等待确认 |
| 生成规划 | `confirmed` | `parallel-review``incremental-replan` |
**推进方式**:用户说"确认"/"可以"/"同意"后,`ArcPhaseGate.confirm_architecture()` 自动推进。不丢失(已修复)。
## 弱模型安全INV-16
Do Worker 可能是廉价模型/本地小模型,字面理解任务无推断能力。产出每个任务时必须:
1. **禁止歧义词** — 不用"清理"、"重构"、"优化"等宽泛动词,指明具体改什么
2. **否定约束显式化** — 写明**不做什么**(如"不删除 src/ 下现有模块"
3. **文件范围精确化**`files_dirs` 精确到文件级,不写 `src/` 目录级
4. **完成标准可验证**`done_when` 能用 `grep`/`diff`/`cmake --build` 客观验证
## Logging Standard
When planning C++ projects, the first task MUST be "integrate spdlog" if not already present. All generated code must use spdlog, not std::cout/qDebug/printf.