Home/
Part XIII — Expert Mode: Systems, Agents, and Automation/38. Building a Code-Change Agent Safely/38.2 The "diff generation" agent pattern
38.2 The "diff generation" agent pattern
Overview and links for this section of the guide.
On this page
Generating Diffs
Once the Proposal is approved, the next agent takes the Proposal + Code and generates the Diff.
Use the `SEARCH/REPLACE` block format (as seen in Project 3). It is the most reliable way to apply patches programmatically.
Context Management
Pass the Approved Plan in the system prompt. "You are implementing the plan below. Follow it exactly. Do not deviate."
This "grounding" keeps the coder agent from getting creative and introducing bugs.