Repository navigation
Add offline local-current brain search to the CLI - #656
Closed
futurepaul wants to merge 1 commit into
Closed
futurepaul wants to merge 1 commit into
futurepaul wants to merge 1 commit into
Conversation
This was referenced Oct 29, 2026
Collaborator
Author
|
The rerun of the failed jobs is green. All CI checks now pass: the unrelated chat-layout wait in shard 3 cleared, and brain-search checks plus all four e2e shards pass. |
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #627.
Adds
fragment search <name> '<words>' --dir <folder> [--limit N], with the CLI's normal--jsonenvelope. It reads current working Markdown offline, with no login, brain server, sync pass or watcher. Unsynced edits and local-only files are immediately searchable; deleted files disappear between invocations.The disposable index is SQLite FTS5 in memory, rebuilt on every call. All query words are required prefixes; weighted BM25 ranks title (4), heading (3), path/ancestry (2) and body (1). Results identify fragment, path, title, heading, ancestry, excerpt and
synced,local_onlyorconflictedstate. Sync records divergence in an optional journal field so an unsuccessful remote-copy write cannot make adopted local bytes appear agreed. Existing conflict copies and merge markers also warn; remote copies are not separate truth-bearing hits.Validation:
cargo test -p fragment-cli --offline: CLI unit tests and real-binary integration tests, including offline same-size edits, local additions, deletion/restart, journal and sibling-copy conflicts, merge markers, ranking/prefixes, limits, skipped files, invalid input and symlink exclusion.cargo xtask check: JavaScript syntax/guards, schema lock, workspace tests, host and Wasm Clippy with warnings denied.git diff --check.Caveats:
syncedmeans matching the last local journal, not a fresh remote/published-content check. Each call reads all eligible pages; concurrent edits are not an atomic filesystem snapshot. Sync's ignore rules apply. Pages >=1 MiB, non-UTF-8 content and sections beyond the first 500 are reported as skipped. The CommonMark parser includes Setext headings, scalar frontmatter and inline tags; multiline YAML tags are not interpreted, and long sections split at 8000 Unicode characters. Older journals cannot identify a conflict whose remote copy was never saved. Full command/output and conflict semantics are documented in the CLI guide and brain README.Scoped to local lexical search: no embeddings, services, path ACLs, collections, cell API changes or deployment.