How much one store may hold: at most maxMemories memories and maxBytes bytes, measured by MemoryBounds.sizeOf. A TransactionalMemoryStore enforces both in the transaction that adds, by evicting.
The bounds count, and eviction ranks, every memory in the store, whoever stored it - unless an MemoryBounds.Owner is set (withOwner): then only the memories whose metadata carries the owner's key and value count, and only they are ever evicted. A writer that shares a store with data it did not write (knowledge loaded with recordKnowledge, facts an application stores) sets one, as SemanticMemoryMiddleware does (#3034).
The memories to evict from entries - (id, importance, timestamp, size) - so that the rest are within both bounds: lowest importance first (a memory with none counts as 0.5), then oldest, then by id, compared by its UTF-8 bytes as recall and the SQL stores compare ids. entries are the memories that counts: a store passes only those. The SQL stores rank and delete in one statement instead, in this order (#3328).
The memories to evict from entries - (id, importance, timestamp, size) - so that the rest are within both bounds: lowest importance first (a memory with none counts as 0.5), then oldest, then by id, compared by its UTF-8 bytes as recall and the SQL stores compare ids. entries are the memories that counts: a store passes only those. The SQL stores rank and delete in one statement instead, in this order (#3328).