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/mr-chen-05/rules-2.1-optimized/context7-preload-standardgit clone --depth 1 https://github.com/Mr-chen-05/rules-2.1-optimizedWrote 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.
[](https://agentmods.dev/rules/mr-chen-05/rules-2.1-optimized/context7-preload-standard)<a href="https://agentmods.dev/rules/mr-chen-05/rules-2.1-optimized/context7-preload-standard"><img src="https://agentmods.dev/badge/rules/mr-chen-05/rules-2.1-optimized/context7-preload-standard.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00021 | $0.01247 |
| Opus 5 | $0.00010 | $0.00624 |
| Sonnet 5 | $0.00004 | $0.00249 |
| Haiku 4.5 | $0.00002 | $0.00125 |
Grade A, and why
context7-preload-standard 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.
What it actually says
🧠 Context7 知识预载标准(修复/新项目前置)
目标:在修复 Bug 或启动新项目/新功能前,先用 Context7 预载关键知识(架构、约束、接口、历史决策、相关代码),避免“先动手后理解”,提升正确率与效率。
适用范围:前端、后端、全栈项目;适用于问题分析、任务实现、前端/后端开发工作流的起始阶段。
触发时机
- 用户意图包含:Bug、Error、异常、修复、定位、排查、优化、重构、性能问题、新项目、新功能、初始化等
- 工作流命令进入:/analyze-issue、/implement-task、/frontend-dev、/backend-dev 之前
- 项目特征:存在 src/、docs/、tests/、config/、README.*、architecture/、api/ 等目录或文件
- 触发约束(避免冲突与冗余):仅在进入上述工作流命令前触发;不在“启动超级大脑系统”等系统级启动命令下自动触发;若当前阶段已有足够上下文(已预载并未过期),则不重复执行。
执行步骤(标准化)
(1) 检索与聚合(Context7 优先)
- 目录范围(默认):src、docs、tests、config、README.*、architecture、api、scripts、.github
- Bug修复检索模板:错误堆栈/异常关键词、相关模块与文件名、最近改动记录、依赖和版本、兼容性/性能提示
- 新功能/新项目检索模板:架构设计、核心模块与数据模型、接口协议/API 文档、技术约束(安全/性能/合规)、测试策略与最佳实践
(2) 质量阈值与时间界限
- 至少命中 5 个高相关片段,或覆盖 3 类关键材料(架构、接口、约束)
- 质量评分阈值:≥ 0.65(Context7 返回的相关度或评分)
- 超时上限:60 秒;超过则进入回退流程
(3) 预载摘要输出与确认
- 输出内容:关键结论、文件/链接清单、风险/约束、建议的下一步
- 记录位置:project.context.md 的 Pinned 区块添加“知识预载摘要”与链接
- 用户确认:通过增强反馈机制(mcp-feedback-enhanced)收集确认或补充,再继续执行后续流程
回退策略(Context7 不可用或质量不足)
- 回退顺序:Context7 → 代码检索工具(search_codebase/search_by_regex)→ 文件系统直接读取
- Context7 未安装:提示通过统一安装脚本或 MCP 管理规则安装并启用(参考 mcp-unified-management.mdc;install-mcp-tools-enhanced-final.ps1)
- 质量不足:缩小或扩大检索范围、调整关键词模板、延长超时一次(最多 2 次重试),仍不足则进入最小必要信息模式
跳过条件(显式允许轻量变更直行)
- 纯文档或注释修订、无代码行为改动
- 打印/日志文本调整、单文件内小范围变量重命名
- 单测文案微调且不影响逻辑
- 如触发跳过,需在项目记录中标记“预载跳过原因”
安全与边界
- 范围限制:仅在项目根及其子目录内检索,不越权访问外部系统
- 输出约束:仅返回摘要与文件链接,不主动复制大量内容到对话
- 合规保护:遵循 ai-ethical-boundaries.mdc;敏感信息脱敏
与系统的协同
- 与 Context Loader:项目首次深度分析仍由 Context Loader 负责;Context7 预载用于具体任务前的针对性知识获取
- 与记录员系统:预载摘要写入 project.context.md 的 Pinned/Notes;重要结论纳入决策记录链
- 与智能推荐引擎:若意图为 Bug 修复或新项目启动,优先推荐执行本标准作为前置步骤
实施提示(为项目规则引用)
- 在 analyze-issue.mdc、implement-task.mdc、frontend-dev.mdc、backend-dev.mdc 的“Process/流程”前插入“前置步骤:Context7 知识预载”,简述触发、步骤、质量阈值、回退与确认
- 设置默认参数:目录范围(src, docs, tests, config, README.*, architecture, api)、质量阈值 ≥0.65、超时 60s、回退顺序如上、允许轻量变更跳过
核心目标:让“先理解后执行”成为系统默认行为,降低返工与错误率,加速交付。
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.
- 4d ago First seen · 76 lines · 21 tokens per session scan A f97c7f3c7749
context7-preload-standard is a cursor rule published in the GitHub repository Mr-chen-05/rules-2.1-optimized (172 stars, last pushed 10mo ago), licensed MIT. It adds 21 tokens to every session and 1,247 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-30.
Other cursor rules, from other repositories
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
cli-error-handling
CLI command error handling patterns.
prefer-direct-imports-over-module-mocks
Prefer extracting a testable core over vi.mock / vi.resetModules when unit tests need to reach production logic entangled with config, env, or singletons.
control-plane-descriptors
Control plane descriptor and instance implementation patterns.
family-instance-domain-actions
Family instance domain action implementation patterns.