Agentic.Memory.ContextKeeper
(agentic v0.2.2)
Copy Markdown
Per-workspace in-process working memory.
Maintains two data structures:
facts — structured triples extracted from tool results and LLM responses (entity/relation/value). Capped at 500 entries, oldest dropped first.
working_set — key-value pairs stored explicitly by the agent or loop stages. Supports TTL (seconds or
:infinity) and priority (:high,:normal,:low).
Registered via Agentic.Memory.ContextKeeperRegistry so there is at most one keeper
per workspace. Survives session restarts but stops when the workspace disconnects.
Summary
Functions
Returns a specification to start this module under a supervisor.
Return formatted context string for injection into system prompt.
Retrieve a value from the working set.
Ingest a list of facts from FactExtractor.
Query facts matching a substring in entity or value fields.
Check if a ContextKeeper is running for the given workspace.
Store a key-value pair in the working set.
Types
@type state() :: %{ workspace_id: String.t(), facts: [fact()], working_set: %{required(String.t()) => working_entry()} }
@type working_entry() :: %{ value: term(), ttl: integer() | :infinity, priority: :high | :normal | :low, inserted_at: DateTime.t() }
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Return formatted context string for injection into system prompt.
Includes high-priority working set items and recent facts.
Retrieve a value from the working set.
Ingest a list of facts from FactExtractor.
Query facts matching a substring in entity or value fields.
Check if a ContextKeeper is running for the given workspace.
Store a key-value pair in the working set.