A timestamp at the top of the prompt means no call can reuse the cache

leanprompt's own example chat app, which keeps its whole handbook in one system prompt.
≈ 6,700,000 tokens per 1,000 calls, for a handbook the cache could have served estimate
Audited with leanprompt 0.1.0-dev.12
Estimates, not measurements. Every figure on this page is an estimate from reading the code, not a measurement of the app in use.
- Repository
- Podwarden/leanprompt
- Commit audited
67e1586- leanprompt version
- 0.1.0-dev.12
- Audit date
- Status
- Demonstration: an audit of leanprompt’s own example app.
A demonstration on leanprompt's own example app. The before form starts its system prompt with the current time, so no call can reuse the handbook that follows it.
leanprompt read examples/dated-chat/before/ in the code at commit 67e1586 and found 1 place where its LLM calls could use fewer tokens. Static score: 46 of 100 (an estimate from the findings). The code may have changed since.
Findings
-
LP-PC-03No ids, timestamps, versions or paths at the top of the promptexamples/dated-chat/before/app.ts:11· severity high · saves prefillWhat happens. The system prompt starts with the current time to the second. 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.
The 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 helps. 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
Assumptions. 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.
The maintainers’ response
No response from the maintainers yet.
How this was made
The llm-call-audit skill read the code and wrote findings.json; nothing was run against the project’s providers. The full audit page is what leanprompt report --html writes from the same findings.
Corrections and takedown: email info@podwarden.com or open an issue.