Skip to main content

Module audit_log

Module audit_log 

Source
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

§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§

InMemorySink
In-memory sink — useful for tests and ephemeral tooling.
JsonlFileSink
Append-only JSONL file sink with size-based rotation.
MultiSink
Fan-out sink — forwards every entry to a list of inner sinks.
NullSink
Null sink — accepts every entry but discards them.
ToolAuditEntry
One audit row written per tool invocation.
ToolAuditLogger
Top-level audit logger — currently a thin wrapper that owns a single sink.

Enums§

ToolAuditStatus
Status of a single tool invocation for audit purposes.

Traits§

ToolAuditSink
Trait every audit sink implements.