rmnr
DocsTourSlicesBest PracticeAgentsInstall

Command Palette

Search for a command to run...

New

Slice · AI prompt

Audit Log — Workspace Events

Workspace-scoped audit event recorder. Canonical logAuditEvent helper for mutations + actions; supports entity tracking, before/after diff, IP/user-agent capture.

Resource detail View source
Copy this prompt into Claude / Codex / Cursor
audit-log.prompt.mdmarkdown
# Install `audit-log` — Audit Log — Workspace Events

> Workspace-scoped audit event recorder.

📚 Knowledge base : https://resource.rahmanef.com/llms.txt
📦 Slice detail   : https://resource.rahmanef.com/slices/audit-log
🧠 JSON catalog   : https://resource.rahmanef.com/api/knowledge?slice=audit-log
🔗 Source         : https://github.com/rahmanef63/resource-site/tree/main/frontend/slices/audit-log

## 1. Install

```bash
npx rahman-resources add audit-log
# alias: npx rr add audit-log
```

The CLI copies `frontend/slices/audit-log/` into your project + augments `.env.example` + installs npm deps automatically. Run it from your project root.

## 2. What it ships

- peer slices (cascade install):
  - `convex-auth` — Event actor resolved via authenticated user.
- convex feature paths: `convex/features/audit-log`

## 3. Wire it up

Run `rr add audit-log`. Import logAuditEvent from convex/_shared/auditLogger.ts and call inside every workspace-scoped mutation with { action, workspaceId, entityType, entityId, before?, after? }.

## Rules of engagement

- shadcn-only UI primitives. No raw `<button>` / `<dialog>` / native date or file inputs.
- 200-line hard cap per source file (extract neighbours when over).
- All Convex queries hit an index (`.withIndex(...)`); never bare `.collect()`.
- Public mutations/queries declare `args:` validators + authz.
- Full ruleset: https://resource.rahmanef.com/best-practice

The agent will fetch /llms.txt for the full ruleset and use /api/knowledge for the JSON catalog.