Building AI Agents with AI Agents: Harness Engineering at Nexad

·
AIagentengineering
Contents · 8

nexad Engineering Team · March 2026

In early 2026, OpenAI and Anthropic both published deep dives on Harness Engineering. OpenAI showed an experiment where 3 engineers used Codex to produce a million lines of code; Anthropic demonstrated an Initializer-Coder two-stage architecture that keeps agents working across multiple context windows. Both are excellent posts. Still, both focus on Coding Agents — write correct code, pass tests, merge PRs.

What we have been doing over the past three months is different. nexad is an AI-native advertising platform. Our agents don’t just write code — they operate across ad platforms, generate ad creatives, manage campaign budgets, and coordinate data pipelines. When we tried to lift industry harness best practices directly into our stack, we found that many of their underlying assumptions didn’t hold for Marketing Agents.

This post shares the judgments we formed along the way and the concrete practices behind them. Some validate industry consensus, some we arrived at independently, and some are problems we still haven’t solved.

Enjoy.


Why Our Harness Standards Are Higher Than Usual

Before getting into how we harness our Coding Agent, it’s worth explaining why we need more than the standard playbook. The answer lies in the product we’re building.

There’s useful intuition from reinforcement learning: Environment, State, Action, Reward, Policy. The agents we build — our Marketing Agents — operate in an environment with fundamentally different constraints than a Coding Agent’s.

Irreversibility. A Coding Agent’s failure mode is benign: code doesn’t compile, tests don’t pass, PRs get rejected. You can git revert and try again. The Marketing Agents we build submit campaigns to Google Ads, spend client budgets, and publish creatives that might violate platform policies. A suspended ad account isn’t recovered by changing a few lines of code. Every bug our Coding Agent introduces into the Marketing Agent codebase carries amplified risk — it’s not just bad code, it’s bad code that can spend real money.

Tension between creativity and constraints. The Marketing Agents we build must balance creative quality (compelling copy, effective targeting) against hard constraints (brand guidelines, platform policies, budget caps). That means our codebase is full of nuanced business logic — the kind of code where “technically correct” and “actually correct” routinely diverge. A Coding Agent that doesn’t understand these subtleties can write code that passes every test and still breaks the product.

Delayed feedback. Our Marketing Agents’ output quality is measured by CTR, ROAS, and conversion rates — signals that take hours or days to materialize. Bugs in ad-serving logic may not surface until real budget has already been spent. We can’t rely on fast feedback loops to catch Coding Agent mistakes; the harness has to intercept them upfront.

These characteristics — irreversible downstream effects, nuanced business logic, and delayed feedback — explain why we treat Harness Engineering as infrastructure, not process. Every harness decision traces back to a business requirement and a deep understanding of the product context — not engineering preferences or ideas brainstormed in a conference room.


Constraints Are Only Real When Machines Can Execute Them

Candidly, this is where we burned the most time.

Early on, we wrote rules in documentation: CLAUDE.md said “use kwargs logging,” “follow the import hierarchy,” “use soft deletes,” and even included a few team nicknames (whenever the agent forgot those, we knew CLAUDE.md had lost its grip 🤣). The agent read the rules and followed them most of the time, yet regularly forgot under pressure — especially after Claude upgraded to a 1M context window.

Our team was spending 30–40% of its time on manual quality assurance — hand-reviewing code, manually running tests, manually checking spec compliance. That obviously doesn’t scale; it felt way too old-school SaaS.

We studied OpenAI’s Harness blog closely (thank you) and started encoding rules as automated checks. We built 8 custom lint scripts: check_structured_logging.py catches f-string logging; check_soft_delete.py catches direct session.delete() calls; check_api_doc_sync.py checks whether API changes updated the corresponding docs, and so on. These run non-blocking in CI for now — we have to tolerate some legacy violations and pay that tech debt down through separate issues.

From this we distilled a hierarchy of constraint enforcement:

graph LR
  A["Linter / CI Check<br/>Automatic · Blocking · Zero Latency"] --> B["Hook + Exit Code<br/>Runtime Blocking"]
  B --> C["Documented Rules<br/>Agent Reads & Follows"]
  C --> D["Conventions<br/>Relies on Pattern Matching"]
  style A fill:#2d6a4f,color:#fff,stroke:#1b4332
  style B fill:#40916c,color:#fff,stroke:#2d6a4f
  style C fill:#95d5b2,color:#1b4332,stroke:#52b788
  style D fill:#d8f3dc,color:#2d6a4f,stroke:#b7e4c7

Moving down the chain, enforcement weakens. Now, every time we add a new rule, we ask first: can this be a linter? If yes, write the linter first, then write the docs.

This matches OpenAI’s conclusion almost word for word — “when documentation falls short, promote the rule into code” — which we validated independently in practice.

For a Marketing Agent this matters even more. check_soft_delete.py looks like a style check on the surface, yet behind it sits a hard business requirement: hard-deleting ad account records destroys the audit trail required for billing reconciliation. That direct mapping from business rules to code checks is what makes a Marketing Agent harness distinctive.


Self-Evaluation Fails Because of Shared Context, Not Shared Models

Anthropic proved an important finding in their Long-Running Agents post: letting an agent evaluate its own output fails systematically. The agent marks a feature complete when the actual functionality doesn’t work. Their fix is to separate the Generator and the Evaluator.

In practice we arrived at a sharper diagnosis: what fails isn’t same-model evaluation — it’s same-context evaluation.

During our Review phase, once the Main Agent finishes Spec Compliance checks (which require full context of the plan), it spawns a SubAgent for code quality review. This SubAgent uses the exact same model (Claude), with completely different context: it receives only git diff, project rule files (docs/rules/*.md), and a dedicated role definition (.claude/agents/code-reviewer.md) framing it as a “skeptical Senior Reviewer.” It knows nothing about the Main Agent’s reasoning process, compromises, or shortcuts.

The results were surprisingly strong. The SubAgent consistently catches cross-layer import violations, malformed log statements, and missing test coverage — the exact issues the Main Agent had “rationalized away” inside its own context.

This finding matters a lot for startups.

Cross-model evaluation (say, calling OpenAI to review Claude’s output) adds cost, latency, and integration complexity. Context isolation delivers roughly 90% of the benefit at a fraction of the cost. We still use cross-model review where it counts (Codex sanity-checks plans during the Plan phase), while relying on a context-isolated same-model SubAgent for day-to-day code quality.


Harness Strictness Should Be a Variable, Not a Constant

This is the insight we think is most worth sharing.

Both OpenAI’s and Anthropic’s posts implicitly assume every code change receives the same level of quality control. The pipeline treats all changes identically. For pure Coding Agents that’s mostly fine — code is either right or wrong, with little middle ground.

In real product development, though, a public production API facing unknown users and an internal admin panel need very different depths of security review. A dev script and a core billing flow need very different test coverage bars. We found that roughly 30% of agent time was being wasted running unnecessarily strict checks on low-risk code.

Our answer is a Delivery Tier governance framework, T0 through T3, built around one principle: user controllability determines harness strictness:

More details on this in an upcoming blog post :)

TierScenarioUser ProfileEnforcement Level
T0Production critical pathUnknown / potentially malicious users by defaultHighest standard across all 6 dimensions
T1Customer PreviewClose, trusted partnersFocus on security + observability
T2Internal systemsFully controlled internal usersBaseline protection
T3Dev / EVLProduct & engineering teamMinimal constraints

Tiers are detected automatically from file paths. Across the 14 packages in our monorepo, apps/web/ maps to T0, apps/admin-web/ maps to T2, and scripts/ maps to T3. The agent declares the tier during the Plan phase; a human confirms or overrides it. Every subsequent phase — Review, Test, Ship — automatically loads the matching checklist.

Finally, the PR body outputs a 6-dimension compliance matrix (Security, Reliability, Observability, Performance, UX, Compliance).

Anthropic argued that “harness complexity should match model capability.” We think that statement extends naturally: harness strictness must match both model capability and delivery risk. Model capability is one axis; business exposure is another. Delivery Tier is our concrete implementation of the second axis.


Progressive Disclosure Is Not an Optional Optimization — It’s an Architectural Requirement

Our CLAUDE.md grew from 50 lines to 200+. Results improved steadily at first, then suddenly dropped off — the agent started selectively ignoring rules.

OpenAI summarized this phenomenon precisely: “Too much guidance becomes non-guidance. When everything is ‘important,’ nothing is.” We hit the exact same wall independently.

The fix is progressive disclosure. CLAUDE.md stays around 180 lines and acts as an entry-point index pointing to detailed documents under docs/. Each Skill loads only the rule files it needs when triggered: /nex-reviewer reads import-rules.md (49 layering rules) and logging-rules.md only when invoked; /nex-tester reads test-pattern-guide.md only when triggered. The agent sees specific rules only at the moment they apply.

This is essentially the same strategy Cursor uses for MCP tool descriptions — lazy loading rather than preloading — and shares the same lineage as Claude Code’s SKILL.md mechanism. Different teams across the industry are converging on one conclusion: an agent’s context window is a scarce resource and has to be managed as carefully as memory.


Data

Enough qualitative claims — let’s look at the data. Everything below comes from our git log from January 2026 to the present. We can’t share raw commit counts, though the relative trends speak clearly enough.

The first chart shows weekly commit output. In W08 we began a concentrated push on harness infrastructure — shipping our first linters on Feb 12, our first hook on Feb 26, and deploying 4 hooks plus 7 core Skills in a single day on March 2. The effect shows up right after W09:

---
config:
  theme: base
  themeVariables:
    xyChart:
      plotColorPalette: "#95d5b2, #2d6a4f"
---
xychart-beta
  title "Weekly Output Index (baseline = 1.0x)"
  x-axis ["W01","W02","W03","W04","W05","W06","W07","Hoilday","W09","W10 ⬆","W11","W12","W13"]
  y-axis "Index" 0 --> 3
  bar [0.2, 0.7, 0.5, 1.0, 1.2, 1.3, 1.2, 0, 0.7, 0, 0, 0, 0]
  bar [0, 0, 0, 0, 0, 0, 0, 0, 0, 2.1, 2.1, 0.9, 2.0]

From W09 to W10, the output index jumped from 0.7x to 2.1x — nearly 3x — and has hovered around 2x since. Nothing about the speedup is mysterious: the harness absorbed the quality assurance work humans previously did by hand. Before launch, we spent hours on manual code review, testing, and spec checks. Afterward, the Skill pipeline and hooks automated that work. The harness didn’t make the agent faster — it turned humans from checkers into decision-makers.

The second chart shows commit type distribution. One signal stands out: feat and fix sit at nearly 1:1. That’s no coincidence — as agents ship features rapidly, they generate bugs that need fixing just as rapidly. It illustrates why the harness is indispensable: without automated constraints and verification, fix volume scales linearly alongside feat.

---
config:
  theme: base
  themeVariables:
    xyChart:
      plotColorPalette: "#2d6a4f, #95d5b2"
---
xychart-beta
  title "Commit Type Distribution (%)"
  x-axis ["feat","fix","chore","refactor","docs","test","style","perf","other"]
  y-axis "%" 0 --> 35
  bar [30, 30, 0, 0, 0, 0, 0, 0, 0]
  bar [0, 0, 19, 6, 6, 1, 1, 1, 2]

Another slice from the ~2,000 commits: 27% touch documentation and 15% touch test files. That too is by design — our Skill definitions make test updates and doc sync mandatory steps. Eight custom linters run on pre-push, and every piece of agent output clears at least 2–3 automated gates before landing on main.

The buildout timeline of the harness infrastructure itself:

gantt
  title Harness Infrastructure Timeline
  dateFormat YYYY-MM-DD
  axisFormat %m/%d

  section Phase 1: Documentation
    CLAUDE.md created (50 lines)     :milestone, 2026-01-06, 0d
    import-rules.md launched         :milestone, 2026-01-08, 0d

  section Phase 2: Linters
    check_structured_logging.py      :milestone, 2026-02-12, 0d
    check_soft_delete.py             :milestone, 2026-02-12, 0d

  section Phase 3: Hooks + Skills
    First hook (post-edit-check)     :milestone, 2026-02-26, 0d
    4 hooks + 7 skills deployed      :crit, milestone, 2026-03-02, 0d
    DESIGN_PRINCIPLES.md written     :milestone, 2026-03-03, 0d

  section Phase 4: Governance
    Delivery Tier framework launched :milestone, 2026-03-19, 0d

Problems We Still Haven’t Solved

Tech Debt Accelerates Under AI

Agents faithfully copy patterns that already exist in the repository — including bad ones.

Once a flawed logging format slipped into the codebase, the agent replicated it across every new file it touched. A human engineer usually pauses and thinks “that looks wrong, I shouldn’t copy it,” whereas an agent’s pattern-matching biases it toward extending whatever is already there. Our linters block known bad patterns, yet we still haven’t built what OpenAI calls “garbage collection” — a background agent that periodically scans for drift and opens cleanup PRs automatically. That’s next on our roadmap.

Motivation Behind the Plan-Todo-Progress Trifecta

People have asked why we maintain a three-folder artifact setup (docs/plan/active/, docs/todo/active/, docs/progress/active/) and whether it’s over-engineered. We didn’t invent it in a vacuum — it came out of a specific failure mode: without external state on disk, an agent tries to one-shot complex features, runs out of context halfway through, and leaves the next session guessing what happened. That matches the exact failure mode Anthropic documented in their Long-Running Agents post — they use claude-progress.txt and a feature list; we use the three-artifact setup.

One critical design decision here:

Every Todo item must include a Verify command and Expect output, specified down to the exact shell command and expected string. That granularity isn’t arbitrary — it lets the TaskCompleted hook verify completion mechanically instead of trusting the agent’s self-assessment.

The Last Mile of Creative Quality

Our harness checks policy compliance, brand guideline adherence, and technical correctness. Whether an ad creative will actually perform — whether the copy resonates, whether the visual stops someone mid-scroll — remains human judgment. The gap between “policy-compliant” and “high-performing creative” is the part we still cannot automate.


Closing

Junyang wrote in his essay on Agentic Thinking: “The future is a shift from training models to training agents, and from training agents to training systems.” Our experience partially validates that view.

Over the past three months, we have probably spent more time designing Skill pipelines, debugging hook scripts, and refining the Delivery Tier matrix than building any single product feature. Yet that scaffolding is what lets agent-written code serve real customers reliably every day.

Harness Engineering is just getting started. As models improve, constraints that are essential today may turn redundant tomorrow — Anthropic has noted that shift with each new generation of Claude.

What stays constant is a core conviction: harness design for Marketing Agents should be driven by business requirements, not engineering preferences.

When one bad decision by your agent can get a client’s ad account suspended, “enforce invariants, not micromanage implementations” stops being just an engineering principle and becomes a survival strategy.

The form of the reins changes. The role of the reins does not.


Written by Damien, edited by Jason Hu and William Jin · March 2026 · nex.ad

We may be one of the most AI-native startup teams anywhere. If you’re interested in what we’re building — either the technology or the business — feel free to DM me :)