Skip to content

Episodes: cache episode summary embeddings to avoid redundant calls #200

@abbudjoe

Description

@abbudjoe

From PR #196 review (Issue #4).

The fast-path detection re-embeds every active episode summary on each remember() call. With 20 active episodes, that's 20 embedding calls per memory stored.

Recommended fix: Cache summary embeddings keyed by (episode_id, summary_hash):

self._summary_embedding_cache = {}  # {episode_id: (summary_hash, embedding)}

Only re-embed when the summary content changes (hash mismatch). This reduces embedding calls from O(active_episodes) to O(changed_episodes) per remember().

Part of Episode Memories (#190).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions