Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add commands/hamr0/agentic-toolkit/optimizegit clone --depth 1 https://github.com/hamr0/agentic-toolkitWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/hamr0/agentic-toolkit/optimize)<a href="https://agentmods.dev/commands/hamr0/agentic-toolkit/optimize"><img src="https://agentmods.dev/badge/commands/hamr0/agentic-toolkit/optimize.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00008 | $0.00596 |
| Opus 5 | $0.00004 | $0.00298 |
| Sonnet 5 | $0.00002 | $0.00119 |
| Haiku 4.5 | $0.00001 | $0.00060 |
Grade A, and why
optimize scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
This is a copy
100% identical to optimize — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 62 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Analyze $ARGUMENTS for performance.
Examine
- Time complexity (Big O)
- Space complexity
- I/O operations
- Database queries (N+1?)
- Unnecessary allocations
Output
Per bottleneck:
- Location (
file:line) - Cost — what's slow and by how much. Concrete ("N+1 over ~1k rows on every page load"), not vague ("could be faster").
- Optimization — specific change.
- Expected improvement — order-of-magnitude estimate.
- Trade-offs — readability / memory / consistency cost.
After the analysis — verify, then fix
Performance claims are easy to invent. Validate before acting.
Verify each bottleneck. Re-read the cited file:line in context.
Confirm the path is actually hot — look for at least one of:
- a profile / benchmark / log line showing call frequency or duration,
- the path sits on an obvious hot loop / per-request handler with real volume,
- the user provided evidence in the request.
Without one of those, the claim is uncertain — don't optimize on speculation. Mark each finding confirmed, false positive (with reason), or uncertain (needs profiling data).
Fix what's confirmed and unambiguous — minimal change, one obvious shape, no behavior change, no API change. Apply directly. After each edit, re-read the changed region and confirm it still computes the same answer (perf optimizations that quietly change semantics are the worst kind).
Stop and ask when (HITL gates — not all the time, only here):
- the bottleneck is uncertain after grounding (no profile / log and not obviously hot),
- the fix has multiple reasonable shapes (cache vs precompute vs batch vs paginate vs index) — present options with tradeoffs, not a chosen path,
- it changes public API / response shape / DB schema / caller contract,
- it trades correctness for speed (lossy approximation, weaker consistency, eventual-vs-strict) — even when "obviously" faster, or
- it touches concurrency primitives (locks, atomics, ordering) — easy to introduce races.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 62 lines · 8 tokens per session scan A ec5ee88c1df2
optimize is a command published in the GitHub repository hamr0/agentic-toolkit (22 stars, last pushed yesterday), licensed Apache-2.0. It adds 8 tokens to every session and 596 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to optimize, differing in 0 lines, and is treated as a copy.
Other commands, from other repositories
validate
Check database integrity and referential consistency.
debug-task
Debug Frontman task interactions from the database.
OPSX: Verify
Verify implementation matches change artifacts before archiving.
OPSX: Archive
Archive a completed change in the experimental workflow.
OPSX: Sync
Sync delta specs from a change to main specs.
bigquery-cost-check
Audit a BigQuery SQL query or dbt model for potential cost traps before it hits production.