vecboost 0.3.0-rc.1

High-performance embedding vector service written in Rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
<div align="center">

<img src="docs/image/vecboost.png" alt="VecBoost Logo" width="200"/>

[![Rust 2024](https://img.shields.io/badge/Rust-2024-edded?logo=rust&style=for-the-badge)](https://www.rust-lang.org/) [![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-blue.svg?style=for-the-badge)](https://www.apache.org/licenses/LICENSE-2.0) [![GitHub release](https://img.shields.io/github/v/release/Kirky-X/vecboost?style=for-the-badge)](https://github.com/Kirky-X/vecboost/releases) [![Rustc 1.91+](https://img.shields.io/badge/Rustc-1.91+-orange.svg?style=for-the-badge)](https://www.rust-lang.org/)

[ไธญๆ–‡](README.md) | **English**

**A high-performance, production-grade embedding vector service written in Rust. VecBoost provides efficient text vectorization with multiple inference engines, GPU acceleration, and enterprise-grade features.**

[โœจ Features](#features) โ€ข [๐Ÿš€ Quick Start](#quick-start) โ€ข [๐Ÿ“š Documentation](#documentation) โ€ข [๐Ÿ’ป Examples](#examples) โ€ข [๐Ÿค Contributing](#contributing)

</div>

---

<div align="center">

### ๐ŸŽฏ Write the API Once, Get Four Protocols

Interface handlers are written just once; `sdforge` macros generate all four protocol bindings at compile time โ€” the compiler does the rest.

<table style="width:100%; border-collapse: collapse">
<tr>
<td align="center" width="25%">๐ŸŒ<br><b>REST</b><br><span style="color:#64748B">Web clients ยท On by default</span></td>
<td align="center" width="25%">๐Ÿ“ก<br><b>gRPC</b><br><span style="color:#64748B">Microservices ยท Type-safe</span></td>
<td align="center" width="25%">๐Ÿค–<br><b>MCP</b><br><span style="color:#64748B">LLM tools ยท stdio transport</span></td>
<td align="center" width="25%">๐Ÿ’ป<br><b>CLI</b><br><span style="color:#64748B">Scripting ยท Quick checks</span></td>
</tr>
</table>

</div>

---

## ๐Ÿ“‹ Table of Contents

- [โœจ Features](#features)
- [๐Ÿš€ Quick Start](#quick-start)
- [๐Ÿ”Œ API Usage](#api-usage)
- [โš™๏ธ Configuration](#configuration)
- [๐Ÿ“š Documentation](#documentation)
- [๐Ÿ’ป Examples](#examples)
- [๐Ÿ—๏ธ Architecture](#architecture)
- [๐Ÿงช Testing](#testing)
- [๐Ÿ“Š Performance](#performance)
- [๐Ÿ”’ Security](#security)
- [๐Ÿ—บ๏ธ Roadmap](#roadmap)
- [๐Ÿค Contributing](#contributing)
- [๐Ÿ“‹ Changelog](#changelog)
- [๐Ÿ“„ License](#license)
- [๐Ÿ™ Acknowledgements](#acknowledgements)
- [๐Ÿ“ž Contact & Support](#contact--support)
- [โญ Star History](#star-history)

---

## โœจ Features

<table style="width:100%; border-collapse: collapse">
<tr>
<td width="50%" style="vertical-align:top; padding: 12px">๐Ÿš€ <b>High Performance</b><br><span style="color:#64748B">Optimized Rust codebase with batching and concurrent request processing; jemalloc global allocator enabled by default on Linux</span></td>
<td width="50%" style="vertical-align:top; padding: 12px">๐Ÿ”ง <b>Multiple Engines</b><br><span style="color:#64748B"><code>Candle</code> (native Rust) and <code>ONNX Runtime</code> inference engines, switchable via <code>EngineFactory</code></span></td>
</tr>
<tr>
<td width="50%" style="vertical-align:top; padding: 12px">๐Ÿ” <b>Rerank</b><br><span style="color:#64748B">Bi-encoder based document reranking over HTTP/gRPC/CLI</span></td>
<td width="50%" style="vertical-align:top; padding: 12px">๐ŸŒ <b>Internationalization (i18n)</b><br><span style="color:#64748B">ICU+Fluent bilingual (English/Chinese) error responses with <code>Accept-Language</code> per-request negotiation</span></td>
</tr>
<tr>
<td width="50%" style="vertical-align:top; padding: 12px">๐ŸŽฎ <b>GPU Acceleration</b><br><span style="color:#64748B">Native NVIDIA CUDA and Apple Metal support; opt-in <code>mkl</code>/<code>accelerate</code> CPU backends</span></td>
<td width="50%" style="vertical-align:top; padding: 12px">๐ŸŒ <b>Multi-Protocol Interface</b><br><span style="color:#64748B">HTTP/REST, gRPC, MCP, and CLI generated from a single source by <code>sdforge</code></span></td>
</tr>
<tr>
<td width="50%" style="vertical-align:top; padding: 12px">๐Ÿงฉ <b>7-Library Ecosystem</b><br><span style="color:#64748B">Modular ecosystem: <code>trait-kit</code>/<code>confers</code>/<code>inklog</code>/<code>oxcache</code>/<code>limiteron</code>/<code>dbnexus</code>/<code>sdforge</code></span></td>
<td width="50%" style="vertical-align:top; padding: 12px">๐Ÿ“Š <b>Smart Caching</b><br><span style="color:#64748B">High-performance caching via <code>oxcache</code> (LRU/LFU/FIFO + TTL) and three-stage semantic cache lookups</span></td>
</tr>
<tr>
<td width="50%" style="vertical-align:top; padding: 12px">๐Ÿ” <b>Enterprise Security</b><br><span style="color:#64748B">JWT authentication, CSRF protection, role-based access control, TOTP, account lockout, and audit logging</span></td>
<td width="50%" style="vertical-align:top; padding: 12px">โšก <b>Rate Limiting</b><br><span style="color:#64748B">Token-bucket rate limiting via <code>limiteron</code> (global/IP/user/API-key dimensions)</span></td>
</tr>
<tr>
<td width="50%" style="vertical-align:top; padding: 12px">๐Ÿ“ˆ <b>Priority Queue</b><br><span style="color:#64748B">Configurable request priorities, weighted fair scheduling, and time-window dynamic batching</span></td>
<td width="50%" style="vertical-align:top; padding: 12px">๐ŸงŠ <b>Matryoshka Support</b><br><span style="color:#64748B">Dynamic dimensionality reduction (auto re-normalization after truncation) for smaller, faster embeddings (OpenAI-compatible)</span></td>
</tr>
<tr>
<td width="50%" style="vertical-align:top; padding: 12px">๐Ÿ” <b>Observability</b><br><span style="color:#64748B">Prometheus metrics, health checks, structured logging (inklog console + file rotation)</span></td>
<td width="50%" style="vertical-align:top; padding: 12px">๐Ÿ“ฆ <b>Cloud-Native Deployment</b><br><span style="color:#64748B">Multi-arch Docker images (linux/amd64 + arm64); Kubernetes deployment guidance (manifests bring-your-own)</span></td>
</tr>
</table>

In addition to the core capabilities above, an OpenAI-compatible endpoint (`POST /v1/embeddings`, with `encoding_format=base64` support), BF16 inference and SIMD vector similarity, GPU memory paging, read-only `vecboost doctor` diagnostics, Library SDK integration (library mode), and the `config_full.toml` / `config_minimal.toml` config presets are also available; see [๐Ÿ”Œ API Usage](#api-usage) for endpoint details and [โš™๏ธ Configuration](#configuration) for configuration options.

---

## ๐Ÿš€ Quick Start

### ๐Ÿ“ฆ Installation

Prerequisites:

| Dependency | Version | Notes |
|--------|------|------|
| **Rust** | 1.91+ | edition 2024 (`rust-version` in `Cargo.toml` is authoritative) |
| **Cargo** | 1.91+ | ships with Rust |
| **CUDA Toolkit** | 12.x | optional, NVIDIA GPU support (`cuda` feature) |
| **Metal SDK** | latest | optional, Apple Silicon GPU support (`metal` feature) |
| **protobuf-compiler** | latest | optional, required for gRPC E2E tests |

> **๐Ÿ’ก Tip**: run `rustc --version` to verify your Rust installation.

```bash
# 1. Clone the repository
git clone https://github.com/Kirky-X/vecboost.git
cd vecboost

# 2. Default build (http feature, includes OpenAPI docs)
cargo build --release

# 3. Build with GPU support
#    Linux (CUDA):
cargo build --release --features cuda
#    macOS (Metal):
cargo build --release --features metal

# 4. Build multi-protocol interfaces (HTTP + gRPC + CLI)
cargo build --release --features grpc,cli

# 5. Build the MCP interface (stdio mode, start with --mcp)
cargo build --release --features mcp

# 6. Build the CI full-feature combination (database + auth + ONNX + OpenAPI + all protocols)
cargo build --release --features grpc,cli,auth,onnx,db,openapi,mcp
```

Minimal build: `cargo build --no-default-features --features http`.

Configure and run:

```bash
# Copy and customize the config (defaults to config/config.toml)
cp config/config.toml config/config_custom.toml
# Edit config/config_custom.toml

# Run with the default config
./target/release/vecboost

# Run with a custom config (--config; in CLI subcommand mode it must precede the subcommand)
./target/release/vecboost --config config/config_custom.toml
```

> **โœ… Success**: the service starts at `http://127.0.0.1:9002` by default (secure default: loopback only).

> **๐Ÿณ Docker**: `docker build -t vecboost:latest .`, then run with `config/` and `models/` mounted; Docker Compose and Kubernetes deployment are covered in the [๐Ÿ“– User Guide ยท Docker deployment](docs/USER_GUIDE.md#docker-้ƒจ็ฝฒ).

### ๐Ÿ’ก Minimal Example

The following example is adapted from [`examples/http/embed_api.rs`](examples/http/embed_api.rs) and generates embeddings over HTTP (full endpoints in the [๐Ÿ“˜ API Reference](docs/API_REFERENCE.md)):

```bash
curl -X POST http://localhost:9002/api/1/embed \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello, world!"}'
```

Response:

```json
{
  "embedding": [0.123, 0.456, 0.789, ...],
  "dimension": 1024,
  "processing_time_ms": 15.5
}
```

You can also use the CLI (`cli` feature) or the library SDK (library mode):

```bash
# Single-text embedding
cargo run --features cli -- embed --text "Hello, world!"
```

### ๐Ÿงญ Core Concepts

- **Models & engines**: `ModelConfig` declares a HuggingFace model (default `BAAI/bge-small-en-v1.5`); `EngineFactory::create(engine_type, config)` creates a `Candle` (default) or `ONNX` (`onnx` feature) engine; Bert / XlmRoberta architectures and mean/cls/max pooling are supported.
- **Four protocols, one source**: handlers in `src/api/embedding.rs` are annotated with `#[forge(...)]` macros; `sdforge` generates the HTTP/gRPC/MCP/CLI bindings. Hand-written protocol code is forbidden.
- **7-library ecosystem**: `trait-kit` wires all modules through a typestate module registry (`Kit<Unbuilt> โ†’ Kit<Ready>`); `confers` owns configuration, `inklog` logging, `oxcache` caching, `limiteron` rate limiting, `dbnexus` persistence (`db` feature), and `sdforge` interface generation.
- **Configuration precedence**: TOML file + `VECBOOST_`-prefixed environment variable overrides (secrets such as `VECBOOST_JWT_SECRET` / `VECBOOST_ADMIN_PASSWORD` must be provided via env vars); config file changes are validated and logged, taking effect after restart.
- **Feature gating**: every optional capability is an independent feature (see [๐Ÿท๏ธ Feature Flags](#feature-flags)); the minimal build contains only the HTTP server.

---

## ๐Ÿ”Œ API Usage

VecBoost generates its four protocol interfaces from the single source `src/api/embedding.rs` via `sdforge`. All endpoints, parameters, request/response examples, the gRPC method table, and message types are documented in the [๐Ÿ“˜ API Reference](docs/API_REFERENCE.md); summary:

- **HTTP/REST**: `/api/1/*` provides embedding (single / batch / file), similarity, semantic search, rerank, model management, and health endpoints;
- **OpenAI-compatible**: `POST /v1/embeddings`, responding in the OpenAI format (`object` / `data` / `usage`) with `encoding_format=base64` support;
- **Matryoshka dimensionality reduction**: pass `dimensions` (256/512/1024, etc.) to `/v1/embeddings` for smaller, faster vectors; truncated vectors are automatically L2 re-normalized to keep cosine similarity correct;
- **gRPC**: with the `grpc` feature, 13 `vecboost.*` methods are exposed on port 50051 (configurable) over the sdforge unified Call protocol โ€” no hand-written proto โ€” with JWT auth, rate limiting, max connections, and timeouts all configurable;
- **MCP**: the `mcp` feature exposes the `embed` / `embed_batch` / `similarity` / `list_models` tools to LLMs over stdio (`vecboost --mcp`);
- **CLI**: the `cli` feature provides the embed / embed_batch / compute_similarity / search / rerank subcommands (see [๐Ÿ’ก Minimal Example](#minimal-example));
- **Inference engines**: Candle (native Rust, default) and ONNX Runtime (`onnx` feature), switched via the `EngineFactory::create` factory;
- **Observability & operations**: `/metrics` (Prometheus), `/health` (liveness) and `/health?depth=full` (real readiness probe), `/api-docs` (Swagger UI); read-only diagnostics with `vecboost doctor` (config / tokenizer / cache / threads / GPU / model integrity; exit code 1 on FAIL).

Interactive OpenAPI docs: `http://localhost:9002/api-docs` (Swagger UI) and `/api-docs/openapi.json` (spec JSON, requires the `openapi` feature; ReDoc is deferred to v0.3.0). Stage-level metrics (batching / dedup / per-stage latency) are in the [โšก Performance Guide ยท New metrics](docs/PERFORMANCE.md#ๆ–ฐๅขžๆŒ‡ๆ ‡).

### ๐Ÿท๏ธ Feature Flags

The table below maps one-to-one to the `[features]` section of `Cargo.toml`; `default = ["http"]`.

| Feature | Default | Description |
|---------|------|------|
| `http` | โœ… | HTTP/REST API + OpenAPI docs + Prometheus metrics |
| `grpc` | - | gRPC server (generated by sdforge `#[forge(grpc_method)]`) |
| `cli` | - | CLI tool |
| `mcp` | - | MCP protocol interface (LLM tool integration, stdio mode) |
| `openapi` | - | OpenAPI/Swagger UI docs (independent of `http`) |
| `schema` | - | OpenAPI schema derive (auto-enabled by `http`/`openapi`; for library-mode type export) |
| `db` | - | dbnexus database persistence (SQLite) |
| `postgres` | - | PostgreSQL support (implies `db`) |
| `auth` | - | JWT auth + CSRF + RBAC + AES-256-GCM encryption |
| `cuda` | - | NVIDIA CUDA GPU acceleration |
| `metal` | - | Apple Silicon Metal GPU |
| `onnx` | - | ONNX Runtime engine |
| `mkl` | - | x86_64 CPU MKL acceleration backend (opt-in; requires a toolchain that links cleanly) |
| `accelerate` | - | aarch64 macOS Accelerate backend (opt-in) |
| `quantized-gguf` | - | GGUF quantization engine switch (inference backend pending upstream candle support) |

> **๐Ÿ“ฆ Built-in dependencies**: `confers` (config), `inklog` (logging), `oxcache` (cache), `limiteron` (rate limiting), and `trait-kit` (module registry) are mandatory dependencies that are always enabled โ€” no feature flag needed. `sdforge` is enabled by any protocol feature (`http`/`grpc`/`cli`/`mcp`).

---

## โš™๏ธ Configuration

The default config path is `config/config.toml` (`--config <path>` selects another; a missing explicit path fails fast with exit code 2; the repo ships `config_full.toml` / `config_minimal.toml` presets). Environment variables with the `VECBOOST_` prefix override the config file, and secrets (`VECBOOST_JWT_SECRET` / `VECBOOST_ADMIN_PASSWORD`) must be provided via env vars; config file changes are validated and logged, taking effect after restart.

Per-key options and defaults for every config section (server / model / embedding / rerank / monitoring / auth / rate_limit / audit / database / logging / pipeline.worker / semantic_cache / device), the full environment-variable table, and a complete example config are documented in the [๐Ÿ“– User Guide ยท Configuration](docs/USER_GUIDE.md#้…็ฝฎ); you can also read [`config/config.toml`](config/config.toml) directly.

> **โš ๏ธ Note**: the `[flow_control]` and `[cache]` TOML sections are not parsed in the current version (legacy section names); rate limiting uses `[rate_limit]`, caching uses `[embedding]` and `[semantic_cache]`. See the [โ“ FAQ](docs/FAQ.md#้…็ฝฎไธŽ้ƒจ็ฝฒ).

---

## ๐Ÿ“š Documentation

| Document | Description |
|------|------|
| [๐Ÿ“– User Guide](docs/USER_GUIDE.md) | Complete tutorial from installation to advanced usage (incl. deployment) |
| [๐Ÿ“˜ API Reference](docs/API_REFERENCE.md) | Full REST / gRPC / OpenAI-compatible interface documentation |
| [๐Ÿ—๏ธ Architecture](docs/ARCHITECTURE.md) | Design principles, module layout, and data flow |
| [โšก Performance Guide](docs/PERFORMANCE.md) | Benchmark data, tuning-switch registry, and experiment discipline |
| [๐Ÿ”’ Security](docs/SECURITY.md) | Security design, supported versions, and vulnerability reporting |
| [โ“ FAQ](docs/FAQ.md) | Frequently asked questions |
| [๐Ÿงช Test Scenarios](docs/TEST_SCENARIOS.md) | Test-stack responsibilities and the scenario matrix |
| [๐Ÿ“‹ Changelog](docs/CHANGELOG.md) | Release-by-release change log |
| [๐Ÿค Contributing](docs/CONTRIBUTING.md) | How to contribute |
| [๐Ÿ“ˆ Benchmark archive](docs/benchmarks/) | Historical benchmark data (similarity / batch scheduling / semantic cache / GPU pipeline) |
| [๐ŸŒ I18N missing-key audit](docs/I18N_MISSING_AUDIT.md) | Internationalization audit record |

---

## ๐Ÿ’ป Examples

All examples live in [`examples/`](examples/), an independent workspace-member crate `vecboost-examples` (13 categories, 30 runnable binaries) covering basic embedding, HTTP/CLI calls, engine switching, auth, caching, rate limiting, monitoring, audit, semantic cache, and Library SDK integration; the per-category listing is in [`examples/README.md`](examples/README.md).

```bash
# Run a single example
cargo run -p vecboost-examples --bin embed
cargo run -p vecboost-examples --bin library_usage
cargo run -p vecboost-examples --bin matryoshka

# ONNX engine example (requires ONNX Runtime)
cargo run -p vecboost-examples --bin onnx --features onnx
```

---

## ๐Ÿ—๏ธ Architecture

VecBoost uses a modular ecosystem architecture: `trait-kit` wires 17 modules through a typestate module registry (`Kit<Unbuilt> โ†’ Kit<Ready>`), `sdforge` generates the four protocol bindings from the single source `src/api/embedding.rs`, inference is abstracted behind `EngineFactory` to the Candle / ONNX engines, and requests flow through a priority queue and time-window batching into the inference pipeline.

The 7-library ecosystem (trait-kit / confers / inklog / oxcache / limiteron / dbnexus / sdforge) versions and responsibilities, the module dependency graph, data flow, and the cache / security / deployment architecture and extension points are documented in the [๐Ÿ—๏ธ Architecture document](docs/ARCHITECTURE.md).

---

## ๐Ÿงช Testing

### ๐ŸŽฏ Testing Strategy

The test stack has six layers: inline unit tests in `src/`, integration tests in `tests/integration/`, specialized integration tests (doctor / gRPC E2E / model snapshot regression / quantization quality gate / SDK matrix), real-service scenario tests in `tests/scenario/*.py` (15 pytest suites), performance regression thresholds in `tests/perf/`, and 4 Criterion microbenchmark suites in `benches/`. The `TEST_MODE` environment variable controls the test engine (`mock` default / `light` / `full`). Layer responsibilities, the exhaustive scenario matrix, and the CI workflow mapping are in [๐Ÿงช Test Scenarios](docs/TEST_SCENARIOS.md).

### โ–ถ๏ธ Commands (identical to CI)

The commands below are extracted from `.github/workflows/health-check.yml` (CI), `feature-matrix.yml`, `scenario-tests.yml`, and `docs/CONTRIBUTING.md`. Path-dependency note: the `../base/*` ecosystem libraries are living path dependencies, so local gate commands must be scoped with `-p vecboost -p vecboost-examples`.

```bash
# Format and lint gates (CI treats clippy unwrap_used as the production panic-surface gate)
cargo fmt --all -- --check
cargo clippy --features "grpc,cli,auth,onnx,db,openapi,mcp" --all-targets -- -D warnings -W clippy::unwrap_used

# Full-feature compile check (feature-matrix)
cargo check --features "grpc,cli,auth,onnx,db,openapi,mcp"

# Unit + integration tests (CI runs --lib and --tests separately)
cargo test --features "grpc,cli,auth,onnx,db,openapi,mcp" --lib
cargo test --features "grpc,cli,auth,onnx,db,openapi,mcp" --tests

# gRPC E2E (spawns the real binary)
cargo test -p vecboost --features http,grpc --test grpc_e2e

# Scenario tests (pytest; conftest spawns real servers; inference cases auto-SKIP without models/)
cargo build -p vecboost --features http
pytest tests/scenario -q --junitxml=scenario-results.xml

# Python performance tests (sim marker separates simulator cases)
pytest tests/perf -m "not sim"   # real-service cases only
pytest tests/perf -m sim          # simulator cases only

# Coverage (CI hard gate: line coverage >= 80%, tarpaulin)
cargo tarpaulin --features "grpc,cli,auth,onnx,db,openapi,mcp" --all-targets --out lcov --out xml --output-dir coverage/

# Benchmarks (CI benchmark job)
cargo bench --features "grpc,cli,auth,onnx,db,openapi,mcp"

# Documentation build and broken-link check
cargo doc --workspace --no-deps

# Dependency security audit
cargo audit
```

### ๐Ÿ“Š Test Scale

As of the v0.2.1 workspace: ~1700+ inline unit tests in `src/`, 61 Rust integration/specialized tests (`tests/*.rs`), 126 Python scenario/performance cases (15 scenario suites), and 4 Criterion microbenchmark suites; the CI hard gate is line coverage no lower than 80% (tarpaulin), and Python scenario tests run as a nightly scheduled job (UTC 03:00) that does not block PRs. Per-item statistics and the scenario matrix are in [๐Ÿงช Test Scenarios](docs/TEST_SCENARIOS.md).

---

## ๐Ÿ“Š Performance

Benchmark data comes from the measured `docs/benchmarks/` archive (criterion, collected 2026-08 on Linux x86_64, noise roughly ยฑ5-10%): SIMD vector similarity is up to **3.06x** faster than the scalar baseline (~341.7 ns for 1024-dim cosine), `ContinuousBatchLoop` continuous batch scheduling is **5.6x** faster than fixed waiting (1.110 s vs 6.194 s for a 100-request steady load), and exact semantic-cache hits take ~10 ns; the throughput baseline (`embed_throughput_bench`) requires a local model and is **to be measured**. The full benchmark tables, performance design highlights (time-window batching / in-batch dedup / SIMD / thread tuning / jemalloc), GGUF quantization, and the tuning-switch registry are in the [โšก Performance Guide](docs/PERFORMANCE.md); microbenchmarks can be reproduced with `cargo bench` (see the [Testing](#testing) section above).

---

## ๐Ÿ”’ Security

### ๐Ÿ›ก๏ธ Security Design

VecBoost is secure by default: the factory config binds to loopback only, and non-loopback binding with `auth.enabled=false` refuses to start (the `VECBOOST_ALLOW_INSECURE=1` escape hatch logs an ERROR); authentication and authorization build on garrison (JWT + CSRF + RBAC admin role + TOTP + account lockout), plus XFF trust inversion, file-path allowed roots, input length limits, AES-256-GCM config encryption, audit logging, and i18n bilingual error masking. Mechanism-level details are in the [๐Ÿ”’ Security document](docs/SECURITY.md).

### โ›“๏ธ Supply Chain & Gates

`cargo audit`, `cargo deny check`, CodeQL, Trivy/Checkov image scanning, gitleaks secret scanning, and pre-commit hooks run both in CI and locally; the full list and triage policy are in the [๐Ÿ”’ Security document ยท Supply chain & gates](docs/SECURITY.md#ไพ›ๅบ”้“พไธŽๅฎ‰ๅ…จ้—จ็ฆ).

### ๐Ÿšจ Reporting a Vulnerability

Please do not report security vulnerabilities through public issues; contact the maintainer at <kirky-x@outlook.com>. Dependency advisories are gated by CI `cargo-audit`. For the full policy and supported versions, see [SECURITY.md](docs/SECURITY.md).

---

## ๐Ÿ—บ๏ธ Roadmap

<table style="width:100%; border-collapse: collapse">
<tr><th style="text-align:center">Status</th><th style="text-align:left">Area</th><th style="text-align:left">Items</th></tr>
<tr><td align="center">โœ…</td><td>Core service</td><td>Four-protocol single-source generation, Candle/ONNX engines, Bert/XlmRoberta architectures, priority queue and time-window batching</td></tr>
<tr><td align="center">โœ…</td><td>Ecosystem integration</td><td>7-library ecosystem wiring (trait-kit registry, confers config, inklog logging, oxcache cache, limiteron rate limiting, dbnexus persistence, sdforge interfaces)</td></tr>
<tr><td align="center">โœ…</td><td>Security & i18n</td><td>JWT/CSRF/RBAC/TOTP, secure defaults hardening, audit logging, ICU+Fluent bilingual errors</td></tr>
<tr><td align="center">โœ…</td><td>Performance foundation</td><td>SIMD similarity, continuous batching, semantic cache, GPU memory paging, BF16 inference, Matryoshka reduction</td></tr>
<tr><td align="center">๐Ÿšง</td><td>Audit remediation (Unreleased)</td><td>Breaking behavioral changes: secure defaults / login convergence / XFF trust inversion / RBAC wiring / model-scoped cache keys (see [Changelog](#changelog))</td></tr>
<tr><td align="center">๐Ÿšง</td><td>Tuning switches (Unreleased)</td><td>GGUF quantization, quantized vector comparison, multi-model LFRU residency, cache WAL, hardware-aware planning, doctor diagnostics, startup warmup</td></tr>
<tr><td align="center">๐Ÿ“‹</td><td>Quantized inference backend</td><td>GGUF inference backend awaits upstream quantized BERT in candle-transformers (routing/magic-number checks/quality gate scaffolding ready)</td></tr>
<tr><td align="center">๐Ÿ“‹</td><td>Multi-replica session offload</td><td>Externalized auth sessions require the garrison db backend (pool-backed DAO)</td></tr>
<tr><td align="center">๐Ÿ“‹</td><td>Baseline completion</td><td><code>embed_throughput_bench</code> throughput baseline to be measured; MKL/Accelerate comparison baselines on toolchains that link cleanly</td></tr>
<tr><td align="center">๐Ÿ“‹</td><td>Docs & observability</td><td>ReDoc (v0.3.0), pre-configured Grafana dashboards</td></tr>
</table>

---

## ๐Ÿค Contributing

For the detailed workflow and code standards, see the [๐Ÿค Contributing guide](docs/CONTRIBUTING.md).

### ๐Ÿ› ๏ธ Development Environment

The toolchain is Rust 1.91+ (`rust-version` in `Cargo.toml` is authoritative) and Python โ‰ฅ 3.10 + pytest (optional: protobuf-compiler, docker); before submitting you must pass the four quality gates โ€” fmt / clippy (the `unwrap_used` panic-surface gate) / tests / `scripts/doc_consistency_check.py` โ€” and Git hooks run automatically via [pre-commit](https://pre-commit.com/) (`.pre-commit-config.yaml` โ†’ `scripts/pre-commit.sh`); commit messages follow Conventional Commits, and behavioral changes must be recorded in the CHANGELOG `Unreleased` section and mirrored in both READMEs. Environment setup, feature combinations, and the quality-gate commands are in the [๐Ÿค Contributing guide](docs/CONTRIBUTING.md).

### ๐Ÿ’– Ways to Contribute

<table style="width:100%; border-collapse: collapse">
<tr>
<td width="33%" align="center" style="padding: 16px">

### ๐Ÿ› Report a Bug

Found a problem?<br>
<a href="https://github.com/Kirky-X/vecboost/issues/new">Open an issue</a>

</td>
<td width="33%" align="center" style="padding: 16px">

### ๐Ÿ’ก Suggest a Feature

Have an idea?<br>
<a href="https://github.com/Kirky-X/vecboost/issues/new">Start a discussion</a>

</td>
<td width="33%" align="center" style="padding: 16px">

### ๐Ÿ”ง Submit a PR

Want to contribute code?<br>
<a href="https://github.com/Kirky-X/vecboost/pulls">Fork and open a PR</a>

</td>
</tr>
</table>

---

## ๐Ÿ“‹ Changelog

The full release history is in the [๐Ÿ“‹ Changelog](docs/CHANGELOG.md) (following [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), semantic versioning).

| Version | Date | Highlights |
|------|------|------|
| Unreleased | - | Audit remediation and tuning switches: secure defaults hardening, HF tokenizers on all platforms, time-window batching / in-batch dedup, GGUF quantization path, semantic-cache comparison modes, multi-model LFRU, cache WAL, doctor diagnostics, startup warmup |
| 0.2.1 | 2026-09-06 | i18n (114 translation keys), three-protocol rerank, three-stage semantic cache, BF16 precision, SIMD similarity, continuous batch scheduling, GPU memory paging, library mode |
| 0.2.0 | 2026-07-24 | sdforge four-protocol generation, 7-library ecosystem wiring, Matryoshka truncation re-normalization, vuln-0009 repo_id validation |
| 0.1.0 | 2025-12-15 | Initial VecBoost release |

Unreleased contains multiple breaking behavioral changes (secure defaults hardening, login convergence, XFF trust inversion, RBAC wiring, cache-key/tokenizer changes, etc.) โ€” **read before upgrading**: the per-item "old behavior โ†’ new behavior โ†’ migration" table is in the [๐Ÿ“‹ Changelog ยท Unreleased](docs/CHANGELOG.md#unreleased). The multi-replica boundary (auth sessions live in process memory; single replica only) and hot-reload semantics (config changes take effect after restart) are covered in the [โ“ FAQ](docs/FAQ.md#้…็ฝฎไธŽ้ƒจ็ฝฒ).

---

## ๐Ÿ“„ License

This project is licensed under the **Apache License 2.0** - see the [LICENSE](LICENSE) file for details. Copyright ยฉ 2025-2026 Kirky.X๐ŸŒ .

---

## ๐Ÿ™ Acknowledgements

### ๐ŸŒŸ Core Dependencies

VecBoost stands on the shoulders of these excellent open-source projects:

| Dependency | Purpose |
|------|------|
| [candle](https://github.com/huggingface/candle) | Native Rust ML inference framework (default engine) |
| [tokenizers](https://github.com/huggingface/tokenizers) | HuggingFace tokenizer (all platforms) |
| [hf-hub](https://crates.io/crates/hf-hub) | HuggingFace Hub model downloads |
| [trait-kit](https://crates.io/crates/trait-kit) | Module registry & typestate dependency management |
| [confers](https://crates.io/crates/confers) | Configuration loading (TOML + env + validation) |
| [inklog](https://crates.io/crates/inklog) | Structured logging infrastructure |
| [oxcache](https://crates.io/crates/oxcache) | High-performance cache backend |
| [limiteron](https://crates.io/crates/limiteron) | Token-bucket rate limiter |
| [dbnexus](https://crates.io/crates/dbnexus) | Database persistence (`db` feature) |
| [sdforge](https://crates.io/crates/sdforge) | Multi-protocol interface generation |
| [garrison](https://crates.io/crates/garrison) | Authentication & security hardening (`auth` feature) |
| [axum](https://github.com/tokio-rs/axum) | HTTP framework (generated by sdforge) |
| [tokio](https://github.com/tokio-rs/tokio) | Async runtime |
| [utoipa](https://github.com/juhaku/utoipa) | OpenAPI documentation |
| [prometheus](https://github.com/tikv/rust-prometheus) | Metrics export |
| [criterion](https://github.com/bheisler/criterion.rs) | Benchmarking |
| [tikv-jemallocator](https://github.com/tikv/jemallocator) | jemalloc global allocator (Linux glibc) |

### ๐Ÿ’ Special Thanks

Thanks to the Rust community, Hugging Face (model & tokenizer ecosystem), and all [contributors](https://github.com/Kirky-X/vecboost/graphs/contributors).

---

## ๐Ÿ“ž Contact & Support

<table style="width:100%; max-width: 600px">
<tr>
<td align="center" width="33%">
<a href="https://github.com/Kirky-X/vecboost/issues"><b style="color:#991B1B">Issues</b></a><br>
<span style="color:#64748B">Report problems and bugs</span>
</td>
<td align="center" width="33%">
<a href="https://github.com/Kirky-X/vecboost/issues"><b style="color:#1E40AF">Discussions</b></a><br>
<span style="color:#64748B">Ask questions and share ideas</span>
</td>
<td align="center" width="33%">
<a href="https://github.com/Kirky-X/vecboost"><b style="color:#1E293B">GitHub</b></a><br>
<span style="color:#64748B">Browse the source</span>
</td>
</tr>
</table>

---

## โญ Star History

[![Star History Chart](https://api.star-history.com/svg?repos=Kirky-X/vecboost&type=Date)](https://star-history.com/#Kirky-X/vecboost&Date)

If this project helps you, please consider giving it a โญ๏ธ!

**Built by Kirky.X**

---

<sub>ยฉ 2026 Kirky.X. All rights reserved.</sub>