AI Coding Workflow Blueprint
版本:v0.1
定位:开发者使用 Claude Code,在"系分文档已完成"的前提下,完成从设计到代码交付、复盘、自我进化的可复用流程。
目标:流程可视化、可拆分、可替换、可迭代,不把所有动作塞进一个不可控的大 workflow。
1. 设计原则
这个 workflow 不把 Claude Code 当成"自动写完整系统"的黑盒,而是当成一个可编排执行器。
核心思路:
- 系分文档是起点,不再重复做需求澄清。
- 先把系分转成可编码契约,再拆成可验证的闭环 slice。
- 每次只推进一个 slice,降低上下文污染和改动失控。
- workflow 负责节奏和检查点,skill 负责可复用动作,subagent 负责专业角色,hook 负责硬约束,MCP 负责连接外部工具。
- 自我进化只生成提案,不自动改写规则,避免 AI 配置逐渐失真。
2. 主流程总览
#mermaid-svg-haqpRNjUGXYiu7kY{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-haqpRNjUGXYiu7kY .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-haqpRNjUGXYiu7kY .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-haqpRNjUGXYiu7kY .error-icon{fill:#552222;}#mermaid-svg-haqpRNjUGXYiu7kY .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-haqpRNjUGXYiu7kY .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-haqpRNjUGXYiu7kY .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-haqpRNjUGXYiu7kY .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-haqpRNjUGXYiu7kY .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-haqpRNjUGXYiu7kY .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-haqpRNjUGXYiu7kY .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-haqpRNjUGXYiu7kY .marker{fill:#333333;stroke:#333333;}#mermaid-svg-haqpRNjUGXYiu7kY .marker.cross{stroke:#333333;}#mermaid-svg-haqpRNjUGXYiu7kY svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-haqpRNjUGXYiu7kY p{margin:0;}#mermaid-svg-haqpRNjUGXYiu7kY .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-haqpRNjUGXYiu7kY .cluster-label text{fill:#333;}#mermaid-svg-haqpRNjUGXYiu7kY .cluster-label span{color:#333;}#mermaid-svg-haqpRNjUGXYiu7kY .cluster-label span p{background-color:transparent;}#mermaid-svg-haqpRNjUGXYiu7kY .label text,#mermaid-svg-haqpRNjUGXYiu7kY span{fill:#333;color:#333;}#mermaid-svg-haqpRNjUGXYiu7kY .node rect,#mermaid-svg-haqpRNjUGXYiu7kY .node circle,#mermaid-svg-haqpRNjUGXYiu7kY .node ellipse,#mermaid-svg-haqpRNjUGXYiu7kY .node polygon,#mermaid-svg-haqpRNjUGXYiu7kY .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-haqpRNjUGXYiu7kY .rough-node .label text,#mermaid-svg-haqpRNjUGXYiu7kY .node .label text,#mermaid-svg-haqpRNjUGXYiu7kY .image-shape .label,#mermaid-svg-haqpRNjUGXYiu7kY .icon-shape .label{text-anchor:middle;}#mermaid-svg-haqpRNjUGXYiu7kY .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-haqpRNjUGXYiu7kY .rough-node .label,#mermaid-svg-haqpRNjUGXYiu7kY .node .label,#mermaid-svg-haqpRNjUGXYiu7kY .image-shape .label,#mermaid-svg-haqpRNjUGXYiu7kY .icon-shape .label{text-align:center;}#mermaid-svg-haqpRNjUGXYiu7kY .node.clickable{cursor:pointer;}#mermaid-svg-haqpRNjUGXYiu7kY .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-haqpRNjUGXYiu7kY .arrowheadPath{fill:#333333;}#mermaid-svg-haqpRNjUGXYiu7kY .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-haqpRNjUGXYiu7kY .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-haqpRNjUGXYiu7kY .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-haqpRNjUGXYiu7kY .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-haqpRNjUGXYiu7kY .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-haqpRNjUGXYiu7kY .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-haqpRNjUGXYiu7kY .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-haqpRNjUGXYiu7kY .cluster text{fill:#333;}#mermaid-svg-haqpRNjUGXYiu7kY .cluster span{color:#333;}#mermaid-svg-haqpRNjUGXYiu7kY div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-haqpRNjUGXYiu7kY .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-haqpRNjUGXYiu7kY rect.text{fill:none;stroke-width:0;}#mermaid-svg-haqpRNjUGXYiu7kY .icon-shape,#mermaid-svg-haqpRNjUGXYiu7kY .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-haqpRNjUGXYiu7kY .icon-shape p,#mermaid-svg-haqpRNjUGXYiu7kY .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-haqpRNjUGXYiu7kY .icon-shape .label rect,#mermaid-svg-haqpRNjUGXYiu7kY .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-haqpRNjUGXYiu7kY .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-haqpRNjUGXYiu7kY .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-haqpRNjUGXYiu7kY :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}#mermaid-svg-haqpRNjUGXYiu7kY .input>*{fill:#F5F1E8!important;stroke:#B7A77A!important;color:#201E1A!important;stroke-width:1.4px!important;}#mermaid-svg-haqpRNjUGXYiu7kY .input span{fill:#F5F1E8!important;stroke:#B7A77A!important;color:#201E1A!important;stroke-width:1.4px!important;}#mermaid-svg-haqpRNjUGXYiu7kY .input tspan{fill:#201E1A!important;}#mermaid-svg-haqpRNjUGXYiu7kY .stage>*{fill:#E9F2FF!important;stroke:#4878B8!important;color:#0F2544!important;stroke-width:1.4px!important;}#mermaid-svg-haqpRNjUGXYiu7kY .stage span{fill:#E9F2FF!important;stroke:#4878B8!important;color:#0F2544!important;stroke-width:1.4px!important;}#mermaid-svg-haqpRNjUGXYiu7kY .stage tspan{fill:#0F2544!important;}#mermaid-svg-haqpRNjUGXYiu7kY .gate>*{fill:#FFF3D6!important;stroke:#C58A18!important;color:#3A2A05!important;stroke-width:1.6px!important;}#mermaid-svg-haqpRNjUGXYiu7kY .gate span{fill:#FFF3D6!important;stroke:#C58A18!important;color:#3A2A05!important;stroke-width:1.6px!important;}#mermaid-svg-haqpRNjUGXYiu7kY .gate tspan{fill:#3A2A05!important;}#mermaid-svg-haqpRNjUGXYiu7kY .artifact>*{fill:#EAF7EF!important;stroke:#3F9B62!important;color:#123A22!important;stroke-width:1.4px!important;}#mermaid-svg-haqpRNjUGXYiu7kY .artifact span{fill:#EAF7EF!important;stroke:#3F9B62!important;color:#123A22!important;stroke-width:1.4px!important;}#mermaid-svg-haqpRNjUGXYiu7kY .artifact tspan{fill:#123A22!important;}#mermaid-svg-haqpRNjUGXYiu7kY .loop>*{fill:#F2EAFE!important;stroke:#8B5BC8!important;color:#2B1746!important;stroke-width:1.4px!important;}#mermaid-svg-haqpRNjUGXYiu7kY .loop span{fill:#F2EAFE!important;stroke:#8B5BC8!important;color:#2B1746!important;stroke-width:1.4px!important;}#mermaid-svg-haqpRNjUGXYiu7kY .loop tspan{fill:#2B1746!important;}#mermaid-svg-haqpRNjUGXYiu7kY .endNode>*{fill:#FCEBEC!important;stroke:#C8505A!important;color:#43171B!important;stroke-width:1.4px!important;}#mermaid-svg-haqpRNjUGXYiu7kY .endNode span{fill:#FCEBEC!important;stroke:#C8505A!important;color:#43171B!important;stroke-width:1.4px!important;}#mermaid-svg-haqpRNjUGXYiu7kY .endNode tspan{fill:#43171B!important;} 确认
否
是
有
无
采纳
暂不采纳
系分文档
System Analysis
上下文包
CLAUDE.md + 代码地图 + 知识库摘要
任务简报
AI Interview Brief
编码契约
Coding Contract
闭环切片 DAG
Verifiable Slice Graph
人工确认
范围 / 顺序 / 风险
DAG 执行批次
依赖 / 并行度 / 工作区
Slice 实现
并行或串行小闭环
静态验证
typecheck / lint / format / schema
验证通过?
人工裁决修复
问题清单 / 方案确认 / 执行
独立 Review
规格 / 验证 / 维护性 / 安全
人工确认修复项?
交付包
摘要 / 证据 / PR 文案
复盘
经验 / 问题 / 改进点
进化提案
rules / skills / hooks / agents
人工采纳?
更新工作流资产
下一轮任务
New Slice / New Design Change
3. 分层资产图
#mermaid-svg-wNmJi3sXPDTZX7J8{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-wNmJi3sXPDTZX7J8 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-wNmJi3sXPDTZX7J8 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-wNmJi3sXPDTZX7J8 .error-icon{fill:#552222;}#mermaid-svg-wNmJi3sXPDTZX7J8 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-wNmJi3sXPDTZX7J8 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-wNmJi3sXPDTZX7J8 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-wNmJi3sXPDTZX7J8 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-wNmJi3sXPDTZX7J8 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-wNmJi3sXPDTZX7J8 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-wNmJi3sXPDTZX7J8 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-wNmJi3sXPDTZX7J8 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-wNmJi3sXPDTZX7J8 .marker.cross{stroke:#333333;}#mermaid-svg-wNmJi3sXPDTZX7J8 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-wNmJi3sXPDTZX7J8 p{margin:0;}#mermaid-svg-wNmJi3sXPDTZX7J8 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-wNmJi3sXPDTZX7J8 .cluster-label text{fill:#333;}#mermaid-svg-wNmJi3sXPDTZX7J8 .cluster-label span{color:#333;}#mermaid-svg-wNmJi3sXPDTZX7J8 .cluster-label span p{background-color:transparent;}#mermaid-svg-wNmJi3sXPDTZX7J8 .label text,#mermaid-svg-wNmJi3sXPDTZX7J8 span{fill:#333;color:#333;}#mermaid-svg-wNmJi3sXPDTZX7J8 .node rect,#mermaid-svg-wNmJi3sXPDTZX7J8 .node circle,#mermaid-svg-wNmJi3sXPDTZX7J8 .node ellipse,#mermaid-svg-wNmJi3sXPDTZX7J8 .node polygon,#mermaid-svg-wNmJi3sXPDTZX7J8 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-wNmJi3sXPDTZX7J8 .rough-node .label text,#mermaid-svg-wNmJi3sXPDTZX7J8 .node .label text,#mermaid-svg-wNmJi3sXPDTZX7J8 .image-shape .label,#mermaid-svg-wNmJi3sXPDTZX7J8 .icon-shape .label{text-anchor:middle;}#mermaid-svg-wNmJi3sXPDTZX7J8 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-wNmJi3sXPDTZX7J8 .rough-node .label,#mermaid-svg-wNmJi3sXPDTZX7J8 .node .label,#mermaid-svg-wNmJi3sXPDTZX7J8 .image-shape .label,#mermaid-svg-wNmJi3sXPDTZX7J8 .icon-shape .label{text-align:center;}#mermaid-svg-wNmJi3sXPDTZX7J8 .node.clickable{cursor:pointer;}#mermaid-svg-wNmJi3sXPDTZX7J8 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-wNmJi3sXPDTZX7J8 .arrowheadPath{fill:#333333;}#mermaid-svg-wNmJi3sXPDTZX7J8 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-wNmJi3sXPDTZX7J8 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-wNmJi3sXPDTZX7J8 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-wNmJi3sXPDTZX7J8 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-wNmJi3sXPDTZX7J8 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-wNmJi3sXPDTZX7J8 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-wNmJi3sXPDTZX7J8 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-wNmJi3sXPDTZX7J8 .cluster text{fill:#333;}#mermaid-svg-wNmJi3sXPDTZX7J8 .cluster span{color:#333;}#mermaid-svg-wNmJi3sXPDTZX7J8 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-wNmJi3sXPDTZX7J8 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-wNmJi3sXPDTZX7J8 rect.text{fill:none;stroke-width:0;}#mermaid-svg-wNmJi3sXPDTZX7J8 .icon-shape,#mermaid-svg-wNmJi3sXPDTZX7J8 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-wNmJi3sXPDTZX7J8 .icon-shape p,#mermaid-svg-wNmJi3sXPDTZX7J8 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-wNmJi3sXPDTZX7J8 .icon-shape .label rect,#mermaid-svg-wNmJi3sXPDTZX7J8 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-wNmJi3sXPDTZX7J8 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-wNmJi3sXPDTZX7J8 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-wNmJi3sXPDTZX7J8 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}#mermaid-svg-wNmJi3sXPDTZX7J8 .human>*{fill:#FFF3D6!important;stroke:#C58A18!important;color:#332200!important;}#mermaid-svg-wNmJi3sXPDTZX7J8 .human span{fill:#FFF3D6!important;stroke:#C58A18!important;color:#332200!important;}#mermaid-svg-wNmJi3sXPDTZX7J8 .human tspan{fill:#332200!important;}#mermaid-svg-wNmJi3sXPDTZX7J8 .control>*{fill:#E9F2FF!important;stroke:#4878B8!important;color:#0F2544!important;}#mermaid-svg-wNmJi3sXPDTZX7J8 .control span{fill:#E9F2FF!important;stroke:#4878B8!important;color:#0F2544!important;}#mermaid-svg-wNmJi3sXPDTZX7J8 .control tspan{fill:#0F2544!important;}#mermaid-svg-wNmJi3sXPDTZX7J8 .asset>*{fill:#EAF7EF!important;stroke:#3F9B62!important;color:#123A22!important;}#mermaid-svg-wNmJi3sXPDTZX7J8 .asset span{fill:#EAF7EF!important;stroke:#3F9B62!important;color:#123A22!important;}#mermaid-svg-wNmJi3sXPDTZX7J8 .asset tspan{fill:#123A22!important;}#mermaid-svg-wNmJi3sXPDTZX7J8 .tool>*{fill:#F2EAFE!important;stroke:#8B5BC8!important;color:#2B1746!important;}#mermaid-svg-wNmJi3sXPDTZX7J8 .tool span{fill:#F2EAFE!important;stroke:#8B5BC8!important;color:#2B1746!important;}#mermaid-svg-wNmJi3sXPDTZX7J8 .tool tspan{fill:#2B1746!important;}#mermaid-svg-wNmJi3sXPDTZX7J8 .guard>*{fill:#FCEBEC!important;stroke:#C8505A!important;color:#43171B!important;}#mermaid-svg-wNmJi3sXPDTZX7J8 .guard span{fill:#FCEBEC!important;stroke:#C8505A!important;color:#43171B!important;}#mermaid-svg-wNmJi3sXPDTZX7J8 .guard tspan{fill:#43171B!important;} 你
方向判断 / 审批 / 取舍
Workflow
编排阶段、并行分析、review fan-out
Skills
可复用动作:start / plan / implement / verify / retro
Subagents
专业角色:静态检查、架构、安全、review
Rules & CLAUDE.md
长期规则、项目约束、编码风格
Hooks
强制门禁、危险命令阻断、完成前检查
MCP
GitHub / Figma / DB read-only / Docs / 远端证据
Claude Code
执行器
4. 阶段设计
Phase 0:上下文基线与证据包
目标:用户上传系分文档后,先按设计目标获取后续 AI 开发真正会用到的上下文,形成一份可复用、可追踪、可刷新、不过载的上下文包。
这个阶段不是泛泛地"初始化项目",也不是把整个仓库塞给 Claude。它要回答三个问题:
- 系分文档要求实现什么?
- 当前代码库里哪些内容与这些要求直接相关?
- 团队已有知识库、
CLAUDE.md、项目规则里有哪些约束会影响后续实现?
输入:
- 系分文档
- 项目仓库
CLAUDE.md.claude/rules/*- README、架构文档、测试说明、部署说明
- 团队知识库读取 skill
- 可选:issue、PR、历史设计记录、错误日志、运行手册
输出:
docs/ai-coding/context/context-pack.mddocs/ai-coding/context/codebase-context.mddocs/ai-coding/context/knowledge-context.mddocs/ai-coding/context/project-rules-summary.mddocs/ai-coding/context/execution-baseline.mddocs/ai-coding/context/context-gaps.md
上下文包建议结构:
markdown
# Context Pack
## 1. Context Snapshot
- 系分文档版本 / 路径 / 最后更新时间
- 当前代码分支 / commit
- CLAUDE.md 和 rules 读取结果
- 知识库查询时间和查询词
- 上下文刷新触发条件
## 2. Design Intent Summary
- 本次开发目标
- 明确非目标
- 关键业务规则
- 高风险约束
## 3. Project Rules Summary
- 必须遵守的项目约定
- 编码风格
- 目录边界
- 测试和验证命令
- 禁止事项
## 4. Relevant Code Map
- 相关模块
- 相关入口
- 关键文件
- 已有相似实现
- 测试位置
- 可能受影响的边界
## 5. Knowledge Base Context
- 团队知识库中与本次设计相关的条目
- 结论摘要
- 可引用链接或来源
- 与当前系分/代码冲突的地方
## 6. Risk And Constraint Map
- 鉴权 / 权限
- 数据模型 / 迁移
- 外部依赖
- 性能约束
- 兼容性约束
- 安全敏感文件
## 7. Open Context Gaps
- 缺失信息
- 影响范围
- 建议补充方式
- 是否阻塞后续阶段
建议流程:
#mermaid-svg-QoWPUmfpXYOIJUlG{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-QoWPUmfpXYOIJUlG .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-QoWPUmfpXYOIJUlG .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-QoWPUmfpXYOIJUlG .error-icon{fill:#552222;}#mermaid-svg-QoWPUmfpXYOIJUlG .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-QoWPUmfpXYOIJUlG .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-QoWPUmfpXYOIJUlG .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-QoWPUmfpXYOIJUlG .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-QoWPUmfpXYOIJUlG .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-QoWPUmfpXYOIJUlG .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-QoWPUmfpXYOIJUlG .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-QoWPUmfpXYOIJUlG .marker{fill:#333333;stroke:#333333;}#mermaid-svg-QoWPUmfpXYOIJUlG .marker.cross{stroke:#333333;}#mermaid-svg-QoWPUmfpXYOIJUlG svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-QoWPUmfpXYOIJUlG p{margin:0;}#mermaid-svg-QoWPUmfpXYOIJUlG .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-QoWPUmfpXYOIJUlG .cluster-label text{fill:#333;}#mermaid-svg-QoWPUmfpXYOIJUlG .cluster-label span{color:#333;}#mermaid-svg-QoWPUmfpXYOIJUlG .cluster-label span p{background-color:transparent;}#mermaid-svg-QoWPUmfpXYOIJUlG .label text,#mermaid-svg-QoWPUmfpXYOIJUlG span{fill:#333;color:#333;}#mermaid-svg-QoWPUmfpXYOIJUlG .node rect,#mermaid-svg-QoWPUmfpXYOIJUlG .node circle,#mermaid-svg-QoWPUmfpXYOIJUlG .node ellipse,#mermaid-svg-QoWPUmfpXYOIJUlG .node polygon,#mermaid-svg-QoWPUmfpXYOIJUlG .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-QoWPUmfpXYOIJUlG .rough-node .label text,#mermaid-svg-QoWPUmfpXYOIJUlG .node .label text,#mermaid-svg-QoWPUmfpXYOIJUlG .image-shape .label,#mermaid-svg-QoWPUmfpXYOIJUlG .icon-shape .label{text-anchor:middle;}#mermaid-svg-QoWPUmfpXYOIJUlG .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-QoWPUmfpXYOIJUlG .rough-node .label,#mermaid-svg-QoWPUmfpXYOIJUlG .node .label,#mermaid-svg-QoWPUmfpXYOIJUlG .image-shape .label,#mermaid-svg-QoWPUmfpXYOIJUlG .icon-shape .label{text-align:center;}#mermaid-svg-QoWPUmfpXYOIJUlG .node.clickable{cursor:pointer;}#mermaid-svg-QoWPUmfpXYOIJUlG .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-QoWPUmfpXYOIJUlG .arrowheadPath{fill:#333333;}#mermaid-svg-QoWPUmfpXYOIJUlG .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-QoWPUmfpXYOIJUlG .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-QoWPUmfpXYOIJUlG .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-QoWPUmfpXYOIJUlG .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-QoWPUmfpXYOIJUlG .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-QoWPUmfpXYOIJUlG .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-QoWPUmfpXYOIJUlG .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-QoWPUmfpXYOIJUlG .cluster text{fill:#333;}#mermaid-svg-QoWPUmfpXYOIJUlG .cluster span{color:#333;}#mermaid-svg-QoWPUmfpXYOIJUlG div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-QoWPUmfpXYOIJUlG .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-QoWPUmfpXYOIJUlG rect.text{fill:none;stroke-width:0;}#mermaid-svg-QoWPUmfpXYOIJUlG .icon-shape,#mermaid-svg-QoWPUmfpXYOIJUlG .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-QoWPUmfpXYOIJUlG .icon-shape p,#mermaid-svg-QoWPUmfpXYOIJUlG .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-QoWPUmfpXYOIJUlG .icon-shape .label rect,#mermaid-svg-QoWPUmfpXYOIJUlG .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-QoWPUmfpXYOIJUlG .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-QoWPUmfpXYOIJUlG .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-QoWPUmfpXYOIJUlG :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}#mermaid-svg-QoWPUmfpXYOIJUlG .input>*{fill:#F5F1E8!important;stroke:#B7A77A!important;color:#201E1A!important;stroke-width:1.4px!important;}#mermaid-svg-QoWPUmfpXYOIJUlG .input span{fill:#F5F1E8!important;stroke:#B7A77A!important;color:#201E1A!important;stroke-width:1.4px!important;}#mermaid-svg-QoWPUmfpXYOIJUlG .input tspan{fill:#201E1A!important;}#mermaid-svg-QoWPUmfpXYOIJUlG .action>*{fill:#E9F2FF!important;stroke:#4878B8!important;color:#0F2544!important;stroke-width:1.4px!important;}#mermaid-svg-QoWPUmfpXYOIJUlG .action span{fill:#E9F2FF!important;stroke:#4878B8!important;color:#0F2544!important;stroke-width:1.4px!important;}#mermaid-svg-QoWPUmfpXYOIJUlG .action tspan{fill:#0F2544!important;}#mermaid-svg-QoWPUmfpXYOIJUlG .artifact>*{fill:#EAF7EF!important;stroke:#3F9B62!important;color:#123A22!important;stroke-width:1.4px!important;}#mermaid-svg-QoWPUmfpXYOIJUlG .artifact span{fill:#EAF7EF!important;stroke:#3F9B62!important;color:#123A22!important;stroke-width:1.4px!important;}#mermaid-svg-QoWPUmfpXYOIJUlG .artifact tspan{fill:#123A22!important;}#mermaid-svg-QoWPUmfpXYOIJUlG .gate>*{fill:#FFF3D6!important;stroke:#C58A18!important;color:#3A2A05!important;stroke-width:1.6px!important;}#mermaid-svg-QoWPUmfpXYOIJUlG .gate span{fill:#FFF3D6!important;stroke:#C58A18!important;color:#3A2A05!important;stroke-width:1.6px!important;}#mermaid-svg-QoWPUmfpXYOIJUlG .gate tspan{fill:#3A2A05!important;} 足够
不足
上传系分文档
读取项目规则
CLAUDE.md / .claude/rules / README
提取设计意图
功能 / 非目标 / 风险 / 关键词
按设计意图检索代码
入口 / 模块 / 相似实现 / 测试
调用团队知识库 Skill
查询约定 / 历史方案 / 业务背景
汇总上下文包
只保留后续开发需要的证据
上下文是否足够?
记录缺口
阻塞项 / 非阻塞项
进入编码契约阶段
建议工具:
- Skill:
aicoding-context - Skill:团队知识库读取 skill
- Subagent:
context-curator - Subagent:
codebase-cartographer - Subagent:
knowledgebase-researcher - 可选:
/init - 可选:
/run-skill-generator
上下文获取策略:
- 先从系分文档提取检索关键词、模块名、业务实体、接口名、状态名、错误码、权限点。
- 读取
CLAUDE.md和.claude/rules/*,把强约束提升为后续所有阶段的全局约束。 - 检索相关代码时优先找入口、已有模式、相似实现和测试,不做全仓库无差别总结。
- 调用团队知识库 skill 时,查询词必须来自系分和代码映射,避免知识库结果过宽。
- 每条上下文都标注来源、置信度、适用阶段和是否可能过期。
- 区分稳定上下文和临时上下文。项目规则、架构边界属于稳定上下文;某个 slice 的具体文件细节属于临时上下文,后续 Phase 3 再收敛。
- 如果
CLAUDE.md、知识库、代码实现、系分文档之间存在冲突,不能直接选择一个相信,要写入context-gaps.md。
人工 Gate:
- 如果存在阻塞性上下文缺口,先让用户确认或补充。
- 如果上下文里出现系分、代码、知识库互相冲突,必须让用户裁决。
- 如果发现高风险区域,例如鉴权、计费、数据库迁移、生产配置,要在后续切片中标记为高风险。
完成标准:
- 后续 Phase 1 不需要重新盲目搜索项目背景。
- 每个核心设计目标都能对应到相关代码区域或明确标记为新增能力。
- 团队知识库中的相关约定已被摘要,并标明来源。
- 项目硬规则已进入
project-rules-summary.md。 - 上下文缺口已分类为阻塞或非阻塞。
- 上下文包有刷新条件,例如系分变更、
CLAUDE.md变更、相关代码大改、知识库结论更新。
Phase 1:系分转编码契约
目标:把系分文档和 Phase 0 的上下文包翻译成"可以被编码、测试、review 和追责的契约"。
这一阶段会直接决定后续代码质量。它不只是把系分换一种格式,而是把"实现应该长什么样、不能破坏什么、如何证明完成、哪些质量门槛不能降级"提前写清楚。后续切片、编码、验证、review 都应该以这份契约为依据。
复杂任务最容易失败的地方,是一开始需求没有问清楚。人类工程师会在评审会上追问边界条件、异常路径、兼容性和非目标;AI 如果看到用户语气很确定,容易直接执行。所以 Phase 1 必须先做"AI 采访",把问答沉淀成结构化任务简报,再由人类确认。确认后的任务简报成为后续流程的正式依据。后续阶段不能依赖散落在聊天历史里的回答。
输入:
- 系分文档
- Phase 0 生成的上下文包
- 项目规则摘要
- 知识库摘要
- 上下文缺口清单
前置输出:
docs/ai-coding/task-brief.mddocs/ai-coding/interview-decisions.md
输出:docs/ai-coding/coding-contract.md
AI 采访目标:
- 追问系分里没有写清楚但会影响实现质量的点。
- 把用户口头回答转成结构化事实、决策和约束。
- 明确哪些回答是已确认事实,哪些只是推测。
- 避免后续 Claude 依赖聊天历史中的零散信息。
采访重点:
- 业务边界:哪些场景必须支持,哪些明确不支持。
- 角色和权限:谁能做什么,越权时如何表现。
- 状态和生命周期:状态如何流转,是否允许回退、重试、取消。
- 异常路径:失败、超时、重复请求、部分成功如何处理。
- 幂等和一致性:重复操作、并发操作、事务失败如何处理。
- 兼容性:旧数据、旧接口、旧客户端是否要兼容。
- 数据模型:哪些字段必需,哪些字段可为空,历史数据如何处理。
- 外部依赖:第三方服务不可用时如何降级或重试。
- 可观测性:日志、审计、指标、告警是否有要求。
- 验收方式:什么证据能证明这个需求完成。
任务简报结构:
markdown
# Task Brief
## 1. Confirmed Objective
## 2. Confirmed Scope
## 3. Explicit Non-goals
## 4. Actors And Permissions
## 5. Key Business Rules
## 6. State Transitions And Edge Cases
## 7. Data And Compatibility Decisions
## 8. Error Handling And Retry Policy
## 9. Verification Evidence
## 10. Open Questions
## 11. Human Confirmed Decisions
采访规则:
- 一轮最多问 5 到 8 个高价值问题,避免把用户拖进长问卷。
- 问题必须来自 Phase 0 的上下文缺口、系分不明确处、质量风险或高风险领域。
- 如果问题不阻塞实现,标记为非阻塞,不拖慢流程。
- 每个用户回答必须写入
task-brief.md或interview-decisions.md。 - 用户确认任务简报后,后续流程只引用任务简报和编码契约,不引用聊天历史。
契约结构:
- 契约元信息
- 系分文档来源
- 上下文包版本
- 代码基线 commit
- 契约适用范围
- 契约刷新条件
- 功能契约
- 功能范围
- 非目标范围
- 用户可见行为
- 业务规则
- 状态机和边界条件
- 架构契约
- 模块边界
- 允许依赖
- 禁止依赖
- 复用既有抽象
- 不允许顺手重构的区域
- 接口和数据契约
- API 输入输出
- 错误码和错误语义
- 数据模型
- 数据迁移约束
- 向后兼容要求
- 质量契约
- 可读性要求
- 复杂度约束
- 幂等性/事务性要求
- 性能约束
- 可观测性要求
- 可维护性要求
- 安全契约
- 鉴权
- 授权
- 输入校验
- 敏感数据处理
- 日志脱敏
- 依赖和网络访问限制
- 测试契约
- 必测路径
- 边界测试
- 错误路径
- 回归测试
- 不需要测试的理由
- 最小验证命令
- 交付契约
- 完成定义
- PR/commit 说明要求
- 静态验证证据要求
- 人工联调交接要求
- 已知风险披露要求
- 反需求清单
- 明确不做什么
- 明确不能改什么
- 明确不能引入什么
- 未决问题
- 阻塞问题
- 非阻塞问题
- 需要用户裁决的问题
建议增加一个"质量前置矩阵":
markdown
| 契约项 | 来源 | 影响模块 | 质量风险 | 测试义务 | Review 重点 | 是否阻塞 |
|--------|------|----------|----------|----------|-------------|----------|
| 用户只能访问自己的数据 | 系分#权限模型 | auth, api, db | 越权 | 单测 + 集成测试 | 安全 review | 是 |
建议增加一个"行为不变量"列表:
markdown
## Behavior Invariants
- 已有公开 API 的响应字段不能被删除,除非契约明确要求。
- 未登录用户不能访问受保护资源。
- 数据写入失败时不能产生半完成状态。
- 新增功能不能降低现有测试覆盖的核心路径。
建议增加一个"质量评分":
yaml
contract_quality_score:
acceptance_criteria_clarity: 1-5
testability: 1-5
architecture_boundary_clarity: 1-5
risk_visibility: 1-5
context_conflict_resolution: 1-5
implementation_readiness: ready | needs_human_decision | blocked
建议调用:
- Skill:
aicoding-interview - Skill:
aicoding-start - Subagent:
task-interviewer - Subagent:
design-contract-reviewer - Subagent:
test-strategist - Subagent:
architecture-reviewer - 高风险时追加 Subagent:
security-reviewer
建议流程:
#mermaid-svg-Y7PpsSKEFsUgEFZf{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-Y7PpsSKEFsUgEFZf .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-Y7PpsSKEFsUgEFZf .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-Y7PpsSKEFsUgEFZf .error-icon{fill:#552222;}#mermaid-svg-Y7PpsSKEFsUgEFZf .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-Y7PpsSKEFsUgEFZf .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-Y7PpsSKEFsUgEFZf .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-Y7PpsSKEFsUgEFZf .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-Y7PpsSKEFsUgEFZf .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-Y7PpsSKEFsUgEFZf .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-Y7PpsSKEFsUgEFZf .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-Y7PpsSKEFsUgEFZf .marker{fill:#333333;stroke:#333333;}#mermaid-svg-Y7PpsSKEFsUgEFZf .marker.cross{stroke:#333333;}#mermaid-svg-Y7PpsSKEFsUgEFZf svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-Y7PpsSKEFsUgEFZf p{margin:0;}#mermaid-svg-Y7PpsSKEFsUgEFZf .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-Y7PpsSKEFsUgEFZf .cluster-label text{fill:#333;}#mermaid-svg-Y7PpsSKEFsUgEFZf .cluster-label span{color:#333;}#mermaid-svg-Y7PpsSKEFsUgEFZf .cluster-label span p{background-color:transparent;}#mermaid-svg-Y7PpsSKEFsUgEFZf .label text,#mermaid-svg-Y7PpsSKEFsUgEFZf span{fill:#333;color:#333;}#mermaid-svg-Y7PpsSKEFsUgEFZf .node rect,#mermaid-svg-Y7PpsSKEFsUgEFZf .node circle,#mermaid-svg-Y7PpsSKEFsUgEFZf .node ellipse,#mermaid-svg-Y7PpsSKEFsUgEFZf .node polygon,#mermaid-svg-Y7PpsSKEFsUgEFZf .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-Y7PpsSKEFsUgEFZf .rough-node .label text,#mermaid-svg-Y7PpsSKEFsUgEFZf .node .label text,#mermaid-svg-Y7PpsSKEFsUgEFZf .image-shape .label,#mermaid-svg-Y7PpsSKEFsUgEFZf .icon-shape .label{text-anchor:middle;}#mermaid-svg-Y7PpsSKEFsUgEFZf .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-Y7PpsSKEFsUgEFZf .rough-node .label,#mermaid-svg-Y7PpsSKEFsUgEFZf .node .label,#mermaid-svg-Y7PpsSKEFsUgEFZf .image-shape .label,#mermaid-svg-Y7PpsSKEFsUgEFZf .icon-shape .label{text-align:center;}#mermaid-svg-Y7PpsSKEFsUgEFZf .node.clickable{cursor:pointer;}#mermaid-svg-Y7PpsSKEFsUgEFZf .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-Y7PpsSKEFsUgEFZf .arrowheadPath{fill:#333333;}#mermaid-svg-Y7PpsSKEFsUgEFZf .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-Y7PpsSKEFsUgEFZf .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-Y7PpsSKEFsUgEFZf .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Y7PpsSKEFsUgEFZf .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-Y7PpsSKEFsUgEFZf .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Y7PpsSKEFsUgEFZf .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-Y7PpsSKEFsUgEFZf .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-Y7PpsSKEFsUgEFZf .cluster text{fill:#333;}#mermaid-svg-Y7PpsSKEFsUgEFZf .cluster span{color:#333;}#mermaid-svg-Y7PpsSKEFsUgEFZf div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-Y7PpsSKEFsUgEFZf .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-Y7PpsSKEFsUgEFZf rect.text{fill:none;stroke-width:0;}#mermaid-svg-Y7PpsSKEFsUgEFZf .icon-shape,#mermaid-svg-Y7PpsSKEFsUgEFZf .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Y7PpsSKEFsUgEFZf .icon-shape p,#mermaid-svg-Y7PpsSKEFsUgEFZf .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-Y7PpsSKEFsUgEFZf .icon-shape .label rect,#mermaid-svg-Y7PpsSKEFsUgEFZf .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Y7PpsSKEFsUgEFZf .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-Y7PpsSKEFsUgEFZf .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-Y7PpsSKEFsUgEFZf :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}#mermaid-svg-Y7PpsSKEFsUgEFZf .input>*{fill:#F5F1E8!important;stroke:#B7A77A!important;color:#201E1A!important;stroke-width:1.4px!important;}#mermaid-svg-Y7PpsSKEFsUgEFZf .input span{fill:#F5F1E8!important;stroke:#B7A77A!important;color:#201E1A!important;stroke-width:1.4px!important;}#mermaid-svg-Y7PpsSKEFsUgEFZf .input tspan{fill:#201E1A!important;}#mermaid-svg-Y7PpsSKEFsUgEFZf .action>*{fill:#E9F2FF!important;stroke:#4878B8!important;color:#0F2544!important;stroke-width:1.4px!important;}#mermaid-svg-Y7PpsSKEFsUgEFZf .action span{fill:#E9F2FF!important;stroke:#4878B8!important;color:#0F2544!important;stroke-width:1.4px!important;}#mermaid-svg-Y7PpsSKEFsUgEFZf .action tspan{fill:#0F2544!important;}#mermaid-svg-Y7PpsSKEFsUgEFZf .artifact>*{fill:#EAF7EF!important;stroke:#3F9B62!important;color:#123A22!important;stroke-width:1.4px!important;}#mermaid-svg-Y7PpsSKEFsUgEFZf .artifact span{fill:#EAF7EF!important;stroke:#3F9B62!important;color:#123A22!important;stroke-width:1.4px!important;}#mermaid-svg-Y7PpsSKEFsUgEFZf .artifact tspan{fill:#123A22!important;}#mermaid-svg-Y7PpsSKEFsUgEFZf .gate>*{fill:#FFF3D6!important;stroke:#C58A18!important;color:#3A2A05!important;stroke-width:1.6px!important;}#mermaid-svg-Y7PpsSKEFsUgEFZf .gate span{fill:#FFF3D6!important;stroke:#C58A18!important;color:#3A2A05!important;stroke-width:1.6px!important;}#mermaid-svg-Y7PpsSKEFsUgEFZf .gate tspan{fill:#3A2A05!important;} 确认
调整
ready
needs decision
系分文档 + 上下文包
识别需追问问题
边界 / 异常 / 兼容 / 验收
AI 采访用户
生成任务简报
沉淀确认事实
用户确认简报?
抽取可实现条款
功能 / 数据 / 接口 / 规则
补齐质量维度
架构 / 测试 / 安全 / 性能
识别反需求
不做 / 不改 / 不引入
生成编码契约
契约自检
清晰度 / 可测性 / 边界 / 风险
可进入切片?
请求人工裁决
阻塞问题 / 冲突 / 质量不足
进入切片计划
人工 Gate:
- 任务简报未经确认,不进入编码契约生成。
- 如果契约质量评分低于阈值,不进入 Phase 2。
- 如果验收标准不可测试,必须补充或标记为非阻塞风险。
- 如果架构边界不清楚,必须明确"允许改"和"不能改"的模块。
- 如果知识库、代码现状、系分之间有冲突,必须记录裁决结果。
- 如果涉及鉴权、权限、数据迁移、资金、隐私、生产配置,必须显式标为高风险契约项。
完成标准:
- 任务简报已确认,并且用户回答已沉淀为结构化依据。
- 每个核心功能都能找到验收标准。
- 每个重要约束都有实现影响。
- 未决问题被明确列出,不被 Claude 私自假设。
- 每个高风险规则都有测试义务或人工豁免理由。
- 每个 API/数据模型变更都有兼容性说明。
- 每个功能项至少有静态验证证据要求或人工联调交接要求。
- 每个反需求都能在后续 review 中被检查。
- 契约质量评分达到进入 Phase 2 的阈值。
Phase 2:编码契约转实现切片
目标:把完整设计拆成可独立验证的闭环 slice,并构建一个有向无环图。这里的拆分不是按"前端、后端、数据库、测试"分层,而是按"一个可被测试证明的行为闭环"来拆。
很多人拆任务时会自然拆成"写退款 API、写前端、写测试"。这对人类团队分工有用,但对 AI 不一定好。AI 最适合处理的是边界清晰、反馈明确、改动可验证、失败容易回滚的小闭环。
好的 slice 应该小,但不能小到没有业务语义。不要拆成"创建文件 A、创建函数 B、添加参数 C"。这种拆法会让 AI 丢失业务意图,只能机械执行。更好的粒度是"实现一个可被测试证明的行为"。
输出:
docs/ai-coding/implementation-slices.mddocs/ai-coding/implementation-dag.mddocs/ai-coding/decomposition-options.mddocs/ai-coding/traceability-matrix.md
闭环 slice 准入条件:
- 目标能否用一句话描述。
- 涉及文件是否大致可控。
- 验证命令或验证方法是否明确。
- 失败后是否容易回滚。
- 输出是否能被 review。
如果这五点做不到,不进入实现阶段。先让 AI 做探索、补设计或缩小边界。
拆分示例:
text
订单退款能力改造
1. 状态机与数据模型最小变更,验证老订单流程不受影响
2. 退款请求幂等层,只测试重复请求行为
3. 第三方支付退款 fake adapter / sandbox 接入
4. 后台查询和失败原因展示
5. 端到端验收和异常补偿
DAG 节点结构:
yaml
id: S03
name: 退款请求幂等层
behavior: 重复提交同一退款请求时只产生一次有效退款动作
depends_on:
- S01
contract_refs:
- coding-contract.md#退款幂等
expected_files:
- src/refund/*
- tests/refund/*
verification:
commands:
- npm run test -- refund-idempotency
rollback:
strategy: revert_slice_commit
reviewability:
expected_diff_size: small
reviewer_focus:
- 幂等键生成
- 并发重复提交
- 错误响应语义
parallelism:
can_run_with:
- S04
cannot_run_with:
- S02
risk_level: medium
借鉴蒙特卡洛树思想:
- 不是直接接受第一版拆分,而是生成多套候选拆分方案。
- 对每套方案做"轻量模拟":评估实现顺序、依赖数量、验证难度、回滚难度、review 难度和风险暴露时间。
- 保留高分路径,剪掉不可验证、依赖过密、容易污染上下文的路径。
- 对高风险节点优先设计验证和回滚,再决定是否实现。
- 如果某个节点连续被评为不可验证,退回 Phase 1 补契约或补采访。
候选拆分评分:
yaml
decomposition_score:
semantic_cohesion: 1-5
verifiability: 1-5
file_scope_control: 1-5
rollback_simplicity: 1-5
reviewability: 1-5
dependency_pressure: 1-5
parallel_potential: 1-5
risk_frontloading: 1-5
建议调用:
- Workflow:
design-to-slices - Subagents:
closed-loop-slice-plannerdag-plannerrisk-reviewertest-strategistparallelism-reviewer
人工 Gate:
- 确认选择哪一套 DAG 方案。
- 确认每个 slice 是语义闭环,而不是技术分层或机械步骤。
- 确认每个 slice 都满足五个准入条件。
- 确认高风险节点的验证和回滚策略。
- 确认哪些节点可以并行,哪些必须串行。
Phase 3:DAG 调度与并行开发准备
目标:基于 Phase 2 的 DAG,生成执行批次,决定哪些 slice 可以并行处理,哪些必须串行推进,并为每个开发 subagent 准备隔离上下文和边界。
输出:
docs/ai-coding/execution-batches.mddocs/ai-coding/run-journal/Sxx-prep.md
内容:
- DAG 执行层级
- 每批可并行 slice
- 每个 slice 的目标、上下文、文件边界和验证命令
- subagent 分配
- 工作区隔离策略
- 集成顺序
- 冲突处理策略
- 风险点
- 不做事项
- 人工确认点
建议调用:
- Skill:
aicoding-prepare-slice - Subagent:
codebase-cartographer - Subagent:
test-strategist - Subagent:
parallelism-reviewer - 可选 Subagent:多个
implementer
并行条件:
- DAG 依赖上互不阻塞。
- 预计修改文件没有明显重叠。
- 每个 slice 都有独立验证命令。
- 失败时能独立回滚。
- 合并顺序明确。
- 高风险 slice 不和其他高风险 slice 同批执行。
并行执行建议:
- 优先让 subagent 并行做只读准备和方案细化。
- 需要并行写代码时,优先使用独立工作区、独立分支或 worktree。
- 如果两个 slice 会修改同一模块核心文件,默认串行。
- 并行批次完成后必须进入静态验证和人工联调交接,不能声称已经完成集成验证。
人工 Gate:
- 确认执行批次和并行策略。
- 确认每个 subagent 的写入边界。
- 如果涉及数据库、鉴权、安全、支付、迁移,必须明确审批。
Phase 4:执行阶段的小步闭环
目标:执行 Phase 3 批次中的一个 slice 或一个安全可并行的小批次,但每次都必须保持"小步闭环"。不让 AI 长时间自动驾驶,也不让一个 prompt 同时承担多个复杂目标。
执行闭环:
#mermaid-svg-WOmXiMSoYJo3V8UZ{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-WOmXiMSoYJo3V8UZ .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-WOmXiMSoYJo3V8UZ .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-WOmXiMSoYJo3V8UZ .error-icon{fill:#552222;}#mermaid-svg-WOmXiMSoYJo3V8UZ .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-WOmXiMSoYJo3V8UZ .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-WOmXiMSoYJo3V8UZ .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-WOmXiMSoYJo3V8UZ .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-WOmXiMSoYJo3V8UZ .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-WOmXiMSoYJo3V8UZ .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-WOmXiMSoYJo3V8UZ .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-WOmXiMSoYJo3V8UZ .marker{fill:#333333;stroke:#333333;}#mermaid-svg-WOmXiMSoYJo3V8UZ .marker.cross{stroke:#333333;}#mermaid-svg-WOmXiMSoYJo3V8UZ svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-WOmXiMSoYJo3V8UZ p{margin:0;}#mermaid-svg-WOmXiMSoYJo3V8UZ defs #statediagram-barbEnd{fill:#333333;stroke:#333333;}#mermaid-svg-WOmXiMSoYJo3V8UZ g.stateGroup text{fill:#9370DB;stroke:none;font-size:10px;}#mermaid-svg-WOmXiMSoYJo3V8UZ g.stateGroup text{fill:#333;stroke:none;font-size:10px;}#mermaid-svg-WOmXiMSoYJo3V8UZ g.stateGroup .state-title{font-weight:bolder;fill:#131300;}#mermaid-svg-WOmXiMSoYJo3V8UZ g.stateGroup rect{fill:#ECECFF;stroke:#9370DB;}#mermaid-svg-WOmXiMSoYJo3V8UZ g.stateGroup line{stroke:#333333;stroke-width:1;}#mermaid-svg-WOmXiMSoYJo3V8UZ .transition{stroke:#333333;stroke-width:1;fill:none;}#mermaid-svg-WOmXiMSoYJo3V8UZ .stateGroup .composit{fill:white;border-bottom:1px;}#mermaid-svg-WOmXiMSoYJo3V8UZ .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px;}#mermaid-svg-WOmXiMSoYJo3V8UZ .state-note{stroke:#aaaa33;fill:#fff5ad;}#mermaid-svg-WOmXiMSoYJo3V8UZ .state-note text{fill:black;stroke:none;font-size:10px;}#mermaid-svg-WOmXiMSoYJo3V8UZ .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5;}#mermaid-svg-WOmXiMSoYJo3V8UZ .edgeLabel .label rect{fill:#ECECFF;opacity:0.5;}#mermaid-svg-WOmXiMSoYJo3V8UZ .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-WOmXiMSoYJo3V8UZ .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-WOmXiMSoYJo3V8UZ .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-WOmXiMSoYJo3V8UZ .edgeLabel .label text{fill:#333;}#mermaid-svg-WOmXiMSoYJo3V8UZ .label div .edgeLabel{color:#333;}#mermaid-svg-WOmXiMSoYJo3V8UZ .stateLabel text{fill:#131300;font-size:10px;font-weight:bold;}#mermaid-svg-WOmXiMSoYJo3V8UZ .node circle.state-start{fill:#333333;stroke:#333333;}#mermaid-svg-WOmXiMSoYJo3V8UZ .node .fork-join{fill:#333333;stroke:#333333;}#mermaid-svg-WOmXiMSoYJo3V8UZ .node circle.state-end{fill:#9370DB;stroke:white;stroke-width:1.5;}#mermaid-svg-WOmXiMSoYJo3V8UZ .end-state-inner{fill:white;stroke-width:1.5;}#mermaid-svg-WOmXiMSoYJo3V8UZ .node rect{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-WOmXiMSoYJo3V8UZ .node polygon{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-WOmXiMSoYJo3V8UZ #statediagram-barbEnd{fill:#333333;}#mermaid-svg-WOmXiMSoYJo3V8UZ .statediagram-cluster rect{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-WOmXiMSoYJo3V8UZ .cluster-label,#mermaid-svg-WOmXiMSoYJo3V8UZ .nodeLabel{color:#131300;}#mermaid-svg-WOmXiMSoYJo3V8UZ .statediagram-cluster rect.outer{rx:5px;ry:5px;}#mermaid-svg-WOmXiMSoYJo3V8UZ .statediagram-state .divider{stroke:#9370DB;}#mermaid-svg-WOmXiMSoYJo3V8UZ .statediagram-state .title-state{rx:5px;ry:5px;}#mermaid-svg-WOmXiMSoYJo3V8UZ .statediagram-cluster.statediagram-cluster .inner{fill:white;}#mermaid-svg-WOmXiMSoYJo3V8UZ .statediagram-cluster.statediagram-cluster-alt .inner{fill:#f0f0f0;}#mermaid-svg-WOmXiMSoYJo3V8UZ .statediagram-cluster .inner{rx:0;ry:0;}#mermaid-svg-WOmXiMSoYJo3V8UZ .statediagram-state rect.basic{rx:5px;ry:5px;}#mermaid-svg-WOmXiMSoYJo3V8UZ .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#f0f0f0;}#mermaid-svg-WOmXiMSoYJo3V8UZ .note-edge{stroke-dasharray:5;}#mermaid-svg-WOmXiMSoYJo3V8UZ .statediagram-note rect{fill:#fff5ad;stroke:#aaaa33;stroke-width:1px;rx:0;ry:0;}#mermaid-svg-WOmXiMSoYJo3V8UZ .statediagram-note rect{fill:#fff5ad;stroke:#aaaa33;stroke-width:1px;rx:0;ry:0;}#mermaid-svg-WOmXiMSoYJo3V8UZ .statediagram-note text{fill:black;}#mermaid-svg-WOmXiMSoYJo3V8UZ .statediagram-note .nodeLabel{color:black;}#mermaid-svg-WOmXiMSoYJo3V8UZ .statediagram .edgeLabel{color:red;}#mermaid-svg-WOmXiMSoYJo3V8UZ #dependencyStart,#mermaid-svg-WOmXiMSoYJo3V8UZ #dependencyEnd{fill:#333333;stroke:#333333;stroke-width:1;}#mermaid-svg-WOmXiMSoYJo3V8UZ .statediagramTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-WOmXiMSoYJo3V8UZ :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} failed
passed
ReadBrief
ConfirmBoundary
WriteOrUpdateTests
MinimalImplementation
TargetVerification
FixFailure
DiffSelfReview
UpdateJournal
HumanCheckpoint
标准步骤:
- 读取当前阶段简报:
Sxx-prep.md、coding-contract.md、task-brief.md、相关 DAG 节点。 - 确认要改的文件和不改的文件。
- 根据契约补充必要测试或静态检查点;如果本地无法执行测试,要明确人工联调验证点。
- 做最小实现。
- 运行本地可执行的静态验证。
- 修复失败。
- 自查 diff。
- 更新阶段记录。
- 等待下一阶段或下一闭环指令。
执行粒度:
- 每个闭环最好控制在人类 30 分钟到 2 小时可审查的范围内。
- 默认目标是一个可解释 diff,而不是一次性完成大范围改造。
- 一个闭环产生 200 行左右可解释 diff,通常比一次性产生 2000 行 diff 更容易 review 和合并。
- 如果预计 diff 会明显变大,必须先拆成更小闭环,或退回 Phase 2/3 调整 DAG 和批次。
单目标原则:
- 每次只持有一个明确目标。
- 不在同一个执行 prompt 里同时要求"重构状态机、接支付网关、改后台页面、补 e2e、优化性能"。
- 如果当前 slice 内出现多个目标,要拆成多个执行闭环,并明确顺序。
写入边界:
- 只允许修改 Phase 3 为当前闭环批准的文件范围。
- 如果执行中发现必须修改边界外文件,先停止并更新阶段记录,进入人工确认。
- 不顺手重构。
- 不顺手升级依赖。
- 不顺手修改 workflow、rules、hooks、skills。
- 不修改与当前闭环验证无关的测试快照或格式化大面积文件。
验证策略:
- 系统不能本地运行,所以 AI 不承诺完成集成测试、运行时 debug 或联调。
- 每个闭环后只运行快反馈静态验证:类型检查、lint、格式化、schema 校验、生成文件一致性检查。
- 如果补充了测试文件但无法本地执行,要记录为"待人工联调/CI 验证",不能写成已通过。
- 静态验证失败只修当前闭环相关失败;如果暴露出更大设计问题,记录并升级,不把实现越做越大。
- 静态验证通过后才进入 diff 自查。
Diff 自查清单:
- 是否只实现了当前闭环目标?
- 是否改了未授权文件?
- 是否引入无关重构?
- 是否破坏行为不变量?
- 是否满足编码契约和反需求清单?
- 是否有静态验证证据?
- 是否明确列出需要人工联调验证的事项?
- 是否需要更新阶段记录或风险说明?
阶段记录输出:
docs/ai-coding/run-journal/Sxx-implementation.md
记录内容:
- 本闭环目标
- 修改文件
- 未修改文件
- 静态验证点
- 人工联调验证点
- 执行摘要
- 失败和修复
- diff 自查结果
- 剩余风险
- 下一步建议
受控 fan-out 模式:
对于机械性迁移、批量替换、文档生成、简单测试补齐,可以允许更自动化的 fan-out 模式,甚至多个会话并行。但它是例外,不是默认。
fan-out 准入条件:
- 变更边界清晰。
- 每个子任务的文件范围独立。
- 静态验证命令可靠。
- 合并冲突成本低。
- 架构判断少,机械执行多。
- 每个子任务失败后可以独立回滚。
- 批次完成后有统一静态验证和人工联调交接。
不适合 fan-out 的情况:
- 多个 agent 会同时改同一核心模块。
- 任务涉及架构判断、状态机、权限、支付、数据迁移。
- 静态验证命令不稳定或不可用。
- 子任务之间业务语义强耦合。
- 失败后难以定位是哪一个 agent 引入的问题。
建议调用:
- Skill:
aicoding-implement-slice - Subagent:
implementer - 可选:
debugger - 受控 fan-out 时可使用多个
implementer,但必须使用 Phase 3 的执行批次和写入边界。
推荐目标写法:
text
执行 Slice S03 的闭环 1:实现退款请求幂等层的最小可验证行为。
读取 S03-prep.md、coding-contract.md、task-brief.md 和 implementation-dag.md。
只允许修改 S03 批准的文件范围。
先补充必要的幂等校验代码或测试草案,再做最小实现。
运行本项目可用的静态验证命令,例如 typecheck、lint、format check、schema check。
静态验证通过后自查 diff,确认没有无关重构和未授权文件修改。
最后更新 S03-implementation.md,记录修改、静态验证、待人工联调事项和剩余风险。
Phase 5:静态验证与人工联调交接
目标:在系统不能本地运行的前提下,AI 只做可自动执行、反馈快、适合每个小阶段后运行的静态验证;集成测试、debug 联调和真实运行验证交给人工完成。Phase 5 的产物不是"已完成联调"的承诺,而是"静态验证证据 + 人工联调清单"。
静态验证层级:
#mermaid-svg-QWmI6Y634dUOuyil{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-QWmI6Y634dUOuyil .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-QWmI6Y634dUOuyil .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-QWmI6Y634dUOuyil .error-icon{fill:#552222;}#mermaid-svg-QWmI6Y634dUOuyil .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-QWmI6Y634dUOuyil .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-QWmI6Y634dUOuyil .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-QWmI6Y634dUOuyil .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-QWmI6Y634dUOuyil .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-QWmI6Y634dUOuyil .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-QWmI6Y634dUOuyil .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-QWmI6Y634dUOuyil .marker{fill:#333333;stroke:#333333;}#mermaid-svg-QWmI6Y634dUOuyil .marker.cross{stroke:#333333;}#mermaid-svg-QWmI6Y634dUOuyil svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-QWmI6Y634dUOuyil p{margin:0;}#mermaid-svg-QWmI6Y634dUOuyil .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-QWmI6Y634dUOuyil .cluster-label text{fill:#333;}#mermaid-svg-QWmI6Y634dUOuyil .cluster-label span{color:#333;}#mermaid-svg-QWmI6Y634dUOuyil .cluster-label span p{background-color:transparent;}#mermaid-svg-QWmI6Y634dUOuyil .label text,#mermaid-svg-QWmI6Y634dUOuyil span{fill:#333;color:#333;}#mermaid-svg-QWmI6Y634dUOuyil .node rect,#mermaid-svg-QWmI6Y634dUOuyil .node circle,#mermaid-svg-QWmI6Y634dUOuyil .node ellipse,#mermaid-svg-QWmI6Y634dUOuyil .node polygon,#mermaid-svg-QWmI6Y634dUOuyil .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-QWmI6Y634dUOuyil .rough-node .label text,#mermaid-svg-QWmI6Y634dUOuyil .node .label text,#mermaid-svg-QWmI6Y634dUOuyil .image-shape .label,#mermaid-svg-QWmI6Y634dUOuyil .icon-shape .label{text-anchor:middle;}#mermaid-svg-QWmI6Y634dUOuyil .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-QWmI6Y634dUOuyil .rough-node .label,#mermaid-svg-QWmI6Y634dUOuyil .node .label,#mermaid-svg-QWmI6Y634dUOuyil .image-shape .label,#mermaid-svg-QWmI6Y634dUOuyil .icon-shape .label{text-align:center;}#mermaid-svg-QWmI6Y634dUOuyil .node.clickable{cursor:pointer;}#mermaid-svg-QWmI6Y634dUOuyil .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-QWmI6Y634dUOuyil .arrowheadPath{fill:#333333;}#mermaid-svg-QWmI6Y634dUOuyil .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-QWmI6Y634dUOuyil .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-QWmI6Y634dUOuyil .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-QWmI6Y634dUOuyil .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-QWmI6Y634dUOuyil .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-QWmI6Y634dUOuyil .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-QWmI6Y634dUOuyil .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-QWmI6Y634dUOuyil .cluster text{fill:#333;}#mermaid-svg-QWmI6Y634dUOuyil .cluster span{color:#333;}#mermaid-svg-QWmI6Y634dUOuyil div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-QWmI6Y634dUOuyil .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-QWmI6Y634dUOuyil rect.text{fill:none;stroke-width:0;}#mermaid-svg-QWmI6Y634dUOuyil .icon-shape,#mermaid-svg-QWmI6Y634dUOuyil .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-QWmI6Y634dUOuyil .icon-shape p,#mermaid-svg-QWmI6Y634dUOuyil .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-QWmI6Y634dUOuyil .icon-shape .label rect,#mermaid-svg-QWmI6Y634dUOuyil .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-QWmI6Y634dUOuyil .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-QWmI6Y634dUOuyil .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-QWmI6Y634dUOuyil :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}#mermaid-svg-QWmI6Y634dUOuyil .check>*{fill:#EAF7EF!important;stroke:#3F9B62!important;color:#123A22!important;}#mermaid-svg-QWmI6Y634dUOuyil .check span{fill:#EAF7EF!important;stroke:#3F9B62!important;color:#123A22!important;}#mermaid-svg-QWmI6Y634dUOuyil .check tspan{fill:#123A22!important;}#mermaid-svg-QWmI6Y634dUOuyil .gate>*{fill:#FFF3D6!important;stroke:#C58A18!important;color:#3A2A05!important;}#mermaid-svg-QWmI6Y634dUOuyil .gate span{fill:#FFF3D6!important;stroke:#C58A18!important;color:#3A2A05!important;}#mermaid-svg-QWmI6Y634dUOuyil .gate tspan{fill:#3A2A05!important;} 格式化检查
format check
Lint
lint
类型检查
typecheck
Schema 校验
schema validation
生成文件一致性
generated artifacts
静态证据完整?
输出:docs/ai-coding/run-journal/Sxx-verification.md
必须记录:
- 运行了哪些命令
- 通过/失败结果
- 失败如何修复
- 未能自动验证的内容和原因
- 需要人工集成测试、debug 联调、运行时验证的清单
- 人工验证建议步骤或观察点
- 剩余风险
建议调用:
- Skill:
aicoding-verify - 项目静态检查 skill:
verify-static - 可选:代码生成或 schema 校验工具
AI 不做的事:
- 不声称完成集成测试。
- 不声称完成本地运行验证。
- 不声称完成 debug 联调。
- 不通过猜测补齐运行结果。
- 不把"未运行"写成"通过"。
静态验证建议项:
- 类型检查。
- lint。
- 格式化检查。
- schema 校验。
- API 类型或契约文件一致性检查。
- 生成文件一致性检查,例如代码生成产物、锁文件、路由表、类型声明。
- 配置文件基本合法性检查。
人工联调交接清单:
markdown
## Manual Integration Handoff
### What AI Verified
### What AI Could Not Verify
### Manual Test Scenarios
### Debug / Integration Watch Points
### Rollback Notes
Phase 6:独立上下文分角色 Code Review
目标:在交付前用独立上下文的只读 reviewer 交叉审查当前 diff。不要让写代码的同一个会话 review 自己刚写的代码,因为它会受前文计划和自身决策影响,倾向于解释为什么合理。Review 必须只看 review packet:diff、任务简报、编码契约、项目规则、静态验证报告和人工联调交接。
核心原则:
- Reviewer 使用独立会话或只读 subagent。
- Reviewer 不继承 Phase 4 执行会话上下文。
- Reviewer 不修改代码。
- Reviewer 不总结优点。
- Reviewer 优先找会导致线上故障、数据错误、安全问题、权限绕过、性能退化、兼容性破坏、静态验证遗漏或人工联调风险的问题。
- 每个 reviewer 只审自己的领域,避免泛泛而谈。
- 主线程只做汇总、去重、分级、裁决,不替 reviewer 粉饰结论。
Review Packet:
markdown
# Review Packet
## Task Brief
## Coding Contract
## Approved Slice / DAG Node
## Current Diff
## Static Verification Report
## Manual Integration Handoff
## Project Rules Summary
## Anti-requirements And Behavior Invariants
输出:
docs/ai-coding/run-journal/Sxx-review-packet.mddocs/ai-coding/run-journal/Sxx-review.md
#mermaid-svg-idvyRmv871VWnQR0{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-idvyRmv871VWnQR0 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-idvyRmv871VWnQR0 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-idvyRmv871VWnQR0 .error-icon{fill:#552222;}#mermaid-svg-idvyRmv871VWnQR0 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-idvyRmv871VWnQR0 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-idvyRmv871VWnQR0 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-idvyRmv871VWnQR0 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-idvyRmv871VWnQR0 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-idvyRmv871VWnQR0 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-idvyRmv871VWnQR0 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-idvyRmv871VWnQR0 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-idvyRmv871VWnQR0 .marker.cross{stroke:#333333;}#mermaid-svg-idvyRmv871VWnQR0 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-idvyRmv871VWnQR0 p{margin:0;}#mermaid-svg-idvyRmv871VWnQR0 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-idvyRmv871VWnQR0 .cluster-label text{fill:#333;}#mermaid-svg-idvyRmv871VWnQR0 .cluster-label span{color:#333;}#mermaid-svg-idvyRmv871VWnQR0 .cluster-label span p{background-color:transparent;}#mermaid-svg-idvyRmv871VWnQR0 .label text,#mermaid-svg-idvyRmv871VWnQR0 span{fill:#333;color:#333;}#mermaid-svg-idvyRmv871VWnQR0 .node rect,#mermaid-svg-idvyRmv871VWnQR0 .node circle,#mermaid-svg-idvyRmv871VWnQR0 .node ellipse,#mermaid-svg-idvyRmv871VWnQR0 .node polygon,#mermaid-svg-idvyRmv871VWnQR0 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-idvyRmv871VWnQR0 .rough-node .label text,#mermaid-svg-idvyRmv871VWnQR0 .node .label text,#mermaid-svg-idvyRmv871VWnQR0 .image-shape .label,#mermaid-svg-idvyRmv871VWnQR0 .icon-shape .label{text-anchor:middle;}#mermaid-svg-idvyRmv871VWnQR0 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-idvyRmv871VWnQR0 .rough-node .label,#mermaid-svg-idvyRmv871VWnQR0 .node .label,#mermaid-svg-idvyRmv871VWnQR0 .image-shape .label,#mermaid-svg-idvyRmv871VWnQR0 .icon-shape .label{text-align:center;}#mermaid-svg-idvyRmv871VWnQR0 .node.clickable{cursor:pointer;}#mermaid-svg-idvyRmv871VWnQR0 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-idvyRmv871VWnQR0 .arrowheadPath{fill:#333333;}#mermaid-svg-idvyRmv871VWnQR0 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-idvyRmv871VWnQR0 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-idvyRmv871VWnQR0 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-idvyRmv871VWnQR0 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-idvyRmv871VWnQR0 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-idvyRmv871VWnQR0 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-idvyRmv871VWnQR0 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-idvyRmv871VWnQR0 .cluster text{fill:#333;}#mermaid-svg-idvyRmv871VWnQR0 .cluster span{color:#333;}#mermaid-svg-idvyRmv871VWnQR0 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-idvyRmv871VWnQR0 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-idvyRmv871VWnQR0 rect.text{fill:none;stroke-width:0;}#mermaid-svg-idvyRmv871VWnQR0 .icon-shape,#mermaid-svg-idvyRmv871VWnQR0 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-idvyRmv871VWnQR0 .icon-shape p,#mermaid-svg-idvyRmv871VWnQR0 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-idvyRmv871VWnQR0 .icon-shape .label rect,#mermaid-svg-idvyRmv871VWnQR0 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-idvyRmv871VWnQR0 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-idvyRmv871VWnQR0 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-idvyRmv871VWnQR0 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}#mermaid-svg-idvyRmv871VWnQR0 .center>*{fill:#E9F2FF!important;stroke:#4878B8!important;color:#0F2544!important;}#mermaid-svg-idvyRmv871VWnQR0 .center span{fill:#E9F2FF!important;stroke:#4878B8!important;color:#0F2544!important;}#mermaid-svg-idvyRmv871VWnQR0 .center tspan{fill:#0F2544!important;}#mermaid-svg-idvyRmv871VWnQR0 .reviewer>*{fill:#F2EAFE!important;stroke:#8B5BC8!important;color:#2B1746!important;}#mermaid-svg-idvyRmv871VWnQR0 .reviewer span{fill:#F2EAFE!important;stroke:#8B5BC8!important;color:#2B1746!important;}#mermaid-svg-idvyRmv871VWnQR0 .reviewer tspan{fill:#2B1746!important;}#mermaid-svg-idvyRmv871VWnQR0 .report>*{fill:#EAF7EF!important;stroke:#3F9B62!important;color:#123A22!important;}#mermaid-svg-idvyRmv871VWnQR0 .report span{fill:#EAF7EF!important;stroke:#3F9B62!important;color:#123A22!important;}#mermaid-svg-idvyRmv871VWnQR0 .report tspan{fill:#123A22!important;}#mermaid-svg-idvyRmv871VWnQR0 .gate>*{fill:#FFF3D6!important;stroke:#C58A18!important;color:#3A2A05!important;}#mermaid-svg-idvyRmv871VWnQR0 .gate span{fill:#FFF3D6!important;stroke:#C58A18!important;color:#3A2A05!important;}#mermaid-svg-idvyRmv871VWnQR0 .gate tspan{fill:#3A2A05!important;} Review Packet
diff + task brief + contract + rules + static evidence
规格符合性 Reviewer
验证/测试 Reviewer
维护性 Reviewer
安全 Reviewer
回归风险 Reviewer
独立 Findings
主线程汇总
去重 / 分级 / 修复队列
Review Report
P0/P1/P2/P3
基础 Review Prompt:
text
请以严格代码审查方式检查当前 diff。
不要总结优点。
优先找会导致线上故障、数据错误、安全问题、权限绕过、性能退化、兼容性破坏、静态验证遗漏或人工联调风险的问题。
每个问题必须包含:严重级别、文件位置、触发条件、影响、建议修复、需要补充的静态检查或人工验证。
如果没有高置信问题,请明确说没有发现,并列出剩余风险。
只基于 review packet 审查,不引用执行阶段聊天历史。
角色分工:
- 规格符合性 reviewer:只看实现是否符合
task-brief.md、coding-contract.md、DAG 节点和反需求清单。 - 安全 reviewer:只看权限、输入校验、敏感信息、依赖、命令执行、提示注入、数据泄漏。
- 验证/测试 reviewer:只看静态验证覆盖、schema/生成文件一致性、测试草案质量、边界条件、是否缺少人工联调场景、是否过度 mock。
- 维护性 reviewer:只看架构边界、重复代码、命名、可读性、与现有模式的一致性。
- 回归风险 reviewer:只看兼容性破坏、行为不变量破坏、旧流程影响、配置和数据模型风险。
Finding 格式:
yaml
severity: P1
category: spec_compliance
file: src/auth/login.ts
line: 42
trigger: "用户未登录但请求携带过期 token"
impact: "可能返回错误状态,导致前端误判为已登录"
evidence: "..."
problem: "..."
suggested_fix: "..."
required_static_check: "typecheck / lint / schema / generated artifact check / none"
required_manual_verification: "人工联调时验证过期 token 的响应语义"
confidence: high
must_fix: true
规则:
- Reviewer 默认只读。
- Reviewer 只能基于 review packet 审查。
- Reviewer 不输出优点总结。
- Reviewer 不能把"无法验证"写成"没有问题"。
- 低置信、无证据的问题进入风险记录,不直接变成 must-fix。
- P0/P1 作为高优先级建议,但仍需进入人工裁决表。
- P2 由你决定。
- P3 只记录,不阻塞。
- 如果多个 reviewer 报告同一问题,主线程去重后保留最高严重级别和最清晰证据。
- 如果 review finding 指向需求或契约不清楚,优先回到 Phase 1 或 Phase 2,而不是让实现阶段猜。
建议调用:
- Workflow:
cross-review - Subagents:
spec-compliance-reviewertest-reviewermaintainability-reviewersecurity-reviewerregression-reviewer
Phase 7:修复 Loop
目标:所有 CR 问题和静态验证问题先完整列出,由人工判断是否需要修、采用 AI 建议方案还是用户自定义方案,然后 AI 只执行被确认的修复项。
AI 不擅长判断某些问题是否真的该修,尤其是:
- 系分本身有问题。
- 需求突然变更。
- 外部系统协议、接口语义、兼容约束不清楚。
- 业务规则存在历史包袱。
- CR finding 本身有误报或低置信。
所以 Phase 7 不允许 AI 直接根据严重级别自动修复。P0/P1 可以作为优先级建议,但不能替代人工裁决。
#mermaid-svg-VnE0760vAU1jWlyb{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-VnE0760vAU1jWlyb .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-VnE0760vAU1jWlyb .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-VnE0760vAU1jWlyb .error-icon{fill:#552222;}#mermaid-svg-VnE0760vAU1jWlyb .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-VnE0760vAU1jWlyb .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-VnE0760vAU1jWlyb .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-VnE0760vAU1jWlyb .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-VnE0760vAU1jWlyb .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-VnE0760vAU1jWlyb .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-VnE0760vAU1jWlyb .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-VnE0760vAU1jWlyb .marker{fill:#333333;stroke:#333333;}#mermaid-svg-VnE0760vAU1jWlyb .marker.cross{stroke:#333333;}#mermaid-svg-VnE0760vAU1jWlyb svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-VnE0760vAU1jWlyb p{margin:0;}#mermaid-svg-VnE0760vAU1jWlyb defs #statediagram-barbEnd{fill:#333333;stroke:#333333;}#mermaid-svg-VnE0760vAU1jWlyb g.stateGroup text{fill:#9370DB;stroke:none;font-size:10px;}#mermaid-svg-VnE0760vAU1jWlyb g.stateGroup text{fill:#333;stroke:none;font-size:10px;}#mermaid-svg-VnE0760vAU1jWlyb g.stateGroup .state-title{font-weight:bolder;fill:#131300;}#mermaid-svg-VnE0760vAU1jWlyb g.stateGroup rect{fill:#ECECFF;stroke:#9370DB;}#mermaid-svg-VnE0760vAU1jWlyb g.stateGroup line{stroke:#333333;stroke-width:1;}#mermaid-svg-VnE0760vAU1jWlyb .transition{stroke:#333333;stroke-width:1;fill:none;}#mermaid-svg-VnE0760vAU1jWlyb .stateGroup .composit{fill:white;border-bottom:1px;}#mermaid-svg-VnE0760vAU1jWlyb .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px;}#mermaid-svg-VnE0760vAU1jWlyb .state-note{stroke:#aaaa33;fill:#fff5ad;}#mermaid-svg-VnE0760vAU1jWlyb .state-note text{fill:black;stroke:none;font-size:10px;}#mermaid-svg-VnE0760vAU1jWlyb .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5;}#mermaid-svg-VnE0760vAU1jWlyb .edgeLabel .label rect{fill:#ECECFF;opacity:0.5;}#mermaid-svg-VnE0760vAU1jWlyb .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-VnE0760vAU1jWlyb .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-VnE0760vAU1jWlyb .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-VnE0760vAU1jWlyb .edgeLabel .label text{fill:#333;}#mermaid-svg-VnE0760vAU1jWlyb .label div .edgeLabel{color:#333;}#mermaid-svg-VnE0760vAU1jWlyb .stateLabel text{fill:#131300;font-size:10px;font-weight:bold;}#mermaid-svg-VnE0760vAU1jWlyb .node circle.state-start{fill:#333333;stroke:#333333;}#mermaid-svg-VnE0760vAU1jWlyb .node .fork-join{fill:#333333;stroke:#333333;}#mermaid-svg-VnE0760vAU1jWlyb .node circle.state-end{fill:#9370DB;stroke:white;stroke-width:1.5;}#mermaid-svg-VnE0760vAU1jWlyb .end-state-inner{fill:white;stroke-width:1.5;}#mermaid-svg-VnE0760vAU1jWlyb .node rect{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-VnE0760vAU1jWlyb .node polygon{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-VnE0760vAU1jWlyb #statediagram-barbEnd{fill:#333333;}#mermaid-svg-VnE0760vAU1jWlyb .statediagram-cluster rect{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-VnE0760vAU1jWlyb .cluster-label,#mermaid-svg-VnE0760vAU1jWlyb .nodeLabel{color:#131300;}#mermaid-svg-VnE0760vAU1jWlyb .statediagram-cluster rect.outer{rx:5px;ry:5px;}#mermaid-svg-VnE0760vAU1jWlyb .statediagram-state .divider{stroke:#9370DB;}#mermaid-svg-VnE0760vAU1jWlyb .statediagram-state .title-state{rx:5px;ry:5px;}#mermaid-svg-VnE0760vAU1jWlyb .statediagram-cluster.statediagram-cluster .inner{fill:white;}#mermaid-svg-VnE0760vAU1jWlyb .statediagram-cluster.statediagram-cluster-alt .inner{fill:#f0f0f0;}#mermaid-svg-VnE0760vAU1jWlyb .statediagram-cluster .inner{rx:0;ry:0;}#mermaid-svg-VnE0760vAU1jWlyb .statediagram-state rect.basic{rx:5px;ry:5px;}#mermaid-svg-VnE0760vAU1jWlyb .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#f0f0f0;}#mermaid-svg-VnE0760vAU1jWlyb .note-edge{stroke-dasharray:5;}#mermaid-svg-VnE0760vAU1jWlyb .statediagram-note rect{fill:#fff5ad;stroke:#aaaa33;stroke-width:1px;rx:0;ry:0;}#mermaid-svg-VnE0760vAU1jWlyb .statediagram-note rect{fill:#fff5ad;stroke:#aaaa33;stroke-width:1px;rx:0;ry:0;}#mermaid-svg-VnE0760vAU1jWlyb .statediagram-note text{fill:black;}#mermaid-svg-VnE0760vAU1jWlyb .statediagram-note .nodeLabel{color:black;}#mermaid-svg-VnE0760vAU1jWlyb .statediagram .edgeLabel{color:red;}#mermaid-svg-VnE0760vAU1jWlyb #dependencyStart,#mermaid-svg-VnE0760vAU1jWlyb #dependencyEnd{fill:#333333;stroke:#333333;stroke-width:1;}#mermaid-svg-VnE0760vAU1jWlyb .statediagramTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-VnE0760vAU1jWlyb :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 修复
用户自定义方案
系分/契约问题
需求变更
暂缓或接受风险
静态验证失败且仍在确认范围内
CollectFindings
BuildDecisionTable
HumanTriage
ApplyConfirmedFix
CustomFixPlan
DesignIssue
RequirementChange
DeferOrAcceptRisk
BackToContract
BackToBrief
StaticVerify
UpdateFixRecord
HumanReviewResult
Done
修复裁决表:
markdown
| ID | 来源 | 严重级别 | 问题摘要 | 影响 | AI 建议方案 | 人工决定 | 最终方案 | 状态 |
|----|------|----------|----------|------|-------------|----------|----------|------|
| F-01 | security-reviewer | P1 | 越权风险 | 可能访问他人数据 | 增加 owner 校验 | 修复 | 按 AI 方案修 | pending |
| F-02 | spec-reviewer | P1 | 系分未定义退款失败重试 | 需求不清 | 补充状态 | 回系分 | 先更新契约 | blocked |
人工决定选项:
fix_ai_plan:按 AI 建议方案修。fix_custom_plan:按用户自定义方案修。defer:暂缓,记录原因和风险。accept_risk:接受风险,不修。false_positive:误报,不修。back_to_phase_1:系分、任务简报或编码契约需要更新。back_to_phase_2:切片/DAG 拆分需要调整。external_dependency:依赖其他系统协议或团队确认,暂不修。
修复执行规则:
- 未经人工确认的问题不修。
- 未经人工确认的修复方案不执行。
- 用户自定义方案优先于 AI 建议方案。
- 每次修复只处理裁决表中被批准的一组问题。
- 修复不得扩大范围;发现需要扩大范围时停止并重新裁决。
- 如果问题属于系分或需求变更,不在 Phase 7 猜测修复,回到 Phase 1 或 Phase 2。
- 修复后只运行 Phase 5 定义的静态验证,并更新人工联调交接。
- 修复后的新 diff 需要重新进入 Phase 6 review,或者至少由相关角色 reviewer 做 targeted re-review。
输出:
docs/ai-coding/run-journal/Sxx-fix-decision-table.mddocs/ai-coding/run-journal/Sxx-fix.md
修复记录内容:
- 被批准修复的问题
- 未修复问题及原因
- 用户自定义方案
- 实际修改文件
- 静态验证结果
- 需要人工联调重点
- 是否需要回到 Phase 1/2
问题分类:
- 实现 bug
- 静态验证失败
- 安全或权限问题
- 兼容性问题
- 人工联调风险
- 系分/契约不清
- 需求变更
- 外部系统协议不清
- CR 误报
- 可接受风险
恢复动作:
- 补上下文
- 缩小 slice
- 回滚最近 patch
- 更新静态检查或测试草案
- 修改实现
- 请求人工裁决
- 记录为设计问题
Phase 8:交付
目标:把当前 slice 变成可以提交或 PR 的交付包。
输出:docs/ai-coding/run-journal/Sxx-delivery.md
内容:
- 实现摘要
- 对应设计章节
- 修改文件列表
- 静态验证证据
- 人工联调交接摘要
- review 结果
- 修复裁决摘要
- 已知风险
- 未做事项
- 建议 commit message
- 建议 PR description
PR 描述模板:
markdown
## Summary
## Design Traceability
## Verification
## Manual Integration Handoff
## Review Notes
## Risks / Follow-ups
Phase 9:复盘
目标:从本次 slice 中提炼可复用经验。
输出:docs/ai-coding/run-journal/Sxx-retro.md
复盘问题:
- Claude 哪些地方理解错了?
- 哪些上下文一开始应该提供?
- 哪些命令、规则、路径应该沉淀?
- 哪些静态验证最有价值?
- 哪些人工联调问题本可以提前暴露?
- 哪些步骤浪费时间或 token?
- 哪些人工 gate 是必要的?
- 哪些 CR finding 是误报,为什么?
- 哪些修复必须依赖人工裁决?
- 哪些问题应该更新到系分或 coding contract?
- 是否需要新增 skill、subagent、hook、rule、MCP?
建议调用:
- Skill:
aicoding-retro - Subagent:
retro-analyst
Phase 10:自我进化提案
目标:把复盘结果转成可审查的 workflow 资产修改提案。
输出:docs/ai-coding/workflow-change-proposals.md
提案类型:
#mermaid-svg-zYVB24yxPwcbfosA{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-zYVB24yxPwcbfosA .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-zYVB24yxPwcbfosA .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-zYVB24yxPwcbfosA .error-icon{fill:#552222;}#mermaid-svg-zYVB24yxPwcbfosA .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-zYVB24yxPwcbfosA .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-zYVB24yxPwcbfosA .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-zYVB24yxPwcbfosA .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-zYVB24yxPwcbfosA .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-zYVB24yxPwcbfosA .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-zYVB24yxPwcbfosA .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-zYVB24yxPwcbfosA .marker{fill:#333333;stroke:#333333;}#mermaid-svg-zYVB24yxPwcbfosA .marker.cross{stroke:#333333;}#mermaid-svg-zYVB24yxPwcbfosA svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-zYVB24yxPwcbfosA p{margin:0;}#mermaid-svg-zYVB24yxPwcbfosA .edge{stroke-width:3;}#mermaid-svg-zYVB24yxPwcbfosA .section--1 rect,#mermaid-svg-zYVB24yxPwcbfosA .section--1 path,#mermaid-svg-zYVB24yxPwcbfosA .section--1 circle,#mermaid-svg-zYVB24yxPwcbfosA .section--1 polygon,#mermaid-svg-zYVB24yxPwcbfosA .section--1 path{fill:hsl(240, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .section--1 text{fill:#ffffff;}#mermaid-svg-zYVB24yxPwcbfosA .node-icon--1{font-size:40px;color:#ffffff;}#mermaid-svg-zYVB24yxPwcbfosA .section-edge--1{stroke:hsl(240, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .edge-depth--1{stroke-width:17;}#mermaid-svg-zYVB24yxPwcbfosA .section--1 line{stroke:hsl(60, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-zYVB24yxPwcbfosA .disabled,#mermaid-svg-zYVB24yxPwcbfosA .disabled circle,#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:lightgray;}#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:#efefef;}#mermaid-svg-zYVB24yxPwcbfosA .section-0 rect,#mermaid-svg-zYVB24yxPwcbfosA .section-0 path,#mermaid-svg-zYVB24yxPwcbfosA .section-0 circle,#mermaid-svg-zYVB24yxPwcbfosA .section-0 polygon,#mermaid-svg-zYVB24yxPwcbfosA .section-0 path{fill:hsl(60, 100%, 73.5294117647%);}#mermaid-svg-zYVB24yxPwcbfosA .section-0 text{fill:black;}#mermaid-svg-zYVB24yxPwcbfosA .node-icon-0{font-size:40px;color:black;}#mermaid-svg-zYVB24yxPwcbfosA .section-edge-0{stroke:hsl(60, 100%, 73.5294117647%);}#mermaid-svg-zYVB24yxPwcbfosA .edge-depth-0{stroke-width:14;}#mermaid-svg-zYVB24yxPwcbfosA .section-0 line{stroke:hsl(240, 100%, 83.5294117647%);stroke-width:3;}#mermaid-svg-zYVB24yxPwcbfosA .disabled,#mermaid-svg-zYVB24yxPwcbfosA .disabled circle,#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:lightgray;}#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:#efefef;}#mermaid-svg-zYVB24yxPwcbfosA .section-1 rect,#mermaid-svg-zYVB24yxPwcbfosA .section-1 path,#mermaid-svg-zYVB24yxPwcbfosA .section-1 circle,#mermaid-svg-zYVB24yxPwcbfosA .section-1 polygon,#mermaid-svg-zYVB24yxPwcbfosA .section-1 path{fill:hsl(80, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .section-1 text{fill:black;}#mermaid-svg-zYVB24yxPwcbfosA .node-icon-1{font-size:40px;color:black;}#mermaid-svg-zYVB24yxPwcbfosA .section-edge-1{stroke:hsl(80, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .edge-depth-1{stroke-width:11;}#mermaid-svg-zYVB24yxPwcbfosA .section-1 line{stroke:hsl(260, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-zYVB24yxPwcbfosA .disabled,#mermaid-svg-zYVB24yxPwcbfosA .disabled circle,#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:lightgray;}#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:#efefef;}#mermaid-svg-zYVB24yxPwcbfosA .section-2 rect,#mermaid-svg-zYVB24yxPwcbfosA .section-2 path,#mermaid-svg-zYVB24yxPwcbfosA .section-2 circle,#mermaid-svg-zYVB24yxPwcbfosA .section-2 polygon,#mermaid-svg-zYVB24yxPwcbfosA .section-2 path{fill:hsl(270, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .section-2 text{fill:#ffffff;}#mermaid-svg-zYVB24yxPwcbfosA .node-icon-2{font-size:40px;color:#ffffff;}#mermaid-svg-zYVB24yxPwcbfosA .section-edge-2{stroke:hsl(270, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .edge-depth-2{stroke-width:8;}#mermaid-svg-zYVB24yxPwcbfosA .section-2 line{stroke:hsl(90, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-zYVB24yxPwcbfosA .disabled,#mermaid-svg-zYVB24yxPwcbfosA .disabled circle,#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:lightgray;}#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:#efefef;}#mermaid-svg-zYVB24yxPwcbfosA .section-3 rect,#mermaid-svg-zYVB24yxPwcbfosA .section-3 path,#mermaid-svg-zYVB24yxPwcbfosA .section-3 circle,#mermaid-svg-zYVB24yxPwcbfosA .section-3 polygon,#mermaid-svg-zYVB24yxPwcbfosA .section-3 path{fill:hsl(300, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .section-3 text{fill:black;}#mermaid-svg-zYVB24yxPwcbfosA .node-icon-3{font-size:40px;color:black;}#mermaid-svg-zYVB24yxPwcbfosA .section-edge-3{stroke:hsl(300, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .edge-depth-3{stroke-width:5;}#mermaid-svg-zYVB24yxPwcbfosA .section-3 line{stroke:hsl(120, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-zYVB24yxPwcbfosA .disabled,#mermaid-svg-zYVB24yxPwcbfosA .disabled circle,#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:lightgray;}#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:#efefef;}#mermaid-svg-zYVB24yxPwcbfosA .section-4 rect,#mermaid-svg-zYVB24yxPwcbfosA .section-4 path,#mermaid-svg-zYVB24yxPwcbfosA .section-4 circle,#mermaid-svg-zYVB24yxPwcbfosA .section-4 polygon,#mermaid-svg-zYVB24yxPwcbfosA .section-4 path{fill:hsl(330, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .section-4 text{fill:black;}#mermaid-svg-zYVB24yxPwcbfosA .node-icon-4{font-size:40px;color:black;}#mermaid-svg-zYVB24yxPwcbfosA .section-edge-4{stroke:hsl(330, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .edge-depth-4{stroke-width:2;}#mermaid-svg-zYVB24yxPwcbfosA .section-4 line{stroke:hsl(150, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-zYVB24yxPwcbfosA .disabled,#mermaid-svg-zYVB24yxPwcbfosA .disabled circle,#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:lightgray;}#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:#efefef;}#mermaid-svg-zYVB24yxPwcbfosA .section-5 rect,#mermaid-svg-zYVB24yxPwcbfosA .section-5 path,#mermaid-svg-zYVB24yxPwcbfosA .section-5 circle,#mermaid-svg-zYVB24yxPwcbfosA .section-5 polygon,#mermaid-svg-zYVB24yxPwcbfosA .section-5 path{fill:hsl(0, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .section-5 text{fill:black;}#mermaid-svg-zYVB24yxPwcbfosA .node-icon-5{font-size:40px;color:black;}#mermaid-svg-zYVB24yxPwcbfosA .section-edge-5{stroke:hsl(0, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .edge-depth-5{stroke-width:-1;}#mermaid-svg-zYVB24yxPwcbfosA .section-5 line{stroke:hsl(180, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-zYVB24yxPwcbfosA .disabled,#mermaid-svg-zYVB24yxPwcbfosA .disabled circle,#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:lightgray;}#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:#efefef;}#mermaid-svg-zYVB24yxPwcbfosA .section-6 rect,#mermaid-svg-zYVB24yxPwcbfosA .section-6 path,#mermaid-svg-zYVB24yxPwcbfosA .section-6 circle,#mermaid-svg-zYVB24yxPwcbfosA .section-6 polygon,#mermaid-svg-zYVB24yxPwcbfosA .section-6 path{fill:hsl(30, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .section-6 text{fill:black;}#mermaid-svg-zYVB24yxPwcbfosA .node-icon-6{font-size:40px;color:black;}#mermaid-svg-zYVB24yxPwcbfosA .section-edge-6{stroke:hsl(30, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .edge-depth-6{stroke-width:-4;}#mermaid-svg-zYVB24yxPwcbfosA .section-6 line{stroke:hsl(210, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-zYVB24yxPwcbfosA .disabled,#mermaid-svg-zYVB24yxPwcbfosA .disabled circle,#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:lightgray;}#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:#efefef;}#mermaid-svg-zYVB24yxPwcbfosA .section-7 rect,#mermaid-svg-zYVB24yxPwcbfosA .section-7 path,#mermaid-svg-zYVB24yxPwcbfosA .section-7 circle,#mermaid-svg-zYVB24yxPwcbfosA .section-7 polygon,#mermaid-svg-zYVB24yxPwcbfosA .section-7 path{fill:hsl(90, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .section-7 text{fill:black;}#mermaid-svg-zYVB24yxPwcbfosA .node-icon-7{font-size:40px;color:black;}#mermaid-svg-zYVB24yxPwcbfosA .section-edge-7{stroke:hsl(90, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .edge-depth-7{stroke-width:-7;}#mermaid-svg-zYVB24yxPwcbfosA .section-7 line{stroke:hsl(270, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-zYVB24yxPwcbfosA .disabled,#mermaid-svg-zYVB24yxPwcbfosA .disabled circle,#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:lightgray;}#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:#efefef;}#mermaid-svg-zYVB24yxPwcbfosA .section-8 rect,#mermaid-svg-zYVB24yxPwcbfosA .section-8 path,#mermaid-svg-zYVB24yxPwcbfosA .section-8 circle,#mermaid-svg-zYVB24yxPwcbfosA .section-8 polygon,#mermaid-svg-zYVB24yxPwcbfosA .section-8 path{fill:hsl(150, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .section-8 text{fill:black;}#mermaid-svg-zYVB24yxPwcbfosA .node-icon-8{font-size:40px;color:black;}#mermaid-svg-zYVB24yxPwcbfosA .section-edge-8{stroke:hsl(150, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .edge-depth-8{stroke-width:-10;}#mermaid-svg-zYVB24yxPwcbfosA .section-8 line{stroke:hsl(330, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-zYVB24yxPwcbfosA .disabled,#mermaid-svg-zYVB24yxPwcbfosA .disabled circle,#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:lightgray;}#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:#efefef;}#mermaid-svg-zYVB24yxPwcbfosA .section-9 rect,#mermaid-svg-zYVB24yxPwcbfosA .section-9 path,#mermaid-svg-zYVB24yxPwcbfosA .section-9 circle,#mermaid-svg-zYVB24yxPwcbfosA .section-9 polygon,#mermaid-svg-zYVB24yxPwcbfosA .section-9 path{fill:hsl(180, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .section-9 text{fill:black;}#mermaid-svg-zYVB24yxPwcbfosA .node-icon-9{font-size:40px;color:black;}#mermaid-svg-zYVB24yxPwcbfosA .section-edge-9{stroke:hsl(180, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .edge-depth-9{stroke-width:-13;}#mermaid-svg-zYVB24yxPwcbfosA .section-9 line{stroke:hsl(0, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-zYVB24yxPwcbfosA .disabled,#mermaid-svg-zYVB24yxPwcbfosA .disabled circle,#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:lightgray;}#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:#efefef;}#mermaid-svg-zYVB24yxPwcbfosA .section-10 rect,#mermaid-svg-zYVB24yxPwcbfosA .section-10 path,#mermaid-svg-zYVB24yxPwcbfosA .section-10 circle,#mermaid-svg-zYVB24yxPwcbfosA .section-10 polygon,#mermaid-svg-zYVB24yxPwcbfosA .section-10 path{fill:hsl(210, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .section-10 text{fill:black;}#mermaid-svg-zYVB24yxPwcbfosA .node-icon-10{font-size:40px;color:black;}#mermaid-svg-zYVB24yxPwcbfosA .section-edge-10{stroke:hsl(210, 100%, 76.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .edge-depth-10{stroke-width:-16;}#mermaid-svg-zYVB24yxPwcbfosA .section-10 line{stroke:hsl(30, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-zYVB24yxPwcbfosA .disabled,#mermaid-svg-zYVB24yxPwcbfosA .disabled circle,#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:lightgray;}#mermaid-svg-zYVB24yxPwcbfosA .disabled text{fill:#efefef;}#mermaid-svg-zYVB24yxPwcbfosA .section-root rect,#mermaid-svg-zYVB24yxPwcbfosA .section-root path,#mermaid-svg-zYVB24yxPwcbfosA .section-root circle,#mermaid-svg-zYVB24yxPwcbfosA .section-root polygon{fill:hsl(240, 100%, 46.2745098039%);}#mermaid-svg-zYVB24yxPwcbfosA .section-root text{fill:#ffffff;}#mermaid-svg-zYVB24yxPwcbfosA .section-root span{color:#ffffff;}#mermaid-svg-zYVB24yxPwcbfosA .section-2 span{color:#ffffff;}#mermaid-svg-zYVB24yxPwcbfosA .icon-container{height:100%;display:flex;justify-content:center;align-items:center;}#mermaid-svg-zYVB24yxPwcbfosA .edge{fill:none;}#mermaid-svg-zYVB24yxPwcbfosA .mindmap-node-label{dy:1em;alignment-baseline:middle;text-anchor:middle;dominant-baseline:middle;text-align:center;}#mermaid-svg-zYVB24yxPwcbfosA :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} Workflow Evolution
Rules
CLAUDE.md
path-scoped rules
coding standards
Skills
new reusable action
improve existing prompt
add templates
Subagents
new reviewer role
adjust tool permissions
tune role instructions
Hooks
block risky command
require static verification
session summary
MCP
add data source
tighten trust boundary
remove noisy source
Workflow
add gate
split phase
merge repeated steps
change review fan-out
规则:
- 默认只生成提案。
- 你确认后才修改
.claude、CLAUDE.md、skills、hooks、workflows。 - 每条提案必须说明触发原因、修改位置、预期收益、风险。
- 不把一次性项目知识沉淀进全局规则,除非它跨项目复用。
- 不因为一次 CR 误报就削弱 reviewer;先记录误报条件,再评估是否调整 prompt。
5. 推荐最小资产集
第一版只保留能支撑闭环的最小资产,避免 workflow 过重:
text
skills:
- aicoding-context
- aicoding-interview
- aicoding-start
- aicoding-plan
- aicoding-prepare-slice
- aicoding-implement-slice
- aicoding-verify
- aicoding-review
- aicoding-fix
- aicoding-retro
- aicoding-evolve
subagents:
- context-curator
- task-interviewer
- design-contract-reviewer
- codebase-cartographer
- knowledgebase-researcher
- closed-loop-slice-planner
- dag-planner
- parallelism-reviewer
- spec-compliance-reviewer
- test-reviewer
- maintainability-reviewer
- security-reviewer
- regression-reviewer
- retro-analyst
workflows:
- context-intake
- design-to-slices
- cross-review
hooks:
- dangerous-command-blocker
- high-risk-file-approval
- completion-requires-static-verification
- session-journal-writer
暂缓引入:
- 大规模并行写代码。
- 自动更新 workflow 资产。
- 自动生成 commit 或 PR。
- 运行时自动验证。
- 自动判定 CR 问题是否必须修。
6. 可调整参数
建议后续讨论时优先调整这些参数,而不是推翻整体流程:
yaml
slice_size:
target_review_window: "30m-2h"
max_files_changed: 12
target_diff_size_hint: "about_200_lines"
max_review_findings_before_replan: 5
human_gates:
require_task_brief_confirmation: true
require_dag_confirmation: true
require_before_implementation: true
require_for_high_risk_files: true
require_for_all_fix_decisions: true
require_before_workflow_evolution: true
execution_policy:
one_goal_per_loop: true
static_verification_only: true
no_runtime_claims: true
controlled_fanout_default: false
review_policy:
independent_context: true
require_review_packet: true
no_positive_summary: true
required_reviewers:
- spec-compliance-reviewer
- test-reviewer
- maintainability-reviewer
- security-reviewer
- regression-reviewer
fix_policy:
require_human_triage_for_all_findings: true
allow_ai_autofix_without_triage: false
user_custom_fix_plan_overrides_ai: true
return_to_contract_on_requirement_or_protocol_issue: true
verification_policy:
require_lint: true
require_typecheck: true
require_format_check: true
require_schema_validation: true
require_generated_artifact_check: true
require_tests: false
require_build: false
require_runtime_check: false
manual_integration_required: true
7. 后续优化入口
我们后续可以围绕这些问题继续碰撞:
- Phase 1 的 AI 采访问题是否要做成固定模板。
- Phase 2 的 DAG 评分阈值如何设置。
- Phase 3 什么时候允许并行写代码,什么时候只允许并行只读分析。
- Phase 4 的 diff 大小和闭环时间是否需要按项目类型调整。
- Phase 5 静态验证命令如何从项目中自动识别。
- Phase 6 哪些 reviewer 是必跑,哪些按风险触发。
- Phase 7 的人工裁决表是否需要和团队 CR 流程打通。
- Phase 10 哪些经验可以沉淀到个人全局资产,哪些只留在项目内。