Harness engineering beginner tutorial, from 0 to 1
TypeScript agentagenticagentic-aiaiai-agentai-agentsdshdsh-pluginharnessharness-engineeringharness-frameworkllm
docs: add mermaid support and update index pages
sanbuphy1961fff00d9a
diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mtsindex 7a2e941..ac57b45 100644--- a/docs/.vitepress/config.mts+++ b/docs/.vitepress/config.mts@@ -1,31 +1,33 @@/// <reference types="node" />import { defineConfig } from "vitepress";+import { withMermaid } from "vitepress-plugin-mermaid";const docsBase = process.env.DOCS_BASE_PATH ?? "/";const zhLectureItems = [{ text: "欢迎", link: "/zh/" },- { text: "L01. 模型能力强,不等于执行可靠", link: "/zh/lectures/lecture-01-why-capable-agents-still-fail/" },- { text: "L02. Harness 的定义", link: "/zh/lectures/lecture-02-what-a-harness-actually-is/" },- { text: "L03. 让代码仓库成为唯一的事实来源", link: "/zh/lectures/lecture-03-why-the-repository-must-become-the-system-of-record/" },- { text: "L04. 把指令拆分到不同文件里", link: "/zh/lectures/lecture-04-why-one-giant-instruction-file-fails/" },- { text: "L05. 让跨会话的任务保持上下文连续", link: "/zh/lectures/lecture-05-why-long-running-tasks-lose-continuity/" },- { text: "L06. 让 agent 每次工作前先初始化", link: "/zh/lectures/lecture-06-why-initialization-needs-its-own-phase/" },- { text: "L07. 给 agent 划清每次任务的边界", link: "/zh/lectures/lecture-07-why-agents-overreach-and-under-finish/" },- { text: "L08. 用功能清单约束 agent 该做什么", link: "/zh/lectures/lecture-08-why-feature-lists-are-harness-primitives/" },- { text: "L09. 防止 agent 提前宣告完成", link: "/zh/lectures/lecture-09-why-agents-declare-victory-too-early/" },- { text: "L10. 跑通完整流程才算真正验证", link: "/zh/lectures/lecture-10-why-end-to-end-testing-changes-results/" },- { text: "L11. 让 agent 的运行过程可观测", link: "/zh/lectures/lecture-11-why-observability-belongs-inside-the-harness/" },- { text: "L12. 每次会话结束前都做好交接", link: "/zh/lectures/lecture-12-why-every-session-must-leave-a-clean-state/" }+ { text: "模型能力强,不等于执行可靠", link: "/zh/lectures/lecture-01-why-capable-agents-still-fail/" },+ { text: "Harness 的定义", link: "/zh/lectures/lecture-02-what-a-harness-actually-is/" },+ { text: "让代码仓库成为唯一的事实来源", link: "/zh/lectures/lecture-03-why-the-repository-must-become-the-system-of-record/" },+ { text: "把指令拆分到不同文件里", link: "/zh/lectures/lecture-04-why-one-giant-instruction-file-fails/" },+ { text: "让跨会话的任务保持上下文连续", link: "/zh/lectures/lecture-05-why-long-running-tasks-lose-continuity/" },+ { text: "让 agent 每次工作前先初始化", link: "/zh/lectures/lecture-06-why-initialization-needs-its-own-phase/" },+ { text: "给 agent 划清每次任务的边界", link: "/zh/lectures/lecture-07-why-agents-overreach-and-under-finish/" },+ { text: "用功能清单约束 agent 该做什么", link: "/zh/lectures/lecture-08-why-feature-lists-are-harness-primitives/" },+ { text: "防止 agent 提前宣告完成", link: "/zh/lectures/lecture-09-why-agents-declare-victory-too-early/" },+ { text: "跑通完整流程才算真正验证", link: "/zh/lectures/lecture-10-why-end-to-end-testing-changes-results/" },+ { text: "让 agent 的运行过程可观测", link: "/zh/lectures/lecture-11-why-observability-belongs-inside-the-harness/" },+ { text: "每次会话结束前都做好交接", link: "/zh/lectures/lecture-12-why-every-session-must-leave-a-clean-state/" }];const zhProjectItems = [- { text: "P01. 只写提示词让 agent 做,和定好规则再让它做,差多少", link: "/zh/projects/project-01-baseline-vs-minimal-harness/" },- { text: "P02. 让 agent 看懂项目、接住上次的工作", link: "/zh/projects/project-02-agent-readable-workspace/" },- { text: "P03. 让 agent 关掉再打开还能接着干", link: "/zh/projects/project-03-multi-session-continuity/" },- { text: "P04. 用运行反馈修正 agent 的行为", link: "/zh/projects/project-04-incremental-indexing/" },- { text: "P05. 让 agent 自己检查自己做的对不对", link: "/zh/projects/project-05-grounded-qa-verification/" },- { text: "P06. 搭建一套完整的 agent 工作环境", link: "/zh/projects/project-06-runtime-observability-and-debugging/" }+ { text: "欢迎", link: "/zh/projects/" },+ { text: "提示词驱动 vs 规则驱动", link: "/zh/projects/project-01-baseline-vs-minimal-harness/" },+ { text: "让项目可读并接住上次工作", link: "/zh/projects/project-02-agent-readable-workspace/" },+ { text: "跨会话工作连续性", link: "/zh/projects/project-03-multi-session-continuity/" },+ { text: "运行反馈与行为修正", link: "/zh/projects/project-04-incremental-indexing/" },+ { text: "工作评审与自我验证", link: "/zh/projects/project-05-grounded-qa-verification/" },+ { text: "综合 Agent 工作环境", link: "/zh/projects/project-06-runtime-observability-and-debugging/" }];const zhResourceItems = [@@ -39,27 +41,28 @@ const zhResourceItems = [const enLectureItems = [{ text: "Welcome", link: "/en/" },- { text: "Lecture 01. Why Capable Agents Still Fail", link: "/en/lectures/lecture-01-why-capable-agents-still-fail/" },- { text: "Lecture 02. What a Harness Actually Is", link: "/en/lectures/lecture-02-what-a-harness-actually-is/" },- { text: "Lecture 03. Why the Repository Must Become the System of Record", link: "/en/lectures/lecture-03-why-the-repository-must-become-the-system-of-record/" },- { text: "Lecture 04. Why One Giant Instruction File Fails", link: "/en/lectures/lecture-04-why-one-giant-instruction-file-fails/" },- { text: "Lecture 05. Why Long-Running Tasks Lose Continuity", link: "/en/lectures/lecture-05-why-long-running-tasks-lose-continuity/" },- { text: "Lecture 06. Why Initialization Needs Its Own Phase", link: "/en/lectures/lecture-06-why-initialization-needs-its-own-phase/" },- { text: "Lecture 07. Why Agents Overreach and Under-Finish", link: "/en/lectures/lecture-07-why-agents-overreach-and-under-finish/" },- { text: "Lecture 08. Why Feature Lists Are Harness Primitives", link: "/en/lectures/lecture-08-why-feature-lists-are-harness-primitives/" },- { text: "Lecture 09. Why Agents Declare Victory Too Early", link: "/en/lectures/lecture-09-why-agents-declare-victory-too-early/" },- { text: "Lecture 10. Why End-to-End Testing Changes Results", link: "/en/lectures/lecture-10-why-end-to-end-testing-changes-results/" },- { text: "Lecture 11. Why Observability Belongs Inside the Harness", link: "/en/lectures/lecture-11-why-observability-belongs-inside-the-harness/" },- { text: "Lecture 12. Why Every Session Must Leave a Clean State", link: "/en/lectures/lecture-12-why-every-session-must-leave-a-clean-state/" }+ { text: "Why Capable Agents Still Fail", link: "/en/lectures/lecture-01-why-capable-agents-still-fail/" },+ { text: "What a Harness Actually Is", link: "/en/lectures/lecture-02-what-a-harness-actually-is/" },+ { text: "Why the Repository Must Become the System of Record", link: "/en/lectures/lecture-03-why-the-repository-must-become-the-system-of-record/" },+ { text: "Why One Giant Instruction File Fails", link: "/en/lectures/lecture-04-why-one-giant-instruction-file-fails/" },+ { text: "Why Long-Running Tasks Lose Continuity", link: "/en/lectures/lecture-05-why-long-running-tasks-lose-continuity/" },+ { text: "Why Initialization Needs Its Own Phase", link: "/en/lectures/lecture-06-why-initialization-needs-its-own-phase/" },+ { text: "Why Agents Overreach and Under-Finish", link: "/en/lectures/lecture-07-why-agents-overreach-and-under-finish/" },+ { text: "Why Feature Lists Are Harness Primitives", link: "/en/lectures/lecture-08-why-feature-lists-are-harness-primitives/" },+ { text: "Why Agents Declare Victory Too Early", link: "/en/lectures/lecture-09-why-agents-declare-victory-too-early/" },+ { text: "Why End-to-End Testing Changes Results", link: "/en/lectures/lecture-10-why-end-to-end-testing-changes-results/" },+ { text: "Why Observability Belongs Inside the Harness", link: "/en/lectures/lecture-11-why-observability-belongs-inside-the-harness/" },+ { text: "Why Every Session Must Leave a Clean State", link: "/en/lectures/lecture-12-why-every-session-must-leave-a-clean-state/" }];const enProjectItems = [- { text: "Project 01. Prompt-Only vs. Rules-First", link: "/en/projects/project-01-baseline-vs-minimal-harness/" },- { text: "Project 02. Agent-Readable Workspace", link: "/en/projects/project-02-agent-readable-workspace/" },- { text: "Project 03. Multi-Session Continuity", link: "/en/projects/project-03-multi-session-continuity/" },- { text: "Project 04. Runtime Feedback and Scope Control", link: "/en/projects/project-04-incremental-indexing/" },- { text: "Project 05. Self-Verification and Role Separation", link: "/en/projects/project-05-grounded-qa-verification/" },- { text: "Project 06. Complete Harness (Capstone)", link: "/en/projects/project-06-runtime-observability-and-debugging/" }+ { text: "Welcome", link: "/en/projects/" },+ { text: "Prompt-Only vs. Rules-First", link: "/en/projects/project-01-baseline-vs-minimal-harness/" },+ { text: "Agent-Readable Workspace", link: "/en/projects/project-02-agent-readable-workspace/" },+ { text: "Multi-Session Continuity", link: "/en/projects/project-03-multi-session-continuity/" },+ { text: "Runtime Feedback and Scope Control", link: "/en/projects/project-04-incremental-indexing/" },+ { text: "Self-Verification and Role Separation", link: "/en/projects/project-05-grounded-qa-verification/" },+ { text: "Complete Harness (Capstone)", link: "/en/projects/project-06-runtime-observability-and-debugging/" }];const enResourceItems = [@@ -71,43 +74,64 @@ const enResourceItems = [{ text: "中文参考", link: "/zh/resources/reference/" }];-export default defineConfig({- base: docsBase,- title: "Learn Harness Engineering",- description:- "A project-based course on designing the environments, state, verification, and control systems that make Codex and Claude Code reliable.",- cleanUrls: true,- srcExclude: ["temp/**"],- ignoreDeadLinks: true,- themeConfig: {- logo: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23D95C41"><path d="M12 2L13.4 8.6L20 10L13.4 11.4L12 18L10.6 11.4L4 10L10.6 8.6L12 2Z"/></svg>',- search: {- provider: "local"+export default withMermaid(+ defineConfig({+ base: docsBase,+ title: "Learn Harness Engineering",+ description:+ "A project-based course on designing the environments, state, verification, and control systems that make Codex and Claude Code reliable.",+ cleanUrls: true,+ srcExclude: ["temp/**"],+ ignoreDeadLinks: true,+ themeConfig: {+ logo: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23D95C41"><path d="M12 2L13.4 8.6L20 10L13.4 11.4L12 18L10.6 11.4L4 10L10.6 8.6L12 2Z"/></svg>',+ search: {+ provider: "local"+ },+ socialLinks: [{ icon: "github", link: "https://github.com/walkinglabs/learn-harness-engineering" }]},- socialLinks: [{ icon: "github", link: "https://github.com/walkinglabs/learn-harness-engineering" }]- },- markdown: {- theme: {- light: 'github-light',- dark: 'github-dark'- }- },- locales: {- root: {- label: "简体中文",- lang: "zh-CN",- themeConfig: {- nav: [- { text: "首页", link: "/" },- { text: "中文", link: "/zh/" },- { text: "English", link: "/en/" }- ],- sidebar: [],- socialLinks: [{ icon: "github", link: "https://github.com/walkinglabs/learn-harness-engineering" }]+ markdown: {+ theme: {+ light: 'github-light',+ dark: 'github-dark'}},- zh: {- label: "简体中文",+ mermaid: {+ theme: 'base',+ themeVariables: {+ primaryColor: '#F4F3EE',+ primaryBorderColor: '#D1D1D1',+ primaryTextColor: '#1A1A1A',+ lineColor: '#B3B3B3',+ fontFamily: 'Inter, sans-serif'+ }+ },+ locales: {+ root: {+ label: "English",+ lang: "en",+ themeConfig: {+ nav: [+ { text: "Lectures", link: enLectureItems[1].link, activeMatch: '^/en/(lectures/.*)?$' },+ { text: "Projects", link: enProjectItems[0].link, activeMatch: '^/en/projects/' },+ { text: "Library", link: "/en/resources/", activeMatch: '^/en/resources/' }+ ],+ sidebar: {+ '/en/projects/': [+ { text: "Projects", items: enProjectItems }+ ],+ '/en/resources/': [+ { text: "Resource Library", items: enResourceItems }+ ],+ '/en/': [+ { text: "Lectures", items: enLectureItems }+ ]+ },+ socialLinks: [{ icon: "github", link: "https://github.com/walkinglabs/learn-harness-engineering" }]+ }+ },+ zh: {+ label: "简体中文",lang: "zh-CN",link: "/zh/",themeConfig: {@@ -146,42 +170,9 @@ export default defineConfig({}},en: {- label: "English",- lang: "en",- link: "/en/",- themeConfig: {- nav: [- { text: "Lectures", link: enLectureItems[1].link, activeMatch: '^/en/(lectures/.*)?$' },- { text: "Projects", link: enProjectItems[0].link, activeMatch: '^/en/projects/' },- { text: "Library", link: "/en/resources/", activeMatch: '^/en/resources/' }- ],- sidebar: {- '/en/projects/': [- { text: "Projects", items: enProjectItems }- ],- '/en/resources/': [- { text: "Resource Library", items: enResourceItems }- ],- '/en/': [- { text: "Lectures", items: enLectureItems }- ]- },- outline: {- level: [2, 3]- },- docFooter: {- prev: "Previous page",- next: "Next page"- },- lastUpdated: {- text: "Last updated"- },- returnToTopLabel: "Return to top",- sidebarMenuLabel: "Menu",- darkModeSwitchLabel: "Appearance",- lightModeSwitchTitle: "Switch to light theme",- darkModeSwitchTitle: "Switch to dark theme"+ label: "English",+ lang: "en",+ link: "/en/"}}- }-});+ }));diff --git a/docs/.vitepress/theme/style.css b/docs/.vitepress/theme/style.cssindex 7215b06..356418f 100644--- a/docs/.vitepress/theme/style.css+++ b/docs/.vitepress/theme/style.css@@ -391,7 +391,16 @@background: var(--vp-c-brand-1);}-/* ---------- Back-to-top button ---------- */+/* ---------- Mermaid Charts styling overrides ---------- */+.mermaid {+ background-color: var(--vp-c-bg-elv);+ border: 1px solid var(--vp-c-divider);+ border-radius: 12px;+ padding: 16px;+ margin: 16px 0;+ display: flex;+ justify-content: center;+}.VPDoc .back-to-top-btn {border-radius: 50%;}@@ -400,3 +409,82 @@.VPContent {transition: background-color 0.3s;}++/* ---------- Card components for Index pages ---------- */+.card-grid {+ display: grid;+ grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));+ gap: 16px;+ margin: 20px 0;+}++.card {+ border: 1px solid var(--vp-c-divider);+ border-radius: 12px;+ padding: 20px;+ background-color: var(--vp-c-bg-elv);+ transition: all 0.2s ease;+ text-decoration: none !important;+ display: flex;+ flex-direction: column;+}++.card:hover {+ border-color: var(--vp-c-brand-1);+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);+ transform: translateY(-1px);+}++.dark .card:hover {+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);+}++.card h3 {+ margin: 0 0 8px 0 !important;+ font-size: 1.1rem !important;+ font-weight: 600 !important;+ color: var(--vp-c-text-1);+}++.card p {+ margin: 0 !important;+ font-size: 0.95rem;+ color: var(--vp-c-text-2);+ line-height: 1.5;+}++/* List styling for index pages */+.index-list {+ list-style: none !important;+ padding: 0 !important;+ margin: 16px 0 !important;+}++.index-list li {+ position: relative;+ padding-left: 24px;+ margin-bottom: 12px !important;+ color: var(--vp-c-text-2);+ line-height: 1.6;+}++.index-list li::before {+ content: '';+ position: absolute;+ left: 0;+ top: 10px;+ width: 6px;+ height: 6px;+ border-radius: 50%;+ background-color: var(--vp-c-brand-1);+}++.index-list strong {+ color: var(--vp-c-text-1);+}++.index-list a {+ font-weight: 500;+ text-decoration: underline;+ text-underline-offset: 2px;+}diff --git a/docs/en/index.md b/docs/en/index.mdindex 5aafe3b..b0273b9 100644--- a/docs/en/index.md+++ b/docs/en/index.md@@ -1,71 +1,73 @@# Welcome to Learn Harness Engineering-A project-based course on designing environments, state, verification, and control systems for Codex and Claude Code.--## 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 the lectures first. If you want to jump in, grab these template files from the resource library and adapt them to your project.--**Recommended starter set:**--- `AGENTS.md` or `CLAUDE.md` — root instruction file-- `feature_list.json` — feature status tracker-- `claude-progress.md` — progress log-- `init.sh` — initialization script--Put these four files in your project before you start having an agent do real work. The results will be significantly more stable than just writing a big prompt.--Browse all templates: [English Templates](/en/resources/templates/) or [中文模板](/zh/resources/templates/).--## Who This Is For--This course is for:--- 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 performance--This course is not for:--- People looking for a zero-code AI introduction-- Those who only care about prompts without real implementation-- Learners not prepared to let agents work in real repositories--## Environment Requirements--This is a hands-on course that requires running a coding agent.--You need at least one of these tools:--- Claude Code-- Codex-- Another IDE / CLI coding agent that supports file editing, command execution, and multi-step tasks--The course assumes you can:--- Open a local repository-- Allow the agent to edit files-- Allow the agent to run commands-- Inspect output and repeat tasks--## Core References--Primary:-+Learn Harness Engineering is a course dedicated to the engineering of AI coding agents. We have deeply studied and synthesized the most advanced Harness Engineering theories and practices in the industry. Our core references include:- [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)--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)+- [Awesome Harness Engineering](https://github.com/walkinglabs/awesome-harness-engineering)++Through systematic environment design, state management, verification, and control systems, this course teaches you how to make agentic coding tools like Codex and Claude Code truly reliable. It helps you build features, fix bugs, and automate development tasks by constraining your AI coding assistant with explicit rules and boundaries.++## Get started++Choose your learning path to get started. The course is divided into theoretical lectures, hands-on projects, and a copy-ready resource library.++<div class="card-grid">+ <a href="/en/lectures/lecture-01-why-capable-agents-still-fail/" class="card">+ <h3>Lectures</h3>+ <p>Understand why strong models still fail and learn the theory behind effective harnesses.</p>+ </a>+ <a href="/en/projects/" class="card">+ <h3>Projects</h3>+ <p>Hands-on practice building a reliable agentic environment from scratch.</p>+ </a>+ <a href="/en/resources/" class="card">+ <h3>Resource Library</h3>+ <p>Copy-ready templates (AGENTS.md, feature_list.json) to use in your own repositories.</p>+ </a>+</div>++## The Core Mechanism of a Harness++A harness doesn't "make the model smarter"; rather, it establishes a closed-loop **working system** for the model. You can understand its core workflow through this simple diagram:++```mermaid+graph TD+ A["Clear Objective<br/>AGENTS.md"] --> B("Initialization<br/>init.sh")+ B --> C{"Run Tasks<br/>AI Agent"}+ C -->|Encounter Issues| D["Runtime Feedback<br/>CLI / Logs"]+ D -->|Auto-fix| C+ C -->|Code Completed| E{"Verify & QA<br/>Test suite"}+ E -->|Failed| D+ E -->|Passed| F["Cleanup & Handoff<br/>claude-progress.md"]++ classDef primary fill:#D95C41,stroke:#C14E36,color:#fff,font-weight:bold;+ classDef process fill:#F4F3EE,stroke:#D1D1D1,color:#1A1A1A;+ classDef check fill:#EAE8E1,stroke:#B3B3B3,color:#1A1A1A;++ class A,F primary;+ class B,D process;+ class C,E check;+```++## What you will learn++Here are some of the key concepts you will master:++<ul class="index-list">+ <li><strong>Constrain agent behavior</strong> with explicit rules and boundaries.</li>+ <li><strong>Maintain context</strong> across long-running, multi-session tasks.</li>+ <li><strong>Stop agents</strong> from declaring victory too early.</li>+ <li><strong>Verify work</strong> using full-pipeline tests and self-reflection.</li>+ <li><strong>Make runtime observable</strong> and debuggable.</li>+</ul>++## Next steps++Once you understand the core concepts, these guides help you go deeper:++<ul class="index-list">+ <li><a href="/en/lectures/lecture-01-why-capable-agents-still-fail/">Lecture 01: Why Capable Agents Still Fail</a>: Start with the theory behind harness engineering.</li>+ <li><a href="/en/projects/project-01-baseline-vs-minimal-harness/">Project 01: Baseline vs Minimal Harness</a>: Walk through your first real task.</li>+ <li><a href="/en/resources/templates/">Templates</a>: Grab the minimal harness pack (AGENTS.md, feature_list.json, claude-progress.md) for your own projects.</li>+</ul>diff --git a/docs/en/projects/index.md b/docs/en/projects/index.mdnew file mode 100644index 0000000..ef9e07d--- /dev/null+++ b/docs/en/projects/index.md@@ -0,0 +1,23 @@+# Welcome to Projects++This is the hands-on section of Learn Harness Engineering. Reading the lectures isn't enough—you need to build the environments yourself and observe how Codex, Claude Code, or other AI agents behave under different rules.++## Project Overview++This course features 6 progressive, hands-on projects that teach you how to build a reliable agentic working environment from scratch:++1. **Prompt-Only vs. Rules-First**: Compare how an agent performs with just a prompt versus a basic harness.+2. **Agent-Readable Workspace**: Learn how to structure your repository to make it AI-friendly and establish handoff mechanisms.+3. **Multi-Session Continuity**: Design state files and initialization scripts so your agent can resume work seamlessly across sessions.+4. **Runtime Feedback and Scope Control**: Introduce tools that allow the agent to test its own code and correct errors during execution.+5. **Self-Verification and Role Separation**: Build an independent review mechanism to prevent hallucinations and early declarations of victory.+6. **Complete Harness (Capstone)**: Assemble a final, observable, end-to-end agent working environment.++## How to Proceed++Each project folder typically contains:+- `starter/`: Your starting workspace.+- `solution/`: A reference implementation (if you get stuck).+- Task instructions detailing your background and specific goals.++Use your preferred AI Coding Agent (e.g., Claude Code, Cursor, Trae) to complete the tasks inside the `starter/` directory.diff --git a/docs/zh/index.md b/docs/zh/index.mdindex cf00e56..e9c1a4c 100644--- a/docs/zh/index.md+++ b/docs/zh/index.md@@ -1,82 +1,73 @@# 欢迎来到 Learn Harness Engineering-系统学习如何通过环境、状态、验证与控制机制,让 Codex 和 Claude Code 完成真实工程任务。--## 核心观点--以后让模型干活,人只需要定好规则和边界。这就是 harness。--**为什么这个重要:** 模型很强,但不代表它能自动靠谱地完成真实工程任务。它需要一套明确的规则来约束自己的行为范围,需要清晰的交接机制来维持长时任务的连续性,需要验证手段来确认自己做对了。--我们不是在尝试"让模型本身更聪明",而是在研究:怎么给模型搭建一个靠谱的工作环境,让同一个模型做出更可靠的工作。--## 快速开始--不必先把所有 lecture 读完。如果你想先上手,可以直接去资料库参考这些文件,然后按自己的项目改一版。--中文版本:--- 入口:[中文资料库](/zh/resources/)-- 根指令文件:[`AGENTS.md`](/zh/resources/templates/AGENTS.md) 或 [`CLAUDE.md`](/zh/resources/templates/CLAUDE.md)-- 功能状态文件:[`feature_list.json`](/zh/resources/templates/feature_list.json)-- 进度记录文件:[`claude-progress.md`](/zh/resources/templates/claude-progress.md)-- 会话交接文件:[`session-handoff.md`](/zh/resources/templates/session-handoff.md)-- 收尾检查清单:[`clean-state-checklist.md`](/zh/resources/templates/clean-state-checklist.md)-- 评审模板:[`evaluator-rubric.md`](/zh/resources/templates/evaluator-rubric.md)-- 启动脚本参考:`docs/zh/resources/templates/init.sh`--推荐最小起步组合:--- `AGENTS.md` 或 `CLAUDE.md`-- `feature_list.json`-- `claude-progress.md`-- `init.sh`--先把这四样放进你的项目里,再开始让 agent 真正干活,效果会比只写一段大 prompt 稳定得多。--## 适合谁--这门课适合:--- 已经在使用 coding agent、希望提升稳定性和质量的工程师-- 想系统理解 harness 设计的研究者或构建者-- 需要理解"环境设计如何影响 agent 表现"的技术负责人--这门课不适合:--- 只想要一个零代码 AI 入门的人-- 只关心 prompt,而不打算做真实实现的人-- 不准备让 agent 在真实仓库里工作的学习者--## 环境要求--这是一门真正需要动手跑 coding agent 的课程。--你至少需要具备一个这类工具:--- Claude Code-- Codex-- 其他支持文件编辑、命令执行、多步任务的 IDE / CLI coding agent--课程默认你可以:--- 打开本地仓库-- 允许 agent 编辑文件-- 允许 agent 运行命令-- 检查输出并重复执行任务--如果你没有这类工具,仍然可以阅读课程内容,但无法按预期完成课程 project。--## 核心参考资料--主参考:-+Learn Harness Engineering 是一门专注于 AI 编程智能体工程化落地的课程。本课程深度研究并总结了业内最前沿的 Harness Engineering(工具马具/脚手架工程)理论与实践,参考资料包括:- [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)+- [Awesome Harness Engineering](https://github.com/walkinglabs/awesome-harness-engineering)++通过系统的环境设计、状态管理、验证与控制机制,本课程旨在帮助你让 Codex 和 Claude Code 等 AI Agent 能够真正可靠地完成真实工程任务。它通过明确的规则和边界约束你的 AI 编程助手,帮助你更可靠地构建功能、修复 Bug 并自动化开发任务。++## 开始学习++选择适合你的学习路径。本课程分为理论讲义、实战项目和开箱即用的资料库。++<div class="card-grid">+ <a href="/zh/lectures/lecture-01-why-capable-agents-still-fail/" class="card">+ <h3>讲义</h3>+ <p>理解为什么强大的模型依然会失败,掌握构建有效 Harness 的理论基础。</p>+ </a>+ <a href="/zh/projects/" class="card">+ <h3>项目</h3>+ <p>动手实践,从零开始搭建一个可靠的 Agent 工作环境。</p>+ </a>+ <a href="/zh/resources/" class="card">+ <h3>资料库</h3>+ <p>开箱即用的模板(AGENTS.md、feature_list.json 等),可直接复制到你自己的代码仓库中。</p>+ </a>+</div>++## Harness 的核心机制++Harness 的本质不是“让模型变聪明”,而是给模型建立一套闭环的**工作系统**。你可以通过下面的简单图示理解它的核心运作流:++```mermaid+graph TD+ A["明确目标<br/>AGENTS.md"] --> B("初始化检查<br/>init.sh")+ B --> C{"运行任务<br/>AI Agent"}+ C -->|遇到障碍| D["运行反馈<br/>CLI / Logs"]+ D -->|自动修复| C+ C -->|代码完成| E{"验证与评审<br/>Test & QA"}+ E -->|未通过| D+ E -->|通过| F["清理与交接<br/>claude-progress.md"]++ classDef primary fill:#D95C41,stroke:#C14E36,color:#fff,font-weight:bold;+ classDef process fill:#F4F3EE,stroke:#D1D1D1,color:#1A1A1A;+ classDef check fill:#EAE8E1,stroke:#B3B3B3,color:#1A1A1A;++ class A,F primary;+ class B,D process;+ class C,E check;+```++## 你将学到什么++你将在本课程中掌握以下核心概念:++<ul class="index-list">+ <li>用明确的规则和边界<strong>约束 Agent 的行为</strong>。</li>+ <li>在跨会话的长时任务中<strong>保持上下文连续性</strong>。</li>+ <li><strong>防止 Agent 提前宣告</strong>任务完成。</li>+ <li>让 Agent 学会通过完整的流水线测试来<strong>验证自己的工作</strong>。</li>+ <li>让 Agent 的运行过程<strong>可观测、可调试</strong>。</li>+</ul>++## 下一步++了解核心概念后,可以通过以下内容深入学习:++<ul class="index-list">+ <li><a href="/zh/lectures/lecture-01-why-capable-agents-still-fail/">L01. 模型能力强,不等于执行可靠</a>:从理论开始。</li>+ <li><a href="/zh/projects/project-01-baseline-vs-minimal-harness/">P01. 提示词 vs 规则驱动</a>:完成你的第一个对比实战任务。</li>+ <li><a href="/zh/resources/templates/">中文模板</a>:获取最小 Harness 模板包(AGENTS.md、feature_list.json 等),直接用于你的项目。</li>+</ul>diff --git a/docs/zh/projects/index.md b/docs/zh/projects/index.mdnew file mode 100644index 0000000..7134d5f--- /dev/null+++ b/docs/zh/projects/index.md@@ -0,0 +1,23 @@+# 欢迎来到项目实战++这里是 Learn Harness Engineering 的动手实践部分。仅仅阅读讲义是不够的,你需要亲自搭建环境,观察 Codex 或 Claude Code 等 Agent 在不同规则下的真实表现。++## 项目概览++本课程包含 6 个渐进式的实战项目,带你从零开始构建一个完整的 Agent 工作环境:++1. **提示词驱动 vs 规则驱动**:对比一个纯 Prompt 驱动的 Agent 和带有基础 Harness 的 Agent 在表现上的差异。+2. **让项目可读并接住上次工作**:学习如何重构代码仓库结构,使其对 AI 更加友好,并建立工作交接机制。+3. **跨会话工作连续性**:设计状态文件和初始化脚本,让 Agent 可以在多次对话中断后无缝恢复工作。+4. **运行反馈与行为修正**:引入运行时反馈机制,让 Agent 能够自己检查代码是否能跑通,并修正错误。+5. **工作评审与自我验证**:建立独立的评审与验证环节,防止 Agent 产生“幻觉”或提前宣告胜利。+6. **综合 Agent 工作环境**:搭建一套完整的、带有可观测性的最终 Agent 工作环境(综合演练)。++## 如何进行++每个项目文件夹中通常包含:+- `starter/`:你的起始工作区。+- `solution/`:参考的最终实现(如果你卡住了可以参考)。+- 相关的指导文档,说明本次任务的具体背景和目标。++请使用你习惯的 AI Coding Agent(如 Claude Code、Cursor、Trae 等)在每个项目的 `starter/` 目录下完成任务。diff --git a/package-lock.json b/package-lock.jsonindex 994afcf..75b0950 100644--- a/package-lock.json+++ b/package-lock.json@@ -8,7 +8,7 @@"name": "learn-harness-engineering","version": "0.1.0","devDependencies": {- "mermaid": "^11.13.0",+ "mermaid": "^11.14.0","tsx": "^4.19.0","typescript": "^5.7.0","vitepress": "^1.6.4",@@ -943,9 +943,9 @@"optional": true},"node_modules/@mermaid-js/parser": {- "version": "1.0.1",- "resolved": "https://registry.npmmirror.com/@mermaid-js/parser/-/parser-1.0.1.tgz",- "integrity": "sha512-opmV19kN1JsK0T6HhhokHpcVkqKpF+x2pPDKKM2ThHtZAB5F4PROopk0amuVYK5qMrIA4erzpNm8gmPNJgMDxQ==",+ "version": "1.1.0",+ "resolved": "https://registry.npmmirror.com/@mermaid-js/parser/-/parser-1.1.0.tgz",+ "integrity": "sha512-gxK9ZX2+Fex5zu8LhRQoMeMPEHbc73UKZ0FQ54YrQtUxE1VVhMwzeNtKRPAu5aXks4FasbMe4xB4bWrmq6Jlxw==","dev": true,"license": "MIT","dependencies": {@@ -3121,15 +3121,15 @@}},"node_modules/mermaid": {- "version": "11.13.0",- "resolved": "https://registry.npmmirror.com/mermaid/-/mermaid-11.13.0.tgz",- "integrity": "sha512-fEnci+Immw6lKMFI8sqzjlATTyjLkRa6axrEgLV2yHTfv8r+h1wjFbV6xeRtd4rUV1cS4EpR9rwp3Rci7TRWDw==",+ "version": "11.14.0",+ "resolved": "https://registry.npmmirror.com/mermaid/-/mermaid-11.14.0.tgz",+ "integrity": "sha512-GSGloRsBs+JINmmhl0JDwjpuezCsHB4WGI4NASHxL3fHo3o/BRXTxhDLKnln8/Q0lRFRyDdEjmk1/d5Sn1Xz8g==","dev": true,"license": "MIT","dependencies": {"@braintree/sanitize-url": "^7.1.1","@iconify/utils": "^3.0.2",- "@mermaid-js/parser": "^1.0.1",+ "@mermaid-js/parser": "^1.1.0","@types/d3": "^7.4.3","@upsetjs/venn.js": "^2.0.0","cytoscape": "^3.33.1",diff --git a/package.json b/package.jsonindex bb178fe..ab59633 100644--- a/package.json+++ b/package.json@@ -13,7 +13,7 @@"lecture:run": "tsx"},"devDependencies": {- "mermaid": "^11.13.0",+ "mermaid": "^11.14.0","tsx": "^4.19.0","typescript": "^5.7.0","vitepress": "^1.6.4",