clams
Installation
SKILL.md
Skill Directory
All scripts/ paths in this skill are relative to the directory containing this SKILL.md file. Before running any script, resolve the absolute path to this skill's directory first. For example, if this file is at ~/.claude/skills/clams/SKILL.md, then scripts are at ~/.claude/skills/clams/scripts/.
Rules
- Before running your first
clamscommand in a session, source the user's shell profile to ensure PATH is set:source ~/.zshenv 2>/dev/null; source ~/.bashrc 2>/dev/null. Only needed once per session. - Always read the relevant reference file before running a command. Do not guess flags or syntax — check the reference first
- Use
--machine --format jsonfor commands whose output you need to parse or pipe to a script - Use
--format plainwhen the user wants to see report output in the terminal — display the CLI output directly, do not reformat it - Processing order: sync →
clams rates sync→clams journals process→ reports - Default report formats: use
--format plainfor display reports (balance sheet, balance history, portfolio summary) and--format csv --output <path>for data reports (capital gains, journal entries). Only generate PDF when the user explicitly asks for it. - For PDF reports (only when requested): pipe JSON through
<skill-dir>/scripts/render-<report>.sh --pdf <path>. Requiresweasyprint. - Never summarize or reformat amounts from CLI output — use render scripts,
--format plain, or--format csvto let the CLI format them - Never perform arithmetic on financial values. Do not sum, subtract, average, or derive new numbers from CLI output — only display values that Clams itself has calculated and formatted
- There is no
clams reports exportcommand — PDF and CSV are produced as described above - On errors: read the error JSON (
codeandmessagefields) before diagnosing — do not guess the cause. If the error isn't clear, retry the command with--debugfor more detailed output
Gotchas
- Empty reports? You forgot
clams journals process. This must run after every sync/import and before any report. It's the #1 mistake. - Amounts are in millisatoshis. Never convert, round, summarize, or display raw JSON amounts. Always pipe through the render scripts or use
--format csv. clams reports exportdoes not exist. For PDF, pipe JSON through<skill-dir>/scripts/render-*.sh. For CSV, use--format csv --output <path>on the report command.clams initis interactive-only. It does not support--machinemode. Use the individual commands in onboarding.md instead.clams setupis for server admins. Do not use it in CLI workflows — it configures the Clams server, not the client.- On-chain wallets need an onchain source first.
XPub,Descriptor, andAddressconnections will fail to sync without one. Create it during onboarding (step 7). When creating these connections, auto-resolve the onchain source and network — see "Resolving Onchain Source and Network" in connections.md. Do not ask the user unless genuinely ambiguous. - Re-process after metadata changes. Notes, tags, exclusions, rate overrides, and account adjustments don't take effect until you run
clams journals processagain. - Omitting
--excludedremoves the exclusion.clams metadata records excluded set --event-id <ID>without the--excludedflag un-excludes the event — this is intentional but counterintuitive. - Quarantine blocks accurate reports. Unresolved quarantined events are omitted from reports. Always check
clams journals quarantinedif numbers look wrong. - All JSON responses are wrapped in a
dataenvelope. The shape is{"kind": "...", "schema_version": 1, "data": ...}. Always access.datato get the actual payload — lists may be at.data(array) or.data.items(paginated). --machinerequires--format json. Never combine--machinewith--format csvor--format plain— it will error. Use--machine --format jsonfor scripting, or drop--machineand use--format plain/--format csvdirectly.- Not all reports support CSV. Only capital gains and journal entries have CSV output. Balance sheet and portfolio summary support plain text and PDF only. See the format support table in reports.md.
- Rapid CLI calls trigger rate limiting. Making many requests in quick succession (e.g., paginating through events) causes the backend to return empty responses. These look like auth errors but are transient. When paginating, add a 0.5 s delay between pages and retry on empty responses (up to 3 attempts with a 2 s backoff). See the pagination section in journal-processing.md.
- Event counts can be large. Lightning connections can have tens of thousands of events. Never assume the first page is all there is — always check
next_cursorin the JSON response. If a user asks for a count and the first page returns a full 500 items, there are almost certainly more pages.
Data Hierarchy
workspace → profile → connections → journals → reports
→ onchain sources (for on-chain wallets)
→ metadata (notes, tags, exclusions)
Report Selection
| User is asking about... | Report |
|---|---|
| Cost basis, net worth, unrealized gains, portfolio value, average cost | Portfolio Summary |
| Realized gains/losses, tax reporting, disposals, capital gains | Capital Gains |
| Current balances by account/connection, assets vs liabilities | Balance Sheet |
| How balances changed over time, balance trends | Balance History |
| Raw transaction data, ledger export | Journal Entries |
Workflow Routing
| User wants to... | Reference |
|---|---|
| Log in, create workspace/profile, configure settings, set up onchain source | onboarding.md |
| Add wallets, list/update/delete connections, sync, import CSV/JSON | connections.md |
| Manage onchain sources (Esplora, Electrum, Bitcoin RPC), Tor proxy | onchain.md |
| Import exchange CSV via custom mapping (csv_mapping), custom connections | custom-connections.md |
| Find/inspect a specific transaction by txid or event ID | journal-processing.md |
| Process journals, inspect quarantine, resolve quarantined events | journal-processing.md |
| Add notes, tags, exclusions, rate overrides, or account adjustments | metadata.md |
| Generate balance sheet, balance history, portfolio summary, capital gains, journal entries | reports.md |
| Verify CLI readiness, check state before/after workflows | verification.md |
| Diagnose errors or empty results | troubleshooting.md |
Fallback
clams --help
clams <subcommand> --help