Fergus the Ferret GDG CLOUD LONDON INTRO
01 / 26

From Vibing Chaos to Reliable Agents

Harness Engineering, Loop Engineering, and Spec-Driven Development in the Google Ecosystem

Darren "Dazbo" Lester

Ask my AI agent anything:
dazbo.co.uk

  • Google Chief Technologist at <epam>
  • Google Developer Expert (GDE)
  • Google Cloud Ambassador
Google Developer Experts
Use ◀ ▶ or Space to navigate • Press 'G' for Slide Grid • Press 'F' for Fullscreen • Click any diagram to zoom
THE NORTH STAR "Our goal is to not write any code — without producing AI slop."
Ryan Lopopolo (Google): "I aspire to be a lazy programmer." • "Humans steer, agents execute."

Why Unconstrained "Vibe Coding" Collapses on Monday Morning

  • Hallucination City — Invented APIs, deprecated SDKs, and phantom packages
  • Review Theatre & "LGTM" Fatigue — Bleary-eyed rubber-stamping of sprawling diffs
  • Unmaintainable Tech Debt on Day 1 — Incoherent architecture with zero documentation
  • Insecure by Default — Hardcoded secrets, wide-open permissions, and suppressed warnings
  • The Human Clipboard Furnace — Manually copying terminal errors back into a bloating chat window
Meet Fergus the Ferret: Bleary-Eyed Review Theatre on the 47th Diff Intro // The Vibe Coding Hangover
01 // Setting the Stage Untangling the 2026 Buzzword Soup

Wait... What Do All These Terms Actually Mean?

Click any term below — are they competing religions, or interlocking parts of a single engineering machine?

Harness Engineering: The complete deterministic race car around the model — uniting rules, MCP tools, skills, sandboxes, evaluation gates, and loops so Agent = Model + Harness.
Promise of this talk: Unifying all of these into one cohesive engineering blueprint Intro // Untangling the Buzzwords
02 // The Paradigm Shift Upstream Engineering vs Downstream Firefighting

What "Shift-Left" Means Here: Stop Debugging on the Right

The Paradigm Shift: Shifting Developer Interventions Left

🔴 Vibe Coding: Intervening on the RIGHT (Downstream)

Breezy chat prompt → unconstrained AI dumps 500 lines → human acts as an exhausted manual filter debugging diffs and hallucinations after failure occurs.

🟢 Harness Engineering: Intervening on the LEFT (Upstream)

Engineer the environment before the agent runs: GEMINI.md rules, living specs, container sandboxes, and automated evaluators heal errors inside the loop.

Humans steer upstream on the left; agents execute and self-verify in the loop Intro // The Paradigm Shift
Act I // The Deterministic Chassis If It's Not the Model, It's the Harness

Agent = Model + Harness — Waiting for a Bigger Model Won't Save You

⚠️ The Model Upgrade Fallacy

  • The Knee-Jerk Instinct: When an agent fails in production, teams immediately blame the model and switch to a massive 2-trillion-parameter frontier model at 4x the token cost.
  • High-Priced Slop: If an agent lacks repo context, can't run tests, and has no verification loop, a bigger model just generates more articulate, harder-to-spot slop at four times the price!

🛡️ Model-Agnostic Reliability

  • Build a Good Harness → Get Reliable Results: A fast, cost-effective workhorse like Gemini 3.8-Flash in a well-engineered harness beats a giant frontier model in a weak harness.
  • Insulated From Model Variance: A strong harness insulates your engineering quality from individual model quirks, inconsistencies, and version changes.
  • Commercial Truth (GDE Jaroslav Pantsjoha): The model is a rented commodity; the harness is your proprietary IP.
🦦 Fergus: Spectacles on, cardigan buttoned, vibes retired Act I // Agent = Model + Harness
Act I // The Race Machine Metaphor

The Model is the Driver. The Harness is the Entire Race Car.

🏎️ THE DRIVER = AI MODEL

Probabilistic reasoning & reflexes (e.g. Gemini 3.8-Flash). Without a car, he just does doughnuts on an airfield.

🛡️ CHASSIS & BRAKES = STRUCTURAL HARNESS

GEMINI.md rules, MCP tools, skills, sandboxes, and evaluation gates stopping 180 mph crashes.

⚙️ POWERTRAIN = LOOP ENGINEERING

The dynamic runtime engine inside the harness — iterative intake, combustion, telemetry, and self-correction.

You wouldn't put Lewis Hamilton on a bare engine block with no chassis or brakes Act I // The Motorsport Analogy
Act I // Deconstructing the Chassis Touching Every Component in Today's Talk

The Deterministic Components That Make Up the Harness

Deterministic Foundations of the Developer Harness
Click to zoom: The deterministic foundations surrounding the Developer Harness Container
The AI Engineering Triad

Our Talk Touchpoints

  • Hierarchical Context (GEMINI.md / AGENTS.md)
  • Tools, MCP Servers & Progressive Skills
  • Living State & File Memory (SPEC.md, plan.md, LIVING_MEMORY.md)
  • Evaluation Gates & Loop Engine (RUBRIC.md)
  • Execution Sandboxing (Blast Radius Control)
  • Observability & Trajectory Monitoring
Context = What the agent KNOWS • Harness = What it CAN TOUCH • Loop = How it CONVERGES Act I // Harness Foundations
Component 01 // Hierarchical Context De-Slopping by Design (Alice Moore, Builder.io)

Real Example: Inside My Production GEMINI.md

# Agent Execution Guardrails & Standards (~/.gemini/GEMINI.md)

## Python Guidance & Tooling
- Environment Source of Truth: Respect `pyproject.toml` (default `python 3.13`).
  Manage environments and dependencies exclusively via `uv`.
- Avoid Inline `python -c` Commands: Do NOT run inline `python -c "..."` snippets
  (they break prefix-matched approvals). Write one-off scripts to `scratch/`
  and execute cleanly via `uv run python scratch/helper.py`.
- Standards & Quality: Include top-of-module docstrings, built-in type
  hints (`list`, `dict`), and `rich` for CLI output.
- Strict TDD: Write the failing test first, verify failure, implement, verify pass.
- Mandatory Post-Edit Gate: Run from project root after modifying any `.py` file:
  uvx codespell@latest -s        # check spelling & show summary
  uvx ruff@latest check --fix .  # static analysis & auto-fix

## Agent & AI Development
- NEVER downgrade a Gemini model (e.g. NEVER change `gemini-3.8-flash` to `gemini-3-flash`).
- Build agents using Google ADK (`google-adk`) and Google GenAI SDK (`google-genai`).
  Avoid deprecated `google-generativeai`.
- NEVER push to Git without explicit human sign-off.

Why This Eliminates Slop

  • Layered Context Scopes: Global (~/.gemini/GEMINI.md), team/domain, and repo-specific rules (workspace/GEMINI.md or AGENTS.md).
  • Deterministic Tooling: Mandates uv and strict TDD before writing implementation code.
  • Prefix-Match Ergonomics: Banning python -c stops approval prompts on every turn.
  • Self-Cleaning Hygiene: Every edit triggers codespell and ruff automatically.
  • Blast Radius Control: Strict prohibition on unapproved Git pushes keeps humans steering.
Act I // Hierarchical Context
Component 02 // Skills, MCP & Plugins Loading Kung Fu On-Demand Without "Skills Sprawl"

Whistle-Stop Tour of Agent Skills (They Come Up Everywhere!)

Plugin Package: Rules, Skills, and MCP Servers
# ~/.gemini/config/skills/loopy/SKILL.md
---
name: loopy
description: Discover, audit, craft, and run repeatable AI-agent
  loops with clear checks and stopping conditions.
---
# Step-by-Step Playbook (Loaded ONLY when triggered!)
1. Inspect target repo & verify deterministic test runner...
2. Set clear stopping conditions (100% pass or max-turn limit)...

Progressive Disclosure = Reduced Context Bloat

  • Tool & Skills Sprawl Traps: Connecting 20 MCP servers (150+ schemas) or stuffing 40 guides into GEMINI.md burns thousands of tokens every turn and confuses the model.
  • Progressive Disclosure Levels:
    • Level 1 (Metadata): Only the 2-line YAML frontmatter (<100 tokens) loads at startup.
    • Level 2 (Instructions): Full SKILL.md playbook loads on demand when a matching task begins.
    • Level 3 (Resources): Deep scripts/, schemas & templates load only when needed.

Plugins & My Curated Production Toolkit

  • Plugins = Packaging Vehicle: Not a separate harness component — a distribution bundle uniting Rules + MCP Servers + Agent Skills (e.g. google-cloud-developer with live developer-knowledge MCP).
  • Core Production Skills: code-review-and-quality, Google Agents CLI (ADK), agent-platform-eval-flywheel, find-skills / organise-agent-skills, maintaining-core-documentation, spec-driven-development & loopy.
MCP = Eyes & Hands (Live Tools/Data) • Skills = Procedural Brain Playbooks • Plugins = Distribution Bundle Act I // Skills & Plugins
Act II // The Dynamic Engine 🦦 Retiring Fergus from 2 AM Clipboard Duty

The Harness Must Be Automated & Loop

The Autonomous Developer Loop Cycle
The Autonomous Loop Cycle: Act → Check → Diagnose → Adjust → Retry → Stop / Escalate

The Closed-Loop Cadence

  • 1. ACT → 2. CHECK → 3. DIAGNOSE → 4. ADJUST → 5. RETRY or STOP/ESCALATE: Converge autonomously to 100% pass, or trip a circuit breaker.
  • Human-in-the-Loop ≠ Human-in-Every-Turn: Replace continuous babysitting with strategic governance at predefined escalation points.
  • Dev Workbench vs Runtime (Spec Spend vs Run Spend): The loop is your development-time forge — not a self-modifying while loop shipped into customer-facing production.
Loop Engineering is the internal combustion engine of the harness Act II // The Loop Cycle
Act II // Loop Architecture 🦦 Fergus & The Runaway Token Bonfire Trap

How to Construct the Loop (And Avoid a Token Bonfire!)

Core Components of the Developer Loop Workbench

Core Loop Building Blocks

  • Context & Goal — Strictly Decoupled:
    Context (GEMINI.md + Skills) = reusable "how we build".
    Goal (spec.md) = specific "what we build today", restated every turn.
  • Sandboxed Tools & TDD + Evals: Safe file/test runners + failing unit tests written first + deterministic linters + semantic Critic forming our Rubric (preventing The Premature Exit).
  • Structured Iteration Memory (LIVING_MEMORY.md): Saving score deltas, root causes, and "Do NOT Repeat" notes after each turn.
  • Iteration Discipline (The One-Change Rule): Modify one semantic behaviour at a time to isolate regressions (while batching mechanical lint/typo fixes in one pass).
  • Escalation Protocol & Stopping Conditions:
    ✓ 100% Rubric Pass • 🛑 Max Turn Limit (e.g. 5 turns) • ⚠️ Escalate to Human if Score Plateaus or Hits Protected Boundaries
🦦 Fergus Lesson: A loop without clear stopping conditions is a token bonfire Act II // Constructing the Loop
Act II // Compounding Engineering Quality The Loop Fixes the Code • The Ratchet Upgrades THE HARNESS

The Ratchet Principle: Locking In Institutional Memory

Diagnostic Rule of Thumb: Loop Bug vs Harness Bug

Loop Bug vs Harness Bug Litmus Test

  • Loop Bug (Refine the Loop): Fixed by sharpening the goal, refining the prompt, updating RUBRIC.md checks, or adjusting the stopping condition.
  • Harness Bug (Upgrade the Harness): Fixed by changing tool definitions, adjusting sandbox permissions, modifying timeouts, adding a SKILL.md / GEMINI.md rule, or intercepting runtime errors.
  • Permanent Immunity (The Ratchet): Once encoded into the harness, that entire class of failure is extinct across all future sessions.
Chat prompts evaporate when the session closes; harness upgrades compound forever Act II // The Ratchet Principle
Act III // Spec-Driven Development (SDD) The Controversial Truth About Source Code

Great Harness + Bad Prompt = Slop. The Spec Is Now the IP.

Permanent Living Specifications vs Disposable Generated Code

Why Our Race Car Needs High-Octane Fuel

  • We've locked down HOW we build in GEMINI.md, MCPs, Skills, and TDD rubrics.
  • But if you feed a vague 2-line prompt into that harness, you still get slop — just well-linted, type-checked slop that builds the wrong thing!
  • We need a persistent specification defining WHAT we build.

🔥 Controversial Message: Code is Disposable

  • Code Is No Longer What We Care About: Your harnessed agent can spit out verified implementation code in 90 seconds, over and over again.
  • Specifications Are the Permanent Source of Truth: When requirements change, don't untangle code — update the spec and regenerate!
Decouple HOW we engineer (GEMINI.md) from WHAT we build (The Persistent Specification) Act III // Spec-Driven Development
Act III // The SDD Lifecycle 5-Minute Spec → 90-Second Verified Build

Updating the Spec With Each Loop: The Logical Conclusion of Agile

Zero Compounding Specification Drift

  • 1. Scope & Edge Discovery (The WHAT): Quick dialogue pinning down intent, non-goals, and edge cases.
  • 2. Interface Contracts & Boundaries (The HOW): Schemas + Always Do / Ask First / Never Do boundaries.
  • 3. Acceptance Criteria (The PROOF): Gherkin scenarios & failing test stubs.
  • 4. 90-Second Sandbox Build & Verify: Inner loop converges to 100% green tests.
  • 5. Inspect & Evolve the Spec: Update the spec on disk for the next iteration — documentation never drifts!
Deep architectural rigour at the blistering feedback speed Agile always promised Act III // SDD Lifecycle
Act III // Concrete Blueprint Operational Boundaries + Clean Formats + Gherkin

What Goes in a Spec? It's Version-Controlled Markdown

# Implementation Spec: Cloud Spanner Audit Event Logger

## 1. Architectural Scope & Contracts
- Component: `AuditEventLogger` service in `services/audit_logger.py`
- Persistence: Cloud Spanner `audit_events (event_id, timestamp, actor, action, payload JSON)`
- Transport: Async gRPC client via `google-cloud-spanner` Python SDK

## 2. Operational Boundaries (Always / Ask / Never)
- ALWAYS DO: Enforce type hints; Spanner Mutation batches;
  author failing test in `tests/` first; run `ruff` & `codespell`.
- ASK FIRST: Adding dependencies to `pyproject.toml`; altering Spanner DDL.
- NEVER DO: Hardcode credentials (use ADC); run inline `python -c`; swallow generic `Exception`.

## 3. Phased Vertical Slices & Verification Gates
- [ ] Phase 1: Domain Models & Failing Test Stub (`pytest` -> fails `NotImplementedError`)
- [ ] Phase 2: Batch Mutations & Backoff Retries (`pytest` -> 100% pass)
- [ ] Phase 3: Static Hygiene (`uvx ruff check --fix .` & `codespell -s` -> 0 warnings)
📄 File: tasks/plan.md (Implementation Plan & Boundaries)

Why Structured Markdown + YAML + Gherkin Works Best

  • Two Spec Layers: spec.md (user-facing WHAT & non-goals) + plan.md (codebase-aware HOW & file impact map).
  • Hybrid Markdown + Conditional YAML: Use clean Markdown headers and bullets for narrative, and flat, compact YAML for structured schemas, configs, and data contracts (especially when nesting depth > 3) instead of verbose JSON or XML.
# Declarative Gherkin Acceptance Contract
Scenario: Booking a table with active dietary preferences
  Given a customer with dietary preference "gluten-free" in profile
  When they request a reservation for 2 people at 19:00
  Then verify table availability via Cloud SQL reservation tool
  And append "gluten-free" to booking notes payload before committing
📄 File: spec.md (Acceptance Contract)
Always Do / Ask First / Never Do boundaries define exactly what the agent can do on its own Act III // Inside the Spec
Act III // SDD Ecosystem Don't Author Specs From a Blank Page

Practical Tools to Build & Govern Your Specifications

Comparing SDD Tooling: spec-driven-development skill, GitHub spec-kit, and Google Conductor

1. spec-driven-development Skill ↗

By Addy Osmani. Conversational gate (Scope Check → Specify → Plan → Tasks → Implement). Pauses to surface explicit "ASSUMPTIONS I'M MAKING" and outputs tasks/plan.md.

2. GitHub spec-kit ↗

CLI & slash workflow (/speckit.specify → .clarify → .plan → .tasks → .implement) governed by .specify/memory/constitution.md, plus lightweight Bug Fixing & Idea Assessment workflows.

3. Google Conductor Extension ↗

Now natively integrated in Google Antigravity! Interviews you in the IDE sidebar to maintain product.md, tech-stack.md, spec.md, and plan.md before unlocking code gen.

All three output version-controlled Markdown committed directly to your Git repository Act III // SDD Tooling
Act III // The Cockpit One Harness Engine Across Developer Surfaces + Python SDK

Doing It Super Easily with Google Antigravity

Google Antigravity Unified Developer Harness

What Antigravity Coordinates Out of the Box

Developer Surfaces + SDK: Antigravity App • Antigravity IDE • IDE Extension (VS Code, JetBrains, Visual Studio, Zed) • Antigravity CLI • Python SDK.
Built-In Plumbing: Auto-binds GEMINI.md, progressive Skills, MCP, container sandboxes, and isolated Subagents.

Combining Formal SDD on Disk + Interactive Slash Commands

  • 1. Draft Persistent Spec on Disk (Formal SDD): Native /plan & /goal alone are ephemeral in chat — use Conductor, spec-kit, or spec-driven-development to commit tasks/plan.md to Git.
  • 2. Stress-Test the Spec (/grill-me): Run /grill-me against tasks/plan.md as a sceptical peer reviewer to expose edge cases before writing code.
  • 3. Tactical Slice Execution (/plan + /goal + /boost): Feed one slice from tasks/plan.md into /goal (with /plan for file edits and /boost for adversarial Builder/Critic review).
  • 4. Harden the Harness (/learn): Crystallise runtime discoveries into .agents/rules/ or GEMINI.md!
Formal SDD provides the permanent living blueprint in Git; slash commands drive high-velocity tactical execution Act III // Google Antigravity
Act III // Hybrid Evaluation Gates Inside Our 14-Point Workbench Rubric (RUBRIC.md)

Deterministic Tests + Binary LLM-as-a-Judge Rubrics

Dazbo in an 80s shell suit
The Sycophantic Yes-Agent:
Q: "Do I look good in this 80s shell suit?"
LLM: "Why yes, Dazbo! So hunky!"
Never ask an LLM to rate code "from 1 to 5" or mark its own homework! Convert every check into a strict 0 / 1 binary assertion graded by an independent, clean-slate Critic agent.
Two-Tier Evaluation Gate
Category Strict Binary Assertion (1 = Pass, 0 = Fail) How It's Checked
Deterministic All unit tests in tests/ pass (100%) AND ruff / codespell report zero errors? pytest, ruff & codespell
Deterministic Built-in type hints used AND zero eval(), exec(), or unparameterised queries? Static Code Scanner (ruff / bandit)
Deterministic Deterministic Tool Trajectory: Only allowlisted tools invoked with valid schemas? Agent Tool Execution Trace
Deterministic Live API & UI Wiring: FastAPI starts cleanly & frontend buttons call real /api/game/* endpoints? FastAPI TestClient & HTML Check
Semantic Critic Goal Fidelity, Scope Discipline & Clean Architecture: Delivers spec capabilities, zero hallucinated files, and direct tool pathways (no convoluted detours)? Independent Critic Agent (LLM Judge)
Semantic Critic Remediation Clarity, Design Intent & UX Ergonomics: Actionable error messages, sound design rationale, and responsive interactive gameplay? Independent Critic Agent (LLM Judge)
Passing Bar: 100% (14 / 14 across 8 Deterministic + 6 Semantic checks required to exit loop) Act III // Binary Evaluation Rubrics
LIVE CLIMAX DEMO Uniting Act I (Chassis) + Act II (Loop) + Act III (Spec)

Side-by-Side Workbench: Vibe Coding vs The Engineered Harness

🚀 Open Live Workbench (localhost:8080) ↗
Google ADK Harness Architecture
Both tracks run Gemini 3.8-Flash on Google ADK — isolating the impact of the Harness + Loop
Harness Engineering Demo Workbench

What Both Tracks Are Building: Cosmic Conquest

  • Same Spec (cosmic_conquest_spec.md): Full-stack FastAPI backend + directed sector graph + turn-based combat + interactive browser star map.
  • Left Track (Unharnessed Vibe): Bare ADK Agent — single pass, no harness_context.md, no skills, no loop.
  • Right Track (Harnessed Loop): ADK LoopAgent (harnessed_builder_agent + RubricEvaluationGateAgent) + 3 Skills (api-and-interface-design, gemini-api-dev, test-driven-development) + LIVING_MEMORY.md + 14-point binary rubric.
Empirical Benchmark Verdict Why the Multi-Turn Loop Dominates

The Amazing Conclusion: 4x Faster, 85% Cheaper, & Actually Works!

Metric Unharnessed (Vibe) Harnessed (Spec + Loop) Harness Advantage
Execution Time 90–120+ seconds 23–35 seconds 3–4x Faster
Combined Tokens 18,000–45,000 (~16k out) ~6,700 (~1,000 out) ~80% Fewer (~15x less out)
Estimated API Cost ~$0.010–$0.017 ~$0.0014–$0.0015 ~85% Cheaper (7–8x less)
14-Point Rubric 6–11 / 14 (Always fails) 14 / 14 (100% pass) Deterministic Quality
Functional Game? ❌ Broken / Dead UI ✅ Playable & Verified Only Harnessed Works!

How Can a Multi-Turn Loop Be Faster & Cheaper Than 1 Prompt?

1. Output Discipline (code to disk, 150-word chat summary → 15x fewer output tokens) • 2. Externalised Reasoning (ThinkingLevel.LOW + millisecond pytest/ruff checks) • 3. Context Pruning (passing only LIVING_MEMORY.md between turns).

Side by Side Workbench Result
Fast generation + real compiler feedback beats slow, unverified internal pondering every time Act III // Head-to-Head Verdict
Act IV // Completing the AI Harness Stopping Multi-Turn Loops From Going Off the Rails

Inside Every Iteration: Fresh Context & Output Discipline

Fergus buried in single-thread chat bloat

1. Why Single-Thread Chat Loops Fail

  • Runaway Context Bloat: Every failed draft and 200-line stack trace stays in the chat history.
  • Going in Circles: By Turn 4, the model retries a fix that failed on Turn 1 because the error is buried in noise.
  • Broken Edits & Drift: Confuses old code drafts in chat with the actual files on disk.
Fergus handing 3-item clipboard to a fresh subagent

2. Fresh Context per Pass (Clean Subagents)

  • Clean Slate Every Turn: Delegate each loop pass to a fresh subagent with a clean context window.
  • Receives Only 3 Things:
    1. The Target Spec Slice (PLAN.md)
    2. Current Workspace Files on Disk
    3. The Compact LIVING_MEMORY.md Receipt
  • Subagent edits, runs tests, writes receipt, and finishes!
Fergus writing code to SSD and holding a 150-word receipt

3. Strict Output Discipline (~15–20x Token Reduction)

  • Output Tokens Drive Latency & Cost: They are the biggest driver of both how long a loop takes and how much it costs!
  • Keep Code in Files, Not Chat: Write code directly to disk via tools; ban full-file dumps in chat replies.
  • 150–250 Word Turn Summary: Reply only with what was tackled, root cause of any failure, and files updated.
Fresh subagent context + Output discipline = Flat token usage across 5+ iterations Act IV // Anatomy of an Iteration
Act IV // Iteration Evidence Receipts Keep the Signal, Drop the Noise

Persistent LIVING_MEMORY.md Across Iterations (Real Example)

# Living Memory: Iteration Ledger (LIVING_MEMORY.md)

## Turn 1: UserSchema Migration (FAILED)
- Changes Made: `app/schemas/user.py` (lines 12–48): replaced `class Config`
  with `model_config = ConfigDict(from_attributes=True)`.
- Verifier Output: `uv run pytest tests/test_user.py`: 16 passed, 2 failed.
- Error: `PydanticUserError: '@validator' is deprecated and no longer
  supports 'each_item=True' in v2 (app/schemas/user.py:34)`.
- Root Cause: Left legacy Pydantic v1 `@validator('roles', each_item=True)`.
- Do NOT Repeat: Do not use `@validator` in Pydantic v2 models.

## Turn 2: UserSchema Migration (FAILED)
- Changes Made: `app/schemas/user.py` (lines 34–58):
  migrated to `@field_validator('email', 'roles')`.
- Verifier Output: `pytest`: 17 passed, 1 failed (`test_invalid_email_code`).
  `ruff`: 0 errors.
- Rubric Delta: 13 / 14 passed (Failed Check 1.2: API error `'invalid_email'`).
- Root Cause: Plain `ValueError` sets error `type` to `'value_error'`,
  breaking v1 API contract.
- Next Hypothesis (Turn 3): Raise `PydanticCustomError('invalid_email', ...)`
  from `pydantic_core` inside `validate_email`.

Why LIVING_MEMORY.md Works

  • Bridges Fresh Subagents: Gives Turn 3 complete institutional memory of Turns 1 & 2 in ~200 tokens instead of 20,000 tokens of raw logs.
  • Explicit "Do NOT Repeat" Guardrail: Stops the agent oscillating between two broken approaches.
  • Tracks Score Progress: Shows clearly whether each turn is improving the rubric score or stuck in a rut.
  • Is a Single Rubric Pass Enough? 1 pass suffices for deterministic code gates (pytest, ruff); when building an agent, prompt, or skill, require multi-trial consecutive passes (e.g. 3/3 runs).
20 lines of structured root-cause signal beats 500 lines of raw stack traces Act IV // LIVING_MEMORY.md
Act IV // Composable Loop Mechanisms 🦦 Fergus: Sleeping in the Hammock as the Headless Car Loops

Ways You Can Add a Loop to Any New or Existing Repo Today

The Composable Loop Engineering Stack
Mechanism What It Supplies Setup Time
Antigravity Slash Commands
(/grill-me, /plan, /goal, /boost, /learn)
Interactive stress-testing, hands-off loop execution, multi-agent critique, and ratcheting. 0 mins
(Built-in)
Loopy ↗ (loopy skill + LOOPS.md + Loop Library) Ready-made or Q&A-crafted loop prompts, verification gates, stop rules, and a shared repo loop catalogue. 1–2 mins
Custom Markdown
(AGENTS.md, RUBRIC.md, LIVING_MEMORY.md)
Standing engineering rules, binary pass/fail criteria, and persistent cross-turn memory. 5–10 mins
Antigravity CLI & SDK Headless CI/CD execution (-p, --output-format json), Python @hooks.stop gates, and budget caps using Antigravity's built-in coding harness. 5–15 mins
Google ADK ↗
(google-adk LoopAgent & Workflow Graphs)
Custom multi-agent topologies, bespoke evaluation gates, and conditional graph routing. 15–30 mins
🦦 Fergus's evolution is complete: From 2 AM panic to sleeping in a hammock while the harness loops Act IV // Practical Loop Mechanisms
Act IV // The Outer Meta-Loop Evolving the Harness Across Tasks

Self-Improving Harnesses — & Implementing the Ratchet Yourself

Google Research Harness-Squared Architecture
Inner Loop fixes the application code • Outer Meta-Loop upgrades the Harness itself

The Outer Meta-Loop Concept (Harness²)

  • Keep the Model Fixed, Upgrade the Harness: Instead of only tweaking prompts, an outer meta-loop (Propose → Probe → Compose) evolves the entire harness: System Prompt, Guardrails, Memory, Tool Guidance, Subagents, Skills, Scripts, and Plugins.
  • Cross-Task Memory (EXPERIENCE.md): Keeps the base harness clean while recording operational lessons across tasks so future runs never start from scratch.

How You Implement This Ratchet in 2 Minutes Today

  • Step 1 (Inspect): Whenever a loop took >1 turn to pass RUBRIC.md, inspect LIVING_MEMORY.md.
  • Step 2 (Log to EXPERIENCE.md & /learn): Record Cue → Harness Upgrade → Evidence in .agents/experience/EXPERIENCE.md (instead of bloating GEMINI.md) and update the relevant SKILL.md, script, or RUBRIC.md.
  • Step 3 (Apply): Apply the harness upgrade so future tasks pass first time.
The inner loop fixes the application code; the outer loop evolves the harness Act IV // Self-Improving Harnesses
Bringing It All Together Every Buzzword Unified Into One Architecture

Recap: Everything That Makes Up Our Complete Harness

1. The Driver (Model)

Model-Agnostic Reliability

A strong harness insulates your engineering quality from individual model quirks, inconsistencies, and version changes — delivering reliable results regardless of the underlying model.

2. Context Engineering

GEMINI.md & Progressive Skills

Hierarchical mechanical standards (uv, TDD, Output Discipline) + on-demand SKILL.md playbooks without Skills Sprawl.

3. Structural Harness

MCP Tools & Container Sandbox

Live truth via MCP + isolated container execution controlling blast radius.

4. Spec-Driven Dev (SDD)

Persistent Living Specs

Code is disposable; the spec is permanent IP. spec.md & tasks/plan.md with Always/Ask/Never boundaries & Gherkin contracts.

5. Inner Loop Engine

Fresh Subagents + Binary Rubric

Fresh subagent per pass + LIVING_MEMORY.md receipts + Two-Tier 0 / 1 RUBRIC.md (Deterministic pytest/ruff + Semantic Critic) + Circuit Breakers.

6. Outer Meta-Loop

The Ratchet (EXPERIENCE.md & /learn)

Every multi-turn stumble logs cross-task lessons in EXPERIENCE.md and upgrades GEMINI.md, LOOPS.md, or RUBRIC.md so the entire class of failure is permanently extinct.

Agent = Model + Harness (Context + Tools/Sandbox + Living Spec + Inner Loop + Outer Ratchet) Act IV // Complete Architecture Recap
The Chequered Flag Interactive Monday-Morning Playbook

Your Practical Harness Engineering Checklist

0 / 8 READY FOR PRODUCTION
1. Codify GEMINI.md / AGENTS.md: Enforce toolchain (uv), TDD, and post-edit ruff + codespell.
2. Enforce Output Discipline: Keep code on disk via tools; ban source dumps in chat; cap turn summaries at 150–250 words.
3. Connect MCP & Progressive Skills: Add developer-knowledge MCP, spec-driven-development, and loopy (no Skills Sprawl).
4. Interrogate Intent First (/grill-me): Author a persistent tasks/plan.md with Always Do / Ask First / Never Do boundaries.
5. Build a Two-Tier Binary RUBRIC.md (0 / 1): Combine deterministic pytest/ruff checks with an independent Semantic Critic.
6. Spawn Fresh Subagents per Iteration: Start each loop pass with a clean context window so old stack traces and failed drafts don't confuse the model.
7. Persist Progress in LIVING_MEMORY.md & Set Stopping Conditions: Log root causes each turn, and halt if stuck or hitting a turn limit (e.g. 5 turns).
8. Ratchet the Harness (EXPERIENCE.md & /learn): Log cross-task lessons in EXPERIENCE.md and turn every multi-turn stumble into a permanent harness upgrade!

Links, Code & 4-Part Series

🌐 This Interactive Deck: harness-engineering.dazbo.co.uk
📖 4-Part Blog Series (Part 1): Dev.to (GDE) & Medium (Google Cloud)
💻 Workbench Repo: github.com/derailed-dash/harness-engineering-demo