The page leanprompt report --html writes for JoshuaC215/agent-service-toolkit at commit 3d77131, audited 2026-11-28. 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 JoshuaC215/agent-service-toolkit

leanprompt audit of JoshuaC215/agent-service-toolkit

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.

The audit found no place where this app pays for tokens it doesn't need

Plus 2 other problems the audit found, listed after the findings. Not scored.

What's wrong and what to change

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

No confirmed findings.

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.

Bedrock replies stop at 1,024 tokens; a cut-off reply is passed on as complete

Note 1. src/core/llm.py:120 LP-GE-12 high not scored

ChatBedrock(model=...) sets no max_tokens. In the locked langchain-aws 1.9.0 an Anthropic model on ChatBedrock uses InvokeModel, whose adapter sends max_tokens=1024 when none is given (llms/bedrock.py:389-392); the Anthropic branch at llm.py:110 gets the model's own limit (128000 for claude-haiku-5-5 in langchain-anthropic 1.7.6). Checked offline with a stub client: invoke and stream both send 1024. Nothing in src/ reads stop_reason, so a cut-off answer is saved as finished.

What to change
Pass an explicit limit in the AWS branch (for example ChatBedrock(model=..., max_tokens=<limit the maintainers choose>)) and surface a stop_reason of max_tokens (response_metadata) to the client instead of treating the message as complete.

How to check the fix Build get_model(AWSModelName.BEDROCK_HAIKU) with a stub boto client that records the InvokeModel body: max_tokens is 1024 today and the chosen limit after the change.

The current date in three system prompts is fixed at server start

Note 2. src/agents/research_assistant.py:39 not scored

current_date is evaluated once at import (research_assistant.py:39, rag_assistant.py:33, github_mcp_agent.py:17) and baked into a module-level f-string that wrap_model reuses for every request (research_assistant.py:54-60). The service is a long-running process, so after the first midnight the default agent states the wrong day. docs/RAG_Assistant.md:40-42 teaches the same pattern.

What to change
Build the date inside the preprocessor lambda (or a small function called from it) so each request gets the current date; the day-level string keeps the prompt prefix stable within a day.

How to check the fix Freeze time at 2026-11-01 during import, move it to 2026-11-03, call the preprocessor: the system message says November 01 today and November 03 after the change.

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.

Other problems found (check each against the code first; not scored):
- Bedrock replies stop at 1,024 tokens; a cut-off reply is passed on as complete (src/core/llm.py:120) [LP-GE-12]: ChatBedrock(model=...) sets no max_tokens. In the locked langchain-aws 1.9.0 an Anthropic model on ChatBedrock uses InvokeModel, whose adapter sends max_tokens=1024 when none is given (llms/bedrock.py:389-392); the Anthropic branch at llm.py:110 gets the model's own limit (128000 for claude-haiku-5-5 in langchain-anthropic 1.7.6). Checked offline with a stub client: invoke and stream both send 1024. Nothing in src/ reads stop_reason, so a cut-off answer is saved as finished. Change: Pass an explicit limit in the AWS branch (for example ChatBedrock(model=..., max_tokens=<limit the maintainers choose>)) and surface a stop_reason of max_tokens (response_metadata) to the client instead of treating the message as complete.
- The current date in three system prompts is fixed at server start (src/agents/research_assistant.py:39): current_date is evaluated once at import (research_assistant.py:39, rag_assistant.py:33, github_mcp_agent.py:17) and baked into a module-level f-string that wrap_model reuses for every request (research_assistant.py:54-60). The service is a long-running process, so after the first midnight the default agent states the wrong day. docs/RAG_Assistant.md:40-42 teaches the same pattern. Change: Build the date inside the preprocessor lambda (or a small function called from it) so each request gets the current date; the day-level string keeps the prompt prefix stable within a day.

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-28 (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.