Essential information for AI agents working on the NobodyWho codebase.
NobodyWho is a Rust-based library for running LLMs locally with offline inference. Core features include streaming responses, tool calling, and context management. Built on the llama-cpp-2 crate.
The main implementation is in nobodywho/core/src/:
chat.rs- Chat API with conversation managementllm.rs- Model loading and worker managementencoder.rs- Embeddings generationcrossencoder.rs- Cross-encoder for rerankingmemory.rs- Memory estimationtemplate.rs- Chat template renderingtokenizer.rs- Tokenizer utilitiestool_calling/- Grammar-based tool callingerrors.rs- Error types usingthiserrorsampler_config.rs- Sampling configuration
- Python (
nobodywho/python/) - PyO3/maturin bindings - Godot (
nobodywho/godot/) - GDExtension bindings - Flutter (
nobodywho/flutter/) - FFI bindings viaflutter_rust_bridge
ChatHandle/ChatHandleAsync- Main chat interface (sync and async)ChatBuilder- Builder pattern for chat configurationMessageenum - User/Assistant/System/Tool messagesModel- Shared model instance (Arc<LlamaModel>)Worker- Background task for model inference
Uses thiserror crate for error types. All errors are defined in errors.rs and implement std::error::Error. Common error types include LoadModelError, InitWorkerError, ChatWorkerError.
llama-cpp-2- underlying LLM inference enginetokio- Async runtimeserde/serde_json- Serializationminijinja- Template rendering for chat templatesgbnf- Grammar-based tool callingtracing- Logging framework
Core library:
cd nobodywho
cargo buildPython bindings:
cd nobodywho/python
maturin develop --uv
cargo run --bin make_stubs # Generate type stubsCore tests:
cd nobodywho
export TEST_MODEL=/path/to/model.gguf
cargo test -- --nocapture --test-threads=1Python tests:
cd nobodywho/python
pytest # Also tests markdown documentation code blocks- Linux/WSL: Use Nix flakes (
nix develop) - Windows: Install rustup, cmake, llvm, msvc, and Vulkan SDK
See CONTRIBUTING.md for detailed setup instructions.
- Desktop (all bindings): Windows, Linux, macOS
- Android: Godot and Flutter bindings
- iOS: Flutter binding
- GPU acceleration: Vulkan (x86/x86_64), Metal (macOS/iOS)
Python:
- Use
#[pyclass]for classes and#[pymethods]for methods - See
nobodywho/python/src/lib.rsfor examples
Godot:
- Use
#[derive(GodotClass)]and#[godot_api] - See
nobodywho/godot/src/lib.rsfor examples
Flutter:
- Uses
flutter_rust_bridgefor FFI bindings - See
nobodywho/flutter/rust/src/lib.rsfor examples
- Use
Arc<LlamaModel>for shared model instances - Builder pattern for configuration (
ChatBuilder) - Async support via
tokio(ChatHandleAsync) - Error propagation with
?operator - Tracing for logging (
tracing::info!,tracing::debug!, etc.)
nobodywho/core/src/chat.rs- Main chat APInobodywho/core/src/llm.rs- Model and worker managementnobodywho/core/Cargo.toml- Core dependenciesnobodywho/python/src/lib.rs- Python bindingsnobodywho/godot/src/lib.rs- Godot extensionCONTRIBUTING.md- Development setupREADME.md- User-facing documentation
Documentation is built with Docusaurus and lives in the docs/ folder. It is deployed to docs.nobodywho.ooo via Cloudflare Pages (see .github/workflows/docs.yml).