Public entry point and adapter port for Gralkor memory.
Named Lens operations use ingest/1 and search/1. Ingestion resolves the
application-owned Lens definition and invokes its ingestion process with a
Lens-bound store. Search always begins with the requesting operator's
reserved "default" destination, then combines explicitly selected
operator-local Lens destinations and the reserved "global" pool; a global
Lens name is provenance, not a search boundary.
The compatibility surface remains recall/4, capture/5, flush/1,
flush_and_await/2, and memory_add/3 or /4. Lens-aware capture uses
capture/6, or capture/7 when the same turn is also routed through
additional Lenses. Legacy group IDs are sanitised at their graph boundary
(sanitize_group_id/1); Lens storage binds the original operator id to its
selected Lens instead.
flush/1 returns :ok before the buffered turns have landed
(fire-and-forget — appropriate for shutdown paths that cannot block).
flush_and_await/2 returns :ok only after buffered ingestion completes,
for callers that must observe completion before rotating state (for example
session-id rotation in JidoGralkor.ContextRotator).
The concrete adapter is resolved from Application.get_env(:jido_gralkor, :client);
defaults to Gralkor.Client.Native (in-process via Pythonx). Tests swap in
Gralkor.Client.InMemory.
No health_check/0 — the embedded runtime is ready by the time
Application.start/2 returns; runtime failures surface from the next call.
Summary
Types
Callbacks
@callback build_communities(group_id()) :: {:ok, %{communities: non_neg_integer(), edges: non_neg_integer()}} | {:error, term()}
@callback capture( session_id(), group_id(), agent_name(), user_name(), messages() ) :: :ok | {:error, term()}
@callback capture( session_id(), group_id(), agent_name(), user_name(), messages(), lens :: String.t() ) :: :ok | {:error, term()}
@callback capture( session_id(), group_id(), agent_name(), user_name(), messages(), lens :: String.t(), additional_lenses :: [String.t()] ) :: :ok | {:error, term()}
@callback flush(session_id()) :: :ok | {:error, term()}
@callback flush_and_await(session_id(), timeout_ms :: pos_integer()) :: :ok | {:error, :timeout} | {:error, term()}
@callback recall(group_id(), agent_name(), session_id() | nil, query :: String.t()) :: {:ok, String.t()} | {:error, term()}
@callback search_generalisations( group_id(), query :: String.t(), max_results :: pos_integer() ) :: {:ok, [Gralkor.Generalisation.t()]} | {:error, term()}
Functions
@spec impl() :: module()
@spec ingest(Gralkor.Ingest.t()) :: :ok | {:error, term()}
@spec lens!(String.t()) :: Gralkor.Lens.t()
@spec search(Gralkor.Search.t()) :: {:ok, [String.t()]} | {:error, term()}