Compress Prompt
Reduce tokens in AI-targeted text. Always use subagents - never compress on main thread.
Process
- •For each file/text to compress, spawn Task:
- •subagent_type: "general-purpose"
- •prompt: include COMPRESSION RULES below + the text
- •Subagent writes compressed output directly to file
- •Main thread reports: file path + before/after token counts
Measure with: ./scripts/count-token <file>
Subagent Prompt Template
code
Compress this text for AI consumption. Apply these rules:
COMPRESSION RULES:
- Drop articles when obvious ("the file" → "file")
- Drop filler phrases ("In order to" → delete, "Make sure to" → delete)
- Imperative voice ("You should run" → "Run")
- Use symbols where clear ("results in" → "→", "and" → "+")
- Condense repetitive lists (keep structure, merge similar items)
- Merge redundant examples (4 similar examples → 1 representative + "etc")
- Keep headers but simplify ("## Step 1: Setup" → "## Setup")
PRESERVE EXACTLY:
- Commands: syntax, flags, args
- Code blocks: unless clearly redundant
- File paths
- Keywords: errors, APIs, technical terms
- Distinct cases with different behavior
TEXT TO COMPRESS:
{text}
Write compressed version to: {output_path}
Parallel Compression
Multiple files → spawn multiple subagents in single message for parallel execution.