Add your custom rules and team conventions here.
This file is never overwritten by rulebook init or rulebook update.
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Vectorizer is a high-performance vector database and search engine built in Rust, designed for semantic search, document indexing, and AI-powered applications. It provides sub-3ms search times with HNSW indexing, supports multiple embedding models, and offers full Qdrant API compatibility.
- Cargo.toml edition: Must be
"2024"- NEVER change to 2021 or earlier - The codebase uses Edition 2024 features for advanced async patterns
When adding features, implement in this order:
- Core engine first (business logic in
src/db/,src/embedding/) - REST endpoints second (
src/api/) - MCP tools third (
src/server/)
NEVER implement features only in MCP - REST and MCP must have identical functionality.
# Build
cargo build --release
# Build with GPU acceleration (macOS Metal)
cargo build --release --features hive-gpu
# Build with all features
cargo build --release --features full
# Run server (starts REST on :15002 + MCP)
./target/release/vectorizer
cargo run
# Run tests
cargo test
# Run a single test
cargo test test_name
# Run tests in a specific module
cargo test module_name::
# Run tests with output
cargo test -- --nocapture
# Format and lint
cargo fmt
cargo clippy
# Stop server
pkill vectorizer # or Ctrl+C# Build + push hivehub/vectorizer:<tag> with the buildx registry cache
# (see docs/development/docker-builds.md for the full pipeline).
.\scripts\docker\build-push.ps1 -Tag 3.x.y
# Local-only build (host arch, no push); reads the registry cache
# read-only.
.\scripts\docker\build.ps1 -Tag dev
# Cold build (skip cache) — for baseline measurement.
.\scripts\docker\build-push.ps1 -Tag bench-baseline -NoCacheThe container binary is compiled with the dedicated release-docker
Cargo profile (lto = false, codegen-units = 16). The host
cargo build --release flow above is unaffected and continues to use
the workspace release profile (lto = "thin", codegen-units = 4).
Client → REST/MCP → Core Engine → Vector Store
src/api/- HTTP endpoints (Axum-based REST API)src/db/- Core database operations (VectorStore, Collection, HNSW indexing)src/models/- Data models (Vector, CollectionConfig, SearchResult)src/embedding/- Embedding providers (BM25, BERT, MiniLM, TF-IDF)src/server/- MCP server implementationsrc/grpc/- gRPC service (Qdrant-compatible)src/quantization/- Vector quantization (Scalar, Product Quantization)src/persistence/- Storage (MMap, .vecdb format)src/replication/- Master-replica replication (BETA)src/cluster/- Distributed sharding (BETA)src/auth/- JWT + API Key authentication with RBACsrc/cache/- Query cachingsrc/discovery/- File discovery and indexing pipeline
tests/- Integration tests organized by featuretests/api/rest/- REST API integration teststests/api/mcp/- MCP integration teststests/grpc/- gRPC teststests/integration/- Feature integration tests (sharding, clustering, etc.)tests/replication/- Replication tests- Unit tests are colocated in
src/modules
- REST API / Dashboard: http://localhost:15002
- MCP Server: ws://localhost:15002/mcp
- GraphQL: http://localhost:15002/graphql
- Health Check: http://localhost:15002/health
Use thiserror for custom error types with VectorizerError as the main error type. Propagate errors with ? operator.
Arc<RwLock<T>>for shared stateDashMapfor concurrent key-value operationsparking_lotlocks (not std::sync)
All API types derive Serialize, Deserialize from serde. Use #[serde(rename_all = "lowercase")] for enums.
Use tokio runtime. Never use blocking operations (std::thread::sleep) in async code - use tokio::time::sleep.
default = ["hive-gpu", "fastembed"]hive-gpu- GPU acceleration (Metal on macOS)fastembed- Fast embedding models with ONNXfull- All features including real-models, ONNX, Arrow, Parquet, Transmutations2s-tests- Server-to-server tests (requires explicit enable)
config.yml- Runtime configurationworkspace.yml- Workspace/project definitionsconfig.example.yml- Configuration reference