LemonMemory.Providers (lemon_memory v0.1.0)

View Source

Supervised registry and fan-out search boundary for memory providers.

Lemon always includes the local SQLite provider. Additional BEAM providers can register at runtime and are queried through this module, which gives the agent one stable memory-search surface while keeping external providers isolated by timeout and exception handling.

Summary

Functions

Returns a specification to start this module under a supervisor.

Fan out a memory document to enabled providers.

Register or replace a BEAM memory provider.

Search enabled providers and return merged memory documents.

Returns redacted provider metadata suitable for operators and support bundles.

Remove a registered provider. The built-in local provider cannot be removed.

Types

provider_spec()

@type provider_spec() :: %{
  :id => String.t(),
  :module => module(),
  optional(:enabled) => boolean(),
  optional(:label) => String.t(),
  optional(:source) => String.t(),
  optional(:scopes) => [atom()],
  optional(:timeout_ms) => non_neg_integer()
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

put(doc, opts \\ [])

@spec put(
  LemonMemory.Document.t(),
  keyword()
) :: :ok

Fan out a memory document to enabled providers.

The call is fire-and-forget. Providers are invoked inside this GenServer and failures are logged but never returned to callers finalizing a run.

register_provider(spec)

@spec register_provider(provider_spec() | keyword()) :: :ok | {:error, term()}

Register or replace a BEAM memory provider.

register_provider(server, spec)

@spec register_provider(GenServer.server(), provider_spec() | keyword()) ::
  :ok | {:error, term()}

search(query, opts \\ [])

@spec search(
  binary(),
  keyword()
) :: [LemonMemory.Document.t()]

Search enabled providers and return merged memory documents.

start_link(opts \\ [])

status(opts \\ [])

@spec status(keyword()) :: map()

Returns redacted provider metadata suitable for operators and support bundles.

unregister_provider(id)

@spec unregister_provider(String.t()) :: :ok | {:error, term()}

Remove a registered provider. The built-in local provider cannot be removed.

unregister_provider(server, id)

@spec unregister_provider(GenServer.server(), String.t()) :: :ok | {:error, term()}