Skip to content

KG object field too restrictive: sanitize_name rejects commas and common punctuation #455

@TheusFire

Description

@TheusFire

Problem

When adding knowledge graph triples via , the field is validated using which enforces a strict character set (). This rejects commas, colons, parentheses, and other common punctuation that naturally appears in descriptive KG objects.

Example that fails:

Workaround: Split into one-fact-per-triple. This works but is clunky for descriptive facts and inflates triple counts.

Root cause

In line ~429, all three KG fields use :

Subject and predicate are structural (entity IDs, relationship types) — strict validation makes sense. But the object field is often descriptive text, not a path component or entity name.

Suggested fix

Use (with a max_length cap) for the field instead of :

This preserves security (null byte and length checks) while allowing natural text in KG object values. The underlying SQLite storage uses parameterized queries so there is no injection risk.

Additional suggestion: bulk KG import

When seeding a knowledge graph from scratch (e.g. mapping a family structure and project states), adding 60+ triples one-at-a-time is slow. A tool that accepts an array of triples would significantly improve the onboarding experience.


Discovered while seeding a KG with family/project data as a daily-use archivist. Happy to PR either fix if welcome. Great tool — using it daily with autonomous cron sessions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/kgKnowledge grapharea/mcpMCP server and toolsbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions