Agent skill

Token Flow Tracing

by PlamenTSV in PlamenTSV/plamen

Trigger Pattern SPL token CPI transfers, tokenaccount.amount, invoke/invokesigned, Transfer/TransferChecked - Inject Into Lifecycle, External-Env agents

MITAuto-check passedBusiness, Finance & HR

Install Token Flow Tracing

skills CLI
$ npx skills add PlamenTSV/plamen --skill token-flow-tracing -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install PlamenTSV/plamen token-flow-tracing --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/PlamenTSV/plamen.git skills-src && mkdir -p .claude/skills && cp -r skills-src/agents/skills/solana/token-flow-tracing .claude/skills/token-flow-tracing && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
token-flow-tracing
GitHub stars
303
Token cost
~2.6k tokens
SKILL.md length
1,113 words
Files
1
Skills in repo
87
Repo updated
First seen
Licence
MIT

At a glance

Trigger Pattern SPL token CPI transfers, tokenaccount.amount, invoke/invokesigned, Transfer/TransferChecked - Inject Into Lifecycle, External-Env agents

  • Works in 9 steps: Token Entry Points → Token State Tracking → Token Exit Points → …
  • Pattern SPL token CPI transfers
  • SKILL.md covers 1. Token Entry Points, 2. Token State Tracking, 3. Token Exit Points and 4. Token Type Separation…, plus 9 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Token Flow Tracing is an agent skill from PlamenTSV/plamen. Trigger Pattern SPL token CPI transfers, tokenaccount.amount, invoke/invokesigned, Transfer/TransferChecked - Inject Into Lifecycle, External-Env agents

Its SKILL.md is about 2.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Business, Finance & HR. It works with Solana. The repository describes itself as: Autonomous Web3 security audit agent for Claude Code. The licence is MIT.

When your agent uses it

  • Pattern SPL token CPI transfers
  • Tokenaccount.amount
  • Invoke/invokesigned
  • Transfer/TransferChecked - Inject Into Lifecycle

Example prompts

  • “/token-flow-tracing”

Workflow steps

9 steps, taken from the step headings in SKILL.md.

  1. Token Entry Points
  2. Token State Tracking
  3. Token Exit Points
  4. Token Type Separation (Multi-Token Protocols)
  5. Unsolicited Transfer Analysis
  6. Token Flow Checklist
  7. Cross-Token Interactions
  8. CPI Return Type Verification
  9. Transfer Side Effects Analysis

What it can do on your machine

Read from SKILL.md and the folder at commit 795962b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are rust and markdown).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Token Flow Tracing loads about 2.6k tokens when it runs. Until then it costs about 43 tokens; SKILL.md has 1,113 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~43
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from PlamenTSV/plamen at commit 795962b, republished under its MIT licence (© PlamenTSV). 1,113 words, ~2,564 tokens.

Download SKILL.mdSave it as .claude/skills/token-flow-tracing/SKILL.md (or your agent's skills folder).
name
token-flow-tracing
description
Trigger Pattern SPL token CPI transfers, token_account.amount, invoke/invoke_signed, Transfer/TransferChecked - Inject Into Lifecycle, External-Env agents

TOKEN_FLOW_TRACING Skill (Solana)

Trigger Pattern: SPL token CPI transfers, token_account.amount, invoke/invoke_signed, Transfer/TransferChecked Inject Into: Lifecycle, External-Env agents

For every token the protocol handles:

1. Token Entry Points

Where can tokens enter?

  • deposit() / stake() instructions - standard entry points via CPI to Token Program
  • Unsolicited SPL transfers - anyone can transfer SPL tokens to any known token account address
  • SOL lamport donations - anyone can transfer lamports to any account (system_program::transfer or direct)
  • CPI return tokens - tokens sent back as part of external CPI (e.g., unstake returns tokens, swap output)
  • PDA-owned token accounts - tokens arriving at program-derived token accounts

2. Token State Tracking

For each entry point:

  • What state variable tracks the balance? (e.g., vault.total_value, pool.total_deposited)
  • Is token_account.amount read directly for calculations? -> Donation attack vector
  • Are tracked balances vs actual token_account.amount compared anywhere?
  • Can tracked balance get out of sync with actual token account balance?

Red flags:

  • Exchange rate calculations using token_account.amount directly
  • No reconciliation mechanism to handle discrepancies
  • Internal accounting updated BEFORE CPI transfer completes
  • PDA token accounts readable by anyone - balance is public state

3. Token Exit Points

Where can tokens leave?

  • withdraw() / unstake() instructions
  • Fee distributions to treasury/authority accounts
  • Reward claim instructions
  • Emergency withdrawal / rescue instructions
  • CPI transfers to external adaptors or strategy programs
  • Liquidation transfers

For each exit: does the tracked balance decrease BEFORE or AFTER the CPI transfer? For each transfer call: can the source account be underfunded at execution time? (funds deployed externally, locked, or lent out → transfer reverts)

3b. Self-Transfer Accounting

For each transfer instruction: can the source and destination token accounts belong to the same owner/authority, or be the same account? If YES: does a self-transfer update accounting state (fees credited, rewards claimed, snapshots updated, share ratios changed) without net token movement? Flag as FINDING. Note: this check targets accounting manipulation from self-transfers, distinct from the account key uniqueness validation in ACCOUNT_VALIDATION.md's Self-Transfer Risk column.

4. Token Type Separation (Multi-Token Protocols)

For protocols handling multiple token types:

  • Are different SPL tokens handled by different code paths?
  • Can one token type's instruction be triggered with another token's accounts?
  • Are account constraints (mint, authority) properly validated per token type?
  • Does the protocol distinguish between:
    • SOL (native lamports) vs SPL tokens (token accounts)
    • Base SPL vs Token-2022 tokens (different program IDs)
    • Base token vs LP/receipt token (underlying vs yield-bearing)
    • Staking receipt tokens (validator stake, LP shares, delegation receipts)

Check: If instruction A handles MintX and instruction B handles MintY, can MintX accounts be passed to instruction B's logic?

5. Unsolicited Transfer Analysis

Can tokens be sent to the protocol's token accounts without calling deposit()?

If YES (almost always YES on Solana):

  • Does this break accounting? (tracked balance != actual token_account.amount)
  • Does this inflate exchange rates? (more assets per share)
  • Does this enable first-depositor attack amplification?
  • Are there reconciliation instructions to sync state?
  • Can an attacker front-run deposits with unsolicited transfers?

If NO:

  • Why not? (Token-2022 TransferHook rejecting? PDA authority required for receives?)
  • Is the protection reliable? (can it be bypassed?)

5b. Unsolicited Transfer Matrix (All Token Types)

For EVERY token type the protocol holds, queries, or receives - including SOL lamports:

Token TypeCan Transfer To Protocol?Changes Accounting?Blocks Operations?Triggers Side Effects?
SOL (lamports)YES (always)YES/NOYES/NOYES/NO
{spl_token_a}YES/NOYES/NOYES/NOYES/NO

RULE: If ANY transferable token affects state -> analyze: accounting divergence, rent impact, operation blocking, side effect chains.

6. Token Flow Checklist

For each token identified:

TokenEntry PointsExit PointsTracking Vartoken_account.amount Used?Unsolicited Possible?
[Name/Mint]deposit, CPI returnwithdraw, claimtotal_depositedYES/NOYES/NO

7. Cross-Token Interactions

For protocols with multiple tokens:

  • Can operations on TokenA affect TokenB's accounting?
  • Are there exchange rate dependencies between tokens (SOL vs SPL, base vs LP)?
  • Can withdrawing TokenA affect availability of TokenB?
  • Can SOL lamport balance affect SPL token operations (rent exemption)?

8. CPI Return Type Verification

For every CPI call that returns tokens or modifies accounts:

Show full SKILL.md (473 more words)Show less
8a. CPI Target Verification
  • What program does the CPI target? Is the program ID validated?
  • What accounts does the CPI expect modified? Are they verified post-CPI?

Common mismatches:

  • Token Program vs Token-2022 Program (different program IDs, different behavior)
  • Spoofed program ID (attacker-controlled program mimicking expected interface)
  • Wrong mint account (different token received than expected)
  • Different decimal precision tokens

Check: invoke_signed(&instruction, &[accounts...]) - verify the target program and returned account state match expectations.

8b. Return Value / Account State Validation
  • Does the protocol validate account state after CPI completes?
  • Can zero/max/unexpected balances cause issues?
  • Is there a mismatch between expected and actual post-CPI state?

9. Transfer Side Effects Analysis

For every CPI transfer to external programs:

9a. On-Transfer Behavior
  • Does the token use Token-2022 TransferHook extension? (arbitrary code execution on transfer)
  • Does the token use TransferFee extension? (amount received != amount sent)
  • Does the token have PermanentDelegate? (delegate can transfer without owner approval)
  • Can CPI transfer trigger state mutations in external programs?
9b. Side Effect Inventory
Token / MintOn Transfer Side EffectImpact on Protocol
[Token]TransferHook executes arbitrary CPIPotential reentrancy / state corruption
[Token]TransferFee withholds portionAccounting mismatch (sent != received)
[Token]PermanentDelegate can move tokensTokens can leave without protocol consent
9c. Token-2022 Extension Checks
  • TransferHook: unexpected CU consumption (DoS)? TransferFee: accounting drift? PermanentDelegate: unauthorized drains? ConfidentialTransfer: hidden balances?
9d. Side Effect Token Type Analysis
CPI Call / EventSide EffectToken Type ProducedProtocol Handles This Type?Mismatch?
{cpi_call}{side_effect}{token_type_or_UNKNOWN}YES/NOYES/NO

RULES: Side effect type != expected -> FINDING. Type UNKNOWN -> CONTESTED (Rule 4). Check BOTH CPI calls AND unsolicited transfers.

Example Application

rust
// RED FLAG: Direct balance usage - donatable
let rate = ctx.accounts.vault_token.amount / vault.total_shares;
// BETTER: Tracked balance - but verify total_deposited updated on ALL entry paths
let rate = vault.total_deposited / vault.total_shares;

Finding Template

When this skill identifies an issue:

markdown
**ID**: [TF-N]
**Severity**: [based on fund impact]
**Step Execution**: S1,2,3,4,5,6,7,8,9 | X(reasons) | ?(uncertain)
**Location**: program/src/instructions/file.rs:LineN
**Title**: [Token type] can enter/exit via [path] without [expected accounting update]
**Description**: [Trace the token flow and where it diverges from expected]
**Impact**: [What breaks: exchange rates, user balances, protocol insolvency]

Step Execution Checklist (MANDATORY)

CRITICAL: You MUST report completion status for ALL sections. Findings with incomplete sections will be flagged for depth review.

SectionRequiredCompleted?Notes
1. Token Entry PointsYESY/X/?
2. Token State TrackingYESY/X/?
3. Token Exit PointsYESY/X/?
4. Token Type SeparationIF multi-tokenY/X(N/A)/?
5. Unsolicited Transfer AnalysisYESY/X/?
5b. Unsolicited Transfer Matrix (All Types)YESY/X/?MANDATORY - never skip
6. Token Flow ChecklistYESY/X/?
7. Cross-Token InteractionsIF multi-tokenY/X(N/A)/?
8. CPI Return Type VerificationYESY/X/?MANDATORY - never skip
9. Transfer Side Effects (Token-2022)YESY/X/?MANDATORY - never skip
9d. Side Effect Token TypeYESY/X/?MANDATORY - never skip
Cross-Reference Markers
  • After Section 5: IF staking receipts identified -> MUST complete Sections 8-9. IF CPI calls return tokens -> MUST verify return state in Section 8.
  • After Section 8: Cross-reference with TOKEN_2022_EXTENSIONS.md for TransferHook/TransferFee. IF program ID UNVERIFIED -> mark CONTESTED.
  • After Section 9: IF side effects UNKNOWN -> assume YES (adversarial default per Rule 5). Document: "Assumed adversarial: [effect]. Impact if true: [trace]"
Mandatory Forced Output

Sections 8 and 9 MUST produce tabular output even if uncertain. If UNVERIFIED: verdict cannot be REFUTED, use CONTESTED. If side effects UNKNOWN: apply adversarial default and document assumptions.

© PlamenTSV, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in agents/skills/solana/token-flow-tracing of PlamenTSV/plamen.

Open the folder on GitHubat commit 795962b

Compare with similar skills

Token Flow Tracing next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Token Flow Tracing compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Token Flow Tracing this skillPlamenTSV/plamen303—~2.6kAutomated safety check: PassMIT
Swapper Depositswapperfinance/swapper-toolkit852—~1.8kAutomated safety check: PassMIT
Drift SDKalsk1992/CloddsBot2.9k1 repos~625Automated safety check: PassMIT
Prismirfndi/prism-liquidity-agent122—~1.5kAutomated safety check: PassMIT
Ansem Cryptoquestflowai/investorskills1.9k—~793Automated safety check: PassMIT
Solana Skillnpc-live/clawfirm156—~1kAutomated safety check: PassNone

Similar skills

  • Swapper Deposit

    swapperfinance/swapper-toolkit

    Deposit and bridge funds into a wallet or protocol using Swapper Finance.

    852 GitHub stars~1.8k tokensUpdated 6 mo ago
    Business, Finance & HRAuto-check passed
  • Drift SDK

    alsk1992/CloddsBot

    Drift Protocol perpetual futures trading on Solana (direct SDK)

    2.9k GitHub starsUsed in 1 repo~625 tokens
    Business, Finance & HRAuto-check passed
  • Prism

    irfndi/prism-liquidity-agent

    Operate Prism, an autonomous Solana DLMM liquidity agent for Meteora pools.

    122 GitHub stars~1.5k tokensUpdated 10 days ago
    Business, Finance & HRAuto-check passed
  • Ansem Crypto

    questflowai/investorskills

    A skill your agent uses when evaluating crypto narratives, attention rotation, memecoin cycles, Solana-style ecosystem momentum, social distribution, and reflexive retail flows in an Ansem-style…

    1.9k GitHub stars~793 tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed
  • Solana Skill

    npc-live/clawfirm

    Interact with Solana blockchain via Helius APIs. An agent skill from npc-live/clawfirm.

    156 GitHub stars~1k tokensUpdated 3 mo ago
    Business, Finance & HRAuto-check passed
  • Birdeye API

    agiprolabs/claude-trading-skills

    Solana token market data via Birdeye — prices, OHLCV, trades, token metadata, security checks, and trader activity

    410 GitHub stars~1.8k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed

More from PlamenTSV/plamen

All 87 skills in this repo
  • Audit Prep

    PlamenTSV/plamen

    Prepare Solidity projects for a security audit — test coverage, test quality, NatSpec docs, code hygiene, dependency health, best-practice enforcement, deployment readiness, and project…

    303 GitHub stars~3.7k tokensUpdated 12 days ago
    Auto-check passed
  • Verification Protocol

    PlamenTSV/plamen

    Trigger Pattern Always (used by all verifier agents) - Inject Into security-verifier agents (Phase 5)

    303 GitHub stars~3.5k tokensUpdated 12 days ago
    Auto-check passed
  • Ability Analysis

    PlamenTSV/plamen

    Trigger Pattern Always (Aptos Move) - foundational security check - Inject Into Breadth agents, depth agents

    303 GitHub stars~3.3k tokensUpdated 12 days ago
    Auto-check passed
  • Ability Analysis

    PlamenTSV/plamen

    Trigger Pattern Always (Sui Move) -- foundational security check - Inject Into Breadth agents, depth agents

    303 GitHub stars~3.2k tokensUpdated 12 days ago
    Auto-check passed
  • Account Lifecycle

    PlamenTSV/plamen

    Trigger Pattern ACCOUNTCLOSING flag detected (close/CloseAccount usage) - Inject Into Breadth agents, depth agents

    303 GitHub stars~1.2k tokensUpdated 12 days ago
    Auto-check passed
  • Account Validation

    PlamenTSV/plamen

    Trigger Pattern Always required for Solana audits - Inject Into Breadth agents, depth agents

    303 GitHub stars~1.7k tokensUpdated 12 days ago
    Auto-check passed

Works with

Questions about Token Flow Tracing

What does Token Flow Tracing do?

Trigger Pattern SPL token CPI transfers, tokenaccount.amount, invoke/invokesigned, Transfer/TransferChecked - Inject Into Lifecycle, External-Env agents. Token Flow Tracing is an agent skill from PlamenTSV/plamen.

When should I use Token Flow Tracing?

Token Flow Tracing fits situations like: pattern SPL token CPI transfers; tokenaccount.amount; invoke/invokesigned; transfer/TransferChecked - Inject Into Lifecycle.

How do I install Token Flow Tracing in Claude Code?

Run `npx skills add PlamenTSV/plamen --skill token-flow-tracing -a claude-code`. Or copy the skill folder (agents/skills/solana/token-flow-tracing in PlamenTSV/plamen) into .claude/skills/token-flow-tracing in your project. Claude Code loads it when a task matches its description.

How do I install Token Flow Tracing in Codex?

Run `npx skills add PlamenTSV/plamen --skill token-flow-tracing -a codex`. Or copy the skill folder (agents/skills/solana/token-flow-tracing in PlamenTSV/plamen) into .agents/skills/token-flow-tracing in your project. Codex loads it when a task matches its description.

Can I use Token Flow Tracing in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add PlamenTSV/plamen --skill token-flow-tracing -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/token-flow-tracing, .gemini/skills/token-flow-tracing, .github/skills/token-flow-tracing and .opencode/skills/token-flow-tracing in your project.

What does Token Flow Tracing need to run?

SKILL.md names no scripts, command-line tools or credentials: Token Flow Tracing is instructions for the agent only.

Does Token Flow Tracing access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Token Flow Tracing safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Token Flow Tracing use?

Token Flow Tracing is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Token Flow Tracing use?

About 2.6k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Token Flow Tracing?

Skills that share tags, products or a category with Token Flow Tracing: Swapper Deposit (swapperfinance/swapper-toolkit, 852 stars), Drift SDK (alsk1992/CloddsBot, 2.9k stars), Prism (irfndi/prism-liquidity-agent, 122 stars) and Ansem Crypto (questflowai/investorskills, 1.9k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Token Flow Tracing?

PlamenTSV (a GitHub user) maintains it in PlamenTSV/plamen, which has 303 GitHub stars. The repository holds 87 skills in this directory. The repository was last updated on September 26, 2026.

Source: PlamenTSV/plamen on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.