Skip to content

[good first issue]🎯 [Bug] Hardcoded Chinese Headers in Persona/Scene Extraction Prompts Cause Language Leakage #122

@SD-fan

Description

@SD-fan

OpenClaw Version | OpenClaw 版本

Hermes v0.15.1

Plugin Version | 插件版本

v0.3.6

Operating System | 操作系统

Ubuntu / Docker

System Specification | 系统配置

RTX Pro 6000, Qwen 3.6 27B FP8 MTP

Describe the bug | 问题描述

Issue: Hardcoded Chinese Headers in Persona/Scene Extraction Prompts Cause Language Leakage

Problem

The TencentDB Memory Gateway injects Chinese-language section headers into the Persona profile and memory context, even when the user communicates exclusively in German (or any other non-Chinese language). This happens because the prompt templates in scene-extraction.ts contain hardcoded Chinese section headers that the LLM follows as a template.

Affected Files

  • src/core/prompts/scene-extraction.ts (lines 198-229)
  • Generated persona.md files contain Chinese headers like:
    • ## 演变轨迹 (Evolution Trajectory)
    • ## 待确认/矛盾点 (Pending Confirmation / Contradictions)
    • ## 用户基础信息 (User Basic Information)
    • ## 用户核心特征 (User Core Traits)
    • ## 用户偏好 (User Preferences)
    • ## 隐性信号 (Implicit Signals)
    • ## 核心叙事 (Core Narrative)

Impact

  1. Language contamination: Chinese characters appear in the injected memory context for every session, regardless of the user's language preference.
  2. Agent confusion: The agent may accidentally copy Chinese headers into responses if it does not carefully filter the injected context.
  3. User experience: Users who do not read Chinese see unexpected characters in their conversation context.
  4. Persona profile pollution: The generated persona.md file contains Chinese section headers that persist across sessions.

Root Cause

The prompt templates in scene-extraction.ts use hardcoded Chinese section headers as output format instructions. The LLM follows these templates literally, producing Chinese headers in the generated persona profile. The CHANGELOG mentions that prompts should adapt to the user's language, but this is not implemented for the scene extraction templates.

Suggested Fix

Replace hardcoded Chinese headers in scene-extraction.ts with English or language-adaptive equivalents:

## 演变轨迹 -> ## Evolution Trajectory
## 待确认/矛盾点 -> ## Pending Confirmation / Contradictions
## 用户基础信息 -> ## User Basic Information
## 用户核心特征 -> ## User Core Traits
## 用户偏好 -> ## User Preferences
## 隐性信号 -> ## Implicit Signals
## 核心叙事 -> ## Core Narrative

Environment

  • Hermes Agent: v0.15.1 (2026.5.29)
  • TencentDB Memory Gateway: v0.3.6
  • Model: qwen3.6-27b (custom provider)
  • OS: WSL (Windows Subsystem for Linux)
  • Docker: hermes-memory image

To Reproduce | 复现步骤

  1. Set up TencentDB Memory Gateway with any LLM backend
  2. Run conversations in German (or any non-Chinese language)
  3. Check the generated persona.md file
  4. Observe Chinese section headers in the output

Expected behavior | 预期行为

The prompt templates should either:

  • Use language-neutral headers (English as default)
  • Dynamically adapt headers to the detected user language
  • At minimum not inject Chinese characters into non-Chinese conversations

Error Logs / Screenshots | 报错日志/截图

No response

Additional context | 补充信息

No response

Metadata

Metadata

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions