The Memory Working Set
The Working Set is the finalized, ranked collection of memories that are injected into an AI agent's prompt context for a specific conversation or task.
It represents the system's "best guess" at the knowledge the AI needs right now to be helpful and accurate.
Definition
A working set is dynamic and ephemeral. It is generated on-the-fly by the Hybrid Retrieval system based on:
- The current user and organization (The Subject).
- The current conversation history or query.
- The available memory blocks for that tenant.
Characteristics
- Ranked: Memories are ordered by their composite score (Similarity + Salience + Confidence).
- Capped: The working set has a limit (e.g., 10-20 blocks) to prevent context window saturation and "lost in the middle" effects.
- De-aliased: The system ensures only the latest version of a memory is present if multiple
SUPERSEDESrelationships exist. - Aggregated: Memories may be grouped into Memory Packs for better structural presentation to the AI.
The Generation Lifecycle
- Trigger: An agent calls the
memory.querytool. - Retrieve: The hybrid engine fetches structurally and semantically relevant blocks.
- Filter: Non-salient or low-confidence blocks are discarded.
- Rank: Remaining blocks are scored and sorted.
- Finalize: The top-N blocks are compiled into the final prompt context.
Working Set in the UI
In the Memory Browser, users can see the "Current Working Set" for their session. This allows administrators to:
- See exactly what context the AI is currently "remembering."
- Inspect the scores for each block in the set.
- Manually pin or remove blocks if the Working Set is inaccurate.
Best Practices for Developers
- Manage Context Size: Don't request too many blocks at once. A focused working set of 5-10 high-quality memories is often more effective than 50 noisy ones.
- Use Subjects: Always query within a subject scope to ensure the working set is relevant to the current conversation.
- Trust the Scoring: Let the engine handle the ranking and salience decay to ensure the most "important" information naturally stays in the set.