Cliente Python para mnemonexus — memória pra agentes de IA, open source, em português.
Project description
mnemonexus
Cliente Python oficial para o mnemonexus — memória pra agentes de IA, open source, em português.
Paridade com mem0 nas operações CRUD, mais o diferencial: compilação Karpathy, twice-rule pra lessons, grafo de entidades, staleness/supersede automáticos.
Instalação
pip install mnemonexus
Uso
from mnemonexus import Nexus
nexus = Nexus(api_url="http://localhost:8080", token="seu-token-sanctum")
# Paridade mem0
nexus.add("Reunião terça 14h", domain="memory")
result = nexus.search("quando é a reunião?")
print(result.answer)
# Twice rule — lesson aprendida
nexus.lesson(
title="Sempre validar embedding dim antes de inserir em pgvector",
body="Dim 1536 ≠ 1024 → INSERT explode silenciosamente",
severity="critical",
)
# Decision com rationale
nexus.decision(
title="Adotar pgvector em vez de Weaviate",
description="Reduz containers; busca híbrida fica dentro de Eloquent",
category="architecture",
)
# Grafo de entidades
graph = nexus.entity("foxpulse").graph()
for edge in graph.edges:
print(edge.from_entity_slug, "→", edge.kind, "→", edge.to_entity_slug)
# Async também (recomendado em apps async)
import asyncio
from mnemonexus import AsyncNexus
async def main():
async with AsyncNexus(token="...") as nexus:
await nexus.add("…")
r = await nexus.search("…")
asyncio.run(main())
API resumida
Paridade mem0
| Método | Endpoint | O que faz |
|---|---|---|
add(content, **) |
POST /ingest |
Adiciona memória |
search(query, **) |
POST /query |
Recall híbrido (FTS + vetor) |
get(slug) |
GET /pages/{slug} |
Lê página |
update(slug, content) |
PUT /pages/{slug} |
Supersede |
delete(slug) |
DELETE /pages/{slug} |
Hard delete |
history(slug) |
GET /pages/{slug} |
Cadeia de versões |
Diferencial mnemonexus
| Método | Endpoint | O que faz |
|---|---|---|
compile(slug) |
POST /pages/{slug}/compile |
Recompila wiki page |
extract_facts(text) |
POST /facts/extract |
Facts + entidades + relações |
lesson(title, body) |
POST /lessons |
Lesson com twice-rule |
decision(title, description) |
POST /decisions |
Decisão com rationale |
compact_session(id) |
PUT /sessions/{id} |
Fecha + sumariza sessão |
entity(slug).graph() |
GET /entities/{slug}/graph |
Grafo BFS da entidade |
search_entity(q) |
GET /entities |
Busca grafo de entidades |
Errors
NexusError é a base. Subclasses:
AuthError— 401/403NotFoundError— 404ValidationError— 422
Cookbook
Veja examples/:
01_hello_world.py— add + search02_with_karpathy.py— wiki compilada03_with_lessons.py— twice rule04_multi_tenant.py— isolamento por agent_id/tenant05_rag_over_wiki.py— RAG com histórico
Dev
git clone https://github.com/lrdeoliveira/mnemonexus-python
cd mnemonexus-python
pip install -e ".[dev]"
pytest
Licença
MIT.
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 mnemonexus-0.1.0.tar.gz.
File metadata
- Download URL: mnemonexus-0.1.0.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60be41406e42f2bc9ffe89f6525018a33137611a2a0e9d60322318e3985c675f
|
|
| MD5 |
f898afd4fb2039cbc39ce4dadb98ed01
|
|
| BLAKE2b-256 |
d6b6de195fc5ea1a70034689c28c5292c8044d1c25c833dca0d243f01bb41a1f
|
File details
Details for the file mnemonexus-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mnemonexus-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee7a72e993705b1376bb863055f7dca7d3b3202496956fd4db70eb44546fb0c1
|
|
| MD5 |
99be5a1b7048144531e81cb15156260c
|
|
| BLAKE2b-256 |
9e3374be058a8b51e5a9a9bb082eb9e281ab036408e8693ad4d117a592f293be
|