jeevesagent.memory.redis_facts
==============================

.. py:module:: jeevesagent.memory.redis_facts

.. autoapi-nested-parse::

   Redis-backed bi-temporal fact store.

   Each fact lives in a Redis hash at ``{prefix}{id}`` (default prefix
   ``jeeves:fact:``). Fields:

   * ``id`` / ``subject`` / ``predicate`` / ``object`` — strings
   * ``confidence`` — string-encoded float
   * ``valid_from_ts`` / ``recorded_at_ts`` — string-encoded floats
   * ``valid_until_ts`` — string-encoded float (``"0"`` when still valid)
   * ``currently_valid`` — ``b"1"`` / ``b"0"`` flag (mirror of
     ``valid_until_ts == 0``)
   * ``sources`` — JSON-encoded list of episode ids
   * ``embedding`` — float32 BLOB (only present when an embedder is
     configured)

   Supersession is a brute-force scan: ``SCAN`` for all fact keys, find
   those with matching subject + predicate that are currently valid and
   have a different object, and ``HSET`` each to flip
   ``currently_valid=False`` + stamp ``valid_until_ts``. RediSearch with
   HNSW + numeric/tag indexes is a follow-up.



Attributes
----------

.. autoapisummary::

   jeevesagent.memory.redis_facts.DEFAULT_KEY_PREFIX


Classes
-------

.. autoapisummary::

   jeevesagent.memory.redis_facts.RedisFactStore


Module Contents
---------------

.. py:class:: RedisFactStore(client: Any, *, embedder: jeevesagent.core.protocols.Embedder | None = None, key_prefix: str = DEFAULT_KEY_PREFIX)

   Bi-temporal fact store over plain Redis hashes.


   .. py:method:: aclose() -> None
      :async:



   .. py:method:: all_facts() -> list[jeevesagent.core.types.Fact]
      :async:



   .. py:method:: append(fact: jeevesagent.core.types.Fact) -> str
      :async:



   .. py:method:: connect(url: str = 'redis://localhost:6379/0', *, embedder: jeevesagent.core.protocols.Embedder | None = None, key_prefix: str = DEFAULT_KEY_PREFIX) -> RedisFactStore
      :classmethod:

      :async:



   .. py:method:: query(*, subject: str | None = None, predicate: str | None = None, object_: str | None = None, valid_at: datetime.datetime | None = None, limit: int = 10, user_id: str | None = None) -> list[jeevesagent.core.types.Fact]
      :async:



   .. py:method:: recall_text(query: str, *, limit: int = 5, valid_at: datetime.datetime | None = None, user_id: str | None = None) -> list[jeevesagent.core.types.Fact]
      :async:



   .. py:property:: embedder
      :type: jeevesagent.core.protocols.Embedder



.. py:data:: DEFAULT_KEY_PREFIX
   :value: 'jeeves:fact:'


