Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

UserPromptSubmit recall regex is English-only: Chinese prompts never trigger auto-recall

未关闭 适合新手
#4 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 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 via additionalContext ✅
  • 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,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nowledge-co/zcode-plugin 的其他 Issue

查看 nowledge-co/zcode-plugin 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。