Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#4 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
1/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
82/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
javascript
Lĩnh vực
backend

Hướng nghiên cứu

Đọc hooks/zcode-mem-hook.mjs, đặc biệt là định nghĩa RECALL_PROMPT_RE ở dòng 8–9, và kiểm tra cách hook UserPromptSubmit sử dụng nó. Issue cung cấp một thay đổi regex và các prompt mẫu để xác minh: prompt tiếng Trung về lịch sử phải kích hoạt việc truy hồi, còn prompt không liên quan thì không. Chạy các bài kiểm thử hook liên quan nếu có; issue không nêu tên tệp kiểm thử nào.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
JavaScript
Star
3
Fork
1
Merge trung bình
1 phút
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của nowledge-co/zcode-plugin

Tất cả issue của nowledge-co/zcode-plugin

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.