Skip to content

Metaprompting is how one template serves N contexts — either by injecting variables at boot ({{VARS}}) or by chaining phases through artifacts on disk.

Guide

how-to-metaprompt

When to reach for it

One static prompt can't serve N contexts.

?   Will this same prompt run across varying team sizes, task types, or phases?

↙↘

No — don't metaprompt

One context, one prompt.

Plain slash command.

Hand-write the text once. Ship.

Yes — metaprompt

Same skeleton, shifting context.

3-team system today.

10-team system tomorrow.

Same Planning Lead, zero edits.

Metaprompting is overhead when there's only one target. It's leverage the moment N > 1.

Two mechanisms, same goal

Injection swaps the content. Phase-gating swaps the stage.

Mechanism A · runtime injection

Variables resolved at agent boot

One template. {{VARS}} replaced per-agent, per-session.

# planning-lead.md

You are the Lead for

{{TEAMS_BLOCK}}

Your expertise:

{{EXPERTISE_BLOCK}}

Log at:

{{CONVERSATION_LOG}}

3-team system, 10-team system — same file. The resolver fills the blanks.

Mechanism B · multi-phase

Phase N's output is Phase N+1's input

Each phase emits an artifact to disk. A regex cascade picks it up.

Phase 1 · Plan

→specs/plan-xxx.md

Phase 2 · Build

→build.log

Phase 3 · Test

Phases compose via disk, not memory. Each is a fresh agent with a fresh prompt.

They're not rivals — real systems stack them. Phase templates have {{VARS}} too.

The reading path

Six nodes, in order. Each teaches a load-bearing piece.

1

Metaprompt Variable Injection pattern

{{EXPERTISE_BLOCK}}{{SKILLS_BLOCK}}{{SESSION_DIR}} resolved at boot — one Planning Lead prompt serves a 3-team or 10-team system with no edits.

2

Phase Gate with Artifact Extraction pattern

Phase N writes specs/plan-xxx.md; a regex cascade pulls the path; Phase N+1 boots with it. Phases compose on disk, not in memory.

3

Classification Gate pattern

The simplest metaprompt: a cheap classifier decides the kind-of-thing, then routes to the type-specific planner. Cheap agent upstream of expensive agent.

4

Cost-Quality Is a Knob principle

Model choice is per-task metaprompting. The map from slash-command to model is a lookup table — not a hardcoded argument.

5

Command primitive

Slash-command templates are where metaprompts live. Variables are the injection point. Output format is what downstream phases consume.

6

Plan primitive

Phase Gate uses plan artifacts as the handoff medium. The plan file is literally the baton.

Read 1–2 if you're building your first metaprompt. Add 3–4 when you start orchestrating. 5–6 are the artifacts the patterns produce.

Where this guide sits

Prompting → metaprompting → multi-agent.

prerequisite

how-to-prompt

Write one good static prompt first.

you are here

how-to-metaprompt

One template → N executions.

next

how-to-build-metaagents

Metaprompting at scale: multi-agent orchestration.

Skip ahead only if you've already felt the pain of hand-editing the same prompt across three agents.

The discipline

Metaprompts turn one template into many executions — without hand-editing.

Inject variables at boot, or chain phases through artifacts on disk. Both trade a flat static prompt for a skeleton plus context. The payoff is that the system scales without the prompt changing.