Agent skill

Elodin Cranelift

by elodin-sys in elodin-sys/elodin

Work with the Cranelift JIT MLIR backend. An agent skill from elodin-sys/elodin.

Apache-2.0Auto-check passedDevelopment

Install Elodin Cranelift

skills CLI
$ npx skills add elodin-sys/elodin --skill elodin-cranelift -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install elodin-sys/elodin elodin-cranelift --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/elodin-sys/elodin.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.cursor/skills/elodin-cranelift .claude/skills/elodin-cranelift && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
elodin-cranelift
GitHub stars
547
Token cost
~2k tokens
SKILL.md length
632 words
Files
1
Skills in repo
14
Repo updated
First seen
Licence
Apache-2.0

At a glance

Work with the Cranelift JIT MLIR backend. An agent skill from elodin-sys/elodin.

  • Works in 7 steps: IR: add Instruction variant in src/ir.rs → Parser: add arm in parse_op() in… → Lowering (scalar): add match arm in… → …
  • Modifying libs/cranelift-mlir/
  • SKILL.md covers Default backend, Where things live, Everyday commands and Shared Large Constants, plus 5 more sections
  • Calls cargo, bash and python

What it does

Elodin Cranelift is an agent skill from elodin-sys/elodin. Work with the Cranelift JIT MLIR backend. Use when modifying libs/cranelift-mlir/, adding new StableHLO ops, debugging simulation correctness issues, running the checkpoint diagnostic tool, or working on the pointer-ABI tensor runtime.

Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Debugging. The repository describes itself as: Elodin simulation and flight software monorepo. The licence is Apache-2.0.

When your agent uses it

  • Modifying libs/cranelift-mlir/
  • Adding new StableHLO ops
  • Debugging simulation correctness issues
  • Running the checkpoint diagnostic tool

Example prompts

  • “/elodin-cranelift”

Requirements

  • Python 3

Workflow steps

7 steps, taken from the first numbered list in SKILL.md.

  1. IR: add Instruction variant in src/ir.rs
  2. Parser: add arm in parse_op() in src/parser.rs
  3. Lowering (scalar): add match arm in lower_instruction() in src/lower.rs
  4. Lowering (pointer-ABI): add match arm in lower_instruction_mem() in src/lower.rs
  5. Runtime (if N-D): add tensor__f64 in src/tensor_rt.rs, register in TensorRtIds
  6. Tests: golden-value tests in tests/ops.rs exercising both run_mlir and run_mlir_mem
  7. cargo test -p cranelift-mlir

What it can do on your machine

Read from SKILL.md and the folder at commit 729022c. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • cargo
    • bash
    • python
    • just
    • nix
    • python3

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Elodin Cranelift loads about 2k tokens when it runs. Until then it costs about 63 tokens; SKILL.md has 632 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~63
When it runs · the whole SKILL.md, loaded when a task matches
~2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from elodin-sys/elodin at commit 729022c, republished under its Apache-2.0 licence (© elodin-sys). 632 words, ~2,039 tokens.

Download SKILL.mdSave it as .claude/skills/elodin-cranelift/SKILL.md (or your agent's skills folder).
name
elodin-cranelift
description
Work with the Cranelift JIT MLIR backend. Use when modifying libs/cranelift-mlir/, adding new StableHLO ops, debugging simulation correctness issues, running the checkpoint diagnostic tool, or working on the pointer-ABI tensor runtime.

Elodin Cranelift Backend

libs/cranelift-mlir/ compiles StableHLO MLIR to native code via Cranelift JIT — the default CPU backend for Elodin simulations. Deep internals live in ARCHITECTURE.md; profiling is in PERFORMANCE.md.

Default backend

Cranelift is the default (backend="cranelift" in WorldBuilder.run / .build). Override per-run:

bash
ELODIN_BACKEND=jax-cpu python examples/<name>/main.py run   # XLA native, reference for correctness
ELODIN_BACKEND=jax-gpu python examples/<name>/main.py run   # XLA CUDA

Or in Python:

python
w.run(system, backend="jax-cpu")

Where things live

PathPurpose
src/ir.rsInternal IR: Module, FuncDef, Instruction variants
src/parser.rsStableHLO text → IR (Winnow parser, child contexts for while/case)
src/lower.rsIR → Cranelift JIT. Dual ABI, cross-ABI marshaling, SIMD, slot pooling
src/tensor_rt.rsRuntime: broadcast_nd, slice, transpose, reduce, gather_nd, scatter, matmul
tests/ops.rsPer-op golden tests, both ABI paths
tests/checkpoint_test.rsXLA-vs-Cranelift comparator
libs/nox-py/src/cranelift_compile.rsJAX → StableHLO, XLA reference checkpoint
libs/nox-py/src/cranelift_exec.rsCraneliftExec tick loop
libs/nox-py/src/exec.rsWorldExec enum (dispatches Cranelift vs JAX)

Everyday commands

Always run inside nix develop.

bash
cargo test -p cranelift-mlir                    # all unit + golden tests
cargo test -p cranelift-mlir --test ops         # per-op only
cargo clippy -p cranelift-mlir -- -Dwarnings
cargo fmt -p cranelift-mlir -- --check

# Full simulation regression (requires `just install` first):
just install
ELODIN_BACKEND=cranelift bash scripts/ci/regress.sh --all                                 # every example
ELODIN_BACKEND=cranelift bash scripts/ci/regress.sh ball examples/ball/main.py            # one example
ELODIN_BACKEND=cranelift bash scripts/ci/regress.sh --update ball examples/ball/main.py   # re-baseline after verifying correctness

Baselines live in scripts/ci/baseline/; tolerances in scripts/ci/baseline/tolerances.json.

Shared Large Constants

Large stablehlo.constant dense<"0x..."> blobs over 1 MB are transparently interned by libs/cranelift-mlir:

  • Parser: src/parser.rs decodes large hex constants as raw bytes and interns them through src/const_cache.rs.
  • Cache: content-addressed by element type, byte length, and raw little-endian bytes under ${ELODIN_CACHE_DIR:-~/.cache/elodin/const-cache}.
  • IR: ConstantValue::DenseExternal is cheap to clone and carries the cached mapping handle.
  • Lowering: src/lower.rs registers each mapping with JITBuilder::symbol and lowers it through declare_data(Linkage::Import), so constants are not copied into the JIT arena.
  • Lifetime: CompiledModule must retain the Arc<CachedConst> handles for every imported constant. The JIT symbol stores raw pointers, so dropping the parsed IR module before live execution would otherwise leave dangling mmap pointers.
  • Concurrent publishing: cache writes must never replace an already-published file. Use a temp file plus no-clobber publish so simultaneous first writers converge on one inode; otherwise one process can map a now-deleted inode and lose page-cache sharing.
  • Campaigns: elodin monte-carlo run ... pins one campaign ELODIN_CACHE_DIR across all workers. Add --memory-probe only for memory-proof runs; it writes memory.json with shared-constant PSS evidence without a bespoke runner.

Relevant tests:

bash
cargo test -p cranelift-mlir --test large_constant_cache
cargo test -p cranelift-mlir --test imported_data_arena -- --ignored --nocapture
cargo test -p cranelift-mlir large_external_constant_8d_dynamic_slice

Customer-style checkpoint repro:

bash
ELODIN_CRANELIFT_DEBUG_DIR=/tmp/dbg \
  cargo test -p cranelift-mlir --test checkpoint_test --release verify_checkpoint -- --ignored --nocapture

# To hold two verifier processes for mmap/PSS sampling:
ELODIN_CACHE_DIR=/tmp/elodin-const-cache-proof \
ELODIN_CRANELIFT_DEBUG_DIR=/tmp/dbg \
ELODIN_CRANELIFT_CHECKPOINT_HOLD_AFTER_TICK_MS=120000 \
  cargo test -p cranelift-mlir --test checkpoint_test --release verify_checkpoint -- --ignored --nocapture

Adding a new op

  1. IR: add Instruction variant in src/ir.rs
  2. Parser: add arm in parse_op() in src/parser.rs
  3. Lowering (scalar): add match arm in lower_instruction() in src/lower.rs
  4. Lowering (pointer-ABI): add match arm in lower_instruction_mem() in src/lower.rs
  5. Runtime (if N-D): add tensor_<op>_f64 in src/tensor_rt.rs, register in TensorRtIds
  6. Tests: golden-value tests in tests/ops.rs exercising both run_mlir and run_mlir_mem
  7. cargo test -p cranelift-mlir

The dual-ABI / SIMD / tensor-runtime design constraints each step has to satisfy are documented in ARCHITECTURE.md.

Show full SKILL.md (247 more words)Show less

Adding a new simulation example

  1. Dump MLIR: ELODIN_BACKEND=cranelift ELODIN_CRANELIFT_DEBUG_DIR=/tmp/dbg python examples/<name>/main.py run
  2. Catalog ops: python3 libs/cranelift-mlir/scripts/catalog_ops.py /tmp/dbg/stablehlo.mlir (safe on multi-GB files — do NOT grep them)
  3. Copy the MLIR into testdata/, create an e2e test
  4. Implement any missing ops (see "Adding a new op")
  5. Regression: ELODIN_BACKEND=cranelift bash scripts/ci/regress.sh <name> examples/<name>/main.py

Debugging

Simulation produces wrong values

The tick checkpoint diagnostic tool is the workhorse. Full usage and MLIR-bisection workflow in ARCHITECTURE.md — Checkpoint Diagnostic Tool section. Quick commands:

bash
# Capture XLA reference + Cranelift outputs for every tick input:
ELODIN_BACKEND=cranelift ELODIN_CRANELIFT_DEBUG_DIR=/tmp/ckpt \
  bash scripts/ci/regress.sh <example> examples/<example>/main.py

# Compare, per output, element-by-element:
ELODIN_CRANELIFT_DEBUG_DIR=/tmp/ckpt \
  cargo test -p cranelift-mlir --test checkpoint_test --release -- --ignored --nocapture

Once the diverging output is identified, reduce it to a minimal tests/ops.rs reproducer before fixing.

Simulation crashes (segfault / abort)
  • Try --release first: some JIT paths trip ptr::copy_nonoverlapping debug-mode UB checks.
  • Stack overflow on complex sims: the checkpoint test pins a 64 MB thread stack; mirror this if reproducing outside the test.
  • NULL pointer in JIT code is almost always a cross-ABI marshaling bug.
Compiler says "unsupported instruction" or "unsupported custom_call target"

Follow "Adding a new op".

Environment variables

Only two matter day-to-day:

  • ELODIN_BACKEND — cranelift (default), jax-cpu, jax-gpu.
  • ELODIN_CRANELIFT_DEBUG_DIR=<dir> — single flag for every diagnostic (profile probes, op-category sampling, tick waveform, instr/fold reports, inliner and slot-pool traces, MLIR dump, first-tick XLA reference checkpoint). Files land flat under <dir>. Zero overhead when unset.

Full outputs and reading guide: PERFORMANCE.md.

Further reading

© elodin-sys, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .cursor/skills/elodin-cranelift of elodin-sys/elodin.

Open the folder on GitHubat commit 729022c

Compare with similar skills

Elodin Cranelift next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Elodin Cranelift compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Elodin Cranelift this skillelodin-sys/elodin547—~2kAutomated safety check: PassApache-2.0
Trellis Session Insightmindfold-ai/Trellis15k4 repos~1.7kAutomated safety check: PassAGPL-3.0
Native Data FetchingCherryHQ/cherry-studio-app4k6 repos~2.9kAutomated safety check: NotesMIT
Debugging Executionsn8n-io/n8n207k—~2.6kAutomated safety check: PassCustom licence
Aoti Debugpytorch/pytorch104k1 repos~1.7kAutomated safety check: PassCustom licence
Herdr Throwaway Reproductionherdrdev/herdr43k—~2.4kAutomated safety check: PassApache-2.0

Similar skills

  • Trellis Session Insight

    mindfold-ai/Trellis

    Reach into past AI conversation history through the trellis mem CLI.

    15k GitHub starsUsed in 4 repos~1.7k tokens
    DevelopmentAuto-check passed
  • Native Data Fetching

    CherryHQ/cherry-studio-app

    A skill your agent uses when implementing or debugging ANY network request, API call, or data fetching.

    4k GitHub starsUsed in 6 repos~2.9k tokens
    DevelopmentAuto-check: notes
  • Official

    Debug failed or wrong-output workflow executions using executions tools.

    207k GitHub stars~2.6k tokensUpdated today
    DevelopmentAuto-check passed
  • Aoti Debug

    pytorch/pytorch

    Debug AOTInductor (AOTI) errors and crashes. An agent skill from pytorch/pytorch.

    104k GitHub starsUsed in 1 repo~1.7k tokens
    DevelopmentAuto-check passed
  • Runs a disposable, uniquely named Herdr session inside an existing one so runtime, pane, terminal or API bugs can be reproduced without touching the main session.

    43k GitHub stars~2.4k tokensUpdated 2 days ago
    DevelopmentAuto-check passed
  • Systematic Debugging

    ultralisp/ultralisp

    A skill your agent uses when encountering any bug, test failure, or unexpected behavior, before proposing fixes

    258 GitHub starsUsed in 51 repos~2.4k tokens
    DevelopmentAuto-check passed

More from elodin-sys/elodin

All 14 skills in this repo
  • Branch Regression

    elodin-sys/elodin

    Compare two git branches (usually the current branch vs main) by running every example on each, capturing exit codes, logs, and editor screenshots, then diffing the results.

    547 GitHub stars~1.6k tokensUpdated yesterday
    Auto-check passed
  • Elodin DB

    elodin-sys/elodin

    Work with Elodin-DB, the time-series telemetry database. An agent skill from elodin-sys/elodin.

    547 GitHub stars~2.9k tokensUpdated yesterday
    Auto-check passed
  • Elodin Dev

    elodin-sys/elodin

    Develop and contribute to the Elodin codebase. An agent skill from elodin-sys/elodin.

    547 GitHub stars~896 tokensUpdated yesterday
    Auto-check passed
  • Elodin Editor Dev

    elodin-sys/elodin

    Contribute to the Elodin Editor, the 3D viewer and graphing tool.

    547 GitHub stars~3.4k tokensUpdated yesterday
    Auto-check passed
  • Elodin Headless Capture

    elodin-sys/elodin

    Run the Elodin Editor without a physical display in Gamescope, take screenshots, and record video through PipeWire and GStreamer.

    547 GitHub stars~2.2k tokensUpdated yesterday
    Auto-check: notes
  • Elodin Monte Carlo

    elodin-sys/elodin

    Develop and calibrate simulations against experimental truth data using elodin monte-carlo.

    547 GitHub stars~2.9k tokensUpdated yesterday
    Auto-check passed

Categories

Questions about Elodin Cranelift

What does Elodin Cranelift do?

Work with the Cranelift JIT MLIR backend. An agent skill from elodin-sys/elodin. Elodin Cranelift is an agent skill from elodin-sys/elodin. Work with the Cranelift JIT MLIR backend.

When should I use Elodin Cranelift?

Elodin Cranelift fits situations like: modifying libs/cranelift-mlir/; adding new StableHLO ops; debugging simulation correctness issues; running the checkpoint diagnostic tool.

How do I install Elodin Cranelift in Claude Code?

Run `npx skills add elodin-sys/elodin --skill elodin-cranelift -a claude-code`. Or copy the skill folder (.cursor/skills/elodin-cranelift in elodin-sys/elodin) into .claude/skills/elodin-cranelift in your project. Claude Code loads it when a task matches its description.

How do I install Elodin Cranelift in Codex?

Run `npx skills add elodin-sys/elodin --skill elodin-cranelift -a codex`. Or copy the skill folder (.cursor/skills/elodin-cranelift in elodin-sys/elodin) into .agents/skills/elodin-cranelift in your project. Codex loads it when a task matches its description.

Can I use Elodin Cranelift in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add elodin-sys/elodin --skill elodin-cranelift -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/elodin-cranelift, .gemini/skills/elodin-cranelift, .github/skills/elodin-cranelift and .opencode/skills/elodin-cranelift in your project.

What does Elodin Cranelift need to run?

Going by SKILL.md and its folder, Elodin Cranelift needs the command-line tools its instructions call (cargo, bash, python, just, nix and python3). Our summary lists: Python 3.

Does Elodin Cranelift access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Elodin Cranelift safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Elodin Cranelift use?

Elodin Cranelift is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Elodin Cranelift use?

About 2k tokens (SKILL.md is roughly 8.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Elodin Cranelift?

Skills that share tags, products or a category with Elodin Cranelift: Trellis Session Insight (mindfold-ai/Trellis, 15k stars), Native Data Fetching (CherryHQ/cherry-studio-app, 4k stars), Debugging Executions (n8n-io/n8n, 207k stars) and Aoti Debug (pytorch/pytorch, 104k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Elodin Cranelift?

elodin-sys (a GitHub organization) maintains it in elodin-sys/elodin, which has 547 GitHub stars. The repository holds 14 skills in this directory. The repository was last updated on October 9, 2026.

Source: elodin-sys/elodin on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.