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:
cd into a git repo whose origin URL is a typical GitHub HTTPS or SSH URL (github.com/<org>/<repo>.git — contains dots)
- Run
~/.claude/skills/gstack/bin/gstack-gbrain-sync.ts --code-only --incremental
- 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)
Summary
/sync-gbrain --code-only(and~/.claude/skills/gstack/bin/gstack-gbrain-sync.ts) generates a source-id that gbrain v0.20+ rejects:Reproduction
cdinto a git repo whoseoriginURL is a typical GitHub HTTPS or SSH URL (github.com/<org>/<repo>.git— contains dots)~/.claude/skills/gstack/bin/gstack-gbrain-sync.ts --code-only --incrementalsources addstepThe generated id
gstack-code-github.com-<org>-<repo>contains:github.com)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:
gstack-code-prefix (saves 12 chars) and slugify only the repo basename, e.g.<repo>or<org>-<repo>truncated.gs-<hash>.--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/wikidirectly (the legacy markdown-import path) bypasses the source-id validation entirely./sync-gbrainis unusable until this is fixed.Environment