bytesandbrains 0.1.2

A Rust library for decentralized networking and edge AI
Documentation
<p align="center">
  <img src="https://raw.githubusercontent.com/Bytes-Brains/bytesandbrains/main/assets/logo.png" alt="Bytes and Brains" width="200" />
</p>

<h1 align="center">bytesandbrains</h1>

<p align="center">
  A Rust library for decentralized networking and edge AI.
</p>

---

**bytesandbrains** provides composable, transport-agnostic building blocks for peer-to-peer overlay networks and distributed machine learning.

## Workspace

| Crate | Description |
|-------|-------------|
| **[bb-core]bb-core/** | Shared traits and types: `Address`, `PeerId`, `Peer`, `OverlayProtocol`, `PeerSampling`, `Embedding`/`EmbeddingSpace`, and distance metrics (optional SIMD via `simsimd`). |
| **[bb-overlay]bb-overlay/** | Protocol implementations built on `bb-core`. |
| **[bb-codec]bb-codec/** | Product Quantization: `ProductQuantizer`, `PQCode`, distance tables for approximate nearest neighbor search. |
| **[bb-index]bb-index/** | Vector indexing: `FlatIndex` with add/search/remove/train operations. |
| **[bb-ml]bb-ml/** | Machine learning utilities: K-Means clustering. |

## Protocols

### [Gossip Peer Sampling]bb-overlay/src/gossip/README.md

A gossip-based peer sampling service that maintains self-healing, randomized overlay networks. Supports Push, Pull, and PushPull exchange modes with configurable selection strategies.

### [Protean]bb-overlay/src/protean/README.md

A distributed approximate nearest-neighbor search protocol. Combines a gossip-based random overlay with a Sparse Neighbor View (SNV) that uses occlusion-based pruning to organize peers by proximity in embedding space.

### GOSSIP-PQ *(in development)*

A decentralized protocol for learning globally representative Product Quantization codebooks via gossip-based subspace exchange. Enables distributed ANN search without central coordination.

## Feature Flags

Feature flags are configured per-crate. Key flags on `bb-overlay`:

| Flag | Default | Description |
|------|---------|-------------|
| `gossip` | No | Gossip peer sampling protocol |
| `protean` | No | Protean kNN/kFN protocol |
| `proto` | No | Protocol Buffers serialization (via `prost`) |
| `full` | No | All of the above |

## License

GPL-2.0