agent-audit-logging
Implement comprehensive audit logging and reporting for multi-agent systems. Covers event capture, structured logging, traceability, compliance reporting, forensic analysis, and real-time monitoring dashboards for agent actions and decisions.
npx skills add cosmicstack-labs/mercury-agent-skills --skill agent-audit-logging --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Implements comprehensive audit logging and reporting for multi-agent systems. Covers event capture, structured logging, traceability chains, compliance reporting, forensic analysis, and real-time monitoring dashboards for agent actions and decisions.
How it works
- Defines a structured AuditEvent schema with event types (invocation, reasoning, tool_call, tool_result, decision, llm_response, error, handoff, human_intervention, token_usage) and fields for identity, context, traceability, and metadata.
- Builds an AuditLogger that buffers events and flushes to storage in batches; provides methods to log specific event types (log_invocation, log_tool_call, log_decision, log_error).
- Establishes a TraceabilityChain to fetch and timeline events by trace_id, and to build a graph of events for visualization.
- Implements a ComplianceReporter with methods to generate reports (summary, tool_usage, error_analysis, compliance_check) from stored events, including calculations like total_events, error rates, tool usage, and suggested actions.
- Provides a real-time AuditDashboard that reports recent activity from the in-memory buffer, including counts, activity by agent, and recent errors.
When to use it
Use when you need end-to-end observability and accountability for agent actions in production multi-agent systems, including debugging, compliance auditing, billing/tracking, and forensic analysis. Trigger reporting during periodic audits or on-demand for incident reviews. Real-time dashboard is intended for live monitoring.
What it can touch
- Storage backend for batch_write and query interfaces (via storage_backend in AuditLogger and storage in TraceabilityChain, ComplianceReporter).
- Internal in-memory buffer for recent events accessed by AuditDashboard.
- No external tool calls beyond the declared tools in the skill (claude-code) are invoked by the agent through this framework.
Caveats
- The skill defines a data model and methods but relies on an external storage backend implementation for persistence and querying.
- The step-by-step code samples assume asynchronous execution (async/await) and Python types; real integration requires compatible runtime and libraries (e.g., asyncio, threading, statistics).
- Some helper imports (e.g., Counter, defaultdict, datetime, threading, asyncio) are implied but not explicitly listed in the snippet; ensure they are available in the actual implementation.
# Agent Audit Log Reporting ## Overview When agents make decisions, take actions, and spend money, every step must be traceable. Audit logs answer questions like: "What did the agent do?", "Why did it do that?", "Who asked for it?", and "Can we prove it followed the rules?" This skill covers event sourcing, structured logging, traceability chains, compliance reporting, and forensic analysis for production multi-agent systems. --- ## Core Concepts ### Why Audit Logging Matters | Need | Without Audit | With Audit | |------|--------------|------------| | **Debugging** | "The agent did something wrong, but what?" | Full replay of decisions | | **Compliance** | No evidence of rule following | Verifiable compliance trail | | **Billing** | "Why did we spend $5K today?" | Per-task cost attribution | | **Security** | Can't detect injection or abuse | Pattern detection on logs | | **Improvement** | Guess what went wrong | Data-driven optimization | | **Accountability** | "Was this the agent or the user?" | Clear provenance | ### What to Log | Event | Details | Priority | |-------|---------|----------| | **Invocation** | Task received, agent, timestamp | Required | | **Reasoning** | Agent's c
- Overview
- Core Concepts
- Why Audit Logging Matters
- What to Log
- Step-by-Step Implementation
- Step 1: Define the Audit Event Schema
- Step 2: Build the Audit Logger
- Step 3: Traceability Chain
- Step 4: Compliance Reports
- Step 5: Real-Time Audit Dashboard
- Step 6: Audit Log Storage & Retention
- Audit Report Templates
- Daily Audit Summary
- Incident Forensics Report
What does the agent-audit-logging skill do?
Implement comprehensive audit logging and reporting for multi-agent systems. Covers event capture, structured logging, traceability, compliance reporting, forensic analysis, and real-time monitoring dashboards for agent actions and decisions.
How do I install it?
Run `npx skills add cosmicstack-labs/mercury-agent-skills --skill agent-audit-logging --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From cosmicstack-labs/mercury-agent-skills, a repository with 364 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.