# `LLMDB.History`
[🔗](https://github.com/agentjido/llm_db/blob/main/lib/llm_db/history.ex#L1)

Read-only runtime access to generated model history artifacts.

History is loaded from `priv/llm_db/history` (or `config :llm_db, :history_dir`).
NDJSON files are parsed into ETS-backed indexes for fast timeline/recent lookups.

# `event`

```elixir
@type event() :: map()
```

# `available?`

```elixir
@spec available?() :: boolean()
```

Returns `true` when history artifacts are available and readable.

# `meta`

```elixir
@spec meta() :: {:ok, map()} | {:error, :history_unavailable | term()}
```

Returns parsed history metadata from `meta.json`.

# `recent`

```elixir
@spec recent(pos_integer()) :: {:ok, [event()]} | {:error, term()}
```

Returns most recent events globally, ordered by `captured_at` then `event_id` descending.

Limit is capped to 500.

# `timeline`

```elixir
@spec timeline(atom() | String.t(), String.t()) :: {:ok, [event()]} | {:error, term()}
```

Returns all timeline events for a model, lineage-aware and ordered by
`captured_at` then `event_id` ascending.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
