Files
dstalk/agents/WORKFLOW.md
XiuChengWu 5766938524
Some checks failed
CI / Determine matrix (push) Has been cancelled
CI / ${{ matrix.os }} / ${{ matrix.build_type }} (push) Has been cancelled
Wave 5+6: plugin ABI hardening, build modernization, ABI/security docs
Wave 5 (9 parallel agents):
- W1.1 atomic diag callback + DLL handle release on shutdown (lin)
- W2.1 unify cross-DLL heap discipline (host->alloc/free/strdup) (chen)
- W2.2 secure_zero api_key on shutdown for deepseek/anthropic (cao)
- W3 CMake modernization: target-based cxx_std_20, dstalk_boost_config
  INTERFACE lib, root-level RUNTIME_OUTPUT_DIRECTORY (hu)
- W4 GitHub Actions CI with dynamic Linux/Windows matrix (ma)
- W5.1 SSE buffer_body to cut peak memory ~67% on 32K streams (zhou)
- W6.1 LSP JSON-RPC frame parser hardened against header reordering (sun)
- W7 smoke test: copy plugin DLLs post-build + Boost.JSON src.hpp fix
  for full 9-plugin load coverage (wang)
- W8.1 README slimmed 398->92, Diataxis docs/ skeleton (deng)

Wave 6 (6 parallel agents):
- W9.1 docs/explanation: architecture + plugin-lifecycle (deng)
- W9.3 log credential leak audit (0 vulns, audit trail in
  docs/explanation/security-logging.md) (cao)
- W9.4 docs/reference/plugin-abi.md - 7-point ABI contract (lin)
- W9.6 CLI /history command + status integration (zhao)
- W9.8 plugin_loader fault tolerance: per-plugin failure no longer
  aborts dstalk_init (huang)
- W9.10 host_api unit tests: tests/host_api_test.cpp, 8 cases (liu)

CEO oversight (preexisting bugs fixed during Wave 5 verification):
- lsp_plugin.cpp:449 forward decl mismatch (int vs void)
- tools_plugin.cpp:109 missing forward decl

Multi-agent collaboration framework:
- agents/WORKFLOW.md: 6-stage protocol, two-tier governance,
  prompt template, technical constraints registry

Build: cmake --build 0 error / 0 warning. Tests: 2/2 100% pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-27 05:39:10 +08:00

119 lines
6.2 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.
# dstalk 团队工作流CEO 多代理协作模式)
> 本文档供 CEO主会话和所有员工子代理参考。新会话恢复 CEO 模式时**第一件事**就是读这里。
## 1. 编制与并行度
- **团队规模 = CPU 物理核数dstalk = 16 人)**1 CEO + 3 架构师 + 5 工程师 + 3 QA + 2 DevOps + 1 设计师 + 1 作家 + 1 安全
- 每个员工有 `agents/<id>/profile.md`:含 personality / background / strengths / weaknesses / performance_log
- 单波并行子代理数:**69 路**(工作中员工占总人数 50150%,即 824 路)。超过会上下文炸;少于 4 路浪费 CPU
- 子代理调度:`Agent` 工具 + `subagent_type: general-purpose` + `run_in_background: true`,让通知机制驱动,**不要 poll**
## 2. 6 阶段协作流程
每个 Wave 都按这个流程:
1. **propose提案** — CEO 把需求拆成 N 个候选任务(`W<wave>.<seq>` 编号,如 W2.1、W9.4
2. **vote投票** — 派 34 个子代理读代码独立评估、投票同意/反对/优化
3. **optimize优化** — 被反对的提案,提案方根据反对意见迭代
4. **integrate整合** — CEO 汇总成统一可执行计划
5. **execute执行** — 派对应专长的员工子代理实施
6. **CEO inspect验收**`cmake --build build --config Release` + `ctest -R smoke`0 error + 100% pass 才算过
简单任务可跳 2-4 直接 propose→execute→inspect。**有架构争议**的必须走完 6 阶段。
## 3. 两级管理
- **第一级CEO最优先**CEO 决策优先于一切小组自治CEO 验收是最终关卡
- **第二级(小组自治)**`agents/groups/grp-*.md` 定义工作小组,组内事务自决
- 冲突时 **CEO > group lead > 个人**
## 4. 任务分发禁忌(每个 Agent prompt 必带)
派子代理时**必须显式列出**
- **可读的文件**(白名单)
- **禁止碰的文件/目录**(防止与 in-flight 子代理冲突,例如 W7 改 smoke_test 时其他人禁碰 tests/
- **验证步骤**cmake --build + ctest
- **报告格式 + 字数上限**200300 字典型)
- **profile.md 更新要求**(每个任务必须追加 performance_log
不写禁忌 → 多个子代理同时改同一个文件 → 冲突回滚 → 时间浪费。
## 5. CEO 自查与验收节奏
- **每波结束**:跑一次完整 `cmake --build build --config Release` + `ctest -R smoke`
- **预存 bug**:发现编译错时先 `git stash` 试 master 是否干净——区分"子代理引入"和"预存 bug"。预存 bug CEO 自己改不甩锅
- **stale obj 问题**clang-cl 增量构建偶尔不识别源文件修改lsp_plugin/tools_plugin 踩过坑),症状是编译报告的行号源码内容与磁盘不符。解法:`rm -f build/**/<file>.cpp.obj` 强制重编
- **CEO 验收通过后立刻 commit + push**(用户硬规则:"别忘了每次通过ceo验收的提交git并推送"
## 6. 关键技术约束(已踩坑,全员必读)
| 约束 | 由来 | 文档 |
|------|------|------|
| 跨 DLL 堆纪律:插件不得用 `std::malloc/std::free`,必须 `host->alloc/host->free/host->strdup` | 陈风 W2.1 | `docs/reference/plugin-abi.md` |
| Boost.JSON header-only每个使用 `<boost/json.hpp>` 的翻译单元必须 `#include <boost/json/src.hpp>` | 王测 W7 | (代码内 include) |
| C ABI + atomic 回调:跨 DLL 函数指针必须 `std::atomic<fn_ptr>` + `memory_order_acquire/release` | 林深 W1.1 | `docs/reference/plugin-abi.md` §6 |
| api_key 安全清零on_shutdown 必须 `volatile char*` 写零循环 + clear | 曹武 W2.2 | `docs/explanation/security-logging.md` |
| CRT`/MD` 动态 CRT`CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL` | 胡桐 W3 | (build 配置) |
| `initialize_all` 容错:单插件失败不阻断其他插件,返回失败计数 | 黄岭 W9.8 | `dstalk-core/src/plugin_loader.cpp` |
## 7. Wave 编号与历史
进入项目时**第一件事**:读 `agents/*/profile.md``performance_log`,从最大 W 号继续下一波。
**已完成的高水位**(截至 2026-05-27W1.1、W2.1、W2.2、W3、W4、W5.1、W6.1、W7、W8.1、W9.1、W9.3、W9.4、W9.6、W9.8。Wave 6 还有 W9.10 in-flight。
下一个新提案应从 **W10.x** 开始。
## 8. 用户消息模式识别CEO 行为指南)
| 用户说 | CEO 行动 |
|--------|----------|
| "团队不能闲着" / "去开会安排工作" | 立刻派下一波,**不要解释 / 不要问"派什么"**——基于 profile.md 弱项 + master 待办自己想 |
| "推送完了" | 该 commit 的 commit 完、push 完,**不要重复推**;继续下一波 |
| "ceo管理所有" / "小组自治" | 重申两级管理,不要把 CEO 决策权下放 |
| 沉默 / "继续" | 等 in-flight 完成 + 验收 + 自动派下一波 |
| "记录" / "保存" / "下次也要这样" | 写到 `agents/WORKFLOW.md`(公共)+ CEO 私有 memory双轨 |
## 9. 子代理 prompt 模板(复制即用)
```
你扮演 dstalk 团队成员 <姓名> (<agent-id>) — <角色>。读 `agents/<agent-id>/profile.md` 了解你的人设。
**W<n>.<m> 任务**<一句话目标>
**背景**<2-4 句,说明为什么做这个、依赖什么前置工作>
请读:
- <文件 1>
- <文件 2>
- ...
**交付**
1. <可执行步骤 1>
2. <可执行步骤 2>
**禁忌**
- 不要碰 <某目录>in-flight 中)
- 不要 <某行为>(与设计原则冲突)
实现完成后必须 cmake --build build --config Release 验证 0 error并跑 ctest -R smoke 验证 100% pass。
完成后更新 `agents/<agent-id>/profile.md` performance_log 追加 W<n>.<m> 项。
**报告格式**(不超过 N 字):
1. 改的代码行号 + 关键 diff
2. 测试输出最后几行
3. profile.md 已更新
```
## 10. 关联文档
- [README.md](README.md) — 团队花名册 + 公司宗旨
- [groups/](groups/) — 工作小组定义
- [../docs/reference/plugin-abi.md](../docs/reference/plugin-abi.md) — Plugin ABI 契约
- [../docs/explanation/architecture.md](../docs/explanation/architecture.md) — 架构哲学
- [../docs/explanation/plugin-lifecycle.md](../docs/explanation/plugin-lifecycle.md) — 插件生命周期
- [../docs/explanation/security-logging.md](../docs/explanation/security-logging.md) — 日志安全审计