Components of A Coding Agent
Summary
A coding agent is an application layer, or "agentic harness," that wraps a Large Language Model (LLM) in a control loop to perform software engineering tasks. While the LLM provides the core reasoning, the harness provides the necessary infrastructure—including tool use, memory, and repository context—to transform a raw model into a functional coding tool.
Key Points
- Model Hierarchy: An LLM acts as the core engine; a reasoning model is an LLM optimized for intermediate verification and search; and an agent is the control loop that utilizes the model within an environment.
- Coding Harness Definition: A specialized agent harness designed for software engineering that manages repository context, tool execution, diff application, and iterative feedback.
- Prompt Optimization: Efficient runtimes utilize a "stable prompt prefix" (containing instructions, tool descriptions, and workspace summaries) to enable prompt-cache reuse and reduce computational overhead.
- Core Architectural Components: A functional coding agent requires six primary building blocks: Live Repo Context, Prompt Shaping/Cache Reuse, Structured Tool Access, Context Reduction, Session Memory/Transcripts, and Subagent Delegation.
- Context Management: Effective agents implement context reduction (clipping) and output management to maintain relevant information within the model's context window.
Technical Details
The architecture of a coding agent relies on the distinction between static and dynamic prompt elements. To optimize performance, the harness implements a "stable prompt prefix" consisting of instructions, tool definitions, and a workspace summary. By keeping this prefix relatively constant, the system can leverage prompt-cache stability, significantly reducing the cost and latency of repeated model calls. Dynamic elements, such as the latest user request, recent conversation transcripts, and short-term memory, are appended to this prefix during each turn of the control loop.
The "Live Repo Context" component functions by gathering "stable facts" about the environment—such as Git branch status, repository layout, and project documentation (e.g., README.md)—before processing user instructions. This prevents the model from starting from a zero-context state. Furthermore, the harness manages structured tool access, which moves beyond prose-based command suggestions to executable, validated, and permission-gated tool calls. This includes managing the lifecycle of a coding session through a SessionStore to handle transcripts, memory, and task resumption.
Impact / Why It Matters
For developers building or implementing AI-driven workflows, the performance of a coding agent is often determined more by the design of the software harness (context management, tool design, and memory) than by the underlying model choice alone. Understanding this architecture allows for the creation of more capable, efficient, and context-aware engineering tools.