How Output Compression Works in AI Coding Assistants: Principles and Practice
This article explains how instruction-level and skill-level mechanisms reduce verbose output from AI coding assistants. It breaks down the four types of tokens in a typical request, shows how a SKILL.md file defines a behavioral contract without changing the underlying model, and interprets reported compression rates that vary by task type. It also outlines the limits of output compression, including hidden reasoning tokens and loading overhead, and gives a five-step approach for measuring real end-to-end savings in a team setting.
1. The Problem: Why AI Coding Assistants Never Seem to Stop Talking
Developers using AI coding assistants run into the same experience: the technical answer is usually correct, but the delivery is extremely long. The model restates the question, lists several possibilities, explains one by one why the others were ruled out, and only then states a conclusion. It closes with a long block of “notes” and “next steps.” For a developer who only needs a runnable snippet, this is low-density information, yet every token is billed and every token consumes context window space.
This pain point has led the community to a clear demand: make the AI cut the filler. A class of lightweight extensions has emerged with a simple premise: make the coding assistant talk “like a caveman.” Keep only the conclusion, the causal chain, and the actionable step; drop pleasantries, preamble, and repeated explanation. One such extension drew heavy attention in a technical community, which shows that verbose output is now a widely perceived experience and cost problem, not a matter of individual preference.
One clarification about the scope of this article: we are not promoting or reviewing any specific extension. We are discussing a general technical approach: constraining a large model’s output style through instruction-layer and skill-layer mechanisms. This approach applies to any coding assistant that follows Skill, Plugin, or custom instruction conventions.
2. What Tokens Actually Cost: Do the Math First
To evaluate any “token-saving” approach, you first need to break down where tokens actually go in a request. A typical coding assistant call involves four categories of tokens:
- System prompt and tool definitions: fixed overhead, including the identity setup, safety policy, available tools, and their parameter schemas. The more tools, the larger this part.
- Context tokens: conversation history, file contents that were read, retrieved code snippets. In long sessions this is often the biggest slice.
- Visible output tokens: the content the model ultimately returns to the user as natural language or code blocks. This is the only target that compression approaches act on directly.
- Hidden reasoning tokens (reasoning/thinking tokens): the internal reasoning the model consumes before answering. Usually not counted in the visible reply, but still a real cost in latency and billing.
Understanding this layering is the prerequisite for judging claims like “75% less consumption.” Output compression only acts on the third category, while the total on the bill is often dominated by the first two.
3. How the Compression Mechanism Works: Change the Behavior Contract, Not the Model
The reason this class of extensions can work is that mainstream coding assistants have already opened up Skill and Plugin mechanisms. The general workflow is as follows.
3.1 Defining a Behavior Contract with SKILL.md
Anthropic provides a relatively complete skill and plugin mechanism for Claude Code. A developer only needs to create a SKILL.md file for Claude to recognize it as a skill, customizing invocation and output style without touching the model internals. The essence of this mechanism is injecting a stable set of behavioral instructions into the model context according to a directory convention.
A minimal usable skill definition typically contains a structured metadata header and body instructions, as shown below:
---name: terse-outputdescription: Use when the user asks for a short answer, or when the question only needs a conclusion---# Output Rules1. State the conclusion first, then the minimum necessary reasoning, no more than 3 points.2. Do not restate the user's question or repeat known context.3. Do not output disclaimers, summary sections, or next-step suggestions unless the user explicitly asks.4. Code first: if a conclusion can be expressed in code, do not explain in natural language what the code does.5. Preserve all boundary conditions, error handling, and safety-related notes; do not omit them for the sake of compression.
The key is rule 5. The place where compression most easily goes wrong is treating “necessary constraints” as filler and deleting them along with everything else. Error handling, boundary conditions, concurrency and idempotency assumptions, and warnings about destructive operations all belong to the non-compressible zone.
3.2 Directory Conventions and Load Timing
A typical implementation includes a plugin manifest directory, a plugin implementation directory, and a skills directory (for example, structures like .claude-plugin, plugins/caveman, skills/caveman), which the host tool scans and registers when the session initializes. Here is a detail that is often overlooked: whether a skill’s description field enters the context depends on the host tool’s loading strategy. If the description is injected permanently, you pay for it on every request; if it is loaded on demand, the cost only appears after it is triggered.
3.3 Why This Works
From the model’s behavioral perspective, verbose output is not because the model “cannot speak briefly,” but because the default alignment target leans toward “explain thoroughly, avoid omissions.” An instruction-layer constraint effectively changes the evaluation standard from “explained comprehensively enough” to “information density high enough,” and the model’s expression strategy switches accordingly. Two reasons make this mechanism hold: first, models have a high degree of compliance with system-level instructions; second, “brief” is itself a clearly describable, low-ambiguity output format requirement, not a vague quality preference.
4. Measured Compression Rates: From “65% on Average” to a Range of 22%–87%
The initial test in the original project’s README reports that it reduces visible output tokens by about 65% without sacrificing technical accuracy, with a range of 22% to 87% across the listed tasks. These numbers deserve careful reading, because they reveal the real distribution of compression gains.
The compression rate depends heavily on task type and falls roughly into four categories:
- High compression (above 70%): concept explanations, syntax questions, configuration syntax, “why am I getting this error” diagnostics. These answers are originally full of preamble and self-correction, leaving the most room to compress.
- Medium compression (30%–60%): code generation and refactoring suggestions. The code itself is not compressible; what can be compressed is the explanation.
- Low compression (below 15%): architecture comparisons, security reviews, multi-constraint tradeoffs. The value of these tasks lies precisely in laying out the tradeoffs clearly, and compression directly harms the quality of the conclusion.
- Negative return: extremely simple Q&A. When the answer itself is only one or two lines, the extra context overhead from the instructions exceeds what they save.
A concrete comparison. Faced with a question like “why does my React component re-render,” a conventional answer unfolds like this:
Your React component re-renders most likely because you are creating a new object reference on every render cycle. When you pass an inline object as a prop, React’s shallow comparison treats it as a different object each time, which triggers a re-render. I suggest using useMemo to cache that object.
The compressed version is closer to:
A new object reference is created on every render. Inline object passed as a prop = reference changes = re-render. Cache the object with useMemo.
The two carry equivalent technical information, but the latter consumes only about one third of the tokens of the former. This example shows that the essence of compression is removing “narrative redundancy,” not deleting information.
5. The Boundaries You Must Recognize
Any approach that claims to sharply cut costs has clear failure boundaries. Here are the four most important to watch.
5.1 It Does Not Act on Hidden Reasoning Tokens
This kind of skill does not target hidden reasoning tokens or thinking tokens; it mainly compresses visible output. This means that if the main cost of a request comes from the model’s reasoning process, output compression produces almost no savings on the bill. Developers can compare the “reasoning token share” before and after enabling it to judge whether the approach addresses the actual bottleneck.
5.2 Loading Itself Costs Tokens
The official Anthropic documentation also notes that loading caveman itself consumes tokens, so the real end-to-end cost savings may fall short of 75%. Skill instructions and plugin manifests occupy context, and the shorter the session, the heavier the fixed cost per session. The reasonable engineering conclusion: compression approaches suit long sessions and multi-turn iteration, not one-off short Q&A.
5.3 The Author Calls It “Not a Strict Benchmark”
The author states clearly that this is only an initial test, not a strict benchmark. The 65% figure comes from a specific task set and a specific prompting strategy, lacking confidence intervals, repetition counts, and randomness control. For a technical selection decision, you must build your own evaluation set rather than citing ready-made numbers.
5.4 Quality Risk Cannot Be Ignored
Compression can bring three types of hidden loss: first, loss of key information (omitting boundary conditions or error handling); second, reduced executability (the conclusion is correct but lacks necessary context, requiring a follow-up round that increases total cost); third, style rigidity (every answer is forced into extreme brevity, and complex problems are oversimplified).
6. Putting It into Practice: Implement It Yourself and Quantify the Gains
To roll out output compression within a team, proceed in the following steps.
Step 1: Establish a Baseline
Fix a set of 20–50 real tasks covering high, medium, and low compression scenarios. For each task, record three metrics: visible output tokens, hidden reasoning tokens, and the number of rounds to complete the task (whether a follow-up was needed).
Task ID | Scenario Type | Visible Output Tokens | Reasoning Tokens | Follow-ups | Conclusion CorrectT001 | Syntax Q&A | 420 | 0 | 0 | YesT002 | Architecture | 880 | 1200 | 1 | Yes
Step 2: Write the Compression Instructions
The instructions should distinguish “compressible items” from “non-compressible items.” Compressible items include restatement, preamble, disclaimers, summary sections, and repeated explanation. Non-compressible items include error handling, boundary conditions, security risks, destructive-operation warnings, and dependency assumptions.
Step 3: Compare with Controlled Variables
Under the same model, the same temperature setting, and the same context length, toggle only the skill on and off, repeat at least 3 times, and take the median. Pay special attention to distinguishing “visible output tokens dropped” from “total tokens dropped”: the former might be 60%, while the latter might be only 20%.
Step 4: Account for End-to-End Cost
Total cost per round = system prompt + skill instructions + context + visible output + reasoning tokensReal gain of the compression approach = (baseline total cost - optimized total cost) / baseline total cost
The gain is real only when the number of follow-ups does not rise. If follow-ups increase by 0.5 rounds, the savings from compression are quickly offset.
Step 5: Enable in Tiers
Make the compression instructions a switchable set of levels rather than a global default. Use the highest compression level for simple Q&A, and the lowest level or off for architecture and design reviews. This “tiered by scenario” approach balances cost and quality better than a one-size-fits-all setting.
7. Extending the Practice to Cloud Platforms and Team Collaboration
In a fuller enterprise development workflow, output compression is only one part of cost control. Around AI coding assistants, the following general capabilities are usually paired with it: using a logging service to retain complete request and response records for token consumption attribution; using monitoring and alerting to set thresholds on average token cost per task and trigger alerts on abnormal increases; using object storage to archive evaluation sets and baseline data for long-term regression; and using a container platform to deploy self-service evaluation environments uniformly, so different teams can compare results under the same baseline.
If you use the relevant foundational capabilities of Baidu AI Cloud, you can combine these steps into an observable cost-governance chain: the logging service handles data retention and retrieval, monitoring and alerting handle anomaly detection, and object storage holds evaluation assets. This upgrades output compression from a “personal habit” to an engineering standard that is measurable, regression-testable, and auditable.
8. Conclusion
The value of output-compression approaches is real but limited. They act on visible output tokens, change expression strategy through behavior-layer instructions, and deliver meaningful gains in scenarios like concept explanations, syntax questions, and simple diagnostics. But they do not affect hidden reasoning tokens, and their own loading has a cost, so claims of “75% end-to-end reduction” do not hold up in engineering terms. A more rigorous statement is: in long sessions, multi-turn iteration, and scenarios dominated by natural-language explanation, visible output tokens can be reduced by about one third to two thirds, while the drop in the total bill is significantly lower than that ratio.
The practical advice for developers can be condensed into three points. First, use the layered model to break down token composition and determine whether the bottleneck is output or reasoning. Second, use your own evaluation set to measure the median rather than the average, and factor follow-up rounds into the gain calculation. Third, enable compression levels by scenario, and put error handling and safety warnings in the non-compressible zone. Do these three things, and output compression can genuinely improve both cost and experience, instead of trading “can’t finish reading” for “can’t understand.”
