convergence-monitoring
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseConvergence Monitoring
收敛监测
Convergence monitoring answers the most important question in iterative AI development: when should you stop iterating? The answer is not a fixed number of iterations or a time limit -- it is convergence. Convergence means the agent's output is stabilizing; each iteration produces fewer and smaller changes than the last.
Core insight: You don't need a zero-diff -- you need the remaining modifications to be inconsequential.
收敛监测解决了迭代式AI开发中最重要的问题:**何时应该停止迭代?**答案不是固定的迭代次数或时间限制——而是收敛。收敛指的是Agent的输出趋于稳定;每一轮迭代产生的变化比上一轮更少、更细微。
**核心见解:**你不需要零差异——只需要剩余的修改无关紧要即可。
1. What Is Convergence?
1. 什么是收敛?
Convergence appears as a rapid, consistent decline in the volume of changes from one iteration to the next:
Iteration 1: ████████████████████████████████████████ 300 lines changed
Iteration 2: ████████████████ 120 lines changed
Iteration 3: ██████ 40 lines changed
Iteration 4: ██ 10 lines changed (cosmetic only)
^--- Convergence reached: the diff shrinks each pass until only cosmetic changes remain收敛表现为迭代间变更量的快速、持续下降:
Iteration 1: ████████████████████████████████████████ 300行变更
Iteration 2: ████████████████ 120行变更
Iteration 3: ██████ 40行变更
Iteration 4: ██ 10行变更(仅 cosmetic 调整)
^--- 已达到收敛:每次迭代的差异不断缩小,直到只剩 cosmetic 变更Convergence indicators
收敛指标
| Signal | What It Means |
|---|---|
| Lines changed decreasing exponentially | Each iteration makes roughly half the changes of the previous one |
| Changes become trivial | Remaining changes are formatting, comments, imports -- not behavior |
| Tests stabilize | Test count stops increasing; pass rate approaches 100% |
| No new files created | The architecture has settled; only existing files are modified |
| Impl tracking updates shrink | Implementation tracking changes are status updates, not new findings |
| Completion signal emitted | Agent determines all exit criteria are met |
| 信号 | 含义 |
|---|---|
| 变更行数呈指数级下降 | 每轮迭代的变更量约为上一轮的一半 |
| 变更变得无关紧要 | 剩余变更仅涉及格式、注释、导入——不影响行为 |
| 测试趋于稳定 | 测试数量停止增长;通过率接近100% |
| 无新文件创建 | 架构已稳定;仅修改现有文件 |
| 实现跟踪更新缩小 | 实现跟踪的变更仅为状态更新,而非新发现 |
| 发出完成信号 | Agent判定所有退出条件均已满足 |
What convergence looks like in git
Git中的收敛表现
bash
undefinedbash
undefinedCheck lines changed per iteration
检查每轮迭代的变更行数
git log --oneline --stat
git log --oneline --stat
Iteration 5: trivial changes
Iteration 5: 无关紧要的变更
abc1234 Iteration 5: formatting and comment fixes
3 files changed, 8 insertions(+), 6 deletions(-)
abc1234 Iteration 5: formatting and comment fixes
3 files changed, 8 insertions(+), 6 deletions(-)
Iteration 4: minor adjustments
Iteration 4: 小幅调整
def5678 Iteration 4: edge case handling
5 files changed, 22 insertions(+), 8 deletions(-)
def5678 Iteration 4: edge case handling
5 files changed, 22 insertions(+), 8 deletions(-)
Iteration 3: moderate changes
Iteration 3: 中度变更
ghi9012 Iteration 3: complete API integration
12 files changed, 85 insertions(+), 31 deletions(-)
ghi9012 Iteration 3: complete API integration
12 files changed, 85 insertions(+), 31 deletions(-)
Iteration 2: significant changes
Iteration 2: 重大变更
jkl3456 Iteration 2: implement core features
18 files changed, 156 insertions(+), 42 deletions(-)
jkl3456 Iteration 2: implement core features
18 files changed, 156 insertions(+), 42 deletions(-)
Iteration 1: major initial work
Iteration 1: 初始主要工作
mno7890 Iteration 1: initial implementation
25 files changed, 312 insertions(+), 15 deletions(-)
---mno7890 Iteration 1: initial implementation
25 files changed, 312 insertions(+), 15 deletions(-)
---2. What Is a Ceiling?
2. 什么是瓶颈(Ceiling)?
A ceiling is when the agent cannot make further progress due to external constraints. Like convergence, it produces small diffs -- but for fundamentally different reasons.
Convergence: Agent is DONE -> small diffs because work is complete
Ceiling: Agent is STUCK -> small diffs because agent cannot proceed瓶颈指的是Agent因外部约束无法取得进一步进展。与收敛类似,它会产生小差异,但原因完全不同。
收敛: Agent已完成工作 -> 差异小是因为工作已结束
瓶颈: Agent陷入停滞 -> 差异小是因为Agent无法继续推进Ceiling causes
瓶颈成因
| Cause | Example | How to Detect |
|---|---|---|
| Missing dependency | API not available, library not installed | Agent logs errors about unavailable resources |
| Ambiguous spec | Requirement can be interpreted multiple ways | Agent oscillates between implementations |
| Tooling limitation | Build tool does not support needed feature | Agent tries workarounds that do not converge |
| External service | Test requires network access, external API | Tests fail with connection/timeout errors |
| Context window exhaustion | Codebase too large for one session | Agent loses track of earlier work |
| Permission boundary | Agent cannot access needed files or systems | Repeated permission errors in logs |
| 成因 | 示例 | 检测方式 |
|---|---|---|
| 缺失依赖 | API不可用、库未安装 | Agent日志中出现关于资源不可用的错误 |
| 模糊需求规格 | 需求存在多种解读方式 | Agent在不同实现间反复摇摆 |
| 工具限制 | 构建工具不支持所需功能 | Agent尝试的变通方法无法收敛 |
| 外部服务依赖 | 测试需要网络访问、外部API | 测试因连接/超时错误失败 |
| 上下文窗口耗尽 | 代码库过大,超出单次会话处理能力 | Agent无法追踪早期工作 |
| 权限边界限制 | Agent无法访问所需文件或系统 | 日志中反复出现权限错误 |
How to tell them apart
如何区分收敛与瓶颈
| Dimension | Convergence (work is finishing) | Ceiling (work is stuck) |
|---|---|---|
| Size of diffs | Shrinking steadily toward zero | Staying small but not trending down |
| Nature of changes | Cosmetic -- whitespace, comments, naming | Functional but going in circles |
| Test results | Pass rate climbing toward full coverage | Pass rate plateaued below target |
| Agent stance | Wrapping up, marking exit criteria done | Retrying the same strategies repeatedly |
| Tracking status | Tasks moving to DONE | BLOCKED items piling up |
| Recommended action | Declare done, move to next phase | Diagnose the obstacle, resolve it, then continue |
| 维度 | 收敛(工作接近完成) | 瓶颈(工作陷入停滞) |
|---|---|---|
| 差异大小 | 稳步缩小至接近零 | 保持较小但无下降趋势 |
| 变更性质 | Cosmetic——空格、注释、命名 | 功能性变更但陷入循环 |
| 测试结果 | 通过率持续攀升至全覆盖 | 通过率在目标以下停滞 |
| Agent状态 | 收尾工作,标记退出条件完成 | 反复尝试相同策略 |
| 跟踪状态 | 任务转为DONE | BLOCKED任务不断堆积 |
| 建议操作 | 宣告完成,进入下一阶段 | 诊断障碍、解决后继续 |
How to distinguish them
区分方法
Check 1: Are tests passing?
YES, and improving -> Convergence
NO, stuck at same failures -> Ceiling
Check 2: Is the agent trying new approaches?
NO, just polishing -> Convergence
YES, but they all fail similarly -> Ceiling
Check 3: Are there BLOCKED tasks in impl tracking?
NO -> Convergence
YES -> Ceiling (read the blockers)
Check 4: Is the agent producing meaningful error messages?
NO, just minor changes -> Convergence
YES, about dependencies/tools/access -> Ceiling检查1:测试是否通过?
是且持续改善 -> 收敛
否,卡在相同失败点 -> 瓶颈
检查2:Agent是否尝试新方法?
否,仅做优化 -> 收敛
是,但均以类似方式失败 -> 瓶颈
检查3:实现跟踪中是否存在BLOCKED任务?
否 -> 收敛
是 -> 瓶颈(查看阻塞原因)
检查4:Agent是否产生有意义的错误信息?
否,仅做小幅变更 -> 收敛
是,关于依赖/工具/访问权限 -> 瓶颈3. Non-Convergence Signals
3. 非收敛信号
Non-convergence means the agent is making changes, but they are NOT decreasing. The system is not stabilizing.
Non-convergence:
Iteration 1: ████████████████████████████████████████ 250 lines changed
Iteration 2: ██████████████████████████████████████ 230 lines changed
Iteration 3: ████████████████████████████████████████ 260 lines changed
Iteration 4: ██████████████████████████████████ 220 lines changed
^--- NOT converging: changes are flat/oscillating非收敛指的是Agent仍在产生变更,但变更量并未减少。系统未趋于稳定。
非收敛:
Iteration 1: ████████████████████████████████████████ 250行变更
Iteration 2: ██████████████████████████████████████ 230行变更
Iteration 3: ████████████████████████████████████████ 260行变更
Iteration 4: ██████████████████████████████████ 220行变更
^--- 未收敛:变更量持平/波动Root causes of non-convergence
非收敛的根本原因
| Root Cause | Symptom | Fix |
|---|---|---|
| Fuzzy specs | Agent interprets requirements differently each iteration | Make specs more precise; add concrete acceptance criteria |
| Weak validation | Agent cannot verify correctness, so it keeps changing things | Add build/test/lint gates; strengthen acceptance criteria |
| Fighting sub-agents | Multiple agents change the same code in conflicting ways | Add file ownership tables; dispatch subagents via the Agent tool |
| Contradictory requirements | Spec A says X, spec B says not-X | Resolve contradictions in specs; add explicit priority/precedence |
| Missing exit criteria | Agent does not know when it is done | Add explicit exit criteria checklists and completion signals |
| Over-broad scope | Too much work for one prompt/iteration | Split into smaller, focused prompts with clear boundaries |
| Unstable dependencies | External library or API keeps changing | Pin dependencies; mock external services in tests |
| 根本原因 | 症状 | 修复方案 |
|---|---|---|
| 模糊需求规格 | Agent每轮迭代对需求的解读不同 | 细化需求规格;添加具体验收标准 |
| 弱验证机制 | Agent无法验证正确性,因此持续变更 | 添加构建/测试/代码检查关卡;强化验收标准 |
| 子Agent冲突 | 多个Agent以冲突方式修改同一代码 | 添加文件归属表;通过Agent工具调度子Agent |
| 矛盾需求 | 规格A要求X,规格B要求非X | 解决需求中的矛盾;添加明确优先级/规则 |
| 缺失退出条件 | Agent不知道何时完成工作 | 添加明确的退出条件清单和完成信号 |
| 范围过宽 | 单次提示/迭代的工作量过大 | 拆分为更小、聚焦的提示,明确边界 |
| 依赖不稳定 | 外部库或API持续变更 | 固定依赖版本;在测试中模拟外部服务 |
The critical rule
关键规则
When the loop isn't stabilizing, the problem is upstream -- fix the specifications, validation, or coordination rather than adding more passes.
Running more iterations when the system is not converging wastes time and compute. Instead:
- Stop the iteration loop
- Analyze the non-convergence pattern
- Fix the root cause (usually specs or validation)
- Resume the iteration loop
当循环未趋于稳定时,问题出在源头——修复需求规格、验证机制或协调问题,而非增加迭代次数。
当系统未收敛时,运行更多迭代只会浪费时间和计算资源。正确做法:
- 停止迭代循环
- 分析非收敛模式
- 修复根本原因(通常是需求规格或验证机制)
- 恢复迭代循环
4. Test Pass Rate as Convergence Signal
4. 测试通过率作为收敛信号
Test pass rate is the most reliable quantitative convergence signal. Track these metrics:
测试通过率是最可靠的定量收敛信号。需跟踪以下指标:
Metrics to monitor
监测指标
| Iteration | Tests | Pass | Fail | Skip | Pass Rate | Delta |
|-----------|-------|------|------|------|-----------|-------|
| 1 | 45 | 30 | 15 | 0 | 66.7% | -- |
| 2 | 62 | 50 | 12 | 0 | 80.6% | +13.9 |
| 3 | 78 | 70 | 8 | 0 | 89.7% | +9.1 |
| 4 | 85 | 82 | 3 | 0 | 96.5% | +6.8 |
| 5 | 88 | 87 | 1 | 0 | 98.9% | +2.4 || Iteration | 测试总数 | 通过数 | 失败数 | 跳过数 | 通过率 | 变化量 |
|-----------|-------|------|------|------|-----------|-------|
| 1 | 45 | 30 | 15 | 0 | 66.7% | -- |
| 2 | 62 | 50 | 12 | 0 | 80.6% | +13.9 |
| 3 | 78 | 70 | 8 | 0 | 89.7% | +9.1 |
| 4 | 85 | 82 | 3 | 0 | 96.5% | +6.8 |
| 5 | 88 | 87 | 1 | 0 | 98.9% | +2.4 |What to look for
关注模式
| Pattern | Meaning | Action |
|---|---|---|
| Test count increasing | Agent is adding coverage | Good -- system is maturing |
| Pass rate approaching 100% | Implementation matches specs | Good -- approaching convergence |
| Fewer failures per iteration | Each pass fixes more than it breaks | Good -- healthy convergence |
| Pass rate plateaus < 100% | Some tests consistently fail | Ceiling -- investigate failing tests |
| Test count decreasing | Agent is deleting tests | Bad -- investigate why; may be deleting inconvenient tests |
| Pass rate oscillating | Fixes in one area break another | Non-convergence -- check for conflicting specs |
| 模式 | 含义 | 操作 |
|---|---|---|
| 测试数量增加 | Agent在添加测试覆盖 | 良好——系统正在成熟 |
| 通过率接近100% | 实现符合需求规格 | 良好——接近收敛 |
| 每轮迭代失败数减少 | 每轮迭代修复的问题多于引入的问题 | 良好——健康收敛 |
| 通过率在<100%时停滞 | 部分测试持续失败 | 瓶颈——调查失败测试 |
| 测试数量减少 | Agent在删除测试 | 不良——调查原因;可能是删除了不便的测试 |
| 通过率波动 | 修复某区域问题时破坏了另一区域 | 非收敛——检查是否存在矛盾需求 |
Automated convergence check
自动化收敛检查
bash
undefinedbash
undefinedAfter each iteration, check convergence signals
每轮迭代后,检查收敛信号
echo "=== Convergence Check ==="
echo "=== 收敛检查 ==="
1. Lines changed (should be decreasing)
1. 变更行数(应持续减少)
git diff --stat HEAD~1
git diff --stat HEAD~1
2. Test results (should be improving)
2. 测试结果(应持续改善)
{TEST_COMMAND} 2>&1 | tail -5
{TEST_COMMAND} 2>&1 | tail -5
3. Build health (should always pass)
3. 构建健康度(应始终通过)
{BUILD_COMMAND} 2>&1 | tail -3
{BUILD_COMMAND} 2>&1 | tail -3
4. Files changed (should be decreasing)
4. 变更文件数(应持续减少)
git diff --name-only HEAD~1 | wc -l
---git diff --name-only HEAD~1 | wc -l
---5. Forward Progress Metrics
5. 进度指标
For large projects where full convergence takes many iterations, track forward progress toward eventual convergence.
对于需要多轮迭代才能完全收敛的大型项目,需跟踪朝向最终收敛的进度。
Spec requirement coverage
需求规格覆盖率
The percentage of spec requirements with passing tests:
Spec Requirements Coverage:
spec-auth.md: ██████████████████████████████████████ 95% (19/20 requirements)
spec-data.md: ████████████████████████████████ 80% (16/20 requirements)
spec-ui.md: ██████████████████████ 55% (11/20 requirements)
spec-api.md: ████████████████████████████ 70% (14/20 requirements)
─────────────────────────────────────────────────────
Overall: ████████████████████████████ 75% (60/80 requirements)拥有通过测试的需求规格占比:
需求规格覆盖率:
spec-auth.md: ██████████████████████████████████████ 95% (19/20项需求)
spec-data.md: ████████████████████████████████ 80% (16/20项需求)
spec-ui.md: ██████████████████████ 55% (11/20项需求)
spec-api.md: ████████████████████████████ 70% (14/20项需求)
─────────────────────────────────────────────────────
整体: ████████████████████████████ 75% (60/80项需求)Forward progress signals
进度信号
| Metric | Healthy Trend | Unhealthy Trend |
|---|---|---|
| Requirements with passing tests | Increasing each iteration | Flat or decreasing |
| Total test count | Increasing | Flat or decreasing |
| DONE tasks in impl tracking | Increasing | Flat with BLOCKED tasks growing |
| Open issues | Decreasing | Increasing or flat |
| Dead ends documented | Increasing slightly (learning) | Exploding (thrashing) |
| 指标 | 健康趋势 | 不健康趋势 |
|---|---|---|
| 通过测试的需求数 | 每轮迭代增加 | 持平或减少 |
| 总测试数 | 增加 | 持平或减少 |
| 实现跟踪中的DONE任务 | 增加 | 持平且BLOCKED任务增多 |
| 未解决问题 | 减少 | 增加或持平 |
| 记录的死胡同 | 小幅增加(学习过程) | 激增(盲目尝试) |
Iteration velocity
迭代速度
Track how much progress each iteration makes:
| Iteration | Requirements Met | New This Iteration | Velocity |
|-----------|-----------------|-------------------|----------|
| 1 | 15/80 | 15 | 15 |
| 2 | 30/80 | 15 | 15 |
| 3 | 48/80 | 18 | 18 |
| 4 | 60/80 | 12 | 12 |
| 5 | 68/80 | 8 | 8 |
| 6 | 73/80 | 5 | 5 |
| 7 | 76/80 | 3 | 3 |Velocity should decrease over time (easy requirements first, hard ones last), but should never hit zero. Zero velocity = ceiling.
跟踪每轮迭代的进度:
| Iteration | 已满足需求数 | 本轮新增 | 速度 |
|-----------|-----------------|-------------------|----------|
| 1 | 15/80 | 15 | 15 |
| 2 | 30/80 | 15 | 15 |
| 3 | 48/80 | 18 | 18 |
| 4 | 60/80 | 12 | 12 |
| 5 | 68/80 | 8 | 8 |
| 6 | 73/80 | 5 | 5 |
| 7 | 76/80 | 3 | 3 |速度应随时间下降(先处理简单需求,后处理复杂需求),但绝不应降至零。零速度=瓶颈。
6. When to Stop Iterating
6. 何时停止迭代
Stop conditions (convergence reached)
停止条件(已达到收敛)
Stop the iteration loop when ANY of these are true:
- Completion signal emitted: Agent outputs
<all-tasks-complete> - Changes are trivial: Last iteration changed fewer than ~20 lines, all formatting/comments
- Test pass rate is stable: Pass rate has been 95%+ for 2+ consecutive iterations
- All exit criteria met: Every in the exit criteria checklist is
[ ][x] - Forward progress stalled positively: All spec requirements have passing tests
当满足以下任一条件时,停止迭代循环:
- **发出完成信号:**Agent输出
<all-tasks-complete> - **变更无关紧要:**上一轮迭代变更少于约20行,且均为格式/注释调整
- **测试通过率稳定:**通过率连续2+轮保持95%以上
- **所有退出条件满足:**退出条件清单中的所有均变为
[ ][x] - **进度正向停滞:**所有需求规格均有通过的测试
Continue conditions (not yet converged)
继续条件(未达到收敛)
Continue iterating when ALL of these are true:
- Changes are still substantial (behavior changes, not just formatting)
- Test pass rate is still improving
- There are still TODO or IN_PROGRESS tasks in impl tracking
- The iteration count is under the maximum
当满足以下所有条件时,继续迭代:
- 变更仍为实质性(行为变更,而非仅格式调整)
- 测试通过率仍在改善
- 实现跟踪中仍有TODO或IN_PROGRESS任务
- 迭代次数未超过最大值
Investigate conditions (possible ceiling)
调查条件(可能存在瓶颈)
Pause and investigate when ANY of these are true:
- Changes are small but tests are NOT passing
- Agent is retrying the same approach repeatedly
- BLOCKED tasks are accumulating in impl tracking
- Test pass rate is oscillating (up-down-up-down)
- Agent is producing error messages about dependencies or tooling
当满足以下任一条件时,暂停并调查:
- 变更量小但测试未通过
- Agent反复尝试相同方法
- 实现跟踪中BLOCKED任务不断堆积
- 测试通过率波动(上升-下降-上升-下降)
- Agent产生关于依赖或工具的错误信息
7. Monitoring During Iteration Loops
7. 迭代循环中的监测
What to monitor in real time
实时监测内容
+------------------------------------------------------+
| Convergence Dashboard |
+------------------------------------------------------+
| Iteration: 4/10 |
| Lines changed: 45 (prev: 112, trend: decreasing) |
| Files changed: 3 (prev: 8, trend: decreasing) |
| Test pass rate: 94.2% (prev: 87.1%, trend: up) |
| Tests: 82 total (prev: 75, trend: up) |
| BLOCKED tasks: 0 (prev: 1, trend: down) |
| Status: CONVERGING |
+------------------------------------------------------++------------------------------------------------------+
| 收敛仪表盘 |
+------------------------------------------------------+
| 迭代次数: 4/10 |
| 变更行数: 45(上一轮: 112,趋势: 下降) |
| 变更文件数: 3(上一轮: 8,趋势: 下降) |
| 测试通过率: 94.2%(上一轮: 87.1%,趋势: 上升) |
| 测试总数: 82(上一轮: 75,趋势: 上升) |
| BLOCKED任务数: 0(上一轮: 1,趋势: 下降) |
| 状态: 正在收敛 |
+------------------------------------------------------+Monitoring commands
监测命令
bash
undefinedbash
undefinedQuick convergence check after each iteration
每轮迭代后快速检查收敛情况
echo "--- Lines changed ---"
git diff --stat HEAD~1 | tail -1
echo "--- Files changed ---"
git diff --name-only HEAD~1 | wc -l
echo "--- Test results ---"
{TEST_COMMAND} --summary 2>&1 | tail -3
echo "--- Impl tracking status ---"
grep -c "BLOCKED|IN_PROGRESS|TODO|DONE" context/impl/impl-*.md
undefinedecho "--- 变更行数 ---"
git diff --stat HEAD~1 | tail -1
echo "--- 变更文件数 ---"
git diff --name-only HEAD~1 | wc -l
echo "--- 测试结果 ---"
{TEST_COMMAND} --summary 2>&1 | tail -3
echo "--- 实现跟踪状态 ---"
grep -c "BLOCKED|IN_PROGRESS|TODO|DONE" context/impl/impl-*.md
undefinedAutomated alerts
自动化告警
Set up alerts for non-convergence signals:
| Alert | Trigger | Action |
|---|---|---|
| Oscillation | Lines changed increased vs previous iteration | Pause; check for conflicting changes |
| Stall | Lines changed < 5 but tests still failing | Pause; likely a ceiling |
| Regression | Test pass rate decreased | Pause; investigate what broke |
| Runaway | Lines changed > 500 for 3+ iterations | Pause; scope may be too broad |
为非收敛信号设置告警:
| 告警 | 触发条件 | 操作 |
|---|---|---|
| 波动 | 变更行数较上一轮增加 | 暂停;检查是否存在冲突变更 |
| 停滞 | 变更行数<5但测试仍失败 | 暂停;可能存在瓶颈 |
| 退化 | 测试通过率下降 | 暂停;调查问题原因 |
| 失控 | 连续3+轮迭代变更行数>500 | 暂停;范围可能过宽 |
8. Non-Convergence Recovery
8. 非收敛恢复流程
When you detect non-convergence, follow this recovery process:
检测到非收敛时,遵循以下恢复流程:
Step 1: Stop the iteration loop
步骤1:停止迭代循环
Do not keep running. More iterations will not help.
不要继续运行。更多迭代无济于事。
Step 2: Diagnose the root cause
步骤2:诊断根本原因
markdown
undefinedmarkdown
undefinedNon-Convergence Diagnosis
非收敛诊断
Symptoms
症状
- Changes are flat (not decreasing)
- Changes are oscillating (up-down-up-down)
- Agent is retrying failed approaches
- Tests are oscillating (passing then failing)
- Multiple agents changing the same files
- 变更量持平(未减少)
- 变更量波动(上升-下降-上升-下降)
- Agent反复尝试失败方法
- 测试结果波动(通过后又失败)
- 多个Agent修改同一文件
Root Cause Analysis
根本原因分析
- Check specs: Are requirements clear and unambiguous?
- Check validation: Can the agent verify correctness?
- Check file ownership: Are agents conflicting?
- Check scope: Is the prompt trying to do too much?
- Check dependencies: Are external resources available?
undefined- 检查需求规格:需求是否清晰明确?
- 检查验证机制:Agent能否验证正确性?
- 检查文件归属:Agent是否存在冲突?
- 检查范围:提示的工作量是否过大?
- 检查依赖:外部资源是否可用?
undefinedStep 3: Fix the root cause
步骤3:修复根本原因
| Root Cause | Fix |
|---|---|
| Fuzzy specs | Rewrite ambiguous requirements with concrete acceptance criteria |
| Weak validation | Add build/test/lint gates to the prompt |
| File conflicts | Add file ownership tables; dispatch subagents via the Agent tool |
| Over-broad scope | Split into smaller prompts; reduce concurrent agents |
| External dependency | Mock the dependency; or resolve it before resuming |
| 根本原因 | 修复方案 |
|---|---|
| 模糊需求规格 | 重写模糊需求,添加具体验收标准 |
| 弱验证机制 | 在提示中添加构建/测试/代码检查关卡 |
| 文件冲突 | 添加文件归属表;通过Agent工具调度子Agent |
| 范围过宽 | 拆分为更小的提示;减少并发Agent数量 |
| 外部依赖问题 | 模拟依赖;或在恢复前解决依赖问题 |
Step 4: Resume the iteration loop
步骤4:恢复迭代循环
After fixing the root cause, resume from where you stopped. Do NOT restart from scratch -- git history preserves all progress.
bash
undefined修复根本原因后,从停止处恢复。不要从头开始——git历史记录保留了所有进度。
bash
undefinedResume with the same prompt, possibly fewer remaining iterations
使用相同提示恢复迭代,可减少剩余迭代次数
iteration-loop context/prompts/003-generate-impl-from-plans.md -n 5 -t 1h
---iteration-loop context/prompts/003-generate-impl-from-plans.md -n 5 -t 1h
---9. Convergence and Revision
9. 收敛与修订
Revision directly improves convergence by making specs more complete:
Without revision:
Iteration 1: 200 lines, 5 manual fixes -> specs unchanged
Iteration 2: 180 lines, 4 manual fixes -> specs unchanged
Iteration 3: 170 lines, 4 manual fixes -> NOT converging
With revision:
Iteration 1: 200 lines, 5 manual fixes -> specs updated with 5 new requirements
Iteration 2: 100 lines, 2 manual fixes -> specs updated with 2 new requirements
Iteration 3: 50 lines, 0 manual fixes -> CONVERGINGFrequent manual fixes without revision = non-convergence. The iteration loop keeps producing the same bugs because nothing in the specs prevents them.
修订通过完善需求规格直接提升收敛效率:
无修订:
Iteration 1: 200行变更,5处手动修复 -> 需求规格未变更
Iteration 2: 180行变更,4处手动修复 -> 需求规格未变更
Iteration 3: 170行变更,4处手动修复 -> 未收敛
有修订:
Iteration 1: 200行变更,5处手动修复 -> 需求规格新增5项要求
Iteration 2: 100行变更,2处手动修复 -> 需求规格新增2项要求
Iteration 3: 50行变更,0处手动修复 -> 正在收敛**频繁手动修复但不修订需求规格=非收敛。**迭代循环会持续产生相同的bug,因为需求规格中没有任何规则防止此类问题。
Cross-References
交叉引用
- Convergence patterns reference: See for the complete convergence pattern catalog with examples.
references/convergence-patterns.md - Revision: See skill for how tracing bugs to specs improves convergence.
ck:revision - Prompt pipeline: See skill for designing prompts with proper exit criteria and completion signals.
ck:prompt-pipeline - Validation-first design: See skill for building validation gates that provide convergence signals.
ck:validation-first - Impl tracking: See skill for tracking progress and detecting ceiling conditions.
ck:impl-tracking
- **收敛模式参考:**查看获取完整的收敛模式目录及示例。
references/convergence-patterns.md - **修订:**查看技能,了解如何通过将bug追溯到需求规格来提升收敛效率。
ck:revision - **提示流水线:**查看技能,了解如何设计带有适当退出条件和完成信号的提示。
ck:prompt-pipeline - **验证优先设计:**查看技能,了解如何构建提供收敛信号的验证关卡。
ck:validation-first - **实现跟踪:**查看技能,了解如何跟踪进度并检测瓶颈情况。
ck:impl-tracking