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

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.

agentmods
npx agentmods add rules/nvidia/physicsnemo/mod-006-invalid-or-missing-jaxtyping-tensor-annotations
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.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.svg" alt="Measured on agentmods" 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. Scan, not verified.
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 $0.00039 $0.00540
Opus 5 $0.00019 $0.00270
Sonnet 5 $0.00008 $0.00108
Haiku 4.5 $0.00004 $0.00054

Measured 4d ago against content hash c1ce0d71eead, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 4d 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. 4d 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,216 stars, last pushed today), licensed Apache-2.0. It adds 39 tokens to every session and 540 once invoked, about $0.0002 per session on Opus 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.