[GH-ISSUE #1291] [Feature]: LTM Korean name identity — particle boundaries, short names, source id→name aliases #659

Closed
opened 2026-10-20 17:29:29 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Promansis on GitHub (Oct 9, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1291

Originally assigned to: @Promansis on GitHub.

What problem does this solve?

Long-Term Memory cannot reliably resolve Korean character names on stock code, without a third-party server patch. This was surfaced while triaging #1277, where the reporter's environment runs a custom hangul_subjectid_patch.cjs that normalizes subjectId values and improves Korean name handling. The reporter's guiding principle — identity comes from trusted names and keys, not from a romanized subjectId — is already how LTM works, and exact Hangul name matching already succeeds. The gaps are narrower, but they drop or misroute valid Korean memories:

  1. A Hangul name followed directly by a grammatical particle no longer counts as present in the source. isSourceBackedProperName calls sourceContainsWholeName, which requires a non-letter boundary immediately after the name (SOURCE_BACKED_NAME_BOUNDARY_PATTERN = /[\p{L}\p{N}'-]/u, subject-identity.ts:171). Korean attaches particles with no space, so 서무진은 … fails the whole-name test: the trailing 은 is a letter, so the boundary check rejects the match (subject-identity.ts:1973-1976). The name then fails source-presence and the candidate is treated as untrusted, so no character is resolved or provisionally created. English names are unaffected because a space or punctuation separates them.

  2. A 2-syllable Korean short name that is the suffix of a known 3-syllable name is not offered for review. partialNameTokensMatch splits on _/whitespace tokens (subject-identity.ts:1900-1905), so 진욱 ⊂ 도진욱 (written without a space) never reaches the existing partial_name_requires_review flow. It either fails resolution or risks a wrong automatic bind.

Both are identity-resolution gaps, not cosmetic: a Korean character fact can be dropped, or filed under the wrong character, even when the name is plainly present in the source.

Proposed package or change

Long-Term Memory, server-side identity resolution (packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/subject-identity.ts), with Korean regression coverage in tests/long-term-memory-extraction-graph.regression.ts. Phased so each step can land and be validated on its own:

  1. Particle boundary (bug-shaped). When a name ends in Hangul and the following characters are a permitted particle (은/는/이/가/을/를/의/에게/와/과/도/로/한테 …), treat the particle as a boundary so the name still counts as present. The boundary must match a complete permitted suffix, not simply accept any following text that begins with 이, 가, or 로.

  2. Strip a trailing particle from a returned name — but only when the stripped form exactly matches a known, in-scope name; never to create a new character. Some names legitimately end in those syllables (하은, 이수이), so exact full-name matches must win first.

  3. Korean short-name review. A 2-syllable name that is the suffix of a 3-syllable known name (진욱 ⊂ 도진욱) should route to the existing partial_name_requires_review flow, not auto-bind. An independently known character named 진욱 must keep its exact match; keep 선아 and 서나 distinct (no phonetic or romanization-based merging).

  4. Optional: read source-stated id → name pairs (e.g. characters: lines and seo_mujin -> 서무진 maps in the source summary) as aliases for that extraction. This adds another identity hint source and needs explicit conflict handling, so it is deferred behind the steps above.

Explicitly out of scope: don't remove the existing successful Latin-name fallback, and don't change subjectId to carry Hangul — keep Hangul in subjectNames, ASCII in subjectId, and trusted keys as identity.

Why should this be optional?

Long-Term Memory is a downloadable Agent package, not Engine core. Korean name handling is package behavior inside LTM's own extraction, subject-identity and validation pipeline, so it ships through the catalog like any other LTM change; the Engine core is unaffected. This also keeps the change localized to the package's identity resolution rather than adding language-specific logic to shared Engine code.

Alternatives considered

  • Romanize subjectId, then match on it. Rejected: identity must not depend on a romanized id, and romanization can collide (the reporter's own patch normalizes subjectId, which is where the reported issues originated). Exact Hangul name matching already works and should stay the source of identity.
  • Loosen the generic boundary to "name is a prefix of the following text." Rejected: this would wrongly match one name inside a longer name and create false identities. The boundary must accept a complete particle suffix only.
  • Port the reporter's "" → "subject" fallback hardening. Do not port blindly: two different unnormalizable ids could both become "subject" and appear to be siblings, which is unsafe alongside sibling borrowing. An empty sentinel may intentionally mean "no usable identifier".
  • Leave it to the reporter's patch. The patch is third-party, server-side, and outside the official package; the goal here is that Korean users can drop it.

Additional context

  • Follow-up to #1277 (shipped as LTM 1.4.21). That fix added nameless-candidate identity borrowing from a named sibling with the same bucket + subjectId; particle and short-name handling was deliberately split out because it changes which names count as source-backed and therefore which characters can be created.
  • Sibling borrowing cannot recover a Korean name when a particle makes the named sibling fail source-presence first — that happens earlier in the pipeline, which is why step 1 matters on its own.
  • Related verification gap carried from #1277: the added regression borrowed from an already-known catalog character, so borrowing from a character newly discovered in the same extraction is not yet proven independently.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Oct 9, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1291 Originally assigned to: @Promansis on GitHub. ## What problem does this solve? Long-Term Memory cannot reliably resolve Korean character names on stock code, without a third-party server patch. This was surfaced while triaging #1277, where the reporter's environment runs a custom `hangul_subjectid_patch.cjs` that normalizes `subjectId` values and improves Korean name handling. The reporter's guiding principle — **identity comes from trusted names and keys, not from a romanized `subjectId`** — is already how LTM works, and exact Hangul name matching already succeeds. The gaps are narrower, but they drop or misroute valid Korean memories: 1. **A Hangul name followed directly by a grammatical particle no longer counts as present in the source.** `isSourceBackedProperName` calls `sourceContainsWholeName`, which requires a non-letter boundary immediately after the name (`SOURCE_BACKED_NAME_BOUNDARY_PATTERN = /[\p{L}\p{N}'-]/u`, `subject-identity.ts:171`). Korean attaches particles with no space, so `서무진은 …` fails the whole-name test: the trailing `은` is a letter, so the boundary check rejects the match (`subject-identity.ts:1973-1976`). The name then fails source-presence and the candidate is treated as untrusted, so no character is resolved or provisionally created. English names are unaffected because a space or punctuation separates them. 2. **A 2-syllable Korean short name that is the suffix of a known 3-syllable name is not offered for review.** `partialNameTokensMatch` splits on `_`/whitespace tokens (`subject-identity.ts:1900-1905`), so `진욱 ⊂ 도진욱` (written without a space) never reaches the existing `partial_name_requires_review` flow. It either fails resolution or risks a wrong automatic bind. Both are identity-resolution gaps, not cosmetic: a Korean character fact can be dropped, or filed under the wrong character, even when the name is plainly present in the source. ## Proposed package or change Long-Term Memory, server-side identity resolution (`packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/subject-identity.ts`), with Korean regression coverage in `tests/long-term-memory-extraction-graph.regression.ts`. Phased so each step can land and be validated on its own: 1. **Particle boundary (bug-shaped).** When a name ends in Hangul and the following characters are a permitted particle (`은/는/이/가/을/를/의/에게/와/과/도/로/한테` …), treat the particle as a boundary so the name still counts as present. The boundary must match a complete permitted suffix, not simply accept any following text that begins with `이`, `가`, or `로`. 2. **Strip a trailing particle from a returned name** — but only when the stripped form exactly matches a known, in-scope name; never to create a new character. Some names legitimately end in those syllables (하은, 이수이), so exact full-name matches must win first. 3. **Korean short-name review.** A 2-syllable name that is the suffix of a 3-syllable known name (진욱 ⊂ 도진욱) should route to the existing `partial_name_requires_review` flow, not auto-bind. An independently known character named `진욱` must keep its exact match; keep `선아` and `서나` distinct (no phonetic or romanization-based merging). 4. **Optional: read source-stated `id → name` pairs** (e.g. `characters:` lines and `seo_mujin -> 서무진` maps in the source summary) as aliases for that extraction. This adds another identity hint source and needs explicit conflict handling, so it is deferred behind the steps above. Explicitly **out of scope**: don't remove the existing successful Latin-name fallback, and don't change `subjectId` to carry Hangul — keep Hangul in `subjectNames`, ASCII in `subjectId`, and trusted keys as identity. ## Why should this be optional? Long-Term Memory is a downloadable Agent package, not Engine core. Korean name handling is package behavior inside LTM's own extraction, subject-identity and validation pipeline, so it ships through the catalog like any other LTM change; the Engine core is unaffected. This also keeps the change localized to the package's identity resolution rather than adding language-specific logic to shared Engine code. ## Alternatives considered - **Romanize `subjectId`, then match on it.** Rejected: identity must not depend on a romanized id, and romanization can collide (the reporter's own patch normalizes `subjectId`, which is where the reported issues originated). Exact Hangul name matching already works and should stay the source of identity. - **Loosen the generic boundary to "name is a prefix of the following text."** Rejected: this would wrongly match one name inside a longer name and create false identities. The boundary must accept a complete particle suffix only. - **Port the reporter's `"" → "subject"` fallback hardening.** Do not port blindly: two different unnormalizable ids could both become `"subject"` and appear to be siblings, which is unsafe alongside sibling borrowing. An empty sentinel may intentionally mean "no usable identifier". - **Leave it to the reporter's patch.** The patch is third-party, server-side, and outside the official package; the goal here is that Korean users can drop it. ## Additional context - Follow-up to #1277 (shipped as LTM 1.4.21). That fix added nameless-candidate identity borrowing from a named sibling with the same `bucket + subjectId`; particle and short-name handling was deliberately split out because it changes which names count as source-backed and therefore which characters can be created. - Sibling borrowing cannot recover a Korean name when a particle makes the *named* sibling fail source-presence first — that happens earlier in the pipeline, which is why step 1 matters on its own. - Related verification gap carried from #1277: the added regression borrowed from an already-known catalog character, so borrowing from a character newly discovered in the same extraction is not yet proven independently. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:29:29 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Agents#659
No description provided.