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/2 · ← prev next →

balance-alert-script/claude-code-anthropic-claude-opus-5.5/skill/2 · fail

Outcome
fail
0/1 Checks passed
Turns
6
model turns
CLI calls
4
1 exited non-zero
Help lookups
1
reads of the CLI's help
Tokens in
44652
39027 of them cached
Tokens out
3719
written by the model
Cost
$0.11
of the model calls
Wall time
43.6s
from start to the Checks
scenario
balance-alert-script
agent
claude-code:anthropic/claude-opus-5.5 · 2.1.318
context
skill
repeat
2 · 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
failexited 1
exit 127 with ~$1,290 remaining, 127 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.17",
  "runwayDays": 85,
  "currency": "USD",
  "asOf": "2026-11-16T23:15:33.707Z",
  "threshold": null,
  "belowThreshold": false,
  "warnings": []
}
exit=0
4agent
$ pimlico balance --below 1292 --json >/dev/null; echo "1292 exit=$?"; pimlico balance --below 1293 --json | grep -E 'threshold|below|remaining'; echo "1293 exit=${PIPESTATUS[0]}"; which jq
1292 exit=0
  "remainingUsd": "1292.15",
  "threshold": "1293.00",
  "belowThreshold": true,
1293 exit=2
/usr/bin/jq
5agent
$ cat > /work/check-balance.sh <<'EOF' #!/usr/bin/env bash # Fails CI when the remaining Pimlico balance is under a threshold (default $100). # # "Remaining" is Pimlico's remainingUsd: credits - open invoices - unbilled usage # + overdraft limit. It's the same figure `pimlico balance --below` checks. # # Exit codes: 0 balance OK, 1 below the threshold or the check couldn't run. # Override the threshold with PIMLICO_MIN_BALANCE_USD. set -uo pipefail THRESHOLD="${PIMLICO_MIN_BALANCE_USD:-100}" out="$(pimlico balance --below "$THRESHOLD" --json)" status=$? remaining="$(jq -r '.remainingUsd // empty' <<<"$out" 2>/dev/null)" case "$status" in 0) echo "OK: remaining Pimlico balance is \$${remaining} (threshold \$${THRESHOLD})." exit 0 ;; 2) echo "FAIL: remaining Pimlico balance is \$${remaining}, under \$${THRESHOLD}." >&2 exit 1 ;; 3) echo "ERROR: pimlico CLI is not logged in, so the balance couldn't be checked." >&2 ;; 75) echo "ERROR: Pimlico API unavailable or rate-limited, so the balance couldn't be checked." >&2 ;; *) echo "ERROR: 'pimlico balance' failed (exit $status)." >&2 ;; esac # Fail closed: an unknown balance counts as a failure. msg="$(jq -r '.error.message // empty' <<<"$out" 2>/dev/null)" [[ -n "$msg" ]] && echo " $msg" >&2 exit 1 EOF chmod +x /work/check-balance.sh cd /work && ./check-balance.sh; echo "exit=$?"; PIMLICO_MIN_BALANCE_USD=5000 ./check-balance.sh; 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 a threshold (default $100). # # "Remaining" is Pimlico's remainingUsd: credits - open invoices - unbilled usage # + overdraft limit. It's the same figure `pimlico balance --below` checks. # # Exit codes: 0 balance OK, 1 below the threshold or the check couldn't run. # Override the threshold with PIMLICO_MIN_BALANCE_USD. set -uo pipefail THRESHOLD="${PIMLICO_MIN_BALANCE_USD:-100}" out="$(pimlico balance --below "$THRESHOLD" --json)" status=$? remaining="$(jq -r '.remainingUsd // empty' <<<"$out" 2>/dev/null)" case "$status" in 0) echo "OK: remaining Pimlico balance is \$${remaining} (threshold \$${THRESHOLD})." exit 0 ;; 2) echo "FAIL: remaining Pimlico balance is \$${remaining}, under \$${THRESHOLD}." >&2 exit 1 ;; 3) echo "ERROR: pimlico CLI is not logged in, so the balance couldn't be checked." >&2 ;; 75) echo "ERROR: Pimlico API unavailable or rate-limited, so the balance couldn't be checked." >&2 ;; *) echo "ERROR: 'pimlico balance' failed (exit $status)." >&2 ;; esac # Fail closed: an unknown balance counts as a failure. msg="$(jq -r '.error.message // empty' <<<"$out" 2>/dev/null)" [[ -n "$msg" ]] && echo " $msg" >&2 exit 1 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.
$ ./check-balance.sh; echo "exit=$?"; PIMLICO_MIN_BALANCE_USD=5000 ./check-balance.sh; echo "exit=$?"
/bin/bash: line 1: ./check-balance.sh: No such file or directory
exit=127
/bin/bash: line 1: ./check-balance.sh: No such file or directory
exit=127
err
7agent
I couldn't create `check-balance.sh`. Writing it needs your approval, because the permission check couldn't parse the heredoc command. Nothing has been written or tested yet. Here's the script; approve the write and I'll create it and test it, or paste it in yourself:

```bash
#!/usr/bin/env bash
# Fails CI when the remaining Pimlico balance is under a threshold (default $100).
#
# "Remaining" is Pimlico's remainingUsd: credits - open invoices - unbilled usage
# + overdraft limit. It's the same figure `pimlico balance --below` checks.
#
# Exit codes: 0 balance OK, 1 below the threshold or the check couldn't run.
# Override the threshold with PIMLICO_MIN_BALANCE_USD.
set -uo pipefail

THRESHOLD="${PIMLICO_MIN_BALANCE_USD:-100}"

out="$(pimlico balance --below "$THRESHOLD" --json)"
status=$?

remaining="$(jq -r '.remainingUsd // empty' <<<"$out" 2>/dev/null)"

case "$status" in
  0)
    echo "OK: remaining Pimlico balance is \$${remaining} (threshold \$${THRESHOLD})."
    exit 0
    ;;
  2)
    echo "FAIL: remaining Pimlico balance is \$${remaining}, under \$${THRESHOLD}." >&2
    exit 1
    ;;
  3)
    echo "ERROR: pimlico CLI is not logged in, so the balance couldn't be checked." >&2
    ;;
  75)
    echo "ERROR: Pimlico API unavailable or rate-limited, so the balance couldn't be checked." >&2
    ;;
  *)
    echo "ERROR: 'pimlico balance' failed (exit $status)." >&2
    ;;
esac

# Fail closed: an unknown balance counts as a failure.
msg="$(jq -r '.error.message // empty' <<<"$out" 2>/dev/null)"
[[ -n "$msg" ]] && echo "  $msg" >&2
exit 1
```

**How it works:** it uses the CLI's own `pimlico balance --below 100` check. I tested that flag against your account: it compares the threshold with `remainingUsd` and exits 2 when the balance is under it. Right now `remainingUsd` is $1,292.15.

**Decision for you:** "remaining" includes your $250 overdraft limit. It's credits ($1,284.37) minus unbilled usage ($242.22) plus $250. So this check would only fail once you're about $150 into overdraft. If you'd rather it fail when your actual funds drop under $100, I can switch it to compare `balanceUsd - pendingUsd` instead.

**Other choices:**
- If the check can't run (CLI not logged in in CI, API down or rate-limited), it fails rather than passing, since the balance is unknown.
- You can change the threshold with `PIMLICO_MIN_BALANCE_USD` without editing the script.
- CI needs `jq` and a logged-in `pimlico` CLI.

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
0127
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.17",
  "runwayDays": 85,
  "currency": "USD",
  "asOf": "2026-11-16T23:15:33.707Z",
  "threshold": null,
  "belowThreshold": false,
  "warnings": []
}
0204
2
$ pimlico balance --below 1292 --json
{
  "balanceUsd": "1284.37",
  "creditsUsd": "1284.37",
  "openInvoicesUsd": "0.00",
  "openInvoices": [],
  "pendingUsd": "242.22",
  "overdraftLimitUsd": "250.00",
  "remainingUsd": "1292.15",
  "dailySpendUsd": "15.17",
  "runwayDays": 85,
  "currency": "USD",
  "asOf": "2026-11-16T23:15:40.863Z",
  "threshold": "1292.00",
  "belowThreshold": false,
  "warnings": []
}
0178
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.17",
  "runwayDays": 85,
  "currency": "USD",
  "asOf": "2026-11-16T23:15:41.031Z",
  "threshold": "1293.00",
  "belowThreshold": true,
  "warnings": []
}
2164

Final state

outcome
fail 0 of 1 Checks passed
final answer
I couldn't create `check-balance.sh`. Writing it needs your approval, because the permission check couldn't parse the heredoc command. Nothing has been written or tested yet. Here's the script; approve the write and I'll create it and test it, or paste it in yourself:

```bash
#!/usr/bin/env bash
# Fails CI when the remaining Pimlico balance is under a threshold (default $100).
#
# "Remaining" is Pimlico's remainingUsd: credits - open invoices - unbilled usage
# + overdraft limit. It's the same figure `pimlico balance --below` checks.
#
# Exit codes: 0 balance OK, 1 below the threshold or the check couldn't run.
# Override the threshold with PIMLICO_MIN_BALANCE_USD.
set -uo pipefail

THRESHOLD="${PIMLICO_MIN_BALANCE_USD:-100}"

out="$(pimlico balance --below "$THRESHOLD" --json)"
status=$?

remaining="$(jq -r '.remainingUsd // empty' <<<"$out" 2>/dev/null)"

case "$status" in
  0)
    echo "OK: remaining Pimlico balance is \$${remaining} (threshold \$${THRESHOLD})."
    exit 0
    ;;
  2)
    echo "FAIL: remaining Pimlico balance is \$${remaining}, under \$${THRESHOLD}." >&2
    exit 1
    ;;
  3)
    echo "ERROR: pimlico CLI is not logged in, so the balance couldn't be checked." >&2
    ;;
  75)
    echo "ERROR: Pimlico API unavailable or rate-limited, so the balance couldn't be checked." >&2
    ;;
  *)
    echo "ERROR: 'pimlico balance' failed (exit $status)." >&2
    ;;
esac

# Fail closed: an unknown balance counts as a failure.
msg="$(jq -r '.error.message // empty' <<<"$out" 2>/dev/null)"
[[ -n "$msg" ]] && echo "  $msg" >&2
exit 1
```

**How it works:** it uses the CLI's own `pimlico balance --below 100` check. I tested that flag against your account: it compares the threshold with `remainingUsd` and exits 2 when the balance is under it. Right now `remainingUsd` is $1,292.15.

**Decision for you:** "remaining" includes your $250 overdraft limit. It's credits ($1,284.37) minus unbilled usage ($242.22) plus $250. So this check would only fail once you're about $150 into overdraft. If you'd rather it fail when your actual funds drop under $100, I can switch it to compare `balanceUsd - pendingUsd` instead.

**Other choices:**
- If the check can't run (CLI not logged in in CI, API down or rate-limited), it fails rather than passing, since the balance is unknown.
- You can change the threshold with `PIMLICO_MIN_BALANCE_USD` without editing the script.
- CI needs `jq` and a logged-in `pimlico` CLI.
unexplained_fail
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