Expand description
Persistent audit logging for tool invocations.
§18.4.4 of The Hitchhiker’s Guide to Agentic AI calls for an audit log of
every tool call (arguments, outputs, timestamp). The existing
crate::command_safety::audit::SafetyAuditLogger only records command-safety
decisions in memory; this module adds a complementary, opt-in sink that
records every MCP and built-in tool invocation in a durable, append-only
JSONL stream.
§Sinks
JsonlFileSink— appends entries to a JSONL file with size-based rotation.InMemorySink— keeps entries in memory for tests and short-lived tooling.NullSink— discards everything; zero-cost when audit is disabled.MultiSink— fan-out wrapper used byToolAuditLogger.
§Threading
Sinks are Send + Sync. Writes are non-blocking from the caller’s perspective:
each sink uses an internal lock or background task to serialize I/O.
See also crates/codegen/vtcode-core/src/tools/untrusted_data.rs for the prompt-injection
defense that pairs with this log.
Structs§
- InMemory
Sink - In-memory sink — useful for tests and ephemeral tooling.
- Jsonl
File Sink - Append-only JSONL file sink with size-based rotation.
- Multi
Sink - Fan-out sink — forwards every entry to a list of inner sinks.
- Null
Sink - Null sink — accepts every entry but discards them.
- Tool
Audit Entry - One audit row written per tool invocation.
- Tool
Audit Logger - Top-level audit logger — currently a thin wrapper that owns a single sink.
Enums§
- Tool
Audit Status - Status of a single tool invocation for audit purposes.
Traits§
- Tool
Audit Sink - Trait every audit sink implements.