@cevenif: 用Claude Code或Codex做开发,但总觉得AI在乱跑?这门课可能正是你缺的那块拼图。 GitHub上有个开源课程叫 Learn Harness Engineering,专门教你给AI编程助手建立一套可控的工作框架,围绕五个核心机…
摘要
GitHub 上开源课程 Learn Harness Engineering,教你为 AI 编程助手(如 Claude Code、Codex)建立可控工作框架,包含12节理论课和6个实战项目,核心机制涵盖指令、状态、验证、范围、会话。
查看缓存全文
缓存时间: 2026/06/10 05:49
用Claude Code或Codex做开发,但总觉得AI在乱跑?这门课可能正是你缺的那块拼图。 GitHub上有个开源课程叫 Learn Harness Engineering,专门教你给AI编程助手建立一套可控的工作框架,围绕五个核心机制: 指令 状态 验证 范围 会话 让每次任务都有据可查、能接续、能验证。12节理论课加上6个实战项目,还有现成模板可以直接塞进项目里用,不用学完整门课也能马上稳住AI。 https://github.com/walkinglabs/learn-harness-engineering…
walkinglabs/learn-harness-engineering
Source: https://github.com/walkinglabs/learn-harness-engineering
Learn Harness Engineering
A project-based course on building the environment, state management, verification, and control mechanisms that make AI coding agents work reliably.
🌍 This course is available in 14 languages: English, 简体中文, 繁體中文, 日本語, 한국어, Español, Français, Русский, Deutsch, العربية, Tiếng Việt, Oʻzbekcha, Türkçe, Portuguese (BR). Choose your language from the badges above.
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
- Anthropic: Effective harnesses for long-running agents
- Anthropic: Harness design for long-running application development
- Awesome Harness Engineering
Quick start? The
skills/harness-creator/skill can help you scaffold a production-grade harness (AGENTS.md, feature lists, init.sh, verification workflows) for your own project in minutes.
Table of Contents
- ✨ Visual Preview
- What Harness Engineering Actually Means
- Quick Start: Improve Your Agent Today
- Capstone Project: A Real App
- Learning Path
- Syllabus
- Skills
- Other Courses
✨ Visual Preview
🏠 Course Homepage
A comprehensive course outline and introduction to core philosophies, providing a clear path to get started.

📖 Immersive Lectures
Deep dives into real-world pain points and hands-on projects (like Project 01) for an immersive learning experience.

🗂️ Ready-to-Use Resource Library
Templates and reference configurations designed to solve common pitfalls in multi-turn AI agent development, such as context loss and premature task completion.

PDF Coursebooks
The repository now includes a PDF build pipeline for the course content.
- Run
npm run pdf:buildto generate the currently configured PDF coursebooks locally. - Output files are written to
artifacts/pdfs/. - Run
npm run screenshots:readmeif you want to refresh the README preview images. - GitHub Actions workflow
release-course-pdfs.ymlcan build the PDFs and publish them to GitHub Releases.
The Model Is Smart, The Harness Makes It Reliable
There’s a hard truth most people learn the hard way: the strongest model in the world will still fail on real engineering tasks if you don’t build a proper environment around it.
You’ve probably seen this yourself. You give Claude or GPT a task in your repo. It starts well — reads files, writes code, looks productive. Then something goes wrong. It skips a step. It breaks a test. It says “done” but nothing actually works. You spend more time cleaning up than if you’d done it yourself.
This isn’t a model problem. It’s a harness problem.
The evidence is clear. Anthropic ran a controlled experiment: same model (Opus 4.5), same prompt (“build a 2D retro game editor”). Without a harness, it spent $9 in 20 minutes and produced something that didn’t work. With a full harness (planner + generator + evaluator), it spent $200 in 6 hours and built a game you could actually play. The model didn’t change. The harness did.
OpenAI reported the same thing with Codex: in a well-harnessed repository, the same model goes from “unreliable” to “reliable.” Not a marginal improvement — a qualitative shift.
This course teaches you how to build that environment.
THE HARNESS PATTERN
====================
You --> give task --> Agent reads harness files --> Agent executes
|
harness governs every step:
|
+--> Instructions: what to do, in what order
+--> Scope: one feature at a time, no overreach
+--> State: progress log, feature list, git history
+--> Verification: tests, lint, type-check, smoke runs
+--> Lifecycle: init at start, clean state at end
|
v
Agent stops only when
verification passes
What Harness Engineering Actually Means
Harness engineering is about building a complete working environment around the model so it produces reliable results. It’s not about writing better prompts. It’s about designing the system the model operates inside.
A harness has five subsystems:
┌────────────────────────────────────────────────────────────────┐
│ THE HARNESS │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌────────────────────┐ │
│ │ Instructions │ │ State │ │ Verification │ │
│ │ │ │ │ │ │ │
│ │ AGENTS.md │ │ progress.md │ │ tests + lint │ │
│ │ CLAUDE.md │ │ feature_list │ │ type-check │ │
│ │ feature_list │ │ git log │ │ smoke runs │ │
│ │ docs/ │ │ session hand │ │ e2e pipeline │ │
│ └──────────────┘ └──────────────┘ └────────────────────┘ │
│ │
│ ┌──────────────┐ ┌──────────────────────────────────────┐ │
│ │ Scope │ │ Session Lifecycle │ │
│ │ │ │ │ │
│ │ one feature │ │ init.sh at start │ │
│ │ at a time │ │ clean-state checklist at end │ │
│ │ definition │ │ handoff note for next session │ │
│ │ of done │ │ commit only when safe to resume │ │
│ └──────────────┘ └──────────────────────────────────────┘ │
│ │
└────────────────────────────────────────────────────────────────┘
The MODEL decides what code to write.
The HARNESS governs when, where, and how it writes it.
The harness doesn't make the model smarter.
It makes the model's output reliable.
Each subsystem has one job:
- Instructions — Tell the agent what to do, in what order, and what to read before starting. Not one giant file; a progressive disclosure structure the agent navigates on demand.
- State — Track what’s been done, what’s in progress, and what’s next. Persisted to disk so the next session picks up exactly where the last one left off.
- Verification — Only a passing test suite counts as evidence. The agent cannot declare victory without runnable proof.
- Scope — Constrain the agent to one feature at a time. No overreach. No half-finishing three things. No rewriting the feature list to hide unfinished work.
- Session Lifecycle — Initialize at the start. Clean up at the end. Leave a clean restart path for the next session.
Why This Course Exists
The question isn’t “can models write code?” They can. The question is: can they reliably complete real engineering tasks inside real repositories, over multiple sessions, without constant human supervision?
Right now, the answer is: not without a harness.
WITHOUT HARNESS WITH HARNESS
============== ============
Session 1: agent writes code Session 1: agent reads instructions
agent breaks tests agent runs init.sh
agent says "done" agent works on one feature
you fix it manually agent verifies before claiming done
agent updates progress log
Session 2: agent starts fresh agent commits clean state
agent has no memory
of what happened before Session 2: agent reads progress log
agent re-does work agent picks up exactly where it left off
or does something else entirely agent continues the unfinished feature
you fix it again you review, not rescue
Result: you spend more time Result: agent does the work,
cleaning up than if you you verify the result
did it yourself
The questions this course actually cares about:
- 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?
Course Curriculum & Documentation
For the full course materials, please visit the Documentation Website.
The curriculum is divided into three parts:
- Lectures: 12 conceptual units explaining the theory behind harness engineering.
- Projects: 6 hands-on projects where you build an agentic workspace from scratch.
- Resource Library: Copy-ready templates (
AGENTS.md,feature_list.json,init.sh, etc.) to use in your own repositories today.
Quick Start: Improve Your Agent Today
You don’t need to read all 12 lectures before you start getting value. 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.
YOUR PROJECT ROOT
├── AGENTS.md <-- the agent's operating manual
├── CLAUDE.md <-- (alternative, if using Claude Code)
├── init.sh <-- runs install + verify + start
├── feature_list.json <-- what features exist, which are done
├── claude-progress.md <-- what happened each session
└── src/ <-- your actual code
Grab the starter templates from the Resource Library and drop them into your project. That’s it. Four files, and your agent sessions will already be significantly more stable than running on prompts alone.
Capstone Project: A Real App
All six course projects revolve around the same product: an Electron-based personal knowledge base desktop app.
┌──────────────────────────────────────────────────────┐
│ Knowledge Base Desktop App │
│ │
│ ┌──────────────┐ ┌──────────────────────────────┐ │
│ │ Document List│ │ Q&A Panel │ │
│ │ │ │ │ │
│ │ doc-001.md │ │ Q: What is harness eng? │ │
│ │ doc-002.md │ │ A: The environment built │ │
│ │ doc-003.md │ │ around an agent model... │ │
│ │ ... │ │ [citation: doc-002.md] │ │
│ └──────────────┘ └──────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ Status Bar: 42 docs | 38 indexed | last sync 3m │ │
│ └─────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────┘
Core features:
├── Import local documents
├── Manage a document library
├── Process and index documents
├── Run AI-powered Q&A over imported content
└── Return grounded answers with citations
This project was chosen because it combines strong practical value, enough real-world product complexity, and a good setting for observing before/after harness improvements.
Each course project’s starter/solution is a complete copy of this Electron app at that evolutionary stage. P(N+1)’s starter is derived from P(N)’s solution — the app evolves as your harness skills grow.
Learning Path
The course is designed to be done in order. Each phase builds on the last.
Phase 1: SEE THE PROBLEM Phase 2: STRUCTURE THE REPO
======================== ==========================
L01 Strong models ≠ reliable L03 Repository as single
execution source of truth
L02 What harness actually means
L04 Split instructions across
| files, not one giant file
v
P01 Prompt-only vs. |
rules-first comparison v
P02 Agent-readable workspace
Phase 3: CONNECT SESSIONS Phase 4: FEEDBACK & SCOPE
========================== =========================
L05 Keep context alive L07 Draw clear task boundaries
across sessions
L08 Feature lists as harness
L06 Initialize before every primitives
agent session
|
| v
v P04 Runtime feedback to
P03 Multi-session continuity correct agent behavior
Phase 5: VERIFICATION Phase 6: PUT IT ALL TOGETHER
===================== ============================
L09 Stop agents from L11 Make agent's runtime
declaring victory early observable
L10 Full-pipeline run = L12 Clean handoff at end of
real verification every session
| |
v v
P05 Agent verifies its own work P06 Build a complete harness
(capstone project)
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.
Syllabus
Lectures — 12 conceptual units, each answering one core question
Read the full text for each lecture on the Documentation Website.
| Session | Question | Core Idea |
|---|---|---|
| L01 | Why do strong models still fail on real tasks? | The capability gap between benchmarks and real engineering |
| L02 | What does “harness” actually mean? | Five subsystems: instructions, state, verification, scope, lifecycle |
| L03 | Why must the repo be the single source of truth? | If the agent can’t see it, it doesn’t exist |
| L04 | Why does one giant instruction file fail? | Progressive disclosure: give a map, not an encyclopedia |
| L05 | Why do long-running tasks lose continuity? | Persist progress to disk; pick up where you left off |
| L06 | Why does initialization need its own phase? | Verify the environment is healthy before the agent starts work |
| L07 | Why do agents overreach and under-finish? | One feature at a time; explicit definition of done |
| L08 | Why are feature lists harness primitives? | Machine-readable scope boundaries the agent can’t ignore |
| L09 | Why do agents declare victory too early? | Verification gaps: confidence ≠ correctness |
| L10 | Why does end-to-end testing change results? | Only a full-pipeline run counts as real verification |
| L11 | Why does observability belong inside the harness? | If you can’t see what the agent did, you can’t fix what it broke |
| L12 | Why must every session leave a clean state? | The next session’s success depends on this session’s cleanup |
Projects — 6 hands-on projects applying lecture methods to the same Electron app
| Project | What You Do | Harness Mechanism |
|---|---|---|
| P01 | Run the same task twice: prompt-only vs. rules-first | Minimal harness: AGENTS.md + init.sh + feature_list.json |
| P02 | Restructure the repo so the agent can read it | Agent-readable workspace + persistent state files |
| P03 | Make the agent pick up from where it left off | Progress log + session handoff + multi-session continuity |
| P04 | Stop the agent from doing too much or too little | Runtime feedback + scope control + incremental indexing |
| P05 | Make the agent verify its own work | Self-verification + grounded Q&A + evidence-based completion |
| P06 | Build a complete harness from scratch (capstone) | Full harness: all mechanisms + observability + ablation study |
PROJECT EVOLUTION
=================
P01 Prompt-only vs. rules-first You see the problem
|
v
P02 Agent-readable workspace You restructure the repo
|
v
P03 Multi-session continuity You connect sessions
|
v
P04 Runtime feedback & scope You add feedback loops
|
v
P05 Self-verification You make the agent check itself
|
v
P06 Complete harness (capstone) You build the full system
Each project's solution becomes the next project's starter.
The app evolves. Your harness skills grow with it.
Resource Library
- English — templates, checklists, and method references
- 简体中文 — 中文模板、清单和方法参考
- 繁體中文 — 繁體中文範本、清單和方法參考
- 日本語 — テンプレート、チェックリスト、方法リファレンス
- 한국어 — 템플릿, 체크리스트, 방법 참고 자료
- Español — plantillas, listas de verificación y referencias
- Français — modèles, listes de contrôle et références
- Русский — шаблоны, чек-листы и справочники
- Deutsch — Vorlagen, Checklisten und Referenzen
- العربية — قوالب، قوائم تحقق ومراجع
- Tiếng Việt — mẫu, danh sách kiểm tra và tài liệu tham khảo
- Oʻzbekcha — andozalar, tekshiruv roʻyxatlari va maʼlumotnomalar
- Türkçe — şablonlar, kontrol listeleri ve referanslar
- Português (BR) — modelos, listas de verificação e referências de métodos
The Agent Session Lifecycle
One of the core ideas in this course: the agent’s session should follow a structured lifecycle, not a free-for-all. Here’s what that looks like:
AGENT SESSION LIFECYCLE
======================
┌──────────────────────────────────────────────────────────────────┐
│ START │
│ │
│ 1. Agent reads AGENTS.md / CLAUDE.md │
│ 2. Agent runs init.sh (install, verify, health check) │
│ 3. Agent reads claude-progress.md (what happened last time) │
│ 4. Agent reads feature_list.json (what's done, what's next) │
│ 5. Agent checks git log (recent changes) │
│ │
│ SELECT │
│ │
│ 6. Agent picks exactly ONE unfinished feature │
│ 7. Agent works only on that feature │
│ │
│ EXECUTE │
│ │
│ 8. Agent implements the feature │
│ 9. Agent runs verification (tests, lint, type-check) │
│ 10. If verification fails: fix and re-run │
│ 11. If verification passes: record evidence │
│ │
│ WRAP UP │
│ │
│ 12. Agent updates claude-progress.md │
│ 13. Agent updates feature_list.json │
│ 14. Agent records what's still broken or unverified │
│ 15. Agent commits (only when safe to resume) │
│ 16. Agent leaves clean restart path for next session │
│ │
└──────────────────────────────────────────────────────────────────┘
The harness governs every transition in this lifecycle.
The model decides what code to write at each step.
Without the harness, step 9 becomes "agent says it looks fine."
With the harness, step 9 is "tests pass, lint is clean, types check."
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
- People who only care about prompts and don’t plan to build real implementations
- Learners not prepared to let agents work inside real repositories
Requirements
This is a course where you actually run coding agents.
You need at least one of these tools:
- Claude Code
- Codex
- Another IDE or 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 re-run tasks
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.
Local Preview
This repository uses VitePress as a documentation viewer.
npm install
npm run docs:dev # Dev server with hot reload
npm run docs:build # Production build
npm run docs:preview # Preview built site
Then open the local URL that VitePress outputs in your browser.
Prerequisites
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
Helpful but not required:
- 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 References
Primary:
- OpenAI: Harness engineering: leveraging Codex in an agent-first world
- Anthropic: Effective harnesses for long-running agents
- Anthropic: Harness design for long-running application development
- OpenAI: Unrolling the Codex agent loop
- Anthropic: Demystifying evals for AI agents
- LangChain: Improving Deep Agents with harness engineering
- Thoughtworks / Martin Fowler: Harness engineering for coding agent users
- Cursor: Continually improving our agent harness
See the full layered reference list in docs/en/resources/reference/.
Repository Structure
learn-harness-engineering/
├── docs/ # VitePress documentation site
│ ├── lectures/ # 12 lectures (index.md + code/ examples)
│ │ ├── lecture-01-*/
│ │ └── ... (12 total)
│ ├── projects/ # 6 project descriptions
│ │ ├── project-01-*/
│ │ └── ... (6 total)
│ └── resources/ # Multilingual templates & references (14 languages)
│ ├── en/
│ └── ... (14 total)
├── projects/
│ ├── shared/ # Shared Electron + TypeScript + React foundation
│ └── project-NN/ # Per-project starter/ and solution/ directories
├── skills/ # Reusable AI agent skills
│ └── harness-creator/ # Harness engineering skill
├── package.json # VitePress + dev tooling
└── CLAUDE.md # Claude Code instructions for this repo
How the Course Is Organized
- 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
Skills
This repository also includes reusable AI agent skills that you can install directly into your IDE or agent workspace.
- harness-creator: A skill that helps you scaffold a production-grade harness for your own project in minutes.
Other Courses
Our team has also created other courses! Check them out:
Hands-on Modern RL: An open-source, hands-on curriculum bridging the gap from basic RL concepts to LLM alignment, RLVR, and advanced Agentic systems.
Modern LLM Notebook: A hands-on course for building modern LLMs from scratch in PyTorch, with 23 runnable Jupyter Notebooks covering tokenizers, attention, MoE, RLHF, inference, evaluation, and distillation.
Star History
Acknowledgments
This course was inspired by and draws ideas from learn-claude-code — a progressive guide to building an agent from scratch, from a single loop to isolated autonomous execution.
相似文章
@mylifcc: 想真正理解 Claude Code 是怎么跑起来的,而不是只停留在 prompt 层面? 这个 repo 太硬核了: shareAI-lab/learn-claude-code 「Bash is all you need」—— 从 0 到…
介绍一个从零实现类似 Claude Code 的 agent harness 的开源学习项目,包含 20 节课逐步增加核心机制,并提供可运行代码和文档。
@FakeMaidenMaker: GitHub 上一个叫《Learn Harness Engineering》的开源课程最近上了 Hacker News 首页(155 分、5.1k stars), 主题是 AI coding agent 的可靠性工程——也就是 OpenA…
《Learn Harness Engineering》是一个开源课程,系统整理了 OpenAI 和 Anthropic 提出的 AI 编程代理可靠性工程(Harness Engineering)概念,包含 12 节讲座和 6 个项目,旨在帮助开发者构建可靠的 AI 代理环境。
@sagacity: 吴恩达老师的讲 Claude Code,DeepLearning 的科普课程Claude Code: A Highly Agentic Coding Assistant https://note.mowen.cn/detail/ml0Rd…
吴恩达发布关于 Claude Code 的科普课程笔记,介绍了这个高自主性的 AI 编程助手,并分享了入门级别的实践技巧。
@astaxie: 今天群里面讨论怎么样学习 Harness,Harness 工程我学习这两个: 1. https://github.com/walkinglabs/learn-harness-engineering… 通过这个了解每一个 Harness 的…
A project-based course repository on Harness Engineering for AI coding agents, covering environment setup, state management, verification, and control mechanisms to make AI coding agents work reliably. The course synthesizes best practices from OpenAI and Anthropic on building effective harnesses for long-running agents.
@nash_su: 官方给出的 Claude Code 在大型代码库中的最佳实践 当然同样的方法论也可以用在 Codex 或任何 Agent 上,AI 会犯错,会糊弄人,项目越大 AI 债越多,文章中是一些基本的防护和优化方式。 本文使用 http://Wi…
官方给出的Claude Code在大型代码库中的最佳实践,同样适用于Codex或其他AI Agent,介绍了基本的防护和优化方式。