Learn AI Hub/Module 02

Coding with Agents: Harnesses, Guardrails & Verification.

⏱️ 90-Second Read·Topic: AI Engineering·Updated Sep 2026

01.From Chat Prompt to Terminal Agent

The transition from copilot-style code completion to autonomous coding agents represents a major shift in developer leverage. An agent operates inside an iterative execution loop:

1. ObserveRead git diff & files
2. PlanDecompose into steps
3. ExecuteWrite AST/hashline edits
4. VerifyRun linter & test suite

02.Claude Code vs OpenCode: My Experience

I regularly run two leading agent environments for building my web applications:

Claude Code (Anthropic)CLI Native

Unrivalled contextual reasoning over large codebases. Superb at cross-module refactors, finding obscure type mismatches, and respecting existing repository architectural patterns.

OpenCode (Open-Source)Customizable

Complete flexibility. Allows routing different tasks to specialized models (e.g. DeepSeek for rapid unit tests, Claude 3.5 Sonnet for system design) while keeping tools fully customizable.

03.The Golden Rule: Deterministic Verification

An agent left without strict automated verification is dangerous. It will hallucinate working code that compiles but silently breaks subtle edge cases.

Non-Negotiable Production Guardrails:
  • Test Verification First: Never accept an agent's completion claim until `vitest run` or `npm run check` exits code 0.
  • Atomic Commits: Require the agent to make small, reviewable git commits rather than massive monolithic rewrites.
  • Sandboxed Permissions: Lock down sensitive production environment files and secrets from tool exposure.

The 90-Second Rule of Thumb:

Treat a coding agent like a brilliant junior engineer: give it crystal-clear acceptance criteria, confine its edits to designated files, and let automated tests be the judge.