Summary
The standalone memos-local-plugin has several related correctness problems in automatic recall across OpenClaw and Hermes:
- Weak keyword or pattern matches, duplicated question traces, priority/recency signals, and unrelated memory tiers can dominate retrieval candidates for personal-fact queries.
- When the LLM relevance filter selects no candidates, the existing rescue path mechanically refills the result and can inject unrelated memories.
- OpenClaw IM channels can wrap the user body with metadata such as
message_id and sender identifiers. The wrapped prompt may leak that metadata into memos_search and memory_add.
- OpenClaw heartbeat and asynchronous command-completion wakeups can be mistaken for user input and trigger memory search or capture.
- Excluding the entire current session prevents recall of older same-session memories after the host compresses them out of the model-visible conversation.
- Retrieval logs do not always make the mechanical ordering, score components, and actual post-LLM count clear.
This is a follow-up to #1913 and #1923. The prior fix avoided an empty injection by refilling candidates, but that fallback does not respect a valid empty LLM selection and can introduce unrelated context.
Expected behavior
- Semantic retrieval should use the normalized user body only. Routing and visibility hints must not participate in semantic matching.
- Personal-fact queries should prioritize relevant trace evidence over unrelated skills, world models, or recency-ranked pattern hits.
- High-confidence duplicate candidates should not consume Top-K capacity, while distinct evidence and keyword or multi-channel eligibility remain preserved.
- An empty LLM relevance-filter result should remain empty rather than being mechanically refilled.
- OpenClaw integrations should use the official clean inbound body when available and use envelope parsing only as a compatibility fallback.
- Internal OpenClaw events should not trigger memory search or capture.
- Same-session traces still visible to the model should be excluded, while older traces outside the visible context after compression should be eligible for recall.
- Logs should show candidates in their effective order with accurate score details and kept/dropped counts.
Proposed implementation
- Build the semantic query only from clean user text and keep
contextHints as routing/filter metadata.
- Correct vector evidence scoring and add a personal-fact retrieval profile.
- Apply conservative rule-based deduplication after scoring/RRF and before the relative threshold and MMR.
- Preserve keyword-confirmed and multi-channel bypass capabilities during early deduplication.
- Continue using MMR for embedding-based diversity.
- Honor the LLM filter result when it returns an empty selection.
- Correlate OpenClaw
message_received.content with later agent hooks by runId; retain conservative legacy sanitization for old hosts and cache misses.
- Filter heartbeat and internal wakeup signatures before recall and capture.
- Pass model-visible conversation boundaries into retrieval. For Hermes, record the boundary during
on_pre_compress without modifying the compression payload.
- Add score diagnostics and accurate post-filter candidate logging.
Compatibility
- No database schema migration.
- No embedding model or dimension change.
- No new runtime dependency.
- Existing memories and embeddings remain compatible.
- Before a compression boundary is known, preserve the legacy whole-session exclusion behavior.
Affected components
apps/memos-local-plugin/core/retrieval/
apps/memos-local-plugin/adapters/openclaw/
apps/memos-local-plugin/adapters/hermes/
- Retrieval logging and viewer presentation
Acceptance criteria
Summary
The standalone
memos-local-pluginhas several related correctness problems in automatic recall across OpenClaw and Hermes:message_idand sender identifiers. The wrapped prompt may leak that metadata intomemos_searchandmemory_add.This is a follow-up to #1913 and #1923. The prior fix avoided an empty injection by refilling candidates, but that fallback does not respect a valid empty LLM selection and can introduce unrelated context.
Expected behavior
Proposed implementation
contextHintsas routing/filter metadata.message_received.contentwith later agent hooks byrunId; retain conservative legacy sanitization for old hosts and cache misses.on_pre_compresswithout modifying the compression payload.Compatibility
Affected components
apps/memos-local-plugin/core/retrieval/apps/memos-local-plugin/adapters/openclaw/apps/memos-local-plugin/adapters/hermes/Acceptance criteria
memos_searchormemory_addactivity.