# `Jido.Thread`
[🔗](https://github.com/agentjido/jido/blob/v2.3.0/lib/jido/thread.ex#L1)

An append-only log of interaction entries.

Thread is the canonical record of "what happened" in a conversation
or workflow. It is provider-agnostic and never modified destructively.

LLM context is derived from Thread via projection functions, not
stored directly in Thread.

## Example

    thread = Thread.new(metadata: %{user_id: "u1"})

    thread = Thread.append(thread, %{
      kind: :message,
      payload: %{role: "user", content: "Hello"}
    })

    Thread.entry_count(thread)  # => 1
    Thread.last(thread).kind    # => :message

# `t`

```elixir
@type t() :: %Jido.Thread{
  created_at: integer(),
  entries: [any()],
  id: binary(),
  metadata: map(),
  rev: integer(),
  stats: map(),
  updated_at: integer()
}
```

# `append`

```elixir
@spec append(t(), Jido.Thread.Entry.t() | map() | [Jido.Thread.Entry.t() | map()]) ::
  t()
```

Append entries to thread (returns new thread)

# `entry_count`

```elixir
@spec entry_count(t()) :: non_neg_integer()
```

Get entry count

# `filter_by_kind`

```elixir
@spec filter_by_kind(t() | nil, atom() | [atom()]) :: [Jido.Thread.Entry.t()]
```

Filter entries by kind

# `get_entry`

```elixir
@spec get_entry(t(), non_neg_integer()) :: Jido.Thread.Entry.t() | nil
```

Get entry by seq

# `last`

```elixir
@spec last(t()) :: Jido.Thread.Entry.t() | nil
```

Get last entry

# `new`

```elixir
@spec new(keyword()) :: t()
```

Create a new empty thread

# `slice`

```elixir
@spec slice(t(), non_neg_integer(), non_neg_integer()) :: [Jido.Thread.Entry.t()]
```

Get entries in seq range (inclusive)

# `to_list`

```elixir
@spec to_list(t()) :: [Jido.Thread.Entry.t()]
```

Get all entries as list
