audit-log
できること
このスキルは、Agent-Nativeのアプリがアプリのデータへのすべての変更について記録する監査ログを説明します。変更が影響するリソースの名前の付け方と、ログをより役立てる方法を示します。変更の履歴が必要な開発者向けです。
使う場面
- ✓レコードの変更の活動フィードや履歴が必要なとき。
- ✓どの変更をエージェントが行い、どれを人が行ったかを知りたいとき。
- ✓書き込みだけでなく、機密データの読み取りもログに残したいとき。
スキルのリンク
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/audit-log/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“このアプリで、各顧客のレコードを誰が変更したか、そしてエージェントが変更したかどうかを見せてもらえますか?”
毎週5つの新しいスキル。1分で読めます。
仕組み
変更を伴うすべてのアクションは、自動的にイベントを記録します。対象のリソースに名前を付けると、その変更は所有者の履歴に表示されます。また、一部の読み取りをログに残すようマークできます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)を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
statusCode401 or 403 records asstatus: "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, ora2a) records asagentwith the user's email, like the app's own agent (tool);callernames the protocol. Classify a new agent-only caller inAGENT_AUDIT_CALLERS, not in a per-actionauditconfig. - Client and approval — keep four facts in four fields.
actorEmailis the principal the call runs as, never evidence of approval.callerandactorKindare the execution source.reportedClientName/reportedClientVersionare the MCP client's self-reportedclientInfofor that individualtools/call;initialize-only values are not carried forward.oauthClientIdis the OAuth client its credential was issued to.approval(agent-chat,a2a-review,mcp-client-acceptedormcp-review) records the authorization signal for that call.agent-chatis a person's approval in agent chat;a2a-reviewis the owner's approval of a paused A2A call on its review page;mcp-client-acceptedmeans the MCP client accepted its elicitation, and the server cannot verify who responded;mcp-reviewis 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 —
recordActionAuditandrecordOrgAdminAuditEventrequire anattribution(source, reported client, OAuth client, approval, run and network ids), and onlyauditAttribution(ctx)makes one; a Nitro route outside any action usesrouteAuditAttribution(event). Never copycaller,threadIdor the client fields into a hand-built context: a field the copy forgets is stored as null. A call w
よくある質問
すべてのアクションにコードを追加する必要がありますか?
いいえ。変更を伴うアクションは自動で記録され、ログをより役立てる設定だけを追加します。
認証情報はログに保存されますか?
記録の前に、フレームワークが認証情報を伏せるとスキルは述べています。
アナリティクスとはどう違いますか?
監査ログはアプリのデータの変更を記録し、アナリティクスは外部のサービスでプロダクトの利用状況を追跡します。
詳細
作者による元の説明
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
人気
- GitHubのスター
- 7.6k
- ランキング
- #13136
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
design-exploration
7.6kUIの複数のデザインの方向性を並べて検討し、1つを選んでもらい、選んだデザインを磨き上げるようエージェントを支援します。
visual-edit
7.6k実行中のローカルのアプリをビジュアルエディターで開き、本物の画面をまとめて確認し編集できるようエージェントを支援します。
turn-into-app
7.6kワークフロー、スプレッドシート、プロジェクトを、画面にデータが入り、操作の裏でエージェントが働く、洗練されたビジュアルアプリに変えます。
visual-plan
7.6kプレーンテキストの計画を、図、ファイルのマップ、コードの断片、未解決の質問を含む、対話できるビジュアルな計画に変えます。
似ているスキル
api-connector-builder
280kエージェントが既存のパターンに従って、新しいAPI連携を構築します。新しい方式を作らずに、もう一つ連携を追加したいときに使います。
api-design
280kエージェントがベストプラクティスに沿ってREST APIを設計できるようにします。APIの通信方法、エラーの表示方法、データの整理方法を決めるのに役立ちます。
backend-patterns
280kエージェントのサーバーサイドのアーキテクチャパターンとデータベースの最適化を支援します。サーバー上で動くコードを作成またはレビューするときに役立ちます。