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.
Metadata
Release files for mnemonexus 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mnemonexus-0.2.0.tar.gz | 10.9 kB | Without provenance | Details for mnemonexus-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mnemonexus-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for mnemonexus-0.2.0-py3-none-any.whl |
Total release size: 20.1 kB
Release files / mnemonexus-0.2.0.tar.gz
| Download URL | mnemonexus-0.2.0.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
96fafd017d7e15bc358cf9c8202abc8f8388a37257bb6677d1010f427a7ac2ad
|
|
BLAKE2b-256 checksum How to use checksums |
31930d77368458d2a0b13b3711276f15a42953b31d47334d9fa528c39a240e8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / mnemonexus-0.2.0-py3-none-any.whl
| Download URL | mnemonexus-0.2.0-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
987c9d34bf76e59af6025587b6089d15f6f1db75e50cb3be694f79083bf77fa7
|
|
BLAKE2b-256 checksum How to use checksums |
ff2299e9cb43caf3229cc40d22cc5af8a0d84969cab6a6f83aea9653cc276d71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for mnemonexus 0.2.0
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.