Site icon Efficient Coder

Harness²: The Agent Framework That Improves Itself Without Changing Model Weights

Harness²: Recursive Agent Harnessing for an Open World

A harness is everything that sits around a model and turns it into an agent: prompts, tools, memory, skills, orchestration, and more. Harnessing is the work of improving that system. Harness² is a plug-and-play framework that lets the harness improve itself—while the model weights stay completely fixed.

It targets a real problem: agents keep meeting tasks that were never seen when the harness was first designed. Harness² connects two levels of recursion. Task-level recursion refines the execution harness for the current task through a contrastive Propose–Probe–Compose loop. Harnessing-level recursion then stores the adopted harness and evidence-backed lessons in a persistent improvement harness so future tasks start smarter.

What exactly is Harness² and what problem does it solve?

Harness² is a recursive harness-optimization framework that never touches model parameters. It only edits the system that surrounds the model.

Two layers work together:

  • Task-level recursion runs a Propose–Probe–Compose step. It proposes edits, probes their effect on the same task, and composes a refined harness from behavioral contrasts—without any ground-truth feedback.
  • Harnessing-level recursion updates a lasting improvement harness after every task with the adopted harness and the lessons that the evidence actually supports.

Together they let an agent keep getting better in an open world without a human redesigning the whole system for every new domain.

Across three professional benchmarks and four model–harness setups, a single Harness² step already lifts GLM-5 and Gemini 3.5 Flash above their base harnesses. Gains reach 11.5 points on WorkBuddy-Bench, 4.5 points on JobBench, and 11.8 percentage points on LAB’s partial pass rate. Raising the task-level recursion budget brings further improvement.

The released code supports both parallel and sequential recursion, OpenCode and Codex executors, and the three benchmarks JobBench, LAB, and WorkBuddy-Bench.

What are the eight editable harness components?

Harness² exposes eight components you can change:

  • system prompt
  • guardrails
  • memory
  • tool guidance
  • subagents
  • skills
  • scripts
  • plugins

They fall into clear roles. System prompt, guardrails, memory, and skills build context. Tool guidance and scripts define the tool interface. Subagents handle delegated work. Plugins control middleware. Together they decide how the agent thinks, calls tools, and collaborates inside the tool loop. You edit these pieces instead of retraining the model.

How do I install it and run the local demo?

You need Linux, Python 3.12, and uv. From the repository root:

uv venv --python 3.12 .venv
source .venv/bin/activate
uv pip install -e '.[render]'
harness2-demo --output runs/demo --k 2

The local demo runs both recursion modes with deterministic editors and real Python executions. No model credentials are required. It is the fastest way to see the full pipeline.

For model-backed benchmarks you also need Node.js 20+, the Google Cloud CLI, and the benchmark-specific dependencies. LAB needs Pandoc and Poppler; WorkBuddy-Bench needs Docker. Then configure the models:

cp .env.example .env
# Edit .env with your Vertex AI project and model IDs
gcloud auth application-default login

Full setup details—model settings, authentication alternatives, and the Codex executor—are in the setup guide.

How do I run a benchmark end-to-end?

Here is a complete example for LAB: install, check, refine one task, judge, and report.

harness2-setup lab
harness2-check --bench lab
harness2 --bench lab --k 1 --mode parallel \
  --only-domains antitrust-competition --max-tasks 1
harness2-judge --bench lab --k 1 --mode parallel
harness2-report --bench lab --k 1 --mode parallel

Use --mode sequential for sequential recursion. The flag --k sets the task-level recursion budget. Judging and reporting must use the exact same benchmark, executor, subset, --k, --mode, and seed as the refinement run. Add --dry-run to preview task selection without calling any model.

Benchmark Task type Install command Guide
JobBench Professional work harness2-setup jb JobBench guide
LAB Legal work harness2-setup lab LAB guide
WorkBuddy-Bench Office, web, and code harness2-setup wb WorkBuddy guide

Run only one benchmark per command. After setup, WorkBuddy also accepts --subset office, --subset web, or --subset code on every subsequent command.

Parallel versus sequential recursion—how should I choose?

Task-level recursion scales in two ways.

  • Parallel recursion probes multiple candidate harnesses at once (k general + k domain-specific) and then composes k refined harnesses from the shared evidence. It explores wider.
  • Sequential recursion carries the refined harness and the accumulated evidence through k successive Propose–Probe–Compose steps. It refines deeper.
Option Behavior
--k 1 One Propose–Probe–Compose step
--k K --mode parallel Probe K general and K domain candidates, then produce K compositions
--k K --mode sequential Refine the harness through K successive steps
--substrate cx Switch from the default OpenCode executor to Codex

After each task, harnessing-level recursion keeps the adopted harness and the evidence-supported lessons so the next task starts from a stronger baseline. Task selection, concurrency, reproducibility, and baseline comparisons are covered in the experiment guide.

What about web access during evaluation?

Executor network access is unrestricted by default, and Codex runs with its sandbox disabled. Public benchmark rubrics may be reachable online. Before any evaluation, configure the network restrictions described in the experiment guide so the agent cannot read answers or grading criteria.

Where are results stored and how do I resume?

Everything lands under runs/, organized by benchmark and subset. You get task summaries, deliverables, adopted harnesses, reflection notes, and evaluation results.

Repeat the same command to resume. When you change models or task selection, set a new HARNESS2_RUNS_DIR. Full details on results and resume are in the experiment guide; every command also supports --help.

Practical checklist

  • Start with harness2-demo—no model keys required.
  • For real benchmarks: harness2-setup → harness2-check → harness2 → harness2-judge → harness2-report.
  • Control recursion depth with --k; choose exploration style with --mode parallel or sequential.
  • Judging and reporting must match the exact parameters of the refinement run.
  • Restrict network access before evaluation.
  • Results live in runs/; the same command resumes automatically.

One-page overview

Harness² = fixed model weights + two levels of recursive harness improvement.
Task level: Propose–Probe–Compose refines the current harness from behavioral contrasts.
Harnessing level: adopted harnesses and evidence-backed lessons feed a persistent improvement harness.
Eight editable components: system prompt, guardrails, memory, tool guidance, subagents, skills, scripts, plugins.
Supports parallel/sequential recursion, OpenCode/Codex executors, and three professional benchmarks.
A single step already yields clear gains; larger k continues the upward trend.

FAQ

Do I have to change model weights?
No. Harness² only optimizes the surrounding harness. Model weights stay fixed.

Does the local demo need API keys?
No. It uses deterministic editors and real Python executions.

How do I choose between parallel and sequential?
Use parallel when you want broader exploration of candidates. Use sequential when you want deeper successive refinement of one harness.

How large should --k be?
Start at 1 to verify the pipeline, then increase according to budget and observed gains.

Can I stop and resume a run?
Yes. Re-issue the identical command. Change HARNESS2_RUNS_DIR when you switch models or task sets.

Why restrict network access for evaluation?
Executors are unrestricted by default. Public grading criteria could otherwise be read directly and invalidate results.

Can one command run multiple benchmarks?
No. Each command targets a single benchmark.

How do I specify a WorkBuddy subset?
After setup, add --subset office, --subset web, or --subset code to every command.

Exit mobile version