Harness Engineering Playbook
Use this skill to operationalize the practices from OpenAI's Harness Engineering guide in a repo that agents can run against repeatedly and safely.
What To Load
- Use
references/openai-harness-practices.md for the full practice-to-artifact mapping.
- Use
references/rollout-checklist.md for phased adoption in active repos.
- Use
references/wizard-cli.md for Typer wizard command flows.
- Use
assets/templates/ when creating or updating harness files.
Inputs
- Target repository path.
- Existing command surface (
make, npm, cargo, pytest, etc.).
- Existing CI workflows and branch protections.
Workflow
- Baseline the repo and detect existing workflows.
- Bootstrap harness artifacts and templates.
- Apply all nine Harness Engineering practices.
- Run harness audit checks and repair gaps.
- Iterate after real agent runs.
Step 1: Baseline The Repo
- Identify language/toolchain and canonical entrypoints.
- Inventory existing checks, scripts, and CI jobs.
- Record current pain points for agent runs: setup drift, unclear docs, flaky tests, missing trace IDs, slow loops.
Use a short baseline note inside PLANS.md so decisions remain durable.
Step 2: Bootstrap Harness Artifacts
Preferred entrypoint:
python3 scripts/harness_wizard.py init <repo-path> --profile control
Profiles:
baseline: only core harness artifacts.
control: baseline + control-system primitives.
full: control + entropy controls (nightly audit + entropy checks).
Direct shell fallback:
Run:
./scripts/bootstrap_harness.sh <repo-path>
This script installs safe defaults from assets/templates/:
AGENTS.md
PLANS.md
docs/ARCHITECTURE.md
docs/OBSERVABILITY.md
Makefile.harness (+ -include Makefile.harness in Makefile)
scripts/audit_harness.sh
scripts/harness/{smoke,test,lint,typecheck}.sh
.github/workflows/harness.yml
By default, existing files are not overwritten. Pass --force to replace template-managed files.
Step 3: Apply The Nine Practices
Implement each practice directly in repo artifacts.
1. Make Easy To Do Hard Thing
- Ensure hard, high-value tasks are one command away (
make smoke, make check, make ci).
- Keep setup and cleanup scripted.
- Make smoke checks cheap enough for frequent use.
2. Communicate Actionable Constraints With Compact Docs
- Keep
AGENTS.md short, concrete, and command-first.
- Document non-obvious constraints and guardrails.
- Keep docs close to code and update with behavior changes.
3. Structure Codebase With Strict Boundaries And Flow
- Define module boundaries in
docs/ARCHITECTURE.md.
- Parse and validate data at boundaries; use typed contracts for internal flow.
- Prefer one abstraction per module and one clear ownership path.
4. Build Observability In From Day 1
- Emit structured logs/events with correlation IDs.
- Capture key transitions in long-running workflows.
- Define minimum observable fields in
docs/OBSERVABILITY.md.
5. Optimize For Agent Flow, Not Human Flow
- Treat context as a first-class system dependency.
- Use
PLANS.md for multi-step/multi-hour tasks.
- Front-load durable context (scope, constraints, checkpoints) so restarts stay cheap.
6. Bring Your Own Harness
- Standardize repo-local wrappers (
Makefile.harness, scripts/harness/).
- Wrap local infra actions in deterministic scripts.
- Make agent behavior reproducible across machines and runs.
7. Prototype In Natural Language First
- Draft logic and tests in prose before coding.
- Review edge cases in prose and lock acceptance criteria.
- Translate approved prose into code and tests.
8. Invest In Static Analysis And Linting
- Pin formatter/linter/typechecker versions where practical.
- Enforce checks in both local workflow and CI.
- Run static checks before long tests to shorten failure loops.
9. Manage Entropy
- Add periodic audits for docs drift, flaky checks, and dead scripts.
- Keep templates synchronized with real workflows.
- Remove stale abstractions quickly to keep agent context clean.
For a detailed artifact matrix, load references/openai-harness-practices.md.
Step 4: Validate
Run:
python3 scripts/harness_wizard.py audit <repo-path>
Treat any MISSING or FAIL result as blocking before calling harness setup complete.
Step 5: Iterate On Real Runs
- Observe one full agent run from clean checkout to merged change.
- Patch harness gaps immediately.
- Re-run audit.
- Keep
AGENTS.md, PLANS.md, and architecture docs aligned with current behavior.
Adaptation Rules
- Preserve existing project conventions and replace templates incrementally.
- Do not overwrite user-authored files without explicit approval.
- Keep command names stable; change internals behind wrappers.
- Favor deterministic, scriptable workflows over ad-hoc interactive steps.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: harness-engineering-playbook3description: Implement OpenAI Harness Engineering practices in any repository. Use when setting up or refactoring agent-first workflows, writing or upgrading AGENTS.md and PLANS.md, creating deterministic smoke/test/lint/typecheck harness commands, defining strict architecture boundaries and data-shape contracts, wiring observability from day 1, and adding entropy-control checks plus CI automation for reliable autonomous runs. Use when this capability is needed.4---56# Harness Engineering Playbook78Use this skill to operationalize the practices from OpenAI's Harness Engineering guide in a repo that agents can run against repeatedly and safely.910## What To Load1112- Use `references/openai-harness-practices.md` for the full practice-to-artifact mapping.13- Use `references/rollout-checklist.md` for phased adoption in active repos.14- Use `references/wizard-cli.md` for Typer wizard command flows.15- Use `assets/templates/` when creating or updating harness files.1617## Inputs1819- Target repository path.20- Existing command surface (`make`, `npm`, `cargo`, `pytest`, etc.).21- Existing CI workflows and branch protections.2223## Workflow24251. Baseline the repo and detect existing workflows.262. Bootstrap harness artifacts and templates.273. Apply all nine Harness Engineering practices.284. Run harness audit checks and repair gaps.295. Iterate after real agent runs.3031## Step 1: Baseline The Repo3233- Identify language/toolchain and canonical entrypoints.34- Inventory existing checks, scripts, and CI jobs.35- Record current pain points for agent runs: setup drift, unclear docs, flaky tests, missing trace IDs, slow loops.3637Use a short baseline note inside `PLANS.md` so decisions remain durable.3839## Step 2: Bootstrap Harness Artifacts4041Preferred entrypoint:4243```bash44python3 scripts/harness_wizard.py init <repo-path> --profile control45```4647Profiles:4849- `baseline`: only core harness artifacts.50- `control`: baseline + control-system primitives.51- `full`: control + entropy controls (nightly audit + entropy checks).5253Direct shell fallback:5455Run:5657```bash58./scripts/bootstrap_harness.sh <repo-path>59```6061This script installs safe defaults from `assets/templates/`:6263- `AGENTS.md`64- `PLANS.md`65- `docs/ARCHITECTURE.md`66- `docs/OBSERVABILITY.md`67- `Makefile.harness` (+ `-include Makefile.harness` in `Makefile`)68- `scripts/audit_harness.sh`69- `scripts/harness/{smoke,test,lint,typecheck}.sh`70- `.github/workflows/harness.yml`7172By default, existing files are not overwritten. Pass `--force` to replace template-managed files.7374## Step 3: Apply The Nine Practices7576Implement each practice directly in repo artifacts.7778### 1. Make Easy To Do Hard Thing7980- Ensure hard, high-value tasks are one command away (`make smoke`, `make check`, `make ci`).81- Keep setup and cleanup scripted.82- Make smoke checks cheap enough for frequent use.8384### 2. Communicate Actionable Constraints With Compact Docs8586- Keep `AGENTS.md` short, concrete, and command-first.87- Document non-obvious constraints and guardrails.88- Keep docs close to code and update with behavior changes.8990### 3. Structure Codebase With Strict Boundaries And Flow9192- Define module boundaries in `docs/ARCHITECTURE.md`.93- Parse and validate data at boundaries; use typed contracts for internal flow.94- Prefer one abstraction per module and one clear ownership path.9596### 4. Build Observability In From Day 19798- Emit structured logs/events with correlation IDs.99- Capture key transitions in long-running workflows.100- Define minimum observable fields in `docs/OBSERVABILITY.md`.101102### 5. Optimize For Agent Flow, Not Human Flow103104- Treat context as a first-class system dependency.105- Use `PLANS.md` for multi-step/multi-hour tasks.106- Front-load durable context (scope, constraints, checkpoints) so restarts stay cheap.107108### 6. Bring Your Own Harness109110- Standardize repo-local wrappers (`Makefile.harness`, `scripts/harness/`).111- Wrap local infra actions in deterministic scripts.112- Make agent behavior reproducible across machines and runs.113114### 7. Prototype In Natural Language First115116- Draft logic and tests in prose before coding.117- Review edge cases in prose and lock acceptance criteria.118- Translate approved prose into code and tests.119120### 8. Invest In Static Analysis And Linting121122- Pin formatter/linter/typechecker versions where practical.123- Enforce checks in both local workflow and CI.124- Run static checks before long tests to shorten failure loops.125126### 9. Manage Entropy127128- Add periodic audits for docs drift, flaky checks, and dead scripts.129- Keep templates synchronized with real workflows.130- Remove stale abstractions quickly to keep agent context clean.131132For a detailed artifact matrix, load `references/openai-harness-practices.md`.133134## Step 4: Validate135136Run:137138```bash139python3 scripts/harness_wizard.py audit <repo-path>140```141142Treat any `MISSING` or `FAIL` result as blocking before calling harness setup complete.143144## Step 5: Iterate On Real Runs145146- Observe one full agent run from clean checkout to merged change.147- Patch harness gaps immediately.148- Re-run audit.149- Keep `AGENTS.md`, `PLANS.md`, and architecture docs aligned with current behavior.150151## Adaptation Rules152153- Preserve existing project conventions and replace templates incrementally.154- Do not overwrite user-authored files without explicit approval.155- Keep command names stable; change internals behind wrappers.156- Favor deterministic, scriptable workflows over ad-hoc interactive steps.157158---159> Converted and distributed by [TomeVault](https://tomevault.io/claim/broomva) — claim your Tome and manage your conversions.160<!-- tomevault:4.0:skill_md:2026-04-11 -->