Skip to content

Doc-extraction prompt's node-ID rule contradicts graphify/ids.py for non-ASCII paths #3103

Closed

Description

@cw-skykchmin

graphify/ids.py normalizes IDs with re.sub(r"[^\w]+", "_", s, flags=re.UNICODE), so CJK / Cyrillic / accented-Latin letters survive. The module docstring states this explicitly and lists #811 (Unicode collapse) as already fixed.

The bundled skill's doc-extraction prompt (skills/*/references/extraction-spec.md) tells the subagent something different:

  • "Node ID format: lowercase, only [a-z0-9_]"
  • "each segment lowercased with non-alphanumeric chars replaced by _"

A subagent following that text maps every non-ASCII character to _, so only segment lengths survive.

Repro

Any corpus with non-ASCII directory or file names. Three distinct files:

docs/한국어/개념/가나다라마.md
docs/한국어/개념/바사아자차.md
docs/日本語/概念/あいうえお.md
  • engine (extract_markdown -> make_id): docs_한국어_개념_가나다라마, docs_한국어_개념_바사아자차, docs_日本語_概念_あいうえお
  • subagent following the prompt: docs______________doc for all three

Consequences

  1. _doc_twin_remap pairs <slug>_doc with <slug> by exact string match, so the LLM node and the engine node for the same file never pair. The file ends up as two disconnected nodes — the split md quick-scan and semantic extraction mint duplicate document nodes for the same file: bare slug vs slug_doc #1799 exists to prevent.
  2. Distinct files collapse onto one ID when their non-ASCII segments have equal character counts at the same positions, and one node silently overwrites the other on merge. No error is raised.

Expected: distinct source files receive distinct node IDs, and the LLM's IDs agree with ids.py.

Suggested fix

State the charset in the prompt as \w under Unicode semantics and drop the "only [a-z0-9_]" wording, so the three producers named in the ids.py docstring agree.

Verified on 0.9.46 and 0.9.50 — references/*.md are byte-identical between the two, so the wording is unchanged in the current release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions