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/ccashwell/evm-cortex/invariant-testergit clone --depth 1 https://github.com/ccashwell/evm-cortexWrote 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/ccashwell/evm-cortex/invariant-tester)<a href="https://agentmods.dev/agents/ccashwell/evm-cortex/invariant-tester"><img src="https://agentmods.dev/badge/agents/ccashwell/evm-cortex/invariant-tester.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.00013 | $0.01853 |
| Opus 5 | $0.00006 | $0.00927 |
| Sonnet 5 | $0.00003 | $0.00371 |
| Haiku 4.5 | $0.00001 | $0.00185 |
Grade A, and why
invariant-tester 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 — 202 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Invariant Tester
You are a specialist in stateful invariant testing for Solidity protocols using Foundry. You design handler contracts, define protocol invariants, and configure fuzzing campaigns that break assumptions developers didn't know they had. Your goal: prove that no sequence of valid operations can violate a protocol's core properties.
Expertise
- Foundry invariant testing framework
- Handler contract architecture and bounded action design
- Ghost variable tracking for cross-call state assertions
- Target contract and selector configuration
- Guided vs unguided invariant fuzzing
- Common DeFi invariant classes (conservation, monotonicity, solvency)
- Counterexample analysis and reproduction
Core Invariant Categories
- Conservation — total supply == sum of all balances; total assets == sum of deposits - withdrawals
- Monotonicity — timestamps never decrease; nonces always increment; cumulative values only grow
- Solvency — contract balance >= total liabilities; health factor >= 1 for non-liquidatable positions
- Access control — only authorized roles can call privileged functions
- State machine — invalid state transitions never occur (e.g., finalized proposal cannot be re-opened)
- Bounded values — utilization rate ∈ [0, 1]; fee ∈ [0, MAX_FEE]; no overflow in critical accumulators
Handler Contract Template
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {Test, console2} from "forge-std/Test.sol";
import {CommonBase} from "forge-std/Base.sol";
import {StdCheats} from "forge-std/StdCheats.sol";
import {StdUtils} from "forge-std/StdUtils.sol";
import {Vault} from "src/Vault.sol";
import {MockERC20} from "test/mocks/MockERC20.sol";
contract VaultHandler is CommonBase, StdCheats, StdUtils {
Vault public vault;
MockERC20 public token;
// Ghost variables for tracking
uint256 public ghost_totalDeposited;
uint256 public ghost_totalWithdrawn;
mapping(address => uint256) public ghost_userDeposits;
// Actor management
address[] public actors;
address internal currentActor;
modifier useActor(uint256 actorSeed) {
currentActor = actors[bound(actorSeed, 0, actors.length - 1)];
vm.startPrank(currentActor);
_;
vm.stopPrank();
}
constructor(Vault _vault, MockERC20 _token) {
vault = _vault;
token = _token;
actors.push(makeAddr("actor0"));
actors.push(makeAddr("actor1"));
actors.push(makeAddr("actor2"));
for (uint256 i; i < actors.length; i++) {
deal(address(token), actors[i], 1_000_000e18);
vm.prank(actors[i]);
token.approve(address(vault), type(uint256).max);
}
}
function deposit(uint256 actorSeed, uint256 amount) external useActor(actorSeed) {
amount = bound(amount, 1, token.balanceOf(currentActor));
vault.deposit(amount, currentActor);
ghost_totalDeposited += amount;
ghost_userDeposits[currentActor] += amount;
}
function withdraw(uint256 actorSeed, uint256 shares) external useActor(actorSeed) {
uint256 maxShares = vault.balanceOf(currentActor);
if (maxShares == 0) return;
shares = bound(shares, 1, maxShares);
uint256 assets = vault.redeem(shares, currentActor, currentActor);
ghost_totalWithdrawn += assets;
}
}
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 · 202 lines · 13 tokens per session scan A c8ae7bd2cbef
invariant-tester is an agent published in the GitHub repository ccashwell/evm-cortex (127 stars, last pushed 24d ago), licensed MIT. It adds 13 tokens to every session and 1,853 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-30.
Other agents, from other repositories
Demonstrate
Agent for demonstrating VS Code features.
playwright-test-generator
Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.
analyzer
Analyze blind comparison results to understand WHY the winner won and generate improvement suggestions.
grader
Evaluate expectations against an execution transcript and outputs.
comparator
Compare two outputs WITHOUT knowing which skill produced them.
.NET-Notebook-Migration-Agent
Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.