有界需求撰写与可执行验收标准
Agent 辅助工程检查
前置要求
第 73-78 天的 Agent 循环、工具协议、状态与执行限制;Ticket 22 的有界 Agent 项目(projects/agent_learning)。
学习目标
把工程目标转化为带明确验收标准、范围边界与非目标的有界需求,使 Agent 可以执行、评审者可以独立验证。
操作指引
1. 在一次性夹具内选定一个有界变更:扩展 projects/agent_learning(Ticket 22)使 write_report 同时输出每条笔记的词数,或在 projects/text_tools 内做等价的小幅 diff。
2. 将需求写成“意图+约束+验收标准”。每条标准必须机器可检验:“GIVEN summarize-notes 夹具 WHEN 运行 evaluate THEN /tmp/agent-run.json 中 report.word_counts 每条笔记各有一项”。
3. 声明范围边界:Agent 可读写的确切文件、禁止操作(禁止 push、禁止改依赖、禁止联网)以及明确的非目标(不得重构目标模块之外的代码)。
4. 保持变更可评审:目标为改动少于 60 行、单个原子提交。
自主演练与记录
撰写 requirement.md:一段意图说明、三条 Given/When/Then 形式的编号验收标准、允许文件清单、禁止操作清单与两条非目标。自查:每条标准都必须能落实为命令或断言。
如果某条标准无法转化为 python -m projects.agent_learning.cli evaluate ... 的输出或 unittest 断言,它就是不可验证的——改写到可验证为止。
# requirement.md
意图:扩展 write_report 输出每条笔记的词数。
验收标准:
1. GIVEN summarize-notes 夹具 WHEN 运行 evaluate THEN agent-run.json 中的报告含全部笔记的 word_counts。
2. GIVEN 2 条笔记夹具 THEN trace 在 max_steps=6、retries<=2 内。
3. GIVEN fault=invalid_arguments THEN 运行输出结构化失败 observation 而非崩溃。
范围:仅 projects/agent_learning/*.py 与 tests/projects/test_agent_learning.py。
禁止:git push、联网、删除夹具文件。
非目标:新模型适配器、CLI 重设计。
产出一份有界需求,其验收标准可被第三方不加追问地独立执行。
权威源资源与权利证明
SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering
对应章节 / 时间戳: Section 2 The Agent-Computer Interface and Section 3 SWE-agent: Designing an ACI for Software Engineering
验证版本与日期: NeurIPS 2024 / arXiv:2405.15793v2 (Verified: 2026-10-30)
Primary literature on agent-computer interfaces showing that bounded tool commands, trajectory inspection, and environment constraints determine whether an agent can carry an engineering task to verifiable completion.
Agent loops, tool protocols, and basic software engineering workflow vocabulary.
The permission/budget control profile, tool contract schema, and trace audit procedure are fully implemented in the local bounded agent fixture (projects/agent_learning).
对比候选资源与选型分析 (2)
Broader generalist agent platform; SWE-agent isolates the agent-computer interface design principles most relevant to bounded task delivery.
Focuses on autonomous program repair via code search; SWE-agent better matches the curriculum's bounded-tool and human-verification emphasis.
SWE-bench: Can Language Models Resolve Real-World GitHub Issues?
对应章节 / 时间戳: Section 2.1 Benchmark Construction and Section 2.2 Task Formulation (FAIL_TO_PASS tests)
验证版本与日期: ICLR 2024 / arXiv:2310.06770v3 (Verified: 2026-10-30)
Defines the standard pattern this block teaches: a bounded issue statement paired with executable fail-to-pass tests as verifiable acceptance criteria for agent-produced changes.
Unit testing, issue descriptions, and repository evaluation vocabulary.
The acceptance-criteria pattern is exercised locally through the Ticket 22 fixture scorer and the Ticket 24 regression exercise without external datasets.
对比候选资源与选型分析 (2)
Function-level synthesis benchmark; SWE-bench models the repository-scoped issue-to-diff workflow that this delivery block rehearses.
Extends issue resolution to multiple programming languages; the original Python-centric SWE-bench provides a cleaner pedagogical anchor.