The page leanprompt report --html writes for Nutlope/aicommits at commit 98e9c4e, 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 Nutlope/aicommits

leanprompt audit of Nutlope/aicommits

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.

4 places where this app pays for tokens it doesn't need

The biggest, at src/commands/aicommits.ts:147, about 80k tokens per 1,000 calls: with generate set to 2 to 5, the CLI starts that many complete, identical generations at the same moment (Promise.all at aicommits.ts:147-161), so none of them can read the prompt prefix the others are writing to the provider's cache.

Together about 193k 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 2 findings 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 3 other problems 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-GE-01src/commands/aicommits.ts:14780k not cached
LP-GE-02src/commands/pr.ts:17976k prompt
LP-GE-05src/commands/aicommits.ts:18320k prompt, 900 output
LP-PC-01src/feature/generate-commit-message.ts:91317k not cached; the fix writes 17k to the cache at the write price
LP-GE-05 (already reported)src/feature/generate-commit-message.ts:72280k prompt, 41k output
LP-GE-04 (declined by the project)src/feature/providers/base.ts:238113k prompt, 2.3k output

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

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

With generate set to 2 to 5, the CLI starts that many complete, identical generations at the same moment (Promise.all at aicommits.ts:147-161), so none of them can read the prompt prefix the others are writing to the provider's cache.

Finding 1. src/commands/aicommits.ts:147 low LP-GE-01 how often is assumed

What to change
Start the first generation, and start the others once its first model request has returned, so the shared system prompt and diff are served from the automatic cache; the models used here have no usable n parameter.
Why it matters
Each copy prefills the same instructions and diff at the uncached price.
How often it happens
The code shows the problem; how often it happens is assumed. To measure it: how many users set generate above 1
Estimate
about 80k prompt tokens per 1,000 calls not served from cache (estimate)
What the estimate assumes

2% of calls are extra copies from generate above 1 (default is 1, config-types.ts:101-110), about 4,000 prompt tokens each, on providers with automatic caching (OpenAI and most OpenAI-compatible hosts); trades a little latency for the saving.

How to check the fix With generate=3 on OpenAI, cached_tokens on the second and third first-step requests rises from 0 to about the prompt size.

aicommits pr sends the same branch diff (up to 30,000 characters) twice, once to ask for a title (pr.ts:179) and once for a body (pr.ts:189).

Finding 2. src/commands/pr.ts:179 medium LP-GE-02 how often is assumed

The two calls start with different system prompts, so even an automatic prefix cache cannot reuse the diff on the second call.

What to change
Ask for the title and the body in one call with a two-field structured output (the agent SDK path already uses JSON schemas, see agent-sdk.ts), or at least keep one identical system prompt and put the question after the diff.
Why it matters
Each run prefills the diff twice at full price; the diff is about 7,500 tokens at the 30,000-character cap.
How often it happens
The code shows the problem; how often it happens is assumed. To measure it: how many runs are aicommits pr (a beta command) rather than commit message runs
Estimate
about 76k prompt tokens per 1,000 calls (estimate)
What the estimate assumes

pr runs are 2% of calls (10 runs, 20 calls per 1,000), each with a diff near the 30,000-character cap; the answer check (title under 72 characters, body with the three headings) must pass before keeping one call.

How to check the fix Run aicommits pr on a branch with a large diff: before, the provider log shows two requests each carrying the diff; after, one request with the diff once and both fields filled.

When a generation fails for any reason, the CLI re-runs the whole generation with the provider's fallback model (aicommits.ts:176-202; the Git hook does the same at prepare-commit-msg-hook.ts:90-97).

Finding 3. src/commands/aicommits.ts:183 medium LP-GE-05 how often is assumed

That includes errors a new model cannot fix: 'Claude is not logged in', 'Claude plan limit reached' (claude-agent.ts:84-95) and the shared deadline timing out, where the second run redoes every chunk call with a larger model and a fresh deadline.

What to change
Fall back to another model only for model errors (isModelUnavailableError, or the model producing no usable message); rethrow login, plan-limit and timeout errors directly.
Why it matters
A re-run after a timeout pays for all the chunk calls again; a re-run after a login or plan error only delays the error.
How often it happens
The code shows the problem; how often it happens is assumed. To measure it: how many runs print 'Model ... failed. Retrying with ...' after a timeout, a login error or a plan-limit error
Estimate
about 20k prompt tokens per 1,000 calls (estimate)
What the estimate assumes

applies to Together AI, Claude Agent, Codex and OpenCode Go, which define fallbackModel; 0.5% of calls are part of a re-run after a timeout, about 4,000 prompt tokens each; login and plan errors cost no tokens.

How to check the fix With claude-agent logged out, aicommits prints the login error once and does not print 'Retrying with "sonnet"'.

The agentic loop on the Anthropic API sends no cache mark, so on a large diff the second step resends the tools, the instructions and the changed-file tree (about 3,300 tokens) uncached.

Finding 4. src/feature/generate-commit-message.ts:913 low LP-PC-01 how often is assumed

What to change
Add an Anthropic cache mark on the first user message through providerOptions.anthropic.cacheControl when the provider is anthropic.
Why it matters
Sonnet 5.5 caches prefixes from 512 tokens and the second step comes seconds after the first, so the mark pays back within one run.
How often it happens
The code shows the problem; how often it happens is assumed. To measure it: share of runs on the Anthropic API with a Sonnet model and a diff large enough for a second agent step
Estimate
about 16k prompt tokens per 1,000 calls not served from cache (estimate)
What the estimate assumes

Anthropic API is 5% of calls, half of them on Sonnet (the default claude-haiku-4-5 needs 4,096 tokens, more than this prefix), and 20% of those are the second step of a large-diff run.

How to check the fix On a large diff with claude-sonnet-5-5, the second step reports cache_read_input_tokens of about 3,300.

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.

The one-shot path retries up to three times when the answer is empty, ends in an ellipsis or lacks a body (generate-commit-message.ts:652-737), but never reads result.finishReason.

Finding 5. src/feature/generate-commit-message.ts:722 high LP-GE-05 how often is assumed

An answer cut off at the 2,048-token limit, typically a reasoning model that spent the budget thinking, is sent again with the same limit twice more. The agentic path re-runs the whole agent once when nothing was submitted (lines 985-1001).

What to change
After generateText, if result.finishReason is 'length', do not retry unchanged: retry once with a larger maxOutputTokens (or lower reasoning), or fail with a message that names the max-output-tokens setting.
Why it matters
Each unchanged retry pays for the prompt again and usually stops at the same limit, so a cut-off run costs three full generations and still fails.
How often it happens
The code shows the problem; how often it happens is assumed. To measure it: how often finishReason is 'length' on the one-shot call (Groq gpt-oss, OpenCode Go, custom reasoning models), from the provider logs or by logging result.finishReason
Already reported
PR #367 (merged) saw finish_reason length on Gemini 2.5 Flash and raised the limit from 512 to 2,048 tokens; PR #368 (landed on develop, adapted) made max-output-tokens configurable. Neither reads finishReason, so a cut-off answer is still retried unchanged. https://github.com/Nutlope/aicommits/pull/367
Estimate
about 41k output and 80k prompt tokens per 1,000 calls (estimate)
What the estimate assumes

1% of one-shot calls end at the output limit, each retried twice with about 4,000 prompt tokens; the retry on an empty answer after a normal stop (tested at tests/specs/generate-commit-message.ts:912) is fine and stays.

How to check the fix With a mock model that returns finishReason 'length' and empty text, the one-shot path makes one call (or one call plus one with a larger limit) instead of three.

Declined by the project

  • Hosted providers without their own default (OpenAI, Anthropic, Groq, xAI, OpenRouter, remote custom) get 10 seconds, and generate-commit-message.ts:146-169 uses that as one deadline for the whole generation, not per request. src/feature/providers/base.ts:238 https://github.com/Nutlope/aicommits/pull/351

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 retried unchanged, and a cut-off body is committed as complete

Note 1. src/feature/generate-commit-message.ts:725 LP-GE-12 medium not scored

runOneShot never reads result.finishReason. An answer that stopped at the 2,048-token limit is sent again with the same limit up to two more times when it is empty, and then fails with 'The model did not generate a commit message'. When it has a subject and part of a body, parseOneShotMessage accepts it, so a description cut off mid-sentence is committed as if whole.

What to change
After generateText, treat finishReason 'length' as its own case: do not parse the partial text and do not retry with the same options; retry once with a larger maxOutputTokens, or fail with a message that names the max-output-tokens setting.
Why it matters
A reasoning model that spent the budget thinking usually stops at the same place on every unchanged retry.
Same problem as
finding 5

How to check the fix A MockLanguageModelV4 returning finishReason 'length' with empty text makes one call (or two with a larger limit) instead of three; one returning a subject, a partial body and finishReason 'length' is not returned as a commit message.

Claude Agent token usage leaves out cache reads and writes

Note 2. src/feature/subscriptions/claude-agent.ts:105 LP-GE-11 low not scored

The usage record copies result.usage.input_tokens only. On Anthropic that field counts only the tokens after the last cache breakpoint, so cache_read_input_tokens and cache_creation_input_tokens are dropped. Nothing displays usage today, but open PR #382 adds a token-usage line in interactive mode that reads this field.

What to change
Add cache_read_input_tokens and cache_creation_input_tokens to inputTokens (or carry them in inputTokenDetails) before usage is shown.

How to check the fix For one Claude Agent run, the shown input total equals input_tokens plus both cache fields in the SDK result message.

The README says the timeout is per network request; it covers the whole generation

Note 3. README.md:405 LP-GE-15 high not scored

README.md says timeout is 'the timeout for network requests'. Since PR #351 it is one deadline for the whole generation (generate-commit-message.ts:146-169), shared by every chunk call and the combine call of a large diff, and the hosted providers other than Together AI keep 10 seconds for all of it.

What to change
Say in the README that the timeout covers the whole generation, and suggest a larger value for large diffs on hosted providers.

How to check the fix The README's timeout section matches createGenerationBudget.

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-GE-01 at src/commands/aicommits.ts:147: With generate set to 2 to 5, the CLI starts that many complete, identical generations at the same moment (Promise.all at aicommits.ts:147-161), so none of them can read the prompt prefix the others are writing to the provider's cache.
2. LP-GE-02 at src/commands/pr.ts:179: aicommits pr sends the same branch diff (up to 30,000 characters) twice, once to ask for a title (pr.ts:179) and once for a body (pr.ts:189). The two calls start with different system prompts, so even an automatic prefix cache cannot reuse the diff on the second call.
3. LP-GE-05 at src/commands/aicommits.ts:183: When a generation fails for any reason, the CLI re-runs the whole generation with the provider's fallback model (aicommits.ts:176-202; the Git hook does the same at prepare-commit-msg-hook.ts:90-97). That includes errors a new model cannot fix: 'Claude is not logged in', 'Claude plan limit reached' (claude-agent.ts:84-95) and the shared deadline timing out, where the second run redoes every chunk call with a larger model and a fresh deadline.
4. LP-PC-01 at src/feature/generate-commit-message.ts:913: The agentic loop on the Anthropic API sends no cache mark, so on a large diff the second step resends the tools, the instructions and the changed-file tree (about 3,300 tokens) uncached.

Already known to the project (read the link first; do not duplicate work the project has planned or started):
- LP-GE-05 (src/feature/generate-commit-message.ts:722): The one-shot path retries up to three times when the answer is empty, ends in an ellipsis or lacks a body (generate-commit-message.ts:652-737), but never reads result.finishReason. An answer cut off at the 2,048-token limit, typically a reasoning model that spent the budget thinking, is sent again with the same limit twice more. The agentic path re-runs the whole agent once when nothing was submitted (lines 985-1001). Already reported: PR #367 (merged) saw finish_reason length on Gemini 2.5 Flash and raised the limit from 512 to 2,048 tokens; PR #368 (landed on develop, adapted) made max-output-tokens configurable. Neither reads finishReason, so a cut-off answer is still retried unchanged. https://github.com/Nutlope/aicommits/pull/367

Other problems found (check each against the code first; not scored):
- A cut-off answer is retried unchanged, and a cut-off body is committed as complete (src/feature/generate-commit-message.ts:725) [LP-GE-12]: runOneShot never reads result.finishReason. An answer that stopped at the 2,048-token limit is sent again with the same limit up to two more times when it is empty, and then fails with 'The model did not generate a commit message'. When it has a subject and part of a body, parseOneShotMessage accepts it, so a description cut off mid-sentence is committed as if whole. Change: After generateText, treat finishReason 'length' as its own case: do not parse the partial text and do not retry with the same options; retry once with a larger maxOutputTokens, or fail with a message that names the max-output-tokens setting.
- Claude Agent token usage leaves out cache reads and writes (src/feature/subscriptions/claude-agent.ts:105) [LP-GE-11]: The usage record copies result.usage.input_tokens only. On Anthropic that field counts only the tokens after the last cache breakpoint, so cache_read_input_tokens and cache_creation_input_tokens are dropped. Nothing displays usage today, but open PR #382 adds a token-usage line in interactive mode that reads this field. Change: Add cache_read_input_tokens and cache_creation_input_tokens to inputTokens (or carry them in inputTokenDetails) before usage is shown.
- The README says the timeout is per network request; it covers the whole generation (README.md:405) [LP-GE-15]: README.md says timeout is 'the timeout for network requests'. Since PR #351 it is one deadline for the whole generation (generate-commit-message.ts:146-169), shared by every chunk call and the combine call of a large diff, and the hosted providers other than Together AI keep 10 seconds for all of it. Change: Say in the README that the timeout covers the whole generation, and suggest a larger value for large diffs on hosted providers.

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

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

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

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

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.