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 分钟

选定智能体的限定范围任务与权限审查

智能体辅助工程检查 — 须声明所选轨道、权限和审查边界;智能体的输出不构成独立证据。若无已授权的工具可用,须将实操部分标记为"受阻 — 未执行":下面的示例转录仅用于学习审查流程,不能计为真实智能体证据。

前置要求

完成 day-02-act-01。课程档案中已选定一个智能体工具轨道。

学习目标

在声明的权限、预算、上下文、审查和重试上限内,使用一个选定智能体完成限定范围的练习。

操作指引

新建空目录 agent-task-sandbox,并在前后各记录一次 find . -type f(声明的权限是约定,不是操作系统沙箱——范围必须由你自行验证)。把下面的提示词原样交给选定的智能体。允许的操作:仅在 agent-task-sandbox 内创建文件、运行所创建的文件一次。禁止事项:在沙箱外写入、git 提交、访问网络、安装软件包、读取你的主目录文件。每次写入前都必须经人工批准。预算:智能体轮次或重试最多 3 次;停止条件:成果物已验证、预算耗尽、或发生任何越界操作(此时中止并记录违规)。完成后填写审查清单并与证据一起保存。

自主演练与记录

交给选定智能体的准确提示词:

"在目录 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
- 所有写入都发生在沙箱内且在你批准之后
- 转录显示智能体在 3 轮预算内停止

独立掌握标准

满足以下全部即通过:(a) 在智能体运行前声明了限定提示词、权限清单、3 轮预算和停止条件;(b) 学习者用独立的 `find`/`cat`/运行检查验证了成果物和范围,而非采信智能体自己的声称;(c) 记录了清单结论。要么按上述方式完成并验证实操,要么如实将实操部分标记为受阻/未执行并在带标签示例上演示清单流程。把示例或智能体声称当作真实证据出示即不通过。

权威源资源与权利证明

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.