Vibe Code Textbook

Part I, chapters 1–7

Harnesses

The agent runners themselves: what each one does, its configuration, its permission model, and where it breaks.

Part I is about the harness: the program around the model that runs the loop, holds the tools, decides what the agent may do and loads its context. Its seven chapters read the harnesses from their own documentation and source, each on a stated date and at a stated version, because these tools change month by month.

Start with what a coding-agent harness is. It names the four parts every coding agent has (the loop, the tools, the permission gate and the context), checks each against real harnesses, and ships a runnable version of about a hundred lines with a scripted stand-in where the model would be. The other chapters take the parts one at a time. The gate: permission models compared puts Claude Code, Codex CLI, Gemini CLI, the OpenHands SDK and Omnigent side by side, with a working settings file. The context: CLAUDE.md, AGENTS.md and .cursor/rules gives the load and merge rules with an audit script, and memory across sessions separates saved transcripts, compaction and the memory an agent writes for itself. The tools: an MCP server in Python builds a dependency-free stdio server and shows the JSON-RPC on the wire. Unattended use closes the part, with running an agent headless in CI and coding agent security: injection through tool results, MCP server trust, and secrets in configuration.

Check the date and version in a chapter before relying on one of its flags. Workflows turns these parts into working habits. The one item left in our plan for this part is a comparison update when one of these harnesses ships a major version; none did in the third quarter of 2026.

  1. 1

    What is a coding-agent harness? The loop, tools, gate, and context

    A coding-agent harness is the loop around the model. Here is what each part does, read from three real harnesses, with a 100-line runnable version you can inspect.

  2. 2

    Claude Code vs Codex vs Gemini CLI: what an agent may run

    The permission models of Claude Code, Codex CLI, Gemini CLI, the OpenHands SDK, and Omnigent, read from their docs on 2026-09-05, with a working settings file.

  3. 3

    CLAUDE.md, AGENTS.md, and .cursor/rules: what goes in a context file

    Where each coding agent looks for standing instructions, how the files load and merge, the size limits, and an audit script that finds every context file in a repo.

  4. 4

    MCP server tutorial in Python: a stdio server from scratch

    What the Model Context Protocol changes for coding agents, the JSON-RPC on the wire, and a dependency-free Python stdio server exercised with a scripted client.

  5. 5

    Claude Code and Codex headless: running a coding agent in CI safely

    The flags for non-interactive Claude Code and Codex CLI runs, the caps that bound a job, the risks the docs name, and a CI wrapper exercised in dry-run mode.

  6. 6

    Coding agent security: MCP prompt injection, servers, and secrets

    MCP prompt injection via tool descriptions, server trust and secrets: what Claude Code, Codex and Gemini CLI docs commit to, and 593 registry packages scanned.

  7. 7

    Coding agent memory across sessions: Claude Code, Codex, Gemini CLI

    What Claude Code, Codex, and Gemini CLI carry from one session to the next: transcripts, compaction, and agent-written memory, plus a script that checks what loads.