# `MingaAgent.InternalState`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_agent/internal_state.ex#L1)

Internal agent state for todo tracking and scratchpad notes.

This module manages two pieces of ephemeral state that persist across
tool-calling turns within a single prompt but are cleared on new prompts:

- **Todo list**: A structured task checklist the agent uses to track
  progress on multi-step operations. Each task has a description and
  status (pending, in_progress, done).

- **Notebook**: An unstructured scratchpad for planning, intermediate
  reasoning, and working notes. Content is not shown to the user in chat.

Both are stored in the Native provider's GenServer state and accessed
via tool calls during the agent loop.

# `t`

```elixir
@type t() :: %MingaAgent.InternalState{notebook: String.t(), todos: [todo_item()]}
```

The full internal state.

# `todo_item`

```elixir
@type todo_item() :: MingaAgent.TodoItem.t()
```

A single todo item.

# `todo_status`

```elixir
@type todo_status() :: MingaAgent.TodoItem.status()
```

Status of a todo item.

# `new`

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

Creates a new empty internal state.

# `read_notebook`

```elixir
@spec read_notebook(t()) :: String.t()
```

Returns the current notebook content.

# `read_todos`

```elixir
@spec read_todos(t()) :: String.t()
```

Returns the current todo list as a formatted string.

# `write_notebook`

```elixir
@spec write_notebook(t(), String.t()) :: t()
```

Writes (replaces) the notebook content.

# `write_todos`

```elixir
@spec write_todos(t(), [map()]) :: t()
```

Writes (replaces) the entire todo list.

Each item should have `description` and `status` keys.
Missing statuses default to `:pending`.

---

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