cursor-rules

A set of working rules for editing Jupyter Notebooks, which are interactive files that combine code, notes, and results. It directs the agent to use notebook-specific tools when inspecting or changing `.ipynb` files.

In plain words
What is it for?
Reading, creating, deleting, renaming, investigating, and modifying Jupyter Notebook files.
Why use it?
Directly editing a notebook as plain text can damage its internal structure. These rules also help the agent inspect the relevant cells and outputs before making changes.

Cursor rule

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/svallory/the-notebook-mcp/cursor-rules
Clone the repo
git clone --depth 1 https://github.com/svallory/the-notebook-mcp
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,097 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.00015 $0.01097
Opus 5 $0.00008 $0.00549
Sonnet 5 $0.00003 $0.00219
Haiku 4.5 $0.00002 $0.00110

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

Security

Grade A, and why

cursor-rules 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 2d 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/cursor-rules.mdc · 72 lines

How it starts

The opening of the file, as written. The whole thing — 72 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Jupyter Notebook Rules for Cursor (Using the-notebook-mcp MCP server):

  1. Tool Usage:

    • Always use the tools provided by the the-notebook-mcp server for operations on Jupyter Notebook (.ipynb) files.
    • Avoid using the standard edit_file tool on .ipynb files, as this can corrupt the notebook structure.
  2. Investigation Strategy:

    • A comprehensive suite of tools is available to inspect notebooks. If the user mentions an issue, a specific cell, or asks for a modification, first attempt to gather context independently.
    • Use the available tools to examine the notebook structure, content, metadata, and outputs to locate the relevant context or identify the problem.
    • Ask the user for clarification only if the necessary information cannot be determined after using the investigation tools.
  3. Available Tools:

    • Notebook File Tools:

      • notebook_create: Creates a new, empty notebook file.
      • notebook_delete: Deletes an existing notebook file.
      • notebook_read: Reads an entire notebook and returns its structure as a dictionary.
      • notebook_rename: Renames/moves a notebook file from one path to another.
    • Cell Manipulation tools:

      • notebook_add_cell: Adds a new code or markdown cell after a specified index.
      • notebook_change_cell_type: Changes a cell's type (code, markdown, or raw).
      • notebook_delete_cell: Deletes a specific cell.
      • notebook_duplicate_cell: Duplicates a cell multiple times (default: once).
      • notebook_edit_cell: Replaces the source content of a specific cell.
      • notebook_get_cell_count: Returns the total number of cells.
      • notebook_get_info: Retrieves general information (cell count, metadata, kernel, language info).
      • notebook_merge_cells: Merges a cell with the cell immediately following it.
      • notebook_move_cell: Moves a cell to a different position.
      • notebook_read_cell: Reads the source content of a specific cell.
      • notebook_split_cell: Splits a cell into two at a specified line number.
    • Cell Output Tools:

      • notebook_read_cell_output: Reads the output list of a specific code cell.
      • notebook_clear_cell_outputs: Clears the outputs and execution count of a specific cell.
      • notebook_clear_all_outputs: Clears outputs and execution counts for all code cells.
    • Notebook Metadata Tools:

      • notebook_read_metadata: Reads the top-level notebook metadata.
      • notebook_edit_metadata: Updates the top-level notebook metadata.
    • Cell Metadata Tools:

      • notebook_read_cell_metadata: Reads the metadata of a specific cell.
      • notebook_edit_cell_metadata: Updates the metadata of a specific cell.
    • Utility Tools:

      • notebook_validate: Validates the notebook structure against the nbformat schema.
      • notebook_export: Exports the notebook to another format (e.g., python, html) using nbconvert. Note: See External Dependencies below for requirements needed for certain export formats like PDF.
  4. Math Notation: For LaTeX in Markdown cells, use $ ... $ for inline math and $$ ... $$ for display math. Avoid \( ... \) and \[ ... \].

  5. Cell Magics:

    • Avoid unsupported cell magics like %%bash, %%timeit, and %%writefile.
    • Use !command for shell commands instead of %%bash.
    • Use %timeit (line magic) for timing single statements.
    • %%html works for rendering HTML output.
    • %%javascript can execute (e.g., alert), but avoid relying on it for manipulating cell output display.
  6. Rich Outputs: Matplotlib, Pandas DataFrames, Plotly, ipywidgets (tqdm.notebook), and embedded HTML in Markdown generally render correctly.

  7. Mermaid: Diagrams in ```mermaid ``` blocks are not rendered by default.

  8. Character Escaping in source Parameter:

Read the full file on GitHub · 72 lines

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. 2d ago First seen · 72 lines · 15 tokens per session scan A 8045de02905f

Subscribe to this mod's changes

cursor-rules is a cursor rule published in the GitHub repository svallory/the-notebook-mcp (4 stars, last pushed 1y ago), licensed MIT. It adds 15 tokens to every session and 1,097 once invoked, about $0.0001 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-31.