Leanpub Header

Skip to main content

Harness Engineering for AI Agents: Re:Zero, Starting AI Software Engineering from Zero

Contracts, Traceability, Verification, and Operations for AI-Assisted Development

AI can generate code fast. The hard part is making that work reviewable, traceable, and reliable. Apractical field guide for developers building real software with AI coding agents—wrapping agent work in contracts, context structure, traceability, review gates, tests, and measurement so fast-generated code becomes maintainable software.

Minimum price

$15.00

$18.98

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
About

About

About the Book

AI-assisted development often fails in a familiar way: a task looks complete, then collapses under review, tests, or integration. The project goes back to structure, evidence, and first principles. This book is about reducing that repeated collapse.

In this book, a harness means the contracts, review gates, traces, checks, and measurements around an AI agent so its work can be inspected instead of merely trusted. The point is not to make AI sound magical. The point is to keep engineering control when AI can produce large amounts of plausible work very quickly.

The examples are drawn from the author's own naia open-source projects, work logs, agent instructions, failed verification runs, review gates, and the fixes that followed. The book treats AI agents not as simple model calls, but as software contributors that need scope, boundaries, evidence, and external verification.

This is not a clone-coding tutorial or a book of final answers. It is for developers who already use AI coding tools and now need a way to make AI-generated work trustworthy in real projects.

Share this book

Author

About the Author

Luke Yang

Passionate about AI-assisted coding, AI agent development, and open source innovation.Open to collaboration with those shaping the future of software engineerig

Contents

Table of Contents

Cover and Bibliographic Information

Harness Engineering for AI Agents: Re:Zero, Starting AI Software Engineering from Zero

Preface

  1. Author’s Note
  2. To Be Honest

Chapter 0 — This Book’s Promise: A Report, Not a Proof

  1. 0.1 What This Book Is Trying to Cover, and Three Things You Can Actually Use
  2. 0.2 This Is a Report, Not a Proof
  3. 0.3 How to Read Code Links
  4. 0.4 This Book Was Written the Same Way

Chapter 1 — How the Way We Use AI Has Changed

  1. 1.1 From ChatGPT Copy-Paste to Agent Coding
  2. 1.2 From Prompt to Context, and Then to Harness
  3. 1.3 Vibe Coding and Harnesses Are Layers, Not Opposites

Chapter 2 — What Is a Harness? (Agent = Model + Harness)

  1. 2.1 Models Are Commodities; the Harness Is the Moat
  2. 2.2 The Five Components of a Harness
  3. 2.3 Same Model, Different Harness, Different Results
  4. 2.4 The Two Sides of the Term: The Market May Wobble, but We Are Developers

Chapter 3 — In the End, It Is Software Engineering

  1. 3.1 One Sentence from Simon Willison
  2. 3.2 What Is Software Engineering?
  3. 3.3 New Words, Familiar Engineering
  4. 3.4 Harness: Discipline Has Moved
  5. 3.5 The Pain in the Field Is Real
  6. 3.6 The Four Weapons Chosen for This Book
  7. 3.7 Why Now?

Chapter 4 — The Nature of Language Models

  1. 4.1 A Machine That Probabilistically Guesses the Next Thing to Say
  2. 4.2 Tokens: The Link Between Code Volume and Your Wallet
  3. 4.3 Context Window: The AI’s Field of View
  4. 4.4 It Accumulates, Overflows, and Drifts Away
  5. 4.5 Three Core Traits: Confidently Wrong - Unable to Self-Verify - Hallucination

Chapter 5 — The Nature of Agents

  1. 5.1 Observe -> Plan -> Act -> Observe
  2. 5.2 How Agents Read and Edit Code
  3. 5.3 What Agents Read First: AGENTS.md Is Not Free
  4. 5.4 Tool Landscape: Hooks, Skills, Subagents, MCP
  5. 5.5 Context Management and Better Prompting
  6. 5.6 Three Traps (Preview of Part 3)

Chapter 6 — Why Go This Far?

  1. 6.1 “All 16 Succeeded”… and Every One Was Fake
  2. 6.2 Not My Mistake, but AI’s Structural Weakness
  3. 6.3 As-Is -> To-Be: From Single App to Modules
  4. 6.4 The Answer Has Two Axes: Isolation and Contract Harness

Chapter 7 — Weapon ① Contract

  1. 7.1 What It Means to Design With Contracts
  2. 7.2 Fixing AI-Touched Boundaries With Port Contracts
  3. 7.3 gRPC Type Contracts: Process Only Known Messages
  4. 7.4 Do Not Throw on Failure (Never-Throws)
  5. 7.5 File Anchors: Register Ownership and Contract Before Adding a New File
  6. The Cost and Limits of This Design

Chapter 8 — Weapon ② Structure and Isolation

  1. 8.1 Do Not Patch It. Transplant It.
  2. 8.2 Hexagonal: Push External Implementations Out with Ports and Adapters
  3. 8.3 Structure and Checks Should Be Treated Separately
  4. The Cost and Limits of This Design

Chapter 9 — Weapon ③ Traceability (Orthogonal to the Structure Axis)

  1. 9.1 The V-model: From Requirements to Tests
  2. 9.2 Automatically Raise a Red Flag When a Cell Is Empty
  3. 9.3 Treat Existing Behavior as the Baseline
  4. 9.4 The Traceability Table Found Four Missing Capabilities
  5. The Cost and Limits of This Design

Chapter 10 — Weapon ④ Verification

  1. 10.1 Verification Belongs Outside the AI
  2. 10.2 Automated Software Verification First, LLM Cross-Review Later
  3. 10.3 Case 1. Boundary Checks: Automatically Finding Import Violations
  4. 10.4 Case 2. Adversarial Review and Fixed Tests: The Masking Code Story
  5. 10.5 Charter Self-Protection: Preventing the AI from Removing Its Own Restraints
  6. 10.6 Tests Must Be Deterministic
  7. The Cost and Limits of This Design

Chapter 11 — Measurement and Operations

  1. 11.1 Why Benchmarks Matter
  2. 11.2 A Daily Issue Report Is the Project Dashboard
  3. 11.3 What Stops Drift Is Not a Checker, but a Baseline
  4. 11.4 Operations Is a Different Game: When AI Becomes the Attacker
  5. 11.5 Start with the Environment — Why This Environment Existed
  6. 11.6 What Code Can Block — Production DB Access Control and a Seven-Round Fight
  7. 11.7 What Code Cannot Block — Cache, Configuration, and the Script Itself
  8. 11.8 In the End, the Real Shield Is Permissions
  9. Conclusion of Part 3: In the End, We Did Not Invent a Single New Secret Technique

Chapter 12 — Naia, the Visual Agent

  1. 12.1 At First, I Called It an OS
  2. 12.2 From Alpha to Naia
  3. 12.3 Naia’s Name and Character
  4. 12.4 Why Go All the Way to an Operating System?
  5. 12.5 Why Bazzite?
  6. 12.6 What Naia Provides
  7. 12.7 What Makes Naia Different — Compared with OpenClaw, Hermes, and Claude Code
  8. 12.8 Workspace: The Desk Where AI Works
  9. 12.9 Why Operate Open Source Primarily in Korean?
  10. 12.10 Public Repos Where You Can Participate Now
  11. 12.11 The Meaning of Paid Subscriptions and Sponsorship
  12. 12.12 What to Take Away from This Chapter

Chapter 13 — The naia-omni-cascade Runtime: Naia’s Voice and Face on My GPU

  1. 13.1 First, What Becomes Possible?
  2. 13.2 Why Use a Local Voice Model at All?
  3. 13.3 Cascade Structure: Replaceable Parts, Not One Monolith
  4. 13.4 What Should You Try First?
  5. 13.5 Downloads and Prerequisites
  6. 13.6 Authentication Structure
  7. 13.7 Connecting from naia-shell
  8. 13.8 REST API for Developers
  9. 13.9 Realtime Voice API
  10. 13.10 Language and Emotion Tags
  11. 13.11 Putting a Face on the Voice: Video Avatars and the Open Exchange Format (nva)
  12. 13.12 What to Hold On To from This Chapter

Chapter 14 — Naia Memory + Knowledge: My AI That Remembers Me

  1. 14.1 Why Memory Is Core to “My AI”
  2. 14.2 Naia Memory: A Structure Modeled After Human Memory
  3. 14.3 Learning Safely: Receiving Hermes-Style Self-Improvement Without Learning the Wrong Things
  4. 14.4 Knowledge: A Knowledge Compiler for Evidence-Based Answers
  5. 14.5 What to Take Away from This Chapter

Chapter 15 — Naia App Development

  1. 15.1 What Is an App?
  2. 15.2 Why Develop Apps Separately?
  3. 15.3 Basic App Structure
  4. 15.4 Installation and Management
  5. 15.5 Browser App
  6. 15.6 Workspace App
  7. 15.7 Content Studio App
  8. 15.8 What App Developers Should Care About
  9. 15.9 Examples of Apps Developers Can Build
  10. 15.10 What to Take From This Chapter

Chapter 16 — AI-Native Open Source

  1. 16.1 Large-Scale Collaboration Is More Expensive Than It Looks: Three Reasons Open Source Breaks Down
  2. 16.2 Is Rebuilding Everything Every Time the Answer? The Value of Accumulation
  3. 16.3 Naia’s Choice: Designing Together with AI (AX)
  4. 16.4 Repositories That Are Easy for AI to Participate In
  5. 16.5 Licenses and Charters Must Be Readable by AI Too
  6. 16.6 Open Source Mechanisms Built into naia-adk
  7. 16.7 What Actually Happened: vLLM-Omni and MiniCPM-o Work
  8. 16.8 What AI-Supported Open Source Can Look Like
  9. 16.9 What It Means to Participate in naia

Chapter 17 — The Future of Developers: How to Welcome a New Colleague

  1. 17.1 Why I Started naia
  2. 17.2 Cloud AI Is Excellent, but It Is Not My Colleague
  3. 17.3 Human Colleagues Are Also Hard to Predict
  4. 17.4 How Developer Work Is Being Reorganized
  5. 17.5 What It Means to Have My AI
  6. 17.6 How to Welcome a New Colleague
  7. 17.7 The Opportunity Left for Developers
  8. 17.8 From Zero Again

Appendix A - Glossary

Appendix B — Source Map: Complete Code Index for This Book

  1. Chapter 7 — Contracts
  2. Chapter 8 — Structure and Isolation
  3. Chapter 9 — Traceability (V-Model)
  4. Chapter 10 — Verification
  5. Chapter 11 — Measurement and Operations
  6. Chapter 14 — Naia Memory + Knowledge (Absorbing Hermes Self-Improvement)
  7. Chapter 13 — Video Avatar (nva)
  8. Chapter 16 — AI-Native Open Source

Appendix C — External Sources and Confidence Level

  1. Methodology and Perspective
  2. Empirical Numbers (Handle With Care)
  3. Properties of Language Models
  4. Standards and Classics
  5. Ecosystem and Future (Forecasts = Loose)
  6. What to Compare
  7. What to Record: Three Numbers
  8. Recording Template
  9. How to Read the Results

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub