ClaudeCode.Message.SystemMessage.TaskProgress (ClaudeCode v0.36.3)

View Source

Represents a task progress system message from the Claude CLI.

Emitted periodically while a background task is executing to indicate progress. Useful for showing elapsed time, token usage, or tool activity in UIs.

Fields

  • :type - Always :system
  • :subtype - Always :task_progress
  • :task_id - Unique identifier for the task
  • :tool_use_id - Associated tool use block ID (optional)
  • :description - Human-readable progress description
  • :usage - Token and tool usage stats (optional map with total_tokens, tool_uses, duration_ms)
  • :last_tool_name - Name of the most recently used tool (optional)
  • :summary - AI-generated summary of progress so far (optional)
  • :uuid - Message UUID
  • :session_id - Session identifier

JSON Format

{
  "type": "system",
  "subtype": "task_progress",
  "task_id": "task_abc123",
  "tool_use_id": "toolu_abc123",
  "description": "Analyzing files...",
  "usage": {
    "total_tokens": 1500,
    "tool_uses": 3,
    "duration_ms": 4200
  },
  "last_tool_name": "Read",
  "uuid": "...",
  "session_id": "..."
}

Summary

Functions

Creates a new TaskProgress from JSON data.

Type guard to check if a value is a TaskProgress.

Types

t()

@type t() :: %ClaudeCode.Message.SystemMessage.TaskProgress{
  description: String.t() | nil,
  last_tool_name: String.t() | nil,
  session_id: String.t(),
  subtype: :task_progress,
  summary: String.t() | nil,
  task_id: String.t(),
  tool_use_id: String.t() | nil,
  type: :system,
  usage: map() | nil,
  uuid: String.t() | nil
}

Functions

new(json)

@spec new(map()) :: {:ok, t()} | {:error, atom()}

Creates a new TaskProgress from JSON data.

Examples

iex> TaskProgress.new(%{
...>   "type" => "system",
...>   "subtype" => "task_progress",
...>   "task_id" => "task_abc",
...>   "session_id" => "session-1"
...> })
{:ok, %TaskProgress{type: :system, subtype: :task_progress, ...}}

iex> TaskProgress.new(%{"type" => "assistant"})
{:error, :invalid_message_type}

task_progress?(arg1)

@spec task_progress?(any()) :: boolean()

Type guard to check if a value is a TaskProgress.