Agent skill

Token Flow Tracing

by PlamenTSV in PlamenTSV/plamen

Trigger Pattern SEP-41 token transfers, TokenClient::new, transfer/transferfrom/burn, XLM native balance - Inject Into Lifecycle, External-Env agents

MITAuto-check passedSecurity

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/soroban/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
~3.2k tokens
SKILL.md length
1,364 words
Files
1
Skills in repo
87
Repo updated
First seen
Licence
MIT

At a glance

Trigger Pattern SEP-41 token transfers, TokenClient::new, transfer/transferfrom/burn, XLM native balance - Inject Into Lifecycle, External-Env agents

  • Works in 9 steps: Token Entry Points → Token State Tracking → Token Exit Points → …
  • Pattern SEP-41 token 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 SEP-41 token transfers, TokenClient::new, transfer/transferfrom/burn, XLM native balance - Inject Into Lifecycle, External-Env agents

Its SKILL.md is about 3.2k 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 Security, covering Smart contract auditing. It works with Stellar. The repository describes itself as: Autonomous Web3 security audit agent for Claude Code. The licence is MIT.

When your agent uses it

  • Pattern SEP-41 token transfers
  • TokenClient::new
  • Transfer/transferfrom/burn
  • XLM native balance - 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. Cross-Contract Call Return Verification
  9. Allowance Expiry Analysis (Soroban-Specific)

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 3.2k tokens when it runs. Until then it costs about 42 tokens; SKILL.md has 1,364 words of instructions outside code blocks.

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

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,364 words, ~3,158 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 SEP-41 token transfers, TokenClient::new, transfer/transfer_from/burn, XLM native balance - Inject Into Lifecycle, External-Env agents

TOKEN_FLOW_TRACING Skill (Soroban)

Trigger Pattern: SEP-41 transfer/transfer_from/approve/burn, TokenClient::new, XLM native balance, SAC interactions Inject Into: Lifecycle, External-Env agents Finding prefix: [TF-N] Rules referenced: R4, R5, R10, R11

For every token the protocol handles:

1. Token Entry Points

Where can tokens enter?

  • deposit() / stake() functions — explicit entry via token_client.transfer_from(user, contract, amount) or token_client.transfer(user, contract_address, amount)
  • Unsolicited SEP-41 transfers — anyone can call token.transfer(sender, contract_address, amount) directly; the contract has no hook to reject it
  • XLM native balance — anyone can send XLM to the contract's Stellar account; the contract reads this via e.current_contract_address().balance() or a token client wrapping the XLM SAC
  • Return tokens from cross-contract calls — tokens returned as output of invoke_contract (e.g., swap output, unstake return)
  • Allowance-based pulls — contract holds an approved allowance; tokens pulled via transfer_from into the contract

Soroban-specific note: Unlike Solana, there are no token account PDAs. The contract address IS the recipient. Unsolicited transfers arrive directly to e.current_contract_address() and are undetectable without an explicit balance snapshot before and after calls.

2. Token State Tracking

For each entry point:

  • What state variable tracks the balance? (e.g., e.storage().instance().get(&DataKey::TotalDeposited))
  • Is token_client.balance(contract_address) read directly for calculations? → Donation attack vector
  • Are tracked balances vs actual token_client.balance() compared anywhere?
  • Can tracked balance get out of sync with actual on-chain balance?

Red flags:

  • Exchange rate calculations using token_client.balance(e.current_contract_address()) directly
  • No reconciliation mechanism to handle unsolicited-transfer discrepancies
  • Internal accounting updated BEFORE the cross-contract token transfer executes
  • Balance read at function start, transfer happens mid-function, balance read again — reentrancy window (Soroban is reentrant via invoke_contract)

3. Token Exit Points

Where can tokens leave?

  • withdraw() / unstake() functions
  • Fee distributions to treasury address
  • Reward claim functions
  • Emergency withdrawal / rescue functions
  • Cross-contract invoke_contract calls that transfer tokens as part of the call
  • Liquidation transfers

For each exit:

  • Does the tracked balance decrease BEFORE or AFTER token_client.transfer() executes?
  • Can the contract be underfunded at execution time? (funds lent to external contracts, reserved for pending withdrawals)
  • Does the function re-read the live balance after transferring, creating a post-transfer snapshot inconsistency?
3b. Self-Transfer Accounting

For each transfer instruction: can the source and destination be the same address? If YES: does a self-transfer update accounting state (fees credited, rewards claimed, share ratios updated) without net token movement? Flag as FINDING. This targets accounting manipulation, distinct from input validation.

4. Token Type Separation (Multi-Token Protocols)

For protocols handling multiple token types:

  • Are different SEP-41 tokens handled by different code paths?
  • Can one token's function be triggered with another token's contract address?
  • Is the token address validated against a stored allowlist or configured token?
  • Does the protocol distinguish between:
    • XLM native (via e.current_contract_address().balance() or XLM SAC address) vs SEP-41 tokens
    • SAC-wrapped assets (Stellar classic assets bridged to Soroban) vs pure Soroban tokens
    • Base token vs LP/receipt token (underlying vs yield-bearing)
    • Tokens with different decimal precisions (XLM is 7 decimals; many SEP-41 tokens use 7 or 18)

Check: If function A handles TokenX and function B handles TokenY, can TokenX's address be passed to function B?

5. Unsolicited Transfer Analysis

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

If YES (always YES in Soroban — any SEP-41 holder can call token.transfer(self, contract_addr, amount)):

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

If the protocol claims NO:

  • Why not? (Is there a TransferHook equivalent? There is none in standard SEP-41.)
  • 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:

Token TypeCan Transfer To Protocol?Changes Accounting?Blocks Operations?Triggers Side Effects?
XLM (native)YES (always)YES/NOYES/NOYES/NO
{sep41_token_a}YES (always)YES/NOYES/NOYES/NO
SAC-{asset}YES (always)YES/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 Varbalance() Used Directly?Unsolicited Possible?
[Name/Address]deposit, cross-contract returnwithdraw, claimtotal_depositedYES/NOYES (always)

7. Cross-Token Interactions

For protocols with multiple tokens:

  • Can operations on TokenA affect TokenB's accounting?
  • Are there exchange rate dependencies between tokens (XLM vs SEP-41, base vs LP)?
  • Can withdrawing TokenA affect availability of TokenB?
  • Can XLM balance affect SEP-41 token operations (base reserve requirements)?

8. Cross-Contract Call Return Verification

For every invoke_contract call that returns tokens or modifies state:

8a. Contract Address Verification
  • What contract does the call target? Is the contract address validated against a stored trusted address?
  • What return value / state change is expected? Is it verified post-call?

Common mismatches:

  • Wrong token address: attacker passes a fake SEP-41 contract that mints freely
  • Decimal mismatch: token with 7 decimals vs token with 18 decimals — amounts differ by 10^11
  • Return value ignored: invoke_contract succeeded but returned unexpected amount
  • Reentrancy: callee calls back into this contract before this contract's state is updated

Check: Every TokenClient::new(&e, &token_address) — is token_address validated against the configured/expected token, or accepted from user-supplied input?

Show full SKILL.md (528 more words)Show less
8b. Return Value / Post-Call State Validation
  • Does the protocol validate contract state after invoke_contract completes?
  • Can zero/max/unexpected return values cause issues?
  • Is there a mismatch between expected and actual post-call state?

Soroban reentrancy note: Soroban DOES allow reentrant invoke_contract calls unless the contract explicitly guards against them. If a cross-contract call can call back into this contract before the current function completes, check for reentrancy vectors.

9. Allowance Expiry Analysis (Soroban-Specific)

Soroban SEP-41 allowances are stored in Temporary ledger storage with a TTL (expressed as a ledger number deadline, not an amount-only approval like EVM). This creates unique staleness vectors:

9a. Allowance Storage Type
  • Is the allowance stored in Temporary storage? (expires automatically if TTL is not extended)
  • What is the approved expiration_ledger? Is it far enough in the future?
  • Who sets the expiration? Can it be set to 0 (immediate expiry)?
9b. Allowance Expiry Attack Scenarios
ScenarioDescriptionImpact
Expired allowanceContract holds an approved allowance; TTL expires before it is consumed; subsequent transfer_from failsDoS: operation reverts, user funds locked pending reapproval
Short TTL front-runUser approves with short TTL; attacker delays their own transaction until allowance expires; then calls function that relies on the allowanceGriefing: operation fails after attacker delays it
Allowance amount != i128Approved amount stored as i64 in older code; overflow at amounts > 2^63Accounting mismatch: partial approval silently truncated
9c. Token Side Effects (SAC-specific)
  • Is this token a SAC (Stellar Asset Contract)? If YES, the Stellar issuer may have freeze/clawback rights.
  • Can a SAC clawback from the contract mid-operation? (balance disappears; tracked state diverges)
  • Does the protocol handle SAC freeze/clawback gracefully, or does it panic?
9d. Side Effect Token Type Analysis
Call / EventSide EffectToken Type ProducedProtocol Handles This Type?Mismatch?
{cross_contract_call}{side_effect}{token_type_or_UNKNOWN}YES/NOYES/NO

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

Example Application

rust
// RED FLAG: Direct balance usage — donatable
let rate = token_client.balance(&e.current_contract_address()) / vault.total_shares;

// BETTER: Tracked balance — but verify total_deposited is updated on ALL entry paths
let rate = vault.total_deposited / vault.total_shares;

// RED FLAG: Token address from user input — not validated
let token_client = TokenClient::new(&e, &token_address); // token_address from fn args
token_client.transfer_from(&e.current_contract_address(), &from, &to, &amount);

// BETTER: Validated against configured token
let configured_token: Address = e.storage().instance().get(&DataKey::Token).unwrap();
require!(token_address == configured_token, Error::InvalidToken);

Finding Template

markdown
**ID**: [TF-N]
**Severity**: [based on fund impact]
**Step Execution**: S1,2,3,4,5,6,7,8,9 | X(reasons) | ?(uncertain)
**Location**: src/{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: 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. Cross-Contract Call Return VerificationYESY/X/?MANDATORY — never skip
9. Allowance Expiry AnalysisYESY/X/?MANDATORY — Soroban-specific, never skip
9d. Side Effect Token TypeYESY/X/?MANDATORY — never skip
Cross-Reference Markers
  • After Section 5: IF LP/receipt tokens identified → MUST complete Sections 8-9. IF cross-contract calls return tokens → verify return state in Section 8.
  • After Section 8: IF token address is user-supplied → mark CONTESTED until validated. IF reentrancy path exists → escalate to depth-state-trace.
  • After Section 9: IF allowance TTL is shorter than expected operation window → FINDING (at minimum Medium). IF SAC with clawback → document clawback handling or flag missing guard.
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/soroban/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—~3.2kAutomated safety check: PassMIT
Soroban Liquidity Poolsickn33/agentic-awesome-skills47k1 repos~1.3kAutomated safety check: PassMIT
Soroban Contract Auditsickn33/agentic-awesome-skills47k1 repos~1.4kAutomated safety check: PassMIT
Soroban Oracle Data Feed Auditsickn33/agentic-awesome-skills47k1 repos~1.3kAutomated safety check: PassMIT
Soroban Storage Ttl Lifecyclesickn33/agentic-awesome-skills47k1 repos~1.3kAutomated safety check: PassMIT
Soroban Token Mintersickn33/agentic-awesome-skills47k1 repos~1.3kAutomated safety check: PassMIT

Similar skills

  • Soroban Liquidity Pool

    sickn33/agentic-awesome-skills

    Automated market maker liquidity pool register: constant-product invariant curves, swap fee tiers, and LP token shares for Soroban DeFi.

    47k GitHub starsUsed in 1 repo~1.3k tokens
    SecurityAuto-check passed
  • Soroban Contract Audit

    sickn33/agentic-awesome-skills

    Soroban smart contract security audit register: authorization checks, panic pathways, integer overflows, and storage footprint verification for Stellar.

    47k GitHub starsUsed in 1 repo~1.4k tokens
    SecurityAuto-check passed
  • Soroban Oracle Data Feed Audit

    sickn33/agentic-awesome-skills

    DeFi price oracle integration and safety audit register: heartbeat bounds, stale price threshold reversion, and TWAP medianizer validation.

    47k GitHub starsUsed in 1 repo~1.3k tokens
    Business, Finance & HRAuto-check passed
  • Soroban Storage Ttl Lifecycle

    sickn33/agentic-awesome-skills

    Soroban ledger state rent and TTL extension register: live state tracking, bump thresholds, rent fee reserves, and archive boundaries.

    47k GitHub starsUsed in 1 repo~1.3k tokens
    SecurityAuto-check passed
  • Soroban Token Minter

    sickn33/agentic-awesome-skills

    Soroban SEP-41 token contract architecture register: admin control, supply caps, metadata standard, and transfer event emissions on Stellar.

    47k GitHub starsUsed in 1 repo~1.3k tokens
    SecurityAuto-check passed
  • Stellar Dev

    VelaPayments/vela-payments

    End-to-end Stellar development playbook. An agent skill from VelaPayments/vela-payments.

    131 GitHub stars~1.8k tokensUpdated 2 days ago
    Backend & APIsAuto-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 SEP-41 token transfers, TokenClient::new, transfer/transferfrom/burn, XLM native balance - 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 SEP-41 token transfers; tokenClient::new; transfer/transferfrom/burn; XLM native balance - 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/soroban/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/soroban/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 3.2k tokens (SKILL.md is roughly 13k 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: Soroban Liquidity Pool (sickn33/agentic-awesome-skills, 47k stars), Soroban Contract Audit (sickn33/agentic-awesome-skills, 47k stars), Soroban Oracle Data Feed Audit (sickn33/agentic-awesome-skills, 47k stars) and Soroban Storage Ttl Lifecycle (sickn33/agentic-awesome-skills, 47k 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.