Master the four pillars of harness engineering—constraint, information, verification, and correction—to build AI agents that improve automatically and maintain stability at scale.
One morning I found an article-publishing agent that had run overnight ready to push a batch of links to categories that did not exist. The last verification script in the chain caught it and sent the work back to be redone. Swapping in a smarter model never drives that class of accident to zero; what works is the scaffolding you place around the agent.
Harness engineering is a framework for building AI agents that behave predictably and improve automatically. Coined by HashiCorp founder Mitchell Hashimoto, it describes the practice of surrounding AI systems with constraints, information, and feedback mechanisms that guide behavior toward desired outcomes.
Most teams discover the hard way that AI agents aren't "fire and forget." Without proper harness design, they overstep their bounds, repeat mistakes, or miss critical context. This article teaches you to prevent those failures through systematic design.
What Is Harness Engineering?
Harness engineering consists of four interacting components:
Constrain — define what the AI cannot do. Example: forbid deletions, force pushes, unauthorized dependency updates
Inform — provide the necessary context. Example: file contents, test results, project standards
Verify — automatically check outputs. Example: linters, type checks, unit tests
Together, these create a feedback loop where the AI learns and improves without human intervention.
In my own work as an indie developer running several sites and apps, adopting these four pillars changed the stability of my automation more than any model upgrade. Concretely, I maintain a set of pre-push verification scripts — link integrity, config validity, a machine check for robots.txt — as the "Verify" layer, with a fixed "Correct" loop that redoes the work whenever a check fails. Improving the harness has consistently paid off more than trying to make the agent smarter.
✦
Thank you for reading this far.
Continue Reading
What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.
WHAT YOU'LL LEARN
✦A concrete way to apply the four pillars—Constrain, Inform, Verify, Correct—to your own automation
✦How to connect the shared agent harness behind Antigravity 2.0 and the CLI to your own verify loop
✦The reversibility heuristic for setting constraint granularity, drawn from running four sites in parallel
Secure payment via Stripe · Cancel anytime
✦
Unlock This Article
Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.
The recent direction of Antigravity fits harness engineering unusually well. Antigravity 2.0 spans several surfaces—a desktop app, a CLI, an SDK, and a Managed Agents API—and the new Antigravity CLI is designed to share the same agent harness as the rest, so core agent improvements propagate to every surface automatically.
What I care about here is keeping my side of the harness—constraints and verification—decoupled from any single UI. If Constrain and Verify live in the repository as artifacts (an AGENTS.md, a set of pre-push scripts), then whether the entry point is the desktop app or the terminal, the same safety net applies unchanged.
With the migration from Gemini CLI to Antigravity CLI in the air, this paid off concretely: the entry-point tool changed, but the harness sitting in the repo did not need to be rebuilt. Leave making the agent smarter to the vendor; keep "what it must not do" and "the checks it must pass" as your own durable assets. That division of labor is what keeps you from being whipped around by tool generations.
What the Harness Is Worth: Numbers From Running Four Sites
As an indie developer at Dolice, I run several technical blogs in parallel and hand the generate-to-push flow to agents. The lesson that stuck: most accidents are stopped by verification, not by intelligence.
The checks I run before every push are just a handful of scripts—internal-link integrity, frontmatter validity, a machine check of robots.txt. Even so, roughly 80% of the cases that forced a redo were caught at that verification stage, leaving about 20% to escalate to a human.
Verification scripts aren't free, of course. Each one adds maintenance: tuning out false positives, keeping up with spec changes. My rule is simple—only promote a check to a blocking gate if it guards against the kind of failure that hurts once it ships. Cosmetic issues stay as warnings; only hard-to-reverse problems like broken links or corrupted config earn the right to stop the work.
Deciding How Tight to Constrain
The first hard question in Constrain is granularity. Too tight and the agent can't do useful work; too loose and accidents slip through. Where I landed was to split by whether an action is reversible:
Nature of the action
Examples
Treatment
Irreversible
File deletion, force push, bulk dependency bumps, deploy
Forbidden by default (needs explicit human approval)
Reversible but wide-reaching
Bulk find-and-replace, config changes
Allowed, but verification required
Local and easy to undo
Adding comments, single-file suggestions
Left to the agent freely
Once I drew this line, I stopped needing to enumerate constraints in fine detail. Name the irreversible operations explicitly, delegate the rest to verification—and new operations no longer create new decisions. Reversible failures can simply be redone; only irreversible ones are truly frightening. The constraint list is just that ordinary instinct, translated.
The Human Role
Harness engineering doesn't eliminate human judgment—it redirects it:
Design the harness: Decide what the AI should and shouldn't do
Make hard calls: When CRITICAL issues conflict, humans decide
Monitor emergence: Watch for patterns the harness didn't anticipate
Humans become decision-makers and architects, not reviewers.
Conclusion
Harness engineering transforms AI from a "risky automation tool" into a "reliable team member." The four pillars—constraint, information, verification, correction—create a self-improving system that adapts to your project without requiring constant human oversight.
The key insight: AI's value comes from environment design, not raw intelligence.
As a first step, skip building all four pillars and add only Verify today: bundle lint, type checks, and tests into one script and run it after every agent task. That alone stops most accidents at the checkpoint. Constraints and auto-correction can come later, once verification is humming.
Share
Thank You for Reading
Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.