pub struct SystemEvent {Show 17 fields
pub uuid: Option<String>,
pub parent_uuid: Option<String>,
pub logical_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>,
pub subtype: Option<String>,
pub content: Option<String>,
pub is_meta: Option<bool>,
pub level: Option<String>,
pub compact_metadata: Option<CompactMetadata>,
pub error: Option<ErrorDetails>,
}Expand description
System event
Represents system-level events:
- Compact boundaries (conversation compaction)
- API errors (overload, rate limits)
- System reminders
§Special Fields
System events don’t use flattened EventMetadata because:
uuidcan be None for some system events- Need special handling for compact boundaries
§Frequency
~6 occurrences per large session (rare but important!)
Fields§
§uuid: Option<String>Event UUID (can be None for some system events)
parent_uuid: Option<String>Parent UUID
logical_parent_uuid: Option<String>Logical parent UUID (for compact boundaries)
Compact boundaries have both:
parent_uuid- points to compact boundary system messagelogical_parent_uuid- points to last real message before compaction
This preserves conversation flow across compaction.
session_id: StringSession ID
timestamp: DateTime<Utc>Timestamp
is_sidechain: boolIs this part of a sidechain
user_type: Option<String>User type (typically None for system events)
cwd: Option<String>Current working directory
version: Option<String>Claude Code version
git_branch: Option<String>Git branch
slug: Option<String>Agent slug
subtype: Option<String>System event subtype
Common values:
"compact_boundary"- Conversation compaction point"microcompact_boundary"- Smaller compaction"error"- System error
content: Option<String>Content/message
is_meta: Option<bool>Is this a meta event
level: Option<String>Severity level: “info”, “warning”, “error”
compact_metadata: Option<CompactMetadata>Compact boundary metadata (only for compact_boundary subtype)
error: Option<ErrorDetails>Error details (only for error subtype)
Implementations§
Source§impl SystemEvent
impl SystemEvent
Sourcepub fn is_compact_boundary(&self) -> bool
pub fn is_compact_boundary(&self) -> bool
Check if this is a compact boundary
Sourcepub fn is_microcompact_boundary(&self) -> bool
pub fn is_microcompact_boundary(&self) -> bool
Check if this is a microcompact boundary
Sourcepub fn compact_metadata(&self) -> Option<&CompactMetadata>
pub fn compact_metadata(&self) -> Option<&CompactMetadata>
Get compact metadata if this is a compact boundary
Sourcepub fn metadata(&self) -> EventMetadata
pub fn metadata(&self) -> EventMetadata
Convert to EventMetadata (for consistent interface)