Skip to content

sync flattens file extensions in page slugs (docs/auth.md → docs/auth) #1172

@abolnasr

Description

@abolnasr

gbrain sync ingests files and assigns slugs to each
page. The slug strips file extensions:

  • docs/auth.mddocs/auth
  • README.mdreadme
  • _superstack/docs/code-map.md_superstack/docs/code-map
  • src/auth/users.tssrc-auth-users-ts (different
    shape entirely — flattened to dashes)

The TypeScript case is more aggressive: directory
separators become dashes AND the extension becomes part
of the slug (-ts suffix).

This makes slug-pattern filtering brittle. A consumer
wanting "all markdown documentation pages" can't filter
by *.md because the slug doesn't have .md. They have
to either:

  • Filter by negation (-ts, -json, -yaml slug
    suffixes for code/config files)
  • Cross-reference against the page-type column from
    gbrain list (which reports code, note, concept)
  • Detect prose-vs-code by inspecting chunk preview
    content (Superstack's schema-tracker v2 settled on
    this approach)

Expected: slugs preserve the original file
extension, OR the ingested page exposes a mime_type
or extension field queryable via gbrain list.

Suggested fix (least disruptive): add an
extension column to the pages table populated from
the source file. gbrain list could surface it as a
flag; query results could include it in JSON output.
The existing slug shape stays for backwards-
compatibility.

Reproduction:

echo "# Test" > /tmp/test.md
mkdir /tmp/test-project && cp /tmp/test.md /tmp/test-project/
cd /tmp/test-project && git init -q && git add -A && git commit -qm init
gbrain sources add slug-demo --path /tmp/test-project
OPENAI_API_KEY=sk-... gbrain sync --source slug-demo --strategy auto
gbrain list --source slug-demo
# observed: slug is "test", not "test.md"

Severity: low individually; medium when combined
with downstream parsers that need to distinguish prose
from code (which Superstack's gbrain-using subagents do).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions