Compress a prompt
Shortens a long prompt while preserving its behaviour, maps every original instruction to where it now lives, reports the real size reduction and lists test inputs to check nothing changed.
Long prompts cost tokens and latency, and they often bury their important instructions under repetition and filler. But a shorter prompt is only better if it behaves the same. Compression is safe when every behaviour of the original is listed first and checked off at the end, and when test inputs exist to compare the two versions.
Target reduction:
- Build a behaviour inventory: every distinct thing the prompt makes the model do or avoid (role, steps, rules, edge-case handling, output format, tone, examples and what each example teaches). Number them B1, B2 and so on.
- Find what can go without changing behaviour: repetition, filler and politeness, emphasis words, explanations that do not change behaviour, instructions that restate model defaults, and examples that teach the same thing as another example.
- Keep what carries behaviour: reasons that shape judgement in unforeseen cases, edge-case rules, the output format, placeholders, and examples that cover distinct cases.
- Rewrite the prompt more tightly: merge overlapping rules, turn paragraphs into short lists where that is clearer, and keep the original order of priority.
- Map each inventory item to where it now lives in the compressed prompt, or mark it as deliberately removed with the reason.
- Estimate the size before and after in words and approximate tokens (roughly 1.3 tokens per English word), rounded and marked as estimates, and the reduction as a percentage. If the target cannot be met without losing behaviour, stop at the safe size and say which behaviours you would have to drop to go further.
- Write five to eight test inputs that exercise the behaviours most at risk, each with the observable result both versions must produce.
- Preserve every placeholder, variable, delimiter tag name and required output field exactly.
- Never drop a safety, privacy or honesty instruction to save space.
- Do not change what the prompt does. Improvements you notice go in a separate "Possible improvements" line, not into the compressed prompt.
- You cannot run the tests. Present them for the user to run on both versions side by side.
Behaviour inventory
Numbered list B1, B2...
Compressed prompt
Fenced code block.
Behaviour map
Table: Behaviour | Where it lives now (quote the phrase) or "removed: reason".
What was cut
Bullets: what and why it was safe.
Size
One line: "About N words (~T tokens) → about M words (~U tokens), about P% shorter." If the target was not met, one more line on what would have to go to reach it.
Test inputs
Table: Input | Behaviours tested | Expected in both versions. Possible improvements: one line, or "None".
1 required value still a placeholder; the assistant will ask for it.
details
- kind
- Prompt: a task you run by name to get one finished thing back
- domain
- Prompting and assistants
- category
- Prompt engineering
- level
- Intermediate
- made for
- ML / AI engineer, Software engineer, Anyone, personal use
- risk
- read-only
- version
- v1.0.0 · incubating
- reviewed
- 2026-10-02
- works in
- Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Antigravity, OpenCode, Windsurf, Zed, Continue, AGENTS.md, ChatGPT, claude.ai
use in
npx @hermes-hq/hodios install compress-prompt --target claude-codenpx skills add hermes-hq/hodios-dist --skill compress-prompt -a claude-codeclaude plugin marketplace add hermes-hq/hodios-distclaude plugin install hodios-prompting@hodiosThe plugin brings every entry in this domain at once.
pairs well with
All of Prompt engineeringPrompt engineer
Prompt engineer who writes clear, testable instructions, iterates against real examples and evals, and avoids model-specific tricks. Use for designing, debugging and maintaining prompts.
prompt-engineerImprove a prompt
Diagnoses why a prompt gives weak or inconsistent results and rewrites it with clear context, task, constraints and output format while keeping its intent. Use on any prompt for any AI assistant.
improve-promptDiagnose prompt failures
Diagnoses why a prompt produces bad answers from failing examples, traces each failure to a root cause, proposes targeted fixes and a quick regression test set.
diagnose-prompt-failuresAdapt a prompt for a reasoning model
Rewrites a prompt for reasoning-capable models by removing step-by-step micromanagement, stating goals, constraints and success criteria, and keeping the output format exact.
adapt-prompt-for-reasoning-modelBuild a test set for a prompt
Builds a hand-run test set for a prompt with happy, edge and negative inputs, expected behaviour and checkable pass criteria per case, and a scoring sheet to compare prompt versions side by side.
build-prompt-test-setCreate few-shot examples
Builds a small set of diverse, representative few-shot examples for a task, including tricky and negative cases, balanced so the model learns the rule rather than copying surface patterns.
create-few-shot-examples