feat(brain): harden RAG index for bot consumption - #38
Merged
Conversation
Fix ten RAG-quality issues flagged during senior AI engineering review so golemcore-brain is safe to use as the retrieval backend for the bot. - Track stored embedding model id and force a full rebuild when the configured model changes; gate `embeddingsReady` on model match so callers see "not ready" instead of mixed-model vectors. - Guard cosine similarity against dimension mismatches in both SQLite and in-memory adapters — fail loudly instead of returning garbage. - Rewrite chunking to pack whole paragraphs under a 2500/300 budget with char-slice fallback for overlong paragraphs. - Prepend document title to every chunk's embed input while keeping raw chunk text in the stored excerpt. - Fuse dense and lexical hits via reciprocal rank fusion (k=60) in `semanticSearch`, with 2x overfetch to leave a rerank seam. - Make the search limit caller-controlled, resolve the embedding model once per sync, and keep partial embed-batch results instead of dropping the whole change set on a short response. - Document the single-thread indexing executor contract on `scheduleSynchronize`. Covered by TDD red→green cycles; full suite green (92 tests). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds page patch/tx operations, graph endpoints, access tracking with orphan-GC, and frontend user menu refinements. Extends test coverage for the new WikiApplicationService and filesystem access-stats adapter. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Collapse switch-assign into switch-expression for patch reason - Drop unused imports/local in WikiControllerTxTest - Rename MutableClock.instant field to avoid method-name collision - Use try-with-resources for ExecutorService and narrow catch to Exception Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
Hardens golemcore-brain as a retrieval and integration backend: one public search API, explicit reindex operations, safer embedding-index lifecycle, broader automated coverage, and stricter quality gates copied from golemcore-bot without enabling Sonar.
What Changed
POST /api/spaces/{slug}/searchcontract.auto,fts, andhybrid; removed the oldsemanticandlexicalaliases so clients use explicit mode names.POST /api/admin/spaces/{slug}/reindexPOST /api/admin/spaces/reindexREADME.mdas a table, excluding internal LLM/user-management APIs.Test Coverage