Skip to content

models

Class info

Classes

Name Children Inherits
ClaudeAgentColorEntry
clawd_code_sdk.storage.models
Agent's color (from /rename or swarm).
    ClaudeAgentNameEntry
    clawd_code_sdk.storage.models
    Agent's custom name (from /rename or swarm).
      ClaudeAgentProgressData
      clawd_code_sdk.storage.models
      Progress data for agent/subagent operations.
        ClaudeAgentSettingEntry
        clawd_code_sdk.storage.models
        Agent definition used (from --agent flag or settings.agent).
          ClaudeAiTitleEntry
          clawd_code_sdk.storage.models
          AI-generated session title.
            ClaudeApiErrorEntry
            clawd_code_sdk.storage.models
            System entry for API errors with retry information.
              ClaudeApiMessage
              clawd_code_sdk.storage.models
              Claude API assistant message structure.
                ClaudeAssistantEntry
                clawd_code_sdk.storage.models
                Assistant message entry.
                  ClaudeAttachment
                  clawd_code_sdk.storage.models
                  Attachment payload, discriminated by ``type``.
                    ClaudeAttachmentEntry
                    clawd_code_sdk.storage.models
                    Context attached to the conversation (hook output, file contents, reminders, ...).
                      ClaudeAttributionSnapshotEntry
                      clawd_code_sdk.storage.models
                      Attribution snapshot tracking character-level contributions for commit attribution.
                        ClaudeAwaySummaryEntry
                        clawd_code_sdk.storage.models
                        System entry recapping the session for a user returning after a break.
                          ClaudeBashProgressData
                          clawd_code_sdk.storage.models
                          Progress data for bash tool operations.
                            ClaudeCompactBoundaryEntry
                            clawd_code_sdk.storage.models
                            System entry emitted when conversation is compacted.
                              ClaudeContentReplacementEntry
                              clawd_code_sdk.storage.models
                              Content replacement entry for resume reconstruction.
                                ClaudeContentReplacementRecord
                                clawd_code_sdk.storage.models
                                Records content blocks replaced with smaller stubs for prompt cache stability.
                                  ClaudeContextCollapseCommitEntry
                                  clawd_code_sdk.storage.models
                                  Persisted context-collapse commit.
                                    ClaudeContextCollapseSnapshotEntry
                                    clawd_code_sdk.storage.models
                                    Snapshot of staged queue and spawn trigger state.
                                      ClaudeContextCollapseStagedSpan
                                      clawd_code_sdk.storage.models
                                      A staged span within a context collapse snapshot.
                                        ClaudeCostStateEntry
                                        clawd_code_sdk.storage.models
                                        Accumulated cost and duration of the session, for restoring ``/cost`` on resume.
                                          ClaudeCustomTitleEntry
                                          clawd_code_sdk.storage.models
                                          User-set custom title for a session.
                                            ClaudeDequeueOperation
                                            clawd_code_sdk.storage.models
                                            Dequeue operation.
                                              ClaudeDerivedFromEntry
                                              clawd_code_sdk.storage.models
                                              Records the sessions this session continues (after /clear, compaction, resume).
                                                ClaudeDerivedSession
                                                clawd_code_sdk.storage.models
                                                A session this session was derived from.
                                                  ClaudeDocumentContent
                                                  clawd_code_sdk.storage.models
                                                  Document content block.
                                                    ClaudeEnqueueOperation
                                                    clawd_code_sdk.storage.models
                                                    Enqueue operation with content.
                                                      ClaudeEntryBase
                                                      clawd_code_sdk.storage.models
                                                      Base of all entries that take part in the ``parentUuid`` chain.
                                                      ClaudeFileAttributionState
                                                      clawd_code_sdk.storage.models
                                                      Per-file attribution state tracking Claude's character contributions.
                                                        ClaudeFileBackup
                                                        clawd_code_sdk.storage.models
                                                        A backed-up file version in ``\~/.claude/file-history/<sessionId>/``.
                                                          ClaudeFileHistoryDeltaEntry
                                                          clawd_code_sdk.storage.models
                                                          Adds one file backup to an earlier file-history snapshot.
                                                            ClaudeFileHistoryEntry
                                                            clawd_code_sdk.storage.models
                                                            File history snapshot entry.
                                                              ClaudeFileHistorySnapshot
                                                              clawd_code_sdk.storage.models
                                                              Snapshot data in file history entry.
                                                                ClaudeForkContextRefEntry
                                                                clawd_code_sdk.storage.models
                                                                A forked subagent's reference to the parent conversation it inherited.
                                                                  ClaudeGenericSystemEntry
                                                                  clawd_code_sdk.storage.models
                                                                  Fallback for unknown or future system entry subtypes.
                                                                    ClaudeHookInfo
                                                                    clawd_code_sdk.storage.models
                                                                    Hook info in stop_hook_summary.
                                                                      ClaudeHookProgressData
                                                                      clawd_code_sdk.storage.models
                                                                      Progress data for hook operations.
                                                                        ClaudeInformationalEntry
                                                                        clawd_code_sdk.storage.models
                                                                        Informational notice shown in the transcript.
                                                                          ClaudeLastPromptEntry
                                                                          clawd_code_sdk.storage.models
                                                                          Last prompt entry tracking the most recent user prompt.
                                                                            ClaudeLocalCommandEntry
                                                                            clawd_code_sdk.storage.models
                                                                            System entry for local slash commands.
                                                                              ClaudeMcpProgressData
                                                                              clawd_code_sdk.storage.models
                                                                              Progress data for MCP tool operations.
                                                                                ClaudeMessageEntryBase
                                                                                clawd_code_sdk.storage.models
                                                                                Base for user/assistant message entries with message payload.
                                                                                ClaudeModeEntry
                                                                                clawd_code_sdk.storage.models
                                                                                Session mode entry for coordinator/normal detection.
                                                                                  ClaudeModelCostUsage
                                                                                  clawd_code_sdk.storage.models
                                                                                  Per-model token usage and cost in a cost-state entry.
                                                                                    ClaudeModelRefusalFallbackEntry
                                                                                    clawd_code_sdk.storage.models
                                                                                    The model refused and the request was retried with a fallback model.
                                                                                      ClaudePermissionModeEntry
                                                                                      clawd_code_sdk.storage.models
                                                                                      Permission mode of the session (last wins).
                                                                                        ClaudePersistedWorktreeSession
                                                                                        clawd_code_sdk.storage.models
                                                                                        Worktree session state persisted to the transcript for resume.
                                                                                          ClaudePopAllOperation
                                                                                          clawd_code_sdk.storage.models
                                                                                          PopAll operation - clears all queued content.
                                                                                            ClaudePrLinkEntry
                                                                                            clawd_code_sdk.storage.models
                                                                                            PR link entry recording a pull request created during a session.
                                                                                              ClaudeProgressEntry
                                                                                              clawd_code_sdk.storage.models
                                                                                              Progress entry for tracking tool execution status (older Claude Code versions).
                                                                                                ClaudeQueryUpdateData
                                                                                                clawd_code_sdk.storage.models
                                                                                                Progress data for search query updates.
                                                                                                  ClaudeRelocatedEntry
                                                                                                  clawd_code_sdk.storage.models
                                                                                                  The session continued in another working directory.
                                                                                                    ClaudeRemoveOperation
                                                                                                    clawd_code_sdk.storage.models
                                                                                                    Remove operation (steering input).
                                                                                                      ClaudeSavedHookContextEntry
                                                                                                      clawd_code_sdk.storage.models
                                                                                                      Saved hook context entry.
                                                                                                        ClaudeSearchResultsReceivedData
                                                                                                        clawd_code_sdk.storage.models
                                                                                                        Progress data for search results received.
                                                                                                          ClaudeSkillProgressData
                                                                                                          clawd_code_sdk.storage.models
                                                                                                          Progress data for skill operations.
                                                                                                            ClaudeSpeculationAcceptEntry
                                                                                                            clawd_code_sdk.storage.models
                                                                                                            Records a speculation accept with time saved.
                                                                                                              ClaudeStopHookSummaryEntry
                                                                                                              clawd_code_sdk.storage.models
                                                                                                              System entry summarizing hook execution at turn end.
                                                                                                                ClaudeStorageModel
                                                                                                                clawd_code_sdk.storage.models
                                                                                                                Base for transcript models: fields these models don't know are kept.
                                                                                                                ClaudeSummaryEntry
                                                                                                                clawd_code_sdk.storage.models
                                                                                                                Summary entry (conversation summary).
                                                                                                                  ClaudeSystemEntryBase
                                                                                                                  clawd_code_sdk.storage.models
                                                                                                                  Common fields shared across all system entry subtypes.
                                                                                                                  ClaudeTagEntry
                                                                                                                  clawd_code_sdk.storage.models
                                                                                                                  Session tag entry (searchable in /resume).
                                                                                                                    ClaudeTaskProgressData
                                                                                                                    clawd_code_sdk.storage.models
                                                                                                                    Progress data for task tracking.
                                                                                                                      ClaudeTaskSummaryEntry
                                                                                                                      clawd_code_sdk.storage.models
                                                                                                                      Periodic fork-generated summary of what the agent is currently doing.
                                                                                                                        ClaudeToolProgressData
                                                                                                                        clawd_code_sdk.storage.models
                                                                                                                        Progress data for tool execution (SDK format).
                                                                                                                          ClaudeToolsUsedEntry
                                                                                                                          clawd_code_sdk.storage.models
                                                                                                                          Names of the tools used in the session.
                                                                                                                            ClaudeTurnDurationEntry
                                                                                                                            clawd_code_sdk.storage.models
                                                                                                                            System entry recording the duration of a turn.
                                                                                                                              ClaudeUnknownEntry
                                                                                                                              clawd_code_sdk.storage.models
                                                                                                                              An entry of a type these models don't know, kept as it is.
                                                                                                                                ClaudeUsage
                                                                                                                                clawd_code_sdk.storage.models
                                                                                                                                Token usage from Claude API response, with additional storage fields.
                                                                                                                                  ClaudeUserEntry
                                                                                                                                  clawd_code_sdk.storage.models
                                                                                                                                  User message entry.
                                                                                                                                    ClaudeUserMessage
                                                                                                                                    clawd_code_sdk.storage.models
                                                                                                                                    User message content.
                                                                                                                                      ClaudeWaitingForTaskData
                                                                                                                                      clawd_code_sdk.storage.models
                                                                                                                                      Progress data for waiting task operations.
                                                                                                                                        ClaudeWorktreeStateEntry
                                                                                                                                        clawd_code_sdk.storage.models
                                                                                                                                        Records whether the session is currently inside a worktree.

                                                                                                                                          🛈 DocStrings

                                                                                                                                          Claude Code storage models.

                                                                                                                                          Pydantic models for Claude Code's JSONL transcript format, enabling interoperability between agentpool and Claude Code.

                                                                                                                                          Key features: - JSONL-based conversation logs per project - Multi-agent support (main + sub-agents) - Message ancestry tracking - Conversation forking and branching - Discriminated unions for type-safe parsing

                                                                                                                                          See ARCHITECTURE.md for detailed documentation of the storage format.

                                                                                                                                          ClaudeChainEntry module-attribute

                                                                                                                                          The loaded entry types that take part in the parentUuid chain.

                                                                                                                                          All of them derive from :class:ClaudeEntryBase (which exposes uuid and parent_uuid). The union works with isinstance to narrow a :data:ClaudeJSONLEntry.

                                                                                                                                          ClaudeJSONLEntry module-attribute

                                                                                                                                          ClaudeJSONLEntry = Annotated[
                                                                                                                                              Annotated[KnownClaudeJSONLEntry, Tag("known")] | Annotated[ClaudeUnknownEntry, Tag("unknown")],
                                                                                                                                              Discriminator(_entry_kind),
                                                                                                                                          ]
                                                                                                                                          

                                                                                                                                          A JSONL entry: one of the known types, else :class:ClaudeUnknownEntry.

                                                                                                                                          ClaudeSystemEntry module-attribute

                                                                                                                                          ClaudeSystemEntry = Annotated[
                                                                                                                                              Annotated[ClaudeCompactBoundaryEntry, Tag("compact_boundary")]
                                                                                                                                              | Annotated[ClaudeTurnDurationEntry, Tag("turn_duration")]
                                                                                                                                              | Annotated[ClaudeApiErrorEntry, Tag("api_error")]
                                                                                                                                              | Annotated[ClaudeLocalCommandEntry, Tag("local_command")]
                                                                                                                                              | Annotated[ClaudeStopHookSummaryEntry, Tag("stop_hook_summary")]
                                                                                                                                              | Annotated[ClaudeAwaySummaryEntry, Tag("away_summary")]
                                                                                                                                              | Annotated[ClaudeInformationalEntry, Tag("informational")]
                                                                                                                                              | Annotated[ClaudeModelRefusalFallbackEntry, Tag("model_refusal_fallback")]
                                                                                                                                              | Annotated[ClaudeGenericSystemEntry, Tag("__generic__")],
                                                                                                                                              Discriminator(_system_entry_discriminator),
                                                                                                                                          ]
                                                                                                                                          

                                                                                                                                          Discriminated union of system entry subtypes with generic fallback.

                                                                                                                                          ClaudeAgentColorEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Agent's color (from /rename or swarm).

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeAgentColorEntry(ClaudeStorageModel):
                                                                                                                                              """Agent's color (from /rename or swarm)."""
                                                                                                                                          
                                                                                                                                              type: Literal["agent-color"]
                                                                                                                                              session_id: str
                                                                                                                                              agent_color: str
                                                                                                                                          

                                                                                                                                          ClaudeAgentNameEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Agent's custom name (from /rename or swarm).

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeAgentNameEntry(ClaudeStorageModel):
                                                                                                                                              """Agent's custom name (from /rename or swarm)."""
                                                                                                                                          
                                                                                                                                              type: Literal["agent-name"]
                                                                                                                                              session_id: str
                                                                                                                                              agent_name: str
                                                                                                                                          

                                                                                                                                          ClaudeAgentProgressData

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Progress data for agent/subagent operations.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeAgentProgressData(ClaudeStorageModel):
                                                                                                                                              """Progress data for agent/subagent operations."""
                                                                                                                                          
                                                                                                                                              type: Literal["agent_progress"]
                                                                                                                                              prompt: str | None = None
                                                                                                                                              agent_id: str | None = None
                                                                                                                                              message: dict[str, Any] | None = None
                                                                                                                                              normalized_messages: list[dict[str, Any]] | None = None
                                                                                                                                              resume: dict[str, Any] | None = None
                                                                                                                                          

                                                                                                                                          ClaudeAgentSettingEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Agent definition used (from --agent flag or settings.agent).

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeAgentSettingEntry(ClaudeStorageModel):
                                                                                                                                              """Agent definition used (from --agent flag or settings.agent)."""
                                                                                                                                          
                                                                                                                                              type: Literal["agent-setting"]
                                                                                                                                              session_id: str
                                                                                                                                              agent_setting: str
                                                                                                                                          

                                                                                                                                          ClaudeAiTitleEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          AI-generated session title.

                                                                                                                                          Distinct from ClaudeCustomTitleEntry: user renames always win over AI titles in read preference.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeAiTitleEntry(ClaudeStorageModel):
                                                                                                                                              """AI-generated session title.
                                                                                                                                          
                                                                                                                                              Distinct from ClaudeCustomTitleEntry: user renames always win over
                                                                                                                                              AI titles in read preference.
                                                                                                                                              """
                                                                                                                                          
                                                                                                                                              type: Literal["ai-title"]
                                                                                                                                              session_id: str
                                                                                                                                              ai_title: str
                                                                                                                                          

                                                                                                                                          ClaudeApiErrorEntry

                                                                                                                                          Bases: ClaudeSystemEntryBase

                                                                                                                                          System entry for API errors with retry information.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeApiErrorEntry(ClaudeSystemEntryBase):
                                                                                                                                              """System entry for API errors with retry information."""
                                                                                                                                          
                                                                                                                                              subtype: Literal["api_error"]
                                                                                                                                              level: str | None = None
                                                                                                                                              error: dict[str, Any] | None = None
                                                                                                                                              retry_in_ms: float | None = None
                                                                                                                                              retry_attempt: int | None = None
                                                                                                                                              max_retries: int | None = None
                                                                                                                                          

                                                                                                                                          ClaudeApiMessage

                                                                                                                                          Bases: BaseModel

                                                                                                                                          Claude API assistant message structure.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeApiMessage(BaseModel):
                                                                                                                                              """Claude API assistant message structure."""
                                                                                                                                          
                                                                                                                                              model_config = ConfigDict(extra="allow")
                                                                                                                                          
                                                                                                                                              model: str
                                                                                                                                              id: str
                                                                                                                                              type: Literal["message"] = "message"
                                                                                                                                              role: Literal["assistant"]
                                                                                                                                              content: str | Sequence[AssistantContentBlock]
                                                                                                                                              stop_reason: StopReason | None = None
                                                                                                                                              stop_sequence: str | None = None
                                                                                                                                              usage: ClaudeUsage = Field(default_factory=ClaudeUsage)
                                                                                                                                              container: dict[str, Any] | None = None
                                                                                                                                              """Code execution container info, if the response used one."""
                                                                                                                                              stop_details: dict[str, Any] | None = None
                                                                                                                                              context_management: dict[str, Any] | None = None
                                                                                                                                              """Context edits the API applied (e.g. cleared tool results)."""
                                                                                                                                              diagnostics: dict[str, Any] | None = None
                                                                                                                                              """API diagnostics such as ``cache_miss_reason``."""
                                                                                                                                              input_transformations: list[dict[str, Any]] | None = None
                                                                                                                                              """Transformations the API applied to the request input."""
                                                                                                                                          

                                                                                                                                          container class-attribute instance-attribute

                                                                                                                                          container: dict[str, Any] | None = None
                                                                                                                                          

                                                                                                                                          Code execution container info, if the response used one.

                                                                                                                                          context_management class-attribute instance-attribute

                                                                                                                                          context_management: dict[str, Any] | None = None
                                                                                                                                          

                                                                                                                                          Context edits the API applied (e.g. cleared tool results).

                                                                                                                                          diagnostics class-attribute instance-attribute

                                                                                                                                          diagnostics: dict[str, Any] | None = None
                                                                                                                                          

                                                                                                                                          API diagnostics such as cache_miss_reason.

                                                                                                                                          input_transformations class-attribute instance-attribute

                                                                                                                                          input_transformations: list[dict[str, Any]] | None = None
                                                                                                                                          

                                                                                                                                          Transformations the API applied to the request input.

                                                                                                                                          ClaudeAssistantEntry

                                                                                                                                          Bases: ClaudeMessageEntryBase

                                                                                                                                          Assistant message entry.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeAssistantEntry(ClaudeMessageEntryBase):
                                                                                                                                              """Assistant message entry."""
                                                                                                                                          
                                                                                                                                              type: Literal["assistant"]
                                                                                                                                              message: ClaudeApiMessage
                                                                                                                                              is_api_error_message: bool | None = None
                                                                                                                                              error: str | None = None
                                                                                                                                              """Error category for API error messages (``rate_limit``, ``billing_error``, ...)."""
                                                                                                                                              api_error_status: int | None = None
                                                                                                                                              """HTTP status of the failed API request."""
                                                                                                                                              api_error_type: str | None = None
                                                                                                                                              api_error: str | None = None
                                                                                                                                              is_aborted_mid_stream: bool | None = None
                                                                                                                                              requested_model: str | None = None
                                                                                                                                              """Model that was asked for (``message.model`` is the one that answered)."""
                                                                                                                                              effort: str | None = None
                                                                                                                                              per_turn_effort: str | None = None
                                                                                                                                              advisor_model: str | None = None
                                                                                                                                              made_by: str | None = None
                                                                                                                                              """``model`` for model output, ``other`` for synthetic messages."""
                                                                                                                                              api_block_index: int | None = None
                                                                                                                                              """Index of this entry's content block within the API response."""
                                                                                                                                              request_ref: str | None = None
                                                                                                                                              """Reference to the ``api-request`` entry this response answers."""
                                                                                                                                              thinking_duration_ms: int | None = None
                                                                                                                                              thinking_display: str | None = None
                                                                                                                                              tool_input_stream_ms: int | None = None
                                                                                                                                              attribution_agent: str | None = None
                                                                                                                                              attribution_skill: str | None = None
                                                                                                                                              attribution_plugin: str | None = None
                                                                                                                                              attribution_mcp_server: str | None = None
                                                                                                                                              attribution_mcp_tool: str | None = None
                                                                                                                                          

                                                                                                                                          api_block_index class-attribute instance-attribute

                                                                                                                                          api_block_index: int | None = None
                                                                                                                                          

                                                                                                                                          Index of this entry's content block within the API response.

                                                                                                                                          api_error_status class-attribute instance-attribute

                                                                                                                                          api_error_status: int | None = None
                                                                                                                                          

                                                                                                                                          HTTP status of the failed API request.

                                                                                                                                          error class-attribute instance-attribute

                                                                                                                                          error: str | None = None
                                                                                                                                          

                                                                                                                                          Error category for API error messages (rate_limit, billing_error, ...).

                                                                                                                                          made_by class-attribute instance-attribute

                                                                                                                                          made_by: str | None = None
                                                                                                                                          

                                                                                                                                          model for model output, other for synthetic messages.

                                                                                                                                          request_ref class-attribute instance-attribute

                                                                                                                                          request_ref: str | None = None
                                                                                                                                          

                                                                                                                                          Reference to the api-request entry this response answers.

                                                                                                                                          requested_model class-attribute instance-attribute

                                                                                                                                          requested_model: str | None = None
                                                                                                                                          

                                                                                                                                          Model that was asked for (message.model is the one that answered).

                                                                                                                                          ClaudeAttachment

                                                                                                                                          Bases: BaseModel

                                                                                                                                          Attachment payload, discriminated by type.

                                                                                                                                          Claude Code has dozens of attachment types (hook_success, file, edited_text_file, deferred_tools_delta, date, task_status, ...) and adds new ones often, so the payload is kept as-is: the type is typed, everything else is available as extra fields (model_extra) and written back unchanged.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeAttachment(BaseModel):
                                                                                                                                              """Attachment payload, discriminated by ``type``.
                                                                                                                                          
                                                                                                                                              Claude Code has dozens of attachment types (``hook_success``, ``file``,
                                                                                                                                              ``edited_text_file``, ``deferred_tools_delta``, ``date``, ``task_status``, ...) and adds
                                                                                                                                              new ones often, so the payload is kept as-is: the type is typed, everything else is
                                                                                                                                              available as extra fields (``model_extra``) and written back unchanged.
                                                                                                                                              """
                                                                                                                                          
                                                                                                                                              model_config = ConfigDict(extra="allow")
                                                                                                                                          
                                                                                                                                              type: str
                                                                                                                                          

                                                                                                                                          ClaudeAttachmentEntry

                                                                                                                                          Bases: ClaudeEntryBase

                                                                                                                                          Context attached to the conversation (hook output, file contents, reminders, ...).

                                                                                                                                          Attachment entries are part of the parentUuid chain: assistant and user entries often have an attachment as their parent, so chain walks must pass through them.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeAttachmentEntry(ClaudeEntryBase):
                                                                                                                                              """Context attached to the conversation (hook output, file contents, reminders, ...).
                                                                                                                                          
                                                                                                                                              Attachment entries are part of the ``parentUuid`` chain: assistant and user entries
                                                                                                                                              often have an attachment as their parent, so chain walks must pass through them.
                                                                                                                                              """
                                                                                                                                          
                                                                                                                                              type: Literal["attachment"]
                                                                                                                                              attachment: ClaudeAttachment
                                                                                                                                              rendered: list[Any] | None = None
                                                                                                                                              """How the attachment was rendered into the prompt, if recorded."""
                                                                                                                                              rendered_role: str | None = None
                                                                                                                                              rendered_beside_tool_result: bool | None = None
                                                                                                                                              rendered_in_human_turn: list[Any] | None = None
                                                                                                                                          

                                                                                                                                          rendered class-attribute instance-attribute

                                                                                                                                          rendered: list[Any] | None = None
                                                                                                                                          

                                                                                                                                          How the attachment was rendered into the prompt, if recorded.

                                                                                                                                          ClaudeAttributionSnapshotEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Attribution snapshot tracking character-level contributions for commit attribution.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeAttributionSnapshotEntry(ClaudeStorageModel):
                                                                                                                                              """Attribution snapshot tracking character-level contributions for commit attribution."""
                                                                                                                                          
                                                                                                                                              type: Literal["attribution-snapshot"]
                                                                                                                                              message_id: str
                                                                                                                                              surface: str
                                                                                                                                              """Client surface (cli, ide, web, api)."""
                                                                                                                                              file_states: dict[str, ClaudeFileAttributionState]
                                                                                                                                              prompt_count: int | None = None
                                                                                                                                              prompt_count_at_last_commit: int | None = None
                                                                                                                                              permission_prompt_count: int | None = None
                                                                                                                                              permission_prompt_count_at_last_commit: int | None = None
                                                                                                                                              escape_count: int | None = None
                                                                                                                                              escape_count_at_last_commit: int | None = None
                                                                                                                                          

                                                                                                                                          surface instance-attribute

                                                                                                                                          surface: str
                                                                                                                                          

                                                                                                                                          Client surface (cli, ide, web, api).

                                                                                                                                          ClaudeAwaySummaryEntry

                                                                                                                                          Bases: ClaudeSystemEntryBase

                                                                                                                                          System entry recapping the session for a user returning after a break.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeAwaySummaryEntry(ClaudeSystemEntryBase):
                                                                                                                                              """System entry recapping the session for a user returning after a break."""
                                                                                                                                          
                                                                                                                                              subtype: Literal["away_summary"]
                                                                                                                                              content: str | None = None
                                                                                                                                          

                                                                                                                                          ClaudeBashProgressData

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Progress data for bash tool operations.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeBashProgressData(ClaudeStorageModel):
                                                                                                                                              """Progress data for bash tool operations."""
                                                                                                                                          
                                                                                                                                              type: Literal["bash_progress"]
                                                                                                                                              output: str | None = None
                                                                                                                                              full_output: str | None = None
                                                                                                                                              elapsed_time_seconds: int | None = None
                                                                                                                                              total_lines: int | None = None
                                                                                                                                          

                                                                                                                                          ClaudeCompactBoundaryEntry

                                                                                                                                          Bases: ClaudeSystemEntryBase

                                                                                                                                          System entry emitted when conversation is compacted.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeCompactBoundaryEntry(ClaudeSystemEntryBase):
                                                                                                                                              """System entry emitted when conversation is compacted."""
                                                                                                                                          
                                                                                                                                              subtype: Literal["compact_boundary"]
                                                                                                                                              content: str | None = None
                                                                                                                                              level: str | None = None
                                                                                                                                              logical_parent_uuid: str | None = None
                                                                                                                                              compact_metadata: dict[str, Any] | None = None
                                                                                                                                          

                                                                                                                                          ClaudeContentReplacementEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Content replacement entry for resume reconstruction.

                                                                                                                                          When agentId is set, the record belongs to a subagent sidechain; when absent, it's main-thread.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeContentReplacementEntry(ClaudeStorageModel):
                                                                                                                                              """Content replacement entry for resume reconstruction.
                                                                                                                                          
                                                                                                                                              When agentId is set, the record belongs to a subagent sidechain;
                                                                                                                                              when absent, it's main-thread.
                                                                                                                                              """
                                                                                                                                          
                                                                                                                                              type: Literal["content-replacement"]
                                                                                                                                              session_id: str
                                                                                                                                              agent_id: str | None = None
                                                                                                                                              replacements: list[ClaudeContentReplacementRecord]
                                                                                                                                          

                                                                                                                                          ClaudeContentReplacementRecord

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Records content blocks replaced with smaller stubs for prompt cache stability.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeContentReplacementRecord(ClaudeStorageModel):
                                                                                                                                              """Records content blocks replaced with smaller stubs for prompt cache stability."""
                                                                                                                                          
                                                                                                                                              kind: Literal["tool-result"]
                                                                                                                                              tool_use_id: str
                                                                                                                                              replacement: str
                                                                                                                                          

                                                                                                                                          ClaudeContextCollapseCommitEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Persisted context-collapse commit.

                                                                                                                                          The archived messages themselves are NOT persisted — they're already in the transcript as ordinary user/assistant messages. Only enough is persisted to reconstruct the splice instruction and summary placeholder.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeContextCollapseCommitEntry(ClaudeStorageModel):
                                                                                                                                              """Persisted context-collapse commit.
                                                                                                                                          
                                                                                                                                              The archived messages themselves are NOT persisted — they're already
                                                                                                                                              in the transcript as ordinary user/assistant messages. Only enough is
                                                                                                                                              persisted to reconstruct the splice instruction and summary placeholder.
                                                                                                                                              """
                                                                                                                                          
                                                                                                                                              type: Literal["marble-origami-commit"]
                                                                                                                                              session_id: str
                                                                                                                                              collapse_id: str
                                                                                                                                              """16-digit collapse ID."""
                                                                                                                                              summary_uuid: str
                                                                                                                                              """The summary placeholder's uuid."""
                                                                                                                                              summary_content: str
                                                                                                                                              """Full `<collapsed id="...">text</collapsed>` string for the placeholder."""
                                                                                                                                              summary: str
                                                                                                                                              """Plain summary text."""
                                                                                                                                              first_archived_uuid: str
                                                                                                                                              """Span start boundary."""
                                                                                                                                              last_archived_uuid: str
                                                                                                                                              """Span end boundary."""
                                                                                                                                          

                                                                                                                                          collapse_id instance-attribute

                                                                                                                                          collapse_id: str
                                                                                                                                          

                                                                                                                                          16-digit collapse ID.

                                                                                                                                          first_archived_uuid instance-attribute

                                                                                                                                          first_archived_uuid: str
                                                                                                                                          

                                                                                                                                          Span start boundary.

                                                                                                                                          last_archived_uuid instance-attribute

                                                                                                                                          last_archived_uuid: str
                                                                                                                                          

                                                                                                                                          Span end boundary.

                                                                                                                                          summary instance-attribute

                                                                                                                                          summary: str
                                                                                                                                          

                                                                                                                                          Plain summary text.

                                                                                                                                          summary_content instance-attribute

                                                                                                                                          summary_content: str
                                                                                                                                          

                                                                                                                                          Full <collapsed id="...">text</collapsed> string for the placeholder.

                                                                                                                                          summary_uuid instance-attribute

                                                                                                                                          summary_uuid: str
                                                                                                                                          

                                                                                                                                          The summary placeholder's uuid.

                                                                                                                                          ClaudeContextCollapseSnapshotEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Snapshot of staged queue and spawn trigger state.

                                                                                                                                          Unlike commits (append-only, replay-all), snapshots are last-wins — only the most recent snapshot entry is applied on restore.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeContextCollapseSnapshotEntry(ClaudeStorageModel):
                                                                                                                                              """Snapshot of staged queue and spawn trigger state.
                                                                                                                                          
                                                                                                                                              Unlike commits (append-only, replay-all), snapshots are last-wins —
                                                                                                                                              only the most recent snapshot entry is applied on restore.
                                                                                                                                              """
                                                                                                                                          
                                                                                                                                              type: Literal["marble-origami-snapshot"]
                                                                                                                                              session_id: str
                                                                                                                                              staged: list[ClaudeContextCollapseStagedSpan]
                                                                                                                                              armed: bool
                                                                                                                                              """Spawn trigger state."""
                                                                                                                                              last_spawn_tokens: int
                                                                                                                                          

                                                                                                                                          armed instance-attribute

                                                                                                                                          armed: bool
                                                                                                                                          

                                                                                                                                          Spawn trigger state.

                                                                                                                                          ClaudeContextCollapseStagedSpan

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          A staged span within a context collapse snapshot.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeContextCollapseStagedSpan(ClaudeStorageModel):
                                                                                                                                              """A staged span within a context collapse snapshot."""
                                                                                                                                          
                                                                                                                                              start_uuid: str
                                                                                                                                              end_uuid: str
                                                                                                                                              summary: str
                                                                                                                                              risk: float
                                                                                                                                              staged_at: int
                                                                                                                                          

                                                                                                                                          ClaudeCostStateEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Accumulated cost and duration of the session, for restoring /cost on resume.

                                                                                                                                          Snapshot semantics: the last entry holds the session totals.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeCostStateEntry(ClaudeStorageModel):
                                                                                                                                              """Accumulated cost and duration of the session, for restoring ``/cost`` on resume.
                                                                                                                                          
                                                                                                                                              Snapshot semantics: the last entry holds the session totals.
                                                                                                                                              """
                                                                                                                                          
                                                                                                                                              type: Literal["cost-state"]
                                                                                                                                              session_id: str
                                                                                                                                              total_cost_usd: float = Field(alias="totalCostUSD")
                                                                                                                                              total_api_duration: int = Field(default=0, alias="totalAPIDuration")
                                                                                                                                              """Milliseconds spent in API requests."""
                                                                                                                                              total_api_duration_without_retries: int = Field(
                                                                                                                                                  default=0, alias="totalAPIDurationWithoutRetries"
                                                                                                                                              )
                                                                                                                                              total_tool_duration: int = 0
                                                                                                                                              total_duration: int = 0
                                                                                                                                              total_lines_added: int = 0
                                                                                                                                              total_lines_removed: int = 0
                                                                                                                                              start_time: int | None = None
                                                                                                                                              """Epoch milliseconds."""
                                                                                                                                              model_usage: dict[str, ClaudeModelCostUsage] = Field(default_factory=dict)
                                                                                                                                              has_unknown_model_cost: bool = False
                                                                                                                                          

                                                                                                                                          start_time class-attribute instance-attribute

                                                                                                                                          start_time: int | None = None
                                                                                                                                          

                                                                                                                                          Epoch milliseconds.

                                                                                                                                          total_api_duration class-attribute instance-attribute

                                                                                                                                          total_api_duration: int = Field(default=0, alias='totalAPIDuration')
                                                                                                                                          

                                                                                                                                          Milliseconds spent in API requests.

                                                                                                                                          ClaudeCustomTitleEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          User-set custom title for a session.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeCustomTitleEntry(ClaudeStorageModel):
                                                                                                                                              """User-set custom title for a session."""
                                                                                                                                          
                                                                                                                                              type: Literal["custom-title"]
                                                                                                                                              session_id: str
                                                                                                                                              custom_title: str
                                                                                                                                          

                                                                                                                                          ClaudeDequeueOperation

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Dequeue operation.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeDequeueOperation(ClaudeStorageModel):
                                                                                                                                              """Dequeue operation."""
                                                                                                                                          
                                                                                                                                              type: Literal["queue-operation"]
                                                                                                                                              operation: Literal["dequeue"]
                                                                                                                                              session_id: str
                                                                                                                                              timestamp: str
                                                                                                                                          

                                                                                                                                          ClaudeDerivedFromEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Records the sessions this session continues (after /clear, compaction, resume).

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeDerivedFromEntry(ClaudeStorageModel):
                                                                                                                                              """Records the sessions this session continues (after /clear, compaction, resume)."""
                                                                                                                                          
                                                                                                                                              type: Literal["derived-from"]
                                                                                                                                              session_id: str
                                                                                                                                              v: int | None = None
                                                                                                                                              sessions: list[ClaudeDerivedSession]
                                                                                                                                          

                                                                                                                                          ClaudeDerivedSession

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          A session this session was derived from.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeDerivedSession(ClaudeStorageModel):
                                                                                                                                              """A session this session was derived from."""
                                                                                                                                          
                                                                                                                                              id: str
                                                                                                                                              type: str
                                                                                                                                              via: str
                                                                                                                                              """How it was derived (``compact``, ``clear``, ``resume``, ``subprocess``, ...)."""
                                                                                                                                              started: str | None = None
                                                                                                                                          

                                                                                                                                          via instance-attribute

                                                                                                                                          via: str
                                                                                                                                          

                                                                                                                                          How it was derived (compact, clear, resume, subprocess, ...).

                                                                                                                                          ClaudeDocumentContent

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Document content block.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeDocumentContent(ClaudeStorageModel):
                                                                                                                                              """Document content block."""
                                                                                                                                          
                                                                                                                                              type: Literal["document"]
                                                                                                                                              source: ImageSource
                                                                                                                                          

                                                                                                                                          ClaudeEnqueueOperation

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Enqueue operation with content.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeEnqueueOperation(ClaudeStorageModel):
                                                                                                                                              """Enqueue operation with content."""
                                                                                                                                          
                                                                                                                                              type: Literal["queue-operation"]
                                                                                                                                              operation: Literal["enqueue"]
                                                                                                                                              content: str | list[str | ClaudeQueueContent] | None = None
                                                                                                                                              session_id: str
                                                                                                                                              timestamp: str
                                                                                                                                          

                                                                                                                                          ClaudeEntryBase

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Base of all entries that take part in the parentUuid chain.

                                                                                                                                          User, assistant, attachment, system, progress and saved-hook-context entries all link to their predecessor through parent_uuid. The chain regularly runs through non-message entries (an assistant entry's parent is often an attachment or a system entry), so code walking the chain should index every ClaudeEntryBase by uuid, not only user and assistant entries. See :mod:clawd_code_sdk.storage.chain.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeEntryBase(ClaudeStorageModel):
                                                                                                                                              """Base of all entries that take part in the ``parentUuid`` chain.
                                                                                                                                          
                                                                                                                                              User, assistant, attachment, system, progress and saved-hook-context entries all link
                                                                                                                                              to their predecessor through ``parent_uuid``. The chain regularly runs through
                                                                                                                                              non-message entries (an assistant entry's parent is often an attachment or a system
                                                                                                                                              entry), so code walking the chain should index every ``ClaudeEntryBase`` by ``uuid``,
                                                                                                                                              not only user and assistant entries. See :mod:`clawd_code_sdk.storage.chain`.
                                                                                                                                              """
                                                                                                                                          
                                                                                                                                              uuid: str
                                                                                                                                              parent_uuid: str | None = None
                                                                                                                                              logical_parent_uuid: str | None = None
                                                                                                                                              """Preserves logical parent when parentUuid is nullified for session breaks."""
                                                                                                                                              session_id: str
                                                                                                                                              timestamp: str
                                                                                                                                          
                                                                                                                                              # Context
                                                                                                                                              cwd: str = ""
                                                                                                                                              git_branch: str | None = None
                                                                                                                                              version: str = ""
                                                                                                                                              entrypoint: str | None = None
                                                                                                                                              """CLAUDE_CODE_ENTRYPOINT — distinguishes cli/sdk-ts/sdk-py/etc."""
                                                                                                                                              slug: str | None = None
                                                                                                                                              """Session slug for files like plans (used for resume)."""
                                                                                                                                          
                                                                                                                                              # Metadata
                                                                                                                                              user_type: UserType = "external"
                                                                                                                                              is_sidechain: bool = False
                                                                                                                                              is_meta: bool | None = None
                                                                                                                                              agent_id: str | None = None
                                                                                                                                              team_name: str | None = None
                                                                                                                                              """Team name if this is a spawned agent session."""
                                                                                                                                              agent_name: str | None = None
                                                                                                                                              """Agent's custom name (from /rename or swarm)."""
                                                                                                                                              agent_color: str | None = None
                                                                                                                                              """Agent's color (from /rename or swarm)."""
                                                                                                                                              prompt_id: str | None = None
                                                                                                                                              """Correlates with OTel prompt.id for user prompt messages."""
                                                                                                                                              data_flow_on: bool | None = None
                                                                                                                                          

                                                                                                                                          agent_color class-attribute instance-attribute

                                                                                                                                          agent_color: str | None = None
                                                                                                                                          

                                                                                                                                          Agent's color (from /rename or swarm).

                                                                                                                                          agent_name class-attribute instance-attribute

                                                                                                                                          agent_name: str | None = None
                                                                                                                                          

                                                                                                                                          Agent's custom name (from /rename or swarm).

                                                                                                                                          entrypoint class-attribute instance-attribute

                                                                                                                                          entrypoint: str | None = None
                                                                                                                                          

                                                                                                                                          CLAUDE_CODE_ENTRYPOINT — distinguishes cli/sdk-ts/sdk-py/etc.

                                                                                                                                          logical_parent_uuid class-attribute instance-attribute

                                                                                                                                          logical_parent_uuid: str | None = None
                                                                                                                                          

                                                                                                                                          Preserves logical parent when parentUuid is nullified for session breaks.

                                                                                                                                          prompt_id class-attribute instance-attribute

                                                                                                                                          prompt_id: str | None = None
                                                                                                                                          

                                                                                                                                          Correlates with OTel prompt.id for user prompt messages.

                                                                                                                                          slug class-attribute instance-attribute

                                                                                                                                          slug: str | None = None
                                                                                                                                          

                                                                                                                                          Session slug for files like plans (used for resume).

                                                                                                                                          team_name class-attribute instance-attribute

                                                                                                                                          team_name: str | None = None
                                                                                                                                          

                                                                                                                                          Team name if this is a spawned agent session.

                                                                                                                                          ClaudeFileAttributionState

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Per-file attribution state tracking Claude's character contributions.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeFileAttributionState(ClaudeStorageModel):
                                                                                                                                              """Per-file attribution state tracking Claude's character contributions."""
                                                                                                                                          
                                                                                                                                              content_hash: str
                                                                                                                                              """SHA-256 hash of file content."""
                                                                                                                                              claude_contribution: int
                                                                                                                                              """Characters written by Claude."""
                                                                                                                                              mtime: int
                                                                                                                                              """File modification time."""
                                                                                                                                          

                                                                                                                                          claude_contribution instance-attribute

                                                                                                                                          claude_contribution: int
                                                                                                                                          

                                                                                                                                          Characters written by Claude.

                                                                                                                                          content_hash instance-attribute

                                                                                                                                          content_hash: str
                                                                                                                                          

                                                                                                                                          SHA-256 hash of file content.

                                                                                                                                          mtime instance-attribute

                                                                                                                                          mtime: int
                                                                                                                                          

                                                                                                                                          File modification time.

                                                                                                                                          ClaudeFileBackup

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          A backed-up file version in ~/.claude/file-history/<sessionId>/.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeFileBackup(ClaudeStorageModel):
                                                                                                                                              """A backed-up file version in ``~/.claude/file-history/<sessionId>/``."""
                                                                                                                                          
                                                                                                                                              backup_file_name: str | None = None
                                                                                                                                              """``None`` when the file did not exist at that point."""
                                                                                                                                              version: int
                                                                                                                                              backup_time: str
                                                                                                                                              real_parent_dir: str | None = None
                                                                                                                                          

                                                                                                                                          backup_file_name class-attribute instance-attribute

                                                                                                                                          backup_file_name: str | None = None
                                                                                                                                          

                                                                                                                                          None when the file did not exist at that point.

                                                                                                                                          ClaudeFileHistoryDeltaEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Adds one file backup to an earlier file-history snapshot.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeFileHistoryDeltaEntry(ClaudeStorageModel):
                                                                                                                                              """Adds one file backup to an earlier file-history snapshot."""
                                                                                                                                          
                                                                                                                                              type: Literal["file-history-delta"]
                                                                                                                                              message_id: str
                                                                                                                                              snapshot_message_id: str
                                                                                                                                              tracking_path: str
                                                                                                                                              backup: ClaudeFileBackup
                                                                                                                                              timestamp: str
                                                                                                                                          

                                                                                                                                          ClaudeFileHistoryEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          File history snapshot entry.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeFileHistoryEntry(ClaudeStorageModel):
                                                                                                                                              """File history snapshot entry."""
                                                                                                                                          
                                                                                                                                              type: Literal["file-history-snapshot"]
                                                                                                                                              message_id: str
                                                                                                                                              snapshot: ClaudeFileHistorySnapshot | dict[str, Any]
                                                                                                                                              is_snapshot_update: bool = False
                                                                                                                                          

                                                                                                                                          ClaudeFileHistorySnapshot

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Snapshot data in file history entry.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeFileHistorySnapshot(ClaudeStorageModel):
                                                                                                                                              """Snapshot data in file history entry."""
                                                                                                                                          
                                                                                                                                              message_id: str
                                                                                                                                              tracked_file_backups: dict[str, Any]
                                                                                                                                              timestamp: str
                                                                                                                                              has_untracked_changes: bool | None = None
                                                                                                                                          

                                                                                                                                          ClaudeForkContextRefEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          A forked subagent's reference to the parent conversation it inherited.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeForkContextRefEntry(ClaudeStorageModel):
                                                                                                                                              """A forked subagent's reference to the parent conversation it inherited."""
                                                                                                                                          
                                                                                                                                              type: Literal["fork-context-ref"]
                                                                                                                                              agent_id: str | None = None
                                                                                                                                              parent_session_id: str
                                                                                                                                              parent_last_uuid: str
                                                                                                                                              """Last parent-session message the fork's context includes."""
                                                                                                                                              context_length: int | None = None
                                                                                                                                          

                                                                                                                                          parent_last_uuid instance-attribute

                                                                                                                                          parent_last_uuid: str
                                                                                                                                          

                                                                                                                                          Last parent-session message the fork's context includes.

                                                                                                                                          ClaudeGenericSystemEntry

                                                                                                                                          Bases: ClaudeSystemEntryBase

                                                                                                                                          Fallback for unknown or future system entry subtypes.

                                                                                                                                          Claude Code keeps adding new system subtypes. This model captures any subtype not explicitly modeled, preserving all data as optional fields.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeGenericSystemEntry(ClaudeSystemEntryBase):
                                                                                                                                              """Fallback for unknown or future system entry subtypes.
                                                                                                                                          
                                                                                                                                              Claude Code keeps adding new system subtypes. This model captures
                                                                                                                                              any subtype not explicitly modeled, preserving all data as optional fields.
                                                                                                                                              """
                                                                                                                                          
                                                                                                                                              subtype: str | None = None
                                                                                                                                              content: str | None = None
                                                                                                                                              level: str | None = None
                                                                                                                                          
                                                                                                                                              # Fields that may appear on various subtypes
                                                                                                                                              duration_ms: int | None = None
                                                                                                                                              is_compact_summary: bool | None = None
                                                                                                                                              logical_parent_uuid: str | None = None
                                                                                                                                              compact_metadata: dict[str, Any] | None = None
                                                                                                                                              hook_count: int | None = None
                                                                                                                                              hook_infos: list[ClaudeHookInfo] | None = None
                                                                                                                                              hook_errors: list[Any] | None = None
                                                                                                                                              prevented_continuation: bool | None = None
                                                                                                                                              stop_reason: str | None = None
                                                                                                                                              has_output: bool | None = None
                                                                                                                                              error: dict[str, Any] | None = None
                                                                                                                                              retry_in_ms: float | None = None
                                                                                                                                              retry_attempt: int | None = None
                                                                                                                                              max_retries: int | None = None
                                                                                                                                              tool_use_id: str | None = Field(default=None, alias="toolUseID")
                                                                                                                                              tool_use_result: (
                                                                                                                                                  list[ToolUseResult | dict[str, Any]] | ToolUseResult | dict[str, Any] | str | None
                                                                                                                                              ) = None
                                                                                                                                          

                                                                                                                                          ClaudeHookInfo

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Hook info in stop_hook_summary.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeHookInfo(ClaudeStorageModel):
                                                                                                                                              """Hook info in stop_hook_summary."""
                                                                                                                                          
                                                                                                                                              command: str
                                                                                                                                              duration_ms: int | None = None
                                                                                                                                          

                                                                                                                                          ClaudeHookProgressData

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Progress data for hook operations.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeHookProgressData(ClaudeStorageModel):
                                                                                                                                              """Progress data for hook operations."""
                                                                                                                                          
                                                                                                                                              type: Literal["hook_progress"]
                                                                                                                                              hook_event: str | None = None
                                                                                                                                              hook_name: str | None = None
                                                                                                                                              command: str | None = None
                                                                                                                                              prompt_text: str | None = None
                                                                                                                                              status_message: str | None = None
                                                                                                                                          

                                                                                                                                          ClaudeInformationalEntry

                                                                                                                                          Bases: ClaudeSystemEntryBase

                                                                                                                                          Informational notice shown in the transcript.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeInformationalEntry(ClaudeSystemEntryBase):
                                                                                                                                              """Informational notice shown in the transcript."""
                                                                                                                                          
                                                                                                                                              subtype: Literal["informational"]
                                                                                                                                              content: str | None = None
                                                                                                                                              level: str | None = None
                                                                                                                                              launched_agent_id: str | None = None
                                                                                                                                          

                                                                                                                                          ClaudeLastPromptEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Last prompt entry tracking the most recent user prompt.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeLastPromptEntry(ClaudeStorageModel):
                                                                                                                                              """Last prompt entry tracking the most recent user prompt."""
                                                                                                                                          
                                                                                                                                              type: Literal["last-prompt"]
                                                                                                                                              last_prompt: str | None = None
                                                                                                                                              """The prompt; newer entries mark only the message it led to (``leaf_uuid``)."""
                                                                                                                                              leaf_uuid: str | None = None
                                                                                                                                              session_id: str
                                                                                                                                              explicit: bool | None = None
                                                                                                                                          

                                                                                                                                          last_prompt class-attribute instance-attribute

                                                                                                                                          last_prompt: str | None = None
                                                                                                                                          

                                                                                                                                          The prompt; newer entries mark only the message it led to (leaf_uuid).

                                                                                                                                          ClaudeLocalCommandEntry

                                                                                                                                          Bases: ClaudeSystemEntryBase

                                                                                                                                          System entry for local slash commands.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeLocalCommandEntry(ClaudeSystemEntryBase):
                                                                                                                                              """System entry for local slash commands."""
                                                                                                                                          
                                                                                                                                              subtype: Literal["local_command"]
                                                                                                                                              content: str | None = None
                                                                                                                                              level: str | None = None
                                                                                                                                              command_run: dict[str, Any] | None = None
                                                                                                                                              """The command and its arguments."""
                                                                                                                                              context_usage: dict[str, Any] | None = None
                                                                                                                                              """Context window breakdown (for ``/context``)."""
                                                                                                                                              is_display_only: bool | None = None
                                                                                                                                          

                                                                                                                                          command_run class-attribute instance-attribute

                                                                                                                                          command_run: dict[str, Any] | None = None
                                                                                                                                          

                                                                                                                                          The command and its arguments.

                                                                                                                                          context_usage class-attribute instance-attribute

                                                                                                                                          context_usage: dict[str, Any] | None = None
                                                                                                                                          

                                                                                                                                          Context window breakdown (for /context).

                                                                                                                                          ClaudeMcpProgressData

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Progress data for MCP tool operations.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeMcpProgressData(ClaudeStorageModel):
                                                                                                                                              """Progress data for MCP tool operations."""
                                                                                                                                          
                                                                                                                                              type: Literal["mcp_progress"]
                                                                                                                                              status: MCPToolCallStatus | None = None
                                                                                                                                              server_name: str | None = None
                                                                                                                                              tool_name: str | None = None
                                                                                                                                              elapsed_time_ms: int | None = None
                                                                                                                                          

                                                                                                                                          ClaudeMessageEntryBase

                                                                                                                                          Bases: ClaudeEntryBase

                                                                                                                                          Base for user/assistant message entries with message payload.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeMessageEntryBase(ClaudeEntryBase):
                                                                                                                                              """Base for user/assistant message entries with message payload."""
                                                                                                                                          
                                                                                                                                              message: ClaudeApiMessage | ClaudeUserMessage
                                                                                                                                          
                                                                                                                                              is_compact_summary: bool | None = None
                                                                                                                                              request_id: str | None = None
                                                                                                                                          

                                                                                                                                          ClaudeModeEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Session mode entry for coordinator/normal detection.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeModeEntry(ClaudeStorageModel):
                                                                                                                                              """Session mode entry for coordinator/normal detection."""
                                                                                                                                          
                                                                                                                                              type: Literal["mode"]
                                                                                                                                              session_id: str
                                                                                                                                              mode: Literal["coordinator", "normal"]
                                                                                                                                          

                                                                                                                                          ClaudeModelCostUsage

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Per-model token usage and cost in a cost-state entry.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeModelCostUsage(ClaudeStorageModel):
                                                                                                                                              """Per-model token usage and cost in a cost-state entry."""
                                                                                                                                          
                                                                                                                                              input_tokens: int = 0
                                                                                                                                              output_tokens: int = 0
                                                                                                                                              cache_read_input_tokens: int = 0
                                                                                                                                              cache_creation_input_tokens: int = 0
                                                                                                                                              cache_creation_ephemeral_5m_input_tokens: int = Field(
                                                                                                                                                  default=0, alias="cacheCreationEphemeral5mInputTokens"
                                                                                                                                              )
                                                                                                                                              cache_creation_ephemeral_1h_input_tokens: int = Field(
                                                                                                                                                  default=0, alias="cacheCreationEphemeral1hInputTokens"
                                                                                                                                              )
                                                                                                                                              thinking_tokens: int = 0
                                                                                                                                              web_search_requests: int = 0
                                                                                                                                              cost_usd: float = Field(default=0.0, alias="costUSD")
                                                                                                                                          

                                                                                                                                          ClaudeModelRefusalFallbackEntry

                                                                                                                                          Bases: ClaudeSystemEntryBase

                                                                                                                                          The model refused and the request was retried with a fallback model.

                                                                                                                                          retracted_message_uuids are the messages the refusal withdrew from the conversation.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeModelRefusalFallbackEntry(ClaudeSystemEntryBase):
                                                                                                                                              """The model refused and the request was retried with a fallback model.
                                                                                                                                          
                                                                                                                                              ``retracted_message_uuids`` are the messages the refusal withdrew from the conversation.
                                                                                                                                              """
                                                                                                                                          
                                                                                                                                              subtype: Literal["model_refusal_fallback"]
                                                                                                                                              content: str | None = None
                                                                                                                                              level: str | None = None
                                                                                                                                              trigger: str | None = None
                                                                                                                                              direction: str | None = None
                                                                                                                                              scope: str | None = None
                                                                                                                                              original_model: str | None = None
                                                                                                                                              fallback_model: str | None = None
                                                                                                                                              request_id: str | None = None
                                                                                                                                              api_refusal_category: str | None = None
                                                                                                                                              api_refusal_explanation: str | None = None
                                                                                                                                              api_refusal_cyber_verification: dict[str, Any] | None = None
                                                                                                                                              retracted_message_uuids: list[str] | None = None
                                                                                                                                              refused_user_message_uuid: str | None = None
                                                                                                                                          

                                                                                                                                          ClaudePermissionModeEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Permission mode of the session (last wins).

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudePermissionModeEntry(ClaudeStorageModel):
                                                                                                                                              """Permission mode of the session (last wins)."""
                                                                                                                                          
                                                                                                                                              type: Literal["permission-mode"]
                                                                                                                                              session_id: str
                                                                                                                                              permission_mode: str
                                                                                                                                          

                                                                                                                                          ClaudePersistedWorktreeSession

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Worktree session state persisted to the transcript for resume.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudePersistedWorktreeSession(ClaudeStorageModel):
                                                                                                                                              """Worktree session state persisted to the transcript for resume."""
                                                                                                                                          
                                                                                                                                              original_cwd: str
                                                                                                                                              worktree_path: str
                                                                                                                                              worktree_name: str
                                                                                                                                              worktree_branch: str | None = None
                                                                                                                                              original_branch: str | None = None
                                                                                                                                              original_head_commit: str | None = None
                                                                                                                                              session_id: str
                                                                                                                                              tmux_session_name: str | None = None
                                                                                                                                              hook_based: bool | None = None
                                                                                                                                          

                                                                                                                                          ClaudePopAllOperation

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          PopAll operation - clears all queued content.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudePopAllOperation(ClaudeStorageModel):
                                                                                                                                              """PopAll operation - clears all queued content."""
                                                                                                                                          
                                                                                                                                              type: Literal["queue-operation"]
                                                                                                                                              operation: Literal["popAll"]
                                                                                                                                              content: str
                                                                                                                                              session_id: str
                                                                                                                                              timestamp: str
                                                                                                                                          

                                                                                                                                          ClaudePrLinkEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          PR link entry recording a pull request created during a session.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudePrLinkEntry(ClaudeStorageModel):
                                                                                                                                              """PR link entry recording a pull request created during a session."""
                                                                                                                                          
                                                                                                                                              type: Literal["pr-link"]
                                                                                                                                              session_id: str
                                                                                                                                              pr_number: int
                                                                                                                                              pr_url: str
                                                                                                                                              pr_repository: str
                                                                                                                                              timestamp: str
                                                                                                                                          

                                                                                                                                          ClaudeProgressEntry

                                                                                                                                          Bases: ClaudeEntryBase

                                                                                                                                          Progress entry for tracking tool execution status (older Claude Code versions).

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeProgressEntry(ClaudeEntryBase):
                                                                                                                                              """Progress entry for tracking tool execution status (older Claude Code versions)."""
                                                                                                                                          
                                                                                                                                              type: Literal["progress"]
                                                                                                                                              data: ClaudeProgressData
                                                                                                                                              tool_use_id: str | None = Field(default=None, alias="toolUseID")
                                                                                                                                              parent_tool_use_id: str | None = Field(default=None, alias="parentToolUseID")
                                                                                                                                          

                                                                                                                                          ClaudeQueryUpdateData

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Progress data for search query updates.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeQueryUpdateData(ClaudeStorageModel):
                                                                                                                                              """Progress data for search query updates."""
                                                                                                                                          
                                                                                                                                              type: Literal["query_update"]
                                                                                                                                              query: str
                                                                                                                                          

                                                                                                                                          ClaudeRelocatedEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          The session continued in another working directory.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeRelocatedEntry(ClaudeStorageModel):
                                                                                                                                              """The session continued in another working directory."""
                                                                                                                                          
                                                                                                                                              type: Literal["relocated"]
                                                                                                                                              session_id: str
                                                                                                                                              relocated_cwd: str
                                                                                                                                          

                                                                                                                                          ClaudeRemoveOperation

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Remove operation (steering input).

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeRemoveOperation(ClaudeStorageModel):
                                                                                                                                              """Remove operation (steering input)."""
                                                                                                                                          
                                                                                                                                              type: Literal["queue-operation"]
                                                                                                                                              operation: Literal["remove"]
                                                                                                                                              content: str | list[str | ClaudeQueueContent] | None = None
                                                                                                                                              session_id: str
                                                                                                                                              timestamp: str
                                                                                                                                              reason: str | None = None
                                                                                                                                              """Why the item left the queue (``absorbed_mid_turn``, ``delivered_to_agent``)."""
                                                                                                                                              command_uuid: str | None = None
                                                                                                                                              delivery_id: str | None = None
                                                                                                                                          

                                                                                                                                          reason class-attribute instance-attribute

                                                                                                                                          reason: str | None = None
                                                                                                                                          

                                                                                                                                          Why the item left the queue (absorbed_mid_turn, delivered_to_agent).

                                                                                                                                          ClaudeSavedHookContextEntry

                                                                                                                                          Bases: ClaudeEntryBase

                                                                                                                                          Saved hook context entry.

                                                                                                                                          Stores hook context data (e.g. injected system prompts from hooks) persisted alongside the conversation.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeSavedHookContextEntry(ClaudeEntryBase):
                                                                                                                                              """Saved hook context entry.
                                                                                                                                          
                                                                                                                                              Stores hook context data (e.g. injected system prompts from hooks)
                                                                                                                                              persisted alongside the conversation.
                                                                                                                                              """
                                                                                                                                          
                                                                                                                                              type: Literal["saved_hook_context"]
                                                                                                                                              content: list[str] | str | None = None
                                                                                                                                              hook_name: str | None = None
                                                                                                                                              hook_event: str | None = None
                                                                                                                                              tool_use_id: str | None = Field(default=None, alias="toolUseID")
                                                                                                                                          

                                                                                                                                          ClaudeSearchResultsReceivedData

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Progress data for search results received.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeSearchResultsReceivedData(ClaudeStorageModel):
                                                                                                                                              """Progress data for search results received."""
                                                                                                                                          
                                                                                                                                              type: Literal["search_results_received"]
                                                                                                                                              result_count: int
                                                                                                                                              query: str
                                                                                                                                          

                                                                                                                                          ClaudeSkillProgressData

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Progress data for skill operations.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeSkillProgressData(ClaudeStorageModel):
                                                                                                                                              """Progress data for skill operations."""
                                                                                                                                          
                                                                                                                                              type: Literal["skill_progress"]
                                                                                                                                              prompt: str | None = None
                                                                                                                                              agent_id: str | None = None
                                                                                                                                          

                                                                                                                                          ClaudeSpeculationAcceptEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Records a speculation accept with time saved.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeSpeculationAcceptEntry(ClaudeStorageModel):
                                                                                                                                              """Records a speculation accept with time saved."""
                                                                                                                                          
                                                                                                                                              type: Literal["speculation-accept"]
                                                                                                                                              timestamp: str
                                                                                                                                              time_saved_ms: int
                                                                                                                                          

                                                                                                                                          ClaudeStopHookSummaryEntry

                                                                                                                                          Bases: ClaudeSystemEntryBase

                                                                                                                                          System entry summarizing hook execution at turn end.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeStopHookSummaryEntry(ClaudeSystemEntryBase):
                                                                                                                                              """System entry summarizing hook execution at turn end."""
                                                                                                                                          
                                                                                                                                              subtype: Literal["stop_hook_summary"]
                                                                                                                                              hook_count: int | None = None
                                                                                                                                              hook_infos: list[ClaudeHookInfo] | None = None
                                                                                                                                              hook_errors: list[Any] | None = None
                                                                                                                                              prevented_continuation: bool | None = None
                                                                                                                                              stop_reason: str | None = None
                                                                                                                                              has_output: bool | None = None
                                                                                                                                              level: str | None = None
                                                                                                                                              tool_use_id: str | None = Field(default=None, alias="toolUseID")
                                                                                                                                              hook_additional_context: list[Any] | None = None
                                                                                                                                              failed_hook_error_indexes: list[int] | None = None
                                                                                                                                          

                                                                                                                                          ClaudeStorageModel

                                                                                                                                          Bases: ClaudeCodeBaseModel

                                                                                                                                          Base for transcript models: fields these models don't know are kept.

                                                                                                                                          Claude Code adds fields often. Keeping them (instead of ignoring them) means a read entry is written back unchanged, e.g. when a session is copied or forked.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeStorageModel(ClaudeCodeBaseModel):
                                                                                                                                              """Base for transcript models: fields these models don't know are kept.
                                                                                                                                          
                                                                                                                                              Claude Code adds fields often. Keeping them (instead of ignoring them) means a
                                                                                                                                              read entry is written back unchanged, e.g. when a session is copied or forked.
                                                                                                                                              """
                                                                                                                                          
                                                                                                                                              model_config = ConfigDict(extra="allow")
                                                                                                                                          

                                                                                                                                          ClaudeSummaryEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Summary entry (conversation summary).

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeSummaryEntry(ClaudeStorageModel):
                                                                                                                                              """Summary entry (conversation summary)."""
                                                                                                                                          
                                                                                                                                              type: Literal["summary"]
                                                                                                                                              leaf_uuid: str
                                                                                                                                              summary: str
                                                                                                                                              cwd: str | None = None
                                                                                                                                              session_id: str | None = None
                                                                                                                                              """Summaries may not have a session_id."""
                                                                                                                                          

                                                                                                                                          session_id class-attribute instance-attribute

                                                                                                                                          session_id: str | None = None
                                                                                                                                          

                                                                                                                                          Summaries may not have a session_id.

                                                                                                                                          ClaudeSystemEntryBase

                                                                                                                                          Bases: ClaudeEntryBase

                                                                                                                                          Common fields shared across all system entry subtypes.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeSystemEntryBase(ClaudeEntryBase):
                                                                                                                                              """Common fields shared across all system entry subtypes."""
                                                                                                                                          
                                                                                                                                              type: Literal["system"]
                                                                                                                                          

                                                                                                                                          ClaudeTagEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Session tag entry (searchable in /resume).

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeTagEntry(ClaudeStorageModel):
                                                                                                                                              """Session tag entry (searchable in /resume)."""
                                                                                                                                          
                                                                                                                                              type: Literal["tag"]
                                                                                                                                              session_id: str
                                                                                                                                              tag: str
                                                                                                                                          

                                                                                                                                          ClaudeTaskProgressData

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Progress data for task tracking.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeTaskProgressData(ClaudeStorageModel):
                                                                                                                                              """Progress data for task tracking."""
                                                                                                                                          
                                                                                                                                              type: Literal["task_progress"]
                                                                                                                                              task_id: str | None = None
                                                                                                                                              task_type: str | None = None
                                                                                                                                              message: str | None = None
                                                                                                                                          

                                                                                                                                          ClaudeTaskSummaryEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Periodic fork-generated summary of what the agent is currently doing.

                                                                                                                                          Written every min(5 steps, 2min) by forking the main thread mid-turn so claude ps can show something more useful than the last user prompt.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeTaskSummaryEntry(ClaudeStorageModel):
                                                                                                                                              """Periodic fork-generated summary of what the agent is currently doing.
                                                                                                                                          
                                                                                                                                              Written every min(5 steps, 2min) by forking the main thread mid-turn
                                                                                                                                              so ``claude ps`` can show something more useful than the last user prompt.
                                                                                                                                              """
                                                                                                                                          
                                                                                                                                              type: Literal["task-summary"]
                                                                                                                                              session_id: str
                                                                                                                                              summary: str
                                                                                                                                              timestamp: str
                                                                                                                                          

                                                                                                                                          ClaudeToolProgressData

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Progress data for tool execution (SDK format).

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeToolProgressData(ClaudeStorageModel):
                                                                                                                                              """Progress data for tool execution (SDK format)."""
                                                                                                                                          
                                                                                                                                              type: Literal["tool_progress"]
                                                                                                                                              tool_use_id: str | None = None
                                                                                                                                              tool_name: str | None = None
                                                                                                                                              parent_tool_use_id: str | None = None
                                                                                                                                              elapsed_time_seconds: float | None = None
                                                                                                                                              session_id: str | None = None
                                                                                                                                          

                                                                                                                                          ClaudeToolsUsedEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Names of the tools used in the session.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeToolsUsedEntry(ClaudeStorageModel):
                                                                                                                                              """Names of the tools used in the session."""
                                                                                                                                          
                                                                                                                                              type: Literal["tools-used"]
                                                                                                                                              session_id: str
                                                                                                                                              tools: list[str]
                                                                                                                                          

                                                                                                                                          ClaudeTurnDurationEntry

                                                                                                                                          Bases: ClaudeSystemEntryBase

                                                                                                                                          System entry recording the duration of a turn.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeTurnDurationEntry(ClaudeSystemEntryBase):
                                                                                                                                              """System entry recording the duration of a turn."""
                                                                                                                                          
                                                                                                                                              subtype: Literal["turn_duration"]
                                                                                                                                              duration_ms: int | None = None
                                                                                                                                              message_count: int | None = None
                                                                                                                                              pending_background_agent_count: int | None = None
                                                                                                                                          

                                                                                                                                          ClaudeUnknownEntry

                                                                                                                                          Bases: BaseModel

                                                                                                                                          An entry of a type these models don't know, kept as it is.

                                                                                                                                          Claude Code adds entry types often (api-request, atis-latch, ...); they load as this instead of failing, and are written back unchanged.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeUnknownEntry(BaseModel):
                                                                                                                                              """An entry of a type these models don't know, kept as it is.
                                                                                                                                          
                                                                                                                                              Claude Code adds entry types often (``api-request``, ``atis-latch``, ...); they
                                                                                                                                              load as this instead of failing, and are written back unchanged.
                                                                                                                                              """
                                                                                                                                          
                                                                                                                                              model_config = ConfigDict(extra="allow")
                                                                                                                                          
                                                                                                                                              type: str
                                                                                                                                          

                                                                                                                                          ClaudeUsage

                                                                                                                                          Bases: Usage

                                                                                                                                          Token usage from Claude API response, with additional storage fields.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeUsage(Usage):
                                                                                                                                              """Token usage from Claude API response, with additional storage fields."""
                                                                                                                                          
                                                                                                                                              service_tier: ServiceTier | None = None
                                                                                                                                              server_tool_use: AgentServerToolUse | None = None
                                                                                                                                          
                                                                                                                                              @classmethod
                                                                                                                                              def from_entries(cls, entries: Iterable[ClaudeJSONLEntry]) -> ClaudeUsage:
                                                                                                                                                  """Extract deduplicated aggregate token usage from stored entries.
                                                                                                                                          
                                                                                                                                                  Storage duplicates usage data across all content-block entries that
                                                                                                                                                  share the same API ``message.id``. This deduplicates by ``message.id``
                                                                                                                                                  and sums across all unique API calls.
                                                                                                                                                  """
                                                                                                                                                  seen_ids: set[str] = set()
                                                                                                                                                  total = cls()
                                                                                                                                                  for entry in entries:
                                                                                                                                                      if not isinstance(entry, ClaudeAssistantEntry):
                                                                                                                                                          continue
                                                                                                                                                      msg = entry.message
                                                                                                                                                      if msg.id in seen_ids:
                                                                                                                                                          continue
                                                                                                                                                      seen_ids.add(msg.id)
                                                                                                                                                      total.accumulate(msg.usage)
                                                                                                                                                  return total
                                                                                                                                          

                                                                                                                                          from_entries classmethod

                                                                                                                                          from_entries(entries: Iterable[ClaudeJSONLEntry]) -> ClaudeUsage
                                                                                                                                          

                                                                                                                                          Extract deduplicated aggregate token usage from stored entries.

                                                                                                                                          Storage duplicates usage data across all content-block entries that share the same API message.id. This deduplicates by message.id and sums across all unique API calls.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          @classmethod
                                                                                                                                          def from_entries(cls, entries: Iterable[ClaudeJSONLEntry]) -> ClaudeUsage:
                                                                                                                                              """Extract deduplicated aggregate token usage from stored entries.
                                                                                                                                          
                                                                                                                                              Storage duplicates usage data across all content-block entries that
                                                                                                                                              share the same API ``message.id``. This deduplicates by ``message.id``
                                                                                                                                              and sums across all unique API calls.
                                                                                                                                              """
                                                                                                                                              seen_ids: set[str] = set()
                                                                                                                                              total = cls()
                                                                                                                                              for entry in entries:
                                                                                                                                                  if not isinstance(entry, ClaudeAssistantEntry):
                                                                                                                                                      continue
                                                                                                                                                  msg = entry.message
                                                                                                                                                  if msg.id in seen_ids:
                                                                                                                                                      continue
                                                                                                                                                  seen_ids.add(msg.id)
                                                                                                                                                  total.accumulate(msg.usage)
                                                                                                                                              return total
                                                                                                                                          

                                                                                                                                          ClaudeUserEntry

                                                                                                                                          Bases: ClaudeMessageEntryBase

                                                                                                                                          User message entry.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeUserEntry(ClaudeMessageEntryBase):
                                                                                                                                              """User message entry."""
                                                                                                                                          
                                                                                                                                              type: Literal["user"]
                                                                                                                                              message: ClaudeUserMessage
                                                                                                                                              tool_use_result: (
                                                                                                                                                  list[ToolUseResult | dict[str, Any]] | ToolUseResult | dict[str, Any] | str | None
                                                                                                                                              ) = None
                                                                                                                                              source_tool_assistant_uuid: str | None = Field(default=None, alias="sourceToolAssistantUUID")
                                                                                                                                              """For tool results: uuid of the assistant entry holding the ``tool_use`` this answers."""
                                                                                                                                              source_tool_use_id: str | None = Field(default=None, alias="sourceToolUseID")
                                                                                                                                              """ID of the tool use that produced this message (e.g. skill or command expansions)."""
                                                                                                                                              permission_mode: str | None = None
                                                                                                                                              """Permission mode active when the prompt was sent."""
                                                                                                                                              permission_decision: dict[str, Any] | None = None
                                                                                                                                              """How the tool call this result answers was permitted (decision, source, reason)."""
                                                                                                                                              tool_denial_kind: str | None = None
                                                                                                                                              """Why the tool call was denied (``user-rejected``, ``permission-rule``, ...)."""
                                                                                                                                              sandboxed: bool | None = None
                                                                                                                                              """Whether the tool call ran in the sandbox."""
                                                                                                                                              prompt_source: str | None = None
                                                                                                                                              """Where the prompt came from (``typed``, ``sdk``, ``queued``, ``system``)."""
                                                                                                                                              turn_origin: str | None = None
                                                                                                                                              """What started the turn (``human``, ``sdk``, ``task_notification``, ``peer``, ...)."""
                                                                                                                                              origin: dict[str, Any] | None = None
                                                                                                                                              """Origin of the message, keyed by ``kind``."""
                                                                                                                                              turn_position: dict[str, int] | None = None
                                                                                                                                              """``turnIndex`` / ``promptIndex`` of the prompt within the session."""
                                                                                                                                              interrupted_message_id: str | None = None
                                                                                                                                              is_visible_in_transcript_only: bool | None = None
                                                                                                                                              is_virtual: bool | None = None
                                                                                                                                              image_paste_ids: list[int] | None = None
                                                                                                                                              mcp_meta: dict[str, Any] | None = None
                                                                                                                                              """``_meta`` / ``structuredContent`` of an MCP tool result."""
                                                                                                                                          
                                                                                                                                              @property
                                                                                                                                              def is_tool_result(self) -> bool:
                                                                                                                                                  """Whether this is a synthetic tool_result entry (vs. an actual user prompt)."""
                                                                                                                                                  if isinstance(self.message.content, str):
                                                                                                                                                      return False
                                                                                                                                                  return all(b.type == "tool_result" for b in self.message.content)
                                                                                                                                          

                                                                                                                                          is_tool_result property

                                                                                                                                          is_tool_result: bool
                                                                                                                                          

                                                                                                                                          Whether this is a synthetic tool_result entry (vs. an actual user prompt).

                                                                                                                                          mcp_meta class-attribute instance-attribute

                                                                                                                                          mcp_meta: dict[str, Any] | None = None
                                                                                                                                          

                                                                                                                                          _meta / structuredContent of an MCP tool result.

                                                                                                                                          origin class-attribute instance-attribute

                                                                                                                                          origin: dict[str, Any] | None = None
                                                                                                                                          

                                                                                                                                          Origin of the message, keyed by kind.

                                                                                                                                          permission_decision class-attribute instance-attribute

                                                                                                                                          permission_decision: dict[str, Any] | None = None
                                                                                                                                          

                                                                                                                                          How the tool call this result answers was permitted (decision, source, reason).

                                                                                                                                          permission_mode class-attribute instance-attribute

                                                                                                                                          permission_mode: str | None = None
                                                                                                                                          

                                                                                                                                          Permission mode active when the prompt was sent.

                                                                                                                                          prompt_source class-attribute instance-attribute

                                                                                                                                          prompt_source: str | None = None
                                                                                                                                          

                                                                                                                                          Where the prompt came from (typed, sdk, queued, system).

                                                                                                                                          sandboxed class-attribute instance-attribute

                                                                                                                                          sandboxed: bool | None = None
                                                                                                                                          

                                                                                                                                          Whether the tool call ran in the sandbox.

                                                                                                                                          source_tool_assistant_uuid class-attribute instance-attribute

                                                                                                                                          source_tool_assistant_uuid: str | None = Field(default=None, alias='sourceToolAssistantUUID')
                                                                                                                                          

                                                                                                                                          For tool results: uuid of the assistant entry holding the tool_use this answers.

                                                                                                                                          source_tool_use_id class-attribute instance-attribute

                                                                                                                                          source_tool_use_id: str | None = Field(default=None, alias='sourceToolUseID')
                                                                                                                                          

                                                                                                                                          ID of the tool use that produced this message (e.g. skill or command expansions).

                                                                                                                                          tool_denial_kind class-attribute instance-attribute

                                                                                                                                          tool_denial_kind: str | None = None
                                                                                                                                          

                                                                                                                                          Why the tool call was denied (user-rejected, permission-rule, ...).

                                                                                                                                          turn_origin class-attribute instance-attribute

                                                                                                                                          turn_origin: str | None = None
                                                                                                                                          

                                                                                                                                          What started the turn (human, sdk, task_notification, peer, ...).

                                                                                                                                          turn_position class-attribute instance-attribute

                                                                                                                                          turn_position: dict[str, int] | None = None
                                                                                                                                          

                                                                                                                                          turnIndex / promptIndex of the prompt within the session.

                                                                                                                                          ClaudeUserMessage

                                                                                                                                          Bases: BaseModel

                                                                                                                                          User message content.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeUserMessage(BaseModel):
                                                                                                                                              """User message content."""
                                                                                                                                          
                                                                                                                                              model_config = ConfigDict(extra="allow")
                                                                                                                                          
                                                                                                                                              role: Literal["user"]
                                                                                                                                              content: str | Sequence[UserContentBlock]
                                                                                                                                              usage: ClaudeUsage | None = None
                                                                                                                                              """Usage info (for type compatibility with ClaudeApiMessage)."""
                                                                                                                                          

                                                                                                                                          usage class-attribute instance-attribute

                                                                                                                                          usage: ClaudeUsage | None = None
                                                                                                                                          

                                                                                                                                          Usage info (for type compatibility with ClaudeApiMessage).

                                                                                                                                          ClaudeWaitingForTaskData

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Progress data for waiting task operations.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeWaitingForTaskData(ClaudeStorageModel):
                                                                                                                                              """Progress data for waiting task operations."""
                                                                                                                                          
                                                                                                                                              type: Literal["waiting_for_task"]
                                                                                                                                              task_description: str | None = None
                                                                                                                                              task_type: str | None = None
                                                                                                                                          

                                                                                                                                          ClaudeWorktreeStateEntry

                                                                                                                                          Bases: ClaudeStorageModel

                                                                                                                                          Records whether the session is currently inside a worktree.

                                                                                                                                          Last-wins: an enter writes the session, an exit writes null. On --resume, restored only if the worktreePath still exists on disk.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          class ClaudeWorktreeStateEntry(ClaudeStorageModel):
                                                                                                                                              """Records whether the session is currently inside a worktree.
                                                                                                                                          
                                                                                                                                              Last-wins: an enter writes the session, an exit writes null.
                                                                                                                                              On --resume, restored only if the worktreePath still exists on disk.
                                                                                                                                              """
                                                                                                                                          
                                                                                                                                              type: Literal["worktree-state"]
                                                                                                                                              session_id: str
                                                                                                                                              worktree_session: ClaudePersistedWorktreeSession | None = None
                                                                                                                                          

                                                                                                                                          chain_entry_types cached

                                                                                                                                          chain_entry_types() -> frozenset[str]
                                                                                                                                          

                                                                                                                                          The type tags of :data:ClaudeChainEntry (entries that take part in the chain).

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          @cache
                                                                                                                                          def chain_entry_types() -> frozenset[str]:
                                                                                                                                              """The ``type`` tags of :data:`ClaudeChainEntry` (entries that take part in the chain)."""
                                                                                                                                              return frozenset(_entry_tags(ClaudeChainEntry))
                                                                                                                                          

                                                                                                                                          known_entry_types cached

                                                                                                                                          known_entry_types() -> frozenset[str]
                                                                                                                                          

                                                                                                                                          The type tags of :data:KnownClaudeJSONLEntry.

                                                                                                                                          Source code in src/clawd_code_sdk/storage/models.py
                                                                                                                                          @cache
                                                                                                                                          def known_entry_types() -> frozenset[str]:
                                                                                                                                              """The ``type`` tags of :data:`KnownClaudeJSONLEntry`."""
                                                                                                                                              return frozenset(_entry_tags(KnownClaudeJSONLEntry))