LIVE
Back to journal
12 min read
AI & Development

Stop Chasing AI Model Releases: Build a Better Agent Harness

>A practical guide to improving coding-agent results through repository context, tools, sandboxing, feedback loops, evaluations, and token-efficient workflows.

ShareXLinkedIn

🎧 Listen — ~12 min

Audio summary not available yet

~12 min
Stop Chasing AI Model Releases: Build a Better Agent Harness
Verified by Essa Mamdani

Short answer: If your coding agent keeps making shallow edits, losing the task, or claiming success without checking its work, another model release may not be the fix. Improve the harness: the instructions, repository tools, execution environment, context-management rules, verification loop, and safety boundaries surrounding the model. A capable model can only use the information and actions its environment makes available.

This does not mean model choice is irrelevant. A stronger model can improve difficult reasoning, code comprehension, and tool selection. But model upgrades are only one lever—and they are often the most visible one, not the highest-return one. OpenAI’s engineering account of building with Codex describes early progress slowing because the environment was underspecified, then improving by making repository knowledge, tools, architecture rules, and feedback loops legible to agents. Anthropic similarly describes agents as models operating through tools and environmental feedback, and recommends measuring the system and adding complexity only when it improves results.

The practical shift is simple: stop asking only, “Which model should I try next?” Also ask, “What can my agent see, what can it safely do, and how does it know whether it succeeded?”

What is an agent harness?

An agent harness is the operating system around an AI model’s work loop. It commonly includes:

  • Task framing: the user request, acceptance criteria, constraints, and stop conditions.
  • Context: repository instructions, relevant files, conversation history, and retrieved knowledge.
  • Tools: file search, shell, code editing, browser, APIs, tests, and other callable actions.
  • Execution environment: the checkout, dependencies, network access, secrets policy, and sandbox.
  • Orchestration: the loop that submits model turns, executes tool calls, handles retries, and preserves progress.
  • Feedback and verification: test results, compiler errors, lint output, browser checks, code review, and human approval.
  • Safety controls: least-privilege permissions, protected branches, approval gates, and auditability.

The model proposes what to do. The harness supplies the workspace, performs permitted actions, returns grounded results, and decides whether the task is actually complete. In other words, a coding agent is not just a model plus a clever prompt; it is a model embedded in a feedback-and-control system.

diagram

Why the environment can beat another model upgrade

Imagine an agent asked to fix a broken API endpoint. It cannot inspect the call sites, does not know how to run the project, sees a 5,000-line log, and has no test that captures the bug. A newer model might reason better, but it still lacks the missing evidence and reliable feedback.

Now give it a readable project map, fast search, a reproducible test command, concise output, and permission to edit only the working tree. The agent can trace the route, make a focused change, run the relevant check, and iterate on actual failures. That changes the task from “guess what might work” into “observe, act, verify.”

OpenAI’s harness-engineering write-up describes this shift as designing environments, specifying intent, and building feedback loops. Its team reports using repository instructions, architecture constraints, linters, structural tests, and review loops to make agent work more reliable. Those are the company’s reported engineering lessons, not a guarantee that any team will achieve the same throughput. The broadly useful principle is that capability should be made legible and enforceable in the workspace.

The seven parts of a stronger coding-agent setup

1. Make the repository explain itself

Start with a short root AGENTS.md (or the instruction-file convention supported by your agent). It should answer practical questions:

  1. What does this project do?
  2. Where are the main application, tests, and shared utilities?
  3. Which command installs dependencies, starts the app, and runs focused checks?
  4. What architecture or security rules must not be broken?
  5. What must the agent report before calling a task done?

Prefer durable rules over a dump of every project fact. A sprawling instruction file spends tokens on details the agent may not need and is harder to keep current. Put deeper, task-specific guidance in smaller files or skills and load it when relevant. Keep examples executable and commands accurate. If a rule matters, enforce it with a test or linter where possible; prose alone is easy to miss and difficult to audit.

Useful companion files can include a concise README.md, CONTRIBUTING.md, architecture notes, package scripts, and a decision record for genuinely non-obvious choices. A MEMORY.md can help a long-running agent workflow, but should store durable project facts—not a transcript or secrets. The current source tree and tests remain the truth when memory conflicts with code.

2. Give the agent high-signal tools, not a tool zoo

An agent needs a small, understandable interface to its environment. For coding, that often means:

  • Search and file listing: rg and rg --files quickly narrow the search space.
  • Version control: inspect diffs and status before edits; preserve unrelated work.
  • Targeted editing: patch a small region rather than rewriting entire files.
  • Project checks: run the narrow test first, then broader checks when warranted.
  • Browser or API access: only when the task needs current external evidence or UI validation.
  • Structured tool output: return concise results, exit codes, and relevant error lines.

More tools are not automatically better. Overlapping names and vague descriptions create choice points; large raw outputs consume context without improving decisions. Anthropic’s context-engineering guidance specifically treats tools as the contract between an agent and its information/action space: tools should be clear, useful, and token-efficient. Design them around work the agent actually needs to do.

For a catalog of available coding tools and agent interfaces, browse the coding-agent directory. The right choice is the one that works with your repository, provider, permission model, and verification workflow—not simply the one with the newest launch announcement.

3. Make the workspace predictable and safe

An agent should know where it is working and what its actions can affect. Provide a disposable branch, worktree, or sandbox for meaningful changes. Keep production credentials out of ordinary model context; expose only narrowly scoped credentials when the task genuinely requires them. Limit network access if arbitrary internet access is unnecessary, and require explicit review before deployments, destructive operations, or external messages.

Use least privilege: read-only access for investigation, write access to a scoped workspace for implementation, and an approval gate for high-impact actions. A sandbox is not a substitute for security review, but it reduces the blast radius of mistakes. Define what the agent may change, what it must not touch, and what evidence is required before merging.

OpenAI’s computer-environment engineering article describes the same basic loop: the model proposes commands, a controlled environment runs them, and bounded output is returned for the next decision. It highlights isolated filesystems, restricted network access, intermediate storage, retries, and context management as practical environment concerns. Apply the same thinking whether you use a hosted container or a local development machine.

4. Keep context relevant across long tasks

A large context window does not make every possible detail useful. Irrelevant history, duplicated instructions, giant logs, and whole-repository dumps can crowd out the evidence that matters. Use progressive disclosure:

  1. Give a compact project map and task constraints up front.
  2. Search for relevant code instead of pasting the entire repository.
  3. Read the call path and tests around the target before editing.
  4. Retrieve deeper docs only when the task needs them.
  5. Summarize durable progress at natural checkpoints in long sessions.
  6. Compact old context by preserving decisions, changed files, test results, and remaining work—not chat history verbatim.

Anthropic calls this broader problem context engineering: curating the information available to the model at each step, not merely wording the initial prompt. Its guidance describes combining small upfront instructions with just-in-time exploration tools such as file search and grep. This reduces stale context while leaving the agent able to investigate unfamiliar areas.

Token-saving tools can help, but the main savings usually come from not sending irrelevant material, not repeating stable prefixes, and not returning giant tool outputs. Keep command results bounded; show a concise summary plus a way to inspect full logs when needed. The goal is not minimum tokens at any cost—it is maximum useful evidence per token.

5. Build a fast, truthful feedback loop

The highest-value environment improvement is often the ability to find out quickly whether a change works. Establish a check sequence such as:

text
1inspect repository and task-specific instructions
2→ reproduce the failure or identify the missing behavior
3→ make the smallest coherent change
4→ run the focused test or typecheck
5→ inspect the diff and affected call sites
6→ run broader checks if risk warrants
7→ report evidence, limitations, and unrun checks

Tests should catch the behavior that matters, not merely exercise a line. Add a regression test when fixing a bug; use type checking, linting, schema validation, or a browser smoke test where they provide meaningful evidence. Return failures clearly: the command, exit status, and a short relevant excerpt. Avoid “green” success messages when the command was skipped, timed out, or tested the wrong checkout.

For UI tasks, a passing build is not proof the page is usable; load it in a browser and inspect the changed path. For data or migrations, verify the resulting record and preserve rollback/recovery options. For deployment, separately confirm the pushed revision, the deployed revision, and the live behavior. Each is a different claim.

6. Evaluate the harness, not only the model

Create a small set of representative tasks from your own work: a bug fix, a feature with tests, a refactor, a documentation change, and one task that should be refused or escalated. For each model/harness combination, track:

MeasureWhat it tells you
Task successDid the requested behavior pass its acceptance checks?
Regression rateDid the change break existing behavior?
Human interventionHow often did a person need to redirect or repair the run?
Tool efficiencyWere the right tools used without repeated dead ends?
Wall-clock timeHow long did a correct result take, including checks?
Token and tool costWhat did the successful run consume?
Safety behaviorDid it stay within permissions and ask at the right boundaries?

Run the same tasks when changing the model, system instructions, tools, or environment. Otherwise, you will not know which change caused the improvement. Record versions and configuration with results, and keep a few failure examples; a single average score can conceal an unsafe or brittle behavior.

Benchmarks are useful but not interchangeable. OpenAI and Anthropic both describe coding-agent evaluations where environments, tools, and scaffolds shape what the model can do. Treat a score as evidence about a particular model-plus-harness setup, not a context-free ranking of models.

7. Add autonomy only where the loop is reliable

Do not start with a fleet of agents and dozens of tools. Begin with one agent, a bounded task, and a clear acceptance test. Add subagents when work can be split into independent investigations or reviews; otherwise coordination overhead can cost more than it saves. Add persistent memory when repeated tasks demonstrate that useful facts are being lost. Add automated deployment only after verification and approval boundaries are already dependable.

Autonomy amplifies both competence and mistakes. Let the agent make reversible local changes first. Escalate irreversible operations, security-sensitive changes, production access, and ambiguous product decisions to a human. Use a maximum iteration count or budget, and stop with a precise blocker instead of looping indefinitely.

A practical one-hour harness upgrade

You do not need to rebuild your stack. Try this sequence in an existing repository:

  1. Pick three real tasks that have failed or required repeated steering.
  2. Write a concise root instruction file with project map, exact check commands, constraints, and completion-report expectations.
  3. Make one fast check reliable—for example, the targeted test command or a deterministic reproduction script.
  4. Give the agent precise search and diff access and cap noisy command output.
  5. Run one task with the current setup and note where it guessed, searched too broadly, or declared success too soon.
  6. Fix the environment failure once—missing docs, unreliable command, unclear tool, absent fixture, or excessive permissions.
  7. Rerun the same task and compare correctness, intervention, time, and cost.

This is a better first experiment than switching models without a baseline. If the task still fails after the environment becomes clear and measurable, then compare models on the same harness. Sometimes the model really is the limiting factor; the point is to discover that with evidence.

When should you upgrade the model?

Upgrade—or route a task to a stronger model—when a clean, well-instrumented harness still shows a repeatable reasoning limitation: the model misunderstands a valid requirement, cannot navigate the relevant code despite useful tools, or fails a task that your evaluation demonstrates is within scope for another candidate.

Do not use model replacement to paper over missing tests, stale instructions, broken dependencies, opaque errors, or overbroad permissions. Those problems affect every model and often get more expensive as the model becomes more capable.

If you are comparing models for a coding workflow, use the AI model directory to explore candidates, then test them on your own task set. Measure the complete workflow: a model that writes code quickly but needs repeated correction may be slower and more costly than one that produces a verifiable patch on the first pass.

FAQ

What does “harness” mean for an AI coding agent?

It is the system around the model: task instructions, context, tools, orchestration, execution environment, feedback, evaluation, and permission controls. The harness determines what the agent can inspect and do, and how the application checks its result.

Is the harness more important than the model?

Neither is universally more important. Model capability sets an important ceiling, while the harness determines how much of that capability can be applied reliably to a task. Improve obvious environment gaps first, then benchmark candidate models on the same setup.

Does a larger context window solve agent failures?

No. More capacity can help with some long tasks, but irrelevant or stale context can still degrade performance. Retrieve information when needed, keep outputs concise, and preserve task-relevant state across long sessions.

Should every repository have an AGENTS.md or similar file?

A short repository guide is useful when it explains project-specific commands, architecture, or safety rules that are otherwise hard to discover. Keep it accurate and concise, and enforce critical requirements with automated checks where possible.

How can I tell whether a harness change helped?

Rerun the same representative tasks and compare acceptance-test success, regressions, human interventions, time, token/tool cost, and permission behavior. Record the model and configuration so the comparison is reproducible.

Sources and further reading

Keep reading

#AI agents#coding agents#harness engineering#context engineering#developer productivity#agentic coding
ShareXLinkedIn

⚡ Daily AI Model Drop — Get Kimi K3 benchmarks before Twitter

Join 2,400+ AI engineers. 1 email/day, no spam, unsubscribe anytime

Comments