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.
npx agentmods add rules/survivorforge/cursor-rules/rulegit clone --depth 1 https://github.com/survivorforge/cursor-rulesWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.02173 |
| Opus 5 | $0.00000 | $0.01086 |
| Sonnet 5 | $0.00000 | $0.00435 |
| Haiku 4.5 | $0.00000 | $0.00217 |
Grade A, and why
rule 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 yesterday.
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.
This is a copy
91% identical to cursorrules — 6 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 250 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AI/ML Python Projects — Cursor Rules
Production ML: PyTorch, data pipelines, experiment tracking, and deployment
Project Context
You are building an AI/ML project with Python. The project uses PyTorch for model training, handles data pipelines with proper validation, tracks experiments systematically, and follows production ML engineering practices. Code is type-hinted, tested, and reproducible.
Project Structure
project/
src/
data/
datasets.py # PyTorch Dataset classes
transforms.py # Data augmentation and preprocessing
loaders.py # DataLoader configurations
validation.py # Data quality checks
models/
architectures/ # Model definitions
resnet.py
transformer.py
losses.py # Custom loss functions
metrics.py # Evaluation metrics
training/
trainer.py # Training loop
callbacks.py # Training callbacks (early stopping, checkpointing)
optimizers.py # Optimizer configurations
inference/
predictor.py # Inference pipeline
postprocess.py # Output postprocessing
utils/
config.py # Configuration management
logging.py # Experiment logging
reproducibility.py # Seed setting, deterministic mode
configs/
train_config.yaml # Training hyperparameters
model_config.yaml # Model architecture config
scripts/
train.py # Training entry point
evaluate.py # Evaluation script
export.py # Model export (ONNX, TorchScript)
notebooks/
exploration.ipynb # Data exploration (not production code)
tests/
test_data.py
test_models.py
test_training.py
PyTorch Model Patterns
- Inherit from
nn.Module. Always callsuper().__init__(). - Type hint all method signatures:
class ClassificationHead(nn.Module): def __init__(self, in_features: int, num_classes: int, dropout: float = 0.1) -> None: super().__init__() self.dropout = nn.Dropout(dropout) self.fc = nn.Linear(in_features, num_classes) def forward(self, x: torch.Tensor) -> torch.Tensor: x = self.dropout(x) return self.fc(x) - Use
nn.Sequentialornn.ModuleListfor dynamic layer construction — never regular Python lists. - Register buffers for non-parameter tensors:
self.register_buffer('mean', torch.zeros(3)). - Use
@torch.no_grad()for inference methods. - DON'T: Use numpy operations inside
forward()— they break autograd. - DON'T: Create tensors in
forward()without sending to the correct device.
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.
- yesterday First seen · 250 lines · 0 tokens per session scan A c14e0f692310
rule is a cursor rule published in the GitHub repository survivorforge/cursor-rules (18 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,173 tokens. A static security scan graded it A with 0 findings. It is 91% identical to cursorrules, differing in 6 lines, and is treated as a copy.
Other cursor rules, from other repositories
feature-implementation
Structured approach for complex feature implementation with mandatory planning and user approval.
git-safety
Git Safety Rule - Require explicit permission for all git operations.
pr-code-review
Code review rule for PR analysis. Challenges architectural decisions, examines the diff with the default branch, and provides comprehensive feedback on code quality, security, performance, and maintainability before publishing.
mcp-tool-definition
When adding or editing an MCP Server's tool, follow this structure to make it clear when and how the tool should be used.
docs-location
Require technical design docs in docs/ and feature README files next to their code.
component-development
Modern React + TypeScript component patterns — hooks, typed props, performance optimization, forms, and testing.