Skip to content

gbrain put/import always use 'default' source — no way to specify source_id from CLI or per-project config #1222

@aicloud-cpu

Description

@aicloud-cpu

What happened?

gbrain put and gbrain import CLI commands always write to the default source regardless of context. gbrain sync --strategy code creates per-project sources automatically, but any user-imported data (conversations, documents, etc.) is lumped into default.

In a multi-project setup, this means:

  • Code is properly isolated per source (via sync --strategy code)
  • But user-imported data from all projects is mixed in default
  • MCP search with sourceIds filter cannot exclude cross-project conversation data, making source-level isolation ineffective for manually imported content

What did you expect?

gbrain put and gbrain import should support a --source flag to specify the target source:

gbrain put <slug> --content "..." --source my-project
gbrain import <dir> --source my-project

Alternatively, gbrain put could read source_id from the YAML frontmatter of the imported markdown content.

Better yet: support a per-project config file at <project-root>/.gbrain/config.json that overrides the global ~/.gbrain/config.json. Projects can then define their own source_id in this local config, and all put/import/query commands run inside that project directory will automatically use the configured source instead of default. This follows the same pattern as .env / eslintrc — local overrides global.

Steps to reproduce

  1. Run gbrain sync --strategy code . — creates a source like repo-code-xxxx with code pages
  2. Run gbrain put my-page --content "---\ntitle: test\n---\nhello" — page goes to default
  3. Run mcp__gbrain__search with sourceIds: ["repo-code-xxxx"] — still returns default pages
  4. The sourceIds filter cannot exclude cross-project content because user data is all in default

Environment

  • gbrain version: 0.37.0.0
  • OS: Windows 11
  • Bun version: 1.3.14
  • Database: self-hosted PostgreSQL 16 (pgvector)

gbrain doctor --json output

{
  "schema_version": 2,
  "status": "warnings",
  "health_score": 70,
  "checks": [
    {"name": "connection", "status": "ok", "message": "Connected, 500+ pages"},
    {"name": "embedding_provider", "status": "warn", "message": "local model (1024d)"},
    {"name": "schema_version", "status": "ok", "message": "Version 78 (latest: 78)"},
    {"name": "embedding_width_consistency", "status": "ok", "message": "Schema width (1024d) matches embedding_dimensions config"}
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions