Meta Harness Implementation
See the codemetaharness is an open source Python library for optimizing executable harnesses around agentic coding systems.
It is inspired by the Meta Harness paper and is an unofficial open source implementation of the core ideas in that work.
The current benchmark evidence in this repository is centered on the Codex CLI path, including hosted Codex and Codex over local Ollama models.
Codex is the primary and validated backend in this repository today.
Gemini CLI and Omnigent are additional experimental integrations.
It is built for teams who want to improve the code and files around an agent workflow, not just the prompt. That includes instruction files, setup flows, validation scripts, test scripts, routing logic, and other executable support code.
metaharnessMany agent failures come from the harness around the model:
metaharness turns those artifacts into a repeatable optimization target with stored evidence for every proposal.
It also captures a compact environment snapshot before each proposal so agents do not waste early turns on basic workspace discovery.
Projects can also declare an allowed write scope so off-target edits are rejected automatically.
metaharness runs an outer optimization loop around a harness:
The result is a practical, inspectable workflow for improving real harnesses instead of ad hoc prompt tinkering.
AGENTS.md, GEMINI.md, bootstrap scripts, validation scripts, and acceptance testsInstall the published CLI from PyPI:
uv tool install superagentic-metaharness
Check the command:
metaharness --help
If you want to run the built-in examples in this repository, use a source checkout:
uv sync
Run the fake backend on a real benchmark:
uv run metaharness run \
examples/python_fixture_benchmark \
--backend fake \
--budget 1 \
--run-name quickstart
Inspect the run:
uv run metaharness inspect \
examples/python_fixture_benchmark/runs/quickstart
Export the candidate ledger:
uv run metaharness ledger \
examples/python_fixture_benchmark/runs/quickstart \
--tsv
Run a saved experiment matrix:
uv run metaharness experiment \
--config examples/experiment_configs/fake-benchmarks.json
allowed_write_pathsCodexExecBackendGeminiCliBackendOmnigentCliBackend for omni run agent proposalsFakeBackendbackend_plugins (module:callable factories)keep, discard, crash, timeout, no-change, scope-violation, class-violation, and leakage-violationinspect, ledger, summarize, and compare--trace-evidence for HALO/RLM analysis reportsThe repository currently includes:
optimize_harness as a librarygpt-oss:20b and gpt-oss:120bCurrent documented experiments in this repository show:
gpt-oss:120b solves python_fixture_benchmarkgpt-oss:20b is useful for smoke checks but timed out on the current real benchmark runsDetailed experiment records:
gpt-oss:20b and gpt-oss:120bomni run as a metaharness proposerAll real provider results currently documented in this repository were produced through the Codex CLI path.
That includes both hosted Codex runs and local Ollama runs driven through Codex with gpt-oss models.
Other coding-agent evaluations in the wider ecosystem often emphasize Claude Code and Opus, but this repository's current benchmark evidence is Codex-first.
The Omnigent integration has also been smoke-tested against the real Omnigent CLI from source.
In that run, Omnigent improved the built-in Omnigent-agent benchmark from the baseline candidate to c0001, reached objective 0.875, and stayed inside the allowed write scope.
Published package:
superagentic-metaharnessmetaharnessmetaharnessInstall the CLI with uv:
uv tool install superagentic-metaharness
Upgrade it later:
uv tool upgrade superagentic-metaharness
Install it into a Python project dependency set:
uv add superagentic-metaharness
Install with pip:
pip install superagentic-metaharness
Source checkout setup:
uv sync
If you want the docs toolchain too:
uv sync --group dev
Check the CLI:
uv run metaharness --help
Editable install with pip also works:
pip install -e .
Requirements:
codex CLI installedRun a real benchmark with hosted Codex:
uv run metaharness run \
examples/python_fixture_benchmark \
--backend codex \
--hosted \
--budget 1 \
--run-name hosted-codex
Important:
--hosted when a project config defaults to local OllamaProbe the local setup:
uv run metaharness smoke codex \
examples/python_fixture_benchmark \
--probe-only \
--oss \
--local-provider ollama \
--model gpt-oss:20b
Run with gpt-oss:20b:
uv run metaharness run \
examples/python_fixture_benchmark \
--backend codex \
--oss \
--local-provider ollama \
--model gpt-oss:20b \
--proposal-timeout 240 \
--budget 1 \
--run-name ollama-20b
Run with gpt-oss:120b:
uv run metaharness run \
examples/python_fixture_benchmark \
--backend codex \
--oss \
--local-provider ollama \
--model gpt-oss:120b \
--proposal-timeout 420 \
--budget 1 \
--run-name ollama-120b
Real benchmarks:
Omnigent-shaped routing (coding-tool project, JSON routing table as the candidate surface):
Omnigent agent config target:
Smaller deterministic example:
Host embed (call optimize_harness from Omnigent, HarnessRouter/UHP, or AgentSky-style runtimes):
Run the ticket router example:
uv run python examples/ticket_router/run.py --backend fake --budget 1
Create a coding-tool project:
uv run metaharness scaffold coding-tool ./my-coding-tool-optimizer
Available profiles:
standardlocal-oss-smokelocal-oss-mediumskillsRun the scaffold with the fake backend:
uv run metaharness run ./my-coding-tool-optimizer --backend fake --budget 1
You can register custom closed-source or internal harness adapters without editing metaharness core code.
Add a plugin in metaharness.json:
{
"backend_plugins": {
"cursor": {
"factory": "my_harness_plugins.cursor:create_backend",
"options": {
"model": "cursor-pro"
}
}
}
}
Then run it like any other backend:
uv run metaharness run ./my-coding-tool-optimizer --backend cursor --budget 1
Factory contract:
module:callableproject and optionsname, prepare, invoke, and collectCreate an official-style domain onboarding pack:
uv run metaharness onboard ./my-domain-onboarding
This writes:
ONBOARDING.md with a question-driven domain setup flowdomain_spec.md with a structured template for search and evaluation designCreate a scaffold:
uv run metaharness scaffold coding-tool ./my-project
Run a project:
uv run metaharness run ./my-project --backend fake --budget 1
Probe Codex:
uv run metaharness smoke codex ./my-project --probe-only
Inspect a run:
uv run metaharness inspect ./my-project/runs/example
Compare runs:
uv run metaharness compare \
./examples/python_fixture_benchmark/runs/hosted-codex-20260401 \
./examples/python_fixture_benchmark/runs/ollama-20b-20260401 \
./examples/python_fixture_benchmark/runs/ollama-120b-20260401
Run an experiment matrix:
uv run metaharness experiment --config examples/experiment_configs/fake-benchmarks.json
Every run stores:
That makes the optimization history reviewable, debuggable, and reusable.
Compile checks:
uv run python -m compileall -q src tests examples docs
Unit tests:
uv run python -m unittest discover -s tests -v
Docs build:
uv run mkdocs build --strict
Fake benchmark smoke runs:
uv run metaharness run examples/python_fixture_benchmark --backend fake --budget 1 --run-name ci-fixture-local
uv run metaharness run examples/python_cli_benchmark --backend fake --budget 1 --run-name ci-cli-local
uv run python examples/ticket_router/run.py --backend fake --budget 1
metaharness is an unofficial implementation of Meta-Harness. The canonical research repo is stanford-iris-lab/meta-harness.
As of July 2026 the official repo includes an experimental Harbor pilot (experimental/harbor_meta_harness). Sibling community work includes Harness Forge. Later papers to track: AHE, HarnessCompass, and Wang et al. on harness-evolution evals. See Official comparison, Alignment, and Embed.
Functional Source License, Version 1.1, ALv2 Future License (FSL-1.1-ALv2).
You may read, use, modify and redistribute this software for any purpose other than a Competing Use, which means offering it (or substantially similar functionality) to others as a commercial product or service. Internal use, non-commercial education, non-commercial research, and professional services delivered to a licensee are all permitted.
Each version becomes available under the Apache License, Version 2.0 on the second anniversary of its release.
Releases up to and including 0.4.0 were published under Apache 2.0 and remain
available under those terms.
30 commits
4 commits
Python
100.0%
Meta Harness Implementation
See the codemetaharness is an open source Python library for optimizing executable harnesses around agentic coding systems.
It is inspired by the Meta Harness paper and is an unofficial open source implementation of the core ideas in that work.
The current benchmark evidence in this repository is centered on the Codex CLI path, including hosted Codex and Codex over local Ollama models.
Codex is the primary and validated backend in this repository today.
Gemini CLI and Omnigent are additional experimental integrations.
It is built for teams who want to improve the code and files around an agent workflow, not just the prompt. That includes instruction files, setup flows, validation scripts, test scripts, routing logic, and other executable support code.
metaharnessMany agent failures come from the harness around the model:
metaharness turns those artifacts into a repeatable optimization target with stored evidence for every proposal.
It also captures a compact environment snapshot before each proposal so agents do not waste early turns on basic workspace discovery.
Projects can also declare an allowed write scope so off-target edits are rejected automatically.
metaharness runs an outer optimization loop around a harness:
The result is a practical, inspectable workflow for improving real harnesses instead of ad hoc prompt tinkering.
AGENTS.md, GEMINI.md, bootstrap scripts, validation scripts, and acceptance testsInstall the published CLI from PyPI:
uv tool install superagentic-metaharness
Check the command:
metaharness --help
If you want to run the built-in examples in this repository, use a source checkout:
uv sync
Run the fake backend on a real benchmark:
uv run metaharness run \
examples/python_fixture_benchmark \
--backend fake \
--budget 1 \
--run-name quickstart
Inspect the run:
uv run metaharness inspect \
examples/python_fixture_benchmark/runs/quickstart
Export the candidate ledger:
uv run metaharness ledger \
examples/python_fixture_benchmark/runs/quickstart \
--tsv
Run a saved experiment matrix:
uv run metaharness experiment \
--config examples/experiment_configs/fake-benchmarks.json
allowed_write_pathsCodexExecBackendGeminiCliBackendOmnigentCliBackend for omni run agent proposalsFakeBackendbackend_plugins (module:callable factories)keep, discard, crash, timeout, no-change, scope-violation, class-violation, and leakage-violationinspect, ledger, summarize, and compare--trace-evidence for HALO/RLM analysis reportsThe repository currently includes:
optimize_harness as a librarygpt-oss:20b and gpt-oss:120bCurrent documented experiments in this repository show:
gpt-oss:120b solves python_fixture_benchmarkgpt-oss:20b is useful for smoke checks but timed out on the current real benchmark runsDetailed experiment records:
gpt-oss:20b and gpt-oss:120bomni run as a metaharness proposerAll real provider results currently documented in this repository were produced through the Codex CLI path.
That includes both hosted Codex runs and local Ollama runs driven through Codex with gpt-oss models.
Other coding-agent evaluations in the wider ecosystem often emphasize Claude Code and Opus, but this repository's current benchmark evidence is Codex-first.
The Omnigent integration has also been smoke-tested against the real Omnigent CLI from source.
In that run, Omnigent improved the built-in Omnigent-agent benchmark from the baseline candidate to c0001, reached objective 0.875, and stayed inside the allowed write scope.
Published package:
superagentic-metaharnessmetaharnessmetaharnessInstall the CLI with uv:
uv tool install superagentic-metaharness
Upgrade it later:
uv tool upgrade superagentic-metaharness
Install it into a Python project dependency set:
uv add superagentic-metaharness
Install with pip:
pip install superagentic-metaharness
Source checkout setup:
uv sync
If you want the docs toolchain too:
uv sync --group dev
Check the CLI:
uv run metaharness --help
Editable install with pip also works:
pip install -e .
Requirements:
codex CLI installedRun a real benchmark with hosted Codex:
uv run metaharness run \
examples/python_fixture_benchmark \
--backend codex \
--hosted \
--budget 1 \
--run-name hosted-codex
Important:
--hosted when a project config defaults to local OllamaProbe the local setup:
uv run metaharness smoke codex \
examples/python_fixture_benchmark \
--probe-only \
--oss \
--local-provider ollama \
--model gpt-oss:20b
Run with gpt-oss:20b:
uv run metaharness run \
examples/python_fixture_benchmark \
--backend codex \
--oss \
--local-provider ollama \
--model gpt-oss:20b \
--proposal-timeout 240 \
--budget 1 \
--run-name ollama-20b
Run with gpt-oss:120b:
uv run metaharness run \
examples/python_fixture_benchmark \
--backend codex \
--oss \
--local-provider ollama \
--model gpt-oss:120b \
--proposal-timeout 420 \
--budget 1 \
--run-name ollama-120b
Real benchmarks:
Omnigent-shaped routing (coding-tool project, JSON routing table as the candidate surface):
Omnigent agent config target:
Smaller deterministic example:
Host embed (call optimize_harness from Omnigent, HarnessRouter/UHP, or AgentSky-style runtimes):
Run the ticket router example:
uv run python examples/ticket_router/run.py --backend fake --budget 1
Create a coding-tool project:
uv run metaharness scaffold coding-tool ./my-coding-tool-optimizer
Available profiles:
standardlocal-oss-smokelocal-oss-mediumskillsRun the scaffold with the fake backend:
uv run metaharness run ./my-coding-tool-optimizer --backend fake --budget 1
You can register custom closed-source or internal harness adapters without editing metaharness core code.
Add a plugin in metaharness.json:
{
"backend_plugins": {
"cursor": {
"factory": "my_harness_plugins.cursor:create_backend",
"options": {
"model": "cursor-pro"
}
}
}
}
Then run it like any other backend:
uv run metaharness run ./my-coding-tool-optimizer --backend cursor --budget 1
Factory contract:
module:callableproject and optionsname, prepare, invoke, and collectCreate an official-style domain onboarding pack:
uv run metaharness onboard ./my-domain-onboarding
This writes:
ONBOARDING.md with a question-driven domain setup flowdomain_spec.md with a structured template for search and evaluation designCreate a scaffold:
uv run metaharness scaffold coding-tool ./my-project
Run a project:
uv run metaharness run ./my-project --backend fake --budget 1
Probe Codex:
uv run metaharness smoke codex ./my-project --probe-only
Inspect a run:
uv run metaharness inspect ./my-project/runs/example
Compare runs:
uv run metaharness compare \
./examples/python_fixture_benchmark/runs/hosted-codex-20260401 \
./examples/python_fixture_benchmark/runs/ollama-20b-20260401 \
./examples/python_fixture_benchmark/runs/ollama-120b-20260401
Run an experiment matrix:
uv run metaharness experiment --config examples/experiment_configs/fake-benchmarks.json
Every run stores:
That makes the optimization history reviewable, debuggable, and reusable.
Compile checks:
uv run python -m compileall -q src tests examples docs
Unit tests:
uv run python -m unittest discover -s tests -v
Docs build:
uv run mkdocs build --strict
Fake benchmark smoke runs:
uv run metaharness run examples/python_fixture_benchmark --backend fake --budget 1 --run-name ci-fixture-local
uv run metaharness run examples/python_cli_benchmark --backend fake --budget 1 --run-name ci-cli-local
uv run python examples/ticket_router/run.py --backend fake --budget 1
metaharness is an unofficial implementation of Meta-Harness. The canonical research repo is stanford-iris-lab/meta-harness.
As of July 2026 the official repo includes an experimental Harbor pilot (experimental/harbor_meta_harness). Sibling community work includes Harness Forge. Later papers to track: AHE, HarnessCompass, and Wang et al. on harness-evolution evals. See Official comparison, Alignment, and Embed.
Functional Source License, Version 1.1, ALv2 Future License (FSL-1.1-ALv2).
You may read, use, modify and redistribute this software for any purpose other than a Competing Use, which means offering it (or substantially similar functionality) to others as a commercial product or service. Internal use, non-commercial education, non-commercial research, and professional services delivered to a licensee are all permitted.
Each version becomes available under the Apache License, Version 2.0 on the second anniversary of its release.
Releases up to and including 0.4.0 were published under Apache 2.0 and remain
available under those terms.
30 commits
4 commits
Python
100.0%