pub struct EventMetadata {
pub uuid: String,
pub parent_uuid: Option<String>,
pub session_id: String,
pub timestamp: DateTime<Utc>,
pub is_sidechain: bool,
pub user_type: Option<String>,
pub cwd: Option<String>,
pub version: Option<String>,
pub git_branch: Option<String>,
pub slug: Option<String>,
}Expand description
Common metadata present in most events
This structure captures the execution context for an event:
- Session identity:
session_idlinks events to sessions - Graph structure:
parent_uuidforms conversation tree - Execution context:
cwd,git_branchtrack environment - Timing:
timestampfor chronological ordering
§Links and Relationships
uuid: Unique identifier for this eventparent_uuid: Links to previous message (conversation chain)session_id: Groups events into sessionslogical_parent_uuid: Used for compact boundaries to preserve logical flow
§Frequency in Sessions
Present in ~95% of events (all except some system events)
Fields§
§uuid: StringUnique identifier for this event
UUIDs are used to build conversation graphs and link related events.
parent_uuid: Option<String>Links to parent message in conversation chain
Forms a tree structure where:
None= root message (session start)Some(uuid)= response to/result of another event
session_id: StringSession identifier (groups related events)
All events in a session file share the same session_id.
Format: {uuid} (e.g., “7b1f4d79-4ab1-4d12-913d-e367cb3a5387”)
timestamp: DateTime<Utc>Event timestamp (UTC)
Used for chronological ordering and session duration calculation.
is_sidechain: boolWhether this event is part of a sidechain (branching conversation)
Sidechains occur when users:
- Undo/redo operations
- Branch from earlier conversation points
user_type: Option<String>User type discriminator
"external"= Human user input"internal"= Tool result or system messageNone= Not applicable (system events)
cwd: Option<String>Current working directory when event occurred
Examples:
- Windows:
"C:\\Users\\user\\project" - Unix:
"/home/user/project"
version: Option<String>Claude Code version
Format: "2.1.19" or similar semver
git_branch: Option<String>Git branch when event occurred
Useful for correlating sessions with code branches.
Example: "main", "feature-xyz"
slug: Option<String>Agent slug for delegated operations
Present in progress events when using agents.
Examples: "rust-implementer", "research-agent"
Implementations§
Source§impl EventMetadata
impl EventMetadata
Sourcepub fn is_user_prompt(&self) -> bool
pub fn is_user_prompt(&self) -> bool
Check if this is a human user prompt (vs tool result)
Sourcepub fn is_internal(&self) -> bool
pub fn is_internal(&self) -> bool
Check if this is an internal message (tool result)
Sourcepub fn is_sidechain(&self) -> bool
pub fn is_sidechain(&self) -> bool
Check if this is part of a sidechain