pipelines / mail-triage.yaml

Triage your email, send nothing

No repository at all: the target is a scratch folder and the work happens through a connector. The agent can only search and read; what it proposes waits for you, and the apply step can only label threads and save drafts.

// the steps

What runs, in order.

  1. 01-triage
    agent · cheap

    Searches and reads new threads with read-only Gmail tools, and proposes at most 30 actions: label or draft_reply.

  2. verify
    check

    caffeine check actions refuses any action type that isn't allowed.

  3. inbox
    you

    caffeine inbox lists the proposals; caffeine approve or caffeine reject.

  4. apply
    agent · cheap

    With only label_thread and create_draft available: no tool can send.

// the file

The whole pipeline.

Shipped with caffeine as an example. Copy it to ~/.caffeine/pipelines/, list it on a target in workspace.yaml, then caffeine run mail-triage.

pipelines/mail-triage.yaml
description: "Triage new emails into labels and draft replies; nothing is sent"
claude_connectors: true
actions: { allowed: [label, draft_reply], max: 30 }

steps:
  - name: 01-triage
    prompt: prompts/mail-triage/triage.md
    model: cheap
    max_turns: 30
    timeout: 900
    allowed_tools: [Write, ToolSearch,
                    mcp__claude_ai_Gmail__search_threads, mcp__claude_ai_Gmail__get_thread,
                    mcp__claude_ai_Gmail__list_labels]
    verify: caffeine check actions

apply:
  - name: apply
    prompt: prompts/mail-triage/apply.md
    model: cheap
    max_turns: 40
    allowed_tools: [Read, ToolSearch, mcp__claude_ai_Gmail__label_thread, mcp__claude_ai_Gmail__create_draft]