Prompt Compression: Recipes That Ship (2026)
Six copy-paste prompt compression moves for 2026 with real before and after token counts. Cut manners, redundancy, and agent history. No library required.

On this page
Quick Answer. Prompt compression means cutting tokens from a prompt without losing the result. You do not need a library. Six hand-writable moves below drop a bloated prompt 30 to 95 percent, each with the before and after token count plus the failure mode that bites if you overdo it. Counts use the o200k_base tokenizer (2026); reproduce them with the OpenAI tokenizer. Tested on Claude and GPT-class models, July 2026.
Tested on Anthropic Claude and
OpenAI GPT.
Most prompts are padding. Manners, re-explanation of formats the model already knows, prose where a list would do. In an agent loop that padding compounds every turn, and the monthly bill is where you feel it. Prompt caching helps on the repeated prefix (Anthropic docs), but the cheapest token is the one you never send. Six moves, cheapest effort first.
Recipe 1: Kill the throat-clearing
Claim: politeness is tokens the model does not read as signal.
# Before (61 tokens)
Hi! I was hoping you could please help me with something.
I would really appreciate it if you could take a look at
the customer review below and tell me whether the overall
sentiment is positive, negative, or neutral. Thanks so much!
# After (9 tokens)
Classify sentiment: positive, negative, or neutral.
Why it works: "please", "I was hoping", "thanks so much" carry zero task signal. The model grounds on the verb and the constraint, nothing else.
Failure mode: do not delete the real constraint words with the manners. "only", "valid", "3 bullets" stay. Cut the greeting, keep the spec.
Recipe 2: Name the operation, do not describe it
Claim: a named op is a one-word instruction the model already understands.
# Before (34 tokens)
Read the text below and produce a version that is much
shorter, keeping only the most important points and
dropping anything that is not essential.
# After (8 tokens)
Summarize in 3 bullets. Facts only.
Why it works: summarize, extract, classify, rank, rewrite. Each is grounded. Describing the operation in prose re-derives what one verb already says.
Failure mode: vague verbs ("improve", "optimize", "enhance") compress tokens but expand ambiguity. Name a verb that maps to a measurable output.
Recipe 3: Delete what the model already knows
Claim: re-teaching a common format is pure waste.
# Before (41 tokens)
Return the result as JSON. JSON stands for JavaScript
Object Notation, a lightweight format of key-value pairs.
Make sure it is valid and parseable by a standard parser.
# After (11 tokens)
Return valid JSON: {name, email, plan}.
Why it works: the model knows what JSON, Markdown, and CSV are. It does not know your field names. Spend tokens on the second thing.
Failure mode: do not cut the facts it cannot know. Your enum values, your schema, your edge rules stay. Delete the textbook, keep the specifics.
Recipe 4: Structure beats prose
Claim: keys drop connective tissue and raise instruction-following at the same time.
# Before (46 tokens)
I need you to write an email that is friendly but
professional, keep it under 120 words, address the
customer by first name, and end with a clear call to
action to book a demo.
# After (24 tokens)
Write an email.
Tone: friendly, professional.
Max: 120 words.
Open: first name.
End: CTA to book a demo.
Why it works: "that is", "and", "keep it" are glue tokens. A labeled list removes them and the model follows a list more reliably than a run-on sentence.
Failure mode: over-nesting. Two levels of structure max, or you pay back the tokens you saved in bracket noise.
Recipe 5: Trim the few-shot examples
Claim: two sharp examples usually beat five sloppy ones, at a fraction of the tokens.
# Before: 5 full-sentence labeled pairs ... ~300 tokens
# After: 2 minimal pairs that mark the decision boundary (~90 tokens)
Review: "Fast shipping, product broke day two." -> mixed
Review: "Zero issues, would buy again." -> positive
Why it works: exemplars teach the shape, not the volume. Keep the pair that sits on the boundary the model keeps missing. See the few-shot recipes for how to pick the discriminating pair.
Failure mode: dropping the hard example to save tokens. Cut the obvious one, keep the confusing one.
Recipe 6: Fold history into a state line
Claim: in an agent loop, the transcript is the cost. Replace old turns with one state line.
# Before: 20 turns of raw history ... ~1,800 tokens
# After (~28 tokens)
State: user onboarding a Stripe integration; keys set;
webhook failing on signature check; last error 400.
Why it works: the next step needs the current state, not the play-by-play. Recursive summarization, folding every N turns into a state line with a cheap model, is what stops long runs from paying quadratically. Frameworks like Microsoft's LLMLingua automate token pruning, but the hand version above covers most of the win.
Failure mode: summarizing away a detail the next step needs. Fold decisions and open threads, never the unresolved bug.
Which lever first
Cost-ordered, cheapest effort at the top.
Scroll to see more
| Move | Effort | Typical cut |
|---|---|---|
| Kill throat-clearing | trivial | 20 to 80% of the instruction |
| Name the operation | trivial | 50 to 75% of the instruction |
| Delete known context | low | 30 to 70% of the instruction |
| Structure over prose | low | 30 to 50% |
| Trim few-shot | medium | 40 to 70% of the example block |
| Fold history to state | medium | 80 to 95% in agent loops |
Start at the top. The first three cost seconds and clear most of the bloat. Reach for a compression library only when you are pruning long retrieved context at scale, not for a prompt you wrote by hand. The rest of the toolkit lives in the prompt engineering cheat sheet.
Cost to test: $0.00. Every move above is a text edit. The only cost is the tokens you stop paying for.
Written by
Sam Q.Sam Q. writes terse, tested prompt recipes for PromptAttic. Senior engineer energy, commit-message prose.
FAQ
What is prompt compression?
Prompt compression is reducing the number of input tokens in a prompt while preserving the output you wanted. In 2026 it splits into two families: hand editing (cut manners, redundancy, and prose) and algorithmic pruning (tools like LLMLingua that drop low-value tokens). For prompts you write by hand, the editing moves cover most of the saving.
Does prompt compression hurt output quality?
Usually it improves quality, because removing filler and repetition cuts what distracts the model. It only hurts when you delete a real constraint (an enum value, a word like valid or only) or the edge example that marks a hard decision boundary. Cut manners and re-explanation first; those are free.
Do I need a tool like LLMLingua?
No, not for a prompt you wrote by hand. The six moves in this post (kill throat-clearing, name the operation, delete known context, structure over prose, trim few-shot, fold history to a state line) handle the bulk. Reach for a library when you are pruning long retrieved context at scale in a RAG or agent pipeline.
How much can prompt compression save?
Typically 30 to 70 percent on a verbose single prompt, and 80 to 95 percent on an agent transcript once you fold old turns into a state line. The exact cut depends on how much padding the original carried. Measure before and after with a tokenizer to confirm.
What is the single fastest win?
Delete politeness and stop re-explaining formats the model already knows (what JSON is, what Markdown is). That one pass often removes half the instruction with zero risk to the result.
Related recipes
Few-Shot Prompting Examples That Ship (2026)
Five copy-paste few-shot prompting examples that ship: classification, JSON extraction, tone matching, refusal, and format locking, plus the shot-count and label-bias traps.
The 2026 Prompt Engineering Cheat Sheet (For People Who Ship)
A terse, production-first prompt engineering cheat sheet for 2026: fifteen patterns, each with a one-line rule, its failure mode, and a link to the full recipe.
ReAct Prompting: 6 Copy-Paste Recipes That Ship (2026)
ReAct prompting interleaves reasoning and tool calls: Thought, Action, Observation, repeat, until the model has enough to answer. It is how a plain prompt becomes an agent. Six copy-paste ReAct recipes below, each with the failure mode that bites first. Tested July 2026.


