Festival AI Ticino 2° edizione

Your Agent Harness Should Be Tailor-Made

The problem isn't the model. It's the off-the-rack harness.

Stefano Maestri · maeste.it · Risorse Artificiali

the problem · the failures

The demo works. Until it doesn't.

Loops foreveron a tricky task, burning tokens
same turn, same mistake, all night
Edits the wrong filesin the wrong place
the conventions live in heads, not in the repo
Invents toolsthat don't exist
calls an API nobody wrote
Drifts off missionpolitely, mid-task
busy, plausible, no longer yours
Declares victory too early: "the code looks fine" becomes "the feature is complete"
the verification gap: the most common failure of all

You installed a framework, dropped in a system prompt, wired a few tools, and shipped. The demo was fine.

the evidence · same horse, different fates

The problem isn't the model

Same model, same prompt. Only the harness changes.

bare harnesstailored (3 roles)
20 min · $96 h · $200
app opens, input deadcore gameplay works

(documented case, Anthropic engineering, 2026)

The papers agree (arXiv 2607.06906 · 2605.23950)

same six models, orchestration onlycost −41% · time −44% · tokens −38%
harness vs model variance, long horizon×7

Swap the model, little changes. Reshape the scaffolding, everything changes.

the metaphor · q branch

James Bond doesn't buy off the rack

Q
──▶
Hidden compartmentfor the mission: what "done" means, what never to touch
Right fitfor the wearer: how you work, your rules, your taste
Built to movefor the terrain: builds, tests, repo layout, CI

Developer, project, mission: three bodies, zero shared measurements.

anatomy · five subsystems, one loop

What a harness actually is

Project rulesbriefing · red lines
Stateprogress · memory on disk
──▶
agent
──▶
Toolsshell · files · tests
Runtimedeps · services · versions
──▶
Checkstest · lint · build

checks feed back into the agent, every turn: the loop closes

  • Instructions: system prompt (the briefing), guardrails (the red lines)
  • Tools: boundaries, least privilege
  • Environment: reproducible, self-describing
  • State: context and memory that survive the session
  • Feedback: stop conditions, evals, budget, loop control

A prompt file is not a harness. The loop is.

the map · each failure has an owner among the five

Where generic defaults fail

The failureThe missing piece
Loops foreverstop conditions + budget
Edits the wrong filesinstructions that know the real inventory
Invents toolstool boundaries + project constraints
Drifts off missiondefinition of done + loop control
Declares victory too earlyexternalized verification (worker ≠ checker)

Autonomy is exactly where nobody's defaults stop working.

tailoring one of three · the instructions subsystem

Tailoring #1: encode the project's constraints

Off the rack: the giant file

AGENTS.md, 600 lines
├─ top      → recalled
├─ line 300 → the security rule,
│             diluted, ignored
└─ bottom   → recalled

Every failure adds a rule. The file only grows: context budget eaten, priorities blur, contradictions pile up.

Tailored: an entry file that routes

AGENTS.md, 50–200 lines
├─ overview + quick start
├─ hard constraints (≤15, real)
│   - Python: never relative imports.
│   - git: one plain command per call.
│   - never two builds in one tree.
└─ links → docs/api · docs/db · docs/testing
             (read only when the task needs them)

Every rule on the right is a scar. Off-the-rack doesn't know your scars. And an encyclopedia is not a map.

tailoring two of three · the feedback subsystem

Tailoring #2: define "done"

"agent says done"a feeling, not a fact
──▶
Layer 1 · staticlint · typecheck
▼
Layer 2 · runtimetests · the app actually starts
▼
Layer 3 · end-to-endthe full user flow, really executed
▼
doneonly after all three
  • Done is a stop condition, stated before the work starts: criteria, perf budget, perimeter
  • The judgment is externalized: the one who writes the code doesn't grade their own homework
  • Error messages carry repair instructions: what failed, where, how to fix
  • No refactoring until core functionality is verified

If the judgment stays inside the agent, "done" is a mood, not a fact.

tailoring three of three · loop control

Tailoring #3: guard the loop

The simplest loop is one command: a goal, a verification method, a stopping condition. Four kinds, chosen by one test: does this thing have an end?

Triggerschedule · event · previous task done
──▶
Discoverprogress file · issue tracker
──▶
Dispatchspawn an isolated worker
──▶
Verifytests · an independent judge
──▶
Persistprogress · commit · PR
──▶
Your inboxwork remains: it loops. done or blocked: you decide

The loop must not be guarded only by the thing inside the loop.

what to reach for · the parts a real loop is made of

The loop's toolkit: six primitives

Automationsthe heartbeat: scheduled and event triggers
──▶
Worktreesparallel isolation, no collisions
──▶
Skillsproject knowledge, written once
──▶
Connectorsissue tracker · db · staging · chat
──▶
Sub-agentsmaker / checker split
──▶
External statethe spine: memory on disk, not in the window

the state feeds back into every heartbeat: everything reads and writes it

The agent forgets. The repository doesn't.

the receipts · same models, tailored scaffolding

The numbers agree

20% → ~100%same model, four harness additions over four iterations
rules, verification commands, progress state
−41% / −44% / −38%cost / time / tokens, six fixed models
only the orchestration changed
×7harness variance vs model variance
long-horizon tasks
~1M linesthree engineers who wrote no code themselves
~1,500 PRs in five months, agent-generated

None of these numbers were moved by a bigger model.

closing idea · software, not configuration

The reframe: harness as runtime

  • The harness is the runtime. Agents are the software that runs on it.
  • The repo is the spec: everything the agent needs lives in the repository, structured, verifiable.
  • Harness rots like code. Audit it. Pay down harness debt like technical debt.

Whoever owns the harness owns the agent.

takeaways · three moves, monday morning

Takeaways

  1. When things fail, fix the harness first. A good instructions file can beat a more expensive model.
  2. Tailor it: a router, not an encyclopedia; "done" verified in three layers by someone other than the writer; loops with their own stopping judgment.
  3. Start where it hurts: one rule per scar, one spec per task, one loop with an independent judge.

A good prompt helps for one turn. A good harness helps permanently.

thank you

Tailor the harness. Keep the agent.

Stefano Maestri · maeste.it

Risorse Artificiali: podcast & newsletter · slides: maeste.it/speaking

appendix · arxiv 2607.06906

The Harness Effect, in detail

  • Design: six frontier models, same task suite; orchestration is the only independent variable
  • Result: cost per task −41%, time −44%, tokens −38%
  • Implication: benchmark scores without harness disclosure do not transfer to your stack
appendix · arxiv 2605.23950

Binding Constraint Thesis, in detail

  • Claim: on long-horizon tasks, harness-induced variance exceeds model-induced variance (×7 in their experiment)
  • "Stop comparing LLM agents without disclosing the harness"
  • Model choice is a one-bit decision. Harness design is the whole rest of the search space.
appendix · where is my harness broken?

The five-subsystem audit

SubsystemAsk yourselfScore 1–5
Instructionsdo the rules exist in the repo, or only in heads?
Toolsleast privilege granted, or everything/nothing?
Environmentself-describing? locked versions? reproducible?
Statedoes memory survive the session?
Feedbackcan the agent verify itself with commands?
  • Fix the lowest score first: usually feedback (highest ROI)
  • Then ablate: remove one subsystem at a time, measure the drop; as models improve, some components stop being critical, new critical ones emerge
appendix · four families, one test

Loop types, in detail

TypeTriggerStop conditionBest for
turn-basedyou type each promptagent thinks done, or you interruptsmall, exploratory
goalyou give a goalindependent judge confirms, or max turnscomplex tasks with a finish line
time-basedinterval (every N minutes)manual stop, or exitspolling, recurring checks
event-drivenPR opened, CI failed, new issuehandled, or retry limitreactive workflows, CI/CD
  • The goal loop vs the clock: a marathon (one long run toward a finish line) vs an alarm clock (short independent bursts, no cumulative progress)
  • The recurring mistake: putting a goal-shaped job inside a time-based loop, restarting from scratch every interval
appendix · what grows while you sleep

The four silent costs of loops

  • Verification debt: green checks that stopped meaning "works"
  • Comprehension rot: code nobody on the team can explain anymore
  • Cognitive surrender: "the agent says it's fine" becomes the review
  • Token blowout: the bill grows faster than the value

Loops accelerate output and risk at the same time.

appendix · evals in production

Judgment as data: the battery file

# a battery, checked into the repo like code
- pr_risk_high:        yes/no + calibrated probability
- docs_stale:          choice: current | drifted | missing
- review_priority:     score 0-10 against the rubric
- unsure:              "I don't know" is a legal answer (0.5)
  • Policy in code transforms the answers; divergence becomes a doubt for a human
  • Every judgment stays human-owned, versioned, negotiable
appendix · answers ready

Q&A: the questions to expect

  • "Isn't this just prompt engineering?" Prompt: one turn, in your head. Harness: five subsystems, in the repo. The 20%→100% case came from system pieces, not better wording.
  • "Won't the next model make this obsolete?" The papers and the same-model case moved the metrics with fixed models. Ablation findings: as models improve some components stop being critical, new ones emerge. The harness evolves with the model; it doesn't vanish.
  • "I've read studies saying instruction files don't help." Honest answer: evidence is mixed. One study found no general task-success gain and +20% inference cost; a paired study found −28.6% runtime on small tasks. Keep requirements minimal, and test the instructions on the tasks they must support.
  • "Where do I start?" Audit the five subsystems, fix the lowest (usually feedback: verification commands). Then write "done" for the next task, with three layers.
  • "Security?" Tool boundaries and budget are blast-radius control: least privilege, minimal spend, loud failure.
appendix · sources

References

  • The Harness Effect (arXiv 2607.06906) · Stop Comparing LLM Agents Without Disclosing the Harness (arXiv 2605.23950) · StreamVibe (arXiv 2610.34662) · Lost in the Middle (arXiv 2307.03172)
  • Anthropic engineering: harness design for long-running application development; effective harnesses for long-running agents
  • OpenAI: harness engineering, leveraging Codex in an agent-first world
  • Newsletter CY26W37 ("the war is over the harness") and CY26W45 ("agents as software, the harness as runtime"): maeste.it / risorseartificiali.com