Flows category icon
Agent Architecture
Intermediate

Add a Plan/Todo System to Your Agent

Give your agent the planning discipline of the leading harnesses: an explicit, model-visible todo list that survives long tasks.

4 steps12 verify checks60-90 minutesWorks with: emergent · chatgpt · claude · cursor
Start Guided Walkthrough

The Route

0/4 verified

Context Pack

Paste this first. It briefs the AI on requirements, constraints, and the Definition of Done before your first build prompt.

Context Pack
PROJECT CONTEXT:
My agent handles single-step requests fine but falls apart on multi-step tasks: it forgets steps, repeats work, and declares victory early. Source analyses of Claude Code show a first-class todo/plan tool is core to its reliability.

GOAL:
Add a plan/todo subsystem: the model creates and updates a structured task list, and the harness renders it back into context every turn.

REQUIREMENTS:
- A todo tool the model can call: create, update status, and rewrite items
- Todo state stored by the harness and re-rendered into context each turn
- Statuses: pending, in_progress, completed - with exactly one in_progress at a time
- A rule that non-trivial tasks must start with a plan before any other tool call
- Completion gate: the agent cannot finish while items remain pending

CONSTRAINTS:
- Todos are structured data, not freeform markdown scraped by regex
- The harness owns todo state; the model only mutates it via the tool

DEFINITION OF DONE:
- A 5-step task produces a plan first, then executes items in order
- The rendered todo list appears in context every turn and matches state
- Finishing with pending items is blocked with a corrective message
- Interrupting and resuming preserves the plan and current item

COMMON FAILURES TO AVOID:
- Letting the plan live only in the model's head where it evaporates under context pressure
- Multiple items in_progress so progress becomes untrackable
- Marking items complete without evidence the work happened
- Plans created but never updated - a dead artifact instead of a working memory

Paste this into your AI builder first. It teaches the AI what you want before you give it the build prompt.

Related routes

More Agent Architecture flows that share ground with this one.

Flows category icon
Agent Architecture

Design a Single-Loop Agent

Build the core agent loop the leading coding agents use: one model, one loop, tools in, results folded back into context.

01Define the loop contract
02Build the tool registry
03Implement the loop with result folding

+2 more steps to Done

Best forproduction-grade builds with strict verification

5 steps90-150 minutesAdvanced
Flows category icon
Agent Architecture

Assemble a System Prompt Like the Pros

Structure your agent's system prompt the way leading harnesses do: layered sections, dynamic context, and enforceable rules.

01Decompose the current prompt
02Build the section-based assembler
03Pair rules with enforcement

+1 more steps to Done

Best forbuilders who have shipped a basic app before

4 steps60-90 minutesIntermediate
Flows category icon
Agent Architecture

Error Recovery and Retry Policy for the Agent Loop

Design the retry, backoff, and give-up behavior that separates production agents from demos that loop forever.

01Build the error taxonomy
02Implement retries and corrective feedback
03Add the loop breaker

+1 more steps to Done

Best forbuilders who have shipped a basic app before

4 steps60-90 minutesIntermediate

Made with Emergent