# Harness²

> Plug-and-play framework for recursive agent harnessing that refines an agent's prompts, tools, memory and skills per task with model weights fixed.

Harness² is an open-source Python framework from google-research for optimizing the harness around an AI model, meaning the prompts, tools, memory, skills and orchestration that let a model act as an agent. It keeps model weights fixed and refines the harness for each task, then carries lessons forward to later tasks. The release supports OpenCode and Codex executors and runs against the JobBench, LAB and WorkBuddy-Bench benchmarks. The repository states it is not an officially supported Google product.

## What It Is

Harness² is a framework for recursive agent harnessing in an open world, where agents meet tasks that were not anticipated when the harness was designed. It exposes eight editable components around the model: system prompt, guardrails, memory, tool guidance, subagents, skills, scripts and plugins. These control context construction, the tool interface, delegation and behavior inside the tool loop.

## How the recursion works

Task-level recursion uses a contrastive Propose–Probe–Compose step. Edits are proposed, their effects are probed on the same task, and a refined harness is composed from behavioral contrasts between executions, without ground-truth feedback. Harnessing-level recursion updates a persistent improvement harness with adopted harnesses and evidence-supported lessons from each task to guide future refinement.

Task-level recursion can be scaled in two modes. Parallel mode probes K general and K domain-specific candidates and produces K compositions. Sequential mode carries the refined harness and accumulated evidence through K successive steps.

## Running it

The documented setup uses Linux, Python 3.12 and uv. A local demo runs both recursion modes with deterministic editors and real Python executions, and needs no model credentials. Model-backed benchmark runs need Node.js 20+, the Google Cloud CLI and a Vertex AI configuration. LAB also needs Pandoc and Poppler, and WorkBuddy-Bench needs Docker. Commands cover setup, checking, running, judging and reporting. Results are saved under runs/ and include task summaries, deliverables, adopted harnesses, reflection notes and evaluation results, and repeating a command resumes a run.

## Evidence and caveats

The authors report that a single Harness² step improves GLM-5 and Gemini 3.5 Flash over their base harnesses, with gains of up to 11.5 points on WorkBuddy-Bench, 4.5 points on JobBench and 11.8 percentage points on LAB's partial pass rate. The README warns that executor network access is unrestricted and Codex runs with its sandbox disabled, so network restrictions should be configured before evaluation.

## Features
- Task-level Propose–Probe–Compose harness refinement
- Harnessing-level persistent improvement harness
- Parallel and sequential recursion modes
- Eight editable harness components
- OpenCode and Codex executors
- JobBench, LAB and WorkBuddy-Bench support
- Local demo requiring no model credentials
- Judging and reporting commands
- Resumable runs with saved results
- Dry-run task selection preview

## Integrations
OpenCode, Codex, Vertex AI, Google Cloud CLI, Docker, Pandoc, Poppler, JobBench, LAB, WorkBuddy-Bench

## Platforms
LINUX, API, CLI

## Pricing
Open Source

## Links
- Website: https://github.com/google-research/harness2
- Documentation: https://github.com/google-research/harness2/blob/main/docs/SETUP.md
- Repository: https://github.com/google-research/harness2
- EveryDev.ai: https://www.everydev.ai/tools/harness2
