Skip to content

Rust Library

The Cargo package is brokk-bifrost, and the Rust crate name is brokk_bifrost. It exports the analyzer core, project abstractions, searchtools service, and common result types from src/lib.rs.

Add the released crate with Cargo:

Terminal window
cargo add brokk-bifrost

That produces a dependency like:

[dependencies]
brokk-bifrost = "0.8.3"

For local development against a checkout, use a path dependency:

Terminal window
cargo add brokk-bifrost --path /path/to/bifrost

The package name uses a hyphen, but Rust imports use the crate name with an underscore:

use brokk_bifrost::{AnalyzerConfig, FilesystemProject, WorkspaceAnalyzer};
use std::sync::Arc;
use brokk_bifrost::{AnalyzerConfig, FilesystemProject, WorkspaceAnalyzer};
fn main() -> Result<(), String> {
let project = Arc::new(FilesystemProject::new(".")?);
let workspace = WorkspaceAnalyzer::build(project, AnalyzerConfig::default());
let analyzer = workspace.analyzer();
println!("languages: {:?}", analyzer.languages());
println!("files: {}", analyzer.get_analyzed_files().len());
println!("declarations: {}", analyzer.get_all_declarations().len());
Ok(())
}

The top-level crate re-exports the public analyzer and service types most callers need:

ExportUse
WorkspaceAnalyzerBuild a workspace-backed analyzer with default multi-language routing.
MultiAnalyzerRoute analysis across multiple language analyzers.
IAnalyzerTrait for common analyzer operations.
FilesystemProject, FileSetProject, OverlayProject, MultiRootProjectProject backends for different file-source shapes.
ProjectFile, CodeUnit, DeclarationInfo, Language, RangeCore source and symbol model types.
SearchToolsService, ToolOutputIn-process access to the same tool implementations exposed over MCP.
ImportAnalysisProvider, TypeHierarchyProvider, TypeAliasProvider, TestDetectionProviderOptional analyzer capability traits.

For most embedded code-intelligence workflows, prefer SearchToolsService over manually composing individual analyzer calls. It keeps the tool argument and rendering behavior aligned with MCP and the Python client.

The default Rust build has no optional features enabled.

nlp enables semantic search support. It adds the model download, tokenization, and semantic-index plumbing, while the embedding sidecar selects CUDA, Apple Metal, or CPU at runtime.

python enables the PyO3 extension module used by the Python package. Maturin turns this on automatically through pyproject.toml; ordinary CLI and library builds do not need it.