Embedded claim-native memory for AI agents. Collision detection built-in.
Project description
tensory
Embedded, claim-native memory for AI agents. Single SQLite file. Built-in collision detection.
82.2% LoCoMo accuracy | 330+ tests | pyright strict | MIT
Plugin | Benchmarks | API Guide | Architecture | Dashboard
Quickstart
Claude Code plugin (recommended)
Memory works automatically — no tool descriptions in context, no manual search calls:
claude plugin install --source github kryptogrib/tensory --path plugins/claude-code
On install, Claude Code asks for your API keys. That's it — memory activates on every session.
Full plugin docs: plugins/claude-code/README.md
Python library
pip install tensory
from tensory import Tensory, Claim
store = await Tensory.create("memory.db")
await store.add_claims([Claim(text="EigenLayer has 50 team members", entities=["EigenLayer"])])
results = await store.search("EigenLayer")
Extras: pip install "tensory[mcp]" | "tensory[ui]" | "tensory[all]"
MCP server — for Claude Desktop, Cursor, and other MCP clients
{
"mcpServers": {
"tensory": {
"command": "uvx",
"args": ["--from", "tensory[mcp]", "tensory-mcp"],
"env": {
"TENSORY_DB": "~/.local/share/tensory/memory.db",
"OPENAI_API_KEY": "sk-..."
}
}
}
}
Provides 7 tools: tensory_add, tensory_remember, tensory_search, tensory_timeline, tensory_stats, tensory_health, tensory_reset.
The plugin approach is preferred — hooks work automatically, while MCP tools require the agent to call them and their descriptions consume context tokens.
Why tensory
| Library | Strength | Gap |
|---|---|---|
| Mem0 | Simple API, good DX | Chunk-based, no collision detection |
| Graphiti/Zep | Temporal knowledge graph | Requires Neo4j, heavy infra |
| Cognee | Pipeline architecture | Complex setup, no contradiction resolution |
| Letta/MemGPT | Context window management | Agent framework, not a memory library |
| Hindsight | Best benchmarks (92% LoCoMo) | Closed-source cloud service |
tensory: single pip install, atomic claim extraction, contradiction detection, temporal reasoning — zero infrastructure.
Features
- Claim-native storage — extracts atomic, verifiable statements instead of raw text chunks
- Context-aware extraction — same text yields different claims depending on research goal (details)
- Built-in collision detection — finds contradictions and superseding facts automatically (details)
- Cognitive mechanisms — salience decay, surprise scoring, priming — all algorithmic, zero LLM calls (details)
- Hybrid search — FTS5 + vector + graph traversal, merged via RRF, diversified via MMR (details)
- Pluggable LLM and embeddings — OpenAI, Anthropic, Ollama, or bring your own (details)
- Web dashboard — entity graph explorer, claims browser, memory stats
- Full cognitive stack — episodic + semantic + procedural memory + reflection
Architecture
Layer 0: RAW — episodes (raw text). Never deleted.
Layer 1: CLAIMS — atomic claims + embeddings + salience.
Layer 2: GRAPH — entities + relations + waypoints.
Layer 3: CONTEXT — research goals as extraction lenses.
Everything lives in a single SQLite file. No Docker, no Neo4j, no external services required.
Deep dive: docs/architecture.md
Example
from tensory import Tensory, Context
from tensory.embedder import OpenAIEmbedder
store = await Tensory.create(
"memory.db",
llm=my_llm_fn, # any async (str) -> str
embedder=OpenAIEmbedder(api_key="sk-..."),
)
# Create a research context — the lens for extraction
ctx = await store.create_context(
goal="Track DeFi team movements and protocol partnerships",
domain="crypto",
)
# Raw text → auto-extract claims relative to context
result = await store.add(
"Google announced partnership with EigenLayer for cloud restaking...",
source="reddit:r/defi",
context=ctx,
)
# result.claims, result.relations, result.collisions
# Hybrid search — vector + FTS + graph, context-weighted
results = await store.search("EigenLayer", context=ctx)
# Timeline — how facts about an entity evolved
history = await store.timeline("EigenLayer")
Full API reference: docs/api-guide.md
Dashboard
uvx --from "tensory[ui]" tensory-dashboard --db ~/.local/share/tensory/memory.db
Open http://localhost:7770 — entity graph explorer, claims browser, memory stats.
Docker
docker run -d -p 7770:7770 --name tensory-dashboard \
-v ~/.local/share/tensory:/data \
--restart unless-stopped \
ghcr.io/kryptogrib/tensory
Benchmarks
Tested on LoCoMo (Long-term Conversational Memory, ACL 2024):
| Memory System | Accuracy | Queries | Notes |
|---|---|---|---|
| Hindsight (cloud) | 92.0% | 1,540 | Closed-source |
| Tensory | 82.2% | 152 | Open-source, single-file SQLite |
| Cognee | 80.3% | 152 | Partial evaluation |
| Hybrid Search (Qdrant) | 79.1% | 1,540 | Vector-only baseline |
Extraction cost: ~$0.08/conversation (Haiku + embeddings).
Full breakdown, per-category results, failure analysis: docs/benchmark-results.md
Configuration
cp .env.example .env
| Variable | Purpose | Required |
|---|---|---|
OPENAI_API_KEY |
Embeddings + LLM extraction via OpenAI | Only if using OpenAI |
ANTHROPIC_API_KEY |
LLM extraction via Anthropic/proxy | Only if using Anthropic |
ANTHROPIC_BASE_URL |
Proxy URL (CLIProxyAPI, LiteLLM) | Optional |
TENSORY_MODEL |
Model for extraction | Default: claude-haiku-4-5-20251001 |
Full configuration guide: docs/configuration.md
Status
Alpha. 330+ tests, pyright strict, ruff clean, CI on every push.
What's next:
- Full LoCoMo evaluation (1,540 questions) for definitive comparison
- Multi-hop graph traversal — chain facts across entity relationships
- Cross-encoder reranking for retrieval precision
- Session-aware diversification (SSD) for sequential agent queries
- Research agent built on tensory as a reference application
Development
uv sync --all-extras # Install all deps
uv run pytest tests/ # Run all tests
uv run pyright tensory/ # Type check (strict mode)
uv run ruff check tensory/ tests/ # Lint
uv run ruff format tensory/ tests/ # Format
License
MIT
Attribution
Deduplication logic adapted from Graphiti (Apache-2.0 License, Copyright 2024 Zep Software, Inc.)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tensory-0.3.2.tar.gz.
File metadata
- Download URL: tensory-0.3.2.tar.gz
- Upload date:
- Size: 664.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
821d1a367d1e76b037e443ae0ceb184dfc718c8300173168fd778eee237b94d3
|
|
| MD5 |
68e3617f919b8de0abdc704210173fa5
|
|
| BLAKE2b-256 |
74bdda1579573b32f77fdae25f524b8066331dad7e215c89d90d90dab777de24
|
Provenance
The following attestation bundles were made for tensory-0.3.2.tar.gz:
Publisher:
publish-pypi.yml on kryptogrib/tensory
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tensory-0.3.2.tar.gz -
Subject digest:
821d1a367d1e76b037e443ae0ceb184dfc718c8300173168fd778eee237b94d3 - Sigstore transparency entry: 1206583306
- Sigstore integration time:
-
Permalink:
kryptogrib/tensory@9b8738fc70143490c595731bf7d9b08fda2a4834 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/kryptogrib
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@9b8738fc70143490c595731bf7d9b08fda2a4834 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tensory-0.3.2-py3-none-any.whl.
File metadata
- Download URL: tensory-0.3.2-py3-none-any.whl
- Upload date:
- Size: 617.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8712590b556c2b60599b705ecf6c49e9bc71ac9c04ee6ce1d2e853c2cf935b28
|
|
| MD5 |
32d3d614d39960ce900a6253c4271ab1
|
|
| BLAKE2b-256 |
05c38267c440f7f16fd4942957ac6b34a73aa194252b2f350c56ef948942e9b9
|
Provenance
The following attestation bundles were made for tensory-0.3.2-py3-none-any.whl:
Publisher:
publish-pypi.yml on kryptogrib/tensory
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tensory-0.3.2-py3-none-any.whl -
Subject digest:
8712590b556c2b60599b705ecf6c49e9bc71ac9c04ee6ce1d2e853c2cf935b28 - Sigstore transparency entry: 1206583308
- Sigstore integration time:
-
Permalink:
kryptogrib/tensory@9b8738fc70143490c595731bf7d9b08fda2a4834 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/kryptogrib
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@9b8738fc70143490c595731bf7d9b08fda2a4834 -
Trigger Event:
push
-
Statement type: