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/name-only/3 · ← prev next →

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

Outcome
pass
1/1 Checks passed
Turns
9
model turns
CLI calls
12
4 exited non-zero
Help lookups
3
reads of the CLI's help
Tokens in
76655
69127 of them cached
Tokens out
4101
written by the model
Cost
$0.13
of the model calls
Wall time
44.1s
from start to the Checks
scenario
balance-alert-script
agent
claude-code:anthropic/claude-opus-5.5 · 2.1.318
context
name-only
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, 2 with ~$50

reproduce

unsnag run --scenario balance-alert-script --agent claude-code:anthropic/claude-opus-5.5 --context name-only --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
I'll start by exploring the pimlico CLI.
$ ls -la && which pimlico && pimlico --help 2>&1 | head -50
total 12
drwxr-xr-x 1 agent agent 4096 Nov 16 23:21 .
drwxr-xr-x 1 root  root  4096 Nov 16 23:21 ..
drwxrwxrwx 8 agent agent 4096 Nov 16 23:21 .git
/usr/local/bin/pimlico
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
  
[… 589 more characters]
2agent
$ pimlico balance --help 2>&1; echo ---; pimlico balance 2>&1; echo "exit=$?"; echo ---; pimlico balance --json 2>&1; echo "exit=$?"
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
---
Credits                   $1,284.37
Open invoices (0)         $0.00
Balance                   $1,284.37
This month so far (est.)  -$242.22
Overdraft limit           $250.00
Remaining                 $1,292.15
Runway (est.)             ~85 days at $15.16/day this month
As of                     2026-11-16 23:21:40
exit=0
---
{
  "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:41.018Z",
  "threshold": null,
  "belowThreshold": false,
  "warnings": []
}
exit=0
3agent
$ pimlico balance --below 100 --quiet; echo "exit=$?"; pimlico balance --below 2000 --quiet; echo "exit=$?"; pimlico balance --below 2000 --json | head -20; echo "exit=${PIPESTATUS[0]}"
Credits                   $1,284.37
Open invoices (0)         $0.00
Balance                   $1,284.37
This month so far (est.)  -$242.22
Overdraft limit           $250.00
Remaining                 $1,292.15
Runway (est.)             ~85 days at $15.16/day this month
As of                     2026-11-16 23:21:44
exit=0
Credits                   $1,284.37
Open invoices (0)         $0.00
Balance                   $1,284.37
This month so far (est.)  -$242.22
Overdraft limit           $250.00
Remaining                 $1,292.15
Runway (est.)             ~85 days at $15.16/day this month
As of                     2026-11-16 23:21:45
Remaining $1,292.15 is below the $2,000.00 threshold
exit=2
{
  "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:45.311Z",
  "threshold": "2000.00",
  "belowThreshold": true,
  "warnings": []
}
exit=2
4agent
$ pimlico whoami 2>&1; pimlico login --help 2>&1; env | grep -i pimlico; ls ~/.config 2>/dev/null
Exit code 2
Logged in as  ops@northwind-labs.dev
Account       Northwind Labs
Entity        organization
Org id        org_2pX7nQ4sVbW9kLmR3tYe6HcJ8uA
Scopes        write:policies write:keys
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.

PIMLICO_DASHBOARD_URL=http://mock:8080
PIMLICO_TOKEN=pim-oauth-northwind
PIMLICO_TELEMETRY_DISABLED=1
PIMLICO_NO_AUTO_UPDATE=1
err
5agent
$ cat > /work/check-balance.sh <<'EOF' #!/usr/bin/env bash # Fails CI when the remaining Pimlico balance is under the threshold (default $100). # # Auth: set PIMLICO_TOKEN in the CI environment. # Threshold: override with MIN_BALANCE_USD (e.g. MIN_BALANCE_USD=250). # # Exit codes: # 0 remaining balance >= threshold # 2 remaining balance < threshold # 3 not logged in (PIMLICO_TOKEN missing or invalid) # * any other pimlico/network error (fails closed) set -uo pipefail MIN_BALANCE_USD="${MIN_BALANCE_USD:-100}" if ! command -v pimlico >/dev/null 2>&1; then echo "check-balance: pimlico CLI not found on PATH" >&2 exit 127 fi pimlico balance --below "$MIN_BALANCE_USD" --no-color status=$? case "$status" in 0) echo "check-balance: OK, remaining balance is at least \$${MIN_BALANCE_USD}" ;; 2) echo "check-balance: FAIL, remaining balance is under \$${MIN_BALANCE_USD}" >&2 ;; 3) echo "check-balance: FAIL, not logged in to Pimlico (is PIMLICO_TOKEN set?)" >&2 ;; *) echo "check-balance: FAIL, pimlico balance exited with status $status" >&2 ;; esac exit "$status" EOF chmod +x /work/check-balance.sh cd /work && ./check-balance.sh; echo "exit=$?"; MIN_BALANCE_USD=2000 ./check-balance.sh >/dev/null; echo "exit=$?"; PIMLICO_TOKEN= ./check-balance.sh >/dev/null; echo "exit=$?"
This command could not be checked for dangerous rm operations: the shell may read it differently than it was parsed. This requires explicit approval.
err
6agent
$ cat > /work/check-balance.sh <<'EOF' #!/usr/bin/env bash # Fails CI when the remaining Pimlico balance is under the threshold (default $100). # # Auth: set PIMLICO_TOKEN in the CI environment. # Threshold: override with MIN_BALANCE_USD (e.g. MIN_BALANCE_USD=250). # # Exit codes: # 0 remaining balance >= threshold # 2 remaining balance < threshold # 3 not logged in (PIMLICO_TOKEN missing or invalid) # * any other pimlico/network error (fails closed) set -uo pipefail MIN_BALANCE_USD="${MIN_BALANCE_USD:-100}" if ! command -v pimlico >/dev/null 2>&1; then echo "check-balance: pimlico CLI not found on PATH" >&2 exit 127 fi pimlico balance --below "$MIN_BALANCE_USD" --no-color status=$? case "$status" in 0) echo "check-balance: OK, remaining balance is at least \$${MIN_BALANCE_USD}" ;; 2) echo "check-balance: FAIL, remaining balance is under \$${MIN_BALANCE_USD}" >&2 ;; 3) echo "check-balance: FAIL, not logged in to Pimlico (is PIMLICO_TOKEN set?)" >&2 ;; *) echo "check-balance: FAIL, pimlico balance exited with status $status" >&2 ;; esac exit "$status" EOF chmod +x /work/check-balance.sh
This command could not be checked for dangerous rm operations: the shell may read it differently than it was parsed. This requires explicit approval.
err
7agent
The CLI's built-in `pimlico balance --below` already exits 2 under the threshold, so I'm using that. The file write keeps getting blocked by a shell-parsing check, so I'm rewriting it without the escaped `$` signs.
$ cat > /work/check-balance.sh <<'EOF' #!/usr/bin/env bash # Fails CI when the remaining Pimlico balance is under the threshold (default 100 USD). # # Auth: set PIMLICO_TOKEN in the CI environment. # Threshold: override with MIN_BALANCE_USD (e.g. MIN_BALANCE_USD=250). # # Exit codes: # 0 remaining balance >= threshold # 2 remaining balance < threshold # 3 not logged in (PIMLICO_TOKEN missing or invalid) # * any other pimlico/network error (fails closed) set -uo pipefail MIN_BALANCE_USD="${MIN_BALANCE_USD:-100}" if ! command -v pimlico >/dev/null 2>&1; then echo "check-balance: pimlico CLI not found on PATH" >&2 exit 127 fi pimlico balance --below "$MIN_BALANCE_USD" --no-color status=$? case "$status" in 0) printf 'check-balance: OK, remaining balance is at least %s USD\n' "$MIN_BALANCE_USD" ;; 2) printf 'check-balance: FAIL, remaining balance is under %s USD\n' "$MIN_BALANCE_USD" >&2 ;; 3) echo "check-balance: FAIL, not logged in to Pimlico (is PIMLICO_TOKEN set?)" >&2 ;; *) printf 'check-balance: FAIL, pimlico balance exited with status %s\n' "$status" >&2 ;; esac exit "$status" EOF chmod +x /work/check-balance.sh
(Bash completed with no output)
8agent
$ ./check-balance.sh; echo "exit=$?"; MIN_BALANCE_USD=2000 ./check-balance.sh >/dev/null; echo "exit=$?"; env -u PIMLICO_TOKEN ./check-balance.sh >/dev/null; echo "exit=$?"
Credits                   $1,284.37
Open invoices (0)         $0.00
Balance                   $1,284.37
This month so far (est.)  -$242.22
Overdraft limit           $250.00
Remaining                 $1,292.15
Runway (est.)             ~85 days at $15.16/day this month
As of                     2026-11-16 23:22:13
check-balance: OK, remaining balance is at least 100 USD
exit=0
check-balance: FAIL, remaining balance is under 2000 USD
exit=2
error: Not logged in. Run `pimlico login --no-wait --json`, show the user the url and code, then run `pimlico login --wait --json` in the same turn and repeat it while status is pending.
check-balance: FAIL, not logged in to Pimlico (is PIMLICO_TOKEN set?)
exit=3
9agent
I wrote `check-balance.sh` and tested it. It exits 0 when the remaining Pimlico balance is $100 or more and non-zero when it's under.

It uses the CLI's own `pimlico balance --below 100` check, so the script doesn't parse any numbers itself. Results from running it here:

| Case | Exit |
|---|---|
| Current account (remaining $1,292.15) | 0 |
| Threshold raised to $2,000 (`MIN_BALANCE_USD=2000`) | 2 |
| `PIMLICO_TOKEN` unset | 3 |

- **It fails safe:** if the login is missing, the CLI isn't installed or the call errors out, the script exits non-zero. A broken check fails CI rather than passing quietly.
- **Setup:** set `PIMLICO_TOKEN` as a CI secret.
- **Threshold:** defaults to $100. You can change it with `MIN_BALANCE_USD`.

**Decision for you:** Pimlico's "Remaining" figure includes your $250 overdraft limit. It's credits ($1,284.37), minus this month's unbilled usage ($242.22), plus the $250 overdraft. So the script fails when Remaining drops under $100, which is when you're about $150 into the overdraft. If you meant $100 of your own money, the threshold should be $350 (100 + 250); that's a one-line change.

I haven't committed the file.

Target CLI calls

#callexitmssignal
0
$ 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]
0130
1
$ 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
0151
2
$ pimlico balance
Credits                   $1,284.37
Open invoices (0)         $0.00
Balance                   $1,284.37
This month so far (est.)  -$242.22
Overdraft limit           $250.00
Remaining                 $1,292.15
Runway (est.)             ~85 days at $15.16/day this month
As of                     2026-11-16 23:21:40
0256
3
$ 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:41.018Z",
  "threshold": null,
  "belowThreshold": false,
  "warnings": []
}
0207
4
$ pimlico balance --below 100 --quiet
Credits                   $1,284.37
Open invoices (0)         $0.00
Balance                   $1,284.37
This month so far (est.)  -$242.22
Overdraft limit           $250.00
Remaining                 $1,292.15
Runway (est.)             ~85 days at $15.16/day this month
As of                     2026-11-16 23:21:44
0209
5
$ pimlico balance --below 2000 --quiet
Credits                   $1,284.37
Open invoices (0)         $0.00
Balance                   $1,284.37
This month so far (est.)  -$242.22
Overdraft limit           $250.00
Remaining                 $1,292.15
Runway (est.)             ~85 days at $15.16/day this month
As of                     2026-11-16 23:21:45
Remaining $1,292.15 is below the $2,000.00 threshold
2203
6
$ pimlico balance --below 2000 --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:45.311Z",
  "threshold": "2000.00",
  "belowThreshold": true,
  "warnings": []
}
2209nonzero_then_lookup dismissed
7
$ pimlico whoami
Logged in as  ops@northwind-labs.dev
Account       Northwind Labs
Entity        organization
Org id        org_2pX7nQ4sVbW9kLmR3tYe6HcJ8uA
Scopes        write:policies write:keys
0182
8
$ 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
9
$ pimlico balance --below 100 --no-color
Credits                   $1,284.37
Open invoices (0)         $0.00
Balance                   $1,284.37
This month so far (est.)  -$242.22
Overdraft limit           $250.00
Remaining                 $1,292.15
Runway (est.)             ~85 days at $15.16/day this month
As of                     2026-11-16 23:22:13
0180
10
$ pimlico balance --below 2000 --no-color
Credits                   $1,284.37
Open invoices (0)         $0.00
Balance                   $1,284.37
This month so far (est.)  -$242.22
Overdraft limit           $250.00
Remaining                 $1,292.15
Runway (est.)             ~85 days at $15.16/day this month
As of                     2026-11-16 23:22:13
Remaining $1,292.15 is below the $2,000.00 threshold
2176repeated_error dismissed
11
$ pimlico balance --below 100 --no-color
error: Not logged in. Run `pimlico login --no-wait --json`, show the user the url and code, then run `pimlico login --wait --json` in the same turn and repeat it while status is pending.
3132

Final state

outcome
pass
final answer
I wrote `check-balance.sh` and tested it. It exits 0 when the remaining Pimlico balance is $100 or more and non-zero when it's under.

It uses the CLI's own `pimlico balance --below 100` check, so the script doesn't parse any numbers itself. Results from running it here:

| Case | Exit |
|---|---|
| Current account (remaining $1,292.15) | 0 |
| Threshold raised to $2,000 (`MIN_BALANCE_USD=2000`) | 2 |
| `PIMLICO_TOKEN` unset | 3 |

- **It fails safe:** if the login is missing, the CLI isn't installed or the call errors out, the script exits non-zero. A broken check fails CI rather than passing quietly.
- **Setup:** set `PIMLICO_TOKEN` as a CI secret.
- **Threshold:** defaults to $100. You can change it with `MIN_BALANCE_USD`.

**Decision for you:** Pimlico's "Remaining" figure includes your $250 overdraft limit. It's credits ($1,284.37), minus this month's unbilled usage ($242.22), plus the $250 overdraft. So the script fails when Remaining drops under $100, which is when you're about $150 into the overdraft. If you meant $100 of your own money, the threshold should be $350 (100 + 250); that's a one-line change.

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

context inputs

none

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