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.