Skip to content

/sync-gbrain: generated source-id exceeds gbrain v0.20+ validation (32-char limit, no dots) #1323

@onetechgroupll

Description

@onetechgroupll

Summary

/sync-gbrain --code-only (and ~/.claude/skills/gstack/bin/gstack-gbrain-sync.ts) generates a source-id that gbrain v0.20+ rejects:

ERR  code  source registration failed: gbrain sources add gstack-code-github.com-<org>-<repo> failed:
Invalid source id "gstack-code-github.com-<org>-<repo>".
Must be 1-32 lowercase alnum chars with optional interior hyphens (e.g. "wiki", "yc-media").

Reproduction

  • gstack: v1.26.3.0
  • gbrain: v0.26.7 (from master tip, schema v34)
  • Steps:
    1. cd into a git repo whose origin URL is a typical GitHub HTTPS or SSH URL (github.com/<org>/<repo>.git — contains dots)
    2. Run ~/.claude/skills/gstack/bin/gstack-gbrain-sync.ts --code-only --incremental
    3. Sync errors out at the sources add step

The generated id gstack-code-github.com-<org>-<repo> contains:

  • dots (from github.com)
  • often > 32 chars for normal repo names

Both violate gbrain's source-id rule (^[a-z0-9](?:[a-z0-9-]{0,30}[a-z0-9])?$).

Expected

Generator produces a valid source-id that fits gbrain's contract.

Suggested fix

Either:

  • Drop the gstack-code- prefix (saves 12 chars) and slugify only the repo basename, e.g. <repo> or <org>-<repo> truncated.
  • Or hash the canonical remote URL (e.g. first 12 chars of sha1) and prepend a short literal: gs-<hash>.
  • Or accept input via --source-id <id> so users can override.

The current implementation appears to use the canonicalized remote URL verbatim with - instead of /.:. Replacing . with - makes it valid char-wise but doesn't address the length cap.

Workaround

For now, calling gbrain import .codesight/wiki directly (the legacy markdown-import path) bypasses the source-id validation entirely. /sync-gbrain is unusable until this is fixed.

Environment

  • macOS 26.3 (Darwin 25.4.0)
  • bun 1.3.11
  • Postgres 18.3 (Homebrew)

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