unsnag pimlico 1.2.0 · 7bff655a7e58 dirty
· 32m 29s mock
known gaps of mock: usage and key activity have no 1-2 hour aggregation lag; month-to-date metered units behind balance are fixed values; no rate limiting
runs / balance-alert-script/claude-code-anthropic-claude-opus-5.5/skill/3 · ← prev next →

balance-alert-script/claude-code-anthropic-claude-opus-5.5/skill/3 · pass

Outcome
pass
1/1 Checks passed
Turns
6
model turns
CLI calls
8
2 exited non-zero
Help lookups
3
reads of the CLI's help
Tokens in
46660
40122 of them cached
Tokens out
2708
written by the model
Cost
$0.09
of the model calls
Wall time
32.9s
from start to the Checks
scenario
balance-alert-script
agent
claude-code:anthropic/claude-opus-5.5 · 2.1.318
context
skill
repeat
3 · cell ✗✗✓✓✓
findings
—
provider
Anthropic

checks

#checkresultdetailsignal
1
cd /work && test -f check-balance.sh
timeout 60 bash check-balance.sh > /dev/null 2>&1; high=$?
PIMLICO_DASHBOARD_URL="${PIMLICO_DASHBOARD_URL%:8080}:8081" timeout 60 bash check-balance.sh > /dev/null 2>&1; low=$?
echo "exit $high with ~\$1,290 remaining, $low with ~\$50"
test "$high" -eq 0 && test "$low" -ne 0
passexited 0
exit 0 with ~$1,290 remaining, 1 with ~$50

reproduce

unsnag run --scenario balance-alert-script --agent claude-code:anthropic/claude-opus-5.5 --context skill --runs 1

Transcript highlighted = a Signal fired

#actorcontentexitsignal
0user
You have the `pimlico` CLI available.

Write a script, check-balance.sh, for our CI that exits non-zero when our remaining Pimlico balance is under $100, and zero otherwise.
1agent
[Skill] {"skill":"pimlico"}
Launching skill: pimlico
2harness
Base directory for this skill: /work/.claude/skills/pimlico

# The `pimlico` CLI

`pimlico` reads and changes the Pimlico account the user is logged in to. Every
command takes `--json`, which prints one JSON object (errors too, as
`{"error": {...}}` on stdout). Prefer `--json` when you parse output.

Exit codes: `0` ok, `1` error, `2` a threshold was breached (`balance --below`),
`3` not logged in, `75` the API is unavailable or rate-limited. On exit 3, run
`pimlico login --no-wait --json`, show the user the `url` and `code`, then call
`pimlico login --wait --json` in the same turn until `status` is not `pending`.

## Commands

| Task | Command |
| --- | --- |
| Who am I logged in as | `pimlico whoami` |
| Credits, open invoices, runway | `pimlico balance` (`--below <usd>` exits 2 under it) |
| Invoices | `pimlico invoices` (`--open` for unpaid only) |
| Traffic and spend | `pimlico usage --last 24h\|7d\|30d --group chain\|key\|day [--key <name>]` |
| One user operation | `pimlico op <userOpHash> [--chain <id>]` |
| User operation logs | `pimlico ops [--key <name>] [--chain <id>] [--status <status>] [--last 24h\|7d\|30d]` |
| RPC request logs | `pimlico requests [--key <name>] [--method <rpc method>] [--status success\|error] [--bodies]` |
| Supported chains | `pimlico chains [--mainnet\|--testnet]` (no login needed) |
| ERC-20 paymaster tokens | `pimlico erc20 tokens [--chain <id>]` |
| API keys | `pimlico keys list [--all]`, `keys get <name>`, `keys create --name <n>`, `keys rename <name> --to <n>`, `keys disable <name>` |
| Sponsorship policies | `pimlico policies list`, `policies get <sp_id>`, `policies create --name <n> …`, `policies update <sp_id> …`, `policies enable\|disable <sp_id>` |

Run `pimlico <command> --help` for every flag.

## Things to know

- **Policies are addressed by id**, not name: find the `sp_…` id with
  `pimlico policies list` first. Policy amounts are in USD
  (`--budget-usd`, `--per-user-usd`, `--per-op-usd`); `--chains` takes
  comma-separated chain ids (Base is 8453, Optimism 10, Base Sepolia 84532).
  Dates (`--start`, `--end`) are ISO 8601.
- **API keys are addressed by name.** `keys create` prints the new key's
  secret once; save it then. `keys disable` cannot be undone from the CLI.
  Names only need to be unique among active keys.
- **Logs are paginated.** `ops` and `requests` print 50 records per page and a
  `nextCursor`; pass `--all` to walk every page (up to `--max`, 1000 by
  default; with `--json` it prints one JSON object per line). `--csv` prints
  CSV. Both default to the last 24h; widen with `--last 7d` or `--last 30d`.
- **`ops --status` takes one status.** A failed operation is any of
  `failed_validation`, `dropped`, `failed_onchain`,
  `execution_reverted_onchain` and `frontran_onchain`; query each, or fetch
  them all and filter. Operations rejected on submission never become
  operations: look for them with
  `pimlico requests --method eth_sendUserOperation --status error`.
- **Why did an oper
[… 78 more characters]
3agent
$ ls -a && pimlico balance --help; pimlico balance --json; echo "exit=$?"
.
..
.claude
.git
Usage: pimlico balance [options]

Account balance broken down into credits, open invoices and unbilled usage, and
remaining headroom

Options:
  --below <usd>      Exit 2 when the remaining balance is under this
  --watch [seconds]  Refresh every N seconds (min 10, default 30)
  -h, --help         display help for command
{
  "balanceUsd": "1284.37",
  "creditsUsd": "1284.37",
  "openInvoicesUsd": "0.00",
  "openInvoices": [],
  "pendingUsd": "242.22",
  "overdraftLimitUsd": "250.00",
  "remainingUsd": "1292.15",
  "dailySpendUsd": "15.16",
  "runwayDays": 85,
  "currency": "USD",
  "asOf": "2026-11-16T23:21:47.031Z",
  "threshold": null,
  "belowThreshold": false,
  "warnings": []
}
exit=0
4agent
$ pimlico balance --below 1290 --json | grep -E 'remaining|balanceUsd|threshold|below|warn' ; echo "exit=${PIPESTATUS[0]}"; pimlico balance --below 1293 --json | grep -E 'remaining|threshold|below'; echo "exit=${PIPESTATUS[0]}"
  "balanceUsd": "1284.37",
  "remainingUsd": "1292.15",
  "threshold": "1290.00",
  "belowThreshold": false,
  "warnings": []
exit=0
  "remainingUsd": "1292.15",
  "threshold": "1293.00",
  "belowThreshold": true,
exit=2
5agent
$ pimlico --help; pimlico login --help; which jq
pimlico 1.2.0

Gas abstraction is a big part of the UX of any crypto product: Pimlico sponsors
your users' gas or lets them pay in ERC-20 tokens, on every popular EVM chain
and Solana. An API key is required to call our bundler and paymaster;
sponsorship policies are optional hardening that limits which operations you pay
for, on which chains and up to what amount. Usage and billing are transparent:
see what you used and what you owe with `pimlico usage` and `pimlico balance`.

Usage  pimlico <command> [options]

Account
  login                  Log in to Pimlico in the browser
  logout                 Log out and forget the stored credentials
  whoami                 Show the logged-in account

Billing & usage
  balance                Credits, open invoices, unbilled usage and headroom
  invoices               Stripe invoices for the account
  usage                  Requests, API credits and sponsored USD, EVM and Solana

Debug
  op <userOpHash>        Status and timeline of a user operation
  ops                    User operation logs with revert reason, policy and cost
  requests               RPC request logs with the error of failed calls
  solana txs             Sponsored and SPL-paid Solana transactions

Configure
  keys list              List API keys with last use and 30-day traffic
  keys get <name>        Show one API key by name
  keys create            Create an API key (the key is shown once)
  keys rename <name>     Rename an API key
  keys disable <name>    Disable an API key (cannot be re-enabled from the CLI)
  policies list          List sponsorship policies
  policies get <id>      Show one policy, including its effective caps
  policies create        Create a sponsorship policy (active unless --inactive)
  policies update <id>   Change a policy's name, chains, caps or window
  policies enable <id>   Switch a policy on
  policies disable <id>  Switch a policy off
  erc20 tokens           Tokens accepted by the ERC-20 paymaster
  chains           
[… 2325 more characters]
6agent
$ cat > /work/check-balance.sh <<'EOF' #!/usr/bin/env bash # Fail CI when the remaining Pimlico balance is under the threshold. # # Exit codes: # 0 remaining balance >= threshold # 1 remaining balance < threshold # 2 could not check (not logged in, API unavailable, CLI error, ...) # # Override the threshold with PIMLICO_MIN_BALANCE_USD (default 100). set -uo pipefail THRESHOLD="${PIMLICO_MIN_BALANCE_USD:-100}" if ! command -v pimlico >/dev/null 2>&1; then echo "check-balance: pimlico CLI not found on PATH" >&2 exit 2 fi output="$(pimlico balance --below "$THRESHOLD" --json)" status=$? echo "$output" case "$status" in 0) echo "check-balance: OK, remaining Pimlico balance is at or above \$$THRESHOLD" exit 0 ;; 2) echo "check-balance: FAIL, remaining Pimlico balance is under \$$THRESHOLD" >&2 exit 1 ;; 3) echo "check-balance: ERROR, pimlico CLI is not logged in on this runner" >&2 exit 2 ;; 75) echo "check-balance: ERROR, Pimlico API unavailable or rate-limited" >&2 exit 2 ;; *) echo "check-balance: ERROR, pimlico balance exited with status $status" >&2 exit 2 ;; esac EOF chmod +x /work/check-balance.sh cd /work && ./check-balance.sh >/dev/null; echo "default exit=$?" PIMLICO_MIN_BALANCE_USD=1300 ./check-balance.sh 2>&1 >/dev/null; echo "1300 exit=$?" PATH=/usr/bin:/bin bash -c 'cd /work && ./check-balance.sh'; echo "no-cli exit=$?"
default exit=0
check-balance: FAIL, remaining Pimlico balance is under $1300
1300 exit=1
check-balance: pimlico CLI not found on PATH
no-cli exit=2
7agent
I wrote `check-balance.sh` at the repo root. It exits `0` when the remaining balance is at least $100 and `1` when it's under. It also exits `2` if it can't check at all (CLI missing, not logged in, API down), so CI never passes without actually checking. I ran it against your account: it passed at $100, failed when I raised the threshold to $1300, and returned `2` when the CLI wasn't on the PATH.

The script relies on `pimlico balance --below`, which already decides "under the threshold" for you. It prints the full balance JSON to the CI log, and you can change the $100 with `PIMLICO_MIN_BALANCE_USD`.

**Decision for you:** Pimlico's "remaining" balance includes your $250 overdraft limit. Right now that's:

- credits $1,284.37 − unbilled usage $242.22 + overdraft $250.00 = **$1,292.15 remaining**

So the check as written only fails once you're about $150 into your overdraft. If you want it to fail when your own money drops under $100, the threshold needs to include the overdraft, i.e. 100 + 250 = 350. Setting `PIMLICO_MIN_BALANCE_USD=350` does that, but you'd need to update it if your overdraft limit changes. Tell me which you meant and I'll change the default if needed.

**CI login:** the CLI has to be logged in on the runner, and I couldn't find a documented API-token environment variable for it. Login is a browser/device flow, which won't work unattended. You'll need to either restore saved credentials onto the runner or check Pimlico's docs for a CI auth option. Until then the script will exit `2` with "not logged in."

I haven't committed anything.

Target CLI calls

#callexitmssignal
0
$ pimlico balance --help
Usage: pimlico balance [options]

Account balance broken down into credits, open invoices and unbilled usage, and
remaining headroom

Options:
  --below <usd>      Exit 2 when the remaining balance is under this
  --watch [seconds]  Refresh every N seconds (min 10, default 30)
  -h, --help         display help for command
0167
1
$ pimlico balance --json
{
  "balanceUsd": "1284.37",
  "creditsUsd": "1284.37",
  "openInvoicesUsd": "0.00",
  "openInvoices": [],
  "pendingUsd": "242.22",
  "overdraftLimitUsd": "250.00",
  "remainingUsd": "1292.15",
  "dailySpendUsd": "15.16",
  "runwayDays": 85,
  "currency": "USD",
  "asOf": "2026-11-16T23:21:47.031Z",
  "threshold": null,
  "belowThreshold": false,
  "warnings": []
}
0248
2
$ pimlico balance --below 1290 --json
{
  "balanceUsd": "1284.37",
  "creditsUsd": "1284.37",
  "openInvoicesUsd": "0.00",
  "openInvoices": [],
  "pendingUsd": "242.22",
  "overdraftLimitUsd": "250.00",
  "remainingUsd": "1292.15",
  "dailySpendUsd": "15.16",
  "runwayDays": 85,
  "currency": "USD",
  "asOf": "2026-11-16T23:21:52.313Z",
  "threshold": "1290.00",
  "belowThreshold": false,
  "warnings": []
}
0158
3
$ pimlico balance --below 1293 --json
{
  "balanceUsd": "1284.37",
  "creditsUsd": "1284.37",
  "openInvoicesUsd": "0.00",
  "openInvoices": [],
  "pendingUsd": "242.22",
  "overdraftLimitUsd": "250.00",
  "remainingUsd": "1292.15",
  "dailySpendUsd": "15.16",
  "runwayDays": 85,
  "currency": "USD",
  "asOf": "2026-11-16T23:21:52.487Z",
  "threshold": "1293.00",
  "belowThreshold": true,
  "warnings": []
}
2181nonzero_then_lookup dismissed
4
$ pimlico --help
pimlico 1.2.0

Gas abstraction is a big part of the UX of any crypto product: Pimlico sponsors
your users' gas or lets them pay in ERC-20 tokens, on every popular EVM chain
and Solana. An API key is required to call our bundler and paymaster;
sponsorship policies are optional hardening that limits which operations you pay
for, on which chains and up to what amount. Usage and billing are transparent:
see what you used and what you owe with `pimlico usage` and `pimlico balance`.

Usage  pimlico <command> [options]

Account
  login                  Log in to Pimlico in the browser
  logout                 Log out and forget the stored credentials
  whoami                 Show the logged-in account

Billing & usage
  balance                Credits, open invoices, unbilled usage and headroom
  invoices               Stripe invoices for the account
  usage                  Requests, API credits and sponsored USD, EVM and Solana

Debug
  op <userOpHash>        Status and timeline of a user operation
  ops                    User operation logs with revert reason, policy and cost
  requests               RPC request logs with the error of failed calls
  solana txs             Sponsored and SPL-paid Solana transactions

Configure
  keys list              List API keys with last use and 30-day traffic
  keys get <name>        Show one API key by name
  keys create            Create an API key (the key is shown once)
  keys rename <name>     Rename an API key
  keys disable <name>    Disable an API key (cannot be re-enabled from the CLI)
  policies list          List sponsorship policies
  policies get <id>      Show one policy, including its effective caps
  policies create        Create a sponsorship policy (active unless --inactive)
  policies update <id>   Change a policy's name, chains, caps or window
  policies enable <id>   Switch a policy on
  policies disable <id>  Switch a policy off
  erc20 tokens           Tokens accepted by the ERC-20 paymaster
  chains           
[… 904 more characters]
0129
5
$ pimlico login --help
Usage: pimlico login [options]

Log in to Pimlico in the browser

Options:
  --device             Use the device flow (headless machines, SSH)
  --no-open            Print the login URL instead of opening a browser
  --no-wait            Start a device login, print the URL and code, and exit
                       (default without a terminal)
  --wait               Finish a login started with --no-wait; exits 3 if it is
                       still pending
  --timeout <seconds>  How long --wait polls before giving up (default 30)
  --personal           Act on your personal account (skips the question)
  --org                Act on an organization, chosen on the consent screen
                       (skips the question)
  --read-only          Request no write access (skips the permissions checklist)
  --scopes <list>      Write access to request, comma-separated: keys, policies,
                       or none (skips the permissions checklist)
  -h, --help           display help for command

Agents and scripts:
  Every command takes --json. Exit 3 means "log in first".
  Log in without blocking:
    pimlico login --no-wait --json   show the user "url" and "code"
    pimlico login --wait --json      returns once they approve (30 s per call)
  After showing the code, call --wait right away in the same turn and repeat
  while "status" is "pending". Do not end your turn to wait for the user.

0150
6
$ pimlico balance --below 100 --json
{
  "balanceUsd": "1284.37",
  "creditsUsd": "1284.37",
  "openInvoicesUsd": "0.00",
  "openInvoices": [],
  "pendingUsd": "242.22",
  "overdraftLimitUsd": "250.00",
  "remainingUsd": "1292.15",
  "dailySpendUsd": "15.16",
  "runwayDays": 85,
  "currency": "USD",
  "asOf": "2026-11-16T23:22:07.542Z",
  "threshold": "100.00",
  "belowThreshold": false,
  "warnings": []
}
0225
7
$ pimlico balance --below 1300 --json
{
  "balanceUsd": "1284.37",
  "creditsUsd": "1284.37",
  "openInvoicesUsd": "0.00",
  "openInvoices": [],
  "pendingUsd": "242.22",
  "overdraftLimitUsd": "250.00",
  "remainingUsd": "1292.15",
  "dailySpendUsd": "15.16",
  "runwayDays": 85,
  "currency": "USD",
  "asOf": "2026-11-16T23:22:07.796Z",
  "threshold": "1300.00",
  "belowThreshold": true,
  "warnings": []
}
2254repeated_error dismissed

Final state

outcome
pass
final answer
I wrote `check-balance.sh` at the repo root. It exits `0` when the remaining balance is at least $100 and `1` when it's under. It also exits `2` if it can't check at all (CLI missing, not logged in, API down), so CI never passes without actually checking. I ran it against your account: it passed at $100, failed when I raised the threshold to $1300, and returned `2` when the CLI wasn't on the PATH.

The script relies on `pimlico balance --below`, which already decides "under the threshold" for you. It prints the full balance JSON to the CI log, and you can change the $100 with `PIMLICO_MIN_BALANCE_USD`.

**Decision for you:** Pimlico's "remaining" balance includes your $250 overdraft limit. Right now that's:

- credits $1,284.37 − unbilled usage $242.22 + overdraft $250.00 = **$1,292.15 remaining**

So the check as written only fails once you're about $150 into your overdraft. If you want it to fail when your own money drops under $100, the threshold needs to include the overdraft, i.e. 100 + 250 = 350. Setting `PIMLICO_MIN_BALANCE_USD=350` does that, but you'd need to update it if your overdraft limit changes. Tell me which you meant and I'll change the default if needed.

**CI login:** the CLI has to be logged in on the runner, and I couldn't find a documented API-token environment variable for it. Login is a browser/device flow, which won't work unattended. You'll need to either restore saved credentials onto the runner or check Pimlico's docs for a CI auth option. Until then the script will exit `2` with "not logged in."

I haven't committed anything.
teardown
—
mock gaps
—
contamination
—
dns lookups
0 (0 denied)
web tools
WebFetch (sandbox) · WebSearch (provider)

context inputs

kindsourceplaced atofferedused
skillskills/pimlico.claude/skills/pimlicotruetrue

prompt

You have the `pimlico` CLI available.

Write a script, check-balance.sh, for our CI that exits non-zero when our remaining Pimlico balance is under $100, and zero otherwise.

Artifacts

run.json · agent-stdout.jsonl · service-mock.log · session.jsonl