audit-logging-system

audit-logging-system is a cursor rule for coding agents from Mr-chen-05/rules-2.1-optimized. It costs 4,984 tokens per session, scanned A, original, MIT.

A rule set for recording operational activity, security events, performance information, and system changes in audit logs. Audit logs are dated records used to trace what happened, who acted, and what the result was.

In plain words
What is it for?
Use it to record file operations, permission checks, errors, risky actions, configuration changes, resource usage, user instructions, and system startup or shutdown events at different severity levels.
Why use it?
It makes important actions and unusual events easier to review, investigate, and connect to a specific time and operator.

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/audit-logging-system
Clone the repo
git clone --depth 1 https://github.com/Mr-chen-05/rules-2.1-optimized

Wrote 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.

agentmods badge for audit-logging-system

README.md
[![agentmods](https://agentmods.dev/badge/rules/mr-chen-05/rules-2.1-optimized/audit-logging-system.svg)](https://agentmods.dev/rules/mr-chen-05/rules-2.1-optimized/audit-logging-system)
Your own site
<a href="https://agentmods.dev/rules/mr-chen-05/rules-2.1-optimized/audit-logging-system"><img src="https://agentmods.dev/badge/rules/mr-chen-05/rules-2.1-optimized/audit-logging-system.svg" alt="Measured on agentmods" height="20"></a>
Per session 4,984 This file is loaded in full into every session.
When invoked 4,984 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.04984 $0.04984
Opus 5 $0.02492 $0.02492
Sonnet 5 $0.00997 $0.00997
Haiku 4.5 $0.00498 $0.00498

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

Security

Grade A, and why

audit-logging-system 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.

global-rules/audit-logging-system.mdc · 608 lines

How it starts

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

📊 审计日志系统

全面审计: 记录所有关键操作和安全事件,提供完整的审计追踪能力

🎯 系统概述

审计日志系统为规则系统提供完整的操作追踪和安全监控:

  1. 操作审计: 记录所有文件操作和系统变更
  2. 安全事件: 追踪权限检查和异常行为
  3. 性能监控: 记录性能指标和资源使用
  4. 合规支持: 满足审计和合规要求

📋 日志级别

日志级别定义:
  CRITICAL (严重):
    - 安全违规事件
    - 系统崩溃错误
    - 数据损坏事件
    - 权限突破尝试
    - 敏感信息泄露
    
    示例:
      [CRITICAL] 2025-10-18 10:30:00 | 检测到敏感信息泄露尝试
      操作者: AI Agent
      目标文件: project.context.md
      敏感类型: API密钥
      处理结果: 已阻止并脱敏
      审计追踪: audit-2025-10-18-001
  
  WARNING (警告):
    - 风险操作执行
    - 性能降级事件
    - 资源接近上限
    - 配置不当警告
    - 重试次数过多
    
    示例:
      [WARNING] 2025-10-18 10:35:00 | 用户确认风险操作
      操作类型: 删除归档文件
      风险等级: HIGH
      用户确认: 是
      影响范围: 5个归档文件
      审计追踪: audit-2025-10-18-002
  
  INFO (信息):
    - 正常操作记录
    - 状态变更事件
    - 配置更新记录
    - 用户指令执行
    - 系统启动/关闭
    
    示例:
      [INFO] 2025-10-18 10:40:00 | 项目记忆文件更新
      操作者: AI Agent
      文件路径: project.context.md
      变更类型: 添加TODO项
      变更大小: +120字节
      耗时: 0.3秒
  
  DEBUG (调试):
    - 详细调试信息
    - 内部状态记录
    - 性能分析数据
    - 开发诊断信息
    - 变量追踪记录
    
    示例:
      [DEBUG] 2025-10-18 10:45:00 | 缓存查询命中
      缓存类型: MCP检测缓存
      缓存键: mcp-detection-cursor
      命中率: 95%
      响应时间: 2ms

📝 记录内容

1. 操作日志 (Operation Log)

操作日志结构:
  基本信息:
    - 时间戳: ISO 8601格式 (2025-10-18T10:30:00.123Z)
    - 日志级别: CRITICAL/WARNING/INFO/DEBUG
    - 操作类型: 文件操作/系统配置/用户交互等
    - 操作者: User/AI Agent/System
    - 会话ID: 唯一会话标识符
  
  详细信息:
    - 操作目标: 文件路径/配置项/系统组件
    - 操作内容: 具体执行的操作
    - 影响范围: 受影响的资源
    - 执行结果: 成功/失败/部分成功
    - 错误信息: 失败时的详细错误
  
  性能指标:
    - 开始时间: 操作开始时间戳
    - 结束时间: 操作结束时间戳
    - 耗时: 毫秒级精度
    - 资源使用: CPU/内存/磁盘IO
  
  审计信息:
    - 审计追踪ID: 唯一审计标识
    - 关联操作: 相关的前序操作
    - 风险等级: LOW/MEDIUM/HIGH/CRITICAL
    - 合规标签: 合规要求标记

日志格式 (JSON):
  {
    "timestamp": "2025-10-18T10:30:00.123Z",
    "level": "INFO",
    "type": "file_operation",
    "operator": "AI Agent",
    "session_id": "sess-20251018-001",
    "operation": {
      "action": "update",
      "target": "project.context.md",
      "section": "TODO",
      "content_size": 120,
      "backup_created": true
    },
    "result": {
      "status": "success",
      "duration_ms": 350,
      "affected_lines": 5
    },
    "audit": {
      "trace_id": "audit-2025-10-18-001",
      "risk_level": "LOW",
      "compliance": ["data-integrity"]
    }
  }

日志格式 (文本):
  [INFO] 2025-10-18 10:30:00.123 | file_operation | AI Agent | sess-20251018-001
  Action: update project.context.md (TODO section)
  Content: +120 bytes, 5 lines affected
  Result: SUCCESS (350ms)
  Audit: audit-2025-10-18-001 [LOW risk] [data-integrity]
  Backup: .backups/project.context.md.20251018_103000.bak

Read the full file on GitHub · 608 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. 4d ago First seen · 608 lines · 4,984 tokens per session scan A face6c8bcd02

Subscribe to this mod's changes

audit-logging-system 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 4,984 tokens to every session, about $0.0249 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.