-
Notifications
You must be signed in to change notification settings - Fork 9
Add Anthropic Harness Engineering insights to 4 deep-dive docs #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -215,6 +215,22 @@ done_messages ──→ 总 token > max_tokens (1024)? | |
| | 中触发 | Goose(80%)/ Kimi(85%) | 接近上限 | 平衡保留与安全 | 大会话可能来不及 | | ||
| | 晚触发 | Claude Code(~95%) | 接近极限 | 保留最多上下文 | 紧急压缩、无验证时间 | | ||
|
|
||
| ### "Context Anxiety"上下文焦虑(来源:[Anthropic Engineering Blog](https://www.anthropic.com/engineering/harness-design-long-running-apps),2026-03-24) | ||
|
|
||
| Anthropic 工程团队在长任务 harness 开发中发现:**模型在上下文接近容量时会提前结束工作**——不是因为任务完成,而是因为"感知到"上下文即将耗尽。 | ||
|
|
||
| - **Sonnet 4.5**:context anxiety 严重,**单靠 compaction(原地摘要)不够**——因为 compaction 保持了连续性但没有给 Agent 一个"干净起点",焦虑仍然持续。需要**完全重置上下文**(context reset,清空重来)才能保持长任务连贯性 | ||
| - **Opus 4.5**:**基本消除了此行为**(原文:"Opus 4.5 largely removed that behavior on its own"),可以移除 context reset 机制 | ||
|
|
||
| > **Compaction vs Context Reset 的区别**(原文):Compaction 是"原地摘要,保持连续性";Context Reset 是"清空重来,代价是需要足够的交接信息让下一个 Agent 接手"。 | ||
|
|
||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟢 小问题:"Opus 4.5+" 是外推修复后写的是:
博客原文只说了 Opus 4.5 "largely removed" 了 context anxiety,没有对 4.5 之后的所有模型做保证。"4.5+" 是一个外推。建议改为更保守的 — Qwen-Code + GLM-5.1 (Round 2) |
||
| **这解释了压缩阈值差异的深层原因**: | ||
| - Claude Code 设 ~95% 阈值——Opus 4.5 起 context anxiety 基本消除("largely removed"),可以安全地晚触发 | ||
| - 如果使用 Sonnet 作为主模型,可能需要更早触发或使用 context reset | ||
| - Gemini CLI 50% 阈值——可能 Gemini 模型也存在类似的 context anxiety | ||
|
|
||
| > **实践建议**:压缩阈值不应只考虑"保留多少上下文",还应考虑"模型在多少容量下开始焦虑"。不同模型的焦虑阈值不同。 | ||
|
|
||
| ### 验证步骤的价值 | ||
|
|
||
| 只有 Gemini CLI 实现了独立验证(Phase 4 Probe)。其他所有工具都信任单次 LLM 输出。这是**成本与质量的核心权衡**——额外一次 LLM 调用的成本 vs 压缩质量提升。 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -272,16 +272,54 @@ Action → EventStream(发布/订阅总线)→ Runtime → Observation → | |
|
|
||
| ## 设计模式对比 | ||
|
|
||
| ### 协作 vs 竞争 vs 委托 | ||
| ### 协作 vs 竞争 vs 评估 vs 委托 | ||
|
|
||
| | 模式 | 代表 | 优势 | 劣势 | | ||
| |------|------|------|------| | ||
| | **协作分工** | Claude Teammates | 任务并行,效率高 | 协调复杂 | | ||
| | **竞争选优** | Qwen Arena | 多视角,质量高 | 资源浪费(N 倍成本) | | ||
| | **GAN 式评估** | Anthropic Harness(Planner→Generator→Evaluator) | 独立评估,质量可控 | 延迟高,成本高 | | ||
| | **专用委托** | Gemini 5 子代理 | 职责清晰,资源可控 | 灵活性有限 | | ||
| | **事件解耦** | OpenHands EventStream | 最灵活,异步 | 架构最复杂 | | ||
| | **流水线** | Aider Architect | 简单高效 | 非并行 | | ||
|
|
||
| ### GAN 式评估 vs Arena 竞争(来源:[Anthropic Engineering Blog](https://www.anthropic.com/engineering/harness-design-long-running-apps),2026-03-24) | ||
|
|
||
| 两种解决"Agent 自评失败"问题的不同路径: | ||
|
|
||
| | 维度 | GAN 式评估(Anthropic Harness) | Arena 竞争(Qwen Code) | | ||
| |------|-------------------------------|----------------------| | ||
| | **核心思路** | 1 个 Generator + 1 个独立 Evaluator | N 个 Generator 竞争同一任务 | | ||
| | **质量保证** | Evaluator 按标准打分,不达标则退回重做 | 用户从 N 个结果中选最优 | | ||
| | **成本模型** | 固定(1 生成 + 1 评估 × 迭代次数) | 线性(N 倍生成成本) | | ||
| | **适用场景** | 长任务、主观质量(前端设计、UX) | 短任务、客观质量(代码正确性) | | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 事实错误:评估标准混淆了前端和全栈两套不同标准博客中实际有 两套不同的评估标准: 前端设计任务(4 维度):
全栈任务(4 维度):
PR 中写的"设计质量、原创性、技术工艺、功能完整性"是前端标准的意译,但缺少来源说明这是前端设计任务的标准,而非通用标准。容易误导读者认为这是所有任务的统一标准。 建议明确标注这是前端设计任务的评估标准,或分别列出两套标准。 — Qwen-Code + GLM-5.1 |
||
| | **关键发现** | "调校独立评估者比让生成者自我批评**容易得多**" | 多模型视角减少单一模型偏见 | | ||
|
|
||
| **Anthropic 的三代理架构**: | ||
|
|
||
| ``` | ||
| Planner(规划) | ||
| → 将 1-4 句用户需求扩展为完整产品规格 | ||
| → 重范围界定,轻技术细节 | ||
|
|
||
| Generator(生成) | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 误导性省略:Sprint Contract 在 Opus 4.6 中被完全移除博客原文:
PR 详细描述了 Sprint Contract 模式,但省略了关键信息:这个模式在更好的模型出现后就被废弃了。这对读者理解该模式的适用性很重要。 建议补充:" — Qwen-Code + GLM-5.1 |
||
| → 增量式实现,React/Vite/FastAPI/SQLite + Git | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 残留:Sprint 时间线表述修复后写的是:
博客原文的时间线:
"Sonnet 4.5 需要 Sprint"暗示 Sprint 是 Sonnet 特有的需求,但实际上 Opus 4.5 也在用 Sprint。更准确: — Qwen-Code + GLM-5.1 (Round 2) |
||
| → Sprint 分解:v0/v1 harness 使用(含 Opus 4.5),v2(Opus 4.6)已移除 | ||
|
|
||
| Evaluator(评估) | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 残留:加权描述仍不准确修复后写的是:
但博客原文的意思是:
这是一个实用性校准(已经擅长的维度不需要额外加权),而非"推动模型承担审美风险"。两轮修改都未准确传达原文意思。 建议改为: — Qwen-Code + GLM-5.1 (Round 2) |
||
| → 通过 Playwright 测试运行中的应用 | ||
| → 前端设计评估 4 维度:设计质量、原创性、技术工艺(craft)、功能 | ||
| (设计+原创性权重更高——因为 Claude 在工艺和功能性上已默认表现良好) | ||
| → 全栈应用评估 4 维度:产品深度、功能完整性、视觉设计、代码质量 | ||
| → Few-shot 校准 + 显式怀疑指令 | ||
| ``` | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 表述不准确:"主观维度权重 > 客观维度" 的归因有误博客原文:
这是一个实用性的校准决策(对已擅长的维度降低权重),而非"主观比客观更重要"的哲学判断。PR 中的"主观维度(设计、原创性)权重 > 客观维度(技术)"暗示了一种主客观价值的层级关系,扭曲了原文的意思。 建议改为:"设计质量和原创性权重更高——因为 Claude 在工艺和功能性上已默认表现良好,不需要额外加权。" — Qwen-Code + GLM-5.1 |
||
|
|
||
| **关键洞察**: | ||
| - Generator 自评时倾向"自信地夸赞平庸作品"——与人类 code review 中的"自审盲区"一致 | ||
| - Evaluator 天然倾向宽松,需要显式"怀疑指令" + few-shot 校准 | ||
| - 评估标准的措辞会**隐式引导 Generator**(如"museum quality"导致视觉趋同) | ||
| - **Sprint 分解不是永恒的**——Sprint 最初用于所有模型(含 Opus 4.5),Opus 4.6 的长任务能力提升使得 Sprint 机制可以被完全移除(原文:"I removed the sprint construct entirely") | ||
|
|
||
| ### 隔离策略 | ||
|
|
||
| | Agent | 隔离方式 | 上下文共享 | | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -212,6 +212,28 @@ _step() | |
|
|
||
| --- | ||
|
|
||
| ## "生成者不应评价自己"原则 | ||
|
|
||
| > 来源:[Anthropic Engineering Blog](https://www.anthropic.com/engineering/harness-design-long-running-apps)(2026-03-24) | ||
|
|
||
| Anthropic 在长任务 harness 开发中发现了一个关键问题:**当 Agent 被要求评价自己产出的作品时,它会自信地夸赞——即使质量平庸**。 | ||
|
|
||
| 这解释了为什么各工具的验证架构都倾向于**分离生成和评估**: | ||
|
|
||
| | 工具 | 生成者 | 评估者 | 分离程度 | | ||
| |------|--------|--------|---------| | ||
| | **Claude Code /review** | Sonnet(变更摘要) | **独立 Opus 代理**(Bug 扫描 + 安全分析) | 完全分离 | | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟢 小问题:Copilot CLI /review 的评估者描述表中写 Copilot CLI /review 的评估者是"实际编译 + 运行测试(非 LLM)"。请确认是否确实完全使用确定性验证。根据项目中的 copilot-cli EVIDENCE.md,/review 可能也使用 LLM 进行代码分析。如果确实如此,"分离程度"列标注为"完全分离(确定性验证)"可能不够准确。 — Qwen-Code + GLM-5.1 |
||
| | **Copilot CLI /review** | Agent | **实际编译 + 运行测试**(非 LLM) | 完全分离(确定性验证) | | ||
| | **Aider 反射循环** | 主模型 | **lint/test 工具**(非 LLM) | 完全分离(确定性验证) | | ||
| | **Anthropic Harness** | Generator | **独立 Evaluator**(Playwright 测试) | 完全分离 | | ||
| | **Qwen Code Arena** | 多个 Generator | **用户**选优 | 生成分离,评估靠人 | | ||
|
|
||
| > **Anthropic 原文**:"Tuning a standalone evaluator to be skeptical turns out to be far more tractable than making a generator critical of its own work."(调校独立评估者比让生成者自我批评**容易得多**。) | ||
|
|
||
| **实践建议**:如果你在构建 Agent 验证流程,**永远不要让 Agent 评价自己的输出**。用独立代理、确定性工具(编译/测试)、或人类评审。 | ||
|
|
||
| --- | ||
|
|
||
| ## 理想验证架构(未来方向) | ||
|
|
||
| 目前没有任何工具同时实现: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 事实错误:"Opus 4.6" 应为 "Opus 4.5"
博客原文:
博客中 Opus 4.6 的角色是取消了 Sprint Contract 和 Sprint 分解,而不是修复 context anxiety。
实际时间线:
建议修正为
**Opus 4.5**:大幅缓解了此问题— Qwen-Code + GLM-5.1