grimoire
Install and operate Grimoire, author .spell files with full syntax coverage (including advisory decision logic), and run compile/validate/simulate/cast safely. Use when users ask to create, edit, debug, validate, simulate, execute, or explain Grimoire strategies.
npx skills add franalgaba/grimoire --skill grimoireBefore / After 效果对比
0 组description 文档
name: grimoire description: Install and operate Grimoire, author .spell files with full syntax coverage (including advisory decision logic), and run compile/validate/simulate/cast safely. Use when users ask to create, edit, debug, validate, simulate, execute, or explain Grimoire strategies. compatibility: "Requires one of: global grimoire CLI, npx access to @grimoirelabs/cli, or repo-local Bun execution." metadata: version: "2.6" focus: "installation usage syntax advisory execution"
Grimoire CLI Skill
This skill is the base operating playbook for Grimoire.
When To Use
Use this skill when the task includes:
- install/setup of Grimoire tooling
- creating or editing
.spellfiles - syntax questions about DSL capability
- advisory (
advise) authoring, debugging, and replay workflows - setup/compile/validate/simulate/cast/resume workflows
- debugging spell compile/runtime failures
Mandatory Loading Rules
All references/ and docs/ paths below are relative to this skill directory (skills/grimoire/). These rules are required — they solve syntax coverage gaps that cause authoring errors.
STOP — read this first: Do NOT search the codebase, grep for syntax patterns, or rely on memory for DSL syntax. The reference files bundled with this skill are the single source of truth. IMMEDIATELY use the Read tool on the files listed below before writing or editing any spell content.
- For any
.spellauthoring/editing task — IMMEDIATELY read these files using the Read tool before doing anything else:references/syntax-capabilities.mdreferences/authoring-workflow.md
- For CLI flag details — IMMEDIATELY read using the Read tool:
references/cli-quick-reference.md
- For any advisory task (
advise,advisors, replay) — IMMEDIATELY read using the Read tool:docs/how-to/use-advisory-decisions.mddocs/explanation/advisory-decision-flow.md
- For local fork preview workflows — IMMEDIATELY read using the Read tool:
references/anvil-cheatsheet.mddocs/how-to/simulate-on-anvil-fork.md
- For wallet setup and execution key flows — IMMEDIATELY read using the Read tool:
docs/how-to/use-wallet-commands-end-to-end.md
- For RPC/signer/transaction diagnostics — IMMEDIATELY read using the Read tool:
references/cast-cheatsheet.md
Installation Resolution
Select the first working invocation and reuse it for the session.
- Global:
npm i -g @grimoirelabs/cli- command prefix:
grimoire
- No-install:
- command prefix:
npx -y @grimoirelabs/cli
- command prefix:
- Repo-local:
- command prefix:
bun run packages/cli/src/index.ts
- command prefix:
If one path fails, move to the next path automatically.
If grimoire venue doctor ... fails with Unknown venue adapter "doctor", prefer repo-local invocation (bun run packages/cli/src/index.ts) or upgrade global CLI.
Fast Start (Immediate Success Path)
Use this sequence before writing custom spells:
<grimoire-cmd> --help<grimoire-cmd> setup(guided interactive execute onboarding)<grimoire-cmd> validate spells/compute-only.spell<grimoire-cmd> simulate spells/compute-only.spell --chain 1
If all three pass, proceed to spell authoring.
Setup security/runtime expectations:
- setup prompts for hidden passwords and never echoes input
- blank RPC input falls back to chain default public RPC
- setup may write
.grimoire/setup.envunless--no-save-password-envis used - CLI auto-loads nearest
.grimoire/setup.envat startup without overriding existing env vars
Authoring and Execution Policy
- Read syntax references first (mandatory rule above).
- Author/update spell.
- Run
validate(use--strictfor advisory-heavy spells). - Fix errors/warnings and re-run until validation passes.
- Run
simulate. - Before venue metadata queries or value-moving runs, execute
venue doctorfor the target adapter/chain.- Example:
<grimoire-cmd> venue doctor --adapter uniswap --chain 1 --rpc-url <rpc> --json
- Example:
- Before value-moving runs on EVM venues, verify endpoint and signer state with Foundry Cast quickchecks (
chain-id,block-number,balance,nonce).- Do not apply Anvil/Cast checks to offchain venues such as
hyperliquid.
- Do not apply Anvil/Cast checks to offchain venues such as
- For advisory steps intended for deterministic execution, record and then use
--advisory-replay <runId>in dry-run/live cast. - If spell includes irreversible actions, require
cast --dry-runbefore any live cast. - Ask for explicit user confirmation before live value-moving
cast. - For cross-chain mode, require explicit per-chain RPC mappings:
--rpc-url <sourceChainId>=<url>--rpc-url <destinationChainId>=<url>
- For cross-chain Morpho actions, require explicit market mapping via:
--morpho-market-id <actionRef>=<marketId>(repeatable), or--morpho-market-map <path>
- For Morpho collateral lifecycle, prefer explicit actions:
morpho_blue.supply_collateral(asset, amount[, market_id])morpho_blue.withdraw_collateral(asset, amount[, market_id])
- Use bare
0x...address literals in action token fields; quoted address-like strings triggerQUOTED_ADDRESS_LITERAL. - For Morpho doctor readiness checks, set wallet env explicitly (
GRIMOIRE_WALLET_ADDRESSpreferred, fallbackWALLET_ADDRESS). - If a cross-chain run is left waiting, continue with
resume <runId>(use--watchto poll settlement). - Never place passwords/private keys in agent prompts or inline command assignments.
- Prefer keystore +
--password-envover--private-keyfor dry-run/live casts. - Treat
.grimoire/setup.envas plaintext secret material: keep local-only and rotate/remove when no longer needed. - For commands run outside the project tree, set
GRIMOIRE_SETUP_ENV_FILE=/abs/path/to/.grimoire/setup.envwhen needed.
Command Surface (Core)
initsetupcompilecompile-allvalidatesimulatecastvenuesvenuevenue doctorhistorylogresumewallet(generate,address,balance,import,wrap,unwrap)
Use references/cli-quick-reference.md for concise command signatures and safety-critical flags.
Runtime Behavior Model
- One runtime semantics: preview first, commit only for execute paths.
simulateandcast --dry-runare preview-only flows.- Live
castcan commit irreversible actions when policy and runtime checks pass. simulatesupports explicit--rpc-url, with precedence:--rpc-url->RPC_URL_<chainId>->RPC_URL.- Phase 1 cross-chain execution uses two-spell orchestration (
--destination-spell) with one logical run id and resume support.
Query Functions (price / balance)
Always prefer price() and balance() over advisory for data fetching. These are deterministic, fast, and don't require LLM calls.
price(BASE, QUOTE)— live token price via query provider (requires Alchemy RPC URL)balance(ASSET)— on-chain token balance via RPC (any RPC URL)- Never use an advisory (
advise) just to fetch a price, balance, or other structured data
Use advisory only when the task requires LLM judgment, reasoning, or interpretation.
Advisory Operating Rules
- Advisory must be explicit statement form:
x = advise advisor: "prompt" { ... }. - Treat advisory outputs as typed contracts; enforce schema with
output. - Require
timeoutandfallbackin every advisory block. - Prefer
validate --strictwhen advisory logic gates value-moving actions. - Use replay for determinism when moving from preview/dry-run to live execution.
- For runtime debugging, use
--advisory-trace-verbose(non-JSON mode) to stream detailed advisory traces.
Venue Metadata and Snapshots
Use venue skills for snapshot parameters and market metadata:
grimoire-aavegrimoire-uniswapgrimoire-morpho-bluegrimoire-hyperliquidgrimoire-pendlegrimoire-polymarket
Formatting policy for venue CLI output:
- prefer
--format jsonfor automation or nested payloads - use
--format tablefor human-readable summaries
References
references/syntax-capabilities.mdreferences/authoring-workflow.mdreferences/anvil-cheatsheet.mdreferences/cast-cheatsheet.mdreferences/cli-quick-reference.mddocs/how-to/simulate-on-anvil-fork.mddocs/how-to/use-wallet-commands-end-to-end.mddocs/how-to/use-advisory-decisions.mddocs/explanation/advisory-decision-flow.mddocs/reference/cli.mddocs/reference/spell-syntax.mddocs/reference/grimoire-dsl-spec.mddocs/reference/compiler-runtime.md
forum用户评价 (0)
发表评价
暂无评价,来写第一条吧
统计数据
用户评分
为此 Skill 评分