Home / Articles / Blog

AI Coding Isn't the Hard Part Anymore. Harness Engineering Is.
Harness EngineeringAI CodingAI AgentsClaude CodeCodexAGENTS.mdMCPAgent Skills

AI Coding Isn't the Hard Part Anymore. Harness Engineering Is.

Harness engineering explained for developers: the 7 layers of an AI coding harness (context, skills, tools, sandboxing, verification, memory, feedback), a starter stack, and why Gartner calls it a 2026 trend.

AIShrey Vijayvargiya

Every few weeks a new AI coding tool becomes the thing everyone argues about. Claude Code, Codex, Cursor, Gemini, whatever open-source agent trended on GitHub this week.

And the arguments are always the same: benchmarks, tokens per second, context windows, pricing.

I think we're comparing the wrong thing.

The next real advantage in software development won't be which model you use. It will be how well you build the environment around it.

People are starting to call this harness engineering. If you write code with agents every day, it's worth understanding before 2027 gets here.

1. The model isn't the problem

Say you ask an agent to add a payment system to an existing SaaS app. It can read the repo, write the endpoints, create the schema, install packages, run commands and fix its own errors. That part is genuinely impressive.

Now think about what it doesn't know:

  • Your app uses a specific authentication strategy.
  • Some database relationships must never change.
  • Payments need idempotency.
  • Your API responses follow one particular format.
  • Production has restrictions.
  • One package is already deprecated in your project.

The agent can write code that compiles, passes a quick look, and is still a bad implementation. That isn't the model being dumb. Nobody told it how your project works.

An agent doesn't pick up your standards, business logic or infrastructure by itself. You have to put them in its workflow.

2. So what is harness engineering?

A model is the intelligence. An agent is the system that uses it to get things done. The harness is everything else: the instructions, tools, constraints and feedback that make the agent useful and reliable.

My rough equation:

Agent = Model + Tools + Context + Execution Environment + Feedback Loop

Harness engineering is designing and improving all of that, so the agent can finish real engineering tasks without you babysitting it.

It covers context, repository instructions, skills, tool integrations, permissions, tests and evals, and memory.

There's a side benefit I like. If the harness is yours, you can switch model providers without rebuilding your whole workflow. The harness is what you keep. The model is what you swap.

3. The 7 layers of a good harness

This is how I'd build one.

Layer 1: Context

An agent has to understand the project before it changes it. Don't expect it to digest a 100,000-line repo from scratch on every task. Give it structure:

text
/project
  /src
  /components
  /database
  /api

  AGENTS.md
  README.md

  /docs
    architecture.md
    database-schema.md
    api-conventions.md
    deployment.md
    business-logic.md

The docs should say what the app does, how the architecture and auth work, how the database relationships are set up, where the important business logic lives, and how to run and test everything.

The goal isn't more information. It's the right information at the right moment.

Layer 2: Instructions and skills

Some rules shouldn't change from one conversation to the next. Put them in a file the agent reads every time:

text
AGENTS.md

# Project Rules

- Use JavaScript for new application code.
- Follow existing folder conventions.
- Never duplicate existing API functionality.
- Validate all external inputs.
- Use existing authentication middleware.
- Never expose secrets in client-side code.
- Add tests for important business logic.
- Run linting before completing a task.
- Never modify production configuration without approval.

Then add skills for the work you repeat:

text
/skills
  frontend-development/
    SKILL.md

  backend-development/
    SKILL.md

  database-migrations/
    SKILL.md

  security-review/
    SKILL.md

  deployment/
    SKILL.md

A frontend skill explains your component architecture. A database skill covers migration conventions and transactions. A security skill tells the agent how to review auth and sensitive data.

Instead of pasting the same instructions into every prompt, you write them once.

Layer 3: Tools and integrations

An agent with no tools can only suggest things. With the right ones it can actually work inside your environment, and this is where MCP, CLIs and APIs come in:

  • GitHub for issues, branches and pull requests
  • database tools for inspecting schemas
  • browser automation for testing the app
  • a terminal for running commands
  • documentation retrieval for framework references
  • monitoring tools for investigating errors

Don't give every agent access to everything. A frontend agent has no business writing to the production database, and a code review agent doesn't need permission to deploy.

Layer 4: Execution environment and sandboxing

This is the layer people skip, and it's the one that can hurt.

An agent can run commands, install packages, edit files and talk to external systems. So what happens when it runs something destructive? When an untrusted repo contains malicious instructions? When it leaks an environment variable?

A proper harness defines:

  • filesystem boundaries
  • network restrictions
  • environment variable isolation
  • command permissions
  • database access levels
  • approval requirements
  • git branch isolation

On bigger projects, run agents in isolated containers or separate worktrees.

An agent needs enough freedom to work, and not enough to take down production.

Layer 5: Verification

If I had to pick the most important layer, it would be this one.

An agent saying "task completed" doesn't mean the task is completed. You need something objective to check it against:

text
Agent completes task
       |
       v
Run unit tests
       |
       v
Run integration tests
       |
       v
Run lint and type checks
       |
       v
Run security checks
       |
       v
Review changed files
       |
       v
Human approval
       |
       v
Merge and deploy

Decide what success means before the agent starts. For a payment integration that looks like:

  • Does payment creation work?
  • Are duplicate requests handled?
  • Is webhook signature verification on?
  • Are failed payments handled?
  • Are secrets kept server-side?
  • Do the existing checkout flows still work?

A good harness doesn't just help the agent write code. It helps the agent find out when the code is wrong.

Layer 6: Memory and state

Most coding sessions begin with the agent rebuilding context from nothing. On a long project, that gets expensive fast.

If an agent works on a feature across several sessions, it should be able to recover what's already built, which decisions were made, what's unfinished, which tests failed, what blocked it, and which files it touched.

Plain files are enough:

text
/agent-state
  project-context.md
  decisions.md
  current-task.md
  completed-tasks.md
  known-issues.md

One warning: don't trust the agent's memory blindly. Keep important decisions in version-controlled files, and check the real repository state before continuing. Memory should save repeated work. It shouldn't turn into a second source of outdated instructions.

Layer 7: Feedback

This is the layer that makes the rest improve.

A harness shouldn't sit still. Every failed task is feedback about it.

Say an agent keeps writing wrong database migrations. You look into it and find the database conventions were never written down. So you update the database skill, add a migration validation script, and write a test for that exact failure. The next agent has a much better chance of getting it right.

text
Agent executes task
       |
       v
Tests and evaluations
       |
       v
Failure analysis
       |
       v
Improve instructions and tools
       |
       v
Update harness
       |
       v
Better future execution

The aim is a system that gets a little better with every task.

4. How I'd build one from scratch

You don't need a new platform. Start with the tools you already use:

ComponentPossible tools
Coding agentClaude Code, Codex, OpenCode
Model providerOpenAI, Anthropic, OpenRouter
InstructionsAGENTS.md
Agent skillsReusable SKILL.md files
IntegrationsMCP servers and CLIs
ContextRepository docs and code search
ExecutionDocker, containers, Git worktrees
VerificationTests, linting, CI/CD
MemoryMarkdown files and structured state
MonitoringLogs and evaluation results

A repo, a coding agent and a few scripts are enough to begin. Add the rest when your workflow needs it.

5. Why it changes how we build

Take two developers.

Developer A has the most powerful model available. They write prompts, review the output and fix the mistakes by hand.

Developer B has a slightly weaker model, but also documented architecture, reusable skills, repo-aware context, automated verification, isolated environments, saved task state and feedback loops.

Over 100 engineering tasks, who ships more reliable software? I'd bet on B. What matters isn't how much code the model writes. It's how much of that code survives testing, review, integration and production.

6. The bigger idea: model independence

Right now many of us build the whole workflow around one AI coding product. But you could keep your engineering environment separate from your model provider, and run one shared harness across different models:

text
             YOUR PROJECT
                  |
                  v
          ENGINEERING HARNESS
                  |
       +----------+----------+
       |          |          |
    Context     Tools     Rules
       |          |          |
       +----------+----------+
                  |
                  v
           MODEL ROUTER
                  |
       +----------+----------+
       |          |          |
    Model A    Model B    Model C
       |          |          |
       +----------+----------+
                  |
                  v
          EXECUTION + TESTS
                  |
                  v
             VERIFIED PR

A cheaper model could handle documentation changes, a stronger one the architecture decisions, and another one the code review. The harness carries the rules, tool access, context and verification. The model becomes a part you can replace, not the foundation of everything.

I think that matters most for teams building their own agent infrastructure.

7. Where this is going

I see software engineering moving through three phases.

Phase 1, AI-assisted coding. AI autocompletes code, writes functions and explains errors.

Phase 2, agentic coding. You give an agent a task. It inspects the repo, edits files, runs commands and opens a pull request.

Phase 3, harness engineering. You build the system that lets agents run complex workflows with defined context, permissions, evaluations and feedback.

We're heading into the third one, and the big analysts are noticing. On November 18, 2026, Gartner named harness engineering as one of its top strategic software engineering trends for 2026 and beyond. Gartner describes it as configuring AI coding agents with the context, standards and guardrails they need to do engineering work reliably.

Its prediction is that by 2028, organizations with AI coding harness infrastructure will see 60% fewer post-deployment defects than those without it. That's a forecast, not a measured result, so I wouldn't plan around the exact number. But it shows where enterprise attention is going.

This doesn't make models irrelevant. They're just becoming one piece of a bigger system.

My prediction

In a few years, knowing how to use Claude Code, Cursor or Codex will be as ordinary as knowing Git. The skill that's actually worth something will be building the environment where autonomous agents can work safely and reliably.

I expect to see more developers building custom agent runtimes, repository intelligence systems, shared skill libraries, agent evaluation frameworks, sandboxed execution infrastructure and multi-agent pipelines.

And companies will stop asking only for people who can write code with AI. They'll ask for people who can engineer the system that does it.

So stop arguing about which model writes the best code. Spend that time building the harness that makes every model better.

External Links (1)

Explore topics

More in

Weekly letter

Subscribe to iHateReading

Our once-a-week newsletter on programming, jobs, AI, and building products online.

Our once a week newsletter on Programming, Jobs, AI, and Business