Harness Skill
A GAN-inspired multi-agent development harness that decomposes complex software tasks into a
Planner → Generator ↔ Evaluator iteration loop, delivering high-quality output through
structured feedback cycles.
The Planner accepts both vague descriptions (which it expands via project exploration)
and detailed plans (which it faithfully translates into the three harness documents).
There is no separate "lite" mode.
Invocation
/harness <task description or detailed plan>
/harness --max-rounds 8 --threshold 9.5 --pass-k 3 --dir ./my-project <description>
Parameters
| Parameter |
Default |
Description |
<description> |
— |
Task description OR a detailed plan (any length) |
--max-rounds N |
10 |
Maximum generator↔evaluator iteration rounds |
--threshold N |
9.5 |
Score threshold (1-10) for pass^k evaluation |
--pass-k N |
3 |
Consecutive rounds above threshold to pass |
--dir PATH |
. |
Working directory for the project |
Spawning Policy (must follow)
All harness teammates (Planner, Generator, Evaluator) MUST be spawned with
mode: "bypassPermissions" on the Agent tool call. This prevents each file read / edit /
bash command from bouncing back to the team leader (you) for approval, which makes the
harness unusable. Example:
Agent({
subagent_type: "harness-planner",
team_name: "harness-<slug>",
name: "planner",
mode: "bypassPermissions",
prompt: "...",
})
The orchestrator (you) stays in the default permission mode — only the spawned teammates
run in bypass. The user has already opted into this by invoking /harness.
Execution Flow
When this skill is invoked, the orchestrator (you) must follow these steps exactly.
Step 0: Setup
- Parse arguments: extract
--max-rounds, --threshold, --pass-k, --dir, and the
task description.
- Determine the project working directory (
PROJECT_DIR).
- Classify the input as
detailed or vague:
detailed if the description contains a structured plan (numbered steps, file-level
decisions, explicit acceptance criteria, ≥ ~200 words of concrete direction, or
references "the plan above" / "Plan Mode" / a pasted plan block).
vague otherwise (1-4 sentences of intent without implementation detail).
- When in doubt, treat as
vague.
- Record the classification in
state.json as input_mode.
- Team Lifecycle Cleanup: Before creating anything, check if you are currently leading
a team from a previous harness run. If so:
- Create a harness workspace directory:
$PROJECT_DIR/.harness/run-<YYYY-MM-DD>-<short-slug>/
Where <short-slug> is a 2-3 word kebab-case summary of the task (e.g., add-auth-system).
If the same slug already exists for today, append -2, -3, etc.
- Create a new git branch from the current branch:
git checkout -b harness/<short-slug>
- Initialize the harness state file at
.harness/run-<...>/state.json:{
"task": "<original description>",
"input_mode": "detailed" | "vague",
"max_rounds": 10,
"threshold": 9.5,
"pass_k": 3,
"current_round": 0,
"status": "planning",
"scores": [],
"consecutive_passes": 0,
"branch": "harness/<short-slug>"
}
- Ensure
.harness/ is in .gitignore. If missing, append it. The .harness/ directory
contains process documents only; it must not be committed.
Step 1: Planning Phase
Step 1a: Grading Criteria Confirmation (vague mode only)
If input_mode == "vague", use AskUserQuestion to confirm grading criteria before the
Planner runs:
- Dimension Selection (multiSelect): Present candidate dimensions based on project type
(Functionality, Code Quality, Design & UX, Testing & Reliability, Completeness,
Performance, Security, API Design).
- Weight Priority Order (single select): Propose 2-3 weight presets and let the user pick:
- "Functionality-first" — Functionality 35%, Code Quality 20%, Design 20%, Reliability 15%, Completeness 10%
- "UX-first" — Design & UX 30%, Functionality 25%, Completeness 20%, Code Quality 15%, Reliability 10%
- "Balanced" — equal weights across selected dimensions
If input_mode == "detailed", skip this dialog — the Planner uses sensible defaults
(Functionality 35%, Code Quality 25%, Completeness 25%, Reliability 15%). The user already
showed they want fast execution by providing a plan.
Step 1b: Spawn the Planner
Create a Team named harness-<short-slug> and spawn the Planner agent via the Agent
tool with:
subagent_type: "harness-planner"
team_name: "harness-<short-slug>"
name: "planner"
mode: "bypassPermissions" — required
- Prompt containing:
task, project_dir, harness_dir, input_mode,
user_dimensions (if asked), user_weights (if asked).
The Planner will write three files and then stop:
spec.md — Full product/feature specification
criteria.md — Grading criteria
contract.md — What "done" means, how success is verified
The Planner does NOT enter Plan Mode, does NOT write code, and does NOT spawn any other
agents. If the Planner starts drifting into implementation, send a shutdown and respawn.
Step 1c: Confirm with user (vague mode only)
If input_mode == "vague", after the Planner finishes, show the user a one-paragraph
summary of the spec and ask for confirmation before proceeding. The user may adjust scope.
If input_mode == "detailed", skip confirmation and proceed — the plan was already the
user's.
Step 1.5: Alignment Phase (Generator ↔ Evaluator)
Before coding begins, Generator and Evaluator align on approach.
- Spawn Generator and Evaluator as teammates in the same team, both with
mode: "bypassPermissions".
- Generator reads
spec.md, criteria.md, contract.md, then writes
implementation-plan.md:
- Proposed technical architecture and key design decisions
- File-by-file implementation plan
- Dependency choices and rationale
- Risk areas and mitigation
- Proposed round-by-round delivery breakdown
- Evaluator reviews and writes
alignment-review.md:
- Agreement / disagreement on architecture
- Concerns about testability or verifiability
- Suggested changes
- How they will evaluate each deliverable
- If concerns are raised, Generator revises until both agree. Orchestrator facilitates.
In input_mode == "detailed", this phase can be compressed: Generator writes a short
implementation-plan.md that restates the user's plan in the template's shape, and
Evaluator confirms in a brief alignment-review.md. Do not drag out negotiation if the
user already specified the approach.
Step 2: Iteration Phase (Generator ↔ Evaluator)
Each iteration round:
Generator reads spec.md, criteria.md, contract.md, and any previous
feedback-round-N.md, then:
- Implements the next chunk of work
- Writes
progress-round-N.md
- Commits with message
harness: round N - <summary>
Evaluator reads criteria.md, contract.md, progress-round-N.md, and inspects
the actual code/output.
- Web: start the app, drive with Puppeteer/Playwright
- API: curl endpoints
- Library/CLI: run tests, invoke commands
- Scores each dimension (1-10)
- Writes
evaluation-round-N.md (scores + analysis) and feedback-round-N.md
(actionable items).
Check termination (pass^k model):
pass^k = Generator must achieve k consecutive rounds above threshold.
After each Evaluator round, update state.json:
- If this round's weighted avg >= threshold: increment
consecutive_passes
- Else: reset
consecutive_passes to 0
Then check IN ORDER:
a. PASS (Stable): consecutive_passes >= pass_k → proceed to Step 3.
b. PASS (Approaching): avg >= threshold but consecutive_passes < pass_k →
tell Generator: "Score is above threshold ({score}/{threshold}),
{consecutive_passes}/{pass_k} consecutive passes achieved. Maintain quality for
{remaining} more round(s)." Continue.
c. STOP: current_round >= max_rounds → proceed to Step 3.
d. PLATEAU: scores changed < 0.3 for 2+ rounds AND below threshold → Evaluator
suggests pivot.
e. FAIL: below threshold → continue to next round.
Update state.json after each round.
Report progress to user after each round: round number, scores, key feedback points.
Step 3: Delivery
- Generator does a final cleanup pass if needed.
- Commit all remaining changes.
- Attempt to rebase the harness branch onto the base branch:
git rebase <base-branch>
- If conflicts arise, pause and ask the user.
- Do NOT force-push or discard changes.
- Write
summary.md:
- Report final results to the user.
- Team Shutdown (exact sequence):
a. Send
shutdown_request to ALL active teammates and wait for shutdown_approved.
b. Wait for teammate_terminated confirmations.
c. Call TeamDelete.
d. If TeamDelete fails, manually clean up:rm -rf ~/.claude/teams/harness-<slug> ~/.claude/tasks/harness-<slug>
e. Verify cleanup before reporting done.
The user can then review the branch and merge at their discretion.
Harness Workspace Structure
$PROJECT_DIR/.harness/
└── run-2026-03-28-add-auth-system/
├── state.json # Harness state tracking
├── spec.md # Product specification (from Planner)
├── criteria.md # Grading criteria (from Planner)
├── contract.md # Sprint contract (from Planner)
├── implementation-plan.md # Generator's technical plan
├── alignment-review.md # Evaluator's review of the plan
├── progress-round-1.md # Generator progress report
├── evaluation-round-1.md # Evaluator scores + analysis
├── feedback-round-1.md # Actionable feedback for Generator
├── ...
└── summary.md # Final delivery summary
Agent Definitions
Defined in ~/.agents/skills/harness/agents/:
planner.md — Translates task (vague or detailed) into spec + criteria + contract
generator.md — Implements features iteratively
evaluator.md — Tests and scores against criteria
Important Notes
- All teammates spawn with
mode: "bypassPermissions". Never spawn without it; the
harness becomes unusable when every tool call prompts the leader.
- Planner never writes code — it only produces
spec.md, criteria.md, contract.md.
It does not use Plan Mode. If it starts implementing, shut it down and respawn.
- The Planner auto-adapts to vague vs detailed input — no separate skill needed.
- Each harness run gets its own git branch (
harness/<slug>).
.harness/ is gitignored — process documents only, not deliverables.
- Generator and Evaluator MUST align via
implementation-plan.md before coding (Step 1.5).
- Grading dimensions/weights are user-confirmed for vague inputs; defaulted for detailed.
- Default:
--threshold 9.5 --pass-k 3 --max-rounds 10.
Agent Naming Convention
Always use consistent, simple names across runs:
planner — never planner2, planner3, etc.
generator — never generator2, etc.
evaluator — never evaluator2, etc.
Each harness run MUST start with a clean team (Step 0.4).
Team Lifecycle
TeamCreate → [spawn agents in bypassPermissions mode] → [work] → [shutdown all] → TeamDelete
Never leave a team alive between runs. Cleanup in Step 3; verify in Step 0 before starting.
1---2name: harness3description: Launch a multi-agent harness (Planner + Generator + Evaluator, pass^k reliability) to iteratively build and deliver high-quality software. Accepts either a vague task description OR a detailed pre-written plan — the Planner auto-detects and adapts.4---56# Harness Skill78A GAN-inspired multi-agent development harness that decomposes complex software tasks into a9Planner → Generator ↔ Evaluator iteration loop, delivering high-quality output through10structured feedback cycles.1112The Planner accepts both **vague descriptions** (which it expands via project exploration)13and **detailed plans** (which it faithfully translates into the three harness documents).14There is no separate "lite" mode.1516## Invocation1718```19/harness <task description or detailed plan>20/harness --max-rounds 8 --threshold 9.5 --pass-k 3 --dir ./my-project <description>21```2223### Parameters2425| Parameter | Default | Description |26|------------------|---------|------------------------------------------------|27| `<description>` | — | Task description OR a detailed plan (any length) |28| `--max-rounds N` | 10 | Maximum generator↔evaluator iteration rounds |29| `--threshold N` | 9.5 | Score threshold (1-10) for pass^k evaluation |30| `--pass-k N` | 3 | Consecutive rounds above threshold to pass |31| `--dir PATH` | `.` | Working directory for the project |3233## Spawning Policy (must follow)3435**All harness teammates (Planner, Generator, Evaluator) MUST be spawned with36`mode: "bypassPermissions"`** on the Agent tool call. This prevents each file read / edit /37bash command from bouncing back to the team leader (you) for approval, which makes the38harness unusable. Example:3940```41Agent({42 subagent_type: "harness-planner",43 team_name: "harness-<slug>",44 name: "planner",45 mode: "bypassPermissions",46 prompt: "...",47})48```4950The orchestrator (you) stays in the default permission mode — only the spawned teammates51run in bypass. The user has already opted into this by invoking `/harness`.5253## Execution Flow5455When this skill is invoked, the orchestrator (you) must follow these steps exactly.5657### Step 0: Setup58591. Parse arguments: extract `--max-rounds`, `--threshold`, `--pass-k`, `--dir`, and the60 task description.612. Determine the project working directory (`PROJECT_DIR`).623. **Classify the input** as `detailed` or `vague`:63 - `detailed` if the description contains a structured plan (numbered steps, file-level64 decisions, explicit acceptance criteria, ≥ ~200 words of concrete direction, or65 references "the plan above" / "Plan Mode" / a pasted plan block).66 - `vague` otherwise (1-4 sentences of intent without implementation detail).67 - When in doubt, treat as `vague`.68 - Record the classification in `state.json` as `input_mode`.694. **Team Lifecycle Cleanup**: Before creating anything, check if you are currently leading70 a team from a previous harness run. If so:71 - Send shutdown requests to ALL active teammates and wait for confirmation72 - Call `TeamDelete` to cleanly remove the old team73 - If `TeamDelete` fails, manually remove the team directories:74 ```75 rm -rf ~/.claude/teams/<old-team-name> ~/.claude/tasks/<old-team-name>76 ```77 - Only proceed after the old team is fully cleaned up.785. Create a harness workspace directory:79 ```80 $PROJECT_DIR/.harness/run-<YYYY-MM-DD>-<short-slug>/81 ```82 Where `<short-slug>` is a 2-3 word kebab-case summary of the task (e.g., `add-auth-system`).83 If the same slug already exists for today, append `-2`, `-3`, etc.846. Create a new git branch from the current branch:85 ```86 git checkout -b harness/<short-slug>87 ```887. Initialize the harness state file at `.harness/run-<...>/state.json`:89 ```json90 {91 "task": "<original description>",92 "input_mode": "detailed" | "vague",93 "max_rounds": 10,94 "threshold": 9.5,95 "pass_k": 3,96 "current_round": 0,97 "status": "planning",98 "scores": [],99 "consecutive_passes": 0,100 "branch": "harness/<short-slug>"101 }102 ```1038. Ensure `.harness/` is in `.gitignore`. If missing, append it. The `.harness/` directory104 contains process documents only; it must not be committed.105106### Step 1: Planning Phase107108#### Step 1a: Grading Criteria Confirmation (vague mode only)109110If `input_mode == "vague"`, use `AskUserQuestion` to confirm grading criteria before the111Planner runs:1121131. **Dimension Selection** (multiSelect): Present candidate dimensions based on project type114 (Functionality, Code Quality, Design & UX, Testing & Reliability, Completeness,115 Performance, Security, API Design).1162. **Weight Priority Order** (single select): Propose 2-3 weight presets and let the user pick:117 - "Functionality-first" — Functionality 35%, Code Quality 20%, Design 20%, Reliability 15%, Completeness 10%118 - "UX-first" — Design & UX 30%, Functionality 25%, Completeness 20%, Code Quality 15%, Reliability 10%119 - "Balanced" — equal weights across selected dimensions120121If `input_mode == "detailed"`, **skip this dialog** — the Planner uses sensible defaults122(Functionality 35%, Code Quality 25%, Completeness 25%, Reliability 15%). The user already123showed they want fast execution by providing a plan.124125#### Step 1b: Spawn the Planner126127Create a Team named `harness-<short-slug>` and spawn the **Planner** agent via the Agent128tool with:129- `subagent_type: "harness-planner"`130- `team_name: "harness-<short-slug>"`131- `name: "planner"`132- `mode: "bypassPermissions"` — **required**133- Prompt containing: `task`, `project_dir`, `harness_dir`, `input_mode`,134 `user_dimensions` (if asked), `user_weights` (if asked).135136The Planner will write three files and then stop:137- `spec.md` — Full product/feature specification138- `criteria.md` — Grading criteria139- `contract.md` — What "done" means, how success is verified140141**The Planner does NOT enter Plan Mode, does NOT write code, and does NOT spawn any other142agents.** If the Planner starts drifting into implementation, send a shutdown and respawn.143144#### Step 1c: Confirm with user (vague mode only)145146If `input_mode == "vague"`, after the Planner finishes, show the user a one-paragraph147summary of the spec and ask for confirmation before proceeding. The user may adjust scope.148149If `input_mode == "detailed"`, skip confirmation and proceed — the plan was already the150user's.151152### Step 1.5: Alignment Phase (Generator ↔ Evaluator)153154Before coding begins, Generator and Evaluator align on approach.1551561. **Spawn Generator and Evaluator** as teammates in the same team, both with157 `mode: "bypassPermissions"`.1582. **Generator** reads `spec.md`, `criteria.md`, `contract.md`, then writes159 `implementation-plan.md`:160 - Proposed technical architecture and key design decisions161 - File-by-file implementation plan162 - Dependency choices and rationale163 - Risk areas and mitigation164 - Proposed round-by-round delivery breakdown1653. **Evaluator** reviews and writes `alignment-review.md`:166 - Agreement / disagreement on architecture167 - Concerns about testability or verifiability168 - Suggested changes169 - How they will evaluate each deliverable1704. If concerns are raised, Generator revises until both agree. Orchestrator facilitates.171172In `input_mode == "detailed"`, this phase can be **compressed**: Generator writes a short173`implementation-plan.md` that restates the user's plan in the template's shape, and174Evaluator confirms in a brief `alignment-review.md`. Do not drag out negotiation if the175user already specified the approach.176177### Step 2: Iteration Phase (Generator ↔ Evaluator)178179Each iteration round:1801811. **Generator** reads `spec.md`, `criteria.md`, `contract.md`, and any previous182 `feedback-round-N.md`, then:183 - Implements the next chunk of work184 - Writes `progress-round-N.md`185 - Commits with message `harness: round N - <summary>`1861872. **Evaluator** reads `criteria.md`, `contract.md`, `progress-round-N.md`, and inspects188 the actual code/output.189 - Web: start the app, drive with Puppeteer/Playwright190 - API: curl endpoints191 - Library/CLI: run tests, invoke commands192 - Scores each dimension (1-10)193 - Writes `evaluation-round-N.md` (scores + analysis) and `feedback-round-N.md`194 (actionable items).1951963. **Check termination (pass^k model):**197198 pass^k = Generator must achieve `k` consecutive rounds above threshold.199200 After each Evaluator round, update `state.json`:201 - If this round's weighted avg >= threshold: increment `consecutive_passes`202 - Else: reset `consecutive_passes` to 0203204 Then check IN ORDER:205206 a. **PASS (Stable)**: `consecutive_passes >= pass_k` → proceed to Step 3.207 b. **PASS (Approaching)**: avg >= threshold but `consecutive_passes < pass_k` →208 tell Generator: "Score is above threshold ({score}/{threshold}),209 {consecutive_passes}/{pass_k} consecutive passes achieved. Maintain quality for210 {remaining} more round(s)." Continue.211 c. **STOP**: `current_round >= max_rounds` → proceed to Step 3.212 d. **PLATEAU**: scores changed < 0.3 for 2+ rounds AND below threshold → Evaluator213 suggests pivot.214 e. **FAIL**: below threshold → continue to next round.2152164. Update `state.json` after each round.2175. Report progress to user after each round: round number, scores, key feedback points.218219### Step 3: Delivery2202211. Generator does a final cleanup pass if needed.2222. Commit all remaining changes.2233. Attempt to rebase the harness branch onto the base branch:224 ```225 git rebase <base-branch>226 ```227 - If conflicts arise, **pause and ask the user**.228 - Do NOT force-push or discard changes.2294. Write `summary.md`:230 - Final scores231 - Total rounds used232 - Key decisions made233 - What was delivered234 - Reliability metrics:235 ```236 ## Reliability Metrics (pass^k)237 - Threshold: X.X238 - Required consecutive passes (k): N239 - Rounds played: N240 - Rounds above threshold: M241 - Max consecutive passes achieved: N242 - pass^k achieved: YES/NO (round N)243 - Score trend: improving / stable / declining / volatile244 - Final score: X.XX (round N)245 ```2465. Report final results to the user.2476. **Team Shutdown** (exact sequence):248 a. Send `shutdown_request` to ALL active teammates and wait for `shutdown_approved`.249 b. Wait for `teammate_terminated` confirmations.250 c. Call `TeamDelete`.251 d. If `TeamDelete` fails, manually clean up:252 ```253 rm -rf ~/.claude/teams/harness-<slug> ~/.claude/tasks/harness-<slug>254 ```255 e. Verify cleanup before reporting done.256257The user can then review the branch and merge at their discretion.258259## Harness Workspace Structure260261```262$PROJECT_DIR/.harness/263└── run-2026-03-28-add-auth-system/264 ├── state.json # Harness state tracking265 ├── spec.md # Product specification (from Planner)266 ├── criteria.md # Grading criteria (from Planner)267 ├── contract.md # Sprint contract (from Planner)268 ├── implementation-plan.md # Generator's technical plan269 ├── alignment-review.md # Evaluator's review of the plan270 ├── progress-round-1.md # Generator progress report271 ├── evaluation-round-1.md # Evaluator scores + analysis272 ├── feedback-round-1.md # Actionable feedback for Generator273 ├── ...274 └── summary.md # Final delivery summary275```276277## Agent Definitions278279Defined in `~/.agents/skills/harness/agents/`:280- `planner.md` — Translates task (vague or detailed) into spec + criteria + contract281- `generator.md` — Implements features iteratively282- `evaluator.md` — Tests and scores against criteria283284## Important Notes285286- **All teammates spawn with `mode: "bypassPermissions"`.** Never spawn without it; the287 harness becomes unusable when every tool call prompts the leader.288- **Planner never writes code** — it only produces `spec.md`, `criteria.md`, `contract.md`.289 It does not use Plan Mode. If it starts implementing, shut it down and respawn.290- The Planner auto-adapts to vague vs detailed input — no separate skill needed.291- Each harness run gets its own git branch (`harness/<slug>`).292- `.harness/` is gitignored — process documents only, not deliverables.293- Generator and Evaluator MUST align via `implementation-plan.md` before coding (Step 1.5).294- Grading dimensions/weights are user-confirmed for vague inputs; defaulted for detailed.295- Default: `--threshold 9.5 --pass-k 3 --max-rounds 10`.296297### Agent Naming Convention298299Always use consistent, simple names across runs:300- `planner` — never `planner2`, `planner3`, etc.301- `generator` — never `generator2`, etc.302- `evaluator` — never `evaluator2`, etc.303304Each harness run MUST start with a clean team (Step 0.4).305306### Team Lifecycle307308```309TeamCreate → [spawn agents in bypassPermissions mode] → [work] → [shutdown all] → TeamDelete310```311312Never leave a team alive between runs. Cleanup in Step 3; verify in Step 0 before starting.