Agentic.AgentFS.Materializer behaviour (agentic v0.3.0)

Copy Markdown

Behaviour for materializing skills and memories into the agent's filesystem.

Host applications implement this behaviour and pass the module via ctx.metadata[:agent_fs_materializer].

Usage

defmodule MyApp.AgentFS.Materializer do
  @behaviour Agentic.AgentFS.Materializer

  @impl true
  def materialize_skills(opts) do
    # Return list of %{name: ..., content: ...}
  end

  @impl true
  def materialize_memories(opts) do
    # Return string of formatted memory content
  end

  @impl true
  def sync_back_skills(skills_data, opts) do
    # Persist agent-created skills
  end

  @impl true
  def sync_back_memories(memory_content, opts) do
    # Persist agent-created memories
  end
end

Summary

Callbacks

Materialize memories for the agent filesystem.

Materialize skills for the agent filesystem.

Sync back memories modified by the agent.

Sync back skills created by the agent.

Types

opts()

@type opts() :: keyword()

skill_data()

@type skill_data() :: %{name: String.t(), content: String.t()}

skills_data()

@type skills_data() :: [skill_data()]

Callbacks

materialize_memories(opts)

@callback materialize_memories(opts()) :: String.t()

Materialize memories for the agent filesystem.

Returns a string that will be written to <memory_path>/MEMORY.md.

materialize_skills(opts)

@callback materialize_skills(opts()) :: skills_data()

Materialize skills for the agent filesystem.

Returns a list of %{name: ..., content: ...} maps. Each skill will be written as <skill_path>/<name>/SKILL.md in the overlay.

sync_back_memories(t, opts)

@callback sync_back_memories(String.t(), opts()) :: :ok

Sync back memories modified by the agent.

memory_content is the full text of the memory file after the session.

sync_back_skills(skills_data, opts)

@callback sync_back_skills(skills_data(), opts()) :: :ok

Sync back skills created by the agent.

skills_data is a list of %{name: ..., content: ..., is_new: bool} maps for skills that were modified or created during the session.