Skip to content
JournalTORIS / FIELD NOTES

← Blog AI insights

AI Productivity: Harness Engineering, the Foundation of Agent Performance

Harness engineering wraps a model with context management, tool orchestration, verification loops, and permission gating. The model sets the ceiling; the harness decides reliability.

9 min read Read the Korean original

Joohwan Yu · Founder, Full Stack Developer

Toris · Published

Contents

Q. What is AI harness engineering, and why does it matter? It is the work of designing the context, tool, verification, and permission scaffolding around a model. The model sets the ceiling, and the harness decides actual reliability.

For Toris, the harness is not theory but a line item on the P&L. In a one-person studio where the CEO is also the developer, the rate at which an agent finishes work reliably is the company’s production capacity. We run our development workflow on top of AI coding agents, and every day we confirm that the lever for raising that rate is harness design, not swapping models. So the claim in this post is also our operating policy.

AI harness engineering

Building agents these days, you run into something odd. Two tools use the same model, yet one finishes jobs with surprising reliability while the other misses every second time. At first I put it down to “the model must be better,” but the more I dug, the less that held up. The real difference was in the engineering wrapped around the model: the harness.

I want to make one claim in this post. Model performance sets the ceiling, but the harness determines real-world reliability. As of early 2026, the raw capability gap between frontier models keeps narrowing, and how you orchestrate the model is what separates product quality. Whether it is Claude Code or Codex, what we admire is often not the model itself but the harness layered on top of it.

What Is a Harness

A harness originally means the gear fitted to a horse or a parachute: a control device. In the AI context, the harness refers to all the surrounding engineering that turns a raw LLM into an agent that actually does work.

A raw model is simple. It is just a function that takes text in and emits the next token. To promote that function into a reliable software component, you need the following.

  • Context management: what to put in, what to drop, and what to bring back
  • Tool orchestration: which tools to call, when, and with what permissions
  • Verification loops: a structure that runs the model’s output, observes it, and rolls back if it is wrong
  • Subagent fan-out: a structure that splits big jobs in parallel and merges the results
  • Separating planning from execution: making it think first, then act
  • Memory: state that persists across sessions
  • Permission gating: checkpoints placed in front of risky actions

Put it all together and you get a single system. The quality of that system matters as much as the quality of the model, and sometimes more.

Context Engineering: The Heart of the Harness

The longer an agent runs, the faster its context window fills up. Once the context gets messy, the model gets dramatically dumber. This is the so-called “context rot.” So the first requirement of a good harness is to manage context actively.

Compaction

When a conversation grows long, you summarize and compress the earlier part, keeping only the key decisions and state. The point is not to cut blindly but to fold things based on “what is needed to continue this task right now.” Keep file paths, failed attempts, and settled decisions; throw away verbose raw dumps of tool output.

Retrieval

You cannot put everything in context, so you fetch only what you need when you need it. Instead of stuffing the whole codebase into the prompt, you pull in only the relevant files on demand with a search tool. As of early 2026, “find it when needed” clearly beats “load everything up front.” Just-in-time context is close to the right answer.

Memory

Information that must persist across sessions gets written to files or external storage. Even this blog project has past decisions accumulated in MEMORY.md, and the agent reads it at the start every time. Memory is the most practical trick for working around the limits of the context window.

System architecture

Advertisement

Tool Orchestration and Permission Gating

The moment you hand a model tools, the harness suddenly becomes dangerous. It can now delete files, run commands, and call APIs. This is where the real engineering of the harness begins.

A few core principles.

  • Keep tools narrow and clear: tools whose intent is visible, such as read_file, edit_file, and run_tests, confuse the model less than an all-purpose tool like run_anything.
  • Grant permissions in stages: reads are free, writes need confirmation, and destructive actions need explicit approval. Set the height of the gate according to the risk.
  • Treat errors as learning signals: when a tool fails, return the error message to the model as is. A good harness does not hide failures but turns them into feedback.

Permission gating is especially important. Autonomy and safety are a trade-off, and the harness is the device that adjusts that dial. Just putting a gate in front of commands like rm -rf or force push prevents a large share of major incidents.

Toris also treats the gate in front of destructive commands as non-negotiable. In a one-person operation there is nobody to clean up after an accident, so we start the autonomy dial conservative and loosen it only as far as the verification loop has earned trust.

The Plan, Execute, Verify Loop

What I see as the skeleton of a harness is this loop. Instead of telling the model “do it all at once,” you break the work into a cycle of think, act, check.

# Core harness loop (pseudocode)
def agent_loop(task, tools, max_steps=25):
    context = init_context(task)
    plan = model.plan(context)          # 1) Plan: make it think first

    for step in range(max_steps):
        action = model.act(context, plan, tools)  # 2) Execute: decide the tool call

        if action.needs_permission:
            if not gate.approve(action):           # permission gating
                context.add("Denied: find an alternative")
                continue

        result = tools.run(action)                 # run the tool
        observation = verify(action, result)       # 3) Verify: observe the result

        context = compact_if_needed(context)       # context management
        context.add(observation)

        if observation.task_complete:
            return finalize(context)

    return escalate("Max steps exceeded - human intervention needed")

Here verify() is where the harness is won or lost. The model saying “I’m done” and the work actually being done are entirely different matters. So verification has to rest on observable signals, not the model’s self-report.

# Verification gate: trust actual results, not the model's words
def verify(action, result):
    if action.type == "edit_code":
        test_result = run("npm test")           # actually run it
        type_result = run("tsc --noEmit")        # check types too
        return Observation(
            task_complete=test_result.passed and type_result.passed,
            feedback=collect_errors(test_result, type_result),
        )
    # ... per-tool verification rules

Whether this “actually run it” step exists is what separates an agent that works in demos but collapses in production from one you can truly trust. Just slotting the verification tools we already have (tests, type checks, lint, builds) into the loop makes reliability jump.

The verification gate is also the first place Toris invested in the harness. If a person had to recheck every agent output, the time a one-person studio gains would vanish. A structure where only output that passes tests, type checks, and lint reaches review effectively stands in for QA staff.

Orchestration

Subagents and Parallel Fan-Out

The constraint that context is finite leads to an interesting solution. Instead of trying to handle everything in one huge context, you split the work and hand the pieces to multiple subagents.

# Subagent fan-out sketch
def investigate_codebase(question):
    subtasks = [
        "Find where the authentication logic is handled",
        "Summarize the DB schema and migrations",
        "Investigate the permission checks on API routes",
    ]
    # Each subagent gets its own clean, independent context
    results = parallel_map(
        lambda t: spawn_subagent(t, tools=READ_ONLY),
        subtasks,
    )
    # The parent receives only result summaries, not raw file dumps
    return orchestrator.synthesize(question, results)

This structure has two appealing properties.

  • Context isolation: each subagent gets a clean context focused only on its own task. The parent orchestrator receives only refined summaries instead of the messy intermediate steps.
  • Parallelism: independent investigations can run at the same time. Wall-clock time drops, and each one can dig in from a different angle.

Claude Code’s subagents and Codex’s task splitting are both variations on this idea. Break a big problem into small ones, give each a fresh context, and merge the results. It is surprisingly similar to how we organize human teams.

Why the Harness Matters More Than the Raw Model for Reliability

Back to the core claim. Why does the harness matter so much?

First, reliability is a systems problem, not a multiplication problem. Even if a model is 95% accurate per step, a 20-step task drops to 0.95^20 ≈ 36% by simple multiplication. Without verification loops and retries, long tasks almost inevitably fail. The harness is the error-correction device that prevents this collapse of probability.

Second, the model is stateless. Every call is independent. Consistency across sessions, respect for past decisions, and adherence to project conventions all come from the harness (memory, context injection), not the model.

Third, safety comes from the system, not the model. Even a well-aligned model makes mistakes. What blocks destructive commands is not the model’s good intentions but the harness’s permission gate.

AspectRaw model’s roleHarness’s role
Single-step reasoning qualityOSupporting
Long-task reliabilityCeiling onlyDecisive
Cross-session consistency/memoryXO
Safety/permission controlPartialO
Context efficiencyXO
Parallel processing/scalingXO
Domain-specific workflowsXO

In short, a better model raises the ceiling, but it is the harness that actually gets you up to that ceiling. That is why two products using the same model can feel worlds apart.

Claude Code and Codex Are Both “Harnesses”

Through this lens, today’s coding agents look different. We often talk about Claude Code and Codex as if they were “models,” but more precisely they are harnesses layered on top of models.

  • Claude Code: a harness wrapped around the Claude models. File system tools, permission gating, subagents, memory (CLAUDE.md), compaction, even the hook system: all of it is harness-layer engineering. Even if you swap the model, the value of this harness remains.
  • Codex: a harness wrapped around OpenAI models. It provides isolated execution environments, task orchestration, and verification loops. Again, a large part of the core value lies in the scaffolding.

The competition between the two is not simply a fight over “whose model is smarter.” It is a fight over whose harness is better designed. How cleverly it manages context, how tightly it applies verification, and how smoothly it handles permissions are what shape the real-world experience.

That is why, when I evaluate an agent these days, I do not look only at model benchmark scores. I look at how well this harness holds up on long tasks and whether it notices and fixes its own mistakes. That is what ultimately determines satisfaction with the tool I use every day.

So What Should You Do

For someone building agents directly, the takeaways are clear.

  1. Do not fixate on swapping models. Frontier models keep getting better. But if you want to raise reliability right now, fix the harness first.
  2. Put in verification loops first. Tests, type checks, actual execution: hold the model down with observable signals.
  3. Manage context. Do not put everything in; find things when needed and fold what has passed.
  4. Set up permission gates. Design the autonomy dial and the safety gates explicitly.
  5. Split and fan out. Distribute big tasks to subagents with clean contexts.

The model is the engine, and the harness is the body and brakes that let that engine run on a real road. Even the best engine is unusable without brakes. In 2026, AI engineering is shifting its center of gravity from “choosing a model” to “designing around the model.” Harness engineering is no longer optional; it is the main game.

How Toris Applies This

When deciding whether to adopt or replace an agent, Toris looks first at harness maturity (does it hold up on long tasks, does it notice when it is wrong) rather than model benchmarks. Verification loops and permission gates are the basic skeleton we set up before code when starting a new project. We also offer AI and workflow automation consulting that applies these principles as they are to clients’ agent and automation designs.

The official channels’ talks and demos on harnesses and agent design are worth a look.

References

Advertisement