Planning & Control Flow

Spec-First Agent

Drive the agent loop from a human-authored specification document rather than free-form prompts.

Problem

Free-form prompts drift between sessions: the same engineer types subtly different instructions on different days and the agent's behaviour quietly changes. When the spec lives in one engineer's head, nobody else can review it, audit it, or take over when that engineer is away. Without a written target, there is no single source of truth for what "done" means, so the agent may declare success on partial work or keep going past where the team would have stopped. The team needs a written, version-controlled spec without giving up the agent's ability to update its own plan as it learns.

Solution

Write the specification as a markdown file (PROMPT.md, fix_plan.md, or similar). The agent reads the spec at each iteration, executes against it, and may update it under controlled conditions. The spec is the single source of truth for what 'done' means.

When to use

  • The task is well-defined enough to write down as a spec.
  • The spec needs to be inspectable, audited, or shared across engineers.
  • The agent benefits from a stable target rather than free-form prompts.

Open the full interactive page

Diagram, neighbourhood map, code examples, related patterns and full provenance.

Related