AI.Notes (fnord v0.8.27)

View Source

Coordinates the mini-agents that manage project research notes. The workflow for this is:

  1. Initialize the notes with init/1, which loads existing notes from disk.
  2. Consolidate new notes from the prior research session. This incorporates the new facts in the NEW NOTES section into the main body of the notes file.
  3. As user prompts arrive, ingest user messages with ingest_user_msg/2, which updates the user traits based on the user's messages.
  4. As tool calls are made, ingest research results with ingest_research/4, which extracts facts from the tool call results.
  5. Commit the newly gathered facts to disk with commit/1, which appends the new facts to the existing notes. The new facts are stored in a special NEW NOTES section that is recognized by the consolidation agent. These will be incorporated into the main notes body at the beginning of the next session.

The reason for this inverted workflow is because the consolidation process takes much longer than any of the other steps. By performing it at the outset of a session, we reduce the impact of that unfortunate, abeit necessary, time delay on the user experience.

Summary

Types

t()

@type t() :: %AI.Notes{new_facts: [binary()], notes: binary(), user: binary()}

Functions

ask(state, question)

@spec ask(t(), binary()) :: binary()

commit(state)

@spec commit(t()) :: {:ok, t()} | {:error, any()}

consolidate(state)

@spec consolidate(t()) :: t()

ingest_research(state, func, args_json, result)

@spec ingest_research(t(), binary(), binary(), any()) :: t()

ingest_user_msg(state, msg_text)

@spec ingest_user_msg(t(), binary()) :: t()

init(state)

@spec init(t()) :: t()

new()

@spec new() :: t()