Aller au contenu
Skillpedia
API et serveurs (backend)7.6k · #13136

audit-log

Ce qu’il fait

Cette compétence décrit le journal d'audit que les applications Agent-Native enregistrent pour chaque modification des données. Elle montre comment nommer la ressource concernée par une modification et comment rendre le journal plus utile. Elle s'adresse aux développeurs qui ont besoin d'un historique des modifications.

Quand l’utiliser

  • ✓Quand vous avez besoin d'un fil d'activité ou d'un historique des modifications d'enregistrements.
  • ✓Quand vous voulez savoir quelles modifications ont été faites par l'agent et lesquelles par une personne.
  • ✓Quand vous devez journaliser les lectures de données sensibles en plus des écritures.

Lien du skill

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

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/audit-log/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Peux-tu me montrer qui a modifié chaque fiche client de cette application, et si c'est l'agent qui a fait la modification ?”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

Chaque action qui modifie des données enregistre automatiquement un événement. Vous pouvez nommer la ressource cible pour que la modification apparaisse dans la piste de son propriétaire, et marquer certaines lectures à journaliser.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis 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
Questions fréquentes

Faut-il ajouter du code pour chaque action ?

Non. Les actions qui modifient des données enregistrent automatiquement des événements, et vous ne réglez que pour rendre le journal plus utile.

Les identifiants sont-ils enregistrés dans le journal ?

La compétence indique que le framework masque les identifiants avant de les enregistrer.

Quelle différence avec les statistiques d'usage ?

Le journal d'audit enregistre les modifications des données de l'application, tandis que les statistiques suivent l'usage du produit avec des services externes.

Détails

Description originale de l’auteur

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

Popularité

Étoiles GitHub
7.6k
Position au classement
#13136
Licence
MIT
Mis à jour
02/11/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires