depth-token-flow

A focused review of how tokens enter, leave, and move through a blockchain contract, including ways an attacker might exploit those paths.

In plain words
What is it for?
Investigating suspected token donation attacks, checking type separation, tracing token movement, and connecting token issues with other security findings.
Why use it?
Token-flow bugs can depend on assumptions outside the immediate code. It prompts the review to check related conditions and avoid declaring a defense proven without suitable evidence.

Agent

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.

agentmods
npx agentmods add agents/plamentsv/plamen/depth-token-flow
Clone the repo
git clone --depth 1 https://github.com/PlamenTSV/plamen
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,447 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00018 $0.01447
Opus 5 $0.00009 $0.00724
Sonnet 5 $0.00004 $0.00289
Haiku 4.5 $0.00002 $0.00145

Measured 2d ago against content hash fe385de4ac89, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

depth-token-flow 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 2d 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/depth-token-flow.md · 113 lines

How it starts

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

Depth Agent: Token Flow Analysis

You are a depth agent performing targeted follow-up analysis on specific token flow patterns flagged by breadth agents.

Mandatory Analysis Checks

Before ANY verdict:

  1. Devil's Advocate: Answer "What would make this exploitable?" (never "nothing")
  2. Cross-Domain Dependencies: For each target, identify 2-3 assumptions it makes OUTSIDE your domain (e.g., oracle freshness, access control correctness, state variable consistency). Ask: "If this assumption broke, would my target become exploitable?" Tag any dependency as [CROSS-DOMAIN-DEP: {domain}] in your finding output — chain analysis uses these to discover compound exploits invisible to single-domain agents.
  3. Chain Check: Search findings_inventory.md for findings that CREATE the missing precondition
  4. Evidence Quality: Tag all evidence [PROD-ONCHAIN], [CODE], [MOCK], etc. - [MOCK]/[EXT-UNV] cannot support REFUTED
  5. Confidence Gate: Uncertain? → CONTESTED, not REFUTED. Only REFUTED if defense proven with production evidence
  6. Enabler Search: Before REFUTED, ask "Does ANY other finding enable this?"

Reference: ~/.claude/prompts/{LANGUAGE}/generic-security-rules.md for full rule definitions (Rules 1-16). The orchestrator resolves {LANGUAGE} before spawning you.

Your Role

You receive SPECIFIC TARGETS from the breadth pass - locations where token handling may have vulnerabilities. Your job is to perform deep, focused analysis on these exact locations using real protocol constants.

Methodology

For EACH target in your assignment:

1. Read the Skill File

Read the TOKEN_FLOW_TRACING skill from ~/.claude/agents/skills/{LANGUAGE}/token-flow-tracing/SKILL.md for the full methodology. The orchestrator provides the resolved path in your prompt.

2. Token Entry Analysis

For each token entry point (deposit, stake, transfer-in):

  • Trace the EXACT path from external call to state update
  • Identify ALL state variables modified
  • Check: can tokens arrive via paths that bypass this function? (direct transfer, donation)
  • If the protocol queries its own balance directly (rather than using tracked state): what happens if actual balance ≠ tracked balance?

Read the full file on GitHub · 113 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. 2d ago First seen · 113 lines · 18 tokens per session scan A fe385de4ac89

Subscribe to this mod's changes

depth-token-flow is an agent published in the GitHub repository PlamenTSV/plamen (281 stars, last pushed 1mo ago), licensed MIT. It adds 18 tokens to every session and 1,447 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.

Related

Other agents, from other repositories

contract-auditor

Solidity contract specialist for the generate → audit → fix → deploy lifecycle. Use when writing, reviewing, auditing, or deploying smart contracts. Enforces the audit-before-deploy discipline and never deploys without an explicit human acknowledgement.

ChainGPT-org/chaingpt-claude-skill · 51 tokens

defi-trader

Disciplined DeFi execution specialist for swaps, bridges, lending, LP/yield moves, and perps order prep. Use when the user wants to actually DO something on-chain. Runs mandatory pre-flight checks, respects every custody gate, and never sets acknowledgeMainnet or signs from the agent wallet without explicit human…

ChainGPT-org/chaingpt-claude-skill · 74 tokens

web3-researcher

Read-only Web3 research analyst. Use for token due-diligence, market scans, wallet forensics, yield comparisons, perps/funding analysis, and prediction-market odds — anything that answers a question without moving funds. It cannot build or sign transactions, so it is safe to run unattended.

ChainGPT-org/chaingpt-claude-skill · 66 tokens

autopilot

Autopilot is a trading agent that decides, commits, trades and publishes on its own. It runs on the execution infrastructure we already had (multi-chain swap routing, managed wallets, policy gates, token security) and adds the part that was missing: a loop that forms a thesis, refuses or takes the trade against…

0xSoftBoi/suwappubot · 0 tokens

security-auditor

Security auditor for DeFi bot — OWASP top 10, wallet encryption, token security, input validation, dependency scanning, secret detection. Use proactively after code changes or when reviewing security posture.

0xSoftBoi/suwappubot · 44 tokens

swap-debug

Cross-chain swap debugger — trace failed transactions, diagnose quote errors, debug bridge issues, analyze token security problems, debug RPC/balance issues. Use when investigating swap/transaction/balance failures.

0xSoftBoi/suwappubot · 41 tokens