ClaudeCode.Message.CompactBoundaryMessage (ClaudeCode v0.16.0)
View SourceRepresents a conversation compaction boundary message from the Claude CLI.
Compact boundary messages indicate that the CLI has compacted the conversation history to reduce token usage. This message provides metadata about the compaction.
Matches the official SDK schema:
{
type: "system",
subtype: "compact_boundary",
uuid: string,
session_id: string,
compact_metadata: {
trigger: "manual" | "auto",
pre_tokens: number
}
}
Summary
Functions
Type guard to check if a value is a CompactBoundaryMessage.
Creates a new CompactBoundaryMessage from JSON data.
Types
@type t() :: %ClaudeCode.Message.CompactBoundaryMessage{ compact_metadata: %{trigger: String.t(), pre_tokens: non_neg_integer()}, session_id: ClaudeCode.Types.session_id(), subtype: :compact_boundary, type: :system, uuid: String.t() }
Functions
Type guard to check if a value is a CompactBoundaryMessage.
Creates a new CompactBoundaryMessage from JSON data.
Examples
iex> CompactBoundaryMessage.new(%{
...> "type" => "system",
...> "subtype" => "compact_boundary",
...> "uuid" => "...",
...> "session_id" => "...",
...> "compact_metadata" => %{"trigger" => "auto", "pre_tokens" => 5000}
...> })
{:ok, %CompactBoundaryMessage{...}}
iex> CompactBoundaryMessage.new(%{"type" => "assistant"})
{:error, :invalid_message_type}