Skip to main content

Decentralized IPFS-style vector database on Bittensor — the permanent semantic memory layer for AI.

Project description

Engram

Decentralized Vector Database on Bittensor

Permanent, content-addressed semantic memory for AI — no central authority, no single point of failure.

License: MIT Python 3.10+ Bittensor Status Docs


What is Engram?

Engram applies the IPFS insight to AI memory: every piece of knowledge gets a content identifier (CID) derived deterministically from its embedding. The same text always maps to the same CID — regardless of which miner stores it.

  • Content-addressedv1::a3f2b1... uniquely identifies an embedding, not a location
  • Decentralized — embeddings are replicated across competing miners on Bittensor
  • Incentivized — miners earn TAO for provably storing and serving vectors
  • Verifiable — HMAC challenge-response proofs ensure miners actually hold the data
         store("The transformer architecture changed everything.")
                              │
                              ▼
              ┌───────────────────────────────┐
              │   CID: v1::a3f2b1c4d5e6f7...  │
              │   Embedding: [0.02, -0.14, ...]│
              │   Stored on: miners 3, 7, 11  │
              └───────────────────────────────┘
                              │
                  query("how does attention work?")
                              │
                              ▼
              ┌───────────────────────────────┐
              │   score: 0.9821  cid: v1::a3f │
              │   score: 0.8744  cid: v1::b2e │
              │   score: 0.8291  cid: v1::c1d │
              └───────────────────────────────┘

Quick Start

Install

pip install engram-subnet

Or from source:

git clone https://github.com/Dipraise1/-Engram-.git
cd -Engram-
pip install -e .

Configure

cp .env.example .env
# Edit: WALLET_NAME, NETUID, SUBTENSOR_NETWORK
# Optional: USE_LOCAL_EMBEDDER=true  (no OpenAI key needed)

Python SDK

from engram.sdk import EngramClient

client = EngramClient("http://127.0.0.1:8091")

# Store text — returns a permanent CID
cid = client.ingest("The transformer architecture changed everything.")
print(cid)  # v1::a3f2b1...

# Semantic search
results = client.query("how does attention work?", top_k=5)
for r in results:
    print(f"{r['score']:.4f}  {r['cid']}")

# Batch ingest from JSONL
cids = client.batch_ingest_file("data/corpus.jsonl")

CLI

engram ingest "Some important knowledge"
engram ingest --file corpus.jsonl
engram ingest --dir ./docs          # recursive directory ingest

engram query "what is self-attention?"

engram status                        # local store info
engram status --live --netuid 42     # live metagraph + miner health

Framework Integrations

# LangChain
from engram.sdk.langchain import EngramVectorStore
store = EngramVectorStore(miner_url="http://127.0.0.1:8091", embeddings=your_embeddings)
retriever = store.as_retriever(search_kwargs={"k": 5})

# LlamaIndex
from engram.sdk.llama_index import EngramVectorStore
store = EngramVectorStore(miner_url="http://127.0.0.1:8091")
index = VectorStoreIndex.from_documents(
    documents,
    storage_context=StorageContext.from_defaults(vector_store=store)
)

Running a Miner

# Create wallet
btcli wallet new_coldkey --wallet.name engram
btcli wallet new_hotkey --wallet.name engram --wallet.hotkey miner

# Register on subnet
btcli subnet register --netuid 42 --wallet.name engram --wallet.hotkey miner

# Start
python neurons/miner.py --wallet.name engram --wallet.hotkey miner --netuid 42

Full setup: docs/miner.md


Running a Validator

btcli subnet register --netuid 42 --wallet.name engram --wallet.hotkey validator
python neurons/validator.py --wallet.name engram --wallet.hotkey validator --netuid 42

Full setup: docs/validator.md


Scoring

Validators score miners every 120 seconds:

composite_score = 0.50 × recall@10
               + 0.30 × latency_score     (1.0 at ≤100ms, 0.0 at ≥500ms)
               + 0.20 × proof_success_rate

Miners with proof success rate below 50% receive weight 0.


Architecture

┌──────────────────────────────────────────────────────────────┐
│                       Bittensor Chain                        │
│               (metagraph · weight setting · TAO)             │
└─────────────────────┬──────────────────────┬─────────────────┘
                      │                      │
              ┌───────▼──────┐    ┌──────────▼──────┐
              │  Validator   │    │      Miner       │
              │              │    │                  │
              │ • challenge  │───▶│ • FAISS index    │
              │ • score      │    │ • embedder       │
              │ • set weights│◀───│ • proof service  │
              └──────────────┘    └──────────┬───────┘
                                             │
                                   ┌─────────▼────────┐
                                   │   engram-core     │
                                   │   (Rust / PyO3)   │
                                   │ • CID generation  │
                                   │ • HMAC proofs     │
                                   └──────────────────┘

Repository Structure

engram/
├── engram/              # Python package
│   ├── miner/           # Ingest, query, embedder, store, rate limiter
│   ├── validator/       # Scoring, challenge, weight setting
│   ├── sdk/             # Client, LangChain, LlamaIndex adapters
│   └── protocol.py      # Synapse types (IngestSynapse, QuerySynapse)
├── engram-core/         # Rust core — CID generation + storage proofs
├── engram-web/          # Next.js frontend (theengram.space)
├── neurons/             # miner.py, validator.py entry points
├── scripts/             # Demo, ground truth generation, utilities
├── tests/               # pytest suite
└── docs/                # Architecture, SDK, CLI, protocol reference

Documentation

Guide Description
docs/architecture.md System design, data flows, component overview
docs/miner.md Miner setup, configuration, optimization
docs/validator.md Validator setup and scoring loop
docs/sdk.md Python SDK full reference
docs/cli.md CLI command reference
docs/protocol.md Wire protocol, CID spec, scoring formulas

Full web docs: theengram.space/docs


Tests

pytest tests/ -q
cargo test --manifest-path engram-core/Cargo.toml --no-default-features

Network

Property Value
Network Bittensor (TAO)
Type Infrastructure / Storage
Status Testnet
Subnet UID 42 (testnet)
Canonical embedding model text-embedding-3-small (1536d)
Vector index FAISS (IVF-flat)
Proof type HMAC-SHA256 challenge-response

Links


2026 — Permanent semantic memory for AI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

engram_subnet-0.1.1.tar.gz (54.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

engram_subnet-0.1.1-py3-none-any.whl (57.8 kB view details)

Uploaded Python 3

File details

Details for the file engram_subnet-0.1.1.tar.gz.

File metadata

  • Download URL: engram_subnet-0.1.1.tar.gz
  • Upload date:
  • Size: 54.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for engram_subnet-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cd9528b1a402b312634603468bd456e2cdcc9256683b083aada9fd6479643ed3
MD5 7ed96ad047dbd5bb734e40c529d20388
BLAKE2b-256 ee18d9420f1f87784ce6227c9202f3214c6450c2733f84c0a289452da60832e8

See more details on using hashes here.

File details

Details for the file engram_subnet-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: engram_subnet-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 57.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for engram_subnet-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cb60ab14f8a744cd9bfc00691e8bfb3511f3d97baf773a7600db644245754eef
MD5 f417372de9ed04ad17cc2495cfb24d65
BLAKE2b-256 e148e43646a68428f687aadb53d2dfad0a588be9fb62f54ffd153b2849df4c81

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page