Persistent memory via ChromaDB vector store.
Purpose
-------
Provides :func:`remember` and :func:`recall` for long-term semantic
memory across REPL sessions. Backed by a local ChromaDB persistent
client at ``./memory_store/`` with cosine-similarity search.
Falls back to the structured ``missing_dependency`` shape that the
dependency healer can intercept when ``chromadb`` is not installed.
Responsibilities
----------------
- :func:`_get_collection` — lazily build (or reload) the persistent
collection on first access.
- :func:`remember` — embed and store a text chunk with optional
metadata; returns the assigned id.
- :func:`recall` — semantic-similarity query returning the top-k
matches with their metadata and distances.
Requires: ``pip install chromadb``
Diagnostics
-----------
Domain: OC_CHAT.TOOLS
Levels:
L2 — lifecycle events
L3 — semantic details
L4 — deep tracing
Contracts
---------
- The collection is process-singleton — repeat calls reuse the same
client/collection handles.
- Missing ``chromadb`` returns ``{"missing_dependency": "chromadb",
...}`` rather than raising, so the healer can offer to install.
- The on-disk store at ``memory_store/`` is opaque to callers; only
the public ``remember`` / ``recall`` API is supported.
Dependencies
------------
- oc_diagnostics (structured debug logging via _dbg)
- oc_chat.tools.filesystem (lazy; _sandbox_root - places the memory store under the effective sandbox root)
- chromadb (lazy; the persistent vector store client and its cosine-similarity collection, optional)
See Also
--------
oc_chat/docs/conventions/CONTRACTS.md §3 Tool registry contract; §4 Tool return-
value conventions.