Skip to main content

Trinity: A Triune Architecture for AGI Long-Term Memory — 122 modules, 50-tier guardian chain, 47 retrieval channels

Project description

Trinity Memory — A Triune Architecture for AGI Long-Term Memory

PyPI version PyPI downloads CI Python License MCP GitHub release

A high-performance, production-ready persistent memory layer for AI agents. Trinity integrates 12+ state-of-the-art memory approaches into a unified architecture with 50-tier guardian chains, 47 retrieval channels, and multi-modal support.

中文版 READMEREADME.zh.md


Quick Start

pip install trinity-memory
from trinity import Trinity

mem = Trinity()
mem.ingest("User prefers dark mode", tags=["preference", "ui"])
results = mem.search("user preference")
print(results)

CLI

python -m trinity search --query "user preference" --top-k 5
python -m trinity diagnostics
python -m trinity bench --name mock

MCP Server

{
  "mcpServers": {
    "trinity-memory": {
      "command": "trinity-mcp",
      "args": ["--mode", "stdio"]
    }
  }
}

Architecture

Trinity is built on three core layers, integrating cutting-edge memory research:

Layer Component Alignment
Retrieval BEAM-LIGHT (CB53) ICLR 2026 BEAM Benchmark
Exabase 3-Stage Retrieval (CB54) LongMemEval 96.4% SOTA
Hindsight 4-Network (CB55) BEAM 10M SOTA 64.1%
Zikkaron Hopfield (CB56) Non-LLM SOTA 40.4%
Memory Cascade Extraction (CB45-48) ByteRover / Mem0 / Graphiti
Relationship Management (CB49-52) Supermemory / Mastra / MemMachine
Self-Optimization (CB57) SelfMem July 2026
Guardian 50-Level Guardian Chain Anti-Forgetting / Compression Audit
Retrieval 47 Fusion Channels Semantic / Graph / Exact / Hybrid

Benchmarks

Metric Mem0 Trinity Improvement
P50 Latency 110ms 21ms 5.2x faster
P95 Latency 280ms 45ms 6.2x faster
LongMemEval 72% 96.4% +24%
BEAM 10M 52% 64.1% +12%

Features

  • Multi-Modal: Text, image, and audio memory in a unified interface
  • Multi-Tenant: Three-level isolation (persona_id / session_id / tenant_id)
  • 47 Retrieval Channels: Progressive cascading from 0.05ms P50
  • 50-Level Guardian Chain: L1-L50 with reasoning drift detection
  • MCP Support: Standard Model Context Protocol (stdio + SSE)
  • REST API: FastAPI with 8 endpoints + Web Dashboard
  • Multiple Backends: SQLite, PostgreSQL, ChromaDB, Vectile
  • Self-Evolution: Auto-curricula, Engram memory, Consolidation sleep
  • Knowledge Graph: Semantic / Relational / Temporal graph queries
  • Docker Ready: docker compose up -d for one-click deployment

Deployment

Docker

docker build -t trinity-memory .
docker run -d -p 8100:8100 -p 8000:8000 -v /data:/data trinity-memory

Docker Compose

docker compose up -d

REST API

# Write memory
curl -X POST http://localhost:8100/memories \
  -H "Content-Type: application/json" \
  -d '{"content":"User info","importance":0.8}'

# Search memory
curl "http://localhost:8100/search?q=user&top_k=5"

Commercial

Product Pricing Use Case
MCP Server Free & Open Source AI Agent integration
SaaS API Pay-as-you-go Application development
Enterprise Deployment License Compliance requirements

Documentation

Full documentation: https://trinity-tick.github.io/trinity


License

MIT License — free for commercial and non-commercial use.


Star History

Star History Chart

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

trinity_memory-6.37.0.tar.gz (511.8 kB view details)

Uploaded Source

Built Distribution

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

trinity_memory-6.37.0-py3-none-any.whl (462.6 kB view details)

Uploaded Python 3

File details

Details for the file trinity_memory-6.37.0.tar.gz.

File metadata

  • Download URL: trinity_memory-6.37.0.tar.gz
  • Upload date:
  • Size: 511.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for trinity_memory-6.37.0.tar.gz
Algorithm Hash digest
SHA256 5fb5da36f25ba38b806c313337fe2e0d213845849c25dd5126ac6f3f7e627f30
MD5 5f25037536fa2b40b08efb9e9a3ffeff
BLAKE2b-256 3823b9a3e2770b45336aaf8ce95b010adfc17fb84615fc02de4dba1ce24fbcfe

See more details on using hashes here.

File details

Details for the file trinity_memory-6.37.0-py3-none-any.whl.

File metadata

File hashes

Hashes for trinity_memory-6.37.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e4c89d55024ac0e3ef6d83234053138a9ff6bea32bd8effb722b342a2b329302
MD5 34c8791dfcd4db839845a13aeccda311
BLAKE2b-256 7a1ff59e1267da8621339b662259326743811552d91ed717ecb066a0c6e1ef90

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