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

Copy Markdown View Source

Pure helpers that weave a memory provider into an agent turn.

The provider is the normalized form {module, opts} (or nil when memory is disabled). enrich_messages/3 prefetches memories relevant to the current query and injects them as a system message, kept after any leading static system messages so a cacheable system prefix is undisturbed. Memory failures degrade to a no-op so a backend issue never fails an agent turn.

Writes are explicit (the memory_remember action). Automatic post-turn capture is a documented future extension, not wired here.

Summary

Functions

Inject relevant memories into messages for the given query.

Append a provider's build_user_context/1 block to the LAST user message.

Types

provider()

@type provider() :: {module(), keyword()} | nil

Functions

enrich_messages(messages, arg2, query)

@spec enrich_messages([map()], provider(), String.t()) :: [map()]

Inject relevant memories into messages for the given query.

enrich_user_context(messages, arg2)

@spec enrich_user_context([map()], provider()) :: [map()]

Append a provider's build_user_context/1 block to the LAST user message.

Unlike enrich_messages/3, which injects into the system prefix, this injects into the user message so a per-turn refresh leaves the cacheable system prefix untouched. A nil provider, an absent callback, or a failure is a no-op.