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/e-gov/cursor-prompts/audit-logginggit clone --depth 1 https://github.com/e-gov/cursor-promptsWhat 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.01298 | $0.01298 |
| Opus 5 | $0.00649 | $0.00649 |
| Sonnet 5 | $0.00260 | $0.00260 |
| Haiku 4.5 | $0.00130 | $0.00130 |
Grade A, and why
audit-logging 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 3d 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.
How it starts
The opening of the file, as written. The whole thing — 161 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Audit Logging Conventions
Context
- Apply when implementing significant business operations within service classes (
src/main/java/**/service/**/*.java) that require an audit trail. - This application uses a dedicated
AuditLoggerutility to ensure consistent, structured logging of important events for security and compliance. - Audit logs are separate from regular application/debug logs.
- For comprehensive security best practices, see
[security.mdc](mdc:rules/common/security.mdc).
Standard Log Structure
Using the AuditLogger utility ensures logs are generated in the following standard JSON format. Developers do not construct this JSON manually.
{
"correlationId": "550e8400-e29b-41d4-a716-446655440000",
"time": "2023-04-04T12:34:56.123456Z",
"application": {
"name": "bookstore-service",
"extraInfo": {
"environment": "dev"
}
},
"activity": {
"action": "BOOK_UPDATED", // Example action
"extraInfo": { // Action-specific details
"id": "123e4567-e89b-12d3-a456-426614174000",
"oldTitle": "The Old Title",
"newTitle": "The New Title"
// ... other relevant fields ...
}
},
"actor": {
"name": "system" // Or user identifier
},
"client": {
"id": "bookstore-app",
"source": "INTERNAL"
},
"result": {
"code": "SUCCESS",
"message": "Operation completed successfully"
}
}
Requirements
- Use
AuditLogger: ALL audit log entries MUST be generated using the static methods provided by theAuditLoggerutility class. - Log Significant Business Events: Only log high-level, meaningful business operations (e.g., resource creation, update, deletion, key access), not low-level implementation details.
- Log After Success: Audit log entries for successful operations MUST be created after the core business logic (e.g., database commit) has completed successfully within the same transaction context.
- Do Not Log Sensitive Data: Avoid including sensitive personal information (e.g., passwords, detailed financial data, PII unless strictly necessary and compliant with regulations) in audit log messages or
extraInfofields. Redact or omit if necessary. - Use Correct Methods: Use the appropriate
AuditLoggermethod for the event type. - Log All Authentication Attempts: ALL authentication attempts MUST be logged regardless of outcome (login, logout, failed authentication, session timeout).
- Log All User-Initiated Activities: ALL user-initiated activities MUST be logged (CRUD operations, searches, file uploads, exports).
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.
- 3d ago First seen · 161 lines · 1,298 tokens per session scan A fba726cc26c3
audit-logging is a cursor rule published in the GitHub repository e-gov/cursor-prompts (34 stars, last pushed 4mo ago), licensed MIT. It adds 1,298 tokens to every session, about $0.0065 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.