> ## Documentation Index
> Fetch the complete documentation index at: https://labs.prompthon.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Planning And Reflection

<div className="not-prose my-4 rounded-md border border-gray-200 bg-gray-50 p-2 text-sm dark:border-gray-800 dark:bg-gray-900/40">
  <div className="mb-2 px-1 text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Need help?</div>

  <div className="flex flex-wrap gap-2">
    <a className="inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-1.5 font-medium text-gray-700 no-underline shadow-sm hover:border-gray-300 hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950/60 dark:text-gray-200 dark:hover:bg-gray-900" href="https://discord.gg/sDE2HhGTg4" target="_blank" rel="noreferrer">
      <Icon icon="discord" iconType="brands" size={14} />

      <span>Ask in Discord</span>
    </a>

    <a className="inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-1.5 font-medium text-gray-700 no-underline shadow-sm hover:border-gray-300 hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950/60 dark:text-gray-200 dark:hover:bg-gray-900" href="https://github.com/Prompthon-IO/agent-systems-handbook/issues/new/choose" target="_blank" rel="noreferrer">
      <Icon icon="github" iconType="brands" size={14} />

      <span>Open a GitHub issue</span>
    </a>

    <a className="inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-1.5 font-medium text-gray-700 no-underline shadow-sm hover:border-gray-300 hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950/60 dark:text-gray-200 dark:hover:bg-gray-900" href="https://github.com/Prompthon-IO/agent-systems-handbook/blob/main/SUPPORT.md" target="_blank" rel="noreferrer">
      <Icon icon="life-ring" size={14} />

      <span>Support guide</span>
    </a>
  </div>
</div>

## Summary

Planning and reflection patterns add structure around an agent loop. Planning
breaks a task into an explicit execution path. Reflection evaluates a draft or
trajectory and decides what to improve.

## Why It Matters

Pure step-by-step control is often not enough for longer or more structured
tasks. The agent may need to see the whole shape of the work before acting, or
it may need a deliberate review step after producing an initial answer.

Planning and reflection are two ways to improve quality without pretending the
first pass will always be good enough.

## Mental Model

Planning patterns, such as the plan-then-execute style highlighted in the
imported source material, separate work into two phases:

* generate a task plan
* execute against that plan

Reflection patterns add another loop:

* produce an initial answer or artifact
* critique it
* refine it

These patterns are useful for different reasons.

* planning reduces drift on multi-step structured tasks
* reflection improves quality when first drafts are cheap but correctness or
  performance matters

## Architecture Diagram

```mermaid theme={null}
flowchart TD
  Task["Task"] --> Plan["Plan"]
  Plan --> Execute["Execute step by step"]
  Execute --> Draft["Draft result"]
  Draft --> Review["Reflect and critique"]
  Review --> Refine["Refine or stop"]
  Refine --> Final["Final result"]
```

## Tool Landscape

Planning works well when the task can be decomposed clearly:

* structured research
* multi-step analysis
* code generation with explicit stages

Reflection works well when the system can meaningfully judge and improve its
own output:

* code quality and performance
* report structure and completeness
* task trajectories that need error correction

Both patterns benefit from lightweight memory because plans, critiques, and
prior drafts need to be available without overwhelming the main context.

## Tradeoffs

* Planning improves coherence, but it can lock the system into a weak plan if
  replanning is impossible.
* Reflection improves quality, but it increases latency and model cost.
* Detailed plans help structured work, but they can become overhead for simple
  tasks.
* Strong critique prompts can improve outputs, but they also create another
  place where prompt design can fail.

Useful defaults:

* add planning when the task has more than one meaningful dependency chain
* add reflection when quality matters enough to justify another pass
* stop iterating when additional review no longer changes the decision

## Reading Extensions

* [Reasoning And Control Patterns](/patterns/reasoning-and-control-patterns)
* [Evaluation And Observability](/systems/evaluation-and-observability)
* [Patterns Overview](/patterns)

## Update Log

* 2026-04-21: Initial repo-native draft based on imported reference material and lab rewrite rules.
