system-diagnostics

A rule file describing a system-health and troubleshooting framework. It covers checks for rule files, project context, permissions, performance, data consistency, integrations, and sensitive information.

In plain words
What is it for?
Checking rule syntax and references, validating context files and timestamps, scanning for exposed sensitive data, and running the listed diagnostic commands.
Why use it?
It gives agents a defined way to investigate whether configuration, context records, or related systems are incomplete or inconsistent.

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/mr-chen-05/rules-2.1-optimized/system-diagnostics
Clone the repo
git clone --depth 1 https://github.com/Mr-chen-05/rules-2.1-optimized
Per session 2,650 This file is loaded in full into every session.
When invoked 2,650 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.02650 $0.02650
Opus 5 $0.01325 $0.01325
Sonnet 5 $0.00530 $0.00530
Haiku 4.5 $0.00265 $0.00265

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

Security

Grade A, and why

system-diagnostics 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.

global-rules/system-diagnostics.mdc · 369 lines

How it starts

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

🔧 系统诊断工具

第1层 - 诊断框架概述

核心诊断模块

诊断系统包括:
  1. 规则系统诊断
  2. 上下文记录诊断
  3. 权限系统诊断
  4. 性能监控诊断
  5. 数据一致性诊断
  6. 集成测试诊断

第2层 - 规则系统诊断

规则健康检查

检查项目:
  1. 规则文件完整性:
     - 检查所有规则文件是否存在
     - 检查文件大小和行数
     - 检查文件编码是否正确
  
  2. 规则语法检查:
     - 验证YAML语法有效性
     - 检查Markdown格式正确性
     - 验证特殊字符的编码
  
  3. 规则版本一致性:
     - 检查所有规则文件版本号
     - 确认版本号格式正确
     - 验证兼容性关系
  
  4. 规则引用检查:
     - 检查交叉引用有效性
     - 验证包含关系完整性
     - 检测循环引用
  
  5. 优先级冲突检查:
     - 检查优先级分配是否合理
     - 检测优先级冲突
     - 建议优先级优化

检查命令:
  /diagnose-rules - 执行完整规则诊断
  /check-rule-syntax [rule_file] - 检查特定规则文件语法
  /verify-rule-references - 验证规则间引用关系
  /check-rule-versions - 检查规则版本一致性

第3层 - 上下文记录诊断

上下文健康检查

检查项目:
  1. 文件完整性:
     - 检查 project.context.md 是否存在
     - 检查 context.archive*.md 文件
     - 检查备份文件完整性
  
  2. 数据结构检查:
     - 验证所有必需区块存在
     - 检查区块内容格式
     - 验证ID唯一性
  
  3. 内容一致性检查:
     - 检查Pinned条目引用有效性
     - 验证TODO任务的状态一致性
     - 检测重复条目
  
  4. 时间戳有效性:
     - 检查所有时间戳格式正确
     - 验证时间戳的逻辑顺序
     - 检测时间异常
  
  5. 敏感信息扫描:
     - 检测未脱敏的敏感信息
     - 查找潜在的安全风险
     - 建议清理措施

检查命令:
  /diagnose-context - 执行完整上下文诊断
  /check-context-integrity - 检查上下文数据完整性
  /verify-timestamps - 验证时间戳一致性
  /scan-sensitive-info - 扫描敏感信息
  /check-duplicates - 检测重复条目

第4层 - 权限系统诊断

权限健康检查

检查项目:
  1. 权限配置检查:
     - 验证权限配置文件有效性
     - 检查角色定义完整性
     - 验证权限分配正确性
  
  2. 审计日志检查:
     - 检查审计日志文件存在
     - 验证日志格式一致性
     - 检查日志文件大小
  
  3. 权限冲突检测:
     - 检测权限分配冲突
     - 发现权限缝隙
     - 建议权限优化
  
  4. 异常操作检测:
     - 检查是否有越权操作
     - 检测可疑的操作模式
     - 查找安全威胁

检查命令:
  /diagnose-permissions - 执行完整权限诊断
  /verify-permission-config - 验证权限配置
  /audit-anomalies - 检测审计异常
  /permission-conflict-check - 检查权限冲突
  /security-assessment - 执行安全评估

第5层 - 性能监控诊断

性能诊断

监控指标:
  1. 文件操作性能:
     - 读取延迟 (ms)
     - 写入延迟 (ms)
     - 操作吞吐量 (ops/sec)
  
  2. 内存使用:
     - 当前内存占用 (MB)
     - 内存峰值 (MB)
     - 内存泄漏风险
  
  3. CPU使用率:
     - 当前CPU使用 (%)
     - 峰值CPU使用 (%)
  
  4. 系统负载:
     - 1分钟平均负载
     - 5分钟平均负载
     - 15分钟平均负载
  
  5. 缓存效率:
     - 缓存命中率 (%)
     - 缓存大小 (MB)
     - 缓存刷新频率

监控命令:
  /diagnose-performance - 获取性能诊断报告
  /monitor-memory - 监控内存使用
  /monitor-cpu - 监控CPU使用
  /cache-stats - 查看缓存统计
  /performance-trends - 查看性能趋势

Read the full file on GitHub · 369 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 · 369 lines · 2,650 tokens per session scan A 91cd03a25beb

Subscribe to this mod's changes

system-diagnostics is a cursor rule published in the GitHub repository Mr-chen-05/rules-2.1-optimized (172 stars, last pushed 9mo ago), licensed MIT. It adds 2,650 tokens to every session, about $0.0132 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.