defi-architect

defi-architect is an agent for Claude Code from ccashwell/evm-cortex. It costs 18 tokens per session (1,492 once invoked), scanned A, original, MIT.

A design specialist for decentralized finance, or DeFi: financial applications that run on blockchains and interact through smart contracts.

In plain words
What is it for?
Use it to design lending, trading, liquidity, fee, liquidation, flash-loan, upgrade, and emergency mechanisms, while checking their economic assumptions and safety conditions.
Why use it?
It makes protocol designs account for system rules, attack paths, transaction-ordering risks from block producers and traders, incentives, and compatibility with other DeFi systems.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md). Also seen: model in frontmatter.

Good fit Use it to design lending, trading, liquidity, fee, liquidation, flash-loan, upgrade, and emergency mechanisms, while checking their economic assumptions and safety conditions.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/ccashwell/evm-cortex/defi-architect
Install

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.

Clone the repo
git clone --depth 1 https://github.com/ccashwell/evm-cortex

Made for: Claude Code.

Wrote 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.

agentmods badge for defi-architect

README.md
[![agentmods](https://agentmods.dev/badge/agents/ccashwell/evm-cortex/defi-architect/github.svg)](https://agentmods.dev/agents/ccashwell/evm-cortex/defi-architect)
Your own site
<a href="https://agentmods.dev/agents/ccashwell/evm-cortex/defi-architect"><img src="https://agentmods.dev/badge/agents/ccashwell/evm-cortex/defi-architect/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for defi-architect

Your own site · 80×15
<a href="https://agentmods.dev/agents/ccashwell/evm-cortex/defi-architect"><img src="https://agentmods.dev/badge/agents/ccashwell/evm-cortex/defi-architect.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 18 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,492 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00018 $0.01492
Opus 5.5 $0.00007 $0.00597
Sonnet 5.5 $0.00004 $0.00298
Haiku 4.5 $0.00002 $0.00149

Measured 1mo ago against content hash b981d6cfa4fc, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

defi-architect 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 1mo 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.

agents/defi-architect.md · 158 lines

How it starts

The opening of the file, as written. The whole thing — 158 lines — stays where its author put it; the contents beside it link to each section on GitHub.

DeFi Architect

You are a DeFi protocol architect who designs composable, MEV-aware, and economically sound onchain financial systems. You think in terms of invariants, attack surfaces, and incentive alignment. Every design decision you make considers gas efficiency, composability with existing DeFi primitives, and adversarial behavior from MEV searchers and malicious actors.

Expertise

  • Protocol composability patterns and DeFi lego design
  • Flash loan integration and atomic transaction design
  • MEV-aware protocol architecture (sandwich protection, backrun incentives)
  • Fee model design (static, dynamic, auction-based)
  • Liquidity provision mechanisms and incentive structures
  • Protocol-owned liquidity (POL) strategies
  • Atomic arbitrage and liquidation design
  • Emergency mechanisms and circuit breakers
  • Upgradability patterns for DeFi (proxy vs immutable tradeoffs)
  • Cross-protocol risk analysis

Design Principles

1. Invariant-First Design

Every protocol must have a clearly defined set of invariants. Design the system around these invariants, then prove they hold under all operation sequences.

INVARIANT: totalDebt <= totalCollateral * collateralFactor
INVARIANT: sum(shares[i] * sharePrice) == totalAssets
INVARIANT: reserveBalance >= sum(pendingWithdrawals)

2. Composability by Default

Design contracts as building blocks. Accept and return standard interfaces (ERC-20, ERC-4626, ERC-721). Never assume you know who the caller is or what they'll do with the output.

// Good: composable — returns shares, accepts any ERC-20
function deposit(uint256 assets, address receiver) external returns (uint256 shares);

// Bad: non-composable — hardcoded logic, no return value
function deposit() external payable;

3. MEV-Aware Design Patterns

// Commit-reveal for sandwich protection
mapping(bytes32 => uint256) public commitTimestamps;

function commit(bytes32 hash) external {
    commitTimestamps[hash] = block.timestamp;
}

function reveal(uint256 amount, uint256 nonce) external {
    bytes32 hash = keccak256(abi.encodePacked(msg.sender, amount, nonce));
    require(block.timestamp >= commitTimestamps[hash] + DELAY, "too early");
    require(block.timestamp <= commitTimestamps[hash] + WINDOW, "expired");
    delete commitTimestamps[hash];
    _execute(amount);
}

Read the full file on GitHub · 158 lines

Changes

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.

  1. 1mo ago First seen · 158 lines · 18 tokens per session scan A b981d6cfa4fc

Subscribe to this mod's changes

defi-architect is an agent published in the GitHub repository ccashwell/evm-cortex (131 stars, last pushed 17d ago), licensed MIT. It adds 18 tokens to every session and 1,492 once invoked, about $0.0001 per session on Opus 5.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.

Related

Other agents, from other repositories

chainaware-ltv-estimator

Estimates the 12-month revenue potential (Lifetime Value) of any Web3 wallet using behavioral signals from ChainAware's Prediction MCP. Combines on-chain experience, activity categories, risk profile, forward-looking intent, and fraud-based retention probability into a USD revenue range. Use this agent PROACTIVELY…

ChainAware/behavioral-prediction-mcp · 297 tokens

chainaware-counterparty-screener

Real-time pre-transaction counterparty screening using ChainAware's Behavioral Prediction MCP. Returns a fast go/no-go Interaction Risk Level (Safe / Caution / Block) with a one-line reason before a trade, transfer, or contract interaction. Use this agent PROACTIVELY whenever a user is about to interact with an…

ChainAware/behavioral-prediction-mcp · 231 tokens

token-economics-designer

Token economics and tier design specialist. Use when designing pricing models, access tiers, or token distribution strategies.

Matt-Dionis/claude-code-configs · 28 tokens

crypto-analyst

Cryptocurrency market analyst - price trends, fundamentals, risk assessment using CoinPaprika data for 12,000+ cryptocurrencies and 350+ exchanges.

coinpaprika/claude-marketplace · 34 tokens

defi-engineer

DeFi integration specialist for composing with Solana protocols including Jupiter, Drift, Kamino, Raydium, Orca, Meteora, Marginfi, and Sanctum. Handles swap routing, lending/borrowing, staking, liquidity provision, and oracle price feeds. Use when: Integrating DeFi protocols, building swap interfaces, implementing…

GeckoVision/gecko-surf · 100 tokens

crypto-trader

Build cryptocurrency trading systems, implement trading strategies, and integrate with exchange APIs. Use PROACTIVELY for crypto trading bots, order execution, and portfolio management.

rafaelkamimura/claude-tools · 36 tokens