hermes - ✅(Solved) Fix [BUG] session_search returns zero/partial results despite session files containing matching content [1 pull requests, 3 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#15500Fetched 2026-04-26 05:27:01
View on GitHub
Comments
3
Participants
3
Timeline
8
Reactions
0
Timeline (top)
commented ×3labeled ×3cross-referenced ×1marked_as_duplicate ×1

Root Cause

Root Cause Hypothesis

Fix Action

Workaround

Manual grep works but is not user-friendly:

grep -r "keyword" ~/.Hermes/sessions/session_*.json | head -20

PR fix notes

PR #15509: fix: bypass FTS5 for CJK queries in session_search

Description (problem / solution / changelog)

Fixes #15500

Problem

session_search returns zero or very few results for CJK (Chinese/Japanese/Korean) queries despite session files clearly containing matching content. grep finds 148 matches but session_search returns only 1.

Root Cause

FTS5's default tokenizer splits CJK characters into individual tokens. A query like "大别山项目" becomes 大 AND 别 AND 山 AND 项 AND 目. The existing LIKE fallback only triggers when FTS5 returns zero results. If FTS5 returns even 1-2 matches, the LIKE fallback never runs.

Fix

For CJK queries, bypass FTS5 entirely and use LIKE '%query%' for accurate phrase matching.

Files Changed

  • hermes_state.py — restructured CJK search path

Changed files

  • hermes_state.py (modified, +16/-12)
  • plugins/memory/hindsight/__init__.py (modified, +7/-0)
RAW_BUFFERClick to expand / collapse

Bug Description

Session files are being saved correctly to ~/.Hermes/sessions/, but session_search fails to find content that clearly exists within those session files.

Reproduction

  1. Conduct a multi-session conversation involving a specific topic (e.g., "大别山项目")
  2. Verify session files exist: ls ~/.Hermes/sessions/session_20260424_*.json | wc -l
  3. Run session_search(query="topic_keyword")
  4. Compare results with direct grep: grep -r "keyword" ~/.Hermes/sessions/session_20260424_*.json | wc -l

Actual Results

MethodMatch Count
grep on session files148 matches
session_search1 match

Session files are ~500KB each and clearly contain the keyword "大别山", yet session_search returns almost nothing.

Environment

  • Hermes version: 1.0.0 (from hermes-agent package.json)
  • OS: macOS
  • Session file count: 153 files for 2026-04-24 alone
  • Total session storage: significant (multiple GB)

Root Cause Hypothesis

  1. Indexing issue: The session search index may not be built or updated properly
  2. Context Compaction side effect: When context is compacted, the full content may be replaced by a summary that loses searchable detail
  3. FTS5 configuration: Session search likely uses SQLite FTS5 — the index may be stale or not rebuilt after session updates

Expected Behavior

session_search should return all sessions containing the query keyword, matching what grep finds.

Impact

  • Historical conversations are effectively unsearchable
  • This breaks the core value proposition of persistent memory across sessions
  • Users cannot retrieve past work, research, or decisions

Workaround

Manual grep works but is not user-friendly:

grep -r "keyword" ~/.Hermes/sessions/session_*.json | head -20

extent analysis

TL;DR

Rebuilding the session search index may resolve the issue with session_search not finding existing content in session files.

Guidance

  • Verify the session search index is up-to-date by checking the last update timestamp or running a manual index rebuild command if available.
  • Investigate the Context Compaction configuration to ensure it's not replacing full content with summaries that lose searchable details.
  • Check the FTS5 configuration for any settings that might be causing the index to become stale or not rebuild after session updates.
  • Consider running a manual grep command as a temporary workaround to retrieve sessions containing the query keyword.

Example

No code snippet is provided as the issue doesn't imply a specific code change, but the manual grep command can be used as a temporary workaround:

grep -r "keyword" ~/.Hermes/sessions/session_*.json | head -20

Notes

The root cause of the issue is uncertain, and the provided information doesn't point to a specific solution. Further investigation into the indexing, Context Compaction, and FTS5 configuration is needed to determine the exact cause.

Recommendation

Apply workaround: Use the manual grep command as a temporary solution until the root cause is determined and a proper fix is implemented. This allows users to retrieve sessions containing the query keyword, albeit in a non-user-friendly manner.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING