Skip to content

FTS5 query failures with Hermes Agent instructional prompts #1595

@SonicBotMan

Description

@SonicBotMan

Description

When used with Hermes Agent, the before_prompt_build hook receives internal agent prompts that cause FTS5 query failures and wasted LLM calls.

Steps to Reproduce

  1. Deploy MemTensor plugin with Hermes Agent v0.10.0
  2. Enable auto-recall functionality
  3. Wait for session end when Hermes fires _SKILL_REVIEW_PROMPT
  4. Observe FTS5 query failures in logs

Example Error

[warn] FTS query failed for: "Review the conversation above consider saving updating skill if appropriate Focus on was non trivial approach used to complete task that required trial error changing course due to experiential findings along the way did the user expect desire different method outcome? If relevant skill already exists update it with what you learned Otherwise create new skill if the approach is reusable If nothing is worth saving just say Nothing to save stop", returning empty

Root Cause

The normalizeAutoRecallQuery() function in apps/memos-local-openclaw/index.ts doesn't filter out:

  • Long instructional prompts (>300 chars)
  • System prompt patterns ("You are...")
  • Known Hermes review prompts ("Review the conversation above...")

These prompts are passed to FTS5 search, which fails because:

  1. The sanitized query is too long/complex
  2. The content is instructional, not searchable information

Impact

  • FTS5 query failures: Logged as warnings, degrade search quality
  • Wasted LLM calls: filterRelevant() receives empty responses
  • Degraded performance: FTS search falls back to vector-only search

Proposed Solution

Add early detection for instructional prompts in normalizeAutoRecallQuery():

if (query.length > 300) {
  return "";  // System instructions, not user queries
}
if (/^You are\b/i.test(query)) {
  return "";  // System prompt pattern
}
if (/Review the conversation above/i.test(query)) {
  return "";  // Hermes review prompt
}

Related PR

#1594 - fix: skip instructional prompts in auto-recall query normalization

Environment

  • Hermes Agent: v0.10.0
  • MemTensor: v1.0.4
  • Model: deepseek-v4-flash (reasoning model)
  • OS: Linux (Docker container)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions