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/yudefine/nuxt-supabase-starter/audit-patterngit clone --depth 1 https://github.com/YuDefine/nuxt-supabase-starterWhat 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.00000 | $0.02659 |
| Opus 5 | $0.00000 | $0.01329 |
| Sonnet 5 | $0.00000 | $0.00532 |
| Haiku 4.5 | $0.00000 | $0.00266 |
Grade A, and why
audit-pattern 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.
How it starts
The opening of the file, as written. The whole thing — 142 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Audit Pattern
D-pattern audit 是 clade 對 audit / operation log 的標準治理模式。決策已定: 不採 DB-only、evlog-only、雙寫並行;新建與升級都走 DB transactional outbox canonical、evlog derived stream、DB hash anchor。
Reference: docs/d-pattern-master-plan.md
三段定義
- DB outbox canonical:audit row 與業務 mutation 必須在同一個 PostgreSQL transaction 內完成。business commit 成功時 audit row 必須存在;business rollback 時 audit row 也 rollback。
- evlog derived stream:evlog 只從 canonical audit event 衍生,用於 ops、security monitoring、cross-service trace、短 TTL PII envelope。handler 不能只送 fire-and-forget audit event 就宣稱 audit 完成。
- Hash anchor in DB:
prev_hash與hash直接寫在 canonical DB row。Cloudflare Workers 的node:fsVFS 不是 durable journal,多 instance hash chain 也會 race,所以 hash chain 不依賴 fs journal。
Source-of-truth 規則:任何 audit 問題先查 DB row,evlog 是衍生視圖;evlog miss 是 monitoring 缺口,不改變 canonical audit truth。
MUST
- Audit canonical truth MUST live in DB transactional outbox。
- Audit row MUST 與業務 mutation 在同一個 PostgreSQL transaction 內完成;Supabase JS 多次
.from().insert()不是 transaction,必要時用 SQL RPC。 - evlog audit events MUST 帶
auditEventId,且該值必須對應 DB canonical row 的event_id。 - DB row MUST 包含
prev_hash/hash。 - DB row MUST NOT 包含
ip_address/user_agent/ device fingerprint 等 PII 欄位。 - Multi-tenant consumer MUST 使用 per-tenant chain;實作可用 PostgreSQL advisory lock per tenant,或用 partition / tenant-scoped chain owner。
business_keysMUST 只放結構化業務鍵,例如invoiceId、reportVersion、policyVersion、rowCount。business_keysMUST NOT 放 PII、姓名、email、raw LLM prompt、raw request body、大型 payload。- 拒絕操作(auth 失敗、role 失敗、policy deny、quota deny)MUST 呼叫
auditDeny()。 requireAuth()/requireRole()/ policy helper 若會拒絕使用者,失敗路徑 MUST 自動寫入auditDeny(),不可要求每個 handler 手寫。- Audit drain reliability MUST 透過 Postgres outbox dispatcher(
claim_audit_outbox_batch+FOR UPDATE SKIP LOCKED+ idempotentmark_audit_evlog_drained);MUST NOT 依 tenant tier 或事件等級降級成 fire-and-forget evlog。Drain 端 MUST 以auditEventIdidempotently 去重(at-least-once 語意)。 - Atomicity 依事件 風險等級 分流,不依商業 tier:高風險 mutation(refund / billing、role / permission、data export、regulated report finalization、AI agent autonomous decision / tool invoke)MUST 用 SQL RPC 包 business mutation + audit insert 同 transaction;一般 CUD 用 helper baseline,但 audit insert MUST 緊接 business write,MUST NOT 先 response 或丟 background promise。
- Outbox dispatcher state MUST 放在 Postgres(
evlog_drained_at/attempts/next_attempt_at/lease_until),MUST NOT 用 KV / D1 / Worker memory 作 durability source。LISTEN/NOTIFY、Realtime、Worker memory buffer 只能作 wake-up / best-effort signal,MUST NOT 被當成 durable queue。
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.
- 2d ago First seen · 142 lines · 0 tokens per session scan A 4c13534ac4b7
audit-pattern is a cursor rule published in the GitHub repository YuDefine/nuxt-supabase-starter (45 stars, last pushed 4d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,659 tokens. 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
speckit_speckit.git.validate
Proxy for the speckit.git.validate workflow.
speckit_speckit.specify
Proxy for the speckit.specify workflow.
viberaven-core
VibeRaven production gate — canonical agent commands and gate loop.
browser-extension
Browser extension patterns and development practices.
process-management
Process management and zombie process prevention patterns.
coverage-thresholds
Coverage threshold configuration patterns.