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-schemagit clone --depth 1 https://github.com/YuDefine/nuxt-supabase-starterWrote 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/yudefine/nuxt-supabase-starter/audit-schema)<a href="https://agentmods.dev/rules/yudefine/nuxt-supabase-starter/audit-schema"><img src="https://agentmods.dev/badge/rules/yudefine/nuxt-supabase-starter/audit-schema.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.00000 | $0.01301 |
| Opus 5 | $0.00000 | $0.00651 |
| Sonnet 5 | $0.00000 | $0.00260 |
| Haiku 4.5 | $0.00000 | $0.00130 |
Grade A, and why
audit-schema 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 5d 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 — 113 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Audit Schema Conventions(supabase variant)
通用 audit_logs 表名 + D-pattern hash chain 慣例。適用 / / 等 Supabase Cloud / self-hosted 走通用 schema 的 consumer。
表名與基本欄位
預設 audit table 命名為 public.audit_logs,MUST 含下列欄位:
| 欄位 | 型別 | 說明 |
|---|---|---|
event_id |
uuid PK |
audit row primary key |
tenant_id |
uuid |
per-tenant chain(multi-tenant consumer 必填;single-tenant 可移除) |
actor_id |
uuid |
操作者 user.id;nullable 容納 system event |
action |
text |
操作動作識別(<verb>.<entity> 格式,例如 data.export、role.check) |
target_type |
text |
受影響 entity 類型 |
target_id |
text |
受影響 entity PK |
outcome |
text |
success / denied / failure 三選一 |
reason |
text |
denied / failure 時的原因 |
business_keys |
jsonb |
結構化業務鍵;不可放 PII / raw prompt / large payload |
prev_hash |
text |
上一筆同 tenant 的 hash(per-tenant chain) |
hash |
text |
本筆 hash(trigger 在 INSERT 時計算) |
idempotency_key |
text |
高風險外部 webhook / payment callback 用 |
span_id |
uuid |
同批操作共用 span id |
created_at |
timestamptz |
自動 now() |
D-pattern Hash Chain 規約
audit_logs 是 D-pattern canonical truth(DB row 是 source of truth;evlog wide event 是 derived stream)。
- MUST 用 trigger 計算
prev_hash/hash(SECURITY DEFINER + advisory lock 避免 race) - MUST hash payload function 標
STABLE並用 deterministic 欄位列表 - MUST RLS 只允許 service insert / service select / tenant select;沒有 UPDATE / DELETE policy
- MUST 所有 audit row 走 Postgres outbox dispatcher(
claim_audit_outbox_batch+mark_audit_evlog_drained),不分 tenant tier 不分流 - NEVER 在 DB row 寫
ip_address/user_agent/ device fingerprint(PII envelope 只放 evlog)
Audit helper 接口
每個 consumer MUST 用 server/utils/audit.ts 統一 helper(vendor template 在 clade vendor/snippets/audit-pattern/helper.ts):
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.
- 5d ago First seen · 113 lines · 0 tokens per session scan A aac76424a459
audit-schema is a cursor rule published in the GitHub repository YuDefine/nuxt-supabase-starter (45 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,301 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
viberaven-supabase-rls
Apply when editing Supabase migrations, RLS policies, or auth SQL.
sveltekit-spa
You are an expert SvelteKit engineer. Follow these rules ALWAYS when generating or editing code.
supabase
Supabase development guidelines, commands, and database patterns.
cache-optimization
Fantasy402 cache optimization patterns and performance guidelines.
database-patterns
Database patterns and D1 query best practices.
as-contract-cast-smell
// ❌ WRONG — bypasses the family ContractSerializer seam const contract = JSON.parse(raw) as Contract; const contract = JSON.parse(raw) as Contract .