aomi-transact
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAomi Transact
Aomi 交易
Use the CLI as an agent operating procedure, not as a long-running shell.
Each command starts, runs, and exits. Conversation history lives on the
backend. Local session data lives under or .
aomiAOMI_STATE_DIR~/.aomi将该CLI作为Agent操作流程使用,而非长期运行的shell。每条命令启动、运行后即退出。对话历史存储在后端,本地会话数据保存在或路径下。
aomiAOMI_STATE_DIR~/.aomiUse This Skill When
适用场景
- The user wants to chat with the Aomi agent from the terminal.
- The user wants balances, prices, routes, quotes, or transaction status.
- The user wants to build, simulate, confirm, sign, or broadcast wallet requests.
- The user wants to simulate a batch of pending transactions before signing.
- The user wants to inspect or switch apps, models, chains, or sessions.
- The user wants to inject API keys or other backend secrets for the current session.
- 用户想要通过终端与Aomi Agent聊天
- 用户需要查询余额、价格、路径、报价或交易状态
- 用户需要构建、模拟、确认、签名或广播钱包请求
- 用户想要在签名前模拟一批待处理交易
- 用户需要查看或切换应用、模型、链或会话
- 用户想要为当前会话注入API密钥或其他后端密钥
Hard Rules
硬性规则
- Never print secrets verbatim in normal status, preflight, or confirmation output.
- Treat ,
PRIVATE_KEY,AOMI_API_KEY,ALCHEMY_API_KEY, and private RPC URLs as secrets.PIMLICO_API_KEY - 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.
- Prefer over stuffing provider API keys into normal chat text.
aomi --secret NAME=value ... - Do not sign anything unless the CLI has actually queued a wallet request and you can identify its ID.
tx-N - When starting work from a new Codex or assistant chat thread, default the first Aomi command to unless the user explicitly wants to continue an existing session.
--new-session - If is set in the environment, do not also pass
PRIVATE_KEYunless you intentionally want to override the environment value.--private-key - must match the address derived from the signing key. If they differ,
--public-keywill update the session to the signer address.aomi sign - Private keys must start with . Add the prefix if missing.
0x - is only one default RPC URL. When switching chains, prefer passing
CHAIN_RPC_URLon--rpc-url.aomi sign - Switching the chat/session chain with does not switch
--chain. The RPC used forCHAIN_RPC_URLmust match the pending transaction's chain.aomi sign - and
--aa-providerare AA-only controls and cannot be used with--aa-mode.--eoa
- 禁止在常规状态、预检查或确认输出中原样打印密钥
- 将、
PRIVATE_KEY、AOMI_API_KEY、ALCHEMY_API_KEY和私有RPC URL视为机密信息PIMLICO_API_KEY - 如果用户提供了私钥或API密钥,除非用户明确要求重新格式化该特定值,否则不要回显
- 优先使用格式,而非将服务商API密钥填入普通聊天文本中
aomi --secret NAME=value ... - 除非CLI已实际将钱包请求加入队列且你能识别其ID,否则不要签署任何内容
tx-N - 从新的Codex或助手聊天线程开始工作时,默认第一条Aomi命令添加参数,除非用户明确想要延续现有会话
--new-session - 如果环境中已设置,不要额外传递
PRIVATE_KEY参数,除非你有意覆盖环境变量值--private-key - 必须与签名密钥派生的地址匹配。如果二者不一致,
--public-key会将会话更新为签名者地址aomi sign - 私钥必须以开头,如果缺失请补充该前缀
0x - 仅为默认RPC URL,切换链时优先在
CHAIN_RPC_URL命令中传递aomi sign参数--rpc-url - 使用切换聊天/会话链不会修改
--chain,CHAIN_RPC_URL使用的RPC必须与待处理交易的链匹配aomi sign - 和
--aa-provider是仅适用于AA的控制参数,不可与--aa-mode同时使用--eoa
Quick Start
快速开始
Run this once at the start of the session:
bash
aomi --version
aomi status 2>/dev/null || echo "no session"If the user is asking for a read-only result, that may be enough. If they want
to build or sign a transaction, continue with the workflow below.
会话开始时执行一次以下命令:
bash
aomi --version
aomi status 2>/dev/null || echo "no session"如果用户只需要只读结果,以上命令可能已经足够。如果用户需要构建或签署交易,请继续使用以下工作流。
Default Workflow
默认工作流
- Chat with the agent.
- If the agent asks whether to proceed, send a short confirmation in the same session.
- Review pending requests with .
aomi tx - For multi-step flows (e.g. approve → swap), simulate before signing: .
aomi simulate tx-1 tx-2 - Sign the queued request(s).
- Verify with ,
aomi tx, oraomi log.aomi status
The CLI output is the source of truth. If you do not see , there is nothing to sign yet.
Wallet request queued: tx-N- 与Agent聊天
- 如果Agent询问是否继续,在同一会话中发送简短确认信息
- 使用查看待处理请求
aomi tx - 对于多步骤流程(如授权→兑换),签名前先模拟:
aomi simulate tx-1 tx-2 - 签名队列中的请求
- 使用、
aomi tx或aomi log验证结果aomi status
CLI输出是唯一可信来源。如果你没有看到提示,说明当前没有可签名的内容。
Wallet request queued: tx-NWorkflow Details
工作流详情
Read-Only Requests
只读请求
Use these when the user does not need signing:
bash
aomi chat "<message>" --new-session
aomi chat "<message>" --verbose
aomi tx
aomi log
aomi status
aomi events
aomi --version
aomi app list
aomi app current
aomi model list
aomi model current
aomi chain list
aomi session list
aomi session resume <id>Notes:
- Quote the chat message.
- On the first command in a new Codex or assistant thread, prefer so old local/backend state does not bleed into the new task.
--new-session - Use when debugging tool calls or streaming behavior.
--verbose - Pass on the first wallet-aware chat if the backend needs the user's address.
--public-key - For chain-specific requests, prefer on the command itself. Use
--chain <id>only when multiple consecutive commands should stay on the same chain.AOMI_CHAIN_ID=<id> - Use to inspect configured secret handles for the active session.
aomi secret list - wipes the active local session pointer and starts a fresh thread next time.
aomi close
当用户不需要签名时使用以下命令:
bash
aomi chat "<message>" --new-session
aomi chat "<message>" --verbose
aomi tx
aomi log
aomi status
aomi events
aomi --version
aomi app list
aomi app current
aomi model list
aomi model current
aomi chain list
aomi session list
aomi session resume <id>注意事项:
- 聊天消息需要加引号
- 在新的Codex或助手线程中执行第一条命令时,优先使用参数,避免旧的本地/后端状态混入新任务
--new-session - 调试工具调用或流式行为时使用参数
--verbose - 如果后端需要用户地址,在第一次钱包相关的聊天命令中传递参数
--public-key - 对于特定链的请求,优先在命令中使用参数,仅当多个连续命令需要保持在同一链上时才使用
--chain <id>环境变量AOMI_CHAIN_ID=<id> - 使用查看当前会话已配置的密钥句柄
aomi secret list - 会清除当前活跃的本地会话指针,下次聊天时将开启全新线程
aomi close
Secret Ingestion
密钥录入
Use this when the backend or selected app needs API keys, provider tokens, or
other named secrets for the current session:
bash
aomi --secret ALCHEMY_API_KEY=sk_live_123 --new-session
aomi --secret ALCHEMY_API_KEY=sk_live_123 chat "simulate a swap on Base" --new-session
aomi secret list
aomi secret clearImportant behavior:
- with no command ingests secrets into the active session and exits.
aomi --secret NAME=value - ingests first, then runs the command.
aomi --secret NAME=value chat "..." - prints secret handle names, not raw values.
aomi secret list - removes all secrets for the active session.
aomi secret clear - Do not combine with
--secret.aomi secret clear
当后端或选中的应用需要API密钥、服务商令牌或其他当前会话使用的命名密钥时使用以下命令:
bash
aomi --secret ALCHEMY_API_KEY=sk_live_123 --new-session
aomi --secret ALCHEMY_API_KEY=sk_live_123 chat "simulate a swap on Base" --new-session
aomi secret list
aomi secret clear重要特性:
- 不带子命令的会将密钥录入当前活跃会话后直接退出
aomi --secret NAME=value - 会先录入密钥,再执行后续命令
aomi --secret NAME=value chat "..." - 仅打印密钥句柄名称,不会输出原始值
aomi secret list - 会移除当前活跃会话的所有密钥
aomi secret clear - 不要将与
--secret同时使用aomi secret clear
Building Wallet Requests
构建钱包请求
Use the first chat turn to give the agent the task and, if relevant, the wallet
address and chain:
bash
aomi chat "swap 1 ETH for USDC" --new-session --public-key 0xYourAddress --chain 1If the user wants a different backend app or chain, pass them explicitly on the
next command:
bash
aomi chat "show my balances" --app khalani
aomi chat "swap 1 POL for USDC on Polygon" --chain 137
aomi chat "swap 1 POL for USDC on Polygon" --app khalani --chain 137Important behavior:
- A chat response does not always queue a transaction immediately.
- The agent may return a quote, route, timing estimate, or deposit method and ask whether to proceed.
- When that happens, keep the same session and reply with a short confirmation message.
- Only move to after a wallet request is queued.
aomi sign - For Khalani, prefer a deposit method when available. The intended flow is quote -> sign transfer -> submit/continue after the transfer settles.
TRANSFER - Avoid Khalani routes that require ERC-20 approval unless the user explicitly wants that path or no transfer route is available.
CONTRACT_CALL
Queued request example:
⚡ Wallet request queued: tx-1
to: 0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD
value: 1000000000000000000
chain: 1
Run `aomi tx` to see pending transactions, `aomi sign <id>` to sign.使用第一次聊天对话向Agent下达任务,如果相关的话同时传递钱包地址和链信息:
bash
aomi chat "swap 1 ETH for USDC" --new-session --public-key 0xYourAddress --chain 1如果用户需要使用不同的后端应用或链,请在下一条命令中显式传递:
bash
aomi chat "show my balances" --app khalani
aomi chat "swap 1 POL for USDC on Polygon" --chain 137
aomi chat "swap 1 POL for USDC on Polygon" --app khalani --chain 137重要特性:
- 聊天响应不会总是立即将交易加入队列
- Agent可能返回报价、路径、时间预估或存款方式并询问是否继续
- 出现这种情况时,保持同一会话并回复简短确认信息即可
- 仅当钱包请求加入队列后再执行命令
aomi sign - 对于Khalani,可用时优先选择存款方式,预期流程为:报价→签名转账→转账确认后提交/继续
TRANSFER - 避免使用需要ERC-20授权的Khalani 路径,除非用户明确要求该路径或没有可用的转账路径
CONTRACT_CALL
队列请求示例:
⚡ Wallet request queued: tx-1
to: 0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD
value: 1000000000000000000
chain: 1
Run `aomi tx` to see pending transactions, `aomi sign <id>` to sign.Signing Policy
签名规则
Use these rules exactly:
- Default command:
aomi sign <tx-id> [<tx-id> ...] - Default behavior: try account abstraction (AA) first, retry unsponsored AA when Alchemy sponsorship is unavailable, then fall back to EOA automatically if AA still fails.
- : require AA with no EOA fallback.
--aa - : force direct EOA execution.
--eoa - or
--aa-provider: AA-specific controls. Use them only when the user explicitly wants a provider or mode.--aa-mode
Examples:
bash
undefined严格遵循以下规则:
- 默认命令:
aomi sign <tx-id> [<tx-id> ...] - 默认行为:优先尝试账户抽象(AA),Alchemy赞助不可用时重试无赞助AA,若AA仍失败则自动回退到EOA
- :仅使用AA,不回退到EOA
--aa - :强制直接使用EOA执行
--eoa - 或
--aa-provider:AA专属控制参数,仅当用户明确指定服务商或模式时使用--aa-mode
示例:
bash
undefinedDefault: AA first, automatic EOA fallback if needed
默认:优先AA,必要时自动回退到EOA
aomi sign tx-1 --private-key 0xYourPrivateKey --rpc-url https://eth.llamarpc.com
aomi sign tx-1 --private-key 0xYourPrivateKey --rpc-url https://eth.llamarpc.com
Require AA only
仅使用AA
aomi sign tx-1 --aa --private-key 0xYourPrivateKey
aomi sign tx-1 --aa --private-key 0xYourPrivateKey
Force EOA only
强制仅使用EOA
aomi sign tx-1 --eoa --private-key 0xYourPrivateKey --rpc-url https://eth.llamarpc.com
aomi sign tx-1 --eoa --private-key 0xYourPrivateKey --rpc-url https://eth.llamarpc.com
Explicit AA provider and mode
显式指定AA服务商和模式
aomi sign tx-1 --aa-provider pimlico --aa-mode 4337 --private-key 0xYourPrivateKey
undefinedaomi sign tx-1 --aa-provider pimlico --aa-mode 4337 --private-key 0xYourPrivateKey
undefinedBatch Simulation
批量模拟
Use to dry-run pending transactions before signing. Simulation
runs each tx sequentially on a forked chain so state-dependent flows (approve →
swap) are validated as a batch — the swap sees the approve's state changes.
aomi simulatebash
undefined签名前使用对代签交易进行 dry-run。模拟会在分叉链上按顺序执行每笔交易,因此依赖状态的流程(授权→兑换)可以作为批量进行验证——兑换操作可以看到授权带来的状态变化。
aomi simulatebash
undefinedSimulate a single pending tx
模拟单条待处理交易
aomi simulate tx-1
aomi simulate tx-1
Simulate a multi-step batch in order (approve then swap)
按顺序模拟多步骤批量交易(先授权后兑换)
aomi simulate tx-1 tx-2
The response includes per-step success/failure, revert reasons, and gas usage:
Simulation result:
Batch success: true
Stateful: true
Total gas: 147821
Step 1 — approve USDC
success: true
gas_used: 46000
Step 2 — swap on Uniswap
success: true
gas_used: 101821
When to simulate:
- **Always simulate multi-step flows** (approve → swap, approve → deposit, etc.) before signing. These are state-dependent — the second tx will revert if submitted independently.
- **Optional for single independent txs** like a simple ETH transfer or a standalone swap with no prior approval needed.
- 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.
When not to simulate:
- Read-only operations (balances, prices, quotes).
- If there are no pending transactions (`aomi tx` shows nothing).
Simulation and signing workflow:
```bashaomi simulate tx-1 tx-2
响应包含每一步的成功/失败状态、回退原因和gas使用量:
Simulation result:
Batch success: true
Stateful: true
Total gas: 147821
Step 1 — approve USDC
success: true
gas_used: 46000
Step 2 — swap on Uniswap
success: true
gas_used: 101821
何时需要模拟:
- **多步骤流程必须模拟**(授权→兑换、授权→存款等)后再签名。这些流程依赖状态——第二笔交易如果单独提交会回退
- **单条独立交易可选模拟**,比如简单的ETH转账或不需要前置授权的独立兑换
- 如果模拟在第N步失败,重试前请先阅读回退原因。常见原因包括:余额不足、报价/时间戳过期、calldata错误。模拟失败后不要盲目重新签名
何时不需要模拟:
- 只读操作(余额、价格、报价查询)
- 没有待处理交易时(`aomi tx`无输出)
模拟和签名工作流:
```bash1. Build the request
1. 构建请求
aomi chat "approve and swap 100 USDC for ETH on Uniswap"
--public-key 0xYourAddress --chain 1
--public-key 0xYourAddress --chain 1
aomi chat "approve and swap 100 USDC for ETH on Uniswap"
--public-key 0xYourAddress --chain 1
--public-key 0xYourAddress --chain 1
2. Check what got queued
2. 检查队列中的请求
aomi tx
aomi tx
3. Simulate the batch
3. 模拟批量交易
aomi simulate tx-1 tx-2
aomi simulate tx-1 tx-2
4. If simulation succeeds, sign
4. 模拟成功后签名
aomi sign tx-1 tx-2 --private-key 0xYourPrivateKey --rpc-url https://eth.llamarpc.com
aomi sign tx-1 tx-2 --private-key 0xYourPrivateKey --rpc-url https://eth.llamarpc.com
5. Verify
5. 验证结果
aomi tx
undefinedaomi tx
undefinedAccount Abstraction
账户抽象
AA is the preferred signing path when the user wants smart-account behavior,
gas sponsorship, or the CLI's automated fallback handling.
Use AA when:
- The user wants the most hands-off signing flow and is fine with the CLI trying AA before EOA.
- The user wants sponsored or user-funded smart-account execution through Alchemy or Pimlico.
- The user explicitly asks for or
4337account-abstraction mode.7702
How to choose:
- with no AA flags: try AA first, then fall back to EOA automatically if AA is unavailable.
aomi sign - : require AA only. Use this when the user does not want an EOA fallback.
aomi sign --aa - : bypass AA entirely and sign directly with the wallet key.
aomi sign --eoa - : force a specific AA provider.
aomi sign --aa-provider alchemy|pimlico - : force the execution mode when the user wants a specific AA path.
aomi sign --aa-mode 4337|7702
More signing notes:
- handles both transaction requests and EIP-712 typed data signatures.
aomi sign - Batch signing is supported for transaction requests only, not EIP-712 requests.
- A single override cannot be used for a mixed-chain multi-sign request.
--rpc-url - If the signer address differs from the stored session public key, the CLI updates the session to the signer address.
- The pending transaction already contains its target chain. Use a signing RPC for that same chain.
- If points to Ethereum but the pending transaction is on Polygon, Arbitrum, Base, Optimism, or Sepolia, override it with a matching
CHAIN_RPC_URL.--rpc-url - Prefer a reliable chain-specific RPC over generic public RPCs, which may return ,
401, or generic parameter errors.429 - If is available, prefer constructing the matching chain-specific Alchemy RPC before trying generic public RPCs.
ALCHEMY_API_KEY - If the available RPC looks unreliable, try at most one or two reasonable chain-specific public RPCs, then ask the user for a proper provider-backed RPC URL for that chain instead of continuing to guess.
当用户需要智能账户行为、gas赞助或CLI的自动回退处理时,AA是优先选择的签名路径。
适用场景:
- 用户想要最省心的签名流程,接受CLI优先尝试AA再回退到EOA的逻辑
- 用户想要通过Alchemy或Pimlico实现赞助或用户出资的智能账户执行
- 用户明确要求或
4337账户抽象模式7702
选择方式:
- 不带AA标记的:优先尝试AA,AA不可用时自动回退到EOA
aomi sign - :仅允许使用AA,用户不想要EOA回退时使用
aomi sign --aa - :完全绕过AA,直接使用钱包密钥签名
aomi sign --eoa - :强制使用指定的AA服务商
aomi sign --aa-provider alchemy|pimlico - :用户需要特定AA路径时强制指定执行模式
aomi sign --aa-mode 4337|7702
更多签名注意事项:
- 同时支持交易请求和EIP-712类型数据签名
aomi sign - 仅交易请求支持批量签名,EIP-712请求不支持
- 跨多链的混合签名请求不能使用单一覆盖
--rpc-url - 如果签名者地址与存储的会话公钥不同,CLI会将会话更新为签名者地址
- 待处理交易已包含目标链信息,请使用对应链的签名RPC
- 如果指向以太坊,但待处理交易在Polygon、Arbitrum、Base、Optimism或Sepolia上,请使用匹配的
CHAIN_RPC_URL覆盖--rpc-url - 优先使用可靠的链专属RPC,而非通用公共RPC,后者可能返回、
401或通用参数错误429 - 如果有可用的,优先构建对应链的Alchemy RPC,再尝试通用公共RPC
ALCHEMY_API_KEY - 如果可用的RPC看起来不可靠,最多尝试1-2个合理的链专属公共RPC,之后请向用户索要对应链的正规服务商RPC URL,不要继续猜测
Session And Storage Notes
会话和存储注意事项
- Active session, app, model, chain, pending txs, and signed txs are stored locally under or
AOMI_STATE_DIR.~/.aomi - Session files live under by default and get local IDs like
~/.aomi/sessions/.session-1 - Useful commands:
bash
aomi session list
aomi session resume <id>
aomi session delete <id>
aomi close- 活跃会话、应用、模型、链、待处理交易、已签名交易都存储在本地或
AOMI_STATE_DIR路径下~/.aomi - 会话文件默认存储在下,本地ID格式为
~/.aomi/sessions/session-1 - 常用命令:
bash
aomi session list
aomi session resume <id>
aomi session delete <id>
aomi closeReference: Commands
参考:命令
Chat
聊天
bash
aomi chat "<message>" --new-session
aomi chat "<message>" --verbose
aomi chat "<message>" --model <rig>
aomi chat "<message>" --public-key 0xYourAddress --chain 1
aomi chat "<message>" --app khalani --chain 137- Quote the message.
- On the first command in a new Codex or assistant thread, prefer .
--new-session - Use to stream tool calls and agent output.
--verbose - Use on the first wallet-aware message.
--public-key - Use ,
--app, and--modelto change the active context for the next request.--chain - Prefer for one-off chain-specific requests. Use
--chain <id>when several consecutive commands should share the same chain context.AOMI_CHAIN_ID=<id>
bash
aomi chat "<message>" --new-session
aomi chat "<message>" --verbose
aomi chat "<message>" --model <rig>
aomi chat "<message>" --public-key 0xYourAddress --chain 1
aomi chat "<message>" --app khalani --chain 137- 消息需要加引号
- 在新的Codex或助手线程中执行第一条命令时,优先使用参数
--new-session - 使用可以流式输出工具调用和Agent结果
--verbose - 第一条钱包相关消息使用参数
--public-key - 使用、
--app和--model修改下一次请求的活跃上下文--chain - 单次链专属请求优先使用,多个连续命令需要共享同一链上下文时使用
--chain <id>AOMI_CHAIN_ID=<id>
Transaction Inspection
交易查看
bash
aomi tx
aomi log
aomi status
aomi events
aomi secret list
aomi secret clear- inspects pending and signed requests.
aomi tx - replays conversation and tool output.
aomi log - shows the current session summary.
aomi status - shows raw backend system events.
aomi events - shows configured secret handles for the active session.
aomi secret list - removes all configured secrets for the active session.
aomi secret clear
bash
aomi tx
aomi log
aomi status
aomi events
aomi secret list
aomi secret clear- 查看待处理和已签名的请求
aomi tx - 回放对话和工具输出
aomi log - 显示当前会话摘要
aomi status - 显示原始后端系统事件
aomi events - 显示当前会话已配置的密钥句柄
aomi secret list - 移除当前会话所有已配置的密钥
aomi secret clear
Batch Simulation
批量模拟
bash
aomi simulate <tx-id> [<tx-id> ...]- Runs pending transactions sequentially on a forked chain (Anvil snapshot/revert).
- Each tx sees state changes from previous txs — validates state-dependent flows like approve → swap.
- Returns per-step success/failure, revert reasons, and .
gas_used - Returns for the entire batch.
total_gas - No on-chain state is modified — the fork is reverted after simulation.
- Requires pending transactions to exist in the session (to check).
aomi tx
bash
aomi simulate <tx-id> [<tx-id> ...]- 在分叉链上按顺序执行待处理交易(Anvil快照/回退)
- 每笔交易可以看到之前交易带来的状态变化——可验证授权→兑换这类依赖状态的流程
- 返回每一步的成功/失败状态、回退原因和
gas_used - 返回整个批量的
total_gas - 不会修改链上状态——模拟结束后分叉会被回退
- 需要会话中存在待处理交易(可通过检查)
aomi tx
App And Model Commands
应用和模型命令
bash
aomi app list
aomi app current
aomi model list
aomi model current
aomi model set <rig>- shows available backend apps.
aomi app list - shows the active app from local session state.
aomi app current - persists the selected model for the current session.
aomi model set <rig> - also applies a model for the session.
aomi chat --model <rig> "<message>"
bash
aomi app list
aomi app current
aomi model list
aomi model current
aomi model set <rig>- 显示可用的后端应用
aomi app list - 显示本地会话状态中的活跃应用
aomi app current - 为当前会话持久化选中的模型
aomi model set <rig> - 也可以为会话应用指定模型
aomi chat --model <rig> "<message>"
Chain Commands
链命令
bash
aomi chain listbash
aomi chain listSession Commands
会话命令
bash
aomi session list
aomi session new
aomi session resume <id>
aomi session delete <id>
aomi close- Session selectors accept the backend session ID, , or
session-N.N - clears the active local session pointer. The next chat starts fresh.
aomi close
bash
aomi session list
aomi session new
aomi session resume <id>
aomi session delete <id>
aomi close- 会话选择器支持后端会话ID、或
session-N格式N - 清除活跃本地会话指针,下次聊天将开启全新会话
aomi close
Reference: Account Abstraction
参考:账户抽象
Signing Modes
签名模式
- Default : try AA first, retry unsponsored Alchemy AA when sponsorship is unavailable, then fall back to EOA automatically.
aomi sign ... - : require AA only. Do not fall back to EOA.
aomi sign ... --aa - : force direct EOA signing.
aomi sign ... --eoa
- 默认:优先尝试AA,赞助不可用时重试无赞助Alchemy AA,之后自动回退到EOA
aomi sign ... - :仅允许使用AA,不回退到EOA
aomi sign ... --aa - :强制直接使用EOA签名
aomi sign ... --eoa
AA Providers
AA服务商
| Provider | Flag | Env Var | Notes |
|---|---|---|---|
| Alchemy | | | Supports sponsorship, 4337, 7702 |
| Pimlico | | | Supports 4337 and 7702 |
Provider selection rules:
- If the user explicitly selects a provider, use it.
- In default mode, the CLI prefers the first configured AA provider.
- If no AA provider is configured, default mode uses EOA directly.
| 服务商 | 标记 | 环境变量 | 说明 |
|---|---|---|---|
| Alchemy | | | 支持赞助、4337、7702 |
| Pimlico | | | 支持4337和7702 |
服务商选择规则:
- 如果用户明确选择了服务商,使用指定服务商
- 默认模式下,CLI优先使用第一个配置的AA服务商
- 如果没有配置AA服务商,默认模式直接使用EOA
AA Modes
AA模式
| Mode | Flag | Meaning |
|---|---|---|
| | Bundler-based smart account flow |
| | Delegated execution flow |
| 模式 | 标记 | 含义 |
|---|---|---|
| | 基于Bundler的智能账户流程 |
| | 委托执行流程 |
Default Chain Modes
默认链模式
| Chain | ID | Default AA Mode |
|---|---|---|
| Ethereum | 1 | 7702 |
| Polygon | 137 | 4337 |
| Arbitrum | 42161 | 4337 |
| Base | 8453 | 4337 |
| Optimism | 10 | 4337 |
| 链 | ID | 默认AA模式 |
|---|---|---|
| Ethereum | 1 | 7702 |
| Polygon | 137 | 4337 |
| Arbitrum | 42161 | 4337 |
| Base | 8453 | 4337 |
| Optimism | 10 | 4337 |
Sponsorship
赞助
Alchemy sponsorship is optional.
bash
export ALCHEMY_API_KEY=your-key
export ALCHEMY_GAS_POLICY_ID=your-policy-id
aomi sign tx-1Default signing behavior for Alchemy:
- Try sponsored AA.
- If sponsorship is unavailable, retry AA with user-funded gas.
- If AA still fails and the mode is default auto mode, fall back to EOA.
Alchemy赞助是可选功能。
bash
export ALCHEMY_API_KEY=your-key
export ALCHEMY_GAS_POLICY_ID=your-policy-id
aomi sign tx-1Alchemy默认签名行为:
- 尝试赞助AA
- 如果赞助不可用,重试用户出资gas的AA
- 如果AA仍失败且模式为默认自动模式,回退到EOA
Supported Chains
支持的链
| Chain | ID |
|---|---|
| Ethereum | 1 |
| Polygon | 137 |
| Arbitrum One | 42161 |
| Base | 8453 |
| Optimism | 10 |
| Sepolia | 11155111 |
| 链 | ID |
|---|---|
| Ethereum | 1 |
| Polygon | 137 |
| Arbitrum One | 42161 |
| Base | 8453 |
| Optimism | 10 |
| Sepolia | 11155111 |
RPC Guidance By Chain
按链选择RPC指南
Use an RPC that matches the pending transaction's chain:
- Ethereum txs -> Ethereum RPC
- Polygon txs -> Polygon RPC
- Arbitrum txs -> Arbitrum RPC
- Base txs -> Base RPC
- Optimism txs -> Optimism RPC
- Sepolia txs -> Sepolia RPC
Practical rule:
- affects the wallet/session context for chat and request building.
--chain - affects where
--rpc-urlestimates and submits the transaction.aomi sign - Treat them as separate controls and keep them aligned with the transaction you are signing.
使用与待处理交易链匹配的RPC:
- 以太坊交易 -> 以太坊RPC
- Polygon交易 -> Polygon RPC
- Arbitrum交易 -> Arbitrum RPC
- Base交易 -> Base RPC
- Optimism交易 -> Optimism RPC
- Sepolia交易 -> Sepolia RPC
实用规则:
- 影响聊天和请求构建的钱包/会话上下文
--chain - 影响
--rpc-url预估和提交交易的节点地址aomi sign - 将二者视为独立控制参数,保持与你要签名的交易对齐
Reference: Configuration
参考:配置
Flags And Env Vars
标记和环境变量
All config can be passed as flags. Flags override environment variables.
| Flag | Env Var | Default | Purpose |
|---|---|---|---|
| | | Backend URL |
| | none | API key for non-default apps |
| | | Backend app |
| | backend default | Session model |
| | none | Wallet address for chat/session context |
| | none | Signing key for |
| | chain RPC default | RPC override for signing |
| | | Active wallet chain |
| | auto | AA provider override |
| | chain default | AA mode override |
所有配置都可以通过标记传递,标记优先级高于环境变量。
| 标记 | 环境变量 | 默认值 | 用途 |
|---|---|---|---|
| | | 后端URL |
| | 无 | 非默认应用的API密钥 |
| | | 后端应用 |
| | 后端默认 | 会话模型 |
| | 无 | 聊天/会话上下文的钱包地址 |
| | 无 | |
| | 链RPC默认 | 签名用RPC覆盖 |
| | | 活跃钱包链 |
| | 自动 | AA服务商覆盖 |
| | 链默认 | AA模式覆盖 |
AA Provider Credentials
AA服务商凭证
| Env Var | Purpose |
|---|---|
| Enables Alchemy AA |
| Optional Alchemy sponsorship policy |
| Enables Pimlico AA |
ALCHEMY_API_KEY| Chain | Example Alchemy RPC |
|---|---|
| Ethereum | |
| Polygon | |
| Arbitrum | |
| Base | |
| Optimism | |
| Sepolia | |
| 环境变量 | 用途 |
|---|---|
| 启用Alchemy AA |
| 可选Alchemy赞助政策 |
| 启用Pimlico AA |
ALCHEMY_API_KEY| 链 | Alchemy RPC示例 |
|---|---|
| Ethereum | |
| Polygon | |
| Arbitrum | |
| Base | |
| Optimism | |
| Sepolia | |
Storage
存储
| Env Var | Default | Purpose |
|---|---|---|
| | Root directory for local session state |
Storage layout by default:
- stores per-session JSON files.
~/.aomi/sessions/ - stores the active local session pointer.
~/.aomi/active-session.txt
| 环境变量 | 默认值 | 用途 |
|---|---|---|
| | 本地会话状态的根目录 |
默认存储结构:
- 存储单会话JSON文件
~/.aomi/sessions/ - 存储活跃本地会话指针
~/.aomi/active-session.txt
Important Config Rules
重要配置规则
- should start with
PRIVATE_KEY.0x - If is already set in the environment, do not also pass
PRIVATE_KEYunless you intentionally want to override it.--private-key - is only one default RPC URL. For chain switching, prefer passing
CHAIN_RPC_URLon--rpc-url.aomi sign - If the user switches from Ethereum to Polygon, Arbitrum, Base, Optimism, or Sepolia, do not keep using an Ethereum for signing.
CHAIN_RPC_URL - and
--aa-providercannot be used with--aa-mode.--eoa - In default signing mode, missing AA credentials cause the CLI to use EOA directly.
- 必须以
PRIVATE_KEY开头0x - 如果环境中已设置,不要额外传递
PRIVATE_KEY参数,除非你有意覆盖它--private-key - 仅为默认RPC URL,切换链时优先在
CHAIN_RPC_URL命令中传递aomi sign参数--rpc-url - 如果用户从以太坊切换到Polygon、Arbitrum、Base、Optimism或Sepolia,不要继续使用以太坊进行签名
CHAIN_RPC_URL - 和
--aa-provider不可与--aa-mode同时使用--eoa - 默认签名模式下,缺失AA凭证会导致CLI直接使用EOA
Reference: Examples
参考:示例
Read-Only Chat
只读聊天
bash
aomi chat "what is the price of ETH?" --verbose
aomi logbash
aomi chat "what is the price of ETH?" --verbose
aomi logBasic Swap Flow
基础兑换流程
bash
undefinedbash
undefined1. Start a wallet-aware session on Ethereum
1. 在以太坊上开启钱包感知会话
aomi chat "swap 1 ETH for USDC on Uniswap"
--public-key 0xYourAddress
--chain 1
--public-key 0xYourAddress
--chain 1
aomi chat "swap 1 ETH for USDC on Uniswap"
--public-key 0xYourAddress
--chain 1
--public-key 0xYourAddress
--chain 1
2. If the agent only returns a quote, confirm in the same session
2. 如果Agent仅返回报价,在同一会话中确认
aomi chat "proceed"
aomi chat "proceed"
3. Review the queued request
3. 查看队列中的请求
aomi tx
aomi tx
4. Sign with default behavior: AA first, then automatic EOA fallback if needed
4. 使用默认行为签名:优先AA,必要时自动回退到EOA
5. Verify
5. 验证结果
aomi tx
aomi log
undefinedaomi tx
aomi log
undefinedApprove + Swap With Simulation
带模拟的授权+兑换流程
bash
undefinedbash
undefined1. Build a multi-step request
1. 构建多步骤请求
aomi chat "approve and swap 500 USDC for ETH on Uniswap"
--public-key 0xYourAddress --chain 1
--public-key 0xYourAddress --chain 1
aomi chat "approve and swap 500 USDC for ETH on Uniswap"
--public-key 0xYourAddress --chain 1
--public-key 0xYourAddress --chain 1
2. Check queued requests
2. 查看队列中的请求
aomi tx
aomi tx
3. Simulate the batch — approve then swap
3. 模拟批量交易——先授权后兑换
aomi simulate tx-1 tx-2
aomi simulate tx-1 tx-2
4. If simulation passes, sign the batch
4. 模拟通过后签名批量交易
5. Verify
5. 验证结果
aomi tx
undefinedaomi tx
undefinedExplicit EOA Flow
显式EOA流程
bash
aomi sign tx-1 \
--eoa \
--private-key 0xYourPrivateKey \
--rpc-url https://eth.llamarpc.combash
aomi sign tx-1 \
--eoa \
--private-key 0xYourPrivateKey \
--rpc-url https://eth.llamarpc.comExplicit AA Flow
显式AA流程
bash
aomi sign tx-1 \
--aa \
--aa-provider pimlico \
--aa-mode 4337 \
--private-key 0xYourPrivateKeybash
aomi sign tx-1 \
--aa \
--aa-provider pimlico \
--aa-mode 4337 \
--private-key 0xYourPrivateKeyAlchemy Sponsorship Flow
Alchemy赞助流程
bash
export ALCHEMY_API_KEY=your-alchemy-key
export ALCHEMY_GAS_POLICY_ID=your-policy-id
export PRIVATE_KEY=0xYourPrivateKey
export CHAIN_RPC_URL=https://eth.llamarpc.com
aomi chat "swap 100 USDC for ETH" --public-key 0xYourAddress --chain 1
aomi sign tx-1bash
export ALCHEMY_API_KEY=your-alchemy-key
export ALCHEMY_GAS_POLICY_ID=your-policy-id
export PRIVATE_KEY=0xYourPrivateKey
export CHAIN_RPC_URL=https://eth.llamarpc.com
aomi chat "swap 100 USDC for ETH" --public-key 0xYourAddress --chain 1
aomi sign tx-1Switching App And Chain
切换应用和链
bash
aomi chat "show my balances" --app khalani
aomi chat "swap 1 POL for USDC on Polygon" --app khalani --chain 137
aomi txbash
aomi chat "show my balances" --app khalani
aomi chat "swap 1 POL for USDC on Polygon" --app khalani --chain 137
aomi txKhalani Transfer Flow
Khalani转账流程
bash
undefinedbash
undefined1. Ask for a quote and prefer a transfer-based deposit route
1. 请求报价,可用时优先选择基于转账的存款路径
aomi chat "swap 0.1 USDC for WETH using Khalani. Prefer a TRANSFER deposit method over CONTRACT_CALL if available." --app khalani --chain 1
aomi chat "swap 0.1 USDC for WETH using Khalani. Prefer a TRANSFER deposit method over CONTRACT_CALL if available." --app khalani --chain 1
2. If the agent asks for confirmation, confirm in the same session
2. 如果Agent询问确认,在同一会话中确认
aomi chat "proceed with the transfer route"
aomi chat "proceed with the transfer route"
3. Review the queued transfer request
3. 查看队列中的转账请求
aomi tx
aomi tx
4. Sign the transfer
4. 签名转账
aomi sign tx-1 --private-key 0xYourPrivateKey --rpc-url https://eth.llamarpc.com
aomi sign tx-1 --private-key 0xYourPrivateKey --rpc-url https://eth.llamarpc.com
5. Continue with the agent if a submit/finalize step is required
5. 如果需要提交/确认步骤,继续与Agent交互
aomi chat "the transfer has been sent, continue"
undefinedaomi chat "the transfer has been sent, continue"
undefinedCross-Chain RPC Example
跨链RPC示例
bash
undefinedbash
undefinedBuild the request on Polygon
在Polygon上构建请求
aomi chat "swap 0.1 USDC for WETH using Khalani on Polygon" --app khalani --chain 137
aomi tx
aomi chat "swap 0.1 USDC for WETH using Khalani on Polygon" --app khalani --chain 137
aomi tx
Sign with a Polygon RPC, even if CHAIN_RPC_URL is still set to Ethereum
使用Polygon RPC签名,即使CHAIN_RPC_URL仍设置为以太坊
aomi sign tx-8 --rpc-url https://polygon.drpc.org --chain 137
undefinedaomi sign tx-8 --rpc-url https://polygon.drpc.org --chain 137
undefinedSession Control
会话控制
bash
aomi session list
aomi session resume 2
aomi status
aomi closebash
aomi session list
aomi session resume 2
aomi status
aomi closeTroubleshooting
故障排查
- If returns
aomi chat, wait briefly and run(no response).aomi status - If signing fails in default mode, the CLI may already retry with unsponsored AA and then EOA. Read the console output before retrying manually.
- If AA is required and fails, check or
ALCHEMY_API_KEY, the selected chain, and any requestedPIMLICO_API_KEY.--aa-mode - If a transaction fails on-chain, check the RPC URL, balance, and chain.
- ,
401, and generic parameter errors during429are often RPC problems rather than transaction-construction problems. Try a reliable RPC for the correct chain.aomi sign - If is set, construct the correct chain-specific Alchemy RPC before falling back to random public endpoints.
ALCHEMY_API_KEY - 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.
- If 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.
aomi simulate - If returns
aomi simulate, the backend could not fork the chain — simulation ran each tx independently viastateful: false, so state-dependent flows (approve → swap) may show false negatives. Retry or check that the backend's Anvil instance is running.eth_call
- 如果返回
aomi chat,稍等片刻后执行(no response)aomi status - 如果默认模式下签名失败,CLI可能已经自动重试了无赞助AA和EOA,手动重试前请先阅读控制台输出
- 如果要求AA但签名失败,请检查或
ALCHEMY_API_KEY、选中的链以及任何指定的PIMLICO_API_KEY--aa-mode - 如果交易上链失败,请检查RPC URL、余额和链
- 过程中出现的
aomi sign、401和通用参数错误通常是RPC问题,而非交易构建问题。请尝试对应链的可靠RPC429 - 如果已设置,优先构建正确的链专属Alchemy RPC,再回退到随机公共节点
ALCHEMY_API_KEY - 如果同一链的1-2个公共RPC都失败,停止尝试随机节点,请向用户索要对应链的正规RPC URL
- 如果因回退失败,请阅读回退原因。常见原因包括:报价或时间戳过期(重新聊天获取新报价)、代币余额不足、缺少前置授权。未明确原因前不要签名模拟失败的交易
aomi simulate - 如果返回
aomi simulate,说明后端无法分叉链——模拟通过stateful: false独立执行每笔交易,因此授权→兑换这类依赖状态的流程可能出现假阴性。请重试或检查后端的Anvil实例是否运行eth_call