guide

guide is a cursor rule for Cursor from altaidevorg/rules-for-ai. It costs 984 tokens per session, scanned A, original, MIT.

A guide to Flax NNX, a neural-network library for JAX. It explains how NNX combines ordinary Python objects with JAX’s function-based processing, including model state, filters, transformations, and state handling.

In plain words
What is it for?
Use it as an introduction or reference when building NNX modules, selecting their state, applying JAX operations, or using the NNX functional interface.
Why use it?
It provides the background needed to understand how NNX models work and how their changing values are made compatible with JAX.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it as an introduction or reference when building NNX modules, selecting their state, applying JAX operations, or using the NNX functional interface.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/altaidevorg/rules-for-ai/guide
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/altaidevorg/rules-for-ai

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for guide

README.md
[![agentmods](https://agentmods.dev/badge/rules/altaidevorg/rules-for-ai/guide/github.svg)](https://agentmods.dev/rules/altaidevorg/rules-for-ai/guide)
Your own site
<a href="https://agentmods.dev/rules/altaidevorg/rules-for-ai/guide"><img src="https://agentmods.dev/badge/rules/altaidevorg/rules-for-ai/guide/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for guide

Your own site · 80×15
<a href="https://agentmods.dev/rules/altaidevorg/rules-for-ai/guide"><img src="https://agentmods.dev/badge/rules/altaidevorg/rules-for-ai/guide.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 984 This file is loaded in full into every session.
When invoked 984 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00984 $0.00984
Opus 5.5 $0.00394 $0.00394
Sonnet 5.5 $0.00197 $0.00197
Haiku 4.5 $0.00098 $0.00098

Measured 2mo ago against content hash 0d86edc9c792, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

guide scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

examples/flax/guide.mdc · 62 lines

What it actually says

Flax NNX is a neural network library for JAX designed to enhance the developer experience by integrating stateful object-oriented programming with JAX's functional paradigm. The core abstraction is nnx.Module (0), a standard Python class where state (parameters, batch statistics, RNG states) is held directly as attributes, typically wrapped in nnx.Variable (1) subtypes (e.g., nnx.Param, nnx.BatchStat). This allows for intuitive initialization and direct attribute access.

To bridge the gap with JAX's requirement for pure functions and immutable data structures (pytrees), NNX provides:

  1. A Functional API (2): Functions like nnx.split, nnx.merge, nnx.state, and nnx.update allow explicitly separating a Module's static structure (GraphDef) from its dynamic state (GraphState), which is a pytree of immutable nnx.VariableState (1) objects. GraphDef and GraphState (7) form the internal representation used by this API. Filters (5) are used extensively within this API to select specific parts of the state based on type, tags, or path.
  2. Lifted Transforms (3): Higher-level wrappers around JAX transformations (e.g., nnx.jit, nnx.grad, nnx.vmap) that implicitly handle the state splitting and merging via the Functional API (2), offering a more object-oriented interface to users.

Auxiliary components include:

  • nnx.Rngs (4): Manages PRNG keys for reproducibility and simplified handling within nnx.Module methods.
  • nnx.Optimizer (6): A helper class encapsulating a Module, its differentiable parameters (selected via Filters (5)), an Optax optimizer, and its state, simplifying the training loop update step.

Overall, NNX aims to provide the flexibility and ease-of-use of Python objects while retaining compatibility with the performance benefits of JAX's functional transformations.

Source Repository: https://github.com/google/flax.git

flowchart TD
    A0["nnx.Module"]
    A1["nnx.Variable / nnx.VariableState"]
    A2["NNX Functional API (split/merge/state/update/graphdef)"]
    A3["NNX Lifted Transforms (jit, grad, vmap, scan, etc.)"]
    A4["nnx.Rngs"]
    A5["Filters (`filterlib`)"]
    A6["nnx.Optimizer"]
    A7["Graph Representation (GraphDef / GraphState)"]
    A0 -- "Contains / Holds state in" --> A1
    A0 -- "Uses for randomness" --> A4
    A2 -- "Operates on / Deconstructs ..." --> A0
    A2 -- "Produces / Consumes" --> A7
    A2 -- "Uses for selection" --> A5
    A3 -- "Operates on" --> A0
    A3 -- "Uses implicitly" --> A2
    A5 -- "Selects / Filters" --> A1
    A6 -- "Wraps / Manages" --> A0
    A6 -- "Updates state of" --> A1
    A6 -- "Uses for parameter selection" --> A5
    A7 -- "Contains immutable state" --> A1
    A4 -- "Manages RNG state via" --> A1
    A3 -- "Uses for selection (e.g., S..." --> A5

Chapters

nnx.Module nnx.Variable / nnx.VariableState nnx.Rngs Filters (filterlib) NNX Lifted Transforms (jit, grad, vmap, scan, etc.) NNX Functional API (split/merge/state/update/graphdef) Graph Representation (GraphDef / GraphState) nnx.Optimizer


Generated by Rules for AI

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 62 lines · 984 tokens per session scan A 0d86edc9c792

Subscribe to this mod's changes

guide is a cursor rule published in the GitHub repository altaidevorg/rules-for-ai (2 stars, last pushed 1y ago), licensed MIT. It adds 984 tokens to every session, about $0.0039 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other cursor rules, from other repositories

pytorch-deep-learning

A set of Python guidelines for building and training deep-learning models with PyTorch, a machine-learning framework. It covers model structures, training loops, loss calculation, optimization, and choosing available hardware.

holtwood/awesome-cursorrules-zh · 316 tokens

scikit-learn-machine-learning

A set of Python guidelines for building machine-learning models with scikit-learn, a library for training models from data. It covers preparing data, linking processing steps into pipelines, training models, and checking results with cross-validation.

holtwood/awesome-cursorrules-zh · 181 tokens

tensorflow-handbook

A set of guidelines for building and training neural networks with TensorFlow and Keras, Python tools for machine learning. It covers sequential models, model training, distributed training, and using multiple GPUs.

holtwood/awesome-cursorrules-zh · 169 tokens

langflow-input-types

This document provides a comprehensive guide to all input types available in Langflow. Each input type is designed for specific use cases and data formats.

Empreiteiro/langflow-factory · 5,974 tokens

dask-notebook

Create a Jupyter notebook that sets up a Dask distributed LocalCluster and walks through an ETL workflow.

brendancol/xarray-spatial-skills · 0 tokens

032_MIPROv2_MultiHop_Reasoning_Tutorial

Comprehensive example of using MIPROv2 to optimize complex multi-hop reasoning systems with DSPy 3.0.1. This tutorial demonstrates advanced reasoning chain optimization, knowledge graph traversal, and production-ready multi-step inference systems.

AIFlowML/cursor_rules · 10,696 tokens