02 / 90

第 02: 概念拆解與最小重現

概念拆解與最小重現。各活動都保留預測、觀察、複盤與恢復證據。

自學方法與 Python 工程基礎 480 分鐘(8 小時專注學習)
01 120 分鐘

概念拆解與最小重現

獨立掌握檢查 — 評量作業期間不得使用 AI 輔助。若接受任何輔助必須如實申報,但接受輔助的作業只計為補救練習:在聲稱掌握之前,必須完成一次新的無輔助檢查。

前置要求

完成第 01 學習日(物件變更追蹤器與預測-實驗-複盤流程)。無需進階 Python 知識。

學習目標

把令人困惑的請求拆解為可觀察的概念、輸入、輸出、約束和最小重現;複用第 01 學習日的追蹤推理方法,而不是照抄其程式碼。

操作指引

把第 01 學習日的預測-實驗-複盤循環應用到一個新問題上——不要貼上第 01 學習日的追蹤器,也不要自行編造任務。全程不查資料:(1) 在執行之前寫下所有預測輸出;(2) 執行給定程式碼片段並記錄實際輸出;(3) 把結果拆解為輸入、預期輸出、約束、名稱/物件/原地修改/新物件配置;(4) 提煉出最小重現;(5) 安排一次新的無輔助檢查。請控制在 120 分鐘預算內。

自主實作與記錄

一位學習者回報:「我的清理輔助函式本應去掉空白,但執行後變數裡的空白還在。為什麼 s.strip() 沒能修好 s?」

執行前先預測每一行輸出:

s = '  data  '
print(repr(s.strip()))
print(repr(s))
s = s.strip()
print(repr(s))

然後把這個請求拆解為:輸入;學習者預期的輸出;實際觀察到的輸出;被破壞的約束;以及哪些要素是名稱、物件、原地修改和新物件配置。最後寫出仍能重現該效果的最小程式碼片段(你的 MRE)。

獨立掌握標準

在無輔助、不查資料的條件下滿足以下全部即通過:(a) 執行前正確預測全部三行輸出;(b) 拆解正確指出「是配置新物件而非原地修改」以及「只有賦值才重新綁定名稱」;(c) MRE 不超過三行且仍能重現變數不變的效果。任何輔助只計為補救練習,在聲稱掌握之前必須先無輔助正確預測並驗證一個新變體(如 `name.upper()`)。

權威來源資源與權利證明

linking PSF License Version 2

Python Data Model & Mutability Reference

作者 / 機構: Python Software Foundation | 原始出處連結 ↗

對應章節 / 時間戳: Section 3.1 & 3.2 (Objects, values, types)

驗證版本與日期: Python 3.12 (Verified: 2026-10-30)

入選理由:

Normative reference on Python identity vs value semantics and mutable vs immutable types without tutorial inaccuracies.

來源前置條件:

Basic command line and high school reading comprehension

安全回退方案(離線彈性):

Official documentation is mirrored locally via standard library pydoc and embedded offline lesson explanations if internet access is interrupted.

對比候選資源與選型分析 (4)
MIT OCW 6.0001 (Prof. Eric Grimson) ↗ compared_alternative [CC BY-NC-SA 4.0]

High pedagogical clarity for Python fundamentals, but structures mutability around academic lecture pacing rather than immediate hands-on minimal reproductions (MRE).

Stanford CS336: Language Modeling from Scratch (Spring 2024) ↗ compared_deferred [No license declared (the repository has no LICENSE file, so all rights are reserved by default)]

Strong systems engineering and PyTorch tensor rigor, but assumes advanced Python mastery and PyTorch installed; deferred to Days 30-60 model pretraining.

3Blue1Brown: Essence of Linear Algebra ↗ compared_deferred [3Blue1Brown copyright (all rights reserved); site FAQ permits only short clips under stated conditions]

Strong visual intuition for linear transformations and vector spaces; selected for Days 10-18 mathematics foundations, but not relevant for Day 01 Python object references.

Andrej Karpathy: Neural Networks: Zero to Hero (micrograd) ↗ compared_deferred [MIT (Repository) / Standard YouTube License (Video)]

Clear, executable autograd intuition; code is MIT license, but video subtitles have unknown/proprietary distribution rights (prohibiting full-text transcript import). Selected for Days 19-25 autograd implementation with linking-only reuse.

linking Journal publisher copyright (all rights reserved) - lawful external linking only

Improving Students' Learning With Effective Learning Techniques: Promising Directions From Cognitive and Educational Psychology

作者 / 機構: John Dunlosky, Katherine A. Rawson, Elizabeth J. Marsh, Mitchell J. Nathan, Daniel T. Willingham | 原始出處連結 ↗

對應章節 / 時間戳: Psychological Science in the Public Interest 14(1): 4-58; practice testing and distributed practice sections

驗證版本與日期: Psychological Science in the Public Interest, 2013 (Verified: 2026-10-30)

入選理由:

Detailed comparative review rating practice testing and distributed practice as high-utility techniques while rating highlighting and rereading low-utility; anchors the retrieval, correction, and spaced-review design of Days 88-90.

來源前置條件:

None beyond general academic reading.

安全回退方案(離線彈性):

Curriculum restates the utility ratings and application conditions in original prose; every task remains runnable offline.

對比候選資源與選型分析 (2)
Pashler et al. Learning Styles: Concepts and Evidence ↗ compared_alternative [Publisher copyright (originally Wiley; now SAGE Publications)]

Important negative result on learning-styles matching but narrower scope; Dunlosky et al. rates a broader set of techniques directly usable for this curriculum.

Brown, Roediger & McDaniel: Make It Stick: The Science of Successful Learning ↗ compared_alternative [Publisher copyright (Harvard University Press)]

Strong trade-book synthesis of the same evidence base; the peer-reviewed review is preferred for citation precision and technique-by-technique utility ratings.

02 120 分鐘

選定 Agent 的限定範圍任務與權限審查

Agent 輔助工程檢查 — 須宣告所選軌道、權限和審查邊界;Agent 的產出不構成獨立證據。若無已授權的工具可用,須將實作部分標記為「受阻 — 未執行」:下面的範例轉錄僅用於學習審查流程,不能計為真實 Agent 證據。

前置要求

完成 day-02-act-01。課程檔案中已選定一個 Agent 工具軌道。

學習目標

在宣告的權限、預算、上下文、審查和重試上限內,使用一個選定 Agent 完成限定範圍的練習。

操作指引

新建空目錄 agent-task-sandbox,並在前後各記錄一次 find . -type f(宣告的權限是約定,不是作業系統沙箱——範圍必須由你自行驗證)。把下面的提示詞原樣交給選定的 Agent。允許的操作:僅在 agent-task-sandbox 內建立檔案、執行所建立的檔案一次。禁止事項:在沙箱外寫入、git 提交、存取網路、安裝套件、讀取你的家目錄檔案。每次寫入前都必須經人工批准。預算:Agent 回合或重試最多 3 次;停止條件:成果物已驗證、預算耗盡、或發生任何越界操作(此時中止並記錄違規)。完成後填寫審查清單並與證據一起保存。

自主實作與記錄

交給選定 Agent 的準確提示詞:

「在目錄 agent-task-sandbox(絕對路徑:<貼上你的沙箱路徑>)中建立檔案 hello.py,使其在 python3 hello.py 執行時輸出 day 02。不要建立或修改任何其他內容。不要使用網路或安裝套件。建立檔案並執行一次後即停止。」

預期成果物:agent-task-sandbox/hello.py 和你自己撰寫的 review.md。

審查清單(在 review.md 中逐項作答):
- 沙箱內的 find . -type f 只顯示 hello.py(無多餘檔案)
- 檔案內容只做被要求的事
- python3 hello.py 輸出 day 02
- 所有寫入都發生在沙箱內且在你批准之後
- 轉錄顯示 Agent 在 3 回合預算內停止

獨立掌握標準

滿足以下全部即通過:(a) 在 Agent 執行前宣告了限定提示詞、權限清單、3 回合預算和停止條件;(b) 學習者用獨立的 `find`/`cat`/執行檢查驗證了成果物和範圍,而非採信 Agent 自己的聲稱;(c) 記錄了清單結論。要麼按上述方式完成並驗證實作,要麼如實將實作部分標記為受阻/未執行並在帶標籤範例上演示清單流程。把範例或 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 All Rights Reserved (personal research blog) Prose is linked, not copied; the curriculum uses its own bounded-agent implementation

LLM Powered Autonomous Agents

作者 / 機構: Lilian Weng | 原始出處連結 ↗

對應章節 / 時間戳: Sections: planning, memory, tool use, challenges

驗證版本與日期: Blog post June 23, 2023 (Verified: 2026-10-30)

入選理由:

Widely used survey mapping agent architecture components (planning, memory, tools) and their failure modes; supports the capstone integration architecture review.

來源前置條件:

Agent loops, tool use, and planning vocabulary.

安全回退方案(離線彈性):

The capstone architecture lesson specifies the adapter boundary, budgets, and tool contracts directly; no blog content is required offline.

對比候選資源與選型分析 (2)
Significant Gravitas: AutoGPT repository ↗ compared_alternative [MIT License (outside autogpt_platform/); Polyform Shield License (autogpt_platform/)]

Open-ended autonomous loop; deliberately excluded as the capstone must remain a bounded, evaluable system.

Yohei Nakajima: BabyAGI repository ↗ compared_alternative [MIT License]

Task-list autonomy demo; the survey article gives vocabulary while the capstone keeps fixed tasks and budgets.

03 120 分鐘

獨立終端/檔案系統檢查

獨立掌握檢查 — 評量作業期間不得使用 AI 輔助。若接受任何輔助必須如實申報,但接受輔助的作業只計為補救練習:在聲稱掌握之前,必須完成一次新的無輔助檢查。

前置要求

完成 day-02-act-02。評量路徑需要 Bash;已驗證的執行範圍是 Linux Bash。

學習目標

在無 AI 輔助的情況下獨立建立並檢查目錄和檔案,然後用終端命令驗證成果物。

操作指引

在執行每個檢查之前先預測輸出,然後記錄觀察到的輸出。所有工作都在新建的一次性 fs-sandbox 目錄內進行:不在家目錄或任何現有專案中建立內容,不讀取真實使用者檔案,也不假定存在任何先前的倉庫狀態。請在 Bash 中執行評量命令序列——程式碼區塊及其印出的 rm -r -- 行使用 Bash 的 %q 引用,實際執行範圍為 Linux Bash;zsh、dash 與 Windows PowerShell/cmd 等價命令僅為未執行的參考資訊。 該序列在受控的失敗即停子 shell 中執行:先用 mktemp 新建私有根目錄並驗證,mkdir 或 cd 失敗會在任何寫入之前中止——設定失敗絕不會寫入當前目錄。程式碼區塊末尾會印出一條字面的 rm -r -- <private-root> 清理命令(Bash %q 引用),它只指向本次建立的私有根目錄;僅在想刪除該目錄時才執行它。 請在 Bash 中執行該程式碼區塊;實際執行範圍為 Linux Bash,zsh/dash/Windows 未執行。

自主實作與記錄

把下面整個程式碼區塊(作為一整塊)貼到新的 Bash shell 中執行,在每個 pwd、find、cat、ls、wc 之前寫下預測。若設定失敗,子 shell 會中止,當前目錄不會被寫入任何內容。末尾會印出一條只指向所建立根目錄的字面 rm -r -- <private-root> 清理命令;僅在想刪除時才執行:

(
set -e
SBX_ROOT=$(mktemp -d "${TMPDIR:-/tmp}/d02sbx.XXXXXX")
[ -n "$SBX_ROOT" ]
[ -d "$SBX_ROOT" ]
[ -w "$SBX_ROOT" ]
[ -x "$SBX_ROOT" ]
mkdir "$SBX_ROOT/fs-sandbox"
cd "$SBX_ROOT/fs-sandbox"
pwd
mkdir -p notes/drafts
printf 'first note\n' > notes/todo.txt
printf 'idea one\nidea two\n' > notes/drafts/ideas.txt
find . -type f | sort
cat notes/todo.txt
cd notes && pwd && ls && cd ..
wc -l notes/drafts/ideas.txt
printf 'rm -r -- %q\n' "$SBX_ROOT"
)

對每個檢查記錄:預測輸出、觀察輸出,以及檔案系統狀態(路徑、檔案內容、當前目錄)是否與你的心理模型一致。

獨立掌握標準

在無輔助條件下滿足以下全部即通過:(a) 每個 `pwd`/`find`/`cat`/`ls`/`wc` 的預測都在執行前寫下,且所有觀察輸出均已記錄;(b) 所有成果物僅建立於 `fs-sandbox` 內並用指定命令驗證;(c) 任何預測錯誤都附有修正後的假設記錄。輔助只計為補救練習,在聲稱掌握之前必須完成一次新的無輔助檢查。

權威來源資源與權利證明

linking PSF License Version 2

Python Standard Library: pathlib

作者 / 機構: Python Software Foundation | 原始出處連結 ↗

對應章節 / 時間戳: Path.exists, Path.cwd, and anchoring paths to __file__

驗證版本與日期: Python 3.12 (Verified: 2026-10-30)

入選理由:

Normative reference for the exists()/cwd() evidence that separates an absent file from a wrong working directory.

來源前置條件:

Basic Python syntax from Study Days 01-09

安全回退方案(離線彈性):

Path.exists() and Path.cwd() are exercised directly in the local drill, so no online page is required.

對比候選資源與選型分析 (2)
os.path documentation ↗ compared_alternative [PSF License Version 2]

Functionally equivalent for exists() checks; pathlib keeps the beginner syntax object-oriented and consistent across the block.

shutil — High-level file operations ↗ compared_alternative [PSF License Version 2]

Covers copying and moving whole trees rather than path modeling; pathlib remains the right reference for the filesystem checks these days rehearse.

linking PSF License Version 2

Python Standard Library: tempfile

作者 / 機構: Python Software Foundation | 原始出處連結 ↗

對應章節 / 時間戳: TemporaryDirectory for disposable on-disk fixtures

驗證版本與日期: Python 3.12 (Verified: 2026-10-30)

入選理由:

Normative reference for creating and auto-removing fixture files inside tests without touching real user files.

來源前置條件:

Basic Python syntax from Study Days 01-09

安全回退方案(離線彈性):

TemporaryDirectory is part of the installed standard library and needs no page access.

對比候選資源與選型分析 (2)
pytest tmp_path fixture ↗ compared_alternative [MIT]

Equivalent capability scoped to the pytest runner; deferred until the curriculum adopts pytest.

io — Core tools for working with streams ↗ compared_alternative [PSF License Version 2]

Lower-level file-object interface without automatic cleanup semantics; tempfile was selected for the safe scratch-file pattern the drills require.

04 120 分鐘

預測-實驗-複盤與提取回憶

獨立掌握檢查 — 評量作業期間不得使用 AI 輔助。若接受任何輔助必須如實申報,但接受輔助的作業只計為補救練習:在聲稱掌握之前,必須完成一次新的無輔助檢查。

前置要求

完成 day-02-act-03,以及你自己記錄的第 01–02 學習日誌。

學習目標

提取三天方法的記憶,將證據與掌握標準對比,並為每個遺漏概念安排補救。

操作指引

按可區分的階段進行:(1) 不查資料回憶 — 不看任何筆記,寫出你記得的第 01–02 學習日證據(追蹤器輸出、venv 不變量、git 狀態轉換、strip/MRE 結果);(2) 與證據對比 — 打開你自己的記錄日誌,逐行對比回憶值與記錄值;把每個概念標記為已驗證或遺漏,並在不覆蓋回憶內容的前提下註釋更正;(3) 新的無輔助遷移 — 無輔助預測一個新程式碼片段的輸出,執行並記錄結果;(4) 為每個遺漏項安排帶日期的補救或下一次檢查。

自主實作與記錄

不查資料列出第 01–02 學習日的概念,以及你記得的每個概念的證據值(例如 a is c 的求值結果;sys.prefix != sys.base_prefix 的含義;git 狀態順序)。然後與你的書面記錄對比——不要重新執行舊命令。對每個概念,用實際記錄值標記已驗證或遺漏。如果沒有遺漏,明確說明,並帶證據駁斥一個常見的似是而非的誤解(例如「賦值會複製串列」),然後仍須完成新的遷移檢查:無輔助預測

d = {'a': 1}
e = d
e['b'] = 2
print(d, d is e)

的輸出,執行並記錄結果,再安排一次帶日期的下一次檢查。

獨立掌握標準

日誌滿足以下全部即通過:(a) 回憶在任何核對之前寫下,並與對比階段明確分離;(b) 至少兩個第 01–02 學習日概念各自與實際記錄值進行了對比;(c) 記錄了真實的不一致及其更正,或明確寫出「未發現遺漏」並帶證據駁斥一個常見誤解;(d) 有新的無輔助遷移預測及其觀察結果;(e) 每個遺漏項都有帶日期的下次檢查或補救步驟。輔助只計為補救練習,在聲稱掌握之前必須完成一次新的無輔助檢查。

權威來源資源與權利證明

linking Journal publisher copyright (all rights reserved) - lawful external linking only

Test-Enhanced Learning: Taking Memory Tests Improves Long-Term Retention

作者 / 機構: Henry L. Roediger III, Jeffrey D. Karpicke | 原始出處連結 ↗

對應章節 / 時間戳: Psychological Science 17(3): 249-255, Experiments 1-2

驗證版本與日期: Psychological Science, 2006 (Verified: 2026-10-30)

入選理由:

Foundational experimental evidence that retrieval practice (testing) outperforms repeated study for long-term retention; grounds the Day 88 AI-free retrieval checks in peer-reviewed learning science rather than folk advice.

來源前置條件:

Basic understanding of study sessions, retention intervals, and experimental design vocabulary.

安全回退方案(離線彈性):

The curriculum restates the experimental design and effect sizes in original prose; every sealed task runs without the paper.

對比候選資源與選型分析 (2)

Strong meta-analytic coverage of spacing effects but addresses scheduling rather than the retrieval effect itself; retained as support for the Day 90 spaced-review schedule.

Equally foundational follow-up demonstrating repeated retrieval vs repeated study; the 2006 paper is cited as the standard first controlled demonstration.

linking Journal publisher copyright (all rights reserved) - lawful external linking only

Improving Students' Learning With Effective Learning Techniques: Promising Directions From Cognitive and Educational Psychology

作者 / 機構: John Dunlosky, Katherine A. Rawson, Elizabeth J. Marsh, Mitchell J. Nathan, Daniel T. Willingham | 原始出處連結 ↗

對應章節 / 時間戳: Psychological Science in the Public Interest 14(1): 4-58; practice testing and distributed practice sections

驗證版本與日期: Psychological Science in the Public Interest, 2013 (Verified: 2026-10-30)

入選理由:

Detailed comparative review rating practice testing and distributed practice as high-utility techniques while rating highlighting and rereading low-utility; anchors the retrieval, correction, and spaced-review design of Days 88-90.

來源前置條件:

None beyond general academic reading.

安全回退方案(離線彈性):

Curriculum restates the utility ratings and application conditions in original prose; every task remains runnable offline.

對比候選資源與選型分析 (2)
Pashler et al. Learning Styles: Concepts and Evidence ↗ compared_alternative [Publisher copyright (originally Wiley; now SAGE Publications)]

Important negative result on learning-styles matching but narrower scope; Dunlosky et al. rates a broader set of techniques directly usable for this curriculum.

Brown, Roediger & McDaniel: Make It Stick: The Science of Successful Learning ↗ compared_alternative [Publisher copyright (Harvard University Press)]

Strong trade-book synthesis of the same evidence base; the peer-reviewed review is preferred for citation precision and technique-by-technique utility ratings.