UserPromptSubmit recall regex is English-only: Chinese prompts never trigger auto-recall
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 82/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- javascript
- 领域
- backend
调研方向
阅读 hooks/zcode-mem-hook.mjs,尤其是第 8–9 行的 RECALL_PROMPT_RE 定义,并检查 UserPromptSubmit hook 如何使用它。Issue 提供了一个正则表达式修改和用于验证的示例提示:关于历史的中文提示应触发召回,而无关提示不应触发。若有相关的 hook 测试,请运行;issue 中没有指定测试文件。
由索引模型根据 Issue 内容生成。
描述
Summary
The UserPromptSubmit recall hook never fires for Chinese-language prompts, because RECALL_PROMPT_RE in hooks/zcode-mem-hook.mjs only matches English keywords. For users who work primarily in Chinese, the auto-recall feature is effectively dead.
Details
In plugin v0.2.0, hooks/zcode-mem-hook.mjs:8-9:
const RECALL_PROMPT_RE =
/\b(previous|prior|history|remember|decision|like before|regression|release|plugin|connector|sync|hook|thread|memory|context)\b/i;
A prompt like Nowledge Mem 的安装历史和配置 (clearly asking about installation history) does not match, so recall is skipped even when highly relevant memories exist in the store.
Verified fix
Adding a separate CJK alternative group (CJK has no \b word boundaries, so it must not be wrapped in \b(...)):
const RECALL_PROMPT_RE =
/\b(previous|prior|history|remember|decision|like before|regression|release|plugin|connector|sync|hook|thread|memory|context)\b|(之前|以前|上次|历史|记住|记忆|回忆|决策|上下文|还记得)/i;
Tested locally (Windows, plugin 0.2.0, nmem-cli 0.10.76):
- Prompt
Nowledge Mem 的安装历史和配置→ hook injected 2 relevant memories viaadditionalContext✅ - Unrelated prompt
帮我写个函数→ no recall triggered, no output ✅ (false-positive rate unchanged)
Suggestion
A keyword gate is inherently brittle across languages. A more robust long-term option might be to make the gate language-agnostic — e.g. always run a bounded top-3 recall on every prompt (cost is one local search), or derive the trigger from the context bundle rather than a keyword list. The regex patch above is a minimal stopgap.
- 主要语言
- JavaScript
- 星标
- 3
- 派生
- 1
- 平均合并
- 1 分钟
- 30 天内合并 PR
- 1
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
nowledge-co/zcode-plugin 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 45/100
nowledge-co/zcode-plugin#2 · 1 条评论 ·
查看 nowledge-co/zcode-plugin 的全部 Issue
相似的 Issue
-
Let TypeScript accept an initial object in ReactiveDict可能已有人在做 @yograj-vijay-yadav 今天认领。 未关闭bug good first issue help wanted workshop
难度 2/5 1-3 小时 新手友好度 92/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
akitaonrails/FrankMD#268 ·
维护者通常 1 天内回复
-
account: profile
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 5 天内回复
-
难度 1/5 1 小时以内 新手友好度 82/100
mfreed7/xslt_polyfill#65 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复