Works with the AI Agents you already use
DSH Token Optimizer
Audit DSH agent logs to identify redundant tool calls, retry loops, and quantified token waste.
Free
DSH Token Optimizer
Example session with this skill installed
Analyze the logs in logs/production_run_042.txt and tell me why the cost spiked.
- Read your context and instructions
- Compiled the dsh token optimizer
I have analyzed logs/production_run_042.txt. The audit identified a significant retry loop in the get_user_metadata tool and redundant reasoning steps during the final synthesis phase.
DSH Token Optimization Report
| Category | Occurrences | Estimated Waste (Tokens) | Estimated Cost (USD) |
|---|---|---|---|
| Redundant Tool Calls | 14 | 28,400 | $0.42 |
| Retry Loops | 8 | 112,000 | $1.68 |
| Duplicate Reasoning | 3 | 15,500 | $0.23 |
| Total | 25 | 155,900 | $2.33 |
Detected Patterns
Tool Loop: The web_search tool was called 5 times with the exact same query "current stock price of AAPL" because the agent failed to parse the JSON response correctly.
Context Bloat: The agent repeated its internal scratchpad logic regarding "user authentication status" in every turn of the 12-turn conversation, adding ~1,200 tokens per turn.
Error Cycle: A 401 Unauthorized error from the database_query tool triggered a retry loop that persisted for 8 cycles before the agent gave up.
Next steps
- Update the
web_searchparser to handle the specific JSON schema returned by the API. - Refactor the system prompt to prevent the agent from re-stating authentication logic once verified.
- Implement a hard cap of 3 retries for the
database_querytool to prevent runaway costs on auth failures.
Connects securely to your tools. The creator never sees your data.
About this skill
Debugging high agent costs often feels like hunting for ghosts in thousands of log lines. This skill audits local DSH agent logs to pinpoint exactly where redundant tool calls and retry loops are burning your budget.
What it does
- Waste identification scans logs for redundant tool calls that return identical data.
- Loop detection flags recurring retry cycles where the agent fails to progress.
- Reasoning analysis spots duplicate logic steps that inflate context window usage.
- Cost estimation calculates the specific dollar amount wasted based on token counts.
How it works
- Supply log path by pointing the script to your local DSH log file.
- Pattern matching identifies sequences of identical inputs or repeating error states.
- Quantification aggregates the total tokens consumed by these inefficient patterns.
- Reporting delivers a breakdown of waste categories and potential savings.
Frameworks & tools
This skill targets the DSH agent framework and requires a Python environment to execute the log analysis script.
Why this beats prompting it yourself
Manual log inspection is slow and prone to missing subtle repetition patterns across large files. This tool automates the pattern matching and math, providing an objective dollar value for the inefficiencies found.
Use cases
- Audit expensive agent runs to justify refactoring specific tools.
- Identify brittle tool interfaces that trigger frequent retry loops.
- Optimize prompt context by removing repetitive reasoning cycles.
- Monitor token efficiency during agent development and testing.
Known limitations
Requires log files to be in the standard DSH text format. Does not perform real-time monitoring or live intervention.
Requires logs in standard DSH text format. Analysis is performed on local files only, not via real-time streams or API connections.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free forever
No account required to browse
Trust & safety
Security scan
Security scan passed 2 days ago
- Free with an Agensi account
Permissions
File Scopes
The tool analyzes the file you provide locally. Nothing is uploaded.