Expand description
Agent Trace storage layer for VT Code.
This module provides file-based storage for Agent Trace records,
supporting reading/writing traces to .vtcode/traces/ directory.
§Overview
Agent Trace is an open specification for tracking AI-generated code. See https://agent-trace.dev/ for the full specification.
§Usage
ⓘ
use vtcode_core::trace::{TraceStore, TraceGenerator, TraceContext};
// Create context for generating traces
let ctx = TraceContext::new("claude-opus-4", "anthropic")
.with_workspace_path("/my/workspace")
.with_session_id("session-123")
.with_turn_number(1);
// Generate trace from diff tracker (after apply_patch)
if let Some(trace) = TraceGenerator::from_diff_tracker(&tracker, &ctx) {
// Store the trace
let store = TraceStore::for_workspace("/my/workspace");
store.write_trace(&trace)?;
}Structs§
- Contributor
- The contributor that produced a code contribution.
- Related
Resource - A related resource linked to a conversation.
- Tool
Info - Information about the tool that generated the trace.
- Trace
Context - Information needed to create a trace from file changes.
- Trace
Conversation - A conversation that contributed code to a file.
- Trace
File - A file with attributed conversation ranges.
- Trace
Generator - Generate Agent Trace records from tracked file changes.
- Trace
Index - Index file for quick lookup of traces by file path.
- Trace
Metadata - Additional metadata for trace records.
- Trace
Range - A range of lines with attribution information.
- Trace
Record - A complete Agent Trace record tracking AI contributions to code.
- Trace
Record Builder - Builder for constructing trace records incrementally.
- Trace
Store - Trace storage for reading and writing Agent Trace records.
- VcsInfo
- Version control system information.
- VtCode
Metadata - VT Code specific metadata in traces.
Enums§
- Contributor
Type - Type of contributor for code attribution.
- Hash
Algorithm - Hash algorithm for content hashes.
- VcsType
- Supported version control system types.
Constants§
- AGENT_
TRACE_ MIME_ TYPE - MIME type for Agent Trace records.
- AGENT_
TRACE_ VERSION - Current Agent Trace specification version.
- TRACES_
DIR - Default directory name for trace storage.
Functions§
- compute_
content_ hash - Compute a content hash using the default algorithm (MurmurHash3).
- compute_
content_ hash_ with - Compute a content hash using the specified algorithm.
- get_
git_ head_ revision - Get the current git HEAD revision.
- normalize_
model_ id - Convert a model string to models.dev convention format.