Learn Harness Engineering
A deep dive · walkinglabs / learn-harness-engineering

The harness is the product.

A practical field guide to making AI coding agents reliable across real repositories, long-running work, and eventually autonomous loops.

14 lectures8 projects15 languages
00 · TL;DR

Stop asking, “Is the model smart enough?”

Ask whether the agent has a clear map, a healthy environment, durable memory, a narrow job, and an independent way to prove it finished.

Harness engineering is the design of the environment around a model so its capability becomes repeatable execution.

The shift

From prompt craft → system design

  • Instructions live in the repository.
  • Progress survives the chat window.
  • Scope and “done” are machine-readable.
  • Tests and runtime signals decide, not vibes.
Source: Lecture 02
00 · Why it matters

What changes when the workspace carries the load?

Reliability

Fewer “looks done” moments

Completion becomes evidence-based: tests, lint, type-checks, smoke runs, and full-pipeline checks.

Continuity

Less re-discovery

The next session reads progress and handoff state instead of reconstructing the last session from scratch.

Leverage

More time outside the loop

Once goals, feedback, and stopping conditions are explicit, you can automate parts of the workflow safely.

These are operational benefits, not magic model upgrades. A harness exposes and reduces predictable failure modes; it cannot compensate for an impossible task or a missing product decision.

00 · Where to use it

Good fit: work with a real repo, a real definition of done.

Product teams

Feature delivery

Break a large product request into verifiable slices that an agent can implement and hand off.

AI / ML

Eval pipelines

Run generator–evaluator loops with reproducible datasets, logs, and explicit failure states.

Knowledge work

Research repos

Keep evidence, methods, decisions, and open questions in one agent-readable workspace.

Personal builds

Long-running projects

Keep a side project moving across evenings, devices, agents, and context windows.

Electron knowledge baseRAG / provenanceBrowser gamesDeveloper toolingApplied AI prototypes
Section 01

Capability isn’t execution.

Before adding more model horsepower, understand the structural reasons an agent can fail inside a perfectly ordinary codebase.

01
01 · The problem

Same model. Different fate.

Bare environment prompt-only

  • Vague requirements become guesses.
  • Implicit conventions remain invisible.
  • The agent spends context on setup and discovery.
  • “Done” can mean “I wrote code”.
  • The next session starts without durable context.

Harnessed environment rules-first

  • The repo contains the operating map.
  • One feature has an explicit boundary.
  • Init proves the environment is ready.
  • Verification is executable and independent.
  • Clean state makes continuation cheap.
$920 min bare run, as reported in the repo’s Anthropic example
$2006 hour harnessed run, same model and task
Cost efficiency and reliability are separate decisions

The lesson is not “spend more”. It is that a harness changes what the model can reliably do, while also making the extra runtime visible as a trade-off.

Source: Lecture 01
01 · Diagnose before you upgrade

Most failures have a layer.

Task“Add search” is underspecified: the agent must invent behaviour, scope, and acceptance criteria.
ContextArchitecture decisions live in Slack, tickets, or someone’s head instead of the repo.
EnvironmentDependencies, versions, services, or test setup are incomplete or undocumented.
VerificationThe agent can inspect its own work but has no independent proof that the system works.
StateA new session loses decisions, changed files, test state, and the next safe action.

Use the layer as a diagnostic label. “The model is dumb” is a weak post-mortem; “verification gap in the export path” is a fixable one.

01 · The method

Turn every failure into a harness upgrade.

ExecuteRun the same task in the real workspace.
ObserveCapture actual output, tests, diffs, and runtime state.
AttributeMap the failure to a harness layer.
RepairAdd the missing context, constraint, or check.
Example

Agent declares export “done”

Independent smoke run shows the path is wrong. The repair is not a stronger prompt: add an end-to-end export check and make it part of the stopping condition.

Measure

Track the verification gap

Record how often the agent says “done” before an independent check agrees. The gap tells you where the harness is weak.

Section 02

Build the environment around the model.

A harness is not one giant prompt. It is a set of cooperating subsystems that make work legible, bounded, and testable.

02
02 · The definition

Five subsystems. One reliable path.

Instructions

Give the agent a map, not an encyclopaedia.

Root guidance should explain the project, stack, first-run commands, hard constraints, and where deeper docs live. Progressive disclosure keeps task-relevant context close without making the root file unmanageable.

Source: Lecture 02
02 · Instructions + context

If the agent can’t see it, it effectively doesn’t exist.

Humans can ask colleagues, search Slack, or remember a conversation. An agent’s practical world is the task, the files it can read, and the tool output it can observe.

Make the repository an executable map of the project: what it is, how it is shaped, how to change it, and how to prove the change.

project/
├── AGENTS.md # map + invariants
├── docs/ # progressive detail
│ ├── architecture.md
│ └── decisions/
├── feature_list.json # scope + done
├── progress.md # session state
├── init.sh # initialise + verify
└── src/
Source: Lecture 03
02 · Instruction architecture

A root file should be a directory page.

Giant manual failure mode

  • Every new mistake becomes another rule.
  • Relevant and irrelevant context mix together.
  • Critical constraints get buried.
  • Contradictions accumulate.

Progressive disclosure better pattern

  • Root file explains the project and points outward.
  • Domain rules live near the relevant code.
  • Deep references are loaded when needed.
  • The agent navigates a map instead of memorising an encyclopaedia.
# AGENTS.md — keep this short and navigable
1. Read docs/architecture.md before changing boundaries
2. Work on one feature from feature_list.json
3. Run ./init.sh, then the feature’s verification commands
4. Update progress.md and leave a clean handoff
Source: Lecture 04
02 · State

Context windows end. The project shouldn’t.

Session AExplore → decide → modify → verify
PersistProgress, decisions, changed files, test state
Session BRead handoff → continue the unfinished slice
Progress log

What happened?

Record the current feature, completed work, open issues, and the last verification result.

Feature state

What is next?

Keep task status machine-readable so scheduling, verification, and handoff share the same source.

Git history

What changed?

Use commits as durable checkpoints and a clean restart path, not as a substitute for a progress note.

Source: Lecture 05
02 · Lifecycle

Reliability has an entrance and an exit.

Initialise

Install or check dependencies, inspect project state, and run baseline verification before implementation.

Implement

Work on one bounded feature. Keep the runtime observable while the agent makes changes.

Verify

Run the checks that count, including the full pipeline where boundaries can fail.

Handoff

Update state, document unfinished work, remove temporary debris, and leave the next session a clean start.

$ ./init.sh
# environment OK
# baseline tests pass
# app starts in smoke mode

$ ./verify.sh
# feature checks pass
# end-to-end flow pass

$ git status --short
# only intended files changed
02 · Scope

“Done” needs a shape.

Agents overreach when the task boundary is fuzzy. They under-finish when completion is a feeling rather than a checklist.

One feature at a time. Explicit acceptance criteria. No rewriting the feature list to hide unfinished work.

{
  "id": "search-api",
  "status": "in_progress",
  "acceptance": [
    "GET /api/search?q=...",
    "pagination defaults to 20",
    "pytest passes",
    "mypy --strict passes"
  ],
  "evidence": "verify.log"
}

The feature list is not just a project-management memo. In the repo’s model, it is shared infrastructure for the scheduler, verifier, and handoff reporter.

Section 03

Make correctness observable.

The agent’s confidence is not evidence. Design checks that expose the gap, then feed the result back into the next decision.

03
03 · Verification

“I’m done” is a claim, not a result.

Agent says doneSelf-assessment, often based on local confidence
Independent checkTests, smoke flow, evaluator, or human approval

Replace the agent’s feelings with externalised, execution-based verification.

A good definition of done is phrased so a command or independent evaluator can answer yes or no.

unitisolates a component
e2eproves the path works together
obsexplains why the path failed
Source: Lecture 09
03 · Verification

Unit tests are necessary. They are not the whole path.

RendererUI intent
PreloadBoundary contract
ServiceBusiness logic
RuntimeActual side effect
Unit

Fast signal

Does an isolated function or component behave as expected with its dependencies controlled?

Integration

Boundary signal

Do the real modules agree on data shape, paths, timing, and errors?

End to end

System signal

Can a user complete the actual flow, including startup, UI, services, and side effects?

Source: Lecture 10
03 · Observability

If you can’t see the runtime, you can’t steer it.

Expose the path

Capture what the next decision needs

commands executed and exit codes
files changed and important diffs
test / lint / build results
runtime errors and logs
what was tried, what remains
run_id: 2026-09-03T20:42Z
feature: search-api
changed: [src/api/search.ts, tests/search.test.ts]
tests: pass 18 / fail 1
failure: e2e path not mounted
next: inspect router registration

Observability turns retrying from blind wandering into a targeted correction.

Source: Lecture 11
03 · Evaluation

Don’t just add rules. Measure the marginal value.

Treat the harness as an experimental system. Remove one component at a time and observe what degrades.

This is an ablation study: it shows which mechanism matters for the current model, task, and repository.

BaselineSame task, same model, full harness.
AblateRemove one element: state, e2e check, scope file, or init step.
CompareCompletion, rework, intervention, time, cost, and failure attribution.
DecideKeep, redesign, or retire the mechanism based on observed value.

The repo’s useful warning: as models get stronger, some components may become less critical, while new bottlenecks emerge. A harness should evolve with evidence.

03 · Capstone

A real app gives the harness something real to prove.

Document listImport and manage local documents
IndexingProcess and index content
Q&A panelAsk questions over imported content
CitationsReturn grounded answers with evidence
Runtime

Electron + TypeScript + React

Main process, preload bridge, renderer, shared types, and services create meaningful boundaries.

Evolution

Each project becomes the next starter

The app stays constant while the harness grows from prompt-only to full workspace.

Learning value

Failures become visible

Import, index, retrieve, answer, and cite are testable paths with different failure modes.

Section 04

From harness to loops to graphs.

Once the environment is stable, the next design question is: who presses start, how often does work repeat, and where does control flow belong?

04
04 · Loop engineering

Move the start button up a level.

The first twelve lectures improve the agent’s workspace. Loop engineering changes the trigger: the system starts work from a goal, a schedule, or an event.

GoalThe end state the system should reach
+
VerificationIndependent evidence that the state is reached
+
Stopping conditionWhen to stop, retry, escalate, or spend the budget
=
LoopWork can progress without a human prompt at every step

Automation doesn’t remove control. It relocates control into explicit goals, budgets, permissions, feedback, and stopping rules.

Source: Lecture 13
04 · Choose the right loop

Does the work have an end?

Goal loop finite

  • Provide the desired end state.
  • Progress should accumulate.
  • Stop when verification passes or budget is exhausted.
  • Example: implement a payment system with test coverage.

Timer loop ongoing

  • Repeat a small action on an interval.
  • Each run can be independent.
  • Stop manually or when the task exits.
  • Example: check whether CI is broken every 15 minutes.

Rule of thumb: has an end → goal. No end, just keep watching → loop.

04 · Independent judgement

The person doing the work shouldn’t grade the work.

MakerPlan and implement the next bounded change
CheckerRun independent tests, review, or evaluator
FeedbackPass → advance. Fail → return targeted evidence.
Why it works

Separation creates pressure for evidence

The maker is rewarded for progress; the checker is responsible for correctness. The harness can keep the roles in one model, separate agents, deterministic scripts, or a human gate.

Design constraint

Feedback must be actionable

“It failed” is weak. “The router path is missing; add registration, rerun e2e” gives the maker a next move.

Source: Project 07
04 · Graph engineering

A loop is a graph with one node.

When a workflow needs specialisation, parallelism, shared state, verification, recovery, or human approval, make the hidden structure explicit.

ResearchLocate the problem and prepare a plan
ImplementWrite changes and tests
VerifyIndependent review + runtime checks
MergeCommit and update shared state

Failure routes back to implementation. Insufficient information routes back to research. Shared state carries requirements, notes, code, and results.

nodesedgesshared staterouting rulesrollbackhuman approval
Source: Lecture 14
04 · Critical reading

Durable pattern. Unsettled label.

The repository itself warns you not to confuse a useful design pattern with a viral term.

Its graph lecture fact-checks the “graph engineering” trend, calls out fabricated benchmark claims, and argues that graphs are often what complex loops become.

Keep

Explicit control flow

make handoffs visible
name shared state
define retry and rollback
add human approval where risk demands it
Question

Is the orchestration tax worth it?

Draw the graph when the structure reduces ambiguity or failure. Don’t add a graph because the word is fashionable.

Section 05

Implement the smallest useful harness.

Start with a repo contract and one verifiable feature. Earn complexity through observed failure, not enthusiasm.

05
05 · How-to · 01

Write the map before the mission.

Create AGENTS.md

Explain the project, architecture, conventions, first-run commands, non-negotiables, and links to deeper docs.

Make it navigable

Keep root guidance concise. Move domain-specific rules into docs/ or near the code they govern.

State the evidence

List the commands that count: tests, lint, type-check, build, smoke, and end-to-end flows.

# minimal AGENTS.md outline
## Project
## Architecture
## How to run
## How to verify
## Invariants
## Task workflow
## Deeper references
05 · How-to · 02

Move “what next?” out of the chat.

harness-state/
├── feature_list.json
├── progress.md
├── session-handoff.md
├── clean-state-checklist.md
└── decisions/

Choose one feature

Give it a bounded objective, acceptance criteria, and explicit dependencies.

Persist status

Track todo → in_progress → verified, plus evidence and remaining risk.

Write the handoff

End every session with the current state, changed files, checks run, and next safe action.

05 · How-to · 03

Make setup a first-class phase.

The agent should not spend the implementation session discovering that the project can’t install, build, or run.

install dependencies or validate the lockfile
check versions and required services
run baseline tests and type checks
start the app or smoke environment
record the known-good baseline
$ ./init.sh
→ checking runtime versions
→ installing dependencies
→ running baseline checks
→ starting smoke environment

READY  baseline verified
If this fails, fix the environment before the feature.
Source: Lecture 06
05 · How-to · 04

Make the agent earn its next move.

ImplementOne feature, one bounded diff
Run checksFast local checks first, full path where it matters
Read evidenceUse logs, failures, diffs, and runtime state
Advance or repairOnly verified work changes feature state
Failure policy

Retry with a reason

Every retry should name the observed failure and the harness layer being changed. Otherwise the loop repeats the same mistake more expensively.

Definition of done

Make it runnable

Translate “looks good” into commands, expected outputs, and a clear stopping condition.

05 · How-to · 05

Leave the next session a clean runway.

Session exit checklist
feature status reflects reality
tests and verification results are recorded
changed files are intentional
temporary debug artefacts are removed
unresolved issues are named
next action is safe and specific

The next session’s success is determined partly by the state you leave behind.

A commit is useful. A commit plus a truthful handoff is a restart path.

Source: Lecture 12
05 · How-to · 06

Earn automation through evidence.

Start manual

Run one bounded feature end to end. Learn where the agent fails and what evidence you need.

Automate a goal

Define the end state, independent verification, and stopping condition. Add a budget and escalation path.

Repeat a watch task

Use a timer loop for genuinely ongoing checks, not for a finite implementation task that needs cumulative state.

Draw the graph

When the loop contains parallel work, specialist roles, rollback, or approval, externalise nodes, edges, shared state, and routing.

Smallest useful progression: repo map → feature state → verification → clean handoff → goal loop → explicit graph.

05 · Starter kit

The four files that buy you leverage quickly.

01

AGENTS.md

The operating map: project, architecture, commands, invariants, references.

02

init.sh

Initialise, verify the baseline, and prepare a known-good runtime.

03

feature_list.json

Machine-readable scope, acceptance criteria, status, and evidence.

04

progress.md

Truthful session state, decisions, open issues, and handoff.

$ mkdir -p harness-state docs
$ touch AGENTS.md init.sh feature_list.json progress.md
$ ./init.sh
$ agent "implement the next verified feature"

The repository also provides a reusable skills/harness-creator/ skill with templates, scripts, and built-in eval cases for scaffolding and assessing harnesses.

Closing thought

Build the workspace that lets the model be right more often.

Before the next task
Can the agent find the architecture?
Can it run the real verification?
Is the feature boundary explicit?
Will another session know what happened?
Can a failure tell you what to fix?

The best first harness is not elaborate. It is honest, executable, and improved one failure at a time.

When an agent fails, inspect the environment before you swap the model.

Further reading

Go to the source.

Course repo

Learn Harness Engineering

README, projects, resource library, multilingual docs, and the harness-creator skill.

Use this deck

Share, fork, adapt

This is a self-contained HTML deck. Use the overview button to jump around, or the arrow keys to present it linearly.

Built from the repository’s English README and lecture/project material inspected on September 3, 2026. External claims are represented as reported by the repository unless separately linked above.

01 / 01