Token Efficiency Encyclopedia

Meta-prompting

Use a model to rewrite a prompt into a shorter one, and accept a candidate only if a behavioral test suite still passes. The prompt is treated like code under refactoring: the model proposes smaller versions, the tests are the specification, and the token count is the objective being minimized.

The targets that pay most are the prompts resident on every turn — system instructions, tool descriptions, tool schemas, agent definitions. They accrete over months as each bug gets its own sentence, and nobody dares delete a sentence because nobody knows which behavior it holds up.

How It Works

  1. Collect the resident prompt surface for one component: its tool description, schema docs, agent definitions, the system-prompt paragraphs that mention it, and companion tools that restate the same rules.
  2. Write behavioral tests for every requirement the prompt must keep: given this situation, the agent must (or must not) do X. These are evals over agent trajectories, not string checks on the prompt.
  3. Ask a model for a smaller candidate, giving it the current prompt, the requirements, and the failures of the previous candidate.
  4. Run the tests on the candidate. Keep it if it passes and is shorter; feed failures back otherwise.
  5. Iterate until the size stops shrinking or tests start failing, then ship behind an online experiment.

The loop is "meta" because the model's output is a prompt, and the quality of that prompt is judged by how another model run behaves under it.

Why It Works

Evidence

GitHub Copilot applied this to the guidance of its task tool (the subagent launcher), which had spread across tool descriptions, schemas, agent definitions, system instructions, and companion tools. The loop halved the prompt, removing about 1,300 tokens per turn: 1.8% fewer prompt tokens per session and 2.9% lower normalized cost per active hour, with no quality regression detected (GitHub blog, 2026).

The first attempt shipped a regression the offline tests missed: independent custom agents started running sequentially instead of in parallel. Users found it; the team wrote a regression eval for that behavior before compressing further. Their lesson: "Prompt behavior needs tests. If a behavior is not tested, a shorter prompt can remove it."

The Test Suite Is the Real Artifact

The compressor optimizes against the tests, so anything untested is, from its point of view, free to delete. Consequences:

Limitations

Terminology

"Meta-prompting" is also used in the literature for a different idea — a conductor model that decomposes a task and prompts expert instances of itself (Suzgun & Kalai, 2024). This article uses the term in the prompt-optimization sense: a model writing and refining prompts, as in APE and OPRO below, with token count as the objective.

See Also

Tools