Skip to main content

TurboMemory ⚡

PyPI Version Python Versions License: MIT Tests Lint Code Coverage Downloads

TurboMemory is a lightweight semantic storage engine for compressed embedding archives.

It combines:

  • SQLite metadata indexing
  • append-only transcript logging
  • quantized embedding storage (4-bit / 6-bit / 8-bit packed format)
  • topic-based partitioning + centroid prefiltering
  • background consolidation (merge / prune / deduplicate)
  • optional confidence decay + contradiction detection

TurboMemory is designed for local-first semantic search, offline RAG, and edge deployments.

Goal: deliver "SQLite simplicity" for semantic memory + compressed vector storage.


Why TurboMemory?

Embedding storage is expensive:

  • float32 vectors consume large disk space
  • most vector DBs are heavy to deploy
  • local-first apps need portable storage formats

TurboMemory solves this by using TurboQuant-style packing to store embeddings efficiently while still enabling fast retrieval.


Features

Storage

  • Append-only transcript/event log (durable ingestion)
  • Topic-based storage files (load-on-demand)
  • SQLite index for metadata + fast filtering
  • Packed embedding formats: 4-bit / 6-bit / 8-bit

Retrieval

  • centroid/topic prefilter to reduce search space
  • configurable scoring pipeline
  • optional verification filtering

Maintenance / Self-Healing

  • background consolidation daemon
  • deduplication and merging of similar chunks
  • TTL expiration + confidence decay
  • experimental contradiction detection

Installation

pip install turbomemory

From source

git clone https://github.com/Kubenew/TurboMemory.git
cd TurboMemory
pip install -e .

With all features

pip install turbomemory[all]

Requirements

  • Python 3.9+
  • numpy >= 1.24.0
  • sentence-transformers >= 2.2.0

Quickstart

CLI Usage

# Add memory
python -m turbomemory add_memory --topic notes --text "TurboMemory stores semantic chunks efficiently."

# Query
python -m turbomemory query --query "semantic storage" --k 5

# Get stats
python -m turbomemory stats

Python Usage

from turbomemory import TurboMemory

tm = TurboMemory(root="./tm_data")

# Add memory
tm.add_memory(
    topic="notes",
    text="TurboMemory stores semantic chunks efficiently.",
    ttl_days=365
)

# Query
results = tm.query("semantic storage", k=5)

for score, topic, chunk in results:
    print(f"[{score:.3f}] {chunk['text']}")

Example output:

[0.892] TurboMemory stores semantic chunks efficiently.
[0.756] Semantic search with compression
[0.723] Vector storage made simple

CLI Command Reference

Command Description
add_memory Add a memory chunk
add_turn Add conversation turn
query Search memories
stats Show statistics
backup Create backup
restore Restore from backup
export Export topics
import Bulk import
merge Merge topics
sync Sync with remote
hybrid Hybrid search

See python -m turbomemory --help for full options.


Architecture

┌─────────────────────────────────────────────────────────────────┐
│                        TurboMemory                              │
├─────────────────────────────────────────────────────────────────┤
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐       │
│  │  CLI / API    │  │ Python SDK    │  │ Integrations │       │
│  └──────┬─────────┘  └──────┬─────────┘  └──────┬─────────┘       │
│         │                   │                   │                  │
│  ┌──────▼───────────────────▼───────────────────▼─────────┐    │
│  │                    Core Engine                         │    │
│  │  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐    │    │
│  │  │ Quantization│  │   Search    │  │ Consolidation│    │    │
│  │  │  (4/6/8bit)│  │  (BM25+Vec) │  │   Daemon    │    │    │
│  │  └──────┬──────┘  └──────┬──────┘  └──────┬──────┘    │    │
│  └─────────┼────────────────┼────────────────┼────────────┘    │
│            │                │                │                 │
│  ┌─────────▼────────────────▼────────────────▼────────────┐  │
│  │                    Storage Layer                       │  │
│  │  ┌─────────┐  ┌─────────┐  ┌─────────┐  ┌─────────┐   │  │
│  │  │SQLite   │  │  TMF    │  │  .tmlog │  │  Sync   │   │  │
│  │  │Index    │  │ Vectors │  │   Log   │  │ Protocol│   │  │
│  │  └─────────┘  └─────────┘  └─────────┘  └─────────┘   │  │
│  └────────────────────────────────────────────────────────┘  │
└──────────────────────────────────────────────────────────────┘

Benchmarks

Compression Ratios

Format Size (10K vectors, 384 dims) Compression
float32 14.6 MB 1x
8-bit 3.7 MB 4x
6-bit 2.8 MB 5.2x
4-bit 1.8 MB 8x

Query Latency

Dataset Size Latency (P95)
1,000 chunks 12ms
10,000 chunks 45ms
100,000 chunks 180ms

Recall Quality

Bit Depth Avg Cosine Similarity
8-bit 0.997
6-bit 0.968
4-bit 0.912

Run benchmarks yourself:

python -m turbomemory.benchmark

Comparison

Feature TurboMemory Chroma sqlite-vector LanceDB
Compression 4-8x None None None
Local-first ✅ ❌ ✅ ✅
SQLite backend ✅ ❌ ✅ ❌
Topic partitioning ✅ ❌ ❌ ❌
Self-healing ✅ ❌ ❌ ❌
Replication ✅ ❌ ❌ ✅
Hybrid search ✅ ✅ ❌ ✅
No server needed ✅ ❌ ✅ ❌

Integrations

LangChain

from turbomemory.integrations import TurboMemoryVectorStore

vectorstore = TurboMemoryVectorStore(root="./data", topic="docs")
vectorstore.add_texts(["doc1", "doc2"])
docs = vectorstore.similarity_search("query")

LlamaIndex

from turbomemory.integrations import getTurboMemoryIndex

index = getTurboMemoryIndex(root="./data")
query_engine = index.as_query_engine()
response = query_engine.query("your question")

Limitations

  • No distributed clustering - Designed for single-node deployment
  • No real-time multi-writer - Single-writer with eventual consistency via sync
  • HNSW/IVF not default - Uses centroid prefilter; optional HNSW available
  • Model pinned at ingest - All vectors must use same embedding model

Glossary

  • Centroid prefilter: Pre-selects relevant topics using centroid similarity before full search
  • Confidence decay: Reduces confidence of older memories over time
  • Contradiction detection: Detects conflicting information and adjusts confidence
  • Consolidation: Background process to merge/prune/optimize storage
  • TurboQuant: 4/6/8-bit packed quantization for embeddings
  • TMF: TurboMemory Format - portable storage format specification

Roadmap

See ROADMAP.md

Version Milestone
v0.3 Stability + CI + packaging
v0.4 Benchmarks + profiling
v0.5 TMF v1 stable format
v0.6 Hybrid search (BM25 + vector)
v0.7 FastAPI server mode
v0.8 Replication / edge sync

Docker

# Build
docker build -t turbomemory .

# Run
docker run -p 8000:8000 turbomemory

# Or use docker-compose
docker compose up

Contributing

Contributions are welcome!

  1. Fork the repo
  2. Create a feature branch
  3. Run tests: pytest tests/
  4. Run linters: ruff check . && black .
  5. Submit a PR

See CONTRIBUTING.md for details.


License

MIT License - see LICENSE


Support


Star History

Star History Chart

Metadata

Release files for turbomemory 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for turbomemory 0.5.1
File Size Uploaded Provenance Actions
turbomemory-0.5.1.tar.gz 143.4 kB With provenance Details for turbomemory-0.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for turbomemory 0.5.1
File Interpreter ABI Platform Actions
turbomemory-0.5.1-py3-none-any.whl Python 3 none any Details for turbomemory-0.5.1-py3-none-any.whl

Total release size: 309.8 kB

Release files / turbomemory-0.5.1.tar.gz

Download URL turbomemory-0.5.1.tar.gz
Size 143.4 kB
Tags Source
SHA-256 checksum
How to use checksums
17ab28b56579c356166ea0ce1e6f31f637cab6ee57a0bb5044e9f6390358d204
BLAKE2b-256 checksum
How to use checksums
dc911a59761451a92d4fc0c845c3253eaa6560dc8e744f4c7f1a58f08e97d84b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 20, 2026.

Transparency log

Release files / turbomemory-0.5.1-py3-none-any.whl

Download URL turbomemory-0.5.1-py3-none-any.whl
Size 166.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aedbdf4feb14f06dcca5a182dc965070ca5c4cd2bc4629aec60debbaaea7f298
BLAKE2b-256 checksum
How to use checksums
2fb4b20ef2035a83ecb9b6ea245f4d1e4aa9008243e1e12ca08a2c22c1577cb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 20, 2026.

Transparency log

Security for turbomemory 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for turbomemory-0.5.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page