← Insights

Mental Models for the AI EconomyAI Development

Harness²: The Agent Harness That Rewrites Itself

A harness makes an agent reliable. A harness for the harness makes it get better: every correction is captured, promoted, enforced or deleted.

By George MoreasOctober 8, 20268 min read · interactive

A harness is everything you wrap around a coding agent so it behaves like a teammate: standing instructions, permissions, hooks, tools and a verification loop. Most people build one, feel the improvement, and then freeze it. Six weeks later the file is stale, the agent is repeating last month’s mistakes and nobody remembers which rule was written for what.

The short from DIY Smart Code titled “Why your AI agent needs to rewrite its own rules” (tagged #harness2) names the next step. This is our longer version of that idea: the harness needs its own harness. Call it harness².

The short answer:

Harness² is a maintenance loop around your agent’s rules. Each correction is captured, classified, promoted to the cheapest layer that will actually hold it, and deleted when it stops being true. The agent may draft rule changes; a person approves them.

Why a static harness decays

Codebases move. Dependencies change, conventions drift, a deploy quirk gets fixed. Every rule in a memory file costs context on every session, and a contradicted rule is worse than none — it teaches the agent that the file is optional. A harness that only grows becomes noise. A harness that never grows keeps paying for the same mistake.

01 / The compounding harness

Every correction either repeats or retires

0510session 1 → 12 · solid: repeat mistakes · dashed: standing rules
0.1 repeat mistakes left5.1 rules carried into every session
Illustrative: ten recurring mistake types; each session a share of what remains is promoted into a standing rule. Pruning removes 30% of accumulated rules on the chosen cadence. Not a measurement of any tool.

The model above shows the shape, not a measurement: promotion collapses repeat mistakes quickly, while pruning keeps the rule set from swelling into a context tax. The two dials work against each other only if you neglect one of them.

The loop

  1. Capture: when you correct the agent, it writes the correction down — what happened, what should have happened, which file.
  2. Classify: one-off, recurring pattern, or broken rule.
  3. Promote: recurring patterns go to memory or CLAUDE.md; rules the agent has broken go to a hook, because hooks run as code rather than as a request.
  4. Review: the agent proposes the edit as a diff. You approve it like any other change.
  5. Prune: on a cadence, the agent lists rules nothing has needed recently or that contradict the codebase, and proposes deletions.
02 / The promotion ladder

Where does this correction belong?

Promote to memory / CLAUDE.md. A pattern. The second correction is the signal that the harness, not the model, is missing information.

An editorial heuristic, not a vendor specification. Thresholds should match your own failure costs.

Where it goes wrong

Self-approval. An agent that silently edits its own rules can relax its own constraints. Rule changes are diffs with a human signature, every time. Permissions and hooks protecting secrets or deploys should never be self-editable.

Rule inflation. Writing a rule for every hiccup is the same failure as never writing one, just slower. The promotion threshold — corrected twice — is the filter.

Vague rules. “Be careful with the database” is a mood. “Never run a migration without listing affected tables first” is testable. If you cannot tell whether a rule was followed, rewrite it.

What makes it better than a better prompt

Anthropic’s write-up on harnesses for long-running agents leans on persistent progress files and incremental, verifiable steps so each new session starts from recorded state rather than memory. Harness² applies the same discipline to the rules themselves: the lessons are recorded state, versioned in the repo, reviewed like code. Over time the harness becomes the most accurate document of how your project actually works.

A harness makes the agent reliable today. A harness for the harness is what keeps it reliable next quarter.

Sources and limits

Written October 20, 2026. Research dates describe the evidence, not a claim about current tool performance. The interactive models are illustrative; they do not predict an organization’s productivity.

  1. DIY Smart Code: Why your AI agent needs to rewrite its own rules (YouTube Short)
  2. Claude Code: manage memory (CLAUDE.md)
  3. Claude Code: hooks reference
  4. Anthropic: effective harnesses for long-running agents
Share
Mental Models for the AI Economy

Get the next essay the day it publishes.

A few a month, written from real builds. Unsubscribe in one click.

George Moreas
About the author
George Moreas

Performance marketing and search leader who builds — 15+ years in digital growth and product (AT&T/DirecTV, Microsoft, Employbridge, Site Impact), now running his own properties with AI. These essays are field notes from that loop: what AI actually changes about work, product, and the economics underneath. Based in South Florida.

Keep reading