grimoire
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGrimoire CLI Skill
Grimoire CLI 技能
The Grimoire CLI compiles, validates, simulates, and executes strategy files.
.spellGrimoire CLI 可编译、验证、模拟并执行策略文件。
.spellWhen to use
使用场景
- You want deterministic execution with adapters (,
simulate).cast - You need CLI-only workflows (compile, validate, history, logs, wallet).
- 你希望通过适配器实现确定性执行(、
simulate命令)。cast - 你需要纯CLI工作流(编译、验证、历史记录、日志、钱包操作)。
VM vs deterministic
VM模式 vs 确定性模式
- VM mode runs inside an agent session and is best-effort. Use the skill for in-agent execution.
grimoire-vm - Deterministic runtime runs via the CLI. This skill covers that runtime.
For VM prototyping with snapshots, use the venue skills (, , , ) with .
grimoire-aavegrimoire-uniswapgrimoire-morpho-bluegrimoire-hyperliquid--format spell- VM模式在Agent会话中运行,为尽力而为型执行。如需在Agent内执行,请使用技能。
grimoire-vm - 确定性运行时通过CLI运行。本技能覆盖该运行时场景。
如需使用快照进行VM原型开发,请结合参数使用场景适配器技能(、、、)。
--format spellgrimoire-aavegrimoire-uniswapgrimoire-morpho-bluegrimoire-hyperliquidCommands
命令列表
grimoire init
grimoire init
Initialize a new directory with config and examples.
.grimoirebash
grimoire init [--force] [--vm]Use to scaffold a VM quickstart spell and README.
--vm初始化一个包含配置文件和示例的新目录。
.grimoirebash
grimoire init [--force] [--vm]使用参数可快速搭建VM入门级spell文件和README文档。
--vmgrimoire compile
grimoire compile
Compile a file to IR (intermediate representation).
.spellbash
grimoire compile <spell> [-o <file>] [--pretty]将文件编译为IR(中间表示)。
.spellbash
grimoire compile <spell> [-o <file>] [--pretty]grimoire compile-all
grimoire compile-all
Compile every file in a directory (default: ).
.spellspells/bash
grimoire compile-all [dir] [--fail-fast] [--json]编译指定目录下所有文件(默认目录:)。
.spellspells/bash
grimoire compile-all [dir] [--fail-fast] [--json]grimoire validate
grimoire validate
Validate a file without compiling.
.spellbash
grimoire validate <spell> [--strict]无需编译即可验证文件的合法性。
.spellbash
grimoire validate <spell> [--strict]grimoire simulate
grimoire simulate
Simulate spell execution (dry run). State is loaded/saved between runs.
bash
grimoire simulate <spell> [-p <json>] [--vault <address>] [--chain <id>] [--state-dir <dir>] [--no-state]
[--advisor-skills-dir <dir>...]
[--advisory-pi] [--advisory-replay <runId>] [--advisory-provider <name>] [--advisory-model <id>]
[--advisory-thinking <level>] [--advisory-tools <mode>] [--pi-agent-dir <dir>]模拟spell执行(试运行)。运行过程中会自动加载/保存状态。
bash
grimoire simulate <spell> [-p <json>] [--vault <address>] [--chain <id>] [--state-dir <dir>] [--no-state]
[--advisor-skills-dir <dir>...]
[--advisory-pi] [--advisory-replay <runId>] [--advisory-provider <name>] [--advisory-model <id>]
[--advisory-thinking <level>] [--advisory-tools <mode>] [--pi-agent-dir <dir>]grimoire cast
grimoire cast
Execute a spell onchain. Supports dry-run and live modes.
bash
grimoire cast <spell> [-p <json>] [--vault <address>] [--chain <id>] \
[--dry-run] [--key-env <name>] [--keystore <path>] [--password-env <name>] \
[--rpc-url <url>] [--gas-multiplier <n>] [--skip-confirm] [-v] [--json] \
[--advisor-skills-dir <dir>...] [--state-dir <dir>] [--no-state] \
[--advisory-pi] [--advisory-replay <runId>] [--advisory-provider <name>] [--advisory-model <id>] \
[--advisory-thinking <level>] [--advisory-tools <mode>] [--pi-agent-dir <dir>]在链上执行spell。支持试运行和正式运行模式。
bash
grimoire cast <spell> [-p <json>] [--vault <address>] [--chain <id>] \
[--dry-run] [--key-env <name>] [--keystore <path>] [--password-env <name>] \
[--rpc-url <url>] [--gas-multiplier <n>] [--skip-confirm] [-v] [--json] \
[--advisor-skills-dir <dir>...] [--state-dir <dir>] [--no-state] \
[--advisory-pi] [--advisory-replay <runId>] [--advisory-provider <name>] [--advisory-model <id>] \
[--advisory-thinking <level>] [--advisory-tools <mode>] [--pi-agent-dir <dir>]grimoire venues
grimoire venues
List available venue adapters and supported chains.
bash
grimoire venues [--json]列出可用的场景适配器及支持的链。
bash
grimoire venues [--json]grimoire venue
grimoire venue
Proxy to venue metadata CLIs bundled in .
@grimoirelabs/venuesbash
grimoire venue <adapter> [args...]代理调用中捆绑的场景元数据CLI。
@grimoirelabs/venuesbash
grimoire venue <adapter> [args...]grimoire history
grimoire history
View execution history for spells.
bash
grimoire history # list all spells with state
grimoire history <spellId> # runs for a specific spell
grimoire history <spellId> --limit 5 --json查看spell的执行历史记录。
bash
grimoire history # 列出所有带状态的spell
grimoire history <spellId> # 查看指定spell的所有运行记录
grimoire history <spellId> --limit 5 --jsongrimoire log
grimoire log
View ledger events for a specific spell run.
bash
grimoire log <spellId> <runId> [--json] [--state-dir <dir>]查看特定spell运行的账本事件日志。
bash
grimoire log <spellId> <runId> [--json] [--state-dir <dir>]grimoire wallet
grimoire wallet
Manage wallet operations.
bash
grimoire wallet generate # create new keystore
grimoire wallet address --keystore <path> --password-env <name>
grimoire wallet balance --keystore <path> --password-env <name> --chain <id> --rpc-url <url>
grimoire wallet import --private-key <hex>
grimoire wallet wrap --amount <n> --chain <id> --keystore <path> --password-env <name>
grimoire wallet unwrap --amount <n> --chain <id> --keystore <path> --password-env <name>管理钱包操作。
bash
grimoire wallet generate # 创建新的密钥库
grimoire wallet address --keystore <path> --password-env <name>
grimoire wallet balance --keystore <path> --password-env <name> --chain <id> --rpc-url <url>
grimoire wallet import --private-key <hex>
grimoire wallet wrap --amount <n> --chain <id> --keystore <path> --password-env <name>
grimoire wallet unwrap --amount <n> --chain <id> --keystore <path> --password-env <name>Running Locally
本地运行
All CLI commands can be invoked via:
bash
bun run packages/cli/src/index.ts <command> [args]所有CLI命令均可通过以下方式调用:
bash
bun run packages/cli/src/index.ts <command> [args]Environment Variables
环境变量
- - Wallet private key (default for
PRIVATE_KEY)--key-env - - Keystore password (default for
KEYSTORE_PASSWORD)--password-env - - JSON-RPC endpoint (fallback for
RPC_URL)--rpc-url
- - 钱包私钥(
PRIVATE_KEY参数的默认值)--key-env - - 密钥库密码(
KEYSTORE_PASSWORD参数的默认值)--password-env - - JSON-RPC端点(
RPC_URL参数的备选值)--rpc-url
State Persistence
状态持久化
Simulate and cast automatically load/save spell state to (SQLite). Use to disable or to change the directory.
.grimoire/grimoire.db--no-state--state-dirSimulate和Cast命令会自动将spell状态加载/保存到(SQLite数据库)。可使用参数禁用该功能,或通过参数修改存储目录。
.grimoire/grimoire.db--no-state--state-dirAdvisor Skills
顾问技能
Use with or to resolve advisor skills from directories containing files. The runtime emits / metadata in advisory events for external orchestrators.
--advisor-skills-dir <dir>simulatecastSKILL.mdskillsallowedTools在使用simulate或cast命令时,可通过参数从包含文件的目录中加载顾问技能。运行时会在顾问事件中输出/元数据,供外部编排器使用。
--advisor-skills-dir <dir>SKILL.mdskillsallowedToolsAdvisory (Pi OAuth)
顾问功能(Pi OAuth)
Advisory steps ( and ) call Pi when a model is configured (spell model, CLI model/provider, or Pi defaults). If no model is available, the runtime uses the spell fallback. Use to force Pi even if no model is configured.
**...**advise--advisory-piOAuth (OpenAI Codex) setup:
bash
pi
/login当配置了模型(spell模型、CLI模型/提供商或Pi默认值)时,顾问步骤(和)会调用Pi。若未配置任何模型,运行时会使用spell的 fallback 方案。使用参数可强制调用Pi,即使未配置模型。
**...**advise--advisory-piOAuth(OpenAI Codex)设置:
bash
pi
/loginselect OpenAI Codex
选择OpenAI Codex
If the `pi` CLI is not installed globally, you can run `npx @mariozechner/pi-coding-agent` instead. Credentials live under `~/.pi/agent` unless you pass `--pi-agent-dir`.
Example:
```bash
grimoire simulate spells/my-spell.spell \
--advisory-pi \
--advisory-provider openai-codex \
--advisory-model gpt-5.2 \
--advisory-tools noneRecord → replay (deterministic advisory outputs):
bash
grimoire simulate spells/my-spell.spell --advisory-pi
grimoire simulate spells/my-spell.spell --advisory-replay <runId>
若未全局安装`pi` CLI,可使用`npx @mariozechner/pi-coding-agent`替代。凭据默认存储在`~/.pi/agent`目录下,可通过`--pi-agent-dir`参数修改存储路径。
示例:
```bash
grimoire simulate spells/my-spell.spell \
--advisory-pi \
--advisory-provider openai-codex \
--advisory-model gpt-5.2 \
--advisory-tools none记录→重放(确定性顾问输出):
bash
grimoire simulate spells/my-spell.spell --advisory-pi
grimoire simulate spells/my-spell.spell --advisory-replay <runId>