Chinese/Japanese i18n: improve viewer Memories search
Summary
Revision / clarification: my earlier note about Chinese source memories being rewritten into English appears to have been caused by Claude Code's own rewriting/summarization behavior, not necessarily by AgentMemory itself. I have worked around that locally by saving a strong preference memory that tells the assistant to preserve the user's original Chinese.
The remaining AgentMemory-side issue is the viewer memory search experience for Chinese/Japanese content on http://localhost:3113/#memories.
Environment
- AgentMemory version: 0.9.18
- OS: Windows
- Viewer:
http://localhost:3113/#memories - Source/query language: Chinese; also interested in Japanese support
- LLM provider: Gemini configured
Confirmed issue: viewer memory search is weak for Chinese/Japanese
I tested the backend REST search directly with a Chinese query:
Invoke-RestMethod -Method Post `
-Uri http://localhost:3111/agentmemory/search `
-Body (@{ query='测试 agentmemory 记录'; limit=10; format='compact' } | ConvertTo-Json) `
-ContentType 'application/json'
The backend can find Chinese memories successfully.
However, the viewer memory page at /#memories appears to only load memories and then locally filter them in JavaScript:
var search = state.memories.search.toLowerCase();
...
(m.title || '').toLowerCase().includes(search)
(m.content || '').toLowerCase().includes(search)
This means the viewer memory search is not using BM25/vector/smart-search and may not handle Chinese/Japanese input well, especially with IME composition and CJK tokenization expectations.
Expected behavior
- The viewer Memories page should support Chinese and Japanese input/search reliably.
- Search should ideally call backend
/agentmemory/searchor/agentmemory/smart-searchinstead of only local substring filtering. - If local filtering remains, it should handle IME composition events correctly and not assume English tokenization/casing.
- The viewer should make it clear whether the search box is local filtering or full backend search.
Possible solution
- Add a backend-powered search mode to the Memories page.
- Use
/agentmemory/smart-searchor/agentmemory/searchfor non-empty search queries. - Keep local filtering as a fast fallback for empty/simple filters.
- Add CJK-specific tests around Chinese/Japanese memory content and viewer search behavior.
Optional / lower-priority i18n improvement
Even though the English rewrite issue in my case came from Claude Code behavior, AgentMemory may still benefit from a documented option or prompt rule for users who want memory content to preserve the source language.
For example:
Preserve the source language of the input. Do not translate Chinese/Japanese/Korean or other non-English source content into English unless the user explicitly asks for translation.
Possible config idea:
AGENTMEMORY_MEMORY_LANGUAGE=auto
where auto means detect and preserve the source language.
This is not the primary bug report anymore; the primary issue is the viewer Memories search behavior.
Proposal / offer to help
I can help build the Chinese/Japanese viewer search improvement if maintainers want it. A possible implementation plan:
- Improve the viewer Memories search to use backend search/smart-search for non-empty queries.
- Add IME-safe frontend handling for Chinese/Japanese input.
- Add regression tests with Chinese and Japanese examples:
- Chinese queries can find matching memories from the viewer and backend.
- Japanese queries can find matching memories from the viewer and backend.
- Confirm whether optional CJK tokenizers such as
@node-rs/jieba/tiny-segmentershould be installed, recommended, or surfaced in diagnostics for better search quality.
Please let me know whether this direction fits the project.