Public entry point and adapter port for Gralkor memory.
Named Lens operations use ingest/1 and replace/1; search/1 selects
registered Destinations. Ingestion
resolves an appending Lens and invokes its ingestion process with a
Lens-bound store. Replacement validates and stores the complete graph for a
replaceable Lens. Lenses and Reflections reference first-class Destinations,
whose addresses resolve graph placement and whose ontologies govern
extraction. Destination search runs every distinct selection concurrently,
defaults an empty selection to packaged operator memory, and can return
facts, nodes, episodes, or Reflection artefacts.
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. The internal capture/8 form also carries the host tools
and tool context made available to subsequent Reflections. 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 capture( session_id(), group_id(), agent_name(), user_name(), messages(), lens :: String.t(), additional_lenses :: [String.t()], reflection_context :: map() ) :: :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()}
Functions
@spec impl() :: module()
@spec ingest(Gralkor.Ingest.t()) :: :ok | {:error, term()}
@spec lens!(String.t()) :: Gralkor.Lens.t() | Gralkor.Lens.Replaceable.t()
@spec replace(Gralkor.Replace.t()) :: :ok | {:error, term()}
@spec search(Gralkor.Search.t()) :: {:ok, [search_result()]} | {:error, term()}