agentleFS
elodin-syselodin-sys/elodin/.cursor/skills/nox-py-dev/SKILL.md

nox-py-dev

Skill553 starsChanged 5 months agoApache-2.0View on GitHub

Contribute to the Elodin Python SDK (nox-py). Use when editing PyO3 bindings in libs/nox-py/, adding new Python API surface, modifying the JAX integration, working on component/system compilation, or changing the Python package in python/elodin/.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 2 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Add PyO3 #[pyclass] bindings

    line 107
  2. Very specific:

    Add Python-side type alias in python/elodin/__init__.py

    line 109
  3. Distinctive:

    Test: spawn an entity with the component, verify it appears in the editor

    line 110
  4. Very specific:

    Add the Python decorator in python/elodin/__init__.py

    line 115
  5. Very specific:

    Ensure it composes with | (pipe operator)

    line 116
  6. Distinctive:

    Test: write a simulation using the new decorator, verify output

    line 117
  7. Very specific:

    Add the mode in exec.rs (or world_builder.rs for world-level API)

    line 121
  8. Very specific:

    Add Python API in world_builder.rs

    line 123

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

nox-py Development

nox-py is the Elodin Python SDK — PyO3 bindings that bridge Python simulations to the Rust ECS engine (in nox-py/src/), the NOX tensor compiler (→ cranelift / JAX), and Impeller telemetry.

Build & Test

just install py

# Run tests
pytest libs/nox-py/tests/

# Quick verification with an example
elodin editor examples/three-body/main.py

Rebuild the wheel after any Rust changes. Python-only changes in python/elodin/ are picked up immediately.

Architecture

Python user code
    │
    ▼
python/elodin/__init__.py    ← Python API surface, decorators, Query/GraphQuery
    │
    ▼
libs/nox-py/src/lib.rs       ← PyO3 module registration
    │
    ├── world_builder.rs      ← World creation, spawn, run
    ├── system.rs             ← System compilation pipeline
    ├── component.rs          ← Component types and metadata
    ├── archetype.rs          ← Archetype definitions
    ├── query.rs              ← Query system (map, map_seq)
    ├── graph.rs              ← GraphQuery and edge_fold
    ├── spatial.rs            ← SpatialTransform, SpatialMotion, SpatialForce, SpatialInertia
    ├── entity.rs             ← EntityId management
    ├── exec.rs               ← WorldExec enum (Iree/Jax), profiling, DB integration
    ├── jax_exec.rs           ← JaxExec, JaxWorldExec (JAX JIT per-tick execution)
    ├── step_context.rs       ← StepContext for pre/post step callbacks
    ├── impeller_client.rs    ← Impeller client for DB connection
    ├── asset.rs              ← Mesh, Material, GLB asset handling
    ├── linalg.rs             ← Linear algebra utilities
    ├── ukf.rs                ← Unscented Kalman Filter
    ├── s10.rs                ← S10 recipe integration
    └── error.rs              ← Error types and Python exception mapping
    │
    ▼
libs/nox/                     ← Tensor library, symbolic backend
    │
    ▼
libs/cranelift-mlir/          ← Pure Rust StableHLO runtime

Python API Surface

python/elodin/__init__.py

The main API module. Exports:

  • Decorators: @system, @map, @map_seq
  • Types: World, Query, GraphQuery, Component, Archetype, Body
  • Spatial types: SpatialTransform, SpatialMotion, SpatialForce, SpatialInertia, Quaternion
  • Built-in components: WorldPos, WorldVel, Inertia, Force, WorldAccel
  • Utilities: six_dof(), Panel, GraphEntity, Mesh, Material, Edge

python/elodin/jaxsim.py

JAX-only execution mode. Compiles the simulation world into pure JAX functions for RL training and jax.vmap batching.

python/elodin/egm08.py / python/elodin/j2.py

Earth gravity models. EGM08 is a high-fidelity spherical harmonics model; J2 is simple oblate Earth.

Key Rust Modules

world_builder.rs

Central orchestrator. Handles World.spawn(), World.insert(), World.run(), World.build(), World.to_jax(). This is where simulation execution modes branch.

system.rs

Compiles Python-defined systems into executable computations via cranelift (default) or JAX. Handles the @system, @map, @map_seq decorator logic on the Rust side. System composition (pipe |) is implemented here.

exec.rs

Defines WorldExec enum with Cranelift(CraneliftWorldExec) and Jax(JaxWorldExec) variants. Both implement the same interface for tick execution, profiling, and DB integration. The backend parameter in w.run() / w.build() selects between the cranelift and JAX execution modes.

jax_exec.rs

JAX backend: compiles Noxpr graph → jax.jit() callable, then executes each tick by calling the JAX function via PyO3. Slower than cranelift but supports all JAX operations and the GPU.

component.rs

Maps Python Component annotations to component schemas. Handles type inference, metadata, and the ComponentType / PrimitiveType hierarchy.

spatial.rs

PyO3 bindings for spatial vector algebra types. Each type wraps a nox tensor and exposes Python-friendly constructors, accessors, and arithmetic operators.

graph.rs

Graph query implementation. edge_fold is the core operation — it iterates edges, queries left/right entity components, and accumulates results.

Adding a New Feature

New Component Type

  1. Define the Rust type in component.rs or a new module
  2. Add PyO3 #[pyclass] bindings
  3. Export in lib.rs module registration
  4. Add Python-side type alias in python/elodin/__init__.py
  5. Test: spawn an entity with the component, verify it appears in the editor

New System Decorator

  1. Implement the Rust compilation logic in system.rs
  2. Add the Python decorator in python/elodin/__init__.py
  3. Ensure it composes with | (pipe operator)
  4. Test: write a simulation using the new decorator, verify output

New Execution Mode

  1. Add the mode in exec.rs (or world_builder.rs for world-level API)
  2. Wire CLI support in apps/elodin/ if needed
  3. Add Python API in world_builder.rs

Dependencies

CratePurpose
pyo3Python ↔ Rust bindings
numpyNumPy array interop (via pyo3-numpy)
nox-py (Rust core)ECS world, component storage, system execution
noxTensor library, spatial math
impellerTelemetry protocol
stellaratorAsync runtime for DB connections
tokioAsync runtime (for some I/O paths)

Key References

  • Full SDK documentation: libs/nox-py/README.md
  • Python API reference: docs/public/content/reference/python-api.md
  • nox-py Rust source: libs/nox-py/src/
  • Impeller protocol: libs/impeller/

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.