Skip to content
Skillpedia
APIs & servers (backend)7.6k Β· #13136

audit-log

What it does

This skill describes the audit log that Agent-Native apps record for every change to app data. It shows how to name the resource a change affects and how to make the log more useful. It is for developers who need a change history.

When to use it

  • βœ“When you need an activity feed or a history of changes to records.
  • βœ“When you want to know which changes the agent made and which a person made.
  • βœ“When you need to log reads of sensitive data as well as writes.

Skill link

https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/audit-log/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/audit-log/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œCan you show me who changed each customer record in this app, and whether the agent made the change?”

5 new skills a week. 1 minute to read.

How it works

Every mutating action records an event automatically. You can name the target resource so the change appears in its owner's trail, and you can mark some reads for logging.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Audit Log

Rule

Every mutating action automatically records an audit event β€” no wiring needed. The framework captures who/what/when/from-where at the defineAction seam, redacts credentials, and attributes the change to a human or the agent (with the agent thread/turn that caused it). You only touch audit config to make events more useful (declare the target) or to opt a read in / a noisy write out.

This is distinct from:

  • observability β€” sampled agent-run telemetry (traces, evals), developer-facing.
  • tracking β€” fire-and-forget product analytics to external SaaS.

Audit is complete, durable, locally queryable, and scoped to the data it describes.

Declare the target so it lands in the owner's trail

By default an event is scoped to the actor (you see your own changes and the agent's changes on your behalf). To make a change to a shared resource show up in the owner's audit trail, declare the target:

defineAction({
  description: "Delete a recording",
  schema: z.object({ id: z.string() }),
  audit: {
    // type + id label the event; ownerEmail/orgId/visibility scope who can read it.
    target: (args, result, meta) => ({
      type: "recording",
      id: args.id,
      // Optional β€” defaults to the actor. Set when editing someone else's resource.
      ownerEmail: result?.ownerEmail,
      visibility: "org",
    }),
    summary: (args) => `Deleted recording ${args.id}`,
  },
  run: async (args, ctx) => { /* ... */ },
});

target, ownerEmail, visibility, and summary are all optional. The minimum useful addition is target: () => ({ type, id }).

Defaults and how to override them

  • Mutations (anything not GET / readOnly) are audited automatically.
  • Read-only actions are skipped. Audit a sensitive read (secret access, bulk export) with audit: { onRead: true }.
  • High-frequency framework actions (app-state sync, context-xray, navigate, appearance) are skipped by default. Force one on with audit: { enabled: true }.
  • Opt a noisy write out with audit: { enabled: false }.
  • Skip capturing arguments (large/sensitive payloads) with audit: { recordInputs: false }. Inputs are credential-redacted regardless.
  • Refusals β€” a thrown error with statusCode 401 or 403 records as status: "denied", so a refused attempt shows up as an attempt.
  • Probes β€” a health or capability probe sends { "__probe__": true } as its only argument. If it is rejected it records nothing; if it executes, or carries any other argument, it records like any call. Do not invent another probe shape in a client; the recorder only knows this one.
  • Outside agents β€” a call over an agent protocol (mcp, webmcp, or a2a) records as agent with the user's email, like the app's own agent (tool); caller names the protocol. Classify a new agent-only caller in AGENT_AUDIT_CALLERS, not in a per-action audit config.
  • Client and approval β€” keep four facts in four fields. actorEmail is the principal the call runs as, never evidence of approval. caller and actorKind are the execution source. reportedClientName / reportedClientVersion are the MCP client's self-reported clientInfo for that individual tools/call; initialize-only values are not carried forward. oauthClientId is the OAuth client its credential was issued to. approval (agent-chat, a2a-review, mcp-client-accepted or mcp-review) records the authorization signal for that call. agent-chat is a person's approval in agent chat; a2a-review is the owner's approval of a paused A2A call on its review page; mcp-client-accepted means the MCP client accepted its elicitation, and the server cannot verify who responded; mcp-review is the signed-in owner's approval of a direct MCP call on its review page. The recorder reads approval from the invocation's execution frame, never from its context. Never infer approval from the email, and never backfill these fields on older rows.
  • Attribution comes from one helper β€” recordActionAudit and recordOrgAdminAuditEvent require an attribution (source, reported client, OAuth client, approval, run and network ids), and only auditAttribution(ctx) makes one; a Nitro route outside any action uses routeAuditAttribution(event). Never copy caller, threadId or the client fields into a hand-built context: a field the copy forgets is stored as null. A call w
FAQ

Do I have to add code for every action?

No. Mutating actions record events automatically, and you only add settings to make the log more useful.

Are credentials stored in the log?

The skill says the framework redacts credentials before recording.

How is this different from analytics?

Audit logs record app data changes, while analytics tracks product usage with outside services.

Details

Original description by the author

Durable, access-scoped, append-only record of who changed what app data, when, and whether it was the agent or a human. Use when adding an activity feed or change history, declaring what a mutating action targets, auditing sensitive reads, or answering "what did the agent change / who edited this".

repo: BuilderIO/agent-native

Popularity

GitHub stars
7.6k
Ranking position
#13136
License
MIT
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills