Harness Engineering for Agents
Harness Engineering for Agents
Foundations & The Minimal Loop
Agent Equals Model Plus Harness
Prompt Context and Harness Engineering Compared
Runtime Infrastructure in Production Coding Agents
The Core ReAct Loop
Message History and Provider Wire Formats
Tool Schemas and Argument Error Handling
Step Caps Retry Budgets and Stop-Loss Detection
Failure Modes You Must Experience Firsthand
Context Rot and Oversized Tool Outputs
Mid-Turn Crashes and Half-Applied Edits
Capstone: 150-Line CLI Agent
Production Loops Context Control & Trust Boundaries
Structured Loop Hierarchy
Session Turn Step Lifecycle
Live State Projections and SSE Event Streaming
Mid-Turn Steering Versus Message Queuing
Layered Context Engineering
Always-On Instructions Versus Progressive Disclosure
Per-Step Dynamic Injection and Memoization
Two-Stage Compaction
Tail Preservation and Workflow Handoffs
Production Tool Execution
Schema Validation Progress and Cancellation
Human-in-the-Loop Approval Gates
Inline Tools Versus Long-Running Workflow Tools
Security and Sandbox Split
Trusted App Runtime Versus Isolated Sandbox
Firewall-Level Credential Brokering
Capstone: Approvals Two-Stage Compaction and Docker Isolation
Durable Execution Replay Safety & Subagents
Commit-First Architecture
Append-Only Transcripts and Atomic Typed Documents
Group-Commit Batching and Deferred Commits
Pluggable Storage Backends
Checkpointed Task State Machines
The Effect Sandwich Pattern
Crash Recovery and Restart Limit Circuit Breakers
Idempotent Submission Admission
Replay Safety and External Parking
Safe Versus Non-Idempotent Tools
Deterministic Memoization of Nondeterministic Decisions
Zero-Compute Parking on Timers and Webhooks
Structured Concurrency for Subagents
Task-Owned Child Conversations and Abort Propagation
Fan-Out Combinators and Background Isolation
Zero-Copy Conversation Forks and Delta Watching
Capstone: Journaling Dedup and Crash Resume
Pure State Machines Fail-Closed Security & Systems Rigor
Architectural Constitution and Boundaries
Composition Root and Import Boundaries
Single Core Across CLI Wasm and Node-API
Pure Decision Logic and Formal Verification
Zero-I/O Retry and Recovery Planners
Model Checking Recovery and Leases with TLA+
Fail-Closed Security and Prompt-Injection Defense
Single Permission Choke Point
Cross-Shell Command Parsing Parity
Evidence-Quoted LLM Security Review
Safe Read-Only Git and Subprocess-Free Indexing
Prompt-Cache and Token Economics
Minimal Tool Registries and Lazy MCP Loading
SHA-256 Image Offloading and Transcript Retention
Cache-Prefix Stability and A/B Proxy Regression Tests
Distributed Fencing
Optimistic Writer Fencing and Lease Yielding
Stable Execution IDs Against Double Execution
Capstone: Retry State Machine Allowlists and Cache Test
Code Mode Brain-vs-Hands & Multi-Harness SDKs
Programmatic Tool Calling and Code Mode
Collapsing Sequential Calls into One Sandboxed Cell
Keeping Raw Intermediate Outputs Out of Context
Deterministic Journaling and Replay of Nested Calls
Brain-Versus-Hands Execution Topology
Durable Brains at the Edge
Ephemeral Remote Hands on Demand
Multi-Harness Provider Abstraction
Unifying Claude Codex and Other Families
Preserving Native Ordering and Tool Conventions
High-Concurrency Systems Patterns
Lock-Free Inbox Multiplexing
Native and WebAssembly Parity
Capstone: Sandboxed JS Tool and WebSocket Hands Worker
Verification Simulation & Production Readiness
Storage and Environment Conformance Suites
Deterministic Fault-Injection Simulation and Fuzzing
Deterministic Terminal and UI Tape Replay
File-Based Behavioral Evals and OpenTelemetry Tracing
Capstone: Fault-Injection Harness for Crashes Timeouts and Bad JSON
Loading SophistAI