mod-003i-docstrings-should-include-cross-references

mod-003i-docstrings-should-include-cross-references is a cursor rule for Cursor from NVIDIA/physicsnemo. It costs 32 tokens per session (477 once invoked), scanned A, original, Apache-2.0.

A documentation rule for Python docstrings, which are explanatory notes attached to code. It requires links to related classes, functions, methods, and outside resources using Sphinx documentation syntax.

In plain words
What is it for?
Use it when writing or reviewing docstrings that mention other code elements, research papers, websites, or documentation.
Why use it?
It makes generated documentation easier to navigate and helps readers move directly between related code and supporting references.

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-003i-docstrings-should-include-cross-references
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-003i-docstrings-should-include-cross-references

README.md
[![agentmods](https://agentmods.dev/badge/rules/nvidia/physicsnemo/mod-003i-docstrings-should-include-cross-references.svg)](https://agentmods.dev/rules/nvidia/physicsnemo/mod-003i-docstrings-should-include-cross-references)
Your own site
<a href="https://agentmods.dev/rules/nvidia/physicsnemo/mod-003i-docstrings-should-include-cross-references"><img src="https://agentmods.dev/badge/rules/nvidia/physicsnemo/mod-003i-docstrings-should-include-cross-references.svg" alt="Measured on agentmods" height="20"></a>
Per session 32 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 477 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.00032 $0.00477
Opus 5 $0.00016 $0.00238
Sonnet 5 $0.00006 $0.00095
Haiku 4.5 $0.00003 $0.00048

Measured 4d ago against content hash 3cb2867b5104, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

mod-003i-docstrings-should-include-cross-references 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-003i-docstrings-should-include-cross-references.mdc · 65 lines

What it actually says

When writing docstrings with references to other code, rule MOD-003i should be followed. Explicitly reference "Following rule MOD-003i, which encourages cross-references using :class:, :func:, :meth:..." when adding links.

MOD-003i: Docstrings should include cross-references

Description:

When possible, docstrings should use links to other docstrings using Sphinx cross-reference syntax:

  • Classes: :class:~physicsnemo.models.some_model.SomeModel``
  • Functions: :func:~physicsnemo.utils.common_function``
  • Methods: :meth:~physicsnemo.models.some_model.SomeModel.some_method``

When referencing external resources, such as papers, websites, or other documentation, docstrings should use links to the external resource in the format some link text <some_url>_.

Rationale:

Cross-references create a navigable documentation structure where users can easily jump between related classes, methods, and functions. External links provide context and attribution for algorithms and techniques. This improves the overall quality and usability of the documentation.

Example:

class MyEncoder(Module):
    r"""
    Encoder network using attention mechanism.

    This implementation is based on `Transformer Architecture <https://arxiv.org/abs/1706.03762>`_.
    See :class:`~physicsnemo.nn.MultiHeadAttention` for attention details.

    Parameters
    ----------
    activation : str
        Activation function. See :func:`~torch.nn.functional.relu` for details.

    Notes
    -----
    Can be paired with :class:`~physicsnemo.models.decoder.MyDecoder` for
    autoencoding tasks.
    """
    pass

Anti-pattern:

# Not necessarily wrong, but missing opportunities for useful links
class MyEncoder(Module):
    r"""
    Encoder network using attention mechanism.

    Based on the Transformer paper.  # Could link to paper
    Uses MultiHeadAttention.  # Could link to class
    """
    pass
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 · 65 lines · 32 tokens per session scan A 3cb2867b5104

Subscribe to this mod's changes

mod-003i-docstrings-should-include-cross-references is a cursor rule published in the GitHub repository NVIDIA/physicsnemo (3,211 stars, last pushed yesterday), licensed Apache-2.0. It adds 32 tokens to every session and 477 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.