Skip to main content
Lab Grimoire
TW EN
Coffee
Stop Blaming AI for Being Dumb — Your Agent Doesn't Need a Bigger Brain, It Needs an Operating System
Agent Architecture

Stop Blaming AI for Being Dumb — Your Agent Doesn't Need a Bigger Brain, It Needs an Operating System

On this page

Agent Harness Operating System Cover

The Setup: A 50-File Refactoring Disaster

Picture this scenario. You give AI a straightforward task: refactor a Python project with 50 files.

Files 1-10? Flawless. Elegant code. Clear architecture. Helpful comments. You think: "Wow, this is better than my teammates."

File 15? Getting a bit rough around the edges, but acceptable.

File 30? Real problems emerge. The AI contradicts itself. A constraint it set in file 5 gets overridden in file 30. Import conflicts. Naming inconsistencies.

File 45? Complete breakdown. It has no idea what it's doing. The logic is completely fragmented. Earlier decisions are undone.

Your reaction: "This AI is useless for serious work. I can't trust it with long tasks."

But the real story is different. You didn't hire someone with low intelligence. You gave a genius brain zero infrastructure.


AI Models Are CPUs. Where's the Operating System?

Let's go back to computer history.

In the 1940s, computers were just raw CPUs. One program at a time. One crash and the whole machine went down. No isolation. No protection. No management.

Then in the 1960s, operating systems emerged. They inserted a management layer between the CPU and programs:

  • Memory isolation (each program gets its own space)
  • Process scheduling (deciding who runs when)
  • Resource allocation (managing CPU, RAM, disk)
  • Security boundaries (one program can't trash another)

Suddenly? You could run 100 programs simultaneously without them interfering.

Now look at AI Agents. What we've built is essentially a 1940s computer—a bare LLM. We call an API, feed context, get output. Done. No management layer. No operating system.

So when Agents encounter long-running tasks, they crash. Not because they're unintelligent. But because they lack infrastructure.

Harness Architecture Stack

Four Ways Agents Fail Without an OS

Without an operating system, Agents fail in four predictable modes.

1. Context Rot

An LLM's context window is finite—say, 200K tokens. For the first 10 steps, the Agent remembers your original goal and constraints. By step 50, new information floods in and old constraints get overwritten. It forgets things like "don't delete that file."

UC Berkeley researchers found: 67% failure rate in 72-hour-long tasks, primarily due to context rot.

2. Runaway Loops

The Agent gets stuck in "try this method → fail → try the exact same method → fail again." No one tells it to stop and try something different. CPU spikes. Costs explode. Progress: zero.

3. Compounding Hallucinations

One hallucination triggers a chain of hallucinations. The Agent confidently invents a Python function that doesn't exist. Every subsequent step is built on this fiction. By the end, you're constructing a house on sand.

Anthropic research: Agent self-evaluation accuracy is only 23%. It's wildly optimistic.

4. Zero Safety Boundaries

No "pause zone." The Agent can do anything—delete critical files, modify production configs, execute rm -rf /. No one asks "are you sure?"

The damage is irreversible.


Same Brain, Different Harness, Double the Score

Now for the evidence that shatters everything.

Anthropic engineers ran an experiment:

  • Model: fixed (GPT-5.2-Codex—no upgrade)
  • Changed: only the harness architecture (the Agent's execution environment)
  • Benchmark: Terminal Bench (complex code generation)

Result: 52.8% → 66.5%. A 13.7 percentage-point jump.

Same "brain." Different "harness." Performance doubles.

Why Agents Can't Self-Evaluate

Anthropic discovered a fundamental Agent flaw: self-evaluation bias.

If you tell an Agent "write code, then test it yourself," the Agent is overly optimistic. Code that it wrote always looks correct to it. Actual accuracy? Only 23%. But external verification achieves 87%.

This means any "self-correcting" Agent has an inherent weakness. You need an independent validator—a different AI or human—to check the first Agent's work.

This is Generator-Evaluator separation. It must be built into the harness.

Stripe's 1,300 AI PRs Per Week

Stripe has an internal system called Minions that automatically generates code improvements, fixes bugs, and optimizes performance. It produces roughly 1,300 Pull Requests per week.

On the surface: "AI has become superhuman!"

Reality? 99% of PRs merge automatically. Only 1% need human review.

The secret isn't the model. It's the harness. Stripe's Minions includes:

  • Automated test verification
  • Code style checking
  • Security scanning
  • Pre-merge validation

That 1% of flagged PRs? All caught by the harness's Safety Guard component—high-risk operations that require human approval.

Vercel's Tool Paradox

Vercel engineers discovered something counterintuitive: More tools lead to higher failure rates.

  • 100 tools available: 68% failure rate
  • 50 tools: 42%
  • 20 tools: 19%
  • 15-20 carefully chosen tools: 8-12%

Why? Choice paralysis. Too many options means too many decision points, too many potential conflicts.

Removing 80% of tools improved reliability by 50%.

This reveals a key principle of harness engineering: Constraints enable reliability.


The Six Organs of a Harness

The Six Organs of a Harness

Think of an Agent as a human body. The LLM is the "brain." But a brain alone isn't a person. You need a heart, lungs, liver.

A harness is the Agent's "organ system."

1. Prompt Management (Identity Card)

Function: Injects the Agent's role, rules, and constraints into the system.

Analogy: An employee's job contract.

"What's your position? What can you do? What can't you? What's the priority when there's conflict?"

Failure symptom: Agent forgets its role. Starts as "code reviewer," ends as "system architect." Breaks its own constraints.

Results (by the numbers):

  • Constraint adherence: 62% → 94%
  • Out-of-scope operations: 71% reduction

The simplest implementation is an about-me.md:

I am a professional Python code reviewer.
Role: Check code quality, suggest improvements.
Can do: Suggest changes, rewrite snippets.
Cannot do: Delete files, modify main branch.
Priority: Safety > Performance > Readability.

2. Memory Management (External Hard Drive)

Function: Persists intermediate results to files, preventing context window overflow.

Analogy: Your notebook. Brain can't remember everything. Write important things down.

Failure symptom: Each step starts from zero. Can't build multi-step reasoning. Repeated analysis. Context window fills up, old decisions get discarded.

Implementation:

Step 1: Generate design → write design.md
Step 2: Analyze dependencies → write dependencies.json
Step 3: Implement module A → write module_a.py
Step 4: Implement module B → read design.md, dependencies.json

Results:

  • Context utilization: 82% → 41% (more room to think)
  • 100+ step task success: 12% → 76%
  • Decision coherence: 44% → 91%

3. Tool Orchestration (Tool Manager)

Function: Intelligently schedules tools, handles conflicts, prevents cascade failures.

Analogy: An orchestra conductor. Every musician is skilled, but without a conductor, chaos.

Failure symptom: Tool conflicts. Tool A contradicts tool B. Cascade failures. Agent doesn't know the right sequence.

Implementation:

Scheduling rules:
  Must run first: dependency_check
  Can run in parallel: lint + type_check
  If lint fails: pause, require fix
  Only after lint passes: run test
  Conflict priority: Safety tools > Functional tools > Optimization tools

Results:

  • Tool call errors: 34% → 3%
  • Cascade failures: 87% reduction

4. Lifecycle Control (Heart Rate Monitor)

Function: Sets step, token, and time limits. Detects runaway loops.

Analogy: Hospital monitoring. Continuous vital signs. Alarm if abnormal.

Failure symptom: Infinite loops (trying the same thing 10,000 times). Cost explosion ($1,000+ in tokens). Endless user wait. Can't tell if Agent is still working or dead.

Implementation:

Monitoring:
  Step limit: 200 max
  Token limit: 100,000 max
  Time limit: 5 minutes max
  No-progress detection: 5 consecutive steps with no new output → replan

Results:

  • Infinite loops: 100% intercepted
  • Average token consumption: 43% reduction

5. Safety Guard (Hard Hat)

Function: Pauses high-risk operations, requests human confirmation.

Analogy: Pilot's pre-flight checklist. Even experienced pilots verify.

Failure symptom: Agent deletes wrong files. Changes production configs. Executes dangerous commands. Damage is irreversible.

Implementation:

High-risk operations:
  Deletions → require human confirmation
  Config modifications → require human confirmation
  Database operations → require human confirmation
  External API calls → require human confirmation

Results:

  • Irreversible errors: 0 (vs. 2-3 per month before)
  • Human intervention rate: 2-3%

6. Observability (Black Box Flight Recorder)

Function: Records every decision, input, output, reasoning. Enables debugging and auditing.

Analogy: Airplane black box. Records all data. Used to investigate crashes.

Failure symptom: Agent failed. You don't know why. Can't reproduce. Can't trace which step broke. Can't audit.

Implementation:

Record each step:
{
  "step": 1,
  "timestamp": "2026-03-30T14:22:15Z",
  "action": "analyze",
  "input_size": "2.3 KB",
  "output": "requirements.md",
  "tokens_used": 2341,
  "decision_reason": "Identified modules A, B, C",
  "status": "success"
}

Results:

  • Debugging time: 72% reduction
  • Root cause identification: precise
  • Audit trail: complete

Three Generations, One Sentence Each

Technology progresses by chasing bottlenecks.

Generation 1: Prompt Engineering (2022-2023)

Question: "How do I ask best?" Solution: Few-shot examples, role-setting, chain-of-thought. Ceiling: 30-40% improvement.

Generation 2: Context Engineering (2023-2024)

Question: "How do I feed the best data?" Solution: RAG, knowledge graphs, data integration. Ceiling: 40-60% improvement.

Generation 3: Harness Engineering (2025-present)

Question: "How do I build the best environment?" Solution: Memory management, tool orchestration, lifecycle monitoring, safety boundaries. Ceiling: Theoretically 80%+ (extrapolating from 52.8% → 66.5%).

Each generation solves the previous bottleneck and reveals the next one.

Models determine whether an Agent "can think." Harnesses determine whether an Agent "can actually do it."

The AI battlefield of the next decade won't be won by parameter count. It will be won by infrastructure.


What You Can Do Today

Don't wait for a Kubernetes-scale standard framework. Three simple steps. Start now.

Step 1: Give Your Agent an Identity (30 minutes)

Write an about-me.md:

# about-me.md
I am [Agent Name]
Expertise: [specific domain]
Can do: [ability list]
Cannot do: [boundary list]
Priority: [decision order]
Standards: [style guide]

Effect: Constraint adherence ↑ 62% → 94%.

Step 2: Use the File System, Not Context (1 hour)

Assign a file to each output type:

  • Design decisions → design.md
  • Dependency analysis → dependencies.json
  • Implementation → modules/
  • Test results → test_results.md
  • Decision log → decisions.log

Agent writes results. Agent reads files when needed.

Effect: 100+ step task success ↑ 12% → 76%.

Step 3: Start Recording Decision Traces (2 hours setup)

Log each step to execution_trace.jsonl:

{
  "step": 1,
  "timestamp": "2026-03-30T14:22:15Z",
  "action": "analyze_requirements",
  "output": "requirements.md",
  "tokens_used": 2341,
  "decision_reason": "Identified modules A, B, C as core",
  "status": "success"
}

Effect: Debugging time ↓ 72%, full audit trail available.


References

  1. Anthropic Engineering. (2025). "Harness Design for Long-Running Application Development."
  2. ICML 2025. "Agent Infrastructure Evaluation Study."
  3. OpenAI. (2024). "Codex Internal Report — 3 Engineers, 5 Months, 1M Lines."
  4. Stripe Engineering. (2025). "Minions System — 1300 AI PRs per Week."
  5. UC Berkeley. (2025). "Multi-Agent Trace Analysis: 1,600 Failure Cases."
  6. Vercel Engineering. (2025). "Tool Orchestration and Reliability Trade-offs."

Frequently Asked Questions

What exactly is a harness?

It's the execution environment for an Agent—responsible for rule enforcement, memory management, tool orchestration, lifecycle control, safety guardrails, and observability. Think of the model as the brain and the harness as the operating system that lets the brain work reliably.

Won't upgrading to a stronger model just fix everything?

Not necessarily. The same model can perform very differently depending on its harness. The model sets the ceiling, but the environment often determines whether you can reach it—especially on long-running tasks.

Does this matter for everyday users, not just engineers?

Yes. If you're using AI for extended writing, research synthesis, file rewriting, or any multi-step workflow, you're already hitting harness-level problems. You just didn't have a name for it before.

Found this useful?

Follow for new AI × biomedical research notes:

Or buy me a coffee to keep new content coming.

☕ Buy Me a Coffee