Skip to content

CLI: add --source filter to query and search commands #784

@jeremyknows

Description

@jeremyknows

Problem

gbrain query and gbrain search return cross-source results with no way to filter by source_id. When a gbrain brain has multiple ingested sources (wiki articles, user diaries, external docs), queries intended for one source surface results from others.

Current workaround

We filter results client-side by maintaining a slug allowlist of wiki article filenames and discarding any gbrain result whose slug is not in the allowlist. This works but requires N+1 filesystem reads and doesn't scale to sources with non-slug-based identifiers.

Requested

A --source <source_id> flag on gbrain query:

gbrain query "how does Atlas route dispatch events" --source wiki --limit 5

And equivalently on gbrain search. The source_id should match the source identifier used in gbrain sync --source <id>.

Context

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