Skip to main content

cubememory

Official Python SDK for Cube Memory — semantic search with 100% exact recall, isolated multi-tenant islands, and native MCP support.

PyPI npm License: MIT

Install

pip install cubememory          # sync (uses requests)
pip install cubememory[async]   # + async support (uses httpx)

Quick Start

from cubememory import CubeClient

cube = CubeClient(
    base_url="https://cubememory.com.br/gateway",
    api_key="cm_live_YOUR_KEY",
    project_id="proj_YOUR_PROJECT",
)

# Semantic search — 100% exact cosine recall (no ANN approximation)
results = cube.index("my-docs").search("wireless headphones", limit=10)
for r in results:
    print(f"[{r.score:.2f}] {r.text_preview}")

# Index a document
cube.index("my-docs").insert(
    id="doc-001",
    text="Noise cancelling Sony WH-1000XM5",
    metadata={"price": 349, "brand": "Sony"},
)

# LLM Memory (agent remembers between sessions)
cube.memory.store("User prefers dark mode and speaks Portuguese")
ctx = cube.memory.search("user preferences")

# PKM Notes
cube.notes.upsert(
    title="Meeting Q3",
    text="Discussed the roadmap and timeline.",
    tags=["meeting", "q3"],
)
notes = cube.notes.search("roadmap")

Async Usage

import asyncio
from cubememory.client import AsyncCubeClient

async def main():
    cube = AsyncCubeClient(
        base_url="https://cubememory.com.br/gateway",
        api_key="cm_live_YOUR_KEY",
        project_id="proj_YOUR_PROJECT",
    )
    results = await cube.index("my-docs").search("wireless headphones")
    memories = await cube.memory.search("user preferences")

asyncio.run(main())

API Reference

CubeClient(base_url, api_key, project_id, timeout=30.0)

Param Type Description
base_url str Gateway URL, e.g. https://cubememory.com.br/gateway
api_key str Your API key (cm_live_xxx)
project_id str Your project ID (proj_xxx)

cube.index(name)

Method Description
.insert(id, text, metadata?) Index a document
.insert_many(docs[]) Batch index
.search(query, limit?, threshold?, filter?) Semantic search → List[SearchResult]
.get(id) Fetch by ID
.delete(id) Remove document
.stats() Index statistics

SearchResult fields: id, score, text_preview, metadata


cube.memory

Agent memory — persists LLM context between sessions.

Method Description
.store(text, layer?) Save memory ("long-term" or "short-term")
.search(query, limit?) Semantic search → List[SearchResult]
.list(limit?) List all memories
.delete(id) Delete a memory

cube.notes

PKM Notes — Obsidian-style knowledge base with AI auto-connections.

Method Description
.upsert(title, text, id?, tags?) Create or update a note
.list() List all notes → List[Note]
.get(id) Full note with related notes → NoteDetail
.search(query, limit?) Semantic search → List[Note]
.delete(id) Delete note and its chunks

MCP Integration

Connect Claude, GPT, Cursor, or any MCP-compatible LLM:

{
  "mcpServers": {
    "cube-memory": {
      "type": "http",
      "url": "https://cubememory.com.br/gateway/v1/mcp",
      "headers": {
        "Authorization": "Bearer cm_live_YOUR_KEY",
        "X-Project-Id": "proj_YOUR_PROJECT"
      }
    }
  }
}

Available MCP tools:

  • Memory: search_memory, search_context, store_memory, get_memory, list_memories
  • Documents & indexes: list_indexes, get_document_chunk, get_document_full, query_table_index (deterministic analysis over tabular data)
  • Notes: search_notes, get_note
  • Code: search_code, map_code, get_symbol, get_symbol_refs
  • Synapses: list_synapses, get_synapse

Search is exact hybrid retrieval, tolerant to missing accents and typos.


LangChain / Agent Integration

from cubememory import CubeClient

cube = CubeClient(base_url, api_key, project_id)

# Use as a LangChain retriever-style tool
def retrieve(query: str) -> list[str]:
    results = cube.index("knowledge-base").search(query, limit=5)
    return [r.text_preview for r in results]

# Agent memory tool
def remember(text: str) -> str:
    cube.memory.store(text)
    return f"Stored: {text[:60]}..."

def recall(query: str) -> str:
    results = cube.memory.search(query, limit=3)
    return "\n".join(r.text_preview for r in results)

Why Cube Memory?

Cube Memory Bancos vetoriais baseados em ANN/HNSW
100% exact recall ✅ cosine float32 ❌ ANN approximation
Multi-tenant isolation ✅ island per project ⚠️ shared index with filters
MCP native ✅ built-in ❌
Self-host footprint ✅ minimal, single-host friendly ❌ heavy multi-service clusters
LGPD/GDPR ✅ data never leaves your server ❌ cloud by default

Metadata

Release files for cubememory 0.1.6

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

Source distribution (sdist)

Source distribution for cubememory 0.1.6
File Size Uploaded Provenance Actions
cubememory-0.1.6.tar.gz 9.8 kB Without provenance Details for cubememory-0.1.6.tar.gz

Built distribution (wheel)

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

Total release size: 19.4 kB

Release files / cubememory-0.1.6.tar.gz

Download URL cubememory-0.1.6.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d6fa33f48e50e77d7a185554f739ef4d833b74e4219b7ff3fc616a063c9f2146
BLAKE2b-256 checksum
How to use checksums
5b7bdea5cb757eb74cf9a1efd5237cd11dcc9b705954d3178f454a1730c59cb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / cubememory-0.1.6-py3-none-any.whl

Download URL cubememory-0.1.6-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c86068f8b16e27614db190924bfa246576c36706ad16529f01698387a0897878
BLAKE2b-256 checksum
How to use checksums
bd6112fd8e48d549203be7d66c4d68145bb87bb85afaf859473f3e6d5d36b820
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for cubememory 0.1.6

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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