Skip to main content

Crate brainwires_rag

Crate brainwires_rag 

Source
Expand description

brainwires-rag — codebase indexing + hybrid retrieval (vector + BM25) for the Brainwires Agent Framework.

Standalone so its dep weight (lancedb, tantivy, git2, tree-sitter + 12 grammars, rmcp, rayon, …) doesn’t fall on consumers that only want brainwires-knowledge (BKS/PKS/brain client) or brainwires-prompting.

§Public surface

  • ragRagClient, indexer, hybrid query, embedding wiring, document chunking, Git history search.

Two internal subdomains travel with this crate:

  • spectral — log-determinant diversity reranking + cross-encoder reranking. Pure ndarray math; only consumed by rag::client::reranking.
  • code_analysis — AST-based symbol/definition/reference graphs; only consumed by rag::client::code_analysis.

Both are kept in this crate (rather than separate crates) because they have no external consumers and their public API would otherwise need to be invented just for the split.

Re-exports§

pub use rag::client::RagClient;
pub use rag::config::Config;
pub use rag::error::RagError;
pub use rag::types::AdvancedSearchRequest;
pub use rag::types::ClearRequest;
pub use rag::types::ClearResponse;
pub use rag::types::EnsembleRequest;
pub use rag::types::EnsembleResponse;
pub use rag::types::FindDefinitionRequest;
pub use rag::types::FindReferencesRequest;
pub use rag::types::GetCallGraphRequest;
pub use rag::types::GitSearchResult;
pub use rag::types::IndexRequest;
pub use rag::types::IndexResponse;
pub use rag::types::IndexingMode;
pub use rag::types::LanguageStats;
pub use rag::types::QueryRequest;
pub use rag::types::QueryResponse;
pub use rag::types::SearchGitHistoryRequest;
pub use rag::types::SearchGitHistoryResponse;
pub use rag::types::SearchStrategy;
pub use rag::types::StatisticsRequest;
pub use rag::types::StatisticsResponse;
pub use rag::types::FindDefinitionResponse;
pub use rag::types::FindReferencesResponse;
pub use rag::types::GetCallGraphResponse;
pub use spectral::CrossEncoderConfig;
pub use spectral::CrossEncoderReranker;
pub use spectral::DiversityReranker;
pub use spectral::RerankerKind;
pub use spectral::SpectralReranker;
pub use spectral::SpectralSelectConfig;
pub use code_analysis::types::CallEdge;
pub use code_analysis::types::CallGraphNode;
pub use code_analysis::types::Definition;
pub use code_analysis::types::Reference;
pub use code_analysis::types::ReferenceKind;
pub use code_analysis::types::SymbolId;
pub use code_analysis::types::SymbolKind;
pub use code_analysis::types::Visibility;

Modules§

code_analysis
Code relationships module for definition/reference tracking and call graphs.
rag
RAG — Codebase Indexing and Semantic Search
spectral
MSS-inspired spectral subset selection for diverse RAG retrieval.