Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Agentic Software Construction

This section lives at the agentic level, the newest layer of software practice, where AI models aren’t just tools you use but collaborators you direct. Agentic software construction is the discipline of building software with and through AI agents: systems that can read code, propose changes, run commands, and iterate toward an outcome under human guidance.

The patterns here range from foundational concepts (what is a model, a prompt, a context window) to workflow patterns (plan mode, verification loops, thread-per-task) to execution patterns (compaction, progress logs, parallelization). Together they describe a way of working that’s already changing how software gets built, not by replacing human judgment, but by shifting where human judgment is most needed.

For patterns about controlling, evaluating, and steering agents, see Agent Governance and Feedback.

If the earlier sections of this book describe what to build and how to structure it, this section describes how to direct an AI agent to do that building effectively. The principles from every prior section still apply: agents need clear requirements, good separation of concerns, and honest testing. What changes is the workflow: you spend less time typing code and more time thinking, reviewing, and steering.

Foundations

What agents are made of: the core primitives that every agentic workflow builds on.

  • Model — The underlying inference engine that generates language, code, plans, or tool calls.
  • Prompt — The instruction set given to a model to steer its behavior.
  • Context Window — The bounded working memory available to the model.
  • Context Rot — The quiet decline in output quality as inputs grow, even inside the advertised window.
  • Context Engineering — Deliberate management of what the model sees, in what order.
  • Progressive Disclosure — Load instructions, tools, and references into the agent’s working memory only when they become relevant.
  • Agent — A model in a loop that can inspect state, use tools, and iterate toward an outcome.
  • Harness (Agentic) — The software layer around a model that makes it practically usable.
  • Tool — A callable capability exposed to an agent.
  • MCP (Model Context Protocol) — A protocol for connecting agents to external tools and data sources.
  • Retrieval — Pulling relevant documents from an external corpus into the agent’s context at query time.
  • Code Mode — Give the agent a small API and a sandbox; let it write code that calls tools instead of emitting JSON one step at a time.

Direction and Control

How you steer an agent: the patterns that shape what it does before, during, and between tasks.

  • Plan Mode — A read-first workflow: explore, gather context, propose a plan before changing.
  • Question Generation — Interview first, implement second: the agent asks structured clarifying questions before writing any code.
  • Research, Plan, Implement — A three-phase discipline that separates understanding from decision-making from execution.
  • Verification Loop — The cycle of change, test, inspect, iterate.
  • Instruction File — Durable, project-scoped guidance for an agent.
  • Skill — A reusable packaged workflow or expertise unit.
  • Hook — Automation that fires at a lifecycle point.
  • Memory — Persisted information for cross-session consistency.

Coordination

How multiple agents and threads compose: from subagents to full teams.

  • Subagent — A specialized agent delegated a narrower role.
  • Thread-per-Task — Each coherent unit of work in its own conversation thread.
  • Worktree Isolation — Separate agents get separate checkouts.
  • Parallelization — Running multiple agents at the same time on bounded work.
  • Agent Teams — Multiple agents that coordinate with each other through shared task lists and peer messaging.
  • Generator-Evaluator — Two agents in an adversarial loop: one writes, one judges, and quality improves through independent critique.
  • Model Routing — Directing different tasks to different models based on cost, capability, and latency requirements.
  • A2A (Agent-to-Agent Protocol) — A standard protocol for agents to discover each other and collaborate across vendor boundaries.
  • Handoff — The structured transfer of context, authority, and state between agents or agent sessions.

Execution Hygiene

How a single agent thread stays sane over long tasks: managing context, tracking progress, and recovering from interruptions.

  • Compaction — Summarization of prior context to continue without exhausting the context window.
  • Progress Log — A durable record of what has been attempted, succeeded, and failed.
  • Checkpoint — A gate in a workflow where the agent pauses, verifies conditions, and proceeds only if they pass.
  • Externalized State — Storing an agent’s plan, progress, and intermediate results in inspectable files.
  • Ralph Wiggum Loop — A shell loop that restarts an agent with fresh context after each unit of work, using a plan file as the coordination mechanism.