mod-006-invalid-or-missing-jaxtyping-tensor-annotations

mod-006-invalid-or-missing-jaxtyping-tensor-annotations is a cursor rule for Cursor from NVIDIA/physicsnemo. It costs 39 tokens per session (540 once invoked), scanned A, original, Apache-2.0.

A coding rule for machine-learning models that use tensors, which are multi-dimensional numerical data such as images or batches of text. It requires tensor inputs to include jaxtyping annotations describing their expected dimensions.

In plain words
What is it for?
Use it when adding or reviewing tensor arguments in model constructors, forward methods, or other public model methods.
Why use it?
It makes tensor shapes visible in the code and can catch mismatched shapes earlier when runtime checking is enabled.

Cursor rule for Cursor ✓ vendor

Written for Cursor: installed under .cursor/.

Good fit Use it when adding or reviewing tensor arguments in model constructors, forward methods, or other public model methods.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/nvidia/physicsnemo/mod-006-invalid-or-missing-jaxtyping-tensor-annotations
About the project

PhysicsNeMo is an open-source PyTorch framework for creating, training, and fine-tuning machine-learning models for physics, scientific computing, and engineering. Researchers and engineers use its reusable components and training recipes for applications such as aerodynamics, weather forecasting, structural mechanics, geophysics, and thermal design. The catalogue entries provide rules and skills for working with PhysicsNeMo projects.

NVIDIA/physicsnemo · 3,418 stars · on GitHub · developer.nvidia.com

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/NVIDIA/physicsnemo

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 mod-006-invalid-or-missing-jaxtyping-tensor-annotations

README.md
[![agentmods](https://agentmods.dev/badge/rules/nvidia/physicsnemo/mod-006-invalid-or-missing-jaxtyping-tensor-annotations/github.svg)](https://agentmods.dev/rules/nvidia/physicsnemo/mod-006-invalid-or-missing-jaxtyping-tensor-annotations)
Your own site
<a href="https://agentmods.dev/rules/nvidia/physicsnemo/mod-006-invalid-or-missing-jaxtyping-tensor-annotations"><img src="https://agentmods.dev/badge/rules/nvidia/physicsnemo/mod-006-invalid-or-missing-jaxtyping-tensor-annotations/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 mod-006-invalid-or-missing-jaxtyping-tensor-annotations

Your own site · 80×15
<a href="https://agentmods.dev/rules/nvidia/physicsnemo/mod-006-invalid-or-missing-jaxtyping-tensor-annotations"><img src="https://agentmods.dev/badge/rules/nvidia/physicsnemo/mod-006-invalid-or-missing-jaxtyping-tensor-annotations.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 39 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 540 The whole file, excluding the scripts and references it only reads on demand.
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.00039 $0.00540
Opus 5.5 $0.00016 $0.00216
Sonnet 5.5 $0.00008 $0.00108
Haiku 4.5 $0.00004 $0.00054

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

Security

Grade A, and why

mod-006-invalid-or-missing-jaxtyping-tensor-annotations 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.

.cursor/rules/mod-006-invalid-or-missing-jaxtyping-tensor-annotations.mdc · 67 lines

What it actually says

When adding type hints to model methods, rule MOD-006 must be followed. Explicitly reference "Following rule MOD-006, which requires all tensor arguments to use jaxtyping annotations..." when adding type hints.

MOD-006: Invalid or missing jaxtyping tensor annotations in public function signature

Description:

All tensor arguments and variables in model __init__, forward, and other public methods must have type annotations using jaxtyping. This provides runtime-checkable shape information in type hints.

Use the format Float[torch.Tensor, "shape_spec"] where shape_spec describes tensor dimensions using space-separated dimension names (e.g., "batch channels height width" or "b c h w").

Rationale:

Jaxtyping annotations provide explicit, machine-readable documentation of expected tensor shapes. This enables better IDE support, catches shape errors earlier, and makes code more self-documenting. The annotations serve as both documentation and optional runtime checks when jaxtyping's validation is enabled.

Example:

from jaxtyping import Float
import torch

class MyConvNet(Module):
    def __init__(self, in_channels: int, out_channels: int):
        super().__init__()
        self.conv = torch.nn.Conv2d(in_channels, out_channels, kernel_size=3)

    def forward(
        self,
        x: Float[torch.Tensor, "batch in_channels height width"]
    ) -> Float[torch.Tensor, "batch out_channels height width"]:
        """Process input with convolution."""
        return self.conv(x)

Anti-pattern:

# WRONG: No jaxtyping annotations
def forward(self, x: torch.Tensor) -> torch.Tensor:
    return self.layer(x)

# WRONG: Using plain comments instead of jaxtyping
def forward(self, x: torch.Tensor) -> torch.Tensor:
    # x: (batch, channels, height, width)  # Use jaxtyping instead
    return self.layer(x)

# WRONG: Incomplete annotations
def forward(
    self,
    x: Float[torch.Tensor, "b c h w"],
    mask: torch.Tensor  # Missing jaxtyping annotation
) -> Float[torch.Tensor, "b c h w"]:
    return self.layer(x, mask)
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 · 67 lines · 39 tokens per session scan A c1ce0d71eead

Subscribe to this mod's changes

mod-006-invalid-or-missing-jaxtyping-tensor-annotations is a cursor rule published in the GitHub repository NVIDIA/physicsnemo (3,418 stars, last pushed yesterday), licensed Apache-2.0. It adds 39 tokens to every session and 540 once invoked, about $0.0002 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-30.

Related

mod-006-invalid-or-missing-jaxtyping-tensor-annotations compared with cursor rules from other repositories

mod-006-invalid-or-missing-jaxtyping-tensor-annotations next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
mod-006-invalid-or-missing-jaxtyping-tensor-annotationsNVIDIA/physicsnemoCursor rule3.4kyesterdayApache-2.0A39Cursor
scripts-executioncpuguy96/StepCOVNetCursor rule2226d agoApache-2.0A0Cursor
specsstreamlit/streamlitCursor rule46kyesterdayApache-2.0A0Cursor
workflowsstreamlit/streamlitCursor rule46kyesterdayApache-2.0A0Cursor
embedded_skillsstreamlit/streamlitCursor rule46kyesterdayApache-2.0A0Cursor
ponytailDietrichGebert/ponytailCursor rule185k8d agoMITA604Cursor
angular-20angular/angularCursor rule101kyesterdayMITA0Cursor