有界需求撰寫與可執行驗收標準
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.