Skip to content

feat(brain): --local returns only the current project's pages - #406

Open
jacklau04 wants to merge 1 commit into
TheWeiHu:mainfrom
jacklau04:fix/brain-search-local
Open

jacklau04 wants to merge 1 commit into
TheWeiHu:mainfrom
jacklau04:fix/brain-search-local

Conversation

@jacklau04

Copy link
Copy Markdown
Contributor

Why

devbrain brain search/query/ask is project-first but always pads the result list with up to two cross-project hits, and there was no way to turn that off. In a project with few pages, or when the nearest neighbour is a large miscellaneous bucket, agents following the standing "query the brain first" instruction read and act on another project's context. --global already exists for the opposite direction; --local is its counterpart.

What

  • --local on search, query and ask drops the cross-project slice in both the gbrain-backed path (prioritizeEngineResults) and the offline fallback (fallbackSearch).
  • devbrain consumes the flag, so it is never forwarded to the engine; --local --global is rejected with exit 1. Default behaviour is unchanged.
  • stripGlobal generalised to stripFlag; README line updated.

How verified

  • New TestBrainSearchLocalFlagEngine (stub engine that exits 2 if it ever sees --local) and TestBrainSearchLocalFlagOffline (two seeded projects, gbrain absent, plus the exclusive-flags case). Both failed before the change — flag forwarded to the engine; flag tokenised as a search term — and pass after.
  • make test (vet, full suite, dashboard node checks) is green.

🤖 Generated with Claude Code

Retrieval is project-first but always pads with up to two cross-project
results, with no way to turn that off. In a project with few pages, or when
the neighbour is a large `miscellaneous` bucket, agents following "query the
brain first" read and act on another project's context.

`--local` on search/query/ask drops the cross-project slice in both the
gbrain-backed path and the offline fallback. devbrain consumes the flag (it
never reaches the engine); `--local --global` is rejected; the default is
unchanged. stripGlobal is generalised to stripFlag.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant