@aomi-labs/client 0.1.21 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,14 +5,15 @@ description: >
5
5
  check balances or prices, build wallet requests, confirm quotes or routes,
6
6
  sign transactions or EIP-712 payloads, switch apps or chains, or execute
7
7
  swaps, transfers, and DeFi actions on-chain. Covers Aomi chat, transaction
8
- review, AA-first signing with automatic EOA fallback, session controls, and
9
- per-session secret ingestion.
10
- compatibility: "Requires @aomi-labs/client (`npm install -g @aomi-labs/client`). CLI executable is `aomi`. Requires viem for signing (`npm install viem`). Use AOMI_APP / --app, AOMI_MODEL / --model, AOMI_CHAIN_ID / --chain, CHAIN_RPC_URL / --rpc-url, optional --secret NAME=value ingestion, and AOMI_STATE_DIR for local session storage."
8
+ review, AA-first signing with mode fallback, persistent AA configuration,
9
+ session controls, and per-session secret ingestion.
10
+ compatibility: "Requires @aomi-labs/client (`npm install -g @aomi-labs/client`). CLI executable is `aomi`. Requires viem for signing (`npm install viem`). Use AOMI_APP / --app, AOMI_MODEL / --model, AOMI_CHAIN_ID / --chain, CHAIN_RPC_URL / --rpc-url, `aomi secret add` for session secret ingestion, and AOMI_STATE_DIR for local session storage."
11
+
11
12
  license: MIT
12
13
  allowed-tools: Bash
13
14
  metadata:
14
15
  author: aomi-labs
15
- version: "0.5"
16
+ version: "0.6"
16
17
  ---
17
18
 
18
19
  # Aomi Transact
@@ -25,32 +26,52 @@ backend. Local session data lives under `AOMI_STATE_DIR` or `~/.aomi`.
25
26
 
26
27
  - The user wants to chat with the Aomi agent from the terminal.
27
28
  - The user wants balances, prices, routes, quotes, or transaction status.
28
- - The user wants to build, confirm, sign, or broadcast wallet requests.
29
+ - The user wants to build, simulate, confirm, sign, or broadcast wallet requests.
30
+ - The user wants to simulate a batch of pending transactions before signing.
29
31
  - The user wants to inspect or switch apps, models, chains, or sessions.
30
32
  - The user wants to inject API keys or other backend secrets for the current session.
33
+ - The user wants to configure or inspect Account Abstraction settings.
31
34
 
32
35
  ## Hard Rules
33
36
 
34
37
  - Never print secrets verbatim in normal status, preflight, or confirmation output.
35
38
  - Treat `PRIVATE_KEY`, `AOMI_API_KEY`, `ALCHEMY_API_KEY`, `PIMLICO_API_KEY`, and private RPC URLs as secrets.
36
39
  - If the user provides a private key or API key, do not repeat it back unless they explicitly ask for that exact value to be reformatted.
37
- - Prefer `aomi --secret NAME=value ...` over stuffing provider API keys into normal chat text.
40
+ - Prefer `aomi secret add NAME=value` over stuffing provider API keys into normal chat text.
38
41
  - Do not sign anything unless the CLI has actually queued a wallet request and you can identify its `tx-N` ID.
39
42
  - When starting work from a new Codex or assistant chat thread, default the first Aomi command to `--new-session` unless the user explicitly wants to continue an existing session.
40
43
  - If `PRIVATE_KEY` is set in the environment, do not also pass `--private-key` unless you intentionally want to override the environment value.
41
- - `--public-key` must match the address derived from the signing key. If they differ, `aomi sign` will update the session to the signer address.
44
+ - `--public-key` must match the address derived from the signing key. If they differ, `aomi tx sign` will update the session to the signer address.
42
45
  - Private keys must start with `0x`. Add the prefix if missing.
43
- - `CHAIN_RPC_URL` is only one default RPC URL. When switching chains, prefer passing `--rpc-url` on `aomi sign`.
44
- - Switching the chat/session chain with `--chain` does not switch `CHAIN_RPC_URL`. The RPC used for `aomi sign` must match the pending transaction's chain.
46
+ - `CHAIN_RPC_URL` is only one default RPC URL. When switching chains, prefer passing `--rpc-url` on `aomi tx sign`.
47
+ - Switching the chat/session chain with `--chain` does not switch `CHAIN_RPC_URL`. The RPC used for `aomi tx sign` must match the pending transaction's chain.
45
48
  - `--aa-provider` and `--aa-mode` are AA-only controls and cannot be used with `--eoa`.
46
49
 
50
+ ## Command Structure
51
+
52
+ All commands follow a **noun-verb** pattern: `aomi <resource> <action>`.
53
+ There are no top-level aliases — use the full noun-verb form.
54
+
55
+ ```
56
+ aomi chat <message> Send a message
57
+ aomi tx list List pending/signed transactions
58
+ aomi tx simulate <id>... Simulate a batch
59
+ aomi tx sign <id>... Sign and submit
60
+ aomi session list|new|resume|delete|status|log|events|close
61
+ aomi model list|set|current
62
+ aomi app list|current
63
+ aomi chain list
64
+ aomi secret list|clear|add
65
+ aomi aa status|set|test|reset
66
+ ```
67
+
47
68
  ## Quick Start
48
69
 
49
70
  Run this once at the start of the session:
50
71
 
51
72
  ```bash
52
73
  aomi --version
53
- aomi status 2>/dev/null || echo "no session"
74
+ aomi session status 2>/dev/null || echo "no session"
54
75
  ```
55
76
 
56
77
  If the user is asking for a read-only result, that may be enough. If they want
@@ -60,9 +81,9 @@ to build or sign a transaction, continue with the workflow below.
60
81
 
61
82
  1. Chat with the agent.
62
83
  2. If the agent asks whether to proceed, send a short confirmation in the same session.
63
- 3. Review pending requests with `aomi tx`.
64
- 4. Sign the queued request.
65
- 5. Verify with `aomi tx`, `aomi log`, or `aomi status`.
84
+ 3. Review pending requests with `aomi tx list`.
85
+ 4. Sign the queued request with `aomi tx sign <id>`.
86
+ 5. Verify with `aomi tx list`, `aomi session log`, or `aomi session status`.
66
87
 
67
88
  The CLI output is the source of truth. If you do not see `Wallet request queued:
68
89
  tx-N`, there is nothing to sign yet.
@@ -76,10 +97,10 @@ Use these when the user does not need signing:
76
97
  ```bash
77
98
  aomi chat "<message>" --new-session
78
99
  aomi chat "<message>" --verbose
79
- aomi tx
80
- aomi log
81
- aomi status
82
- aomi events
100
+ aomi tx list
101
+ aomi session log
102
+ aomi session status
103
+ aomi session events
83
104
  aomi --version
84
105
  aomi app list
85
106
  aomi app current
@@ -98,7 +119,7 @@ Notes:
98
119
  - Pass `--public-key` on the first wallet-aware chat if the backend needs the user's address.
99
120
  - For chain-specific requests, prefer `--chain <id>` on the command itself. Use `AOMI_CHAIN_ID=<id>` only when multiple consecutive commands should stay on the same chain.
100
121
  - Use `aomi secret list` to inspect configured secret handles for the active session.
101
- - `aomi close` wipes the active local session pointer and starts a fresh thread next time.
122
+ - `aomi session close` wipes the active local session pointer and starts a fresh thread next time.
102
123
 
103
124
  ### Secret Ingestion
104
125
 
@@ -106,19 +127,18 @@ Use this when the backend or selected app needs API keys, provider tokens, or
106
127
  other named secrets for the current session:
107
128
 
108
129
  ```bash
109
- aomi --secret ALCHEMY_API_KEY=sk_live_123 --new-session
110
- aomi --secret ALCHEMY_API_KEY=sk_live_123 chat "simulate a swap on Base" --new-session
130
+ aomi secret add ALCHEMY_API_KEY=sk_live_123 --new-session
131
+ aomi chat "simulate a swap on Base" --new-session
111
132
  aomi secret list
112
133
  aomi secret clear
134
+ aomi secret add NAME=value [NAME=value ...]
113
135
  ```
114
136
 
115
137
  Important behavior:
116
138
 
117
- - `aomi --secret NAME=value` with no command ingests secrets into the active session and exits.
118
- - `aomi --secret NAME=value chat "..."` ingests first, then runs the command.
139
+ - `aomi secret add NAME=value [NAME=value ...]` ingests one or more secrets into the active session.
119
140
  - `aomi secret list` prints secret handle names, not raw values.
120
141
  - `aomi secret clear` removes all secrets for the active session.
121
- - Do not combine `--secret` with `aomi secret clear`.
122
142
 
123
143
  ### Building Wallet Requests
124
144
 
@@ -143,7 +163,7 @@ Important behavior:
143
163
  - A chat response does not always queue a transaction immediately.
144
164
  - The agent may return a quote, route, timing estimate, or deposit method and ask whether to proceed.
145
165
  - When that happens, keep the same session and reply with a short confirmation message.
146
- - Only move to `aomi sign` after a wallet request is queued.
166
+ - Only move to `aomi tx sign` after a wallet request is queued.
147
167
  - For Khalani, prefer a `TRANSFER` deposit method when available. The intended flow is quote -> sign transfer -> submit/continue after the transfer settles.
148
168
  - Avoid Khalani `CONTRACT_CALL` routes that require ERC-20 approval unless the user explicitly wants that path or no transfer route is available.
149
169
 
@@ -154,38 +174,116 @@ Queued request example:
154
174
  to: 0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD
155
175
  value: 1000000000000000000
156
176
  chain: 1
157
- Run `aomi tx` to see pending transactions, `aomi sign <id>` to sign.
177
+ Run `aomi tx list` to see pending transactions, `aomi tx sign <id>` to sign.
158
178
  ```
159
179
 
160
180
  ### Signing Policy
161
181
 
162
182
  Use these rules exactly:
163
183
 
164
- - Default command: `aomi sign <tx-id> [<tx-id> ...]`
165
- - Default behavior: try AA first, retry unsponsored AA when Alchemy sponsorship is unavailable, then fall back to EOA automatically if AA still fails.
166
- - `--aa`: require AA with no EOA fallback.
167
- - `--eoa`: force direct EOA execution.
168
- - `--aa-provider` or `--aa-mode`: AA-specific controls. Use them only when the user explicitly wants a provider or mode.
184
+ - Default command: `aomi tx sign <tx-id> [<tx-id> ...]`
185
+ - Default behavior (**auto-detect**): if an AA provider is configured (env vars, `~/.aomi/aa.json`, or flags), use AA automatically. If no AA provider is configured, use EOA. There is no silent fallback AA either works or fails.
186
+ - **Mode fallback**: when AA is used, the CLI tries the preferred mode (default 7702). If it fails, it tries the alternative mode (4337). If both fail, it returns an error suggesting `--eoa`.
187
+ - `--eoa`: force direct EOA execution, skip AA entirely.
188
+ - `--aa-provider` or `--aa-mode`: AA-specific controls that also force AA mode. Cannot be used with `--eoa`.
169
189
 
170
190
  Examples:
171
191
 
172
192
  ```bash
173
- # Default: AA first, automatic EOA fallback if needed
174
- aomi sign tx-1 --private-key 0xYourPrivateKey --rpc-url https://eth.llamarpc.com
175
-
176
- # Require AA only
177
- aomi sign tx-1 --aa --private-key 0xYourPrivateKey
193
+ # Default: auto-detect. AA if configured, EOA if not.
194
+ aomi tx sign tx-1 --private-key 0xYourPrivateKey --rpc-url https://eth.llamarpc.com
178
195
 
179
196
  # Force EOA only
180
- aomi sign tx-1 --eoa --private-key 0xYourPrivateKey --rpc-url https://eth.llamarpc.com
197
+ aomi tx sign tx-1 --eoa --private-key 0xYourPrivateKey --rpc-url https://eth.llamarpc.com
181
198
 
182
199
  # Explicit AA provider and mode
183
- aomi sign tx-1 --aa-provider pimlico --aa-mode 4337 --private-key 0xYourPrivateKey
200
+ aomi tx sign tx-1 --aa-provider pimlico --aa-mode 4337 --private-key 0xYourPrivateKey
201
+ ```
202
+
203
+ ### Batch Simulation
204
+
205
+ Use `aomi simulate` to dry-run pending transactions before signing. Simulation
206
+ runs each tx sequentially on a forked chain so state-dependent flows (approve →
207
+ swap) are validated as a batch — the swap sees the approve's state changes.
208
+
209
+ ```bash
210
+ # Simulate a single pending tx
211
+ aomi simulate tx-1
212
+
213
+ # Simulate a multi-step batch in order (approve then swap)
214
+ aomi simulate tx-1 tx-2
215
+ ```
216
+
217
+ The response includes per-step success/failure, revert reasons, and gas usage:
218
+
219
+ ```
220
+ Simulation result:
221
+ Batch success: true
222
+ Stateful: true
223
+ Total gas: 147821
224
+
225
+ Step 1 — approve USDC
226
+ success: true
227
+ gas_used: 46000
228
+
229
+ Step 2 — swap on Uniswap
230
+ success: true
231
+ gas_used: 101821
232
+ ```
233
+
234
+ When to simulate:
235
+
236
+ - **Always simulate multi-step flows** (approve → swap, approve → deposit, etc.) before signing. These are state-dependent — the second tx will revert if submitted independently.
237
+ - **Optional for single independent txs** like a simple ETH transfer or a standalone swap with no prior approval needed.
238
+ - If simulation fails at step N, read the revert reason before retrying. Common causes: insufficient balance, expired quote/timestamp, wrong calldata. Do not blindly re-sign after a simulation failure.
239
+
240
+ When not to simulate:
241
+
242
+ - Read-only operations (balances, prices, quotes).
243
+ - If there are no pending transactions (`aomi tx` shows nothing).
244
+
245
+ Simulation and signing workflow:
246
+
247
+ ```bash
248
+ # 1. Build the request
249
+ aomi chat "approve and swap 100 USDC for ETH on Uniswap" \
250
+ --public-key 0xYourAddress --chain 1
251
+
252
+ # 2. Check what got queued
253
+ aomi tx
254
+
255
+ # 3. Simulate the batch
256
+ aomi simulate tx-1 tx-2
257
+
258
+ # 4. If simulation succeeds, sign
259
+ aomi sign tx-1 tx-2 --private-key 0xYourPrivateKey --rpc-url https://eth.llamarpc.com
260
+
261
+ # 5. Verify
262
+ aomi tx
184
263
  ```
185
264
 
265
+ ### Account Abstraction
266
+
267
+ AA is the preferred signing path when the user wants smart-account behavior,
268
+ gas sponsorship, or the CLI's automated fallback handling.
269
+
270
+ Use AA when:
271
+
272
+ - The user wants the most hands-off signing flow and is fine with the CLI trying AA before EOA.
273
+ - The user wants sponsored or user-funded smart-account execution through Alchemy or Pimlico.
274
+ - The user explicitly asks for `4337` or `7702` account-abstraction mode.
275
+
276
+ How to choose:
277
+
278
+ - `aomi sign` with no AA flags: try AA first, then fall back to EOA automatically if AA is unavailable.
279
+ - `aomi sign --aa`: require AA only. Use this when the user does not want an EOA fallback.
280
+ - `aomi sign --eoa`: bypass AA entirely and sign directly with the wallet key.
281
+ - `aomi sign --aa-provider alchemy|pimlico`: force a specific AA provider.
282
+ - `aomi sign --aa-mode 4337|7702`: force the execution mode when the user wants a specific AA path.
283
+
186
284
  More signing notes:
187
285
 
188
- - `aomi sign` handles both transaction requests and EIP-712 typed data signatures.
286
+ - `aomi tx sign` handles both transaction requests and EIP-712 typed data signatures.
189
287
  - Batch signing is supported for transaction requests only, not EIP-712 requests.
190
288
  - A single `--rpc-url` override cannot be used for a mixed-chain multi-sign request.
191
289
  - If the signer address differs from the stored session public key, the CLI updates the session to the signer address.
@@ -205,7 +303,7 @@ More signing notes:
205
303
  aomi session list
206
304
  aomi session resume <id>
207
305
  aomi session delete <id>
208
- aomi close
306
+ aomi session close
209
307
  ```
210
308
 
211
309
  ## Reference: Commands
@@ -227,23 +325,61 @@ aomi chat "<message>" --app khalani --chain 137
227
325
  - Use `--app`, `--model`, and `--chain` to change the active context for the next request.
228
326
  - Prefer `--chain <id>` for one-off chain-specific requests. Use `AOMI_CHAIN_ID=<id>` when several consecutive commands should share the same chain context.
229
327
 
230
- ### Transaction Inspection
328
+ ### Transaction Commands
329
+
330
+ ```bash
331
+ aomi tx list
332
+ aomi tx simulate <id> [<id> ...]
333
+ aomi tx sign <id> [<id> ...]
334
+ ```
335
+
336
+ - `aomi tx list` inspects pending and signed requests.
337
+ - `aomi tx simulate` runs a simulation batch for the given tx IDs.
338
+ - `aomi tx sign` signs and submits one or more queued requests.
339
+
340
+ ### Session Commands
341
+
342
+ ```bash
343
+ aomi session list
344
+ aomi session new
345
+ aomi session resume <id>
346
+ aomi session delete <id>
347
+ aomi session status
348
+ aomi session log
349
+ aomi session events
350
+ aomi session close
351
+ ```
352
+
353
+ - `aomi session status` shows the current session summary.
354
+ - `aomi session log` replays conversation and tool output.
355
+ - `aomi session events` shows raw backend system events.
356
+ - `aomi session close` clears the active local session pointer. The next chat starts fresh.
357
+ - Session selectors accept the backend session ID, `session-N`, or `N`.
358
+
359
+ ### Secret Commands
231
360
 
232
361
  ```bash
233
- aomi tx
234
- aomi log
235
- aomi status
236
- aomi events
237
362
  aomi secret list
238
363
  aomi secret clear
364
+ aomi secret add NAME=value [NAME=value ...]
239
365
  ```
240
366
 
241
- - `aomi tx` inspects pending and signed requests.
242
- - `aomi log` replays conversation and tool output.
243
- - `aomi status` shows the current session summary.
244
- - `aomi events` shows raw backend system events.
245
367
  - `aomi secret list` shows configured secret handles for the active session.
246
368
  - `aomi secret clear` removes all configured secrets for the active session.
369
+ - `aomi secret add` ingests one or more NAME=value secrets.
370
+
371
+ ### Batch Simulation
372
+
373
+ ```bash
374
+ aomi simulate <tx-id> [<tx-id> ...]
375
+ ```
376
+
377
+ - Runs pending transactions sequentially on a forked chain (Anvil snapshot/revert).
378
+ - Each tx sees state changes from previous txs — validates state-dependent flows like approve → swap.
379
+ - Returns per-step success/failure, revert reasons, and `gas_used`.
380
+ - Returns `total_gas` for the entire batch.
381
+ - No on-chain state is modified — the fork is reverted after simulation.
382
+ - Requires pending transactions to exist in the session (`aomi tx` to check).
247
383
 
248
384
  ### App And Model Commands
249
385
 
@@ -260,52 +396,125 @@ aomi model set <rig>
260
396
  - `aomi model set <rig>` persists the selected model for the current session.
261
397
  - `aomi chat --model <rig> "<message>"` also applies a model for the session.
262
398
 
399
+ ### Currently Integrated Apps
400
+
401
+ All apps share a common base toolset (`send_transaction_to_wallet`,
402
+ `encode_and_simulate`, `get_account_info`, `get_contract_abi`, etc.).
403
+ The tools listed below are the app-specific additions.
404
+
405
+ | App | Description | App-Specific Tools | Needs API Key |
406
+ |-----|-------------|-------------------|---------------|
407
+ | `default` | General-purpose on-chain agent with web search | `brave_search` | No |
408
+ | `binance` | Binance CEX — prices, order book, klines | `binance_get_price`, `binance_get_depth`, `binance_get_klines` | Yes (`BINANCE_API_KEY`, `BINANCE_SECRET_KEY`) |
409
+ | `bybit` | Bybit CEX — orders, positions, leverage | `brave_search` (no Bybit-specific tools yet) | Yes (`BYBIT_API_KEY`, `BYBIT_SECRET_KEY`) |
410
+ | `cow` | CoW Protocol — MEV-protected swaps via batch auctions | `get_cow_swap_quote`, `place_cow_order`, `get_cow_order`, `get_cow_order_status`, `get_cow_user_orders` | No |
411
+ | `defillama` | DefiLlama — TVL, yields, volumes, stablecoins | `get_token_price`, `get_yield_opportunities`, `get_defi_protocols`, `get_chain_tvl`, `get_protocol_detail`, `get_dex_volumes`, `get_fees_overview`, `get_protocol_fees`, `get_stablecoins`, `get_stablecoin_chains`, `get_historical_token_price`, `get_token_price_change`, `get_historical_chain_tvl`, `get_dex_protocol_volume`, `get_stablecoin_history`, `get_yield_pool_history` | No |
412
+ | `dune` | Dune Analytics — execute and fetch SQL queries | `execute_query`, `get_execution_status`, `get_execution_results`, `get_query_results` | Yes (`DUNE_API_KEY`) |
413
+ | `dydx` | dYdX perpetuals — markets, orderbook, candles, trades | `dydx_get_markets`, `dydx_get_orderbook`, `dydx_get_candles`, `dydx_get_trades`, `dydx_get_account` | No |
414
+ | `gmx` | GMX perpetuals — markets, positions, orders, prices | `get_gmx_prices`, `get_gmx_signed_prices`, `get_gmx_markets`, `get_gmx_positions`, `get_gmx_orders` | No |
415
+ | `hyperliquid` | Hyperliquid perps — mid prices, orderbook | `get_meta`, `get_all_mids` | No |
416
+ | `kaito` | Kaito — crypto social search, trending, mindshare | `kaito_search`, `kaito_get_trending`, `kaito_get_mindshare` | Yes (`KAITO_API_KEY`) |
417
+ | `kalshi` | Kalshi prediction markets via Simmer SDK | `simmer_register`, `simmer_status`, `simmer_briefing` | Yes (`SIMMER_API_KEY`) |
418
+ | `khalani` | Khalani cross-chain intents — quote, build, submit | `get_khalani_quote`, `build_khalani_order`, `submit_khalani_order`, `get_khalani_order_status`, `get_khalani_orders_by_address` | No |
419
+ | `lifi` | LI.FI aggregator — cross-chain swaps & bridges | `get_lifi_swap_quote`, `place_lifi_order`, `get_lifi_bridge_quote`, `get_lifi_transfer_status`, `get_lifi_chains` | No (optional `LIFI_API_KEY`) |
420
+ | `manifold` | Manifold prediction markets — search, bet, create | `list_markets`, `get_market`, `get_market_positions`, `search_markets`, `place_bet`, `create_market` | Yes (`MANIFOLD_API_KEY`) |
421
+ | `molinar` | Molinar on-chain world — move, explore, chat | `molinar_get_state`, `molinar_look`, `molinar_move`, `molinar_jump`, `molinar_chat`, `molinar_get_chat`, `molinar_get_new_messages`, `molinar_get_players`, `molinar_collect_coins`, `molinar_explore`, `molinar_create_object`, `molinar_customize`, `molinar_ping` | No |
422
+ | `morpho` | Morpho lending — markets, vaults, positions | `get_markets`, `get_vaults`, `get_user_positions` | No |
423
+ | `neynar` | Farcaster social — users, search | `get_user_by_username`, `search_users` | Yes (`NEYNAR_API_KEY`) |
424
+ | `okx` | OKX CEX — tickers, order book, candles | `okx_get_tickers`, `okx_get_order_book`, `okx_get_candles` | Yes (`OKX_API_KEY`, `OKX_SECRET_KEY`, `OKX_PASSPHRASE`) |
425
+ | `oneinch` | 1inch DEX aggregator — quotes, swaps, allowances | `get_oneinch_quote`, `get_oneinch_swap`, `get_oneinch_approve_transaction`, `get_oneinch_allowance`, `get_oneinch_liquidity_sources` | Yes (`ONEINCH_API_KEY`) |
426
+ | `polymarket` | Polymarket prediction markets — search, trade, CLOB | `search_polymarket`, `get_polymarket_details`, `get_polymarket_trades`, `resolve_polymarket_trade_intent`, `build_polymarket_order_preview` | No |
427
+ | `x` | X/Twitter — users, posts, search, trends | `get_x_user`, `get_x_user_posts`, `search_x`, `get_x_trends`, `get_x_post` | Yes (`X_API_KEY`) |
428
+ | `yearn` | Yearn Finance — vault discovery, details | `get_all_vaults`, `get_vault_detail`, `get_blacklisted_vaults` | No |
429
+ | `zerox` | 0x DEX aggregator — swaps, quotes, liquidity | `get_zerox_swap_quote`, `place_zerox_order`, `get_zerox_swap_chains`, `get_zerox_allowance_holder_price`, `get_zerox_liquidity_sources` | Yes (`ZEROX_API_KEY`) |
430
+
431
+ Some apps require API keys via `aomi secret add` (e.g. CEX apps need exchange credentials).
432
+ Use `--app <name>` or `AOMI_APP=<name>` to select an app.
433
+
434
+ To build a new app or update an existing one from an API spec, SDK, or product
435
+ docs, use the companion skill **aomi-build** (install with
436
+ `npx skills add aomi-labs/skills`). It scaffolds Aomi SDK crates with `lib.rs`,
437
+ `client.rs`, and `tool.rs` from OpenAPI specs, REST endpoints, or repository
438
+ examples.
439
+
263
440
  ### Chain Commands
264
441
 
265
442
  ```bash
266
443
  aomi chain list
267
444
  ```
268
445
 
269
- ### Session Commands
446
+ ## Reference: Account Abstraction
270
447
 
271
- ```bash
272
- aomi session list
273
- aomi session new
274
- aomi session resume <id>
275
- aomi session delete <id>
276
- aomi close
277
- ```
448
+ ### Execution Model
278
449
 
279
- - Session selectors accept the backend session ID, `session-N`, or `N`.
280
- - `aomi close` clears the active local session pointer. The next chat starts fresh.
450
+ The CLI uses **auto-detect** by default:
281
451
 
282
- ## Reference: Account Abstraction
452
+ | AA configured? | Flag | Result |
453
+ |---|---|---|
454
+ | Yes | (none) | **AA automatically** (preferred mode → alternative mode fallback) |
455
+ | Yes | `--aa-provider`/`--aa-mode` | AA with explicit settings |
456
+ | Yes | `--eoa` | EOA, skip AA |
457
+ | No | (none) | EOA |
458
+ | No | `--aa-provider` | Error: "AA requires provider credentials" |
459
+
460
+ There is **no silent EOA fallback**. If AA is selected (explicitly or by auto-detect) and both AA modes fail, the CLI returns a hard error suggesting `--eoa`.
461
+
462
+ ### Mode Fallback
283
463
 
284
- ### Signing Modes
464
+ When using AA, the CLI tries modes in order:
465
+
466
+ 1. Try preferred mode (default: 7702 for Ethereum, 4337 for L2s).
467
+ 2. If preferred mode fails, try the alternative mode (7702 ↔ 4337).
468
+ 3. If both modes fail, return error with suggestion: use `--eoa` to sign without AA.
469
+
470
+ ### Persistent AA Configuration
471
+
472
+ AA settings can be persisted to `~/.aomi/aa.json` using the `aomi aa` commands,
473
+ eliminating the need to pass env vars or flags on every sign.
474
+
475
+ ```bash
476
+ # Configure AA provider and credentials
477
+ aomi aa set provider alchemy
478
+ aomi aa set key <your-alchemy-key>
479
+ aomi aa set alchemy-key <your-alchemy-key> # provider-specific key
480
+ aomi aa set pimlico-key <your-pimlico-key> # provider-specific key
481
+ aomi aa set policy <gas-policy-id>
482
+ aomi aa set mode 7702
483
+ aomi aa set fallback eoa
484
+
485
+ # View resolved config (all layers merged)
486
+ aomi aa status
487
+
488
+ # Validate setup against a chain
489
+ aomi aa test --chain 8453
490
+
491
+ # Clear all persisted config
492
+ aomi aa reset
493
+ ```
285
494
 
286
- - Default `aomi sign ...`: try AA first, retry unsponsored Alchemy AA when sponsorship is unavailable, then fall back to EOA automatically.
287
- - `aomi sign ... --aa`: require AA only. Do not fall back to EOA.
288
- - `aomi sign ... --eoa`: force direct EOA signing.
495
+ Priority chain for AA resolution: **flag > env var > `~/.aomi/aa.json` > defaults**.
289
496
 
290
497
  ### AA Providers
291
498
 
292
- | Provider | Flag | Env Var | Notes |
293
- | -------- | ----------------------- | ----------------- | -------------------------------- |
294
- | Alchemy | `--aa-provider alchemy` | `ALCHEMY_API_KEY` | Supports sponsorship, 4337, 7702 |
295
- | Pimlico | `--aa-provider pimlico` | `PIMLICO_API_KEY` | Supports 4337 and 7702 |
499
+ | Provider | Flag | Env Var | Persistent Config | Notes |
500
+ | -------- | ----------------------- | ----------------- | ------------------------- | -------------------------------- |
501
+ | Alchemy | `--aa-provider alchemy` | `ALCHEMY_API_KEY` | `aomi aa set provider alchemy` | 4337 (sponsored via gas policy), 7702 (EOA pays gas) |
502
+ | Pimlico | `--aa-provider pimlico` | `PIMLICO_API_KEY` | `aomi aa set provider pimlico` | 4337 (sponsored via dashboard policy). Direct private key supported. |
296
503
 
297
504
  Provider selection rules:
298
505
 
299
- - If the user explicitly selects a provider, use it.
300
- - In default mode, the CLI prefers the first configured AA provider.
301
- - If no AA provider is configured, default mode uses EOA directly.
506
+ - If the user explicitly selects a provider (flag or persistent config), use it.
507
+ - In auto-detect mode, the CLI uses the first configured AA provider.
508
+ - If no AA provider is configured, auto-detect uses EOA directly.
302
509
 
303
510
  ### AA Modes
304
511
 
305
- | Mode | Flag | Meaning |
306
- | ------ | ---------------- | -------------------------------- |
307
- | `4337` | `--aa-mode 4337` | Bundler-based smart account flow |
308
- | `7702` | `--aa-mode 7702` | Delegated execution flow |
512
+ | Mode | Flag | Meaning | Gas |
513
+ | ------ | ---------------- | -------------------------------- | --- |
514
+ | `4337` | `--aa-mode 4337` | Bundler + paymaster UserOperation via smart account. Gas sponsored by paymaster. | Paymaster pays |
515
+ | `7702` | `--aa-mode 7702` | Native EIP-7702 type-4 transaction with delegation. EOA signs authorization + sends tx to self. | EOA pays |
516
+
517
+ Important: **7702 requires the signing EOA to have native gas tokens** (ETH, MATIC, etc.). There is no paymaster/sponsorship for 7702. Use 4337 for gasless execution.
309
518
 
310
519
  ### Default Chain Modes
311
520
 
@@ -319,19 +528,33 @@ Provider selection rules:
319
528
 
320
529
  ### Sponsorship
321
530
 
322
- Alchemy sponsorship is optional.
531
+ Sponsorship is available for **4337 mode only**. 7702 does not support sponsorship.
532
+
533
+ **Alchemy** (optional gas policy):
323
534
 
324
535
  ```bash
325
536
  export ALCHEMY_API_KEY=your-key
326
537
  export ALCHEMY_GAS_POLICY_ID=your-policy-id
327
- aomi sign tx-1
538
+ aomi tx sign tx-1
328
539
  ```
329
540
 
330
- Default signing behavior for Alchemy:
541
+ Or use persistent config:
542
+
543
+ ```bash
544
+ aomi aa set provider alchemy
545
+ aomi aa set key your-key
546
+ aomi aa set policy your-policy-id
547
+ aomi tx sign tx-1
548
+ ```
549
+
550
+ **Pimlico** (sponsorship via dashboard policy):
551
+
552
+ ```bash
553
+ export PIMLICO_API_KEY=your-key
554
+ aomi tx sign tx-1 --aa-provider pimlico --aa-mode 4337
555
+ ```
331
556
 
332
- 1. Try sponsored AA.
333
- 2. If sponsorship is unavailable, retry AA with user-funded gas.
334
- 3. If AA still fails and the mode is default auto mode, fall back to EOA.
557
+ Pimlico sponsorship is configured on the Pimlico dashboard (sponsorship policies). The API key automatically picks up the active policy — no separate policy ID env var needed.
335
558
 
336
559
  ### Supported Chains
337
560
 
@@ -358,7 +581,7 @@ Use an RPC that matches the pending transaction's chain:
358
581
  Practical rule:
359
582
 
360
583
  - `--chain` affects the wallet/session context for chat and request building.
361
- - `--rpc-url` affects where `aomi sign` estimates and submits the transaction.
584
+ - `--rpc-url` affects where `aomi tx sign` estimates and submits the transaction.
362
585
  - Treat them as separate controls and keep them aligned with the transaction you are signing.
363
586
 
364
587
  ## Reference: Configuration
@@ -366,27 +589,28 @@ Practical rule:
366
589
  ### Flags And Env Vars
367
590
 
368
591
  All config can be passed as flags. Flags override environment variables.
592
+ Environment variables override persistent config (`~/.aomi/aa.json`).
369
593
 
370
594
  | Flag | Env Var | Default | Purpose |
371
595
  | --------------- | ------------------ | ---------------------- | --------------------------------------- |
372
- | `--backend-url` | `AOMI_BACKEND_URL` | `https://api.aomi.dev` | Backend URL |
596
+ | `--backend-url` | `AOMI_BACKEND_URL` | `https://api.aomi.dev` | Backend URL |
373
597
  | `--api-key` | `AOMI_API_KEY` | none | API key for non-default apps |
374
598
  | `--app` | `AOMI_APP` | `default` | Backend app |
375
599
  | `--model` | `AOMI_MODEL` | backend default | Session model |
376
600
  | `--public-key` | `AOMI_PUBLIC_KEY` | none | Wallet address for chat/session context |
377
- | `--private-key` | `PRIVATE_KEY` | none | Signing key for `aomi sign` |
601
+ | `--private-key` | `PRIVATE_KEY` | none | Signing key for `aomi tx sign` |
378
602
  | `--rpc-url` | `CHAIN_RPC_URL` | chain RPC default | RPC override for signing |
379
603
  | `--chain` | `AOMI_CHAIN_ID` | `1` | Active wallet chain |
380
- | `--aa-provider` | `AOMI_AA_PROVIDER` | auto | AA provider override |
604
+ | `--aa-provider` | `AOMI_AA_PROVIDER` | auto-detect | AA provider override |
381
605
  | `--aa-mode` | `AOMI_AA_MODE` | chain default | AA mode override |
382
606
 
383
607
  ### AA Provider Credentials
384
608
 
385
- | Env Var | Purpose |
386
- | ----------------------- | ----------------------------------- |
387
- | `ALCHEMY_API_KEY` | Enables Alchemy AA |
388
- | `ALCHEMY_GAS_POLICY_ID` | Optional Alchemy sponsorship policy |
389
- | `PIMLICO_API_KEY` | Enables Pimlico AA |
609
+ | Env Var | Purpose |
610
+ | ------------------------ | ----------------------------------- |
611
+ | `ALCHEMY_API_KEY` | Enables Alchemy AA (4337 + 7702) |
612
+ | `ALCHEMY_GAS_POLICY_ID` | Optional Alchemy sponsorship policy (4337 only) |
613
+ | `PIMLICO_API_KEY` | Enables Pimlico AA (4337 sponsored) |
390
614
 
391
615
  `ALCHEMY_API_KEY` can also be used to construct chain-specific signing RPCs:
392
616
 
@@ -401,23 +625,25 @@ All config can be passed as flags. Flags override environment variables.
401
625
 
402
626
  ### Storage
403
627
 
404
- | Env Var | Default | Purpose |
405
- | ---------------- | --------- | -------------------------------------- |
406
- | `AOMI_STATE_DIR` | `~/.aomi` | Root directory for local session state |
628
+ | Env Var | Default | Purpose |
629
+ | ----------------- | --------- | -------------------------------------- |
630
+ | `AOMI_STATE_DIR` | `~/.aomi` | Root directory for local session state |
631
+ | `AOMI_CONFIG_DIR` | `~/.aomi` | Root directory for persistent config |
407
632
 
408
633
  Storage layout by default:
409
634
 
410
635
  - `~/.aomi/sessions/` stores per-session JSON files.
411
636
  - `~/.aomi/active-session.txt` stores the active local session pointer.
637
+ - `~/.aomi/aa.json` stores persistent AA configuration.
412
638
 
413
639
  ### Important Config Rules
414
640
 
415
641
  - `PRIVATE_KEY` should start with `0x`.
416
642
  - If `PRIVATE_KEY` is already set in the environment, do not also pass `--private-key` unless you intentionally want to override it.
417
- - `CHAIN_RPC_URL` is only one default RPC URL. For chain switching, prefer passing `--rpc-url` on `aomi sign`.
643
+ - `CHAIN_RPC_URL` is only one default RPC URL. For chain switching, prefer passing `--rpc-url` on `aomi tx sign`.
418
644
  - If the user switches from Ethereum to Polygon, Arbitrum, Base, Optimism, or Sepolia, do not keep using an Ethereum `CHAIN_RPC_URL` for signing.
419
645
  - `--aa-provider` and `--aa-mode` cannot be used with `--eoa`.
420
- - In default signing mode, missing AA credentials cause the CLI to use EOA directly.
646
+ - In auto-detect mode, missing AA credentials cause the CLI to use EOA directly (no error).
421
647
 
422
648
  ## Reference: Examples
423
649
 
@@ -425,7 +651,7 @@ Storage layout by default:
425
651
 
426
652
  ```bash
427
653
  aomi chat "what is the price of ETH?" --verbose
428
- aomi log
654
+ aomi session log
429
655
  ```
430
656
 
431
657
  ### Basic Swap Flow
@@ -440,22 +666,44 @@ aomi chat "swap 1 ETH for USDC on Uniswap" \
440
666
  aomi chat "proceed"
441
667
 
442
668
  # 3. Review the queued request
669
+ aomi tx list
670
+
671
+ # 4. Sign — auto-detects AA if configured, otherwise uses EOA
672
+ aomi tx sign tx-1 \
673
+ --private-key 0xYourPrivateKey \
674
+ --rpc-url https://eth.llamarpc.com
675
+
676
+ # 5. Verify
677
+ aomi tx list
678
+ aomi session log
679
+ ```
680
+
681
+ ### Approve + Swap With Simulation
682
+
683
+ ```bash
684
+ # 1. Build a multi-step request
685
+ aomi chat "approve and swap 500 USDC for ETH on Uniswap" \
686
+ --public-key 0xYourAddress --chain 1
687
+
688
+ # 2. Check queued requests
443
689
  aomi tx
444
690
 
445
- # 4. Sign with default behavior: AA first, then automatic EOA fallback if needed
446
- aomi sign tx-1 \
691
+ # 3. Simulate the batch approve then swap
692
+ aomi simulate tx-1 tx-2
693
+
694
+ # 4. If simulation passes, sign the batch
695
+ aomi sign tx-1 tx-2 \
447
696
  --private-key 0xYourPrivateKey \
448
697
  --rpc-url https://eth.llamarpc.com
449
698
 
450
699
  # 5. Verify
451
700
  aomi tx
452
- aomi log
453
701
  ```
454
702
 
455
703
  ### Explicit EOA Flow
456
704
 
457
705
  ```bash
458
- aomi sign tx-1 \
706
+ aomi tx sign tx-1 \
459
707
  --eoa \
460
708
  --private-key 0xYourPrivateKey \
461
709
  --rpc-url https://eth.llamarpc.com
@@ -464,13 +712,25 @@ aomi sign tx-1 \
464
712
  ### Explicit AA Flow
465
713
 
466
714
  ```bash
467
- aomi sign tx-1 \
468
- --aa \
715
+ aomi tx sign tx-1 \
469
716
  --aa-provider pimlico \
470
717
  --aa-mode 4337 \
471
718
  --private-key 0xYourPrivateKey
472
719
  ```
473
720
 
721
+ ### AA Setup With Persistent Config
722
+
723
+ ```bash
724
+ # One-time setup
725
+ aomi aa set provider alchemy
726
+ aomi aa set key your-alchemy-key
727
+ aomi aa set policy your-gas-policy-id
728
+ aomi aa status
729
+
730
+ # Now all signs auto-use AA — no flags needed
731
+ aomi tx sign tx-1 --private-key 0xYourPrivateKey
732
+ ```
733
+
474
734
  ### Alchemy Sponsorship Flow
475
735
 
476
736
  ```bash
@@ -480,7 +740,7 @@ export PRIVATE_KEY=0xYourPrivateKey
480
740
  export CHAIN_RPC_URL=https://eth.llamarpc.com
481
741
 
482
742
  aomi chat "swap 100 USDC for ETH" --public-key 0xYourAddress --chain 1
483
- aomi sign tx-1
743
+ aomi tx sign tx-1
484
744
  ```
485
745
 
486
746
  ### Switching App And Chain
@@ -488,7 +748,7 @@ aomi sign tx-1
488
748
  ```bash
489
749
  aomi chat "show my balances" --app khalani
490
750
  aomi chat "swap 1 POL for USDC on Polygon" --app khalani --chain 137
491
- aomi tx
751
+ aomi tx list
492
752
  ```
493
753
 
494
754
  ### Khalani Transfer Flow
@@ -501,10 +761,10 @@ aomi chat "swap 0.1 USDC for WETH using Khalani. Prefer a TRANSFER deposit metho
501
761
  aomi chat "proceed with the transfer route"
502
762
 
503
763
  # 3. Review the queued transfer request
504
- aomi tx
764
+ aomi tx list
505
765
 
506
766
  # 4. Sign the transfer
507
- aomi sign tx-1 --private-key 0xYourPrivateKey --rpc-url https://eth.llamarpc.com
767
+ aomi tx sign tx-1 --private-key 0xYourPrivateKey --rpc-url https://eth.llamarpc.com
508
768
 
509
769
  # 5. Continue with the agent if a submit/finalize step is required
510
770
  aomi chat "the transfer has been sent, continue"
@@ -515,10 +775,10 @@ aomi chat "the transfer has been sent, continue"
515
775
  ```bash
516
776
  # Build the request on Polygon
517
777
  aomi chat "swap 0.1 USDC for WETH using Khalani on Polygon" --app khalani --chain 137
518
- aomi tx
778
+ aomi tx list
519
779
 
520
780
  # Sign with a Polygon RPC, even if CHAIN_RPC_URL is still set to Ethereum
521
- aomi sign tx-8 --rpc-url https://polygon.drpc.org --chain 137
781
+ aomi tx sign tx-8 --rpc-url https://polygon.drpc.org --chain 137
522
782
  ```
523
783
 
524
784
  ### Session Control
@@ -526,16 +786,19 @@ aomi sign tx-8 --rpc-url https://polygon.drpc.org --chain 137
526
786
  ```bash
527
787
  aomi session list
528
788
  aomi session resume 2
529
- aomi status
530
- aomi close
789
+ aomi session status
790
+ aomi session close
531
791
  ```
532
792
 
533
793
  ## Troubleshooting
534
794
 
535
- - If `aomi chat` returns `(no response)`, wait briefly and run `aomi status`.
536
- - If signing fails in default mode, the CLI may already retry with unsponsored AA and then EOA. Read the console output before retrying manually.
537
- - If AA is required and fails, check `ALCHEMY_API_KEY` or `PIMLICO_API_KEY`, the selected chain, and any requested `--aa-mode`.
795
+ - If `aomi chat` returns `(no response)`, wait briefly and run `aomi session status`.
796
+ - If AA signing fails, the CLI tries the alternative AA mode automatically. If both modes fail, it returns an error suggesting `--eoa`. Read the console output before retrying manually.
797
+ - If AA is required and fails, check `ALCHEMY_API_KEY` or `PIMLICO_API_KEY`, the selected chain, and any requested `--aa-mode`. Use `aomi aa status` to see the resolved AA config.
538
798
  - If a transaction fails on-chain, check the RPC URL, balance, and chain.
539
- - `401`, `429`, and generic parameter errors during `aomi sign` are often RPC problems rather than transaction-construction problems. Try a reliable RPC for the correct chain.
799
+ - `401`, `429`, and generic parameter errors during `aomi tx sign` are often RPC problems rather than transaction-construction problems. Try a reliable RPC for the correct chain.
540
800
  - If `ALCHEMY_API_KEY` is set, construct the correct chain-specific Alchemy RPC before falling back to random public endpoints.
541
801
  - If one or two public RPCs fail for the same chain, stop rotating through random endpoints and ask the user for a proper RPC URL for that chain.
802
+ - Use `aomi aa test --chain <id>` to validate AA setup for a specific chain before signing.
803
+ - If `aomi simulate` fails with a revert, read the revert reason. Common causes: expired quote or timestamp (re-chat to get a fresh quote), insufficient token balance, or missing prior approval. Do not sign transactions that failed simulation without understanding why.
804
+ - If `aomi simulate` returns `stateful: false`, the backend could not fork the chain — simulation ran each tx independently via `eth_call`, so state-dependent flows (approve → swap) may show false negatives. Retry or check that the backend's Anvil instance is running.