The page leanprompt report --html writes for hystax/optscale-kompressor at commit afcd4de, audited 2026-11-27. Every figure on this page is an estimate from reading the code, not a measurement of the app in use. Corrections and takedown: email info@podwarden.com or open an issue. Back to the audit of hystax/optscale-kompressor

leanprompt audit of hystax/optscale-kompressor

Unattended audit: nobody was asked during the run, so priority, volume and prices were left open; the questions for the owner are listed at the end.

1 place where this app pays for tokens it doesn't need

The biggest, at crates/kompressor-proxy/src/handler.rs:555, about 900k tokens per 1,000 calls: the proxy arms a keep-warm ping for any Anthropic request that stops on tool_use, whether or not the request carries a cache_control mark.

Together about 900k tokens per 1,000 calls An estimate from the code, not a measurement.

Tokens per 1,000 calls, by finding, and each one's share of the total

Plus 1 other problem the audit found, listed after the findings. Not scored.

This project is a gateway or proxy. 0 items are about the gateway's own calls, 1 item about what it does to its clients' calls; each card says which.

What this costs you

Every figure here is an estimate from the code, not a measurement. Findings can overlap (one failed call can show up in two), so the sum may count some tokens twice. Money is not part of the score. The table lists this app's findings first, largest first, then its open questions, then the questions for the server's administrator, then the findings the project already knows about, which are not in the totals.

FindingWhereTokens per 1,000 calls
LP-PC-11 (clients' calls through the gateway)crates/kompressor-proxy/src/handler.rs:555900k prompt

To see this in money, add to leanprompt.yaml:

  • volume: {calls_per_month: N}: how many calls the app makes a month (with targets:, on each entry)
  • prices: per model: input, cached_input and output per 1M tokens (US dollars, or set currency), with source and checked date (or, self-hosted, engine: {prefill_tokens_per_second: N})

leanprompt never guesses a volume or a price. Your coding agent can look up the provider's current price page and add it with the date; how.

What's wrong and what to change

1 open, 0 fixed. Largest first, by the audit's estimate of tokens lost per 1,000 calls.

The proxy arms a keep-warm ping for any Anthropic request that stops on tool_use, whether or not the request carries a cache_control mark.

Finding 1. crates/kompressor-proxy/src/handler.rs:555 low LP-PC-11 how often is assumed clients' calls through the gateway

A request with no mark leaves nothing in the provider's cache, so the ping, which re-sends the whole prompt, is billed at the full input price and finds nothing to read.

What to change
Arm keep-warm only when the body that was sent carries a cache_control mark (top-level, system, tools or messages, nested tool_result content included).
Why it matters
Each such ping is one full-price read of the whole prompt, on a pause that already passed 270 seconds. It is the same cost the module comment says the feature exists to avoid, and it repeats on every later long tool wait because the next tool_use response arms a new timer.
How often it happens
The code shows the problem; how often it happens is assumed. To measure it: how many Anthropic /v1/messages clients behind the proxy send no cache_control anywhere, and how often their tool waits pass 270 seconds (the proxy's own stats rows with keep_warm = 1 and cache_read_tokens = 0 count them)
Who reaches this
only clients that send /v1/messages requests with no cache_control
Estimate
about 900k prompt tokens per 1,000 calls, only for clients that send no cache_control
What the estimate assumes

60,000-token prompt; half of the calls stop on tool_use; 3% of those waits pass 270 seconds; every affected call comes from an unmarked client. All three rates are assumptions.

How to check the fix Send a /v1/messages tool_use turn with no cache_control through the proxy, wait 270 seconds, and check that no keep_warm = 1 row appears; with a marked request the ping still goes out and reads cached tokens.

Other problems the audit found

Problems the audit checked in the code that cost no tokens of their own, such as a spend meter that ignores cache tokens or a cut-off answer accepted as complete. They are not scored. Check each one before you change anything.

CLAUDE-CODE.md says keep-warm is both on and off by default

Note 1. docs/CLAUDE-CODE.md:631 not scored

Line 615 says keep-warm is on by default and that cache_keep_warm = false turns it off. Line 631 of the same paragraph says "It is off because it is the one thing the proxy does that no client asked for", and the example that follows exports CACHE_KEEP_WARM=true as the way to enable it. The code default is true (crates/kompressor-core/src/config.rs:1443).

What to change
Drop the sentence at line 631 and the enabling example, or turn the example into the cache_keep_warm = false opt-out that README.md:435 shows.

How to check the fix Read lines 615 to 637 together; the paragraph states one default.

Fix it with your coding agent

Paste this into Claude Code, Codex, Cursor or any coding assistant. It will check each finding against your code and propose fixes one at a time, asking before it changes anything.

Please check and fix the LLM-call findings from a leanprompt audit of this repository.

1. If the leanprompt skills are not installed for you here, install them: npx leanprompt@0.1.0-dev.15 install
2. Read .leanprompt/findings.json and leanprompt-report.md. If they are missing, use the list below.
3. Check each finding against the code before you change anything. The audit can be wrong: if a finding does not hold, tell me why and leave that code alone.
4. Fix one finding at a time. Show me the change as a small diff and apply it only after I say yes.
5. Prove each fix with the measure-loop skill: a before and after on the same scenario. Ask me before running anything that sends real, billed requests.
6. When a fix is proved, set "fixed": true on its finding in .leanprompt/findings.json and run npx leanprompt@0.1.0-dev.15 score.

Findings, largest first:
1. LP-PC-11 at crates/kompressor-proxy/src/handler.rs:555 [clients' calls through the gateway]: The proxy arms a keep-warm ping for any Anthropic request that stops on tool_use, whether or not the request carries a cache_control mark. A request with no mark leaves nothing in the provider's cache, so the ping, which re-sends the whole prompt, is billed at the full input price and finds nothing to read.

Other problems found (check each against the code first; not scored):
- CLAUDE-CODE.md says keep-warm is both on and off by default (docs/CLAUDE-CODE.md:631): Line 615 says keep-warm is on by default and that cache_keep_warm = false turns it off. Line 631 of the same paragraph says "It is off because it is the one thing the proxy does that no client asked for", and the example that follows exports CACHE_KEEP_WARM=true as the way to enable it. The code default is true (crates/kompressor-core/src/config.rs:1443). Change: Drop the sentence at line 631 and the enabling example, or turn the example into the cache_keep_warm = false opt-out that README.md:435 shows.

Score

One number from 0 to 100 for how well this app avoids paying for the same tokens twice; higher is better. It is computed from the findings above (static) or from your usage log (measured).

99static
E, prefill reuse
0.98
S, prefix stability
1.00
G, generation waste
0.00
Default shares
0 of 1

Findings scored with severity defaults, not estimates. The fewer, the more the static score says about this app.

A static score is an estimate from the audit's findings, not a measurement.

Scored 2026-11-27 (the date on the machine that ran it).

Questions for the owner

These were not answered during the audit. Until they are, the page shows tokens only and ranks the advice without a priority.

  • Priority: which matters most for this app, cost, speed or quality (or weights)? Not set, so the advice uses equal weights. Answer with priority: in leanprompt.yaml.
  • Volume: how many calls does the app make a month? Answer with volume: {calls_per_month: N, source: "..."} in leanprompt.yaml.
  • Prices: what does each model cost (input, cached input, output per 1M tokens, with the source and the date it was read, and the currency if not US dollars)? Answer with prices: in leanprompt.yaml.