inject prompt-recall can never match CJK (Chinese/Japanese/Korean) gene signals: tokenizer is Unicode-aware but has no word segmentation
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, nodejs
調査の方向性
Start in promptRecallHook.js, especially normalizedTokens, buildPromptSequenceIndex, literalSignalHits, and the short-prompt guard. Run the attached repro.mjs to confirm the failing connected-text cases and the English control. Done means CJK signals match when embedded in connected text without regressing ASCII matching or the existing prompt-length behavior.
索引モデルが issue の本文から書いたものです。
説明
Environment
@evomap/evolver2.0.36 (npm, global install)- Node.js v24.18.1 (full ICU), Windows 11
EVOLVER_RECALL_MODE=enforce, local asset store, no Hub involvement- Reproduced on a completely isolated
EVOMAP_HOME— nothing else in play
Summary
A gene whose signals_match contains CJK tokens is never recalled at prompt time, even when
the prompt literally contains that exact token. This is not an encoding problem — CJK is stored,
loaded and compared correctly. It is a word-segmentation problem.
The prompt tokenizer (promptRecallHook.js:99 normalizedTokens) is:
text.toLowerCase().normalize('NFKC').match(/[\p{L}\p{N}]+/gu)
\p{L} covers CJK, so Chinese characters are not stripped — but CJK text has no spaces, and
nothing in Evolver adds word boundaries. A whole Chinese clause therefore collapses into a
single token.
literalSignalHits (promptRecallHook.js:179) then requires the gene's signal to appear as a
contiguous token sequence in the suffix trie built from the prompt
(buildPromptSequenceIndex, promptRecallHook.js:137). Since an individual Chinese word never
survives as its own token, the comparison can never succeed.
prompt 请帮我修复这个报错问题 → ["请帮我修复这个报错问题"] ← 1 token
gene signals_match: ["报错"] → ["报错"] ← never equal
An English gene with the same shape matches fine, because ASCII word spacing produces tokens.
Minimal reproduction
repro.mjs (attached below) is self-contained — it builds a throwaway EVOMAP_HOME, writes one
Chinese-signal gene and one English-signal gene, and calls the real CLI:
node repro.mjs
PASS please handle the zebrafish case English control
PASS 报错,帮我看看这个情况 Chinese, keyword bounded by fullwidth comma
PASS 出现 报错 怎么办才好 Chinese, keyword bounded by spaces
FAIL 请帮我修复这个报错问题 Chinese, keyword embedded in connected text
FAIL 报错日志里的异常信息 Chinese, keyword embedded in connected text
3/5 as expected
The English case is a control: it proves the fixture, the store, the trust gate and the hook
are all working, so the Chinese failures cannot be attributed to a broken test harness. This
matters — an earlier version of this reproduction lacked the control and silently reported
"no matches" for a fixture that was never loadable in the first place
(a gene record needs the asset_id field; and note that writing an explicit
source: 'local_default' provenance row makes a local gene ineligible, while simply omitting
provenance.jsonl leaves it trusted).
Root cause, precisely
| Tokenizer | /[\p{L}\p{N}]+/gu — Unicode-aware, CJK is a valid letter |
| Segmentation | none — no Intl.Segmenter, no CJK segmenter dependency anywhere in the package |
| Match | contiguous token-subsequence lookup in a suffix trie |
| Consequence | a CJK clause is one token; sub-phrase signals can never match |
Boundaries that happen to work, because they are not \p{L}: spaces, fullwidth/halfwidth
punctuation, and script changes. So 报错,帮我看看这个情况 matches while
请帮我修复这个报错问题 does not — the difference is purely whether the keyword is delimited.
Two unrelated traps worth documenting while you are in here:
promptRecallHook.js:394short-circuits any prompt withprompt.trim().length < 8, returning{}.
Several natural Chinese prompts (报错,报错,帮我看看— 2 and 7 characters) fall under this,
so the failure looks like "short prompts" rather than "CJK".- A gene record must carry
asset_id(the store's primary key), andprovenance.jsonlmust use that
same hash. A record built without it loads underasset logbut is silently absent from recall.
Impact
Any non-space-delimited language — Chinese, Japanese, Korean, Thai — gets no prompt-time recall at
all. The failure is silent: the hook returns {} and looks identical to "no relevant gene found".
For users who write prompts in these languages, prompt-recall is effectively dead, and the only
working channel is the session-start injection.
CJK developers are a substantial part of this community (there is a README.zh-CN.md, and many
issues are filed in Chinese), so this is likely affecting a meaningful share of users without
being visible in logs.
Suggested fixes
Ordered by cost:
- Segment the prompt before indexing.
Intl.Segmenteris built into Node (no dependency) —
but note it over-segments Chinese:报错→["报","错"], and since
normalizedTokensdrops tokens withlength < 2(line 105), those single characters are then
discarded, soIntl.Segmenteralone does not fix this without also relaxing the minimum
token length for CJK. I verified this — it is a trap worth avoiding. - Substring fallback for CJK signals. When a signal contains CJK and the trie lookup fails,
fall back toprompt.includes(signal). Cheap, and bounded by the existing
PROMPT_RECALL_SIGNAL_PATTERN_CHARSlimit. - Document the limitation and recommend ASCII/tool-name signals, plus the
|alias syntax,
for genes intended to be recalled in CJK conversations. Right now nothing tells a user that
signals_match: ["报错"]can never fire.
Option 2 seems the smallest change that actually fixes it, and it cannot regress the ASCII path
because it only triggers when the signal contains CJK.
Workaround
Integrators can pre-augment the prompt before calling the hook: scan local genes' CJK signals, and
append any that appear literally in the prompt as a space-separated tail, which makes them
standalone tokens. Verified working on 2.0.36 (the connected-text case above then matches). It is
a workaround, not a fix — the tokenizer should handle this itself.
Reproduction script: repro.mjs (single file, no dependencies beyond a global evolver).
- 主要言語
- JavaScript
- スター
- 9.1k
- フォーク
- 848
- 平均マージ
- 14時間 39分
- マージ済み PR(30日)
- 1
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
EvoMap/evolver のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
[Windows] fdatasyncSync on read-only fd throws EPERM, blocks node credential snapshot (canonicalIdentityLock.js)対応中かも @scui73414-bot が 64 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
似ている issue
-
generate_image reference URL guard lets through IPv4-mapped IPv6 hosts and 100.64.0.0/10対応中かも @goranai が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
NL-BioImaging/OMERO.biomero#92 ·
メンテナーはふだん 1 日以内に返信
-
bug: juros do parcelamento travados em 1x no gateway Rede Débito e Crédito 3DS (woo-rede 5.6.0)オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
LinkNacional/woo-rede#367 ·
-
Docs: 1 broken linkオープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
bug Next.js
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
getsentry/sentry-wizard#1397 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信