Sterlites Logo
AI Architecture
Oct 14, 202623 min read
---
Rohit Dwivedi
Rohit Dwivedi·Founder & CEO

The Harness² Revolution: How Two-Tiered Recursive Self-Improvement Fixes Autonomous Agents in Production

TL;DR

Static runtime scaffolding is the primary culprit behind enterprise agent failures, causing tool call syntax leaks, unverified calculations, and runaway token burn. Harness² resolves this by decoupling task-level harness refinement from cross-task experience curation across an 8-component editable runtime surface. This two-tiered recursive architecture enables label-free self-improvement in open-world production streams, boosting benchmark task accuracy by up to 17 percentage points and cutting tool execution errors by 37 percent.

Scroll to dive deep
The Harness² Revolution: How Two-Tiered Recursive Self-Improvement Fixes Autonomous Agents in Production

The Hook: High-Stakes Paradox & The Disaster Scenario

Enterprise autonomous agents frequently experience silent operational collapse in production not because foundation models lack intelligence, but because immutable, static runtime harnesses fail to handle open-world execution anomalies.

In high-stakes enterprise deployments, autonomous agents constrained by immutable scaffolding do not merely fail; they suffer silent, unmonitored operational collapse—leaking raw execution strings across workspaces while draining cloud compute budgets.

Consider a multi-file financial reconciliation task across accounting schedules, staffing rosters, and budget spreadsheets. An enterprise agent deployed under a conventional, static harness frequently encounters catastrophic failure modes documented in open-world production streams:

  • Unverified Calculation Paths: Figures across schedule, roster, and budget files are generated independently without ever being cross-referenced or reconciled against underlying primary source records.
  • Unopened Workspace Artifacts: Generated spreadsheets and reports are submitted directly to production directories without being reopened or parsed to confirm internal formula evaluation or data completeness.
  • Tool Call Syntax Leakage: The agent’s reasoning loop degrades, outputting raw tool invocation strings as plain text—such as leaking [tool_call: default_api: glob{...}] directly into the conversation turn. Because the runtime harness fails to parse text pseudo-calls, the turn ends abruptly without executing any underlying action.

This reveals the central technical paradox of contemporary enterprise AI: organizations spend millions upgrading underlying foundation models—transitioning from GLM-5 to Gemini 3.5 Flash or Claude Opus 4.8—yet their autonomous agents continue to collapse in production.

The model’s underlying reasoning capability is rarely the root cause. Instead, the system collapses because its runtime harness scaffolding—the static prompts, guardrails, memory structures, tool guidance, scripts, subagents, and context management layer surrounding the frozen base model—remains a brittle, single point of failure. This mirrors the exact hazards we documented in our audit of autonomous agent runtime failures.

The Enterprise Stakes: The Toll of Scaffolding Rigidity

When static harness scaffolding meets dynamic, open-world production demands, the executive consequences are immediate:

  • Corrupted Workspace Deliverables: Unverified agent trajectories overwrite enterprise storage with broken derivations, unparsed formula fields (e.g., Excel cells rendering blank because raw formula strings were written without evaluation), or incomplete schema structures.
  • Runaway Token Spend & SLA Breaches: Lacking adaptive operational guidance, agents enter mechanical loop traps—spinning through 200 model turns or burning up to 85 out of 132 execution steps generating unread intermediate artifacts before hitting hard infrastructure timeouts.
  • Silent Compliance Failures: In specialized domains like legal research (Harvey’s Legal Agent Benchmark / LAB) or end-to-end professional job execution (JobBench), static harnesses fail to enforce mandatory verification passes, leaving unverified claims in submitted legal briefs or financial filings.
The Frozen Scaffolding Fallacy

Upgrading base model weights while retaining static prompt scaffolding is the enterprise equivalent of dropping a Formula 1 engine into a chassis with wooden suspension. When environmental anomalies strike, the model cannot steer around the structural rigidity of its harness.

Primary Thesis: Decoupling Task Refinement from Cross-Task Learning

Conventional test-time adaptation fails in open-world enterprise settings because production streams lack ground-truth verifiers, unit test suites, or test-time labels.

The true paradigm shift requires Harness²—a plug-and-play framework that decouples task-level harness refinement from cross-task harnessing-level learning. By converting runtime failure trajectories into an evolving, durable intelligence layer, Harness² continuously refactors an agent’s runtime execution scaffolding without modifying base model weights.

Mastering this architecture is essential for organizations seeking to operationalize AI harness engineering principles at scale.


Deep System Mechanics: The Investigative Breakdown

Harness² transforms an agent’s execution environment by exposing an eight-component editable surface across three layers, iteratively refactoring scaffolding via coupled task-level and harnessing-level recursive loops.

Rather than treating the runtime harness as a monolithic text prompt, the google-research/harness2 architecture represents runtime scaffolding as an explicit file tree within the agent’s operating workspace.

Research NoteFor those who enjoy the technical details...

Under-the-Hood Reality: The 8-Component Runtime Surface

The eight-component editable surface spans three functional runtime layers. Each component is mounted as an explicit file path within the agent’s workspace environment:

Runtime LayerHarness ComponentMount File / PathActivation MechanicsArchitectural Context Impact
Context ConstructionC1 System Promptsystemprompt.mdInjected on every callDefines top-level persona; competes directly with output token budget.
Context ConstructionC2 Guardrailsguardrails.mdInjected on every callStanding rules; Jinja rendering enforces zero double-brace placeholders.
Context ConstructionC3 MemoryLongTermMEMORY.mdInjected on every callDurable domain facts persisted across stream tasks within a domain.
Context ConstructionC6 Skillsskills/<n>/SKILL.mdLoaded on demand via skill toolZero context cost until invoked; requires mandatory trigger line in always-on text.
Tool InterfaceC4 Tool Guidancetool_descriptions/tool_guidance.mdInjected on every callDefines tool usage parameters, formatting rules, and anti-patterns.
Tool InterfaceC7 Scriptsscripts/<name>.pyExecuted via bashDeterministic Python execution; bypasses token-by-token LLM reasoning.
Orchestration & MiddlewareC5 Subagentssub_agents/<n>/AGENT.mdInvoked via task toolSole component that spawns an isolated context window; returns text result.
Orchestration & MiddlewareC8 Pluginplugin/<name>.tsRegistered inside tool loopTypeScript hooks (tool.execute.after); executes outside model discretion.

The 8-Component Runtime Surface Breakdown

Mapped directly to the Harness² runtime mounting protocol. Components execute across three decoupled layers: Context Construction, Tool Interface, and Orchestration Middleware.

Critical architectural distinctions govern this surface:

  1. Context Isolation via Subagents (C5): Subagents represent the sole component across the entire surface that instantiates an isolated inference context window. While components C1–C4 and C6 write directly into the primary agent’s token context, C5 delegates large-input investigations to a separate worker, returning only a condensed text answer to the main thread. This separation mirrors the topological boundaries explored in stateless zero-context subagent isolation.
  2. Deterministic Loop Enforcement via Plugins (C8): Middleware plugins run directly inside the tool loop as TypeScript event hooks (such as tool.execute.after). By intercepting execution boundaries outside the LLM’s prompt context, plugins enforce non-bypassable constraints—such as appending defensive warnings when tool calls execute without writing required output artifacts—without consuming always-on prompt tokens.

The Two Coupled Levels of Recursion

Harness² achieves label-free self-improvement by coupling two distinct recursive loops: Task-Level Recursion (Level 1) and Harnessing-Level Recursion (Level 2).

Loading diagram...

Level 1: Task-Level Recursion (Propose→Probe→Compose\text{Propose} \rightarrow \text{Probe} \rightarrow \text{Compose})

Task-level recursion refines the execution harness HH for task qtq_t without relying on ground-truth answer keys or test labels.

Let an execution record be defined as:

e=(τ,y)e = (\tau, y)

where τ\tau represents the execution trajectory and yy represents the submitted deliverable. A contrastive improvement step applies an operator Φ\Phi:

(H′,e′,ξ)=Φ(qt,H,E;Rt)\left(H', e', \xi\right) = \Phi\left(q_t, H, E; R_t\right)

where qtq_t is the incoming task, HH is the current execution harness, EE is the local task execution history, RtR_t is the fixed Harness Improvement Library, H′H' is the successor harness, e′e' is its execution record, and ξ\xi is the step record capturing reference executions, candidate probes, composition decisions, and successor trajectories.

The contrastive step operates across three phases:

  1. Propose: The system evaluates an initial reference execution e0∼A(qt;M,H0)e_0 \sim \mathcal{A}(q_t; M, H_0) to diagnose failure modes. It generates two candidate harnesses via dual editor sessions:
    • Invariant Proposals (INV): Focus on procedural agent mechanics, tool call syntax correction, context pruning, and loop handling independent of domain subject matter.
    • Domain Proposals (DOM): Focus on domain knowledge, schema contracts, practitioner reconciliation mechanics, and sector-specific constraints.
  2. Probe: Candidates execute in parallel or sequential containers under matched model and environment conditions. Comparing candidate trajectories against reference execution e0e_0 establishes a behavioral contrast, revealing whether file edits resolve target deficiencies without introducing regressions.
  3. Compose: A Harness Composer inspects reference executions, candidate file diffs, and behavioral trace evidence. It selectively merges supported edits into successor harness H′H', executing it to yield e′e'.

Task-Level Scaling (k>1k > 1)

Exploration depth or width is controlled by budget parameter kk:

  • Parallel Recursion (k>1k > 1): Explores kk invariant and kk domain candidates concurrently. Each of kk independent composition sessions aggregates refinements across the candidate pool:
Hj′=Composej(qt,H,B,P;Rt),j=1,…,kH'_j = \text{Compose}_j\left(q_t, H, B, P; R_t\right), \quad j = 1, \dots, k

where BB is the set of reference executions and PP is the candidate pool. Parallel recursion minimizes wall-clock latency through concurrent container execution.

  • Sequential Recursion (k>1k > 1): Iteratively chains kk contrastive steps, carrying refined harnesses and accumulated trace evidence E(r−1)E^{(r-1)} into step rr:
(H(r),e(r),ξ(r))=Φ(qt,H(r−1),E(r−1);Rt),r=1,…,k\left(H^{(r)}, e^{(r)}, \xi^{(r)}\right) = \Phi\left(q_t, H^{(r-1)}, E^{(r-1)}; R_t\right), \quad r = 1, \dots, k

Sequential chaining allows later steps to explicitly revise or correct earlier harness modifications using accumulated trace evidence.

  • Final Selection: An agentic selector compares anonymized deliverables against task requests, choosing final deliverable yy and adopting corresponding harness Ht∗H^*_t.

Level 2: Harnessing-Level Recursion

Upon task completion, the complete improvement record DtD_t (reference executions, candidate probes, composition decisions, and final deliverables) is passed to an Experience Reflector.

The reflector synthesizes reusable operational lessons detailing why an edit succeeded or failed, appending insights to an EXPERIENCE.md log. Adopted harness components Ht∗H^*_t and their corresponding experience logs update the searchable Harness Improvement Library Rt+1R_{t+1}:

Rt+1=Update(Rt,Ht∗,Dt)R_{t+1} = \text{Update}\left(R_t, H^*_t, D_t\right)

When task qt+1q_{t+1} arrives, the execution pipeline resets to base harness H0H_0, but proposal and composition engines query Rt+1R_{t+1} to retrieve proven, cross-task scaffolding patterns. This continuous enrichment aligns directly with modular SKILL.md documentation and on-demand agent skills.

The “Aha!” Analogy

Legacy Agent Scaffolding is like a Formula 1 pit crew forced to operate from a static 1990s service manual regardless of weather, track erosion, or tire compound degradation.

Harness² functions as an autonomous, onboard telemetry engine. During the race, it analyzes real-time telemetry gaps to rewrite pit-stop protocols on the fly (Task-Level Recursion). Simultaneously, it transmits telemetry logs back to headquarters to permanently upgrade the master engineering playbook for all future circuits (Harnessing-Level Recursion).

Decoupled Exploration: Invariant vs. Domain

Bifurcating proposals into Invariant (INV) and Domain (DOM) paths prevents catastrophic interference. An agent debugging a Python script-parsing error should not simultaneously rewrite domain accounting definitions; isolated proposal streams allow the composer to merge syntactic fixes without corrupting domain logic.

Architecture Lifecycle Sequence

The complete Harness² lifecycle executes through four deterministic transitions:

  1. Ingress: Task qtq_t enters with frozen base model MM, initial harness H0H_0, and Harness Improvement Library RtR_t.
  2. Routing & Proposing: Dual editor sessions analyze reference execution e0e_0 alongside library RtR_t, producing scoped Invariant (INV) and Domain (DOM) harness candidate files.
  3. Mediation & Sandboxing: Candidates run in isolated sandboxes. The Harness Composer evaluates behavioral contrasts across traces, composing supported file diffs into successor harness Ht∗H^*_t.
  4. Execution & Finalization: Agent executes Ht∗H^*_t to produce deliverable yy. The Experience Reflector analyzes improvement record DtD_t, appending adopted components and verified lessons to library Rt+1R_{t+1} for cross-task transfer.

Thinking about AI Architecture? Our team has helped 100+ companies turn AI insight into production reality.


The Production Battleground: Benchmarks & Hard Numbers

Rigorous empirical benchmarks across WorkBuddy-Bench, JobBench, and Harvey’s Legal Agent Benchmark prove that Harness² delivers double-digit performance gains while drastically curbing tool-execution error rates.

In extensive empirical evaluations conducted across three enterprise benchmarks—WorkBuddy-Bench (Office, Web, Code), JobBench (end-to-end job execution), and Harvey’s Legal Agent Benchmark (LAB)—Harness² establishes new state-of-the-art performance baselines.

Empirical Performance Breakthroughs

  • WorkBuddy-Bench: A single Harness² step lifts GLM-5 under OpenCode by +11.5 points (64.2% to 75.7% macro average), outperforming base Gemini 3.5 Flash (72.4%). Parallel scaling at k=5k=5 adds an extra +3.3 to +3.9 points across configurations.
  • JobBench: Single-step gains reach +4.5 points for Gemini 3.5 Flash under OpenCode. Parallel scaling (k=5k=5) yields up to +4.2 additional points, closing the gap between distinct initial harnesses (e.g., shrinking OpenCode–Codex initial gaps from 3.0 points down to 0.5 points).
  • Harvey Legal Agent Benchmark (LAB): Single-step Partial criterion pass rates increase by +11.8 percentage points for GLM-5. Budget scaling (k=5k=5) delivers up to +6.7 percentage points in further gains.
  • Zero-Shot Cross-Model Harness Portability: Empirical evaluation proves that a harness refined on a lower-cost model can be deployed zero-shot onto a different model architecture without running additional adaptation steps. A harness refined on Gemini 3.5 Flash under OpenCode deployed onto GLM-5 yields a +17.3 point surge on WorkBuddy-Code (58.5% →\rightarrow 75.8%). Similarly, deploying the Flash-refined harness onto Gemini 3.7 Flash and Claude Opus 4.8 yields immediate gains of +6.4 points and +2.6 points, respectively.
  • Outperforming Flagship Commercial Production Harnesses: Starting from an open-source OpenCode base, Harness² (k=5k=5) consistently outperforms specialized, closed-source commercial production harnesses running Gemini 3.5 Flash:
    • Beats Claude Code by +4.6 points on Code (80.8% vs. 76.2%) and +4.9 points on Office (83.4% vs. 78.5%).
    • Beats Codex CLI by +5.8 points on Web (78.3% vs. 72.5%).
  • Same-Model Executor-Editor Capability: Self-improvement does not require a superior, higher-tier editor. When GLM-5 acts as its own executor and harness editor at k=2k=2, it achieves a +13.7 point surge on LAB. When Claude Opus 5 serves as both executor and editor, it achieves strong gains across all three benchmarks (+3.3 on WorkBuddy, +5.5 on JobBench, +3.0 on LAB).
  • Granular Tool-Error Reductions: Harness² systematically eliminates execution failures by refining tool interfaces:
    • WorkBuddy-Bench: Tool-error rate drops from 0.8% to 0.5% (-37.5% relative reduction).
    • JobBench: Tool-error rate drops from 14.4% to 9.1% (-36.8% relative reduction).
    • LAB: Tool-error rate drops from 2.0% to 1.6% (-20.0% relative reduction).

These metrics illustrate how scaffolding refinement stabilizes autonomous enterprise agent loops under high operational variance.

Comparative Battle-Test Table

Architectural DimensionLegacy Status Quo (Base / ReasoningBank)Modern Sovereign Breakthrough (Harness²)Measurable Enterprise Impact
Adaptation MechanismStatic prompt context or retrieval-only trajectory memory (ReasoningBank).Two-level recursive edits across an 8-component file surface (.md, .py, .ts).Eliminates context rot; reduces runtime tool-error rates by up to 36.8%–37.5%.
Supervision RequirementRequires ground-truth labels, unit test suites, or external reward models (Meta-Harness, DSPy).Label-free contrastive Propose–Probe–Compose behavioral trace execution.Enables self-improvement in unlabelled, open-world production streams.
Cross-Task GeneralizationTask-specific overfitting or static offline optimization on fixed training sets.Continual updates to Harness Improvement Library (RtR_t) containing reusable components and EXPERIENCE.md logs.Cross-benchmark transfer (JobBench →\rightarrow WorkBuddy-Bench) yields up to +2.9 point zero-shot gains.
Compute / Performance EfficiencyOff Pareto frontier; high token burn caused by unguided retries and memory inflation.Sits directly on empirical Pareto frontier; maximizes pass rate per token spent.Outperforms Meta-Harness and ReasoningBank at lower total token consumption.

Legacy Scaffolding vs. Harness² Recursive Self-Improvement

Evaluated across WorkBuddy-Bench, JobBench, and Harvey LAB datasets using GLM-5, Gemini 3.5 Flash, and Claude Opus 4.8 backbones.


What Breaks in Production: Pitfalls & Blindspots

Autonomous self-improvement without deterministic validation boundaries risks compounding errors through three subtle failure modes: blind selection drift, incorrect premise propagation, and self-fulfilling verification scripts.

The Hidden Traps

  1. Blind Selection Drift: An agentic selector may choose candidate deliverables based on superficial formatting cleanliness rather than substantive functional coverage. On a WorkBuddy coding task (python_port), the selector picked a candidate scoring 55 over one scoring 95 because it appeared “cleaner,” despite the chosen output leaving template placeholders empty and failing 9 unit tests.
  2. Incorrect Premise Propagation: Editor sessions can mistakenly bake flawed assumptions into always-on files (systemprompt.md or guardrails.md). On a security header injection task, an editor added a guardrail asserting that storage keys must preserve exact string casing; because downstream parsers expected lowercase keys, all candidate harnesses inherited this bad rule and failed 6 out of 12 checks.
  3. Self-Fulfilling Verifiers: When an editor writes a custom verification script (scripts/check.py) to validate candidate outputs, the script may encode the exact same flawed assumptions as the edited harness. In a performance validation task, the editor’s helper script reported PASS three times, yet downstream benchmark evaluations failed 4 out of 11 tests because the script failed to test dictionary key equivalency.
Production Trap: The Superficial Cleanliness Bias

When evaluating candidate outputs, LLM selectors default to aesthetic heuristics—favoring well-indented, short outputs over long, exhaustive outputs with edge-case handling. Platform architects must enforce programmatic unit assertions alongside agentic selection to verify functional completeness.

Prescriptive Operational Rules & System Validation Constraints

To prevent these failure modes, engineering teams deploying self-improving agents must enforce three mandatory, system-level validation rules. Prior to executing any candidate rollout, an automated pipeline guard validates the proposed file tree. If a proposal violates any constraint, it is instantly discarded:

Rule 1: Mandatory Skill Trigger Line

When creating or retaining an on-demand skill (skills/<name>/SKILL.md), its exact directory name must appear verbatim in an always-on file (systemprompt.md or guardrails.md) using the mandatory trigger syntax:

If a skill is created without an always-on trigger line, it remains invisible to the agent and is dropped silently at runtime.

Rule 2: Strict Jinja Syntax Isolation in Always-On Text

Always-on files (systemprompt.md, guardrails.md) are pre-rendered through Jinja with StrictUndefined prior to execution. Including double-brace placeholders (e.g., {{ variable }}) or Jinja statement tags (e.g., {% ... %}) causes an immediate template rendering exception that aborts execution before any work begins.

Rule 3: Strict File Existence Dependency Checks

Every Python helper script referenced inside a SKILL.md or prompt must physically exist at scripts/<file>.py or skills/<skill-name>/scripts/<file>.py. Referencing a non-existent script path causes immediate proposal validation failure, forcing the pipeline to fall back to the base harness.


Strategic Point of View: The Dual-Scale Scaffolding Protocol

Sterlites Intelligence introduces The Dual-Scale Scaffolding Protocol as the enterprise standard for decoupling task-level runtime adaptation from persistent organizational intelligence.

This proprietary architectural standard establishes a strict separation between immediate task-execution scaffolding edits (Task-Level Recursion) and long-term, cross-task meta-harnessing experience curation (Harnessing-Level Recursion).

By isolating execution modification from experience persistence, enterprise AI systems safely adapt to novel, zero-label environments while accumulating institutional memory across task streams:

The industry’s obsession with chasing parameter counts is a distraction. In enterprise production, a frozen 30B model wrapped in an adaptive, self-improving harness will consistently demolish a static 1 Trillion-parameter mega-model. If your system cannot recursively refactor its own execution scaffolding from runtime failure traces, you are simply lighting cloud budgets on fire.

Rohit DwivediFounder & CEO, Sterlites

Frequently Asked Questions


The Horizon: Strategic Takeaways & Actionable Roadmap

The future of autonomous systems belongs to architectures that decouple frozen model intelligence from dynamic, self-improving execution infrastructure.

3 Forward-Looking Projections (6–12 Months)

  1. The Shift from Prompt Engineering to Scaffolding Engineering: Enterprise AI organizations will transition away from tweaking monolithic static system prompts. Engineering effort will shift entirely to managing modular, self-evolving eight-component harness trees.
  2. Cross-Model Scaffolding Portability: Harness improvement libraries accumulated by cost-effective models will be routinely deployed onto premier reasoning models. Empirical data confirms that a harness refined on Gemini 3.5 Flash yields an immediate +17.3 point gain when deployed onto GLM-5 without additional tuning.
  3. Deterministic Middleware Supremacy: Always-on text prompts will be deprioritized in favor of deterministic tool-loop plugins (plugin.ts). Intercepting actions directly inside the tool loop guarantees compliance and eliminates context bloat in enterprise runtime environments.

3 Non-Negotiable Architectural Decisions for Q1

  • Modularize the Runtime Surface: Decouple agent application logic from runtime scaffolding. Re-architect monolithic system prompts into the eight editable components (systemprompt, guardrails, memory, skills, tool_guidance, scripts, subagents, plugins).
  • Implement Contrastive Candidate Probing: Integrate contrastive probing into test-time deployment pipelines. Separate edits into Invariant (procedural) and Domain (knowledge) candidates to evaluate behavioral contrasts without relying on ground-truth answer keys.
  • Establish a Centralized Harness Improvement Library: Create a shared, indexed repository to store adopted harness components alongside EXPERIENCE.md records. Capturing execution lessons across distinct task streams allows newly initialized agents to immediately inherit verified enterprise scaffolding.

Sources & Citations

Verified SourceGoogle Cloud AI Research: Harness²: Recursive Agent Harnessing for an Open World
Verified SourceGoogle Research: harness2 Official Repository
Verified SourceHarness² Official Project Portal and Architecture Documentation
Verified SourceHarvey Legal Agent Benchmark (LAB) Evaluation Suite
Verified SourceSST OpenCode Agent Execution Harness
Verified SourceOpenAI Codex CLI Runtime Environment
Work with Us

Need help implementing AI Architecture?

Book a highly tactical 30-minute strategy session. We apply the engineering rigor developed with McKinsey, DHL, and Walmart to accelerate AI for startups and enterprises alike. Let's bypass the hype, evaluate your specific use case, and map a concrete path to production.

30 min · Confidential
Trusted by Fortune 500s20+ Years ExperienceIIT · Stanford

Give your network a competitive edge in AI Architecture.

Establish your authority. Amplify these insights with your professional network.

One-Tap Distribution