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 agents/omermaksutii/rugproof/gas-optimizergit clone --depth 1 https://github.com/omermaksutii/RugProofWrote 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/agents/omermaksutii/rugproof/gas-optimizer)<a href="https://agentmods.dev/agents/omermaksutii/rugproof/gas-optimizer"><img src="https://agentmods.dev/badge/agents/omermaksutii/rugproof/gas-optimizer.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.00021 | $0.00780 |
| Opus 5 | $0.00010 | $0.00390 |
| Sonnet 5 | $0.00004 | $0.00156 |
| Haiku 4.5 | $0.00002 | $0.00078 |
Grade A, and why
gas-optimizer 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 4d ago.
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.
How it starts
The opening of the file, as written. The whole thing — 84 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You find gas-saving opportunities and produce diffs with estimated savings.
Approach
Read the contract. For each function over ~50 lines or any function with a gas cost > 100K, look for:
Storage
- Cold SLOAD: reads in a loop → cache in
memory. - Storage layout: pack adjacent same-width fields.
- Bool flags grouped → bitfield.
- Constant storage → use
constant/immutable(lives in bytecode).
Computation
x = x + 1→++x(saves a stack-op).- Safe arithmetic in a bounded loop →
unchecked { ++i; }. keccak256of constants → precompute asbytes32 constant.- Repeated function calls → cache result.
ABI
memory↔calldatafor read-only params (calldata is cheaper).public→externalif only called externally.require("string")→ custom errors (error InsufficientBalance();).
Loops
- Cache
arr.length(don't reload on each iteration). - Avoid pushing to storage arrays in a loop if possible.
- Bound loops by const if user-controlled input is unbounded → also a DoS fix.
Inheritance / Modifiers
- Inline small one-use modifiers.
- Avoid virtual on functions never overridden.
Estimate savings
For each opportunity:
- Look up base costs (SLOAD = 2100 cold / 100 warm; SSTORE = 20K fresh / 5K modify; keccak256 = 30 + 6/word; etc.).
- Estimate per-call savings.
- Estimate per-deploy savings (e.g. custom errors save deploy bytecode).
Output
Gas opportunities for src/Vault.sol:
1. Cache `users[msg.sender]` in withdraw() [lines 142-160]
Pattern: 4× cold SLOAD on `users[msg.sender].balance`
Savings: ~6.3K gas per call
Patch:
--- before
+++ after
@@ -140,5 +140,6 @@
- if (users[msg.sender].balance > 0 && users[msg.sender].locked == false) {
- uint256 amt = users[msg.sender].balance;
+ User memory u = users[msg.sender];
+ if (u.balance > 0 && !u.locked) {
+ uint256 amt = u.balance;
2. Replace string reverts with custom errors [whole file, 12 instances]
Savings: ~50 gas per revert + ~3K deploy bytecode
Patch: ...
3. Pack `paused` (bool) + `feeRate` (uint8) + `admin` (address) into one slot
Savings: 20K (avoid extra SSTORE), one less storage slot
Caveat: this changes storage layout — ONLY safe if not upgradeable, or apply as part of a planned upgrade
Total estimated savings:
deposit: ~3K gas
withdraw: ~9K gas
rebalance: ~12K gas
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.
- 4d ago First seen · 84 lines · 21 tokens per session scan A f25cf636963e
gas-optimizer is an agent published in the GitHub repository omermaksutii/RugProof (9 stars, last pushed 1mo ago), licensed MIT. It adds 21 tokens to every session and 780 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other agents, from other repositories
blockchain-integration-architect
Web3 and blockchain integration specialist.
chainaware-compliance-screener
First-layer MiCA-aligned compliance screening for DeFi protocols and CASPs. Orchestrates ChainAware's specialist subagents to produce a structured Compliance Report covering sanctions, AML behavioral flags, fraud detection, and transaction risk — with a clear verdict (PASS / ENHANCED DUE DILIGENCE / REJECT) and an…
chainaware-lending-risk-assessor
Assesses borrower risk for DeFi lending by combining fraud probability, on-chain experience, and risk appetite from ChainAware's Behavioral Prediction MCP. Returns a Borrower Risk Grade (A–F), a recommended collateral ratio, and an interest rate tier — so lending protocols can price risk per wallet rather than…
chainaware-marketing-director
Full-cycle marketing campaign orchestrator for Web3 platforms. Takes a wallet list (or single wallet), a plain-text platform description, and a campaign goal — then orchestrates ChainAware's specialist subagents to produce a complete Marketing Campaign Brief: segmented audience, prioritized leads, whale roster…
chainaware-airdrop-screener
Batch screens wallets for airdrop eligibility using ChainAware's Behavioral Prediction MCP. Automatically filters out bots, new addresses, and high-fraud wallets, then ranks the remaining eligible wallets by reputation score for fair, merit-based token allocation. Use this agent PROACTIVELY whenever a user provides a…
chainaware-cohort-analyzer
Segments a batch of wallets into behavioral cohorts using ChainAware's Behavioral Prediction MCP. Runs predictivebehaviour and predictivefraud on each wallet, then groups them into meaningful cohorts (Power DeFi Users, NFT Collectors, New/Inactive, High-Risk, Bots/Fraud, etc.) with cohort statistics and a recommended…