aomi-transact

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Aomi Transact

Aomi 交易

Use the CLI as an agent operating procedure, not as a long-running shell. Each
aomi
command starts, runs, and exits. Conversation history lives on the backend. Local session data lives under
AOMI_STATE_DIR
or
~/.aomi
.
将该CLI作为Agent操作流程使用,而非长期运行的shell。每条
aomi
命令启动、运行后即退出。对话历史存储在后端,本地会话数据保存在
AOMI_STATE_DIR
~/.aomi
路径下。

Use 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
    ,
    PIMLICO_API_KEY
    , and private RPC URLs as secrets.
  • 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
    aomi --secret NAME=value ...
    over stuffing provider API keys into normal chat text.
  • Do not sign anything unless the CLI has actually queued a wallet request and you can identify its
    tx-N
    ID.
  • 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.
  • If
    PRIVATE_KEY
    is set in the environment, do not also pass
    --private-key
    unless you intentionally want to override the environment value.
  • --public-key
    must match the address derived from the signing key. If they differ,
    aomi sign
    will update the session to the signer address.
  • Private keys must start with
    0x
    . Add the prefix if missing.
  • CHAIN_RPC_URL
    is only one default RPC URL. When switching chains, prefer passing
    --rpc-url
    on
    aomi sign
    .
  • 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.
  • --aa-provider
    and
    --aa-mode
    are AA-only controls and cannot be used with
    --eoa
    .
  • 禁止在常规状态、预检查或确认输出中原样打印密钥
  • PRIVATE_KEY
    AOMI_API_KEY
    ALCHEMY_API_KEY
    PIMLICO_API_KEY
    和私有RPC URL视为机密信息
  • 如果用户提供了私钥或API密钥,除非用户明确要求重新格式化该特定值,否则不要回显
  • 优先使用
    aomi --secret NAME=value ...
    格式,而非将服务商API密钥填入普通聊天文本中
  • 除非CLI已实际将钱包请求加入队列且你能识别其
    tx-N
    ID,否则不要签署任何内容
  • 从新的Codex或助手聊天线程开始工作时,默认第一条Aomi命令添加
    --new-session
    参数,除非用户明确想要延续现有会话
  • 如果环境中已设置
    PRIVATE_KEY
    ,不要额外传递
    --private-key
    参数,除非你有意覆盖环境变量值
  • --public-key
    必须与签名密钥派生的地址匹配。如果二者不一致,
    aomi sign
    会将会话更新为签名者地址
  • 私钥必须以
    0x
    开头,如果缺失请补充该前缀
  • CHAIN_RPC_URL
    仅为默认RPC URL,切换链时优先在
    aomi sign
    命令中传递
    --rpc-url
    参数
  • 使用
    --chain
    切换聊天/会话链不会修改
    CHAIN_RPC_URL
    aomi sign
    使用的RPC必须与待处理交易的链匹配
  • --aa-provider
    --aa-mode
    是仅适用于AA的控制参数,不可与
    --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

默认工作流

  1. Chat with the agent.
  2. If the agent asks whether to proceed, send a short confirmation in the same session.
  3. Review pending requests with
    aomi tx
    .
  4. For multi-step flows (e.g. approve → swap), simulate before signing:
    aomi simulate tx-1 tx-2
    .
  5. Sign the queued request(s).
  6. Verify with
    aomi tx
    ,
    aomi log
    , or
    aomi status
    .
The CLI output is the source of truth. If you do not see
Wallet request queued: tx-N
, there is nothing to sign yet.
  1. 与Agent聊天
  2. 如果Agent询问是否继续,在同一会话中发送简短确认信息
  3. 使用
    aomi tx
    查看待处理请求
  4. 对于多步骤流程(如授权→兑换),签名前先模拟:
    aomi simulate tx-1 tx-2
  5. 签名队列中的请求
  6. 使用
    aomi tx
    aomi log
    aomi status
    验证结果
CLI输出是唯一可信来源。如果你没有看到
Wallet request queued: tx-N
提示,说明当前没有可签名的内容。

Workflow 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
    --new-session
    so old local/backend state does not bleed into the new task.
  • Use
    --verbose
    when debugging tool calls or streaming behavior.
  • Pass
    --public-key
    on the first wallet-aware chat if the backend needs the user's address.
  • 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.
  • Use
    aomi secret list
    to inspect configured secret handles for the active session.
  • aomi close
    wipes the active local session pointer and starts a fresh thread next time.
当用户不需要签名时使用以下命令:
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 clear
Important behavior:
  • aomi --secret NAME=value
    with no command ingests secrets into the active session and exits.
  • aomi --secret NAME=value chat "..."
    ingests first, then runs the command.
  • aomi secret list
    prints secret handle names, not raw values.
  • aomi secret clear
    removes all secrets for the active session.
  • Do not combine
    --secret
    with
    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 1
If 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 137
Important 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
    aomi sign
    after a wallet request is queued.
  • For Khalani, prefer a
    TRANSFER
    deposit method when available. The intended flow is quote -> sign transfer -> submit/continue after the transfer settles.
  • Avoid Khalani
    CONTRACT_CALL
    routes that require ERC-20 approval unless the user explicitly wants that path or no transfer route is available.
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.
  • --aa
    : require AA with no EOA fallback.
  • --eoa
    : force direct EOA execution.
  • --aa-provider
    or
    --aa-mode
    : AA-specific controls. Use them only when the user explicitly wants a provider or mode.
Examples:
bash
undefined
严格遵循以下规则:
  • 默认命令:
    aomi sign <tx-id> [<tx-id> ...]
  • 默认行为:优先尝试账户抽象(AA),Alchemy赞助不可用时重试无赞助AA,若AA仍失败则自动回退到EOA
  • --aa
    :仅使用AA,不回退到EOA
  • --eoa
    :强制直接使用EOA执行
  • --aa-provider
    --aa-mode
    :AA专属控制参数,仅当用户明确指定服务商或模式时使用
示例:
bash
undefined

Default: 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
undefined
aomi sign tx-1 --aa-provider pimlico --aa-mode 4337 --private-key 0xYourPrivateKey
undefined

Batch Simulation

批量模拟

Use
aomi simulate
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.
bash
undefined
签名前使用
aomi simulate
对代签交易进行 dry-run。模拟会在分叉链上按顺序执行每笔交易,因此依赖状态的流程(授权→兑换)可以作为批量进行验证——兑换操作可以看到授权带来的状态变化。
bash
undefined

Simulate 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:

```bash
aomi 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`无输出)

模拟和签名工作流:

```bash

1. Build the request

1. 构建请求

aomi chat "approve and swap 100 USDC for ETH on Uniswap"
--public-key 0xYourAddress --chain 1
aomi chat "approve and swap 100 USDC for ETH on Uniswap"
--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
undefined
aomi tx
undefined

Account 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
    4337
    or
    7702
    account-abstraction mode.
How to choose:
  • aomi sign
    with no AA flags: try AA first, then fall back to EOA automatically if AA is unavailable.
  • aomi sign --aa
    : require AA only. Use this when the user does not want an EOA fallback.
  • aomi sign --eoa
    : bypass AA entirely and sign directly with the wallet key.
  • aomi sign --aa-provider alchemy|pimlico
    : force a specific AA provider.
  • aomi sign --aa-mode 4337|7702
    : force the execution mode when the user wants a specific AA path.
More signing notes:
  • aomi sign
    handles both transaction requests and EIP-712 typed data signatures.
  • Batch signing is supported for transaction requests only, not EIP-712 requests.
  • A single
    --rpc-url
    override cannot be used for a mixed-chain multi-sign request.
  • 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
    CHAIN_RPC_URL
    points to Ethereum but the pending transaction is on Polygon, Arbitrum, Base, Optimism, or Sepolia, override it with a matching
    --rpc-url
    .
  • Prefer a reliable chain-specific RPC over generic public RPCs, which may return
    401
    ,
    429
    , or generic parameter errors.
  • If
    ALCHEMY_API_KEY
    is available, prefer constructing the matching chain-specific Alchemy RPC before trying generic public RPCs.
  • 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标记的
    aomi sign
    :优先尝试AA,AA不可用时自动回退到EOA
  • aomi sign --aa
    :仅允许使用AA,用户不想要EOA回退时使用
  • aomi sign --eoa
    :完全绕过AA,直接使用钱包密钥签名
  • aomi sign --aa-provider alchemy|pimlico
    :强制使用指定的AA服务商
  • aomi sign --aa-mode 4337|7702
    :用户需要特定AA路径时强制指定执行模式
更多签名注意事项:
  • aomi sign
    同时支持交易请求和EIP-712类型数据签名
  • 仅交易请求支持批量签名,EIP-712请求不支持
  • 跨多链的混合签名请求不能使用单一
    --rpc-url
    覆盖
  • 如果签名者地址与存储的会话公钥不同,CLI会将会话更新为签名者地址
  • 待处理交易已包含目标链信息,请使用对应链的签名RPC
  • 如果
    CHAIN_RPC_URL
    指向以太坊,但待处理交易在Polygon、Arbitrum、Base、Optimism或Sepolia上,请使用匹配的
    --rpc-url
    覆盖
  • 优先使用可靠的链专属RPC,而非通用公共RPC,后者可能返回
    401
    429
    或通用参数错误
  • 如果有可用的
    ALCHEMY_API_KEY
    ,优先构建对应链的Alchemy RPC,再尝试通用公共RPC
  • 如果可用的RPC看起来不可靠,最多尝试1-2个合理的链专属公共RPC,之后请向用户索要对应链的正规服务商RPC URL,不要继续猜测

Session And Storage Notes

会话和存储注意事项

  • Active session, app, model, chain, pending txs, and signed txs are stored locally under
    AOMI_STATE_DIR
    or
    ~/.aomi
    .
  • Session files live under
    ~/.aomi/sessions/
    by default and get local IDs like
    session-1
    .
  • Useful commands:
bash
aomi session list
aomi session resume <id>
aomi session delete <id>
aomi close
  • 活跃会话、应用、模型、链、待处理交易、已签名交易都存储在本地
    AOMI_STATE_DIR
    ~/.aomi
    路径下
  • 会话文件默认存储在
    ~/.aomi/sessions/
    下,本地ID格式为
    session-1
  • 常用命令:
bash
aomi session list
aomi session resume <id>
aomi session delete <id>
aomi close

Reference: 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
    --verbose
    to stream tool calls and agent output.
  • Use
    --public-key
    on the first wallet-aware message.
  • Use
    --app
    ,
    --model
    , and
    --chain
    to change the active context for the next request.
  • Prefer
    --chain <id>
    for one-off chain-specific requests. Use
    AOMI_CHAIN_ID=<id>
    when several consecutive commands should share the same chain context.
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
    参数
  • 使用
    --verbose
    可以流式输出工具调用和Agent结果
  • 第一条钱包相关消息使用
    --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
  • aomi tx
    inspects pending and signed requests.
  • aomi log
    replays conversation and tool output.
  • aomi status
    shows the current session summary.
  • aomi events
    shows raw backend system events.
  • aomi secret list
    shows configured secret handles for the active session.
  • aomi secret clear
    removes all configured secrets for the active session.
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
    total_gas
    for the entire batch.
  • No on-chain state is modified — the fork is reverted after simulation.
  • Requires pending transactions to exist in the session (
    aomi tx
    to check).
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>
  • aomi app list
    shows available backend apps.
  • aomi app current
    shows the active app from local session state.
  • aomi model set <rig>
    persists the selected model for the current session.
  • aomi chat --model <rig> "<message>"
    also applies a model for the session.
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 list
bash
aomi chain list

Session 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,
    session-N
    , or
    N
    .
  • aomi close
    clears the active local session pointer. The next chat starts fresh.
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
    aomi sign ...
    : try AA first, retry unsponsored Alchemy AA when sponsorship is unavailable, then fall back to EOA automatically.
  • aomi sign ... --aa
    : require AA only. Do not fall back to EOA.
  • aomi sign ... --eoa
    : force direct EOA signing.
  • 默认
    aomi sign ...
    :优先尝试AA,赞助不可用时重试无赞助Alchemy AA,之后自动回退到EOA
  • aomi sign ... --aa
    :仅允许使用AA,不回退到EOA
  • aomi sign ... --eoa
    :强制直接使用EOA签名

AA Providers

AA服务商

ProviderFlagEnv VarNotes
Alchemy
--aa-provider alchemy
ALCHEMY_API_KEY
Supports sponsorship, 4337, 7702
Pimlico
--aa-provider pimlico
PIMLICO_API_KEY
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
--aa-provider alchemy
ALCHEMY_API_KEY
支持赞助、4337、7702
Pimlico
--aa-provider pimlico
PIMLICO_API_KEY
支持4337和7702
服务商选择规则:
  • 如果用户明确选择了服务商,使用指定服务商
  • 默认模式下,CLI优先使用第一个配置的AA服务商
  • 如果没有配置AA服务商,默认模式直接使用EOA

AA Modes

AA模式

ModeFlagMeaning
4337
--aa-mode 4337
Bundler-based smart account flow
7702
--aa-mode 7702
Delegated execution flow
模式标记含义
4337
--aa-mode 4337
基于Bundler的智能账户流程
7702
--aa-mode 7702
委托执行流程

Default Chain Modes

默认链模式

ChainIDDefault AA Mode
Ethereum17702
Polygon1374337
Arbitrum421614337
Base84534337
Optimism104337
ID默认AA模式
Ethereum17702
Polygon1374337
Arbitrum421614337
Base84534337
Optimism104337

Sponsorship

赞助

Alchemy sponsorship is optional.
bash
export ALCHEMY_API_KEY=your-key
export ALCHEMY_GAS_POLICY_ID=your-policy-id
aomi sign tx-1
Default signing behavior for Alchemy:
  1. Try sponsored AA.
  2. If sponsorship is unavailable, retry AA with user-funded gas.
  3. 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-1
Alchemy默认签名行为:
  1. 尝试赞助AA
  2. 如果赞助不可用,重试用户出资gas的AA
  3. 如果AA仍失败且模式为默认自动模式,回退到EOA

Supported Chains

支持的链

ChainID
Ethereum1
Polygon137
Arbitrum One42161
Base8453
Optimism10
Sepolia11155111
ID
Ethereum1
Polygon137
Arbitrum One42161
Base8453
Optimism10
Sepolia11155111

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:
  • --chain
    affects the wallet/session context for chat and request building.
  • --rpc-url
    affects where
    aomi sign
    estimates and submits the transaction.
  • 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.
FlagEnv VarDefaultPurpose
--backend-url
AOMI_BASE_URL
https://api.aomi.dev
Backend URL
--api-key
AOMI_API_KEY
noneAPI key for non-default apps
--app
AOMI_APP
default
Backend app
--model
AOMI_MODEL
backend defaultSession model
--public-key
AOMI_PUBLIC_KEY
noneWallet address for chat/session context
--private-key
PRIVATE_KEY
noneSigning key for
aomi sign
--rpc-url
CHAIN_RPC_URL
chain RPC defaultRPC override for signing
--chain
AOMI_CHAIN_ID
1
Active wallet chain
--aa-provider
AOMI_AA_PROVIDER
autoAA provider override
--aa-mode
AOMI_AA_MODE
chain defaultAA mode override
所有配置都可以通过标记传递,标记优先级高于环境变量。
标记环境变量默认值用途
--backend-url
AOMI_BASE_URL
https://api.aomi.dev
后端URL
--api-key
AOMI_API_KEY
非默认应用的API密钥
--app
AOMI_APP
default
后端应用
--model
AOMI_MODEL
后端默认会话模型
--public-key
AOMI_PUBLIC_KEY
聊天/会话上下文的钱包地址
--private-key
PRIVATE_KEY
aomi sign
使用的签名密钥
--rpc-url
CHAIN_RPC_URL
链RPC默认签名用RPC覆盖
--chain
AOMI_CHAIN_ID
1
活跃钱包链
--aa-provider
AOMI_AA_PROVIDER
自动AA服务商覆盖
--aa-mode
AOMI_AA_MODE
链默认AA模式覆盖

AA Provider Credentials

AA服务商凭证

Env VarPurpose
ALCHEMY_API_KEY
Enables Alchemy AA
ALCHEMY_GAS_POLICY_ID
Optional Alchemy sponsorship policy
PIMLICO_API_KEY
Enables Pimlico AA
ALCHEMY_API_KEY
can also be used to construct chain-specific signing RPCs:
ChainExample Alchemy RPC
Ethereum
https://eth-mainnet.g.alchemy.com/v2/<ALCHEMY_API_KEY>
Polygon
https://polygon-mainnet.g.alchemy.com/v2/<ALCHEMY_API_KEY>
Arbitrum
https://arb-mainnet.g.alchemy.com/v2/<ALCHEMY_API_KEY>
Base
https://base-mainnet.g.alchemy.com/v2/<ALCHEMY_API_KEY>
Optimism
https://opt-mainnet.g.alchemy.com/v2/<ALCHEMY_API_KEY>
Sepolia
https://eth-sepolia.g.alchemy.com/v2/<ALCHEMY_API_KEY>
环境变量用途
ALCHEMY_API_KEY
启用Alchemy AA
ALCHEMY_GAS_POLICY_ID
可选Alchemy赞助政策
PIMLICO_API_KEY
启用Pimlico AA
ALCHEMY_API_KEY
也可用于构建链专属签名RPC:
Alchemy RPC示例
Ethereum
https://eth-mainnet.g.alchemy.com/v2/<ALCHEMY_API_KEY>
Polygon
https://polygon-mainnet.g.alchemy.com/v2/<ALCHEMY_API_KEY>
Arbitrum
https://arb-mainnet.g.alchemy.com/v2/<ALCHEMY_API_KEY>
Base
https://base-mainnet.g.alchemy.com/v2/<ALCHEMY_API_KEY>
Optimism
https://opt-mainnet.g.alchemy.com/v2/<ALCHEMY_API_KEY>
Sepolia
https://eth-sepolia.g.alchemy.com/v2/<ALCHEMY_API_KEY>

Storage

存储

Env VarDefaultPurpose
AOMI_STATE_DIR
~/.aomi
Root directory for local session state
Storage layout by default:
  • ~/.aomi/sessions/
    stores per-session JSON files.
  • ~/.aomi/active-session.txt
    stores the active local session pointer.
环境变量默认值用途
AOMI_STATE_DIR
~/.aomi
本地会话状态的根目录
默认存储结构:
  • ~/.aomi/sessions/
    存储单会话JSON文件
  • ~/.aomi/active-session.txt
    存储活跃本地会话指针

Important Config Rules

重要配置规则

  • PRIVATE_KEY
    should start with
    0x
    .
  • If
    PRIVATE_KEY
    is already set in the environment, do not also pass
    --private-key
    unless you intentionally want to override it.
  • CHAIN_RPC_URL
    is only one default RPC URL. For chain switching, prefer passing
    --rpc-url
    on
    aomi sign
    .
  • If the user switches from Ethereum to Polygon, Arbitrum, Base, Optimism, or Sepolia, do not keep using an Ethereum
    CHAIN_RPC_URL
    for signing.
  • --aa-provider
    and
    --aa-mode
    cannot be used with
    --eoa
    .
  • In default signing mode, missing AA credentials cause the CLI to use EOA directly.
  • PRIVATE_KEY
    必须以
    0x
    开头
  • 如果环境中已设置
    PRIVATE_KEY
    ,不要额外传递
    --private-key
    参数,除非你有意覆盖它
  • CHAIN_RPC_URL
    仅为默认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 log
bash
aomi chat "what is the price of ETH?" --verbose
aomi log

Basic Swap Flow

基础兑换流程

bash
undefined
bash
undefined

1. Start a wallet-aware session on Ethereum

1. 在以太坊上开启钱包感知会话

aomi chat "swap 1 ETH for USDC on Uniswap"
--public-key 0xYourAddress
--chain 1
aomi chat "swap 1 ETH for USDC on Uniswap"
--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

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. Verify

5. 验证结果

aomi tx aomi log
undefined
aomi tx aomi log
undefined

Approve + Swap With Simulation

带模拟的授权+兑换流程

bash
undefined
bash
undefined

1. Build a multi-step request

1. 构建多步骤请求

aomi chat "approve and swap 500 USDC for ETH on Uniswap"
--public-key 0xYourAddress --chain 1
aomi chat "approve and swap 500 USDC for ETH on Uniswap"
--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. 模拟通过后签名批量交易

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
undefined
aomi tx
undefined

Explicit EOA Flow

显式EOA流程

bash
aomi sign tx-1 \
  --eoa \
  --private-key 0xYourPrivateKey \
  --rpc-url https://eth.llamarpc.com
bash
aomi sign tx-1 \
  --eoa \
  --private-key 0xYourPrivateKey \
  --rpc-url https://eth.llamarpc.com

Explicit AA Flow

显式AA流程

bash
aomi sign tx-1 \
  --aa \
  --aa-provider pimlico \
  --aa-mode 4337 \
  --private-key 0xYourPrivateKey
bash
aomi sign tx-1 \
  --aa \
  --aa-provider pimlico \
  --aa-mode 4337 \
  --private-key 0xYourPrivateKey

Alchemy 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-1
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-1

Switching 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 tx
bash
aomi chat "show my balances" --app khalani
aomi chat "swap 1 POL for USDC on Polygon" --app khalani --chain 137
aomi tx

Khalani Transfer Flow

Khalani转账流程

bash
undefined
bash
undefined

1. 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"
undefined
aomi chat "the transfer has been sent, continue"
undefined

Cross-Chain RPC Example

跨链RPC示例

bash
undefined
bash
undefined

Build 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
undefined
aomi sign tx-8 --rpc-url https://polygon.drpc.org --chain 137
undefined

Session Control

会话控制

bash
aomi session list
aomi session resume 2
aomi status
aomi close
bash
aomi session list
aomi session resume 2
aomi status
aomi close

Troubleshooting

故障排查

  • If
    aomi chat
    returns
    (no response)
    , wait briefly and run
    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
    ALCHEMY_API_KEY
    or
    PIMLICO_API_KEY
    , the selected chain, and any requested
    --aa-mode
    .
  • If a transaction fails on-chain, check the RPC URL, balance, and chain.
  • 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.
  • If
    ALCHEMY_API_KEY
    is set, construct the correct chain-specific Alchemy RPC before falling back to random public endpoints.
  • 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
    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.
  • 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.
  • 如果
    aomi chat
    返回
    (no response)
    ,稍等片刻后执行
    aomi status
  • 如果默认模式下签名失败,CLI可能已经自动重试了无赞助AA和EOA,手动重试前请先阅读控制台输出
  • 如果要求AA但签名失败,请检查
    ALCHEMY_API_KEY
    PIMLICO_API_KEY
    、选中的链以及任何指定的
    --aa-mode
  • 如果交易上链失败,请检查RPC URL、余额和链
  • aomi sign
    过程中出现的
    401
    429
    和通用参数错误通常是RPC问题,而非交易构建问题。请尝试对应链的可靠RPC
  • 如果已设置
    ALCHEMY_API_KEY
    ,优先构建正确的链专属Alchemy RPC,再回退到随机公共节点
  • 如果同一链的1-2个公共RPC都失败,停止尝试随机节点,请向用户索要对应链的正规RPC URL
  • 如果
    aomi simulate
    因回退失败,请阅读回退原因。常见原因包括:报价或时间戳过期(重新聊天获取新报价)、代币余额不足、缺少前置授权。未明确原因前不要签名模拟失败的交易
  • 如果
    aomi simulate
    返回
    stateful: false
    ,说明后端无法分叉链——模拟通过
    eth_call
    独立执行每笔交易,因此授权→兑换这类依赖状态的流程可能出现假阴性。请重试或检查后端的Anvil实例是否运行