Skip to main content
skill Claude Code

agent-harness — Claude Code skill: what it does, how to install

Turns a goal into tasks with machine-run checks, then keeps the loop open until each task is verified or explicitly waived. Use it for work that needs a verifiable close.

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add alirezarezvani/claude-skills
/plugin install agent-harness@claude-code-skills
Open on GitHub

What agent-harness does

The skill compiles a goal into a task plan and executes one task at a time with tools from the selected domain. The controller runs each task's checks, caps retries, and escalates to a human when the budget runs out. It will not close the loop with unverified tasks.

The package includes domain manifests in JSON, a goal compiler, and a loop controller. The commands use python3; run state lives in .agent-harness/. Before compiling, define an observable outcome, choose a domain, set boundaries, name an escalation reviewer, and decide the iteration budget. Checks execute shell commands from the plan, so use only trusted plan and state files.

Install it when an agent needs to carry multi-step work through verification. For a single change with no separate checks, this loop adds process you may not need.

What it helps with

  • turn a goal into tasks with verifiable outcomes
  • run checks after each task
  • cap retries when a check fails
  • escalate to a human after budget exhaustion
  • keep unverified tasks from closing the loop

Example prompts for the agent

  • Run this payments service audit through the engineering harness and close only after verification.
  • Build a verifiable plan for this goal using the finance domain.
  • Check `.agent-harness/state.json` and tell me whether the loop can close.

How to install agent-harness

1Plugin marketplace

/plugin marketplace add alirezarezvani/claude-skills
/plugin install agent-harness@claude-code-skills

This installs the whole agent-harness plugin with all its skills

2Skills CLI (Vercel)

npx skills add alirezarezvani/claude-skills --skill agent-harness -a claude-code

3Manually: put the files in place

~/.claude/skills/agent-harness/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/agent-harness/

From the same set349

The whole set →
engineering-skills Alireza Rezvani An engineering skill index for Claude Code that helps you select one specialist SKILL.md for the task at hand. It covers architecture, testing, DevOps, and data work. Claude Code 2,387installs finance-skills Alireza Rezvani Routes ambiguous finance prompts to the right bundled skill: financial-analyst, saas-metrics-coach, or month-end-close. Claude Code 2,312installs marketing-skills Alireza Rezvani A directory and router for marketing skills in Claude Code. It picks the right specialist skill for SEO, content, CRO, channels, and related tasks. Claude Code 2,264installs business-growth-skills Alireza Rezvani Routes growth and revenue prompts to the right specialized skill across customer success, sales engineering, RevOps, and proposals in Claude Code. Claude Code 2,189installs engineering-advanced-skills Alireza Rezvani An index of 37 engineering skills for architecture, automation, reliability, and platform work. Use it when a project needs task-specific engineering workflows. Claude Code 2,019installs product-skills Alireza Rezvani Product work orchestrator for Claude Code. Routes queries across 16 domain lanes and validates discovery trees with deterministic scripts. Claude Code 1,994installs pm-skills Alireza Rezvani Routes project-delivery requests across 8 PM sub-skills for Jira, Confluence, sprints, reporting, and team communication. Useful for controlled delivery work. Claude Code 1,975installs senior-backend Alireza Rezvani Scaffolds backend APIs, detects database bottlenecks, and runs load tests. Useful when designing Express routes, optimizing PostgreSQL, or preparing for production. Claude Code 1,674installs

Similar

pester-migration official github Walks a Pester suite through the next major version and gets it passing again. Useful when bumping the module breaks your *.Tests.ps1 files. GitHub Copilot 25installs application-integration-authoring official google Manage Google Cloud Application Integration versions through the REST API or Python client. Use it to publish workflows and promote versions across environments. Claude Code Gemini CLI CX Codex 16installs pester-should-migration official github Converts classic Pester v5 Should -Be assertions to the Pester v6 Should-Be syntax without spaces. Designed for modernizing PowerShell test suites. GitHub Copilot 19installs game-playtest official OpenAI Guides agents through browser game playtests and frontend QA. It focuses on boot checks, controls, HUD overlay balance, and visual regression capture. CX Codex GP ChatGPT 62installs build-run-debug official OpenAI Build, launch, and debug macOS apps through a shell-first Xcode and Swift workflow when startup or runtime failures need investigation. CX Codex GP ChatGPT 60installs swiftpm-macos official OpenAI Builds, runs, and tests SwiftPM macOS packages and executables. Use it when Package.swift is the main entry point and no Xcode project is present. CX Codex GP ChatGPT 58installs improve-codebase-architecture Matt Pocock This skill scans a codebase for architectural friction, then builds a visual HTML report with refactoring candidates. Use it before a deeper architecture review. Claude Code 1,163,035installs design-taste-frontend Leonxlnx This skill directs the design of public pages and work screens, then checks the result in a browser through screenshots. Use it when an interface feels generic or unfinished. Claude Code CX Codex Cursor +1 673,100installs

Questions about agent-harness

How do I install agent-harness in Claude Code?

Add the marketplace with /plugin marketplace add alirezarezvani/claude-skills, then run /plugin install agent-harness@claude-code-skills.

What does agent-harness do?

It compiles a goal into a verifiable task plan, runs tasks one at a time, and checks their results. When limits are exhausted, it requires human review.

How does the controller verify a task?

The verify command runs checks from the manifest or plan as subprocesses and records evidence. A task cannot be marked verified without evidence.

Source text

SKILL.md · MIT
---
name: agent-harness
description: "Turn any domain folder of skills into a bounded agentic loop: compile a goal into a verifiable task plan, execute tasks with the domain's own tools, verify every task with machine-run checks, retry with caps, escalate to a human when budgets exhaust, and refuse to close until everything is verified or explicitly waived. Use when you want an agent or subagent to pick up a goal and drive it to a verified close across one of this repo's 18 domains ('run this goal through the engineering harness', 'set up an agentic loop for marketing work', 'make the finance domain self-verifying'). NOT for authoring Claude Code Workflow-tool .js scripts (workflow-builder), N-agent tournaments on one task (agenthub), single-file metric optimization (autoresearch-agent), or discovering published loop recipes (loop-library)."
---

# Agent Harness

You are a harness operator, not a hero. The loop — not your optimism — decides when work
is done. Your job: compile the goal into tasks with checks, execute one task at a time,
let the controller adjudicate verification, and stop when the state machine says stop.

## The contract

```
GOAL → goal_compiler → PLAN → loop_controller: [execute → verify]* → CLOSE
                                     ↑______retry (≤ max_attempts, changed approach)
                                     └── ESCALATE on exhausted budgets — never fake success
```

Three layers, all JSON: a committed per-domain **manifest** (what skills/tools/checks
exist), a per-goal **plan** (which tasks, which verifications, what "done" means), and a
per-run **state file** (the single source of truth; a fresh session resumes from it alone).

## Quick start

```bash
# 0. Pick the domain manifest (18 committed under assets/harnesses/, e.g. engineering-team.json)
ls assets/harnesses/

# 1. Compile the goal (refuses vague goals with exit 3 + forcing questions)
python3 scripts/goal_compiler.py \
  --goal "audit the payments service and design an SLO with an error budget" \
  --manifest assets/harnesses/engineering.json --out plan.json

# 2. Initialize the loop state
python3 scripts/loop_controller.py init --plan plan.json --state .agent-harness/state.json

# 3. Drive the loop — repeat until directive is "close" or "escalate"
python3 scripts/loop_controller.py next --state .agent-harness/state.json
#    → {"action": "execute", "task": "T1", ...}: open the task's skill (SKILL.md at
#      skill_path), do the work with its tools, then:
python3 scripts/loop_controller.py record --state .agent-harness/state.json \
  --task T1 --phase execute --exit-code 0
#    → the controller runs the task's checks ITSELF (subprocess, timeout, evidence log):
python3 scripts/loop_controller.py verify --state .agent-harness/state.json --task T1 --cwd <repo-root>

# 4. Close — refused (exit 4) while any task is unverified and unwaived
python3 scripts/loop_controller.py close --state .agent-harness/state.json
```

Regenerate a manifest after skills change (diff-stable, CI-checkable):

```bash
python3 scripts/harness_manifest_builder.py --domain engineering-team \
  --repo-root <repo-root> --out-dir assets/harnesses --no-timestamp
```

## Hard rules

1. **Never adjudicate your own verification.** `verify` runs the checks via subprocess;
   a passing `record --phase verify` without `--evidence` is rejected (exit 6). You do not
   get to declare a task verified.
2. **Never modify a gate you are judged by.** Check commands come from the manifest/plan.
   Editing a check to make it pass is the reward-hacking failure mode
   (see [references/verification_discipline.md](references/verification_discipline.md)) — same
   invariant as autoresearch-agent's locked evaluator.
3. **One task at a time, writes serialized.** Parallelize reading and judging, never two
   tasks writing the same artifact ([references/agentic_loop_canon.md](references/agentic_loop_canon.md)).
4. **Retry means a changed approach.** Same command + same input = same failure. The retry
   directive says so; honor it.
5. **Budgets are terminal states, not suggestions.** `max_attempts_per_task` → escalated
   (exit 2); `max_loop_iterations` → escalate (exit 5). Exhausted budgets are never
   reported as success — a human waives (`close --waive T3 --reason "..."`), you don't.
6. **Fresh context beats long context.** Every `next` directive is executable by a new
   session reading only the plan + state files. Long-running goals: run each iteration as
   its own session against the durable state.
7. **State lives in `.agent-harness/`** — never in `.agenthub/`, `.autoresearch/`, or
   `docs/TC/` (those belong to sibling skills).
8. **Plan and state files are a trust boundary.** `verify` shell-executes each task's
   check command; only run the harness on plan/state files you or `goal_compiler.py`
   produced, never on files from untrusted input (see
   [references/verification_discipline.md](references/verification_discipline.md)).

## Forcing questions (ask before compiling; one per turn, with a recommended answer)

| # | Question | Recommended answer | Why (canon) |
|---|---|---|---|
| 1 | What single observable outcome means DONE? | A named artifact + a command that exits 0 against it | Verifier's law: invest in verifiability first |
| 2 | Which domain harness applies? | The domain whose skills name the deliverable; if two, run two sequential loops | Orchestrator-workers: scoped objectives beat mega-goals |
| 3 | What must NOT change? | List no-touch paths; put them in the goal text so the compiler's plan inherits them | Boundaries are part of a subagent spec |
| 4 | Who reviews escalations, and how fast? | A named human; escalations block the loop by design | Approval-required is a terminal state, not a nuisance |
| 5 | What is the iteration budget? | Default 12 loop iterations / 3 attempts per task; raise only with a reason | Caps are runtime errors, not advice (OpenAI SDK `max_turns`) |

## Exit codes (branch on these mechanically)

| Code | Tool | Meaning |
|---|---|---|
| 0 | all | OK / directive emitted |
| 2 | loop_controller | Escalation required — a human must review the evidence log |
| 3 | goal_compiler | Goal too vague — answer the forcing questions, recompile |
| 4 | goal_compiler / loop_controller | No skill matched / close refused (unverified tasks) |
| 5 | loop_controller | Global iteration cap reached |
| 6 | loop_controller | Invalid transition (recording on verified task, evidence missing, unknown task) |

## Verifiable success

- `python3 scripts/harness_manifest_builder.py --sample`, `scripts/goal_compiler.py --sample`,
  and `scripts/loop_controller.py --sample` all exit 0.
- A vague goal (`--goal "make it better"`) exits 3 and prints forcing questions.
- `loop_controller.py close` on a state with an unverified task exits 4.
- The demo loop in `loop_controller.py --sample` shows a verify failure consuming an attempt
  and the loop still closing only after a passing verify with evidence.

## Related skills

- **workflow-builder**: authoring deterministic `.js` scripts for Claude Code's Workflow
  tool. NOT for goal-to-close loop state (this skill).
- **agenthub**: N parallel agents competing on ONE task in git worktrees. Use it *inside* a
  harness task that wants competing attempts.
- **autoresearch-agent**: metric optimization of a single file against a locked evaluator.
  Use it when a task's done_when is "metric improves".
- **tc-tracker**: per-code-change lifecycle records. Use for change bookkeeping; the harness
  state file is per-goal, not per-change.
- **loop-library**: discover/audit published loop recipes conversationally. This skill is the
  executable enforcement of that vocabulary.
- **ship-gate / self-eval / spec-driven-workflow**: plug in as close-time checks inside a
  task's `verification[]`.

See [references/domain_harness_design.md](references/domain_harness_design.md) for the
three-layer architecture, the reuse map, and how to raise a domain's harness quality.

© Alireza Rezvani · MIT · alirezarezvani/claude-skills

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor