debug-user-tx

debug-user-tx is a command for Claude Code from solanabr/solana-ai-kit. It costs 15 tokens per session (2,424 once invoked), scanned A, original, MIT.

A command for reproducing a user-reported failed Solana transaction against a local copy of blockchain state. It maps the on-chain error to the Rust or interface definition that produced it.

In plain words
What is it for?
Use it with a transaction signature or instruction data to replay failures, inspect accounts and errors, identify Anchor or other program constraints, and suggest a fix.
Why use it?
It connects an opaque transaction failure to the exact source-code location responsible, making diagnosis more concrete.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution.

Good fit Use it with a transaction signature or instruction data to replay failures, inspect accounts and errors, identify Anchor or other program constraints, and suggest a fix.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/solanabr/solana-ai-kit/debug-user-tx
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/solanabr/solana-ai-kit

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 debug-user-tx

README.md
[![agentmods](https://agentmods.dev/badge/commands/solanabr/solana-ai-kit/debug-user-tx/github.svg)](https://agentmods.dev/commands/solanabr/solana-ai-kit/debug-user-tx)
Your own site
<a href="https://agentmods.dev/commands/solanabr/solana-ai-kit/debug-user-tx"><img src="https://agentmods.dev/badge/commands/solanabr/solana-ai-kit/debug-user-tx/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 debug-user-tx

Your own site · 80×15
<a href="https://agentmods.dev/commands/solanabr/solana-ai-kit/debug-user-tx"><img src="https://agentmods.dev/badge/commands/solanabr/solana-ai-kit/debug-user-tx.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,424 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.00015 $0.02424
Opus 5.5 $0.00006 $0.00970
Sonnet 5.5 $0.00003 $0.00485
Haiku 4.5 $0.00002 $0.00242

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

Security

Grade A, and why

debug-user-tx 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 23d 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.

.claude/commands/debug-user-tx.md · 102 lines

How it starts

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

Debug the failing transaction described in $ARGUMENTS. The answer the developer needs is where in this repo it failed: the handler, constraint or require! with file:line, why it failed, and a fix. References: testing.md (LiteSVM, Surfpool), surfpool/cheatcodes.md, transactions-v1.md.

Inputs

Input Notes
signature Preferred: fetch and diagnose in seconds. If the user only pasted an error message, ask for it first.
instruction + wallet When the tx never landed: the serialized tx, or accounts plus data.
cluster, rpc Default from Anchor.toml [provider] or .env. Public RPCs rate-limit, so prefer the project's provider (e.g. Helius).
program Default: IDs from declare_id! / Anchor.toml.

Modes

  • A, signature given: steps 1-4 and 6. Replay (5) only when the on-chain evidence is inconclusive.
  • B, never landed: build the tx from the instruction, replay it (5), then map the error from the replay logs (3-4) and check state (6).
  • C, failing program is not in this repo (Jupiter, Token program...): skip source mapping, diagnose from logs and account state, and say the root cause is outside this codebase.

Steps

  1. Fetch with getTransaction and {"encoding":"json","maxSupportedTransactionVersion":1,"commitment":"confirmed"}. The version must be the integer 1: with 0 or omitted, v1 transactions fail with -32015. Cache the response as .claude/debug/tx-<first 8 chars of sig>.json and re-read it from there. Use meta.err, meta.logMessages, pre/post balances and token balances, meta.innerInstructions, slot, message.accountKeys, message.instructions, and message.transactionConfig (v1 transactions carry the CU limit and priority fee there instead of ComputeBudget instructions).
  2. Failing instruction: the index is meta.err.InstructionError[0]; don't go by position (legacy and v0 txs usually start with ComputeBudget instructions). For v0 txs with lookup tables, index into accountKeys ++ meta.loadedAddresses.writable ++ meta.loadedAddresses.readonly, or CPI-heavy txs resolve the wrong program. A program ID that is not ours means mode C.
  3. Handler: instruction data is base58 in json encoding; decode it first. Anchor: match the first 8 bytes against instructions[].discriminator in target/idl/<program>.json (this also covers custom discriminators). Pinocchio/native: usually the first byte, matched against the process_instruction dispatch.
  4. Error to source, logs first:
    • AnchorError thrown in <file>:<line> is the exact location; quote it.
    • AnchorError caused by account: <name> points at a constraint on that #[derive(Accounts)] field; the Left: / Right: lines show the compared values.
    • The program's own Program log: lines and Program <id> failed: <reason>.

Read the full file on GitHub · 102 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. 23d ago Changed · -279 lines · -8 tokens per session c93fd591a2a4
  2. 24d ago Changed 7ef1e19a8ef4
  3. 1mo ago First seen · 381 lines · 23 tokens per session scan A 7ce7d0431893

Subscribe to this mod's changes

debug-user-tx is a command published in the GitHub repository solanabr/solana-ai-kit (104 stars, last pushed 23d ago), licensed MIT. It adds 15 tokens to every session and 2,424 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.