Skip to content

memos_search returns Chinese text as \uXXXX unicode escapes (Hermes adapter missing ensure_ascii=False) #2255

Description

@rwxyx518-prog

Problem

When calling memos_search / memos_timeline / memos_skill_get etc. through the Hermes adapter, Chinese content in the returned JSON is rendered as \uXXXX unicode escapes instead of readable UTF-8 text.

Example — a memos_search hit snippet shows:

"reflection": "\u7528\u6237\u63d0\u4f9b\u4e86 Tushare KEY..."

instead of the actual Chinese characters. The data itself is correct in the DB; only the JSON returned to the host LLM is escaped.

Root cause

In the Hermes adapter adapters/hermes/memos_provider/__init__.py, the json.dumps(...) calls that serialize tool results to the LLM are missing ensure_ascii=False. Python's default is ensure_ascii=True, which escapes all non-ASCII characters to \uXXXX.

Affected lines (as of 2.0.15): memos_search (~1531), memos_get (~1580), memos_timeline (~1599), memos_skill_list (~1605), memos_environment (~1614 and ~1641), memos_skill_get (~1670).

Notably, a few other json.dumps calls in the same file DO already pass ensure_ascii=False (e.g. ~742, ~1015, ~1021), so this is just inconsistent — the tool-result serializers were missed.

Impact

For Chinese (and any non-ASCII) users, every memory retrieval result is hard to read and increases token/cognitive load on the host LLM. Functional correctness of retrieval is unaffected.

Suggested fix

Add ensure_ascii=False to the json.dumps(...) calls that serialize tool results back to the host (the ones listed above). One-line change each; verified it fixes the escape issue locally on 2.0.15.

Environment

  • Plugin version: 2.0.15 (Hermes adapter)
  • Host: Hermes Agent (Windows)
  • Language: Chinese

Metadata

Metadata

Labels

ai:pr-readyAI-created PR is ready for review | AI 生成的 PR 已等待评审area:pluginOpenClaw & Hermesstatus:in-progressSomeone or AI is working on it | 人工或 AI 正在处理types:bugSomething isn't working | 功能异常

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions