cursorrules

A set of Cursor editor rules for automatically maintaining a project's multi-level documentation indexes. Cursor is an AI-assisted code editor that can load these rules when a conversation starts.

In plain words
What is it for?
Use it to keep project and folder indexes, dependency diagrams, and file header comments updated when code imports, exports, classes, or other public definitions change.
Why use it?
It makes structural documentation updates part of the normal coding workflow while leaving small implementation changes alone. It also defines files, folders, languages, and large-file limits that should be skipped.

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/claudate/project-multilevel-index/cursorrules
Clone the repo
git clone --depth 1 https://github.com/Claudate/project-multilevel-index

Made for: Cursor.

Per session 745 This file is loaded in full into every session.
When invoked 745 The same file — it is already loaded in full.
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.00745 $0.00745
Opus 5 $0.00373 $0.00373
Sonnet 5 $0.00149 $0.00149
Haiku 4.5 $0.00075 $0.00075

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

Security

Grade A, and why

cursorrules 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-example/.cursorrules · 89 lines

What it actually says

项目约定 - 分形索引系统

Cursor AI 编辑器专用配置 - 本文件在每次新对话时自动加载


📚 核心职责

本项目使用分形多级索引系统自动维护文档。当你修改代码文件时,自动更新索引系统。


🎯 核心工作流程

1. 检测变更类型

检查文件是否包含结构性变更关键字:

  • 依赖: import, require, use, from, #include, using
  • 导出: export, public, class, interface, function, def, fn, struct

2. 执行更新策略

  • 结构性变更 → 执行完整更新:

    • ✅ 更新文件头注释 (Input/Output/Pos)
    • ✅ 更新所在文件夹的 FOLDER_INDEX.md
    • ✅ 更新 PROJECT_INDEX.md 和依赖关系图
  • 实现变更 → 跳过更新,继续当前任务

3. 保持静默

  • 小改动: 静默处理,不打断用户
  • 大改动: 简短提示 "✅ 索引已更新"

🔄 关键原则

  1. 主动性: 主动检测并执行更新,不等待用户提醒
  2. 准确性: 正确识别变更类型
  3. 静默性: 不打断用户工作流
  4. 一致性: 确保三级索引同步

💡 快速参考

过滤规则

  • 跳过文件: PROJECT_INDEX.md, FOLDER_INDEX.md
  • 跳过目录: node_modules, .git, dist, build, .next, target
  • 支持语言: .js .jsx .ts .tsx .py .java .kt .rs .go .cpp .c .h .php .rb .swift .cs
  • 文件大小: 跳过 > 500KB 的文件

三级索引结构

PROJECT_INDEX.md (根索引 + Mermaid 依赖图)
├── src/FOLDER_INDEX.md (文件夹索引)
│   └── file.ts (文件头注释: Input/Output/Pos)

📖 详细规则

完整的维护规则、执行流程、错误处理等详细信息,请参考:

规则文件: .cursor/rules/doc-maintenance.md

你可以随时阅读该文件以了解完整的实现细节。


🎨 快速命令

用户可以使用以下命令:

  • 初始化索引: "请为本项目初始化索引系统"
  • 更新索引: "请更新索引系统"
  • 检查一致性: "请检查索引一致性"
  • 切换语言: "请将索引系统切换为英文/中文"

版本: 2.0.0 更新日期: 2025-12-24 架构: 引用分离 (核心要点 + 路径引用) 自动生成: 由 scripts/generate-platform-configs.js 生成 重要: 这是项目级约定,请在每次会话中遵守此规则。

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 · 89 lines · 745 tokens per session scan A d06edc961c7e

Subscribe to this mod's changes

cursorrules is a cursor rule published in the GitHub repository Claudate/project-multilevel-index (139 stars, last pushed 7mo ago), licensed MIT. It adds 745 tokens to every session, about $0.0037 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.