# 三层 Loop 模型 > L1 ⊂ L2 ⊂ L3。每一层是一个独立的有限状态机,触发条件、执行体、退出条件、回滚目标各不相同。本页给出全景对照,下面三页是各自细节。 ## 对照矩阵 | | L1 Unit | L2 Integration | L3 Human | | --- | --- | --- | --- | | units.json 有 pending | 所有 Unit 状态 = passed | POST /devloop/requirement | | Coder + Tester | Integrator + BugTriager + Architect | PM + Architect | | code/ · tests/ · runs/result.json | integration/runs/_{id}_/result.json + triage.json | prd.html rev+1 · sdd.html rev+1 | | 单测全绿 → unit passed | 集成全绿 → project shipped | 人类 sign-off | | retry coder ≤ N | 归因 → 改 SDD → 回 L1 | 对话化追问,PRD 加 section | | 每 unit retry ≤ 5 | 每项目 L2 修复 ≤ 3 轮 | 无限(人类驱动) | | 1-3 分钟 / unit | 2-10 分钟 / 轮 | 分钟 — 小时 | ## 嵌套关系(含数学描述) 三个 Loop 严格嵌套:**L1 触发于 L2 内部**,L2 触发于 L3 内部。即: ```js // 用伪代码表达嵌套关系 while (human.hasFeedback()) { // L3 pm.patchPRD(); architect.regenSDD(); while (!project.integrationGreen()) { // L2 while (unitsPending()) { // L1 parallel(unitsPending(), runUnit); } const r = integrator.run(); if (!r.ok) { const tri = triager.analyze(r); architect.applyPatch(tri.sdd_patch); units.reset(tri.affected); } } } ``` ## 三个 Loop 的色彩 token 同一套颜色在 PRD 文档、看板 UI、Agent 日志、状态徽章里一致复用,便于跨界面识别当前所处的 Loop 层级。 L1 · Unit ### Emerald · #0E8C5A 短周期 / 高频 / 低单价。日志里所有 L1 事件都用这个色描边。 L2 · Integration ### Amber · #C77C2C 中周期 / 中频 / 中单价。Dashboard 中间状态栏专色。 L3 · Human ### Violet · #6E48C3 低频 / 高单价 / 决策性。看板 header / Hero 用此色作 accent。 ## 下一步阅读 详细状态机在以下三页: - [**L1 · Unit Loop**](loops-l1.html) — 单 Unit 的写码—跑测—重试 - [**L2 · Integration Loop**](loops-l2.html) — 集成失败的归因与文档回写 - [**L3 · Human Feedback Loop**](loops-l3.html) — 增量需求的并入