Raxol.Agent.Memory.Record (Raxol Agent v2.6.0)

Copy Markdown View Source

A single cross-session memory entry.

Records are plain structs (no Ecto), scoped to an agent_id. tokenize/1 is shared by the writer (to build the inverted index) and the searcher (to parse a query) so the index and queries always agree on tokenization.

Summary

Functions

Build a record, filling id, type, tags, and timestamps.

Downcase, split on non-word boundaries, drop short tokens, dedup.

The valid memory types.

Types

mem_type()

@type mem_type() :: :decision | :pattern | :gotcha | :link | :insight | :note

t()

@type t() :: %Raxol.Agent.Memory.Record{
  agent_id: String.t() | nil,
  content: String.t(),
  id: String.t(),
  inserted_at: integer(),
  last_accessed: integer(),
  score: float() | nil,
  tags: [String.t()],
  type: mem_type()
}

Functions

new(attrs)

@spec new(map() | keyword()) :: t()

Build a record, filling id, type, tags, and timestamps.

tokenize(text)

@spec tokenize(String.t()) :: [String.t()]

Downcase, split on non-word boundaries, drop short tokens, dedup.

types()

@spec types() :: [mem_type()]

The valid memory types.