Cheat sheet

Agent harness cheat sheet: components, files, problems and a launch checklist

Updated: · Skillaria.Top

An agent harness consists of five subsystems: instructions, tools, environment, state and feedback. The minimal set of files is an AGENTS.md as a short router, a check script (make check, verify.sh), a progress file and a feature list with statuses; the readiness status is set by a script, not by the agent.

Five harness subsystems

SubsystemWhat it isArtifactsSymptom of breakdown
InstructionsWhat the agent must know about the projectAGENTS.md / CLAUDE.md, skills, docs/, ADRsBreaks known conventions
ToolsWhat the agent can doshell, tests, linter, browser, MCP servers"Wants to, but cannot"
EnvironmentWhere the agent workslock files, Docker/devcontainer, git worktree, sandbox, init.shThe session starts with fixing the environment
StateWhat survives a restartPROGRESS.md, DECISIONS.md, feature_list.json, commitsA new session does not know where things stopped
FeedbackHow the agent learns about a mistakemake check, E2E, hooks, arch-check, evaluator"Done", but it does not work

Order for building from scratch: feedback → instructions → state → environment → tools.

Harness files

FilePurposeRule
AGENTS.md / CLAUDE.mdEntry point: what the project is, how to run it, how to check itA short router (about 80 lines), links to docs with the condition "when to read"
docs/*.mdDetails by topicRead on demand, not in full
.claude/skills/*/SKILL.mdRepeatable procedures (deploy, review)Loaded when the task matches the description
PROGRESS.mdState, what is done, blockers, next stepsUpdate at the end of every session
DECISIONS.mdDecision, reason, rejected optionsRecord the path, not only the conclusion
feature_list.jsonFeatures: behavior, verification, stateExactly one feature active (WIP=1)
scripts/verify.shChecks a feature and moves it to passingThe only one who sets passing, with the commit SHA
scripts/arch-check.shArchitectural boundariesExit code 1 + WHY and FIX in the output
scripts/init.shEnvironment check before workEnvironment, clean git, green make check, an active feature
sprint contractA contract for a feature before the codeIn scope / out of scope / open questions
.claude/settings.jsonClaude Code permissions and hooksChecks on events, not in the agent's memory

AGENTS.md skeleton

# Project: payment backend (FastAPI, PostgreSQL)

## Run
docker compose up -d && ./scripts/init.sh

## Check
make check   # lint, types, unit, arch-check
make e2e     # end-to-end scenarios

## Definition of Done
- make check and make e2e — exit code 0
- feature moved to passing by the scripts/verify.sh script
- PROGRESS.md updated

## MUST
- database queries only through repositories
- secrets only from environment variables

## Documents
- docs/payments.md — when the task touches payments and refunds
- docs/migrations.md — when the database schema changes

Feature states

StateMeaningWho changes it
pendingIn the queuePlanner
activeIn progress (only one)Agent at start
passingCheck passedOnly verify.sh
blockedNeeds a human decisionAgent with a description of the reason

Verification levels

LevelWhatWhen
1Lint, typesAlways
2Unit and integration testsAlways
3E2EA change spanning more than one layer; before "done"
4arch-checkNew cross-layer imports

The right to say "done" comes only after the top level. Green unit tests are not readiness.

Making rules mechanical

LevelToolCost
grep guardA script that searches for a pattern and prints WHY/FIXMinutes
Linter ruleimport-linter (Python), dependency-cruiser, eslint-plugin-boundaries (JS/TS)An hour
Architecture testA CI test that fails when layers are violatedMore work, but visible in make check
#!/usr/bin/env bash
fail=0
if grep -rn "from app.db" app/services/; then
  echo "WHY: services do not access the database directly"
  echo "FIX: use a repository from app/repositories/"
  fail=1
fi
exit $fail

Common problems and fixes

ProblemSubsystemFix
A rule in CLAUDE.md is not followedInstructionsShorten the file, turn the rule into a check or a hook
The agent cannot run the testsToolsAllow the command, install the dependencies in the image
Different behavior on different machinesEnvironmentLock files, Docker/devcontainer, pinned runtime versions
Amnesia between sessionsStatePROGRESS.md, a session handoff, reading it at the start of the session
Three features started, none finishedStateWIP=1 in feature_list.json
"Done", but it does not workFeedbackDoD, E2E, verify.sh, an independent evaluator
Tests are green, but the feature is brokenFeedbackE2E with a real database and configuration
The agent copies bad patternsFeedbackarch-check from day one
Unclear what the agent didStateSmall commits, a report in PROGRESS.md, DECISIONS.md
The agent broke the environment overnightEnvironmentSandbox, git worktree, checkpoints, rollback via init.sh
The same review comment twiceHarness overallTurn it into a check in make check, remove the text from the instructions

Roles for long tasks

RoleDoesDoes not
PlannerFeatures with acceptance criteriaDoes not write code
GeneratorImplements one feature, runs the testsDoes not decide whether it is done
EvaluatorA verdict by rubric, with references to a file, a line or a logDoes not see the generator's reasoning
MergeCommits when review == passThis is code, not an agent

Budget for autonomous work

  • The goal is one sentence (for example, bring all features to passing).
  • WIP=1, a time and attempt limit per feature.
  • The metric grows monotonically; a regression means an immediate rollback.
  • Migrations, infrastructure, money — escalate to a human.
  • After several failed reviews, start the feature with a clean context.

Agent launch checklist

  1. There is an AGENTS.md: stack, how to run, the check command, DoD.
  2. make check passes on a clean clone.
  3. The environment is reproducible: lock files, Docker or devcontainer.
  4. The agent has the commands it needs; dangerous ones are forbidden or sandboxed.
  5. There is an E2E test for at least the main scenario.
  6. There is a PROGRESS.md and a rule to read it at the start of the session.
  7. Features are in a list with statuses, exactly one active.
  8. The passing status is set by a script.
  9. Check messages contain WHY and FIX.
  10. The task is formulated with acceptance criteria and a scope boundary.
  11. It is defined what requires a human decision.
  12. The verification gap is measured before the changes, to have a baseline for comparison.

Harness metrics

MetricHow to count
Verification gapShare of "done" claims not confirmed by a check, over 10 tasks
MTTRTime from breakdown to restoring a working state
Cold startWhether a new session answers "where are we, what is next" without guessing
AblationDrop when one subsystem is disabled on a fixed set of tasks

In short

The harness is a loop, not a file: instructions, tools, environment, state and feedback. Start with checks, keep AGENTS.md short, give the readiness status to a script and review the harness regularly. All of this is assembled as a whole on an end-to-end project in the harness engineering course.

FAQ

How is AGENTS.md different from CLAUDE.md?

In purpose they are the same thing: an instructions file for the agent. CLAUDE.md is read by Claude Code, AGENTS.md is a common format for different agents; in CLAUDE.md you can simply reference AGENTS.md.

How many lines should AGENTS.md have?

There is no strict limit, but keep the entry file short — around a hundred lines, like a table of contents. Details are moved into separate documents.

Do I need feature_list.json for a small project?

Not for one-off edits. It pays off when the agent works on several features in a row or across several sessions.

Where should I keep secrets the agent needs access to?

In environment variables or a secrets manager, not in instruction files and not in code. The agent is given access to the environment, not to the values written in the text.

Learn this topic on video

This topic is covered in depth with practice in the course “Harness Engineering: Engineering Reliability for AI Agents”.

Go to course