MingaAgent.InternalState (Minga v0.1.0)

Copy Markdown View Source

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.

Summary

Types

t()

The full internal state.

A single todo item.

Status of a todo item.

Functions

Creates a new empty internal state.

Returns the current notebook content.

Returns the current todo list as a formatted string.

Writes (replaces) the notebook content.

Writes (replaces) the entire todo list.

Types

t()

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

The full internal state.

todo_item()

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

A single todo item.

todo_status()

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

Status of a todo item.

Functions

new()

@spec new() :: t()

Creates a new empty internal state.

read_notebook(internal_state)

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

Returns the current notebook content.

read_todos(internal_state)

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

Returns the current todo list as a formatted string.

write_notebook(state, content)

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

Writes (replaces) the notebook content.

write_todos(state, items)

@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.