Harness engineering beginner tutorial, from 0 to 1
TypeScript agentagenticagentic-aiaiai-agentai-agentsdshdsh-pluginharnessharness-engineeringharness-frameworkllm
Add bilingual resource library and starter templates
sanbuphy4148f9808d72
diff --git a/.vitepress/config.mts b/.vitepress/config.mtsindex a131285..00cce2c 100644--- a/.vitepress/config.mts+++ b/.vitepress/config.mts@@ -24,6 +24,16 @@ const projectItems = [{ text: "Project 06", link: "/projects/project-06-runtime-observability-and-debugging/" }];+const resourceItems = [+ { text: "Overview", link: "/resources/" },+ { text: "中文总览", link: "/resources/zh/" },+ { text: "中文模板", link: "/resources/zh/templates/" },+ { text: "中文参考", link: "/resources/zh/reference/" },+ { text: "English Overview", link: "/resources/en/" },+ { text: "English Templates", link: "/resources/en/templates/" },+ { text: "English Reference", link: "/resources/en/reference/" }+];+export default defineConfig({title: "Learn Harness Engineering",description:@@ -34,7 +44,8 @@ export default defineConfig({nav: [{ text: "Course Home", link: "/" },{ text: "Lectures", link: lectureItems[0].link },- { text: "Projects", link: projectItems[0].link }+ { text: "Projects", link: projectItems[0].link },+ { text: "Library", link: resourceItems[0].link }],search: {provider: "local"@@ -47,6 +58,10 @@ export default defineConfig({{text: "Projects",items: projectItems+ },+ {+ text: "Resource Library",+ items: resourceItems}],outline: {diff --git a/README-CN.md b/README-CN.mdnew file mode 100644index 0000000..c29a1c6--- /dev/null+++ b/README-CN.md@@ -0,0 +1,246 @@+# Learn Harness Engineering++> 这是一门项目制课程:系统学习如何通过环境、状态、验证与控制机制,让 Codex 和 Claude Code 更可靠地工作。++[English Version](./README.md)++本课程仍在持续建设中,内容后续可能会调整。++## 课程概览++Harness engineering 指的是:围绕模型搭建一整套工作环境,让它干活更靠谱。这不只是写提示词,还包括:++- 代码放哪、怎么组织+- 什么能干、什么干不了+- 任务做到哪了、下次怎么接上+- 做完怎么验证对不对+- 出了问题怎么排查+- 哪些规矩必须遵守+- 怎么保持干净、不留烂摊子++这门课是**强实践导向**的。我们不会只停留在"概念解释",而是会让 Codex 或 Claude Code 在同一个不断演化的 Electron 应用上反复工作,并比较弱 harness 与强 harness 的差异。++课程真正关心的问题是:++- 哪些 harness 设计会提升任务完成率?+- 哪些设计会减少返工和错误完成?+- 哪些机制能让长时任务更稳定地持续推进?+- 哪些结构能让系统在多轮 agent 运行后仍然可维护?++## 核心观点++以后让模型干活,人只需要定好规则和边界——这就是 harness。++**这事的关键:** 模型很强,但不代表它能自动靠谱地完成真实工程任务。它需要一套明确的规则来约束自己的行为范围、需要清晰的交接机制来维持长时任务的连续性、需要验证手段来确认自己做对了。++我们不是在尝试"让模型本身更聪明",而是研究:怎么给模型搭建一个靠谱的工作环境,让同一个模型做出更可靠的工作。++## 快速开始++不用读完 12 个讲义再动手。如果你已经在用 coding agent 做项目,下面这些能立刻改善效果。++思路很简单:不是光写提示词,而是在仓库里放一组结构化的文件——告诉 agent 该做什么、做完了什么、怎么验证。这些文件就放在项目里,每次会话都从同一个状态开始。++**第一步.** 把根指令文件复制到项目根目录:++- [`AGENTS.md`](./resources/zh/templates/AGENTS.md) 通用版,或者 [`CLAUDE.md`](./resources/zh/templates/CLAUDE.md) 如果你用 Claude Code+- 把里面的命令、路径和规则换成你自己项目的++**第二步.** 把启动脚本复制进去:++- [`init.sh`](./resources/zh/templates/init.sh) —— 一条命令完成依赖安装、验证和启动+- 把 `INSTALL_CMD`、`VERIFY_CMD`、`START_CMD` 换成你自己的++**第三步.** 把进度日志复制进去:++- [`claude-progress.md`](./resources/zh/templates/claude-progress.md) —— 每轮会话记录做了什么、验证了什么、下一步是什么+- agent 每次开工会先读这个文件,从上次停下的地方继续++**第四步.** 把功能清单复制进去:++- [`feature_list.json`](./resources/zh/templates/feature_list.json) —— 机器可读的功能列表,每个功能有状态、验证步骤和证据+- 把示例功能换成你自己的++四个文件,最小起步就够了。比光靠一段提示词稳定得多。++等项目变复杂了,再补这些:++- [`session-handoff.md`](./resources/zh/templates/session-handoff.md) —— 会话之间的交接摘要+- [`clean-state-checklist.md`](./resources/zh/templates/clean-state-checklist.md) —— 每次会话结束前的清理清单+- [`evaluator-rubric.md`](./resources/zh/templates/evaluator-rubric.md) —— 评审 agent 产出质量的评分表++每个文件的详细用法写在 [中文模板指南](./resources/zh/templates/README.md)。英文版见 [English template guide](./resources/en/templates/README.md)。++## 课程大纲++### 讲义++- [Lecture 01. 模型能力强,不等于执行可靠](./lectures/lecture-01-why-capable-agents-still-fail/README.md)+- [Lecture 02. Harness 的定义](./lectures/lecture-02-what-a-harness-actually-is/README.md)+- [Lecture 03. 让代码仓库成为唯一的事实来源](./lectures/lecture-03-why-the-repository-must-become-the-system-of-record/README.md)+- [Lecture 04. 把指令拆分到不同文件里](./lectures/lecture-04-why-one-giant-instruction-file-fails/README.md)+- [Lecture 05. 让跨会话的任务保持上下文连续](./lectures/lecture-05-why-long-running-tasks-lose-continuity/README.md)+- [Lecture 06. 让 agent 每次工作前先初始化](./lectures/lecture-06-why-initialization-needs-its-own-phase/README.md)+- [Lecture 07. 给 agent 划清每次任务的边界](./lectures/lecture-07-why-agents-overreach-and-under-finish/README.md)+- [Lecture 08. 用功能清单约束 agent 该做什么](./lectures/lecture-08-why-feature-lists-are-harness-primitives/README.md)+- [Lecture 09. 防止 agent 提前宣告完成](./lectures/lecture-09-why-agents-declare-victory-too-early/README.md)+- [Lecture 10. 跑通完整流程才算真正验证](./lectures/lecture-10-why-end-to-end-testing-changes-results/README.md)+- [Lecture 11. 让 agent 的运行过程可观测](./lectures/lecture-11-why-observability-belongs-inside-the-harness/README.md)+- [Lecture 12. 每次会话结束前都做好交接](./lectures/lecture-12-why-every-session-must-leave-a-clean-state/README.md)++### 项目++- [Project 01. 只写提示词让 agent 做,和定好规则再让它做,差多少](./projects/project-01-baseline-vs-minimal-harness/README.md)+- [Project 02. 让 agent 看懂项目、接住上次的工作](./projects/project-02-agent-readable-workspace/README.md)+- [Project 03. 让 agent 关掉再打开还能接着干](./projects/project-03-multi-session-continuity/README.md)+- [Project 04. 用运行反馈修正 agent 的行为](./projects/project-04-incremental-indexing/README.md)+- [Project 05. 让 agent 自己检查自己做的对不对](./projects/project-05-grounded-qa-verification/README.md)+- [Project 06. 搭建一套完整的 agent 工作环境](./projects/project-06-runtime-observability-and-debugging/README.md)++### 资料库++- [Resource Library 总览](./resources/README.md)+- [中文资料库](./resources/zh/README.md)+- [English Resource Library](./resources/en/README.md)++## 学习路径推荐++这门课按顺序来效果最好,每一阶段都建立在前一个的基础上。++**第一阶段 — 先看到问题。** 读 Lecture 01-02,做 Project 01。你会跑两次同样的任务:一次只给提示词,一次加了最基本的规则。差距一目了然。++**第二阶段 — 让项目对 agent 友好。** Lecture 03-04,Project 02。你会重组项目结构,让 agent 能读懂,并且加上跨会话的持久文件。++**第三阶段 — 让会话接得上。** Lecture 05-06,Project 03。这里开始有意思了——让 agent 在你关掉会话后重新打开,还能从上次停下的地方接着干。++**第四阶段 — 加上反馈和范围控制。** Lecture 07-08,Project 04。防止 agent 做多了或做少了,用运行反馈让它保持在正轨上。++**第五阶段 — 验证和自查。** Lecture 09-10,Project 05。让 agent 学会验证自己的工作,而不是做完就说"好了"。++**第六阶段 — 全部串起来。** Lecture 11-12,Project 06。这是 capstone。你将从零开始搭建一套完整的 harness,把前面学的全用上。++每个阶段大约一周(兼职节奏)。想快的话,前三个阶段一个周末就能跑完。++## 适合谁++这门课适合:++- 已经在使用 coding agent、希望提升稳定性和质量的工程师+- 想系统理解 harness 设计的研究者或构建者+- 需要理解"环境设计如何影响 agent 表现"的技术负责人++这门课不适合:++- 只想要一个零代码 AI 入门的人+- 只关心 prompt,而不打算做真实实现的人+- 不准备让 agent 在真实仓库里工作的学习者++## 环境要求++这是一门真正需要动手跑 coding agent 的课程。++你至少需要具备一个这类工具:++- Claude Code+- Codex+- 其他支持文件编辑、命令执行、多步任务的 IDE / CLI coding agent++课程默认你可以:++- 打开本地仓库+- 允许 agent 编辑文件+- 允许 agent 运行命令+- 检查输出并重复执行任务++如果你没有这类工具,仍然可以阅读课程内容,但无法按预期完成课程 project。++## 本地预览++本仓库使用 VitePress 作为文档查看器。++```sh+npm install+npm run docs:dev+```++然后在浏览器里打开 VitePress 输出的本地地址即可。++## 先修要求++必需:++- 熟悉终端、git 和本地开发环境+- 至少会读写一种常见应用栈中的代码+- 有基本的软件调试经验,知道如何看日志、测试和运行行为+- 能投入足够时间完成偏实现型的课程任务++有帮助但非强制:++- 用过 Electron、桌面应用或本地优先工具+- 有测试、日志、软件架构方面的经验+- 已经接触过 Codex、Claude Code 或类似 coding agent++## 核心参考资料++主参考:++- [OpenAI: Harness engineering: leveraging Codex in an agent-first world](https://openai.com/index/harness-engineering/)+- [Anthropic: Effective harnesses for long-running agents](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents)+- [Anthropic: Harness design for long-running application development](https://www.anthropic.com/engineering/harness-design-long-running-apps)++辅助参考:++- [LangChain: The Anatomy of an Agent Harness](https://blog.langchain.com/the-anatomy-of-an-agent-harness/)+- [Thoughtworks: Harness Engineering](https://martinfowler.com/articles/exploring-gen-ai/harness-engineering.html)+- [HumanLayer: Skill Issue: Harness Engineering for Coding Agents](https://www.humanlayer.dev/blog/skill-issue-harness-engineering-for-coding-agents)++## 贯穿项目++本课程的大多数 project 都围绕同一个产品展开:++- 一个基于 Electron 的个人知识库桌面应用++核心目标包括:++- 导入本地文档+- 管理文档库+- 处理与索引文档+- 对导入内容发起 AI 问答+- 返回带引用的 grounded 回答++之所以选择这个项目,是因为它同时具备:++- 很强的实际价值感+- 足够真实的产品复杂度+- 很适合观察 harness 优化前后的效果差异++## 课程作业形式++本课程包含两类内容:++- **Lectures**:12 个概念单元,每个单元只回答一个核心问题+- **Projects**:6 个实践项目,把 lecture 里的方法落实到同一个 Electron 应用上++每个 project 都要求你:++- 让 Codex 或 Claude Code 执行真实任务+- 比较弱 harness 与强 harness 的差别+- 观察可靠性、连续性、验证质量、可维护性的变化++最后一个 project 同时也是整个课程的 capstone harness。++## 课程组织方式++- 每个 lecture 聚焦一个问题+- 整门课配套 6 个 project+- 每个 project 都要求 agent 真正干活+- 每个 project 都要做弱 harness / 强 harness 对照+- 我们关心的是效果变化,而不是"写了多少说明文档"++## 仓库结构++- `lectures/` - 全部讲义+- `projects/` - 全部实践项目,包括 capstone+- `resources/` - 中英双语的可复用模板、检查清单和方法参考++每个 lecture 都带一个 `code/` 目录,用来放小型真实示例和 supporting artifacts。diff --git a/README.md b/README.mdindex 6e579a6..514574b 100644--- a/README.md+++ b/README.md@@ -1,95 +1,186 @@# Learn Harness Engineering-> A project-based course on designing the environments, state, verification, and control systems that make Codex and Claude Code reliable.+> A project-based course on building the environment, state management, verification, and control mechanisms that make Codex and Claude Code work more reliably.-This course is under active construction, and contents are subject to change.+This course is a work in progress. Content may change as it evolves.-## Course Overview+[中文版本](./README-CN.md)-Harness engineering is the practice of building the environment around a model-so that it can do useful, reliable, long-running work. That environment-includes repository knowledge, tool surfaces, working-state artifacts,-verification loops, observability, structural constraints, and maintenance-mechanisms.+## Overview-This course is implementation-heavy. Instead of studying harnesses only as-theory, students will repeatedly use Codex or Claude Code on the same evolving-Electron application and compare weaker harnesses against stronger ones. The-goal is not to admire agent output in isolation, but to understand which-harness decisions produce better task completion, better recovery, and better-long-term maintainability.+Harness engineering is about building a complete working environment around the model so it produces reliable results. It's not just about writing prompts. It also covers:-## Course Premise+- Where code lives and how it's organized+- What the agent is and isn't allowed to do+- How to track task progress and pick up where you left off+- How to verify that work was done correctly+- How to diagnose problems when they arise+- What rules must always be followed+- How to leave things clean after each session-This course starts from a simple idea:+This course is **hands-on**. We won't stop at concepts. You'll have Codex or Claude Code work repeatedly on the same evolving Electron application, comparing weak harnesses against strong ones.-**Strong models still fail when the harness around them is weak.**+The questions this course actually cares about:-We are not trying to make the model smarter. We are trying to make the same-model work better by improving what surrounds it.+- Which harness designs improve task completion rates?+- Which designs reduce rework and incorrect completions?+- Which mechanisms keep long-running tasks progressing steadily?+- Which structures keep the system maintainable after multiple agent runs?-## Who This Course Is For+## Core Thesis++When you let models do work, the human's job is to define the rules and boundaries. That's the harness.++**The key point:** Models are powerful, but that doesn't mean they can reliably complete real engineering tasks on their own. They need explicit rules to constrain their scope, clear handoff mechanisms to maintain continuity across long tasks, and verification methods to confirm they did the work correctly.++We're not trying to "make the model smarter." We're studying how to build a reliable working environment around the model so the same model produces more reliable output.++## Quick Start++You don't need to read all 12 lectures before you start getting value from this course. If you're already using a coding agent on a real project, here's how to improve it right now.++The idea is simple: instead of just writing prompts, give your agent a set of structured files that define what to do, what's been done, and how to verify the work. These files live inside your repo, so every session starts from the same state.++**Step 1.** Copy the root instruction file into your project root:++- [`AGENTS.md`](./resources/en/templates/AGENTS.md) for most agents, or [`CLAUDE.md`](./resources/en/templates/CLAUDE.md) if you're using Claude Code+- Edit the commands, paths, and rules to match your project++**Step 2.** Copy the startup script:++- [`init.sh`](./resources/en/templates/init.sh) — runs dependency install, verification, and startup in one shot+- Replace the `INSTALL_CMD`, `VERIFY_CMD`, and `START_CMD` with your actual commands++**Step 3.** Copy the progress log:++- [`claude-progress.md`](./resources/en/templates/claude-progress.md) — records what was done each session, what's verified, and what's next+- The agent reads this at the start of every session to pick up where it left off++**Step 4.** Copy the feature list:++- [`feature_list.json`](./resources/en/templates/feature_list.json) — a machine-readable list of features with status, verification steps, and evidence+- Replace the example features with your own++That's it for the minimum setup. Four files, and your agent sessions will already be more stable than running on prompts alone.++When your project gets more complex, add these:++- [`session-handoff.md`](./resources/en/templates/session-handoff.md) — compact handoff note between sessions+- [`clean-state-checklist.md`](./resources/en/templates/clean-state-checklist.md) — checklist to run before ending each session+- [`evaluator-rubric.md`](./resources/en/templates/evaluator-rubric.md) — scorecard for reviewing agent output quality++Each file has detailed usage instructions in the [English template guide](./resources/en/templates/README.md). Chinese versions are available in [中文模板指南](./resources/zh/templates/README.md).++## Syllabus++### Lectures++- [Lecture 01. Strong models don't mean reliable execution](./lectures/lecture-01-why-capable-agents-still-fail/README.md)+- [Lecture 02. What harness actually means](./lectures/lecture-02-what-a-harness-actually-is/README.md)+- [Lecture 03. Make the repository your single source of truth](./lectures/lecture-03-why-the-repository-must-become-the-system-of-record/README.md)+- [Lecture 04. Split instructions across files, not one giant file](./lectures/lecture-04-why-one-giant-instruction-file-fails/README.md)+- [Lecture 05. Keep context alive across sessions](./lectures/lecture-05-why-long-running-tasks-lose-continuity/README.md)+- [Lecture 06. Initialize before every agent session](./lectures/lecture-06-why-initialization-needs-its-own-phase/README.md)+- [Lecture 07. Draw clear task boundaries for agents](./lectures/lecture-07-why-agents-overreach-and-under-finish/README.md)+- [Lecture 08. Use feature lists to constrain what the agent does](./lectures/lecture-08-why-feature-lists-are-harness-primitives/README.md)+- [Lecture 09. Stop agents from declaring victory early](./lectures/lecture-09-why-agents-declare-victory-too-early/README.md)+- [Lecture 10. Only a full-pipeline run counts as real verification](./lectures/lecture-10-why-end-to-end-testing-changes-results/README.md)+- [Lecture 11. Make the agent's runtime observable](./lectures/lecture-11-why-observability-belongs-inside-the-harness/README.md)+- [Lecture 12. Clean handoff at the end of every session](./lectures/lecture-12-why-every-session-must-leave-a-clean-state/README.md)++### Projects++- [Project 01. Prompt-only vs. rules-first: how much difference does it make](./projects/project-01-baseline-vs-minimal-harness/README.md)+- [Project 02. Make the project readable and pick up where you left off](./projects/project-02-agent-readable-workspace/README.md)+- [Project 03. Keep the agent working across session restarts](./projects/project-03-multi-session-continuity/README.md)+- [Project 04. Use runtime feedback to correct agent behavior](./projects/project-04-incremental-indexing/README.md)+- [Project 05. Make the agent verify its own work](./projects/project-05-grounded-qa-verification/README.md)+- [Project 06. Build a complete agent harness](./projects/project-06-runtime-observability-and-debugging/README.md)++### Resource Library++- [Resource Library Overview](./resources/README.md)+- [Chinese Resource Library](./resources/zh/README.md)+- [English Resource Library](./resources/en/README.md)++## Recommended Learning Path++This course is designed to be done in order. Each phase builds on the last.++**Phase 1 — See the problem.** Read lectures 1 and 2, then do project 1. You'll run the same task twice: once with just a prompt, once with a minimal harness. The difference will be obvious.++**Phase 2 — Make the repo work for the agent.** Lectures 3 and 4, project 2. You'll restructure the repo so the agent can read it, and add files that survive between sessions.++**Phase 3 — Keep sessions connected.** Lectures 5 and 6, project 3. This is where things get interesting — you'll make the agent pick up from where it left off, even after you close the session.++**Phase 4 — Add feedback and scope control.** Lectures 7 and 8, project 4. You'll stop the agent from doing too much or too little, and use runtime feedback to keep it on track.++**Phase 5 — Verification and self-check.** Lectures 9 and 10, project 5. The agent learns to verify its own work instead of just saying "done."++**Phase 6 — Put it all together.** Lectures 11 and 12, project 6. This is the capstone. You'll build a complete harness from scratch, using everything you've learned.++Each phase takes about a week if you're going part-time. If you want to go faster, phases 1-3 can be done in a long weekend.++## Who This Is ForThis course is for:-- engineers who already use coding agents and want better reliability-- researchers or builders who want a concrete mental model of harness design-- technical leads who want to understand how environment design changes agent- behavior+- Engineers already using coding agents who want better stability and quality+- Researchers or builders who want a systematic understanding of harness design+- Tech leads who need to understand how environment design affects agent performanceThis course is not for:-- readers looking for a no-code introduction to AI-- people who want a prompt-only workflow without hands-on implementation-- learners who do not plan to run a coding agent against a real repository+- People looking for a zero-code AI introduction+- People who only care about prompts and don't plan to build real implementations+- Learners not prepared to let agents work inside real repositories-## Required Setup+## Requirements-This is a hands-on course for people who can actually run a coding agent against-real projects.+This is a course where you actually run coding agents.-You should have access to at least one coding tool such as:+You need at least one of these tools:- Claude Code- Codex-- Another IDE or CLI coding agent with file editing, shell execution, and- multi-step task support+- Another IDE or CLI coding agent that supports file editing, command execution, and multi-step tasksThe course assumes you can:-- open a local repository-- let an agent edit files-- let an agent run commands-- inspect outputs and rerun tasks+- Open a local repository+- Allow the agent to edit files+- Allow the agent to run commands+- Inspect output and re-run tasks-Without an IDE or CLI coding agent, you can still read the course, but you will-not be able to complete the practical projects as intended.+If you don't have such a tool, you can still read the course content, but you won't be able to complete the projects as intended.-## Quick Start+## Local Preview-This repository uses VitePress as its document launcher.+This repository uses VitePress as a documentation viewer.```shnpm installnpm run docs:dev```-Then open the local URL printed by VitePress in your browser.+Then open the local URL that VitePress outputs in your browser.## Prerequisites-- Comfort using the terminal, git, and local development environments-- Ability to read and modify application code in at least one common stack-- Some experience debugging software using logs, tests, and runtime behavior-- Enough time for hands-on implementation work+Required:-Helpful but not strictly required:+- Familiarity with the terminal, git, and local development environments+- Ability to read and write code in at least one common application stack+- Basic software debugging experience (reading logs, tests, and runtime behavior)+- Enough time to commit to implementation-focused coursework-- Prior experience with Electron, desktop apps, or local-first tools-- Prior experience with testing, logging, and software architecture-- Prior use of Codex, Claude Code, or similar coding agents+Helpful but not required:-## Core Sources+- Experience with Electron, desktop apps, or local-first tools+- Background in testing, logging, or software architecture+- Prior exposure to Codex, Claude Code, or similar coding agents++## Core ReferencesPrimary:@@ -97,105 +188,59 @@ Primary:- [Anthropic: Effective harnesses for long-running agents](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents)- [Anthropic: Harness design for long-running application development](https://www.anthropic.com/engineering/harness-design-long-running-apps)-Supporting:+Supplementary:- [LangChain: The Anatomy of an Agent Harness](https://blog.langchain.com/the-anatomy-of-an-agent-harness/)- [Thoughtworks: Harness Engineering](https://martinfowler.com/articles/exploring-gen-ai/harness-engineering.html)- [HumanLayer: Skill Issue: Harness Engineering for Coding Agents](https://www.humanlayer.dev/blog/skill-issue-harness-engineering-for-coding-agents)-## Running Project--Most studios in this course use the same product:--- A desktop personal knowledge base built with Electron--Core product goals:--- Import local documents-- Manage a document library-- Process and index documents-- Ask AI questions about the imported content-- Return source-grounded citations--This project is useful, product-shaped, and complex enough to make harness-improvements visible.--## Coursework+## Capstone Project-The course has two kinds of work:+Most projects in this course revolve around the same product:-- **Lectures**: 12 short conceptual units, each centered on one question-- **Projects**: 6 practical projects that apply those ideas to the same- evolving Electron knowledge app+- An Electron-based personal knowledge base desktop app-Each project asks students to:+Core goals include:-- run Codex or Claude Code on a real task-- compare a weaker harness against a stronger harness-- observe changes in reliability, continuity, verification, and maintainability+- Importing local documents+- Managing a document library+- Processing and indexing documents+- Running AI-powered Q&A over imported content+- Returning grounded answers with citations-The final project functions as the capstone harness for the course.+This project was chosen because it combines:-## How the Course Works+- Strong practical value+- Enough real-world product complexity+- A good setting for observing before/after harness improvements-- Each lecture focuses on one question.-- The course is paired with six practical projects.-- Every project uses Codex or Claude Code to do real work.-- Every project compares a weaker harness against a stronger harness.-- The point is to see performance differences, not just to write notes.+## Course Format-## Repository Layout+This course has two types of content:-- `lectures/` - All lecture notes-- `projects/` - All practical projects, including the capstone+- **Lectures**: 12 conceptual units, each answering one core question+- **Projects**: 6 hands-on projects that apply lecture methods to the same Electron app-Each lecture includes a `code/` folder for real examples and small supporting-artifacts.+Each project requires you to:-## Suggested Schedule+- Have Codex or Claude Code execute real tasks+- Compare weak vs. strong harnesses+- Observe changes in reliability, continuity, verification quality, and maintainability-This course works well as a six-unit sequence:+The final project also serves as the course's capstone harness.-- **Unit 1**: Lectures 01-02 + Project 01-- **Unit 2**: Lectures 03-04 + Project 02-- **Unit 3**: Lectures 05-06 + Project 03-- **Unit 4**: Lectures 07-08 + Project 04-- **Unit 5**: Lectures 09-10 + Project 05-- **Unit 6**: Lectures 11-12 + Project 06+## How the Course Is Organized-You can also study it at a slower pace by treating each unit as one week of-work.--## Course Map--### Lectures--- [Lecture 01. Why capable agents still fail](./lectures/lecture-01-why-capable-agents-still-fail/README.md)-- [Lecture 02. What a harness actually is](./lectures/lecture-02-what-a-harness-actually-is/README.md)-- [Lecture 03. Why the repository must become the system of record](./lectures/lecture-03-why-the-repository-must-become-the-system-of-record/README.md)-- [Lecture 04. Why one giant instruction file fails](./lectures/lecture-04-why-one-giant-instruction-file-fails/README.md)-- [Lecture 05. Why long-running tasks lose continuity](./lectures/lecture-05-why-long-running-tasks-lose-continuity/README.md)-- [Lecture 06. Why initialization needs its own phase](./lectures/lecture-06-why-initialization-needs-its-own-phase/README.md)-- [Lecture 07. Why scope must be made explicit](./lectures/lecture-07-why-agents-overreach-and-under-finish/README.md)-- [Lecture 08. Why verification must be externalized](./lectures/lecture-08-why-feature-lists-are-harness-primitives/README.md)-- [Lecture 09. Why runtime feedback belongs inside the harness](./lectures/lecture-09-why-agents-declare-victory-too-early/README.md)-- [Lecture 10. Why structure and taste must be enforced](./lectures/lecture-10-why-end-to-end-testing-changes-results/README.md)-- [Lecture 11. Why advanced harnesses split roles](./lectures/lecture-11-why-observability-belongs-inside-the-harness/README.md)-- [Lecture 12. Why harnesses must be measured and maintained over time](./lectures/lecture-12-why-every-session-must-leave-a-clean-state/README.md)--### Projects+- Each lecture focuses on one question+- The course includes 6 projects+- Every project requires the agent to do real work+- Every project compares weak vs. strong harness results+- What matters is the measured difference, not how many docs were written-- [Project 01. Baseline vs minimal harness](./projects/project-01-baseline-vs-minimal-harness/README.md)-- [Project 02. Agent-readable workspace and continuity scaffold](./projects/project-02-agent-readable-workspace/README.md)-- [Project 03. Scope control and grounded verification](./projects/project-03-multi-session-continuity/README.md)-- [Project 04. Runtime feedback and structural control](./projects/project-04-incremental-indexing/README.md)-- [Project 05. Evaluator loops and three-role upgrades](./projects/project-05-grounded-qa-verification/README.md)-- [Project 06. Benchmark, cleanup, and capstone harness](./projects/project-06-runtime-observability-and-debugging/README.md)+## Repository Structure-## How to Use This Repository+- `lectures/` - All lectures+- `projects/` - All hands-on projects, including the capstone+- `resources/` - Bilingual reusable templates, checklists, and method references-1. Read the course README to understand the overall structure.-2. Work through the lectures in order.-3. Use the six numbered projects as the practical track.-4. Keep small examples inside each lecture `code/` folder.-5. Use the final project as the capstone harness.+Each lecture includes a `code/` directory for small real-world examples and supporting artifacts.diff --git a/index.md b/index.mdnew file mode 100644index 0000000..af3a21a--- /dev/null+++ b/index.md@@ -0,0 +1,248 @@+# Learn Harness Engineering++> 这是一门项目制课程:系统学习如何通过环境、状态、验证与控制机制,让 Codex 和 Claude Code 更可靠地工作。++本课程仍在持续建设中,内容后续可能会调整。++## 课程概览++Harness engineering 指的是:围绕模型搭建一整套工作环境,让它干活更靠谱。这不只是写提示词,还包括:++- 代码放哪、怎么组织+- 什么能干、什么干不了+- 任务做到哪了、下次怎么接上+- 做完怎么验证对不对+- 出了问题怎么排查+- 哪些规矩必须遵守+- 怎么保持干净、不留烂摊子++这门课是**强实践导向**的。我们不会只停留在“概念解释”,而是会让 Codex 或 Claude Code 在同一个不断演化的 Electron 应用上反复工作,并比较弱 harness 与强 harness 的差异。++课程真正关心的问题是:++- 哪些 harness 设计会提升任务完成率?+- 哪些设计会减少返工和错误完成?+- 哪些机制能让长时任务更稳定地持续推进?+- 哪些结构能让系统在多轮 agent 运行后仍然可维护?++## 核心观点++以后让模型干活,人只需要定好规则和边界——这就是 harness。++**为什么这个重要:** 模型很强,但不代表它能自动靠谱地完成真实工程任务。它需要一套明确的规则来约束自己的行为范围、需要清晰的交接机制来维持长时任务的连续性、需要验证手段来确认自己做对了。++我们不是在尝试"让模型本身更聪明",而是研究:怎么给模型搭建一个靠谱的工作环境,让同一个模型做出更可靠的工作。++## 课程大纲++### 讲义++- [Lecture 01. 为什么强模型依然会失败](./lectures/lecture-01-why-capable-agents-still-fail/README.md)+- [Lecture 02. 什么才算 harness](./lectures/lecture-02-what-a-harness-actually-is/README.md)+- [Lecture 03. 为什么仓库必须成为 system of record](./lectures/lecture-03-why-the-repository-must-become-the-system-of-record/README.md)+- [Lecture 04. 为什么一个巨大的 instruction 文件会失败](./lectures/lecture-04-why-one-giant-instruction-file-fails/README.md)+- [Lecture 05. 为什么长时任务会失去连续性](./lectures/lecture-05-why-long-running-tasks-lose-continuity/README.md)+- [Lecture 06. 为什么初始化必须是独立阶段](./lectures/lecture-06-why-initialization-needs-its-own-phase/README.md)+- [Lecture 07. 为什么 scope 必须被显式化](./lectures/lecture-07-why-agents-overreach-and-under-finish/README.md)+- [Lecture 08. 为什么验证必须外部化](./lectures/lecture-08-why-feature-lists-are-harness-primitives/README.md)+- [Lecture 09. 为什么 runtime feedback 必须进入 harness](./lectures/lecture-09-why-agents-declare-victory-too-early/README.md)+- [Lecture 10. 为什么结构和 taste 必须被强制执行](./lectures/lecture-10-why-end-to-end-testing-changes-results/README.md)+- [Lecture 11. 为什么更强的 harness 会拆分角色](./lectures/lecture-11-why-observability-belongs-inside-the-harness/README.md)+- [Lecture 12. 为什么 harness 必须被持续度量和维护](./lectures/lecture-12-why-every-session-must-leave-a-clean-state/README.md)++### 项目++- [Project 01. 基线 vs 最小 harness](./projects/project-01-baseline-vs-minimal-harness/README.md)+- [Project 02. Agent-readable workspace 与 continuity scaffold](./projects/project-02-agent-readable-workspace/README.md)+- [Project 03. Scope control 与 grounded verification](./projects/project-03-multi-session-continuity/README.md)+- [Project 04. Runtime feedback 与 structural control](./projects/project-04-incremental-indexing/README.md)+- [Project 05. Evaluator loop 与三角色升级](./projects/project-05-grounded-qa-verification/README.md)+- [Project 06. Benchmark、cleanup 与 capstone harness](./projects/project-06-runtime-observability-and-debugging/README.md)++### 资料库++- [Resource Library 总览](./resources/README.md)+- [中文资料库](./resources/zh/README.md)+- [English Resource Library](./resources/en/README.md)++## 适合谁++这门课适合:++- 已经在使用 coding agent、希望提升稳定性和质量的工程师+- 想系统理解 harness 设计的研究者或构建者+- 需要理解“环境设计如何影响 agent 表现”的技术负责人++这门课不适合:++- 只想要一个零代码 AI 入门的人+- 只关心 prompt,而不打算做真实实现的人+- 不准备让 agent 在真实仓库里工作的学习者++## 环境要求++这是一门真正需要动手跑 coding agent 的课程。++你至少需要具备一个这类工具:++- Claude Code+- Codex+- 其他支持文件编辑、命令执行、多步任务的 IDE / CLI coding agent++课程默认你可以:++- 打开本地仓库+- 允许 agent 编辑文件+- 允许 agent 运行命令+- 检查输出并重复执行任务++如果你没有这类工具,仍然可以阅读课程内容,但无法按预期完成课程 project。++## 快速开始++OpenAI 和 Anthropic 这两条线,虽然写法不同,但都在探索同一件事:不是只改 prompt,而是给 coding agent 一套可持续工作的环境。核心做法包括把仓库变成 system of record、把任务状态外部化、把验证变成硬门槛、把每次会话的交接做成可复用的标准流程。++如果你想先上手,不必先把所有 lecture 读完。可以先去专门的资料库文件夹,直接参考这些文件,然后按自己的项目改一版。++中文版本:++- 入口:[`resources/zh/README.md`](./resources/zh/README.md)+- 根指令文件:[`resources/zh/templates/AGENTS.md`](./resources/zh/templates/AGENTS.md) 或 [`resources/zh/templates/CLAUDE.md`](./resources/zh/templates/CLAUDE.md)+- 功能状态文件:[`resources/zh/templates/feature_list.json`](./resources/zh/templates/feature_list.json)+- 进度记录文件:[`resources/zh/templates/claude-progress.md`](./resources/zh/templates/claude-progress.md)+- 会话交接文件:[`resources/zh/templates/session-handoff.md`](./resources/zh/templates/session-handoff.md)+- 收尾检查清单:[`resources/zh/templates/clean-state-checklist.md`](./resources/zh/templates/clean-state-checklist.md)+- 评审模板:[`resources/zh/templates/evaluator-rubric.md`](./resources/zh/templates/evaluator-rubric.md)+- 启动脚本参考:`resources/zh/templates/init.sh`++English version:++- Entry: [`resources/en/README.md`](./resources/en/README.md)+- Root instructions: [`resources/en/templates/AGENTS.md`](./resources/en/templates/AGENTS.md) or [`resources/en/templates/CLAUDE.md`](./resources/en/templates/CLAUDE.md)+- Feature state: [`resources/en/templates/feature_list.json`](./resources/en/templates/feature_list.json)+- Progress log: [`resources/en/templates/claude-progress.md`](./resources/en/templates/claude-progress.md)+- Session handoff: [`resources/en/templates/session-handoff.md`](./resources/en/templates/session-handoff.md)+- Clean-exit checklist: [`resources/en/templates/clean-state-checklist.md`](./resources/en/templates/clean-state-checklist.md)+- Evaluator rubric: [`resources/en/templates/evaluator-rubric.md`](./resources/en/templates/evaluator-rubric.md)+- Bootstrap script reference: `resources/en/templates/init.sh`++推荐最小起步组合:++- `AGENTS.md` 或 `CLAUDE.md`+- `feature_list.json`+- `claude-progress.md`+- `init.sh`++先把这四样放进你的项目里,再开始让 agent 真正干活,效果会比只写一段大 prompt 稳定得多。++## 本地预览++本仓库使用 VitePress 作为文档查看器。++```sh+npm install+npm run docs:dev+```++然后在浏览器里打开 VitePress 输出的本地地址即可。++## 先修要求++必需:++- 熟悉终端、git 和本地开发环境+- 至少会读写一种常见应用栈中的代码+- 有基本的软件调试经验,知道如何看日志、测试和运行行为+- 能投入足够时间完成偏实现型的课程任务++有帮助但非强制:++- 用过 Electron、桌面应用或本地优先工具+- 有测试、日志、软件架构方面的经验+- 已经接触过 Codex、Claude Code 或类似 coding agent++## 核心参考资料++主参考:++- [OpenAI: Harness engineering: leveraging Codex in an agent-first world](https://openai.com/index/harness-engineering/)+- [Anthropic: Effective harnesses for long-running agents](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents)+- [Anthropic: Harness design for long-running application development](https://www.anthropic.com/engineering/harness-design-long-running-apps)++辅助参考:++- [LangChain: The Anatomy of an Agent Harness](https://blog.langchain.com/the-anatomy-of-an-agent-harness/)+- [Thoughtworks: Harness Engineering](https://martinfowler.com/articles/exploring-gen-ai/harness-engineering.html)+- [HumanLayer: Skill Issue: Harness Engineering for Coding Agents](https://www.humanlayer.dev/blog/skill-issue-harness-engineering-for-coding-agents)++## 贯穿项目++本课程的大多数 project 都围绕同一个产品展开:++- 一个基于 Electron 的个人知识库桌面应用++核心目标包括:++- 导入本地文档+- 管理文档库+- 处理与索引文档+- 对导入内容发起 AI 问答+- 返回带引用的 grounded 回答++之所以选择这个项目,是因为它同时具备:++- 很强的实际价值感+- 足够真实的产品复杂度+- 很适合观察 harness 优化前后的效果差异++## 课程作业形式++本课程包含两类内容:++- **Lectures**:12 个概念单元,每个单元只回答一个核心问题+- **Projects**:6 个实践项目,把 lecture 里的方法落实到同一个 Electron 应用上++每个 project 都要求你:++- 让 Codex 或 Claude Code 执行真实任务+- 比较弱 harness 与强 harness 的差别+- 观察可靠性、连续性、验证质量、可维护性的变化++最后一个 project 同时也是整个课程的 capstone harness。++## 课程组织方式++- 每个 lecture 聚焦一个问题+- 整门课配套 6 个 project+- 每个 project 都要求 agent 真正干活+- 每个 project 都要做弱 harness / 强 harness 对照+- 我们关心的是效果变化,而不是“写了多少说明文档”++## 仓库结构++- `lectures/` - 全部讲义+- `projects/` - 全部实践项目,包括 capstone+- `resources/` - 中英双语的可复用模板、检查清单和方法参考++每个 lecture 都带一个 `code/` 目录,用来放小型真实示例和 supporting artifacts。++## 建议学习节奏++这门课适合按 6 个单元推进:++- **Unit 1**: Lecture 01-02 + Project 01+- **Unit 2**: Lecture 03-04 + Project 02+- **Unit 3**: Lecture 05-06 + Project 03+- **Unit 4**: Lecture 07-08 + Project 04+- **Unit 5**: Lecture 09-10 + Project 05+- **Unit 6**: Lecture 11-12 + Project 06++如果你想慢一点,也可以把每个单元当成一周来学。++## 如何使用这个仓库++1. 先读课程首页,理解整体结构。+2. 按顺序阅读 12 个 lecture。+3. 用 6 个 project 作为实践主线。+4. lecture 里的 `code/` 目录用于查看小型示例和真实 artifact。+5. 最后把 Project 06 当作整门课的 capstone harness。diff --git a/resources/README.md b/resources/README.mdnew file mode 100644index 0000000..1730bb9--- /dev/null+++ b/resources/README.md@@ -0,0 +1,28 @@+# Resource Library++This folder is the bilingual starter library for the course. It turns the+course methods into copy-ready templates and compact references you can use in a+real repository.++## Choose A Language++- 中文资料库: [`zh/README.md`](./zh/README.md)+- English library: [`en/README.md`](./en/README.md)++## What You Will Find++- root instruction templates+- feature and progress state files+- handoff and clean-exit checklists+- bootstrap script references+- compact method notes for initializer and coding-agent flows++## Recommended Starter Pack++- `AGENTS.md` or `CLAUDE.md`+- `feature_list.json`+- `claude-progress.md`+- `init.sh`++Start with those four files first, then add handoff and evaluator artifacts as+the project becomes longer-running or higher-risk.diff --git a/resources/en/README.md b/resources/en/README.mdnew file mode 100644index 0000000..04e702d--- /dev/null+++ b/resources/en/README.md@@ -0,0 +1,46 @@+# English Resource Library++This folder turns the course methods into copy-ready templates and compact+references you can use in a real repository.++## When To Use It++Start here when you want Codex, Claude Code, or another coding agent to work+across multiple sessions without constantly re-deriving setup, status, and+scope.++It is especially useful when:++- work spans multiple sessions+- features are numerous and easy to leave half-finished+- agents tend to declare victory too early+- startup steps are rediscovered every time++## Start Here++For a minimal setup, begin with:++- root instructions: [`templates/AGENTS.md`](./templates/AGENTS.md) or [`templates/CLAUDE.md`](./templates/CLAUDE.md)+- feature state: [`templates/feature_list.json`](./templates/feature_list.json)+- progress log: [`templates/claude-progress.md`](./templates/claude-progress.md)+- bootstrap script reference: `resources/en/templates/init.sh`++Then add:++- session handoff: [`templates/session-handoff.md`](./templates/session-handoff.md)+- clean-exit checklist: [`templates/clean-state-checklist.md`](./templates/clean-state-checklist.md)+- evaluator rubric: [`templates/evaluator-rubric.md`](./templates/evaluator-rubric.md)++## Library Structure++- [`templates/`](./templates/README.md): templates to copy into a real repo+- [`reference/`](./reference/README.md): method notes, startup flow, and failure-mode maps++## Recommended Minimal Pack++- `AGENTS.md` or `CLAUDE.md`+- `feature_list.json`+- `claude-progress.md`+- `init.sh`++Those four files are enough to make most agent workflows noticeably more stable.diff --git a/resources/en/reference/README.md b/resources/en/reference/README.mdnew file mode 100644index 0000000..6c5b128--- /dev/null+++ b/resources/en/reference/README.md@@ -0,0 +1,22 @@+# English Reference++These notes explain how to use the templates as a working harness instead of a+loose pile of files.++## Reference Notes++- [`method-map.md`](./method-map.md): map common long-running failure modes to+ the artifact or policy that addresses them first+- [`initializer-agent-playbook.md`](./initializer-agent-playbook.md): what the+ initializer should leave behind before feature work starts+- [`coding-agent-startup-flow.md`](./coding-agent-startup-flow.md): fixed+ session-start flow for later coding runs+- [`prompt-calibration.md`](./prompt-calibration.md): how to keep root+ instructions sharp without making them bloated and brittle++## Suggested Reading Order++1. `method-map.md`+2. `initializer-agent-playbook.md`+3. `coding-agent-startup-flow.md`+4. `prompt-calibration.md`diff --git a/resources/en/reference/coding-agent-startup-flow.md b/resources/en/reference/coding-agent-startup-flow.mdnew file mode 100644index 0000000..b4d8781--- /dev/null+++ b/resources/en/reference/coding-agent-startup-flow.md@@ -0,0 +1,34 @@+# Coding Agent Startup Flow++Use this at the beginning of every session after initialization is complete.++## Fixed Startup Template++1. Run `pwd` and confirm the repository root.+2. Read `claude-progress.md`.+3. Read `feature_list.json`.+4. Review recent commits with `git log --oneline -5`.+5. Run `./init.sh`.+6. Run a baseline smoke or end-to-end path.+7. If the baseline is broken, fix that first.+8. Select the highest-priority unfinished feature.+9. Work only on that feature until it is verified or explicitly blocked.++## Why This Order Matters++- `pwd` prevents accidental work in the wrong directory.+- progress and feature files recover durable state before new edits begin.+- recent commits explain what changed most recently.+- `init.sh` standardizes startup instead of relying on memory.+- baseline verification catches broken starting states before new work hides+ them.++## End-Of-Session Mirror++The same session should end by:++1. recording progress+2. updating feature state+3. writing a handoff if needed+4. committing safe work+5. leaving a clean restart pathdiff --git a/resources/en/reference/initializer-agent-playbook.md b/resources/en/reference/initializer-agent-playbook.mdnew file mode 100644index 0000000..622cf9b--- /dev/null+++ b/resources/en/reference/initializer-agent-playbook.md@@ -0,0 +1,37 @@+# Initializer Agent Playbook++Use this playbook for the first serious session in a repository, before+incremental feature work begins.++## Goal++Create a stable operating surface so later sessions can implement behavior+without re-deriving startup commands, current status, or task boundaries.++## Required Outputs++The initializer should leave behind at least these artifacts:++- a root instruction file such as `AGENTS.md` or `CLAUDE.md`+- a machine-readable feature surface such as `feature_list.json`+- a durable progress artifact such as `claude-progress.md`+- a standard startup helper such as `init.sh`+- an initial safe commit that captures the baseline scaffold++## Checklist++1. Define the standard startup path.+2. Define the standard verification path.+3. Create the progress log and record the starting state.+4. Decompose the work into explicit features with statuses.+5. Create the first clean baseline commit.++## Success Test++A fresh session with no prior chat context should be able to answer:++- what this repository does+- how to start it+- how to verify it+- what is unfinished+- what the next best step isdiff --git a/resources/en/reference/method-map.md b/resources/en/reference/method-map.mdnew file mode 100644index 0000000..405e4ca--- /dev/null+++ b/resources/en/reference/method-map.md@@ -0,0 +1,19 @@+# Method Map++This table maps the most common long-running coding-agent failure modes to the+artifact or operating rule that usually fixes them first.++| Failure mode | What it looks like in practice | Primary fix | Supporting artifact |+| --- | --- | --- | --- |+| Cold-start confusion | A new session spends most of its time rediscovering setup and status | Make the repository the system of record | `claude-progress.md` |+| Scope sprawl | The agent starts several features and finishes none of them cleanly | Restrict active scope | `feature_list.json` |+| Premature completion | The agent claims done after code edits but before runnable proof | Bind completion to evidence | `clean-state-checklist.md` |+| Fragile startup | Every session re-learns how to boot the project | Standardize setup and verification | `init.sh` |+| Weak handoff | The next session cannot tell what is verified, broken, or next | End with an explicit handoff | `session-handoff.md` |+| Subjective review | Review quality depends on taste or memory | Score output with fixed categories | `evaluator-rubric.md` |++## Operating Principle++Add the smallest artifact that directly addresses the observed failure mode.+Avoid solving every reliability problem by dumping more text into one global+instruction file.diff --git a/resources/en/reference/prompt-calibration.md b/resources/en/reference/prompt-calibration.mdnew file mode 100644index 0000000..0a69403--- /dev/null+++ b/resources/en/reference/prompt-calibration.md@@ -0,0 +1,25 @@+# Prompt Calibration++Root instructions should define the operating frame, not every possible move.++## Keep In The Root File++- repository purpose and scope+- startup path+- verification path+- non-negotiable constraints+- required state artifacts+- end-of-session rules++## Move Out Of The Root File++- long historical edge cases+- topic-specific implementation details+- local architecture notes that belong near the code+- examples that only apply to one subsystem++## Working Rule++The root file should help a fresh session orient itself quickly. If the file is+becoming a dumping ground for every past failure, split the detail into smaller+documents and link to them instead.diff --git a/resources/en/templates/AGENTS.md b/resources/en/templates/AGENTS.mdnew file mode 100644index 0000000..3052639--- /dev/null+++ b/resources/en/templates/AGENTS.md@@ -0,0 +1,55 @@+# AGENTS.md++This repository is designed for long-running coding-agent work. The goal is not+to maximize raw code output. The goal is to leave the repo in a state where the+next session can continue without guessing.++## Startup Workflow++Before writing code:++1. Confirm the working directory with `pwd`.+2. Read `claude-progress.md` for the latest verified state and next step.+3. Read `feature_list.json` and choose the highest-priority unfinished feature.+4. Review recent commits with `git log --oneline -5`.+5. Run `./init.sh`.+6. Run the required smoke or end-to-end verification before starting new work.++If baseline verification is already failing, fix that first. Do not stack new+feature work on top of a broken starting state.++## Working Rules++- Work on one feature at a time.+- Do not mark a feature complete just because code was added.+- Keep changes within the selected feature scope unless a blocker forces a+ narrow supporting fix.+- Do not silently change verification rules during implementation.+- Prefer durable repo artifacts over chat summaries.++## Required Artifacts++- `feature_list.json`: source of truth for feature state+- `claude-progress.md`: session log and current verified status+- `init.sh`: standard startup and verification path+- `session-handoff.md`: optional compact handoff for larger sessions++## Definition Of Done++A feature is done only when all of the following are true:++- the target behavior is implemented+- the required verification actually ran+- evidence is recorded in `feature_list.json` or `claude-progress.md`+- the repository remains restartable from the standard startup path++## End Of Session++Before ending a session:++1. Update `claude-progress.md`.+2. Update `feature_list.json`.+3. Record any unresolved risk or blocker.+4. Commit with a descriptive message once the work is in a safe state.+5. Leave the repo clean enough for the next session to run `./init.sh`+ immediately.diff --git a/resources/en/templates/CLAUDE.md b/resources/en/templates/CLAUDE.mdnew file mode 100644index 0000000..040b4ff--- /dev/null+++ b/resources/en/templates/CLAUDE.md@@ -0,0 +1,47 @@+# CLAUDE.md++You are working in a repository designed for long-running implementation work.+Prioritize reliable completion, continuity across sessions, and explicit+verification over speed.++## Operating Loop++At the start of every session:++1. Run `pwd` and confirm you are in the expected repository root.+2. Read `claude-progress.md`.+3. Read `feature_list.json`.+4. Review recent commits with `git log --oneline -5`.+5. Run `./init.sh`.+6. Check whether the baseline smoke or end-to-end path is already broken.++Then select exactly one unfinished feature and work only on that feature until+you either verify it or document why it is blocked.++## Rules++- One active feature at a time.+- Do not claim completion without runnable evidence.+- Do not rewrite the feature list to hide unfinished work.+- Do not remove or weaken tests just to make the task look complete.+- Use repository artifacts as the system of record.++## Required Files++- `feature_list.json`+- `claude-progress.md`+- `init.sh`+- `session-handoff.md` when a compact handoff is useful++## Completion Gate++A feature can move to `passing` only after the required verification succeeds+and the result is recorded.++## Before You Stop++1. Update the progress log.+2. Update the feature state.+3. Record what is still broken or unverified.+4. Commit once the repository is safe to resume.+5. Leave a clean restart path for the next session.diff --git a/resources/en/templates/README.md b/resources/en/templates/README.mdnew file mode 100644index 0000000..c81c82d--- /dev/null+++ b/resources/en/templates/README.md@@ -0,0 +1,176 @@+# Template Guide++These templates are ready to copy into your own project. Each one serves a specific purpose in the agent's workflow. Edit the contents to match your project's commands, paths, feature names, and verification steps.++## How to Get Started++Copy these four files into your project root first:++1. `AGENTS.md` or `CLAUDE.md`+2. `init.sh`+3. `claude-progress.md`+4. `feature_list.json`++Add the remaining files as your project grows.++---++## AGENTS.md++The root instruction file. This is the first thing the agent reads when it starts a session. It defines the operating rules: what to do before writing code, how to work, and how to wrap up.++**How to use it:**++- Copy to your project root directory+- Replace the startup workflow steps with your actual project paths and commands+- Adjust the working rules to match your team's conventions+- Keep the definition of done section — it's the most important part++**What it does for the agent:**++- Tells it to read progress and feature state before starting work+- Forces it to work on one feature at a time+- Requires evidence before marking anything as done+- Defines what a clean end-of-session looks like++Use `AGENTS.md` for Codex or other agents. Use `CLAUDE.md` if you're working with Claude Code — the structure is the same, just formatted for Claude's instruction style.++## init.sh++The startup script. Runs dependency installation, verification, and prints the start command — all in one shot.++**How to use it:**++- Copy to your project root+- Edit these three variables at the top:+ - `INSTALL_CMD` — your dependency install command (e.g. `npm install`, `pip install -r requirements.txt`)+ - `VERIFY_CMD` — your basic verification command (e.g. `npm test`, `pytest`)+ - `START_CMD` — your dev server start command (e.g. `npm run dev`)+- Make it executable: `chmod +x init.sh`++**What it does:**++1. Prints the current directory (so you can confirm it's running in the right place)+2. Installs dependencies+3. Runs the verification command+4. Prints the start command (or runs it if `RUN_START_COMMAND=1` is set)++If verification fails, the agent should stop and fix the baseline before doing anything else.++## claude-progress.md++The progress log. Every session writes to this file, and every new session reads it first.++**How to use it:**++- Copy to your project root+- Fill in the "Current Verified State" section with your project's info+- After each session, update the session record++**What each field means:**++- **Current Verified State** — the single source of truth for where the project stands+ - `Repository root directory` — where the project lives+ - `Standard startup path` — the command to get the project running+ - `Standard verification path` — the command to run tests+ - `Highest priority unfinished feature` — what the next session should work on+ - `Current blocker` — anything that's stuck+- **Session Record** — one entry per session+ - `Goal` — what you planned to do+ - `Completed` — what actually got done+ - `Verification run` — what tests were executed+ - `Evidence recorded` — what proof was captured+ - `Commits` — what was committed+ - `Known risks` — what might be broken+ - `Next best action` — where the next session should start++## feature_list.json++The feature tracker. A machine-readable list of every feature the agent needs to implement, along with its status, verification steps, and evidence.++**How to use it:**++- Copy to your project root+- Replace the example features with your own+- Each feature needs:+ - `id` — a short unique identifier+ - `priority` — integer, lower = higher priority+ - `area` — which part of the app (e.g. "chat", "import", "search")+ - `title` — short description+ - `user_visible_behavior` — what the user should see when it works+ - `status` — one of `not_started`, `in_progress`, `blocked`, `passing`+ - `verification` — step-by-step instructions to confirm it works+ - `evidence` — recorded proof that verification passed (filled in by the agent)+ - `notes` — any extra context++**Status rules:**++- `not_started` — hasn't been touched+- `in_progress` — the one feature currently being worked on (only one at a time)+- `blocked` — can't proceed due to a documented issue+- `passing` — verification passed and evidence is recorded++The agent should only have one feature in `in_progress` at any time.++## session-handoff.md++A compact handoff note between sessions. Use this when a session ends and you want the next one to pick up quickly.++**How to use it:**++- Copy to your project root+- Fill it out at the end of each session (or have the agent fill it out)++**What each section covers:**++- **Currently verified** — what's confirmed working and what verification was run+- **Changes this session** — what code or infrastructure changed+- **Still broken or unverified** — known issues and risky areas+- **Next best action** — what the next session should do, and what not to touch+- **Commands** — startup, verification, and debug commands for quick reference++This file is optional for small sessions. It becomes important when sessions are long or when the project has multiple active areas.++## clean-state-checklist.md++A checklist to run through before ending each session. Makes sure the repo is in a good state for the next session to start cleanly.++**How to use it:**++- Copy to your project root+- Run through it before you close a session+- The agent should also check these items as part of its end-of-session routine++**What it checks:**++- Standard startup still works+- Standard verification still runs+- Progress log is updated+- Feature list reflects actual state (no false `passing` entries)+- No half-finished work left unrecorded+- Next session can continue without manual fixes++## evaluator-rubric.md++A scorecard for reviewing agent output quality. Use this after a session or at project milestones to evaluate whether the work meets the bar.++**How to use it:**++- Copy to your project root+- After a session (or a set of sessions), score the agent's work across six dimensions+- Each dimension is scored 0-2++**The six dimensions:**++1. **Correctness** — does the implementation match the target behavior?+2. **Verification** — were the required checks actually run, with evidence?+3. **Scope discipline** — did the agent stay within the selected feature?+4. **Reliability** — does the result survive a restart or re-run?+5. **Maintainability** — is the code and documentation clear enough for the next session?+6. **Handoff readiness** — can a new session continue using only repo artifacts?++**Conclusion options:**++- Accept — meets the bar+- Revise — needs fixes before accepting+- Block — fundamental issues that need to be resolved firstdiff --git a/resources/en/templates/claude-progress.md b/resources/en/templates/claude-progress.mdnew file mode 100644index 0000000..c6a0a7b--- /dev/null+++ b/resources/en/templates/claude-progress.md@@ -0,0 +1,35 @@+# Progress Log++## Current Verified State++- Repository root:+- Standard startup path:+- Standard verification path:+- Current highest-priority unfinished feature:+- Current blocker:++## Session Log++### Session 001++- Date:+- Goal:+- Completed:+- Verification run:+- Evidence captured:+- Commits:+- Files or artifacts updated:+- Known risk or unresolved issue:+- Next best step:++### Session 002++- Date:+- Goal:+- Completed:+- Verification run:+- Evidence captured:+- Commits:+- Files or artifacts updated:+- Known risk or unresolved issue:+- Next best step:diff --git a/resources/en/templates/clean-state-checklist.md b/resources/en/templates/clean-state-checklist.mdnew file mode 100644index 0000000..5aa8d51--- /dev/null+++ b/resources/en/templates/clean-state-checklist.md@@ -0,0 +1,8 @@+# Clean State Checklist++- [ ] The standard startup path still works.+- [ ] The standard verification path still runs.+- [ ] Current progress is recorded in the progress log.+- [ ] Feature state reflects what is actually passing versus unverified.+- [ ] No half-finished step is left undocumented.+- [ ] The next session can continue without manual repair.diff --git a/resources/en/templates/evaluator-rubric.md b/resources/en/templates/evaluator-rubric.mdnew file mode 100644index 0000000..b1eb57e--- /dev/null+++ b/resources/en/templates/evaluator-rubric.md@@ -0,0 +1,24 @@+# Evaluator Rubric++Use this rubric after implementation and before final acceptance.++| Category | Question | Score (0-2) | Notes |+| --- | --- | --- | --- |+| Correctness | Does the implemented behavior match the requested feature? | | |+| Verification | Did the required checks actually run, with evidence? | | |+| Scope discipline | Did the session stay inside the chosen feature scope? | | |+| Reliability | Does the result survive restart or rerun without repair? | | |+| Maintainability | Is the code and documentation clear enough for the next session? | | |+| Handoff readiness | Can a fresh session continue work from repo artifacts only? | | |++## Verdict++- Accept+- Revise+- Block++## Required Follow-Up++- Missing evidence:+- Required fixes:+- Next review trigger:diff --git a/resources/en/templates/feature_list.json b/resources/en/templates/feature_list.jsonnew file mode 100644index 0000000..138adc6--- /dev/null+++ b/resources/en/templates/feature_list.json@@ -0,0 +1,64 @@+{+ "project": "replace-with-project-name",+ "last_updated": "YYYY-MM-DD",+ "rules": {+ "single_active_feature": true,+ "passing_requires_evidence": true,+ "do_not_skip_verification": true+ },+ "status_legend": {+ "not_started": "Work has not begun.",+ "in_progress": "The feature is the current active task.",+ "blocked": "Work cannot continue until a documented blocker is resolved.",+ "passing": "Required verification has passed and evidence is recorded."+ },+ "features": [+ {+ "id": "chat-001",+ "priority": 1,+ "area": "chat",+ "title": "Create a new conversation",+ "user_visible_behavior": "A user can click New Chat and see a fresh empty conversation.",+ "status": "not_started",+ "verification": [+ "Open the app.",+ "Click New Chat.",+ "Verify a new conversation appears in the sidebar.",+ "Verify the main panel shows an empty conversation state."+ ],+ "evidence": [],+ "notes": ""+ },+ {+ "id": "chat-002",+ "priority": 2,+ "area": "chat",+ "title": "Send a message in the current conversation",+ "user_visible_behavior": "A user can submit a message and see it appear in the active thread.",+ "status": "not_started",+ "verification": [+ "Open an existing conversation.",+ "Type a message into the input.",+ "Submit the message.",+ "Verify the new message appears in the thread."+ ],+ "evidence": [],+ "notes": ""+ },+ {+ "id": "chat-003",+ "priority": 3,+ "area": "chat",+ "title": "Persist the active conversation list",+ "user_visible_behavior": "A user sees previously created conversations after restarting the app.",+ "status": "not_started",+ "verification": [+ "Create two conversations.",+ "Restart the app.",+ "Verify both conversations still appear in the sidebar."+ ],+ "evidence": [],+ "notes": ""+ }+ ]+}diff --git a/resources/en/templates/init.sh b/resources/en/templates/init.shnew file mode 100755index 0000000..d7522d6--- /dev/null+++ b/resources/en/templates/init.sh@@ -0,0 +1,29 @@+#!/usr/bin/env bash++set -euo pipefail++ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"+cd "$ROOT_DIR"++# Replace these commands with the correct commands for your repository.+INSTALL_CMD=(npm install)+VERIFY_CMD=(npm test)+START_CMD=(npm run dev)++echo "==> Working directory: $PWD"+echo "==> Syncing dependencies"+"${INSTALL_CMD[@]}"++echo "==> Running baseline verification"+"${VERIFY_CMD[@]}"++echo "==> Startup command"+printf ' %q' "${START_CMD[@]}"+printf '\n'++if [ "${RUN_START_COMMAND:-0}" = "1" ]; then+ echo "==> Starting the app"+ exec "${START_CMD[@]}"+fi++echo "Set RUN_START_COMMAND=1 if you want init.sh to launch the app directly."diff --git a/resources/en/templates/session-handoff.md b/resources/en/templates/session-handoff.mdnew file mode 100644index 0000000..c37cf46--- /dev/null+++ b/resources/en/templates/session-handoff.md@@ -0,0 +1,30 @@+# Session Handoff++## Verified Now++- What is currently working:+- What verification actually ran:++## Changed This Session++- Code or behavior added:+- Infrastructure or harness changes:++## Broken Or Unverified++- Known defect:+- Unverified path:+- Risk for the next session:++## Next Best Step++- Highest-priority unfinished feature:+- Why it is next:+- What counts as passing:+- What must not change during that step:++## Commands++- Startup:+- Verification:+- Focused debug command:diff --git a/resources/zh/README.md b/resources/zh/README.mdnew file mode 100644index 0000000..61fa0e7--- /dev/null+++ b/resources/zh/README.md@@ -0,0 +1,44 @@+# 中文资料库++这个文件夹把课程里的方法整理成可以直接参考和复用的材料,不是再讲一遍概念,而是尽量回答两个问题:++- 我现在应该先抄哪些文件+- 这些文件分别解决什么问题++## 适合什么时候用++当你准备让 Codex、Claude Code 或其他 coding agent 在一个仓库里持续工作时,就可以从这里开始。它特别适合这些场景:++- 多轮会话开发,担心上下文断裂+- 功能多,容易出现做一半就停的半成品+- 常常提前宣布完成,但实际没测透+- 每次开工都要重新摸索启动方式++## 从这里开始++如果你想先搭一个最小可用版本,优先看这些文件:++- 根指令文件:[`templates/AGENTS.md`](./templates/AGENTS.md) 或 [`templates/CLAUDE.md`](./templates/CLAUDE.md)+- 功能状态文件:[`templates/feature_list.json`](./templates/feature_list.json)+- 进度日志:[`templates/claude-progress.md`](./templates/claude-progress.md)+- 启动脚本参考:`resources/zh/templates/init.sh`++然后按需要补上:++- 会话交接模板:[`templates/session-handoff.md`](./templates/session-handoff.md)+- 收尾检查清单:[`templates/clean-state-checklist.md`](./templates/clean-state-checklist.md)+- 评审模板:[`templates/evaluator-rubric.md`](./templates/evaluator-rubric.md)++## 资料库结构++- [`templates/`](./templates/README.md):可以直接复制到真实仓库里的模板+- [`reference/`](./reference/README.md):方法说明、启动流程和问题对照表++## 推荐最小组合++- `AGENTS.md` 或 `CLAUDE.md`+- `feature_list.json`+- `claude-progress.md`+- `init.sh`++先把这四样放进项目里,再开始让 agent 持续工作,通常就已经能明显降低返工和瞎猜。diff --git a/resources/zh/reference/README.md b/resources/zh/reference/README.mdnew file mode 100644index 0000000..1b1643c--- /dev/null+++ b/resources/zh/reference/README.md@@ -0,0 +1,17 @@+# 中文参考++这一部分解释这些模板该怎么配合使用,而不是把它们当成一堆孤立文件。++## 参考材料++- [`method-map.md`](./method-map.md):把常见长时任务翻车点映射到对应方法和工件+- [`initializer-agent-playbook.md`](./initializer-agent-playbook.md):初始化代理在第一轮应该产出什么+- [`coding-agent-startup-flow.md`](./coding-agent-startup-flow.md):后续编码代理每次开工的固定流程+- [`prompt-calibration.md`](./prompt-calibration.md):根指令应该写到什么程度才合适++## 推荐阅读顺序++1. `method-map.md`+2. `initializer-agent-playbook.md`+3. `coding-agent-startup-flow.md`+4. `prompt-calibration.md`diff --git a/resources/zh/reference/coding-agent-startup-flow.md b/resources/zh/reference/coding-agent-startup-flow.mdnew file mode 100644index 0000000..1d74379--- /dev/null+++ b/resources/zh/reference/coding-agent-startup-flow.md@@ -0,0 +1,33 @@+# 编码代理开工流程++初始化完成后,每轮编码会话都按这个流程开始。++## 固定开工模板++1. 运行 `pwd`,确认仓库根目录+2. 读取 `claude-progress.md`+3. 读取 `feature_list.json`+4. 用 `git log --oneline -5` 查看最近提交+5. 运行 `./init.sh`+6. 跑一条基础 smoke test 或端到端路径+7. 如果基础状态已坏,先修这个+8. 选择最高优先级的未完成功能+9. 只围绕这个功能工作,直到它被验证或明确 blocked++## 为什么顺序不能乱++- `pwd` 能防止在错误目录里干活+- progress 和 feature 文件先恢复持久状态+- 最近提交能解释刚刚发生了什么+- `init.sh` 让启动过程标准化,而不是靠记忆+- 基础验证先跑,可以避免在坏状态上继续叠改动++## 对应的收尾流程++同一轮会话结束时,也应该镜像地做这些事:++1. 记录进度+2. 更新功能状态+3. 必要时写交接摘要+4. 提交安全状态的代码+5. 留下可直接重启的干净环境diff --git a/resources/zh/reference/initializer-agent-playbook.md b/resources/zh/reference/initializer-agent-playbook.mdnew file mode 100644index 0000000..10c4ad6--- /dev/null+++ b/resources/zh/reference/initializer-agent-playbook.md@@ -0,0 +1,35 @@+# 初始化代理操作手册++这个手册用于仓库里的第一轮重要会话,也就是正式开始增量开发之前的初始化阶段。++## 目标++先搭出稳定的工作面,让后续会话不必重新推导启动命令、当前状态和任务边界。++## 必需产出++初始化阶段至少应该留下这些工件:++- 一个根指令文件,例如 `AGENTS.md` 或 `CLAUDE.md`+- 一个机器可读的功能面,例如 `feature_list.json`+- 一个持久进度工件,例如 `claude-progress.md`+- 一个标准启动辅助脚本,例如 `init.sh`+- 一个记录基础脚手架状态的初始安全提交++## 检查清单++1. 定义标准启动路径+2. 定义标准验证路径+3. 建立进度日志并写下初始状态+4. 把工作拆成功能,并给出状态字段+5. 建立第一个干净的 baseline commit++## 成功标准++一个完全没有前文聊天上下文的新会话,应该能回答:++- 这个仓库是做什么的+- 怎么启动+- 怎么验证+- 还有什么没做完+- 下一步最佳动作是什么diff --git a/resources/zh/reference/method-map.md b/resources/zh/reference/method-map.mdnew file mode 100644index 0000000..e2f54ec--- /dev/null+++ b/resources/zh/reference/method-map.md@@ -0,0 +1,16 @@+# 方法对照表++这个表把最常见的长时 coding-agent 失败模式,对应到最先该补的工件或规则。++| 失败模式 | 实际表现 | 首要修复 | 主要工件 |+| --- | --- | --- | --- |+| 冷启动混乱 | 新会话花大量时间重新摸索状态和启动方式 | 让仓库成为 system of record | `claude-progress.md` |+| 范围蔓延 | 一次启动多个功能,最后没有一个完整收尾 | 限制 active scope | `feature_list.json` |+| 提前宣布完成 | 代码改了就说 done,但没有可运行证据 | 把完成绑定到验证证据 | `clean-state-checklist.md` |+| 启动脆弱 | 每轮会话都要重新学怎么启动项目 | 统一启动与验证路径 | `init.sh` |+| 交接薄弱 | 下一轮看不出哪里可用、哪里坏了、接下来做什么 | 明确写交接摘要 | `session-handoff.md` |+| 评审主观 | 质量判断依赖个人记忆和感觉 | 用固定维度做评分 | `evaluator-rubric.md` |++## 使用原则++优先补最能直接消除当前失败模式的那个工件,不要一出问题就把更多规则堆进一个超长 instruction 文件里。diff --git a/resources/zh/reference/prompt-calibration.md b/resources/zh/reference/prompt-calibration.mdnew file mode 100644index 0000000..f89002c--- /dev/null+++ b/resources/zh/reference/prompt-calibration.md@@ -0,0 +1,23 @@+# Prompt 校准++根指令文件应该定义工作框架,而不是把所有动作写死。++## 应该留在根文件里的内容++- 仓库用途和范围+- 启动路径+- 验证路径+- 不可违反的约束+- 必需的状态工件+- 会话结束规则++## 应该移出根文件的内容++- 过长的历史边角案例+- 只属于某个子系统的细节实现说明+- 更适合贴在代码附近的局部架构笔记+- 只对单一模块成立的示例++## 工作原则++根文件的职责是让新会话快速建立方向感。如果它开始变成“过去每次失败都往里加一句”的堆叠场,就应该把细节拆到更小、更明确的文档里,再从根文件跳转过去。diff --git a/resources/zh/templates/AGENTS.md b/resources/zh/templates/AGENTS.mdnew file mode 100644index 0000000..66d84dc--- /dev/null+++ b/resources/zh/templates/AGENTS.md@@ -0,0 +1,50 @@+# AGENTS.md++这个仓库面向长时运行的 coding agent 工作流。目标不是尽可能快地产出代码,而是让每一轮会话结束后,下一个会话仍然能无猜测地继续工作。++## 开工流程++写代码前先做这些事:++1. 用 `pwd` 确认当前目录。+2. 读取 `claude-progress.md`,了解最新已验证状态和下一步。+3. 读取 `feature_list.json`,选择优先级最高的未完成功能。+4. 用 `git log --oneline -5` 看最近提交。+5. 运行 `./init.sh`。+6. 在开始新功能前,先跑必需的 smoke test 或端到端验证。++如果基础验证一开始就失败,先修基础状态,不要在坏的起点上继续叠新功能。++## 工作规则++- 一次只做一个功能。+- 不要因为“代码已经写了”就把功能标记为完成。+- 除非为了消除当前 blocker 的窄范围修复,否则不要扩大到其他功能。+- 实现过程中不要悄悄改弱验证规则。+- 优先依赖仓库里的持久化文件,而不是聊天记录。++## 必需文件++- `feature_list.json`:功能状态的唯一事实来源+- `claude-progress.md`:会话进度和当前已验证状态+- `init.sh`:统一的启动与验证入口+- `session-handoff.md`:较长会话可选的交接摘要++## 完成定义++一个功能只有在以下条件都满足时才算完成:++- 目标行为已经实现+- 要求的验证真的跑过+- 证据记录在 `feature_list.json` 或 `claude-progress.md`+- 仓库仍然能按标准启动路径重新开始工作++## 收尾++结束会话前:++1. 更新 `claude-progress.md`+2. 更新 `feature_list.json`+3. 记录仍未解决的风险或 blocker+4. 在工作处于安全状态后,用清晰的提交信息提交+5. 保证下一轮会话可以直接运行 `./init.sh`diff --git a/resources/zh/templates/CLAUDE.md b/resources/zh/templates/CLAUDE.mdnew file mode 100644index 0000000..8d0bc63--- /dev/null+++ b/resources/zh/templates/CLAUDE.md@@ -0,0 +1,43 @@+# CLAUDE.md++你正在一个为长时实现工作设计的仓库中工作。优先保证可靠完成、跨会话连续性和显式验证,而不是表面上的速度。++## 固定工作循环++每轮会话开始时:++1. 运行 `pwd`,确认当前在正确的仓库根目录+2. 读取 `claude-progress.md`+3. 读取 `feature_list.json`+4. 用 `git log --oneline -5` 查看最近提交+5. 运行 `./init.sh`+6. 检查基础 smoke test 或端到端路径是否已经损坏++然后只选择一个未完成功能,围绕它工作,直到它被验证通过,或者被明确记录为 blocked。++## 规则++- 同一时间只能有一个 active feature+- 没有可运行证据时,不要声称完成+- 不要通过重写功能清单来隐藏未完成工作+- 不要为了“看起来完成”而删除或削弱测试+- 以仓库内文件作为 system of record++## 必需文件++- `feature_list.json`+- `claude-progress.md`+- `init.sh`+- 需要简短交接时使用 `session-handoff.md`++## 完成门槛++只有在要求的验证成功且结果被记录后,功能状态才可以切换到 `passing`。++## 结束前++1. 更新进度日志+2. 更新功能状态+3. 记录仍然损坏或未验证的内容+4. 在仓库可安全恢复后提交+5. 给下一轮会话留下干净的重启路径diff --git a/resources/zh/templates/README.md b/resources/zh/templates/README.mdnew file mode 100644index 0000000..09bd7a6--- /dev/null+++ b/resources/zh/templates/README.md@@ -0,0 +1,176 @@+# 模板使用指南++这些模板可以直接复制到你的项目里用。每个文件在 agent 的工作流程中各有分工。复制过去后,把里面的命令、路径、功能名称和验证步骤换成你自己项目的。++## 怎么开始++先把这四个文件复制到项目根目录:++1. `AGENTS.md` 或 `CLAUDE.md`+2. `init.sh`+3. `claude-progress.md`+4. `feature_list.json`++等项目变复杂了,再补其余的文件。++---++## AGENTS.md++根指令文件。agent 每次开工会先读这个文件。它定义了工作规则:写代码前要做什么、工作过程中怎么守规矩、收尾时要检查什么。++**怎么用:**++- 复制到项目根目录+- 把开工流程里的步骤换成你自己项目的路径和命令+- 工作规则按你们团队的约定调整+- 完成定义那一段别改——那是整个 harness 最关键的部分++**它帮 agent 做什么:**++- 让它在开始工作前先读进度和功能状态+- 逼它一次只做一个功能+- 要求它拿出证据才能标记完成+- 定义了什么叫"干净收尾"++用 `AGENTS.md` 给 Codex 或其他 agent。用 `CLAUDE.md` 给 Claude Code——内容一样,格式按 Claude 的指令风格来的。++## init.sh++启动脚本。一条命令完成依赖安装、验证和打印启动命令。++**怎么用:**++- 复制到项目根目录+- 改顶部这三个变量:+ - `INSTALL_CMD` — 你的依赖安装命令(比如 `npm install`、`pip install -r requirements.txt`)+ - `VERIFY_CMD` — 你的基础验证命令(比如 `npm test`、`pytest`)+ - `START_CMD` — 你的开发服务器启动命令(比如 `npm run dev`)+- 加执行权限:`chmod +x init.sh`++**它做什么:**++1. 打印当前目录(确认跑在正确的地方)+2. 安装依赖+3. 跑验证命令+4. 打印启动命令(如果设了 `RUN_START_COMMAND=1` 就直接启动)++如果验证失败了,agent 应该停下来先修基础状态,不要在坏的基础上继续叠新功能。++## claude-progress.md++进度日志。每轮会话往里写,每轮新会话先读它。++**怎么用:**++- 复制到项目根目录+- 把"当前已验证状态"那段填上你的项目信息+- 每轮会话结束后更新会话记录++**每个字段的意思:**++- **当前已验证状态** — 项目当前进展的唯一真相+ - `仓库根目录` — 项目在哪+ - `标准启动路径` — 把项目跑起来的命令+ - `标准验证路径` — 跑测试的命令+ - `当前最高优先级未完成功能` — 下一轮该做什么+ - `当前 blocker` — 哪里卡住了+- **会话记录** — 每轮一条+ - `本轮目标` — 打算做什么+ - `已完成` — 实际做了什么+ - `运行过的验证` — 跑了什么测试+ - `已记录证据` — 留下了什么证明+ - `提交记录` — 提了什么 commit+ - `已知风险或未解决问题` — 哪里可能有问题+ - `下一步最佳动作` — 下一轮从哪开始++## feature_list.json++功能清单。机器可读的功能列表,每个功能有状态、验证步骤和证据。++**怎么用:**++- 复制到项目根目录+- 把示例功能换成你自己的+- 每个功能需要填:+ - `id` — 短的唯一标识+ - `priority` — 整数,越小越优先+ - `area` — 属于应用的哪块(比如 "chat"、"import"、"search")+ - `title` — 简短描述+ - `user_visible_behavior` — 功能正常时用户能看到什么+ - `status` — 四种状态之一:`not_started`、`in_progress`、`blocked`、`passing`+ - `verification` — 逐步验证步骤+ - `evidence` — 验证通过的记录(agent 填)+ - `notes` — 额外说明++**状态规则:**++- `not_started` — 还没碰+- `in_progress` — 当前正在做的那个(同一时间只能有一个)+- `blocked` — 有记录的阻塞问题,推不动+- `passing` — 验证通过,证据已记录++agent 任何时候只能有一个功能处于 `in_progress`。++## session-handoff.md++会话交接摘要。一轮会话结束时写,下一轮开始时读。让接手的人(或 agent)快速了解现状。++**怎么用:**++- 复制到项目根目录+- 每轮会话结束时填写(也可以让 agent 自己填)++**每段写什么:**++- **当前已验证** — 哪些是确认能用的,跑过什么验证+- **本轮改动** — 改了什么代码或基础设施+- **仍损坏或未验证** — 已知问题和风险区+- **下一步最佳动作** — 下一轮该做什么,哪些东西不要动+- **命令** — 启动、验证、调试命令,方便快速参考++短会话可以不写这个文件。会话长了或者项目有多个并行区域时,它就很关键了。++## clean-state-checklist.md++收尾检查清单。每次会话结束前过一遍,确保仓库处于下一轮可以直接开工的状态。++**怎么用:**++- 复制到项目根目录+- 关掉会话前逐项检查+- agent 的收尾流程里也应该包含这些检查++**检查什么:**++- 标准启动路径还能用+- 标准验证还能跑+- 进度日志已更新+- 功能清单真实反映了 passing 和未验证的边界(没有假 passing)+- 没有半成品处于未记录状态+- 下一轮会话不需要人工修复就能继续++## evaluator-rubric.md++评审评分表。会话结束后或到里程碑时,用它评估 agent 做的东西够不够格。++**怎么用:**++- 复制到项目根目录+- 一轮(或几轮)会话后,按六个维度打分+- 每个维度 0-2 分++**六个维度:**++1. **正确性** — 实现出来的行为是否符合目标功能+2. **验证** — 要求的检查是否真的跑过,并留下证据+3. **范围纪律** — 是否基本保持在选定功能范围内+4. **可靠性** — 结果是否能在重启或重跑后继续工作+5. **可维护性** — 代码和文档是否清楚到足以交给下一轮会话+6. **交接准备度** — 新会话是否能只靠仓库内文件继续推进++**结论选项:**++- Accept — 达标+- Revise — 需要修补才能接受+- Block — 有根本性问题,需要先解决diff --git a/resources/zh/templates/claude-progress.md b/resources/zh/templates/claude-progress.mdnew file mode 100644index 0000000..8ee42ee--- /dev/null+++ b/resources/zh/templates/claude-progress.md@@ -0,0 +1,35 @@+# 进度日志++## 当前已验证状态++- 仓库根目录:+- 标准启动路径:+- 标准验证路径:+- 当前最高优先级未完成功能:+- 当前 blocker:++## 会话记录++### Session 001++- 日期:+- 本轮目标:+- 已完成:+- 运行过的验证:+- 已记录证据:+- 提交记录:+- 更新过的文件或工件:+- 已知风险或未解决问题:+- 下一步最佳动作:++### Session 002++- 日期:+- 本轮目标:+- 已完成:+- 运行过的验证:+- 已记录证据:+- 提交记录:+- 更新过的文件或工件:+- 已知风险或未解决问题:+- 下一步最佳动作:diff --git a/resources/zh/templates/clean-state-checklist.md b/resources/zh/templates/clean-state-checklist.mdnew file mode 100644index 0000000..6a2717d--- /dev/null+++ b/resources/zh/templates/clean-state-checklist.md@@ -0,0 +1,8 @@+# 干净状态检查清单++- [ ] 标准启动路径仍然可用+- [ ] 标准验证路径仍然可运行+- [ ] 当前进度已经记录到进度日志+- [ ] 功能状态真实反映了 passing 和未验证的边界+- [ ] 没有任何半成品步骤处于未记录状态+- [ ] 下一轮会话无需人工修复即可继续diff --git a/resources/zh/templates/evaluator-rubric.md b/resources/zh/templates/evaluator-rubric.mdnew file mode 100644index 0000000..cedc842--- /dev/null+++ b/resources/zh/templates/evaluator-rubric.md@@ -0,0 +1,24 @@+# 评审评分表++在实现完成后、正式验收前,用这张表做一次评审。++| 维度 | 问题 | 分数 (0-2) | 备注 |+| --- | --- | --- | --- |+| 正确性 | 实现出来的行为是否符合目标功能? | | |+| 验证 | 要求的检查是否真的跑过,并留下证据? | | |+| 范围纪律 | 这一轮是否基本保持在选定功能范围内? | | |+| 可靠性 | 结果是否能在重启或重跑后继续工作? | | |+| 可维护性 | 代码和文档是否清楚到足以交给下一轮会话? | | |+| 交接准备度 | 新会话是否能只靠仓库内工件继续推进? | | |++## 结论++- Accept+- Revise+- Block++## 后续动作++- 缺失的证据:+- 必须补的修复:+- 下次复审触发条件:diff --git a/resources/zh/templates/feature_list.json b/resources/zh/templates/feature_list.jsonnew file mode 100644index 0000000..41b9753--- /dev/null+++ b/resources/zh/templates/feature_list.json@@ -0,0 +1,64 @@+{+ "project": "替换成你的项目名",+ "last_updated": "YYYY-MM-DD",+ "rules": {+ "single_active_feature": true,+ "passing_requires_evidence": true,+ "do_not_skip_verification": true+ },+ "status_legend": {+ "not_started": "功能还没开始做。",+ "in_progress": "这个功能是当前唯一正在进行的任务。",+ "blocked": "因为已记录的阻塞问题,当前无法继续推进。",+ "passing": "要求的验证已经通过,并且证据已经记录。"+ },+ "features": [+ {+ "id": "chat-001",+ "priority": 1,+ "area": "chat",+ "title": "创建新会话",+ "user_visible_behavior": "用户点击 New Chat 后,可以看到一个新的空白对话。",+ "status": "not_started",+ "verification": [+ "打开应用。",+ "点击 New Chat。",+ "确认侧边栏出现一个新会话。",+ "确认主面板显示空白对话状态。"+ ],+ "evidence": [],+ "notes": ""+ },+ {+ "id": "chat-002",+ "priority": 2,+ "area": "chat",+ "title": "在当前会话里发送消息",+ "user_visible_behavior": "用户提交一条消息后,可以在当前线程中看到它。",+ "status": "not_started",+ "verification": [+ "打开一个已有会话。",+ "在输入框中输入消息。",+ "提交消息。",+ "确认线程中出现这条新消息。"+ ],+ "evidence": [],+ "notes": ""+ },+ {+ "id": "chat-003",+ "priority": 3,+ "area": "chat",+ "title": "持久化保存会话列表",+ "user_visible_behavior": "应用重启后,用户仍能看到之前创建的会话。",+ "status": "not_started",+ "verification": [+ "创建两个会话。",+ "重启应用。",+ "确认两个会话仍显示在侧边栏中。"+ ],+ "evidence": [],+ "notes": ""+ }+ ]+}diff --git a/resources/zh/templates/init.sh b/resources/zh/templates/init.shnew file mode 100755index 0000000..c153b2a--- /dev/null+++ b/resources/zh/templates/init.sh@@ -0,0 +1,29 @@+#!/usr/bin/env bash++set -euo pipefail++ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"+cd "$ROOT_DIR"++# 按你的项目实际情况替换这些命令。+INSTALL_CMD=(npm install)+VERIFY_CMD=(npm test)+START_CMD=(npm run dev)++echo "==> 当前目录: $PWD"+echo "==> 同步依赖"+"${INSTALL_CMD[@]}"++echo "==> 运行基础验证"+"${VERIFY_CMD[@]}"++echo "==> 启动命令"+printf ' %q' "${START_CMD[@]}"+printf '\n'++if [ "${RUN_START_COMMAND:-0}" = "1" ]; then+ echo "==> 启动应用"+ exec "${START_CMD[@]}"+fi++echo "如果希望 init.sh 直接启动应用,请设置 RUN_START_COMMAND=1。"diff --git a/resources/zh/templates/session-handoff.md b/resources/zh/templates/session-handoff.mdnew file mode 100644index 0000000..a24fc89--- /dev/null+++ b/resources/zh/templates/session-handoff.md@@ -0,0 +1,30 @@+# 会话交接++## 当前已验证++- 现在明确可用的部分:+- 这轮实际跑过的验证:++## 本轮改动++- 新增了哪些代码或行为:+- 基础设施或 harness 发生了哪些变化:++## 仍损坏或未验证++- 已知缺陷:+- 未验证路径:+- 下一轮会话需要注意的风险:++## 下一步最佳动作++- 最高优先级未完成功能:+- 为什么它是下一步:+- 什么结果才算 passing:+- 这一步中哪些东西不要动:++## 命令++- 启动命令:+- 验证命令:+- 定向调试命令: