The page leanprompt report --html writes for catalation/synapse-ceo at commit 03bbd01, 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 catalation/synapse-ceo

leanprompt audit of catalation/synapse-ceo

No open findings

5 findings, fixed. Nothing open remains in this app's code.

Plus 1 question for the server's administrator, listed after the findings. They are about the server's settings, not this app's code, so they are not in this app's score.

Plus 1 finding the project already knows about (planned, in progress, reported or declined), listed after the findings. They are not in the totals or the score.

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

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-PD-01 (already planned)src/synapse_ceo/tools/surface.py:1301.1M 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

0 open, 1 for the server's administrator, 1 already known to the project, 5 fixed. Largest first, by the audit's estimate of tokens lost per 1,000 calls.

No confirmed findings.

Questions for the server's administrator

These are about the server or engine the app calls (its launch settings, its cache, its replicas), not this app's code, so they are not in this app's score; npx leanprompt score --with-server counts them. Each says what would answer it. For an LM Warden server, npx leanprompt profile detect --lmwarden <url> reads the engine's cache facts (block size, match unit, speculative decoding) into leanprompt.yaml.

Is prefix caching on for the local Qwen engine behind Warden, and with what block size?

Finding 1. LM Warden and the llama.cpp/vLLM engine behind LOCAL_BASE_URL low LP-LW-01 unconfirmed

The head this service sends (system prompt and tools) is several thousand tokens, so a block-mode engine reuses it only if caching is on.

What would answer it
whether prefix caching is on in the engine behind Warden and its block or match size (npx leanprompt profile detect --lmwarden reads it)
Change, if confirmed
Turn on prefix caching on the engine; for a hybrid model with speculative decoding, set the prefix match unit.
Why it matters
Without it every local call computes the whole prompt again.
Estimate
small for this app: the local model serves only model-hint turns and classifier fallback (estimate)
What the estimate assumes

the worker tier is configured but not used by the turn loop, so local traffic is a small share

How to check the fix On two consecutive local calls of one session, the engine reports cached prompt tokens close to the shared head.

Already known to the project

The project's own issues, pull requests or docs already cover these, so they are not new and are not in the totals or the score. Read the link before working on one.

Every call is offered all 33 tools, write tools included on read-only turns.

Finding 2. src/synapse_ceo/tools/surface.py:130 low LP-PD-01

The project plans to narrow this once it has failure data.

What to change
When narrowing, keep two fixed tool lists (read and write) so each stays cacheable, rather than a list chosen per turn.
Why it matters
Write tool definitions are sent on turns that cannot use them; switching lists per turn would cost cache, so the gain is mostly in cached-read tokens.
Already planned
Open in the project's own (private) tracker: narrow the tool surface using measured failures (progressive mode, M6). https://gitlab.com/catalation/synapse-ceo/-/issues/14
Estimate
about 1.15M prompt tokens per 1,000 calls, mostly cached reads (estimate)
What the estimate assumes

half of turns are read-only; the write tools are about 2,300 tokens of the roughly 5,000-token tool list

How to check the fix prompt_tokens on read-only turns fall by the write tools' size, and cached_tokens stays high across turns.

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.

A cut-off answer is shown and stored as complete

Note 1. src/synapse_ceo/loop/agent.py:303 LP-GE-12 medium not scored

The stream reader records finish_reason, but the loop never reads it: an answer that stopped at the output limit (finish_reason length) is streamed to the founder, appended to the history and treated as the turn's answer. Tool-call arguments cut off the same way are only caught by argument validation.

What to change
After each call, check response.finish_reason; on length, tell the founder the answer was cut off (an error or status event) and mark the stored message, or retry once with a larger cap.
Same problem as
finding 7

How to check the fix A test with a stub stream ending in finish_reason length produces a truncation event and no plain completed answer.

5 fixed findings

Once a conversation passes 60 messages, every save drops the oldest messages so it is exactly 60 again.

Finding 3. src/synapse_ceo/storage/sessions.py:71 high LP-PC-06 fixed how often is assumed

The start of the history then moves on every turn, so the provider can reuse nothing after the company context: the whole remaining history is computed again on the first call of each later turn.

What to change
Trim in steps instead of on every save: when the history passes 60 messages, cut it back to about 40 (keeping the tool-call boundary rule), so the history stays append-only for the next ten or so turns and the cache breaks once per step, not every turn. Later, a summary message at the cut (cache-aware compaction) keeps what the dropped turns said.
Why it matters
A sliding window rewrites the front of the history on every turn, and a prefix cache only reuses an unchanged front. Long conversations, the ones with the most history, pay full price for all of it on every turn.
How often it happens
The code shows the problem; how often it happens is assumed. To measure it: how many turns run in sessions past 60 messages, and cached_tokens on the first round of those turns, from the turn_end account in the logs
Estimate
about 2.0M prompt tokens per 1,000 calls not served from cache (estimate)
What the estimate assumes

about 7 messages per turn, so the cap is reached after 8 to 9 turns; 30% of turns are in sessions past the cap; about 20,000 history tokens at the cap; only the first call of each turn is affected (later rounds append); about 3 calls per turn; the provider's cache outlives the pause between turns

How to check the fix In a session past 60 messages, the first call of two consecutive turns: cached_tokens on the second covers the system prompt, tools, context and the history up to the previous turn, instead of stopping after the context message.

Every tool result goes into the conversation history whole and stays there for every later call of the session.

Finding 4. src/synapse_ceo/loop/agent.py:687 medium LP-PD-04 fixed size is assumed

Only the copy sent to the founder's screen is cut to 4,000 characters; the model gets the full text, including raw payloads from connected systems through mcpu__invoke.

What to change
Cut each tool result once, when it is added to the history (agent.py, _tool_message): keep the fields the model uses, cap the length (for example 8,000 characters with a note saying it was cut and how to ask for more), and never change it afterwards.
Why it matters
A large result is paid for on every later call until it falls out of the 60-message window, mostly as cached reads, and it brings the per-turn token cap and the history trim closer.
How big it is
The code shows the problem and how often it happens; how many tokens it costs each time is assumed. To measure it: the size distribution of tool results, from the tool-call log's result_excerpt per tool (task_list, knowledge_read, mcpu__invoke)
Estimate
about 1.2M prompt tokens per 1,000 calls that need not be sent (estimate)
What the estimate assumes

an average call carries 2 tool results that could each lose about 600 tokens; most of these tokens are cached reads, so the money saved is smaller than the token count

How to check the fix Replay one tool-heavy session: prompt_tokens on its later calls fall by about the trimmed size, and the eval cases in evals/ still pass.

GLM always thinks, but the stream reader keeps only content and tool calls, so the assistant message stored after a tool call has no reasoning.

Finding 5. src/synapse_ceo/loop/agent.py:466 medium LP-PC-09 fixed unconfirmed

If the provider's template keeps the reasoning of the current turn's tool rounds, the next round's prompt differs from what it cached at that assistant message.

What to change
Read reasoning_content from the stream and store it on the assistant message that carries tool calls, sending it back on the next rounds of the same turn, as Z.ai's thinking docs describe; keep thinking settings the same within a session.
Why it matters
Everything after the first changed byte is computed again; dropping reasoning between tool rounds also makes the model think again about what it had already worked out.
Estimate
about 1.0M prompt tokens per 1,000 calls not served from cache, if the template keeps reasoning (estimate)
What the estimate assumes

two thirds of calls are follow-up rounds of a tool turn; about 1,500 tokens recomputed on each from the last assistant message onwards

How to check the fix On round 2 of a tool turn, cached_tokens reaches the end of round 1's assistant message; the evals in evals/ still pass.

On the last round after a held write, a queued proposal or a pending approval, the loop sends the request with no tools at all.

Finding 6. src/synapse_ceo/loop/agent.py:275 medium LP-PC-05 fixed how often is assumed

GLM's chat template puts the tool list in the system block at the very top, so that request shares no prefix with the round before it and is computed again from the first token.

What to change
Keep the same tool list on the terminal round and stop tool use another way: send tool_choice "none" if Z.ai accepts it, otherwise keep the tools and the closing instruction and ignore any tool call the model makes on that round, as the loop already does.
Why it matters
Removing the tools changes the start of the prompt, which throws away the cache for the whole prompt on that call, history included.
How often it happens
The code shows the problem; how often it happens is assumed. To measure it: how many turns end in a held preview, a queued proposal or a pending approval, and cached_tokens on their final round, from the turn logs
Estimate
about 530k prompt tokens per 1,000 calls not served from cache (estimate)
What the estimate assumes

10% of turns end in a terminal round; the prompt is about 16,000 tokens at that point; the provider renders tools at the top of the prompt (true for GLM and Qwen chat templates)

How to check the fix On a turn that ends with a held write, cached_tokens on the final round rises from near 0 to about the previous round's prompt size.

The agent loop's calls send no max_tokens, to a model that always thinks.

Finding 7. src/synapse_ceo/loop/agent.py:283 medium LP-GE-03 fixed size is assumed

A runaway answer or a long thinking loop runs to the provider's own maximum before anything stops it; the 150,000-token turn cap is only checked after the call returns.

What to change
Send a per-call max_tokens on the agent loop (a setting, for example 8,000 to 16,000, sized from the measured largest answers plus thinking), the same way the classifier already sends one.
Why it matters
Output is the most expensive token, and with no cap a single bad call can spend more than a whole normal turn.
How big it is
The code shows the problem and how often it happens; how many tokens it costs each time is assumed. To measure it: the largest completion_tokens per call and how often a call ends with finish_reason length, from the turn_end logs
Estimate
about 12k output tokens per 1,000 calls (estimate)
What the estimate assumes

about 400 output tokens per call on average; runaway calls are rare and make up about 3% of output

How to check the fix No call's completion_tokens exceeds the cap, and no ordinary answer ends with finish_reason length.

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.

Already known to the project (read the link first; do not duplicate work the project has planned or started):
- LP-PD-01 (src/synapse_ceo/tools/surface.py:130): Every call is offered all 33 tools, write tools included on read-only turns. The project plans to narrow this once it has failure data. Already planned: Open in the project's own (private) tracker: narrow the tool surface using measured failures (progressive mode, M6). https://gitlab.com/catalation/synapse-ceo/-/issues/14

Questions for the server's administrator (not this app's code; do not change the app for these):
- LP-LW-01 (LM Warden and the llama.cpp/vLLM engine behind LOCAL_BASE_URL): Is prefix caching on for the local Qwen engine behind Warden, and with what block size? The head this service sends (system prompt and tools) is several thousand tokens, so a block-mode engine reuses it only if caching is on. What would answer it: whether prefix caching is on in the engine behind Warden and its block or match size (npx leanprompt profile detect --lmwarden reads it)

Other problems found (check each against the code first; not scored):
- A cut-off answer is shown and stored as complete (src/synapse_ceo/loop/agent.py:303) [LP-GE-12]: The stream reader records finish_reason, but the loop never reads it: an answer that stopped at the output limit (finish_reason length) is streamed to the founder, appended to the history and treated as the turn's answer. Tool-call arguments cut off the same way are only caught by argument validation. Change: After each call, check response.finish_reason; on length, tell the founder the answer was cut off (an error or status event) and mark the stored message, or retry once with a larger cap.

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.

It leaves out 1 finding the project already knows about (planned, in progress, declined or reported); with them it would be 95.

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.