Skip to content

[IMPROVEMENT] PRISM: graph-based retrieval-side memory optimization — min-cost path selection, bundle search, query-sensitive edge costs, adaptive intent routing #1733

Description

@Lexus2016

Problem

PRISM (Pareto-Efficient Retrieval over Intent-Aware Structured Memory, arXiv:2605.12260, May 2026) is a training-free, retrieval-side framework that occupies a previously empty corner of the accuracy-vs-context-cost frontier. While SimpleMem (covered 08-05) optimizes the ingestion side, PRISM optimizes retrieval: it formulates memory retrieval as a min-cost selection problem over a graph-structured memory store.

Four orthogonal modules:

  1. Hierarchical bundle search over typed relation paths — retrieves related fact clusters, not isolated facts.
  2. Query-sensitive edge-cost adjustment — edges between facts have costs that shift based on query intent.
  3. Evidence compression — an LLM-side step that compresses retrieved evidence before injecting into context.
  4. Adaptive intent routing — classifies query complexity and adjusts retrieval scope without a per-query LLM call (unlike SimpleMem's intent-aware retrieval which requires LLM inference per query).

On LoCoMo, PRISM achieves strong accuracy at an order-of-magnitude smaller context budget than full-context baselines, outperforming Mem0, Mem0g, and MAGMA under equal-protocol comparisons.

Why it matters for Hermes

tqmemory's retrieval is currently semantic-search-based (embedding similarity). As the note store grows (the evolution pipeline generates notes every cycle), retrieval quality degrades — more results returned, more noise, higher context cost. PRISM's approach of building typed relation paths over the existing link_entities graph and using min-cost path selection would improve retrieval precision without requiring changes to how notes are written.

The adaptive intent routing (no per-query LLM call) is especially attractive for cost-sensitive autonomous workflows — it avoids the token overhead of SimpleMem's LLM-based intent inference. The evidence compression step directly addresses the context-budget problem: retrieved memories are compressed before injection, reducing token consumption.

Proposed Solution

  1. Graph-based retrieval mode. Add alongside existing semantic search: build typed relation paths over existing entity links (references, related-to, supersedes).
  2. Complexity classification. For each query, classify complexity (simple lookup vs. multi-hop reasoning) using lightweight heuristics — no LLM call needed.
  3. Min-cost path traversal. For complex queries, traverse the relation graph with min-cost path selection, bundling related notes.
  4. Evidence compression. Compress retrieved evidence via a short LLM summarization pass before injecting into agent context.

This is a retrieval-side complement to any ingestion-side compression (SimpleMem-style) and uses infrastructure tqmemory already has (the entity graph from link_entities).

Acceptance Criteria

  • A graph-based retrieval mode traverses typed relation paths and returns related note bundles (not just isolated semantic matches).
  • Query complexity is classified without an LLM call; complex queries trigger graph traversal, simple queries use fast semantic lookup.
  • Edge costs adjust based on query intent (query-sensitive cost adjustment).
  • Retrieved evidence is compressed before context injection, reducing token consumption measurably.
  • Retrieval precision improves over semantic-only baseline on a held-out query set (measure: recall@k or nDCG@10).

Source

Priority

Priority score: 0.72 (Impact Medium × Effort Medium). Training-free and uses infrastructure tqmemory already has (entity graph). Retrieval-side optimization that complements ingestion-side approaches.

Dedup note

Distinct from #1713 (Multi-strategy retrieval — BM25 + temporal + cross-encoder reranking). #1713 adds more retrieval strategies (lexical, temporal, reranking fusion). PRISM optimizes retrieval path selection over the graph (min-cost traversal of typed relation edges, bundle search, query-sensitive edge costs, evidence compression). They operate at different layers: #1713 is about which similarity signals to fuse; PRISM is about how to traverse the relation graph optimally. Complementary, not overlapping — #1713 could feed candidates to PRISM's graph traversal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    improvementAn improvement to existing functionalitymemoryMemory subsystem

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions