79 / 90

第 79 天:有界需求、上下文包与权限预算

把工程目标转化为带可执行验收标准的有界需求,组装最小上下文包,并在 Agent 运行前设定权限与预算边界。

Self-Directed Learning & Python 480 分钟有效研习(8 小时)
01 120 分钟

有界需求撰写与可执行验收标准

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 形式的编号验收标准、允许文件清单、禁止操作清单与两条非目标。自查:每条标准都必须能落实为命令或断言。

独立掌握标准

产出一份有界需求,其验收标准可被第三方不加追问地独立执行。

权威源资源与权利证明

linking Open Access / CC BY 4.0

SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering

作者 / 机构: John Yang, Carlos E. Jimenez, Alexander Wettig, Kilian Lieret, Shunyu Yao, Karthik Narasimhan, Ofir Press | 原始出处链接 ↗

对应章节 / 时间戳: 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.

AutoCodeRover: Autonomous Program Improvement ↗ compared_alternative [Open Access / CC BY 4.0]

Focuses on autonomous program repair via code search; SWE-agent better matches the curriculum's bounded-tool and human-verification emphasis.

linking Open Access / CC BY 4.0

SWE-bench: Can Language Models Resolve Real-World GitHub Issues?

作者 / 机构: Carlos E. Jimenez, John Yang, Alexander Wettig, Shunyu Yao, Kexin Pei, Ofir Press, Karthik R. Narasimhan | 原始出处链接 ↗

对应章节 / 时间戳: 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)
HumanEval: Evaluating Large Language Models Trained on Code ↗ compared_alternative [arXiv non-exclusive license / Open Access]

Function-level synthesis benchmark; SWE-bench models the repository-scoped issue-to-diff workflow that this delivery block rehearses.

Multi-SWE-bench: A Multilingual Benchmark for Issue Resolving ↗ compared_alternative [Open Access / CC BY 4.0]

Extends issue resolution to multiple programming languages; the original Python-centric SWE-bench provides a cleaner pedagogical anchor.

02 120 分钟

独立任务分解与上下文包组装

独立掌握检查(无 AI 辅助)

前置要求

第 79 天 活动 1。

学习目标

在无 AI 辅助的情况下,把有界需求分解为有序工作计划,并组装 Agent 所需的最小上下文包:文件清单、接口契约、环境事实与预算。

操作指引

1. 列出任务触及的每个文件及原因;标注只读或可写。
2. 为变更函数编写接口契约:签名、返回模式与错误行为。
3. 记录环境事实:Python 版本、精确运行命令、夹具位置与一次性工作区规则。
4. 按 Ticket 22 控制档估算执行预算:max_steps=6、max_retries=2、tool_payload_bytes=4096。
5. 本活动关闭 Agent 完成:被检验的是你自身的规格化能力,而非 Agent 的能力。

自主演练与记录

为第 79 天需求产出含 files[]、contracts[]、environment{}、budgets{} 键的 context_pack.json,并用 python3 -c 'import json;json.load(open("context_pack.json"))' 证明其可解析。

独立掌握标准

仅凭记忆与文档组装出最小且可解析的上下文包——这是一项独立工程技能,而非 Agent 辅助绩效。

权威源资源与权利证明

linking Open Access / CC BY 4.0

SWE-bench: Can Language Models Resolve Real-World GitHub Issues?

作者 / 机构: Carlos E. Jimenez, John Yang, Alexander Wettig, Shunyu Yao, Kexin Pei, Ofir Press, Karthik R. Narasimhan | 原始出处链接 ↗

对应章节 / 时间戳: 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)
HumanEval: Evaluating Large Language Models Trained on Code ↗ compared_alternative [arXiv non-exclusive license / Open Access]

Function-level synthesis benchmark; SWE-bench models the repository-scoped issue-to-diff workflow that this delivery block rehearses.

Multi-SWE-bench: A Multilingual Benchmark for Issue Resolving ↗ compared_alternative [Open Access / CC BY 4.0]

Extends issue resolution to multiple programming languages; the original Python-centric SWE-bench provides a cleaner pedagogical anchor.

linking CC BY-NC-SA 3.0 noncommercial share-alike

Pro Git, Second Edition

作者 / 机构: Scott Chacon and Ben Straub | 原始出处链接 ↗

对应章节 / 时间戳: Chapter 3 (Git Branching), Section 7.7 (Reset Demystified), Sections 5.2/6.2 (Contributing to a Project)

验证版本与日期: Second edition (Apress, 2014) (Verified: 2026-10-30)

入选理由:

Freely licensed reference for branching, merging, conflict resolution, and safe recovery vocabulary used through the delivery workflow.

来源前置条件:

Basic git status/log/diff vocabulary from earlier study days

安全回退方案(离线弹性):

git help <command> and the Git manual pages ship with Git and cover the same commands offline; every required workflow is stated locally in the lesson.

对比候选资源与选型分析 (2)
GitHub Skills interactive courses ↗ compared_alternative [MIT (varies by course)]

Interactive but requires a GitHub account and an external service; disposable local repositories keep the exercise self-contained.

Atlassian Git Tutorials ↗ compared_alternative [All Rights Reserved]

Vendor-owned prose with no permissive license; Pro Git covers the same ground under CC BY-NC-SA.

03 120 分钟

权限边界、执行预算与有界 Agent 运行

Agent 辅助工程检查

前置要求

第 79 天 活动 2。

学习目标

显式声明 Agent 的权限策略与资源预算,随后在准备好的上下文上运行有界 Agent,并记录完整的 action/observation 追踪。

操作指引

1. 运行前先把授权书写下来:允许的工具(仅限一次性工作区内读写)与禁止操作(git push、联网、付费、删除一次性目录之外的内容)。push、真实部署、付费执行与破坏性命令始终需要单独授权。
2. 设置预算:max_steps=6、max_retries=2、tool_payload_bytes=4096(Ticket 22 控制档)。
3. 运行参考工作流:python -m projects.agent_learning.cli evaluate --fixture summarize-notes --output /tmp/agent-run.json
4. 通过公开 API 演练故障路径:用 DeterministicModelAdapter(fault="invalid_arguments") 调用 run_task,确认 observation 为结构化结果({'ok': False, 'error': 'invalid_arguments'})且运行在预算内终止而非死循环。

自主演练与记录

捕获运行产物并为每个 action 事件加注:消耗了哪项预算、使用了哪类权限、是否保持在声明的文件范围内。确认 result.steps <= 6 且 result.retries <= 2。

独立掌握标准

在显式权限与预算约束下指挥 Agent,产出完整可审计的执行追踪。

权威源资源与权利证明

linking Open Access / CC BY 4.0

SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering

作者 / 机构: John Yang, Carlos E. Jimenez, Alexander Wettig, Kilian Lieret, Shunyu Yao, Karthik Narasimhan, Ofir Press | 原始出处链接 ↗

对应章节 / 时间戳: 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.

AutoCodeRover: Autonomous Program Improvement ↗ compared_alternative [Open Access / CC BY 4.0]

Focuses on autonomous program repair via code search; SWE-agent better matches the curriculum's bounded-tool and human-verification emphasis.

linking CC BY-NC-SA 3.0 noncommercial share-alike

Pro Git, Second Edition

作者 / 机构: Scott Chacon and Ben Straub | 原始出处链接 ↗

对应章节 / 时间戳: Chapter 3 (Git Branching), Section 7.7 (Reset Demystified), Sections 5.2/6.2 (Contributing to a Project)

验证版本与日期: Second edition (Apress, 2014) (Verified: 2026-10-30)

入选理由:

Freely licensed reference for branching, merging, conflict resolution, and safe recovery vocabulary used through the delivery workflow.

来源前置条件:

Basic git status/log/diff vocabulary from earlier study days

安全回退方案(离线弹性):

git help <command> and the Git manual pages ship with Git and cover the same commands offline; every required workflow is stated locally in the lesson.

对比候选资源与选型分析 (2)
GitHub Skills interactive courses ↗ compared_alternative [MIT (varies by course)]

Interactive but requires a GitHub account and an external service; disposable local repositories keep the exercise self-contained.

Atlassian Git Tutorials ↗ compared_alternative [All Rights Reserved]

Vendor-owned prose with no permissive license; Pro Git covers the same ground under CC BY-NC-SA.

04 120 分钟

评估:追踪审计与有据验收判定

独立掌握检查(无 AI 辅助)

前置要求

第 79 天 活动 1-3。

学习目标

独立审计 Agent 运行:将每条验收标准与可观测证据逐一核对,确认预算与权限合规,并写出不采信 Agent 自我声明的合/不合判定。

操作指引

1. 重新载入 /tmp/agent-run.json,用具体断言或命令输出验证活动 1 的每条验收标准。
2. 将每条已记录的 action 与权限清单比对:标记任何越界文件访问或未注册工具调用。
3. 确认终止安全:步数与重试在预算内、无超时强杀、注入故障处均有结构化失败 observation。
4. 撰写 verdict.md:逐条标准的表格引用证据命令与观测结果,外加一段限制说明——deterministic-v1 适配器是夹具,并非真实模型能力证据。

自主演练与记录

产出 verdict.md 表格:criterion | 证据命令 | 观测结果 | 判定。至少一行须引用你亲自重跑的故障路径(invalid_arguments 或 missing_note)。

独立掌握标准

出具一份把独立验证与 Agent 辅助绩效分开的、证据充分的验收判定。

权威源资源与权利证明

linking Open Access / CC BY 4.0

SWE-bench: Can Language Models Resolve Real-World GitHub Issues?

作者 / 机构: Carlos E. Jimenez, John Yang, Alexander Wettig, Shunyu Yao, Kexin Pei, Ofir Press, Karthik R. Narasimhan | 原始出处链接 ↗

对应章节 / 时间戳: Appendix A.4 Evaluation Procedure

验证版本与日期: 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)
HumanEval: Evaluating Large Language Models Trained on Code ↗ compared_alternative [arXiv non-exclusive license / Open Access]

Function-level synthesis benchmark; SWE-bench models the repository-scoped issue-to-diff workflow that this delivery block rehearses.

Multi-SWE-bench: A Multilingual Benchmark for Issue Resolving ↗ compared_alternative [Open Access / CC BY 4.0]

Extends issue resolution to multiple programming languages; the original Python-centric SWE-bench provides a cleaner pedagogical anchor.

linking Open Access / CC BY 4.0

SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering

作者 / 机构: John Yang, Carlos E. Jimenez, Alexander Wettig, Kilian Lieret, Shunyu Yao, Karthik Narasimhan, Ofir Press | 原始出处链接 ↗

对应章节 / 时间戳: Appendix B.3 Trajectory Analysis and B.4 Failure Modes

验证版本与日期: 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.

AutoCodeRover: Autonomous Program Improvement ↗ compared_alternative [Open Access / CC BY 4.0]

Focuses on autonomous program repair via code search; SWE-agent better matches the curriculum's bounded-tool and human-verification emphasis.