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

# The Five-Stage Pipeline

> Leaves → Steep → Taste → Pour → Archive.

Every brew runs through five sequential stages. Each stage is a single LLM call with a stage-specific prompt and JSON schema, owned by a specialized agent.

```text theme={null}
Leaves   →   Steep    →   Taste    →   Pour     →   Archive
Scout        Brewer       Critic       Refiner      Archivist
```

| Stage       | Agent     | Purpose                        | Output                                              |
| ----------- | --------- | ------------------------------ | --------------------------------------------------- |
| **Leaves**  | Scout     | Frame the topic                | `{framing, subtopics, assumptions, open_questions}` |
| **Steep**   | Brewer    | First structured draft         | Brew-type schema                                    |
| **Taste**   | Critic    | Strengths / weaknesses / score | `{strengths, weaknesses, missing, score}`           |
| **Pour**    | Refiner   | Final polished output          | Brew-type schema (richer)                           |
| **Archive** | Archivist | Reusable recipe                | `{recipe_name, reusable_steps, memory_pack}`        |

## Per-brew output schemas

### Research Brew

```json theme={null}
{
  "overview": "...",
  "key_findings": ["..."],
  "patterns": ["..."],
  "risks": ["..."],
  "next_actions": ["..."],
  "social_post": "..."
}
```

### Prompt Brew

```json theme={null}
{
  "variants": [{ "name": "...", "prompt": "...", "notes": "..." }],
  "comparison": "...",
  "best_blend": "...",
  "tasting_notes": "..."
}
```

### Strategy Brew

```json theme={null}
{
  "options": [{ "name": "...", "pros": ["..."], "cons": ["..."] }],
  "tradeoffs": "...",
  "recommendation": "...",
  "action_plan": ["..."]
}
```

### Context Cleanse

```json theme={null}
{
  "summary": "...",
  "memory_pack": "...",
  "open_questions": ["..."],
  "contradictions": ["..."],
  "next_steps": ["..."],
  "reusable_context": "..."
}
```

### Critique Brew

```json theme={null}
{
  "revised_draft": "...",
  "diff_summary": ["..."],
  "strengths": ["..."],
  "remaining_risks": ["..."],
  "one_line_pitch": "..."
}
```

Critique Brews **skip the Steep stage** — the user-supplied draft is treated as the first draft, and the Critic + Refiner sharpen it directly.

## Cellar injection

Before every stage, the user's [Cellar](/guides/the-cellar) (durable facts, preferences, patterns, glossary terms) is loaded and prepended to the system prompt inside a `<<CELLAR>>` block. After the final stage, an extractor LLM proposes 0–5 new entries from the Pour + Archive output and writes any non-duplicates back to the Cellar.

## Live updates

`brew_steps` rows are updated in place as each stage completes. The UI polls these rows so the user sees the kettle progressing in real time.

## Fallbacks

If `TEAGENTIC_AI_KEY` is missing or the AI Gateway fails, each stage falls back to a deterministic mock so the app stays demoable. See [AI Gateway](/reference/ai-gateway).
