This is the page leanprompt report --html writes for the dated-chat example, after the fix, on the leanprompt site. Back to the dated-chat example

leanprompt audit of dated-chat (after/)

No open findings

1 finding, fixed. Nothing open remains in this app's code.

What's wrong and what to change

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

No confirmed findings.

1 fixed finding

The system prompt starts with the current time to the second.

Finding 1. after/app.ts:11 high LP-PC-03 fixed

Every call therefore begins with a different line, so a provider that caches by prefix can reuse nothing, and the roughly 6,000-token handbook after it is read again on every call.

What to change
Take the time out of the system prompt and put it in a labelled <environment> block at the top of the newest user message, as LP-PC-03 recommends. The system prompt is then the same on every call.
Why it matters
A prefix cache matches from the first token and stops at the first difference. With nothing changing at the top, the handbook can be served from the cache on every call after the first.
Estimate
about 6.7 million prompt tokens per 1,000 calls that the cache could have served
What the estimate assumes

An average call of about 6,800 prompt tokens (the handbook, the instructions and a short question) and 60 output tokens; every call after the first in a cache lifetime could reuse all but the newest message.

How to check the fix Send two requests a few seconds apart and compare the provider's cached prompt tokens: near zero before, close to the handbook's size after.

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.

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).

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

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.