
Audit Log
Durable, access-scoped, append-only record of who changed what app data, when, and...
Install
npx skills add BuilderIO/agent-native --skill audit-log -g -a claude-code -y- Repository
- BuilderIO/agent-native7.6k
- Category
- AI and agents
- Updated
- 3d ago
- License
- MIT
- Context cost
- Mediumabout 3,000 tokens
- Runs scripts
- No, instructions only
What it does
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".
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 }).

