Metadata-Version: 2.4
Name: memledger
Version: 0.5.0a0
Summary: Memory governance and trust layer for AI agents — provenance, attribution, confidence gating
Project-URL: Homepage, https://github.com/memledger-ai/memledger-core
Project-URL: Documentation, https://memledger.dev
Project-URL: Repository, https://github.com/memledger-ai/memledger-core
Project-URL: Issues, https://github.com/memledger-ai/memledger-core/issues
Author: Ratnopam Chakrabarti
License-Expression: Apache-2.0
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Requires-Dist: litellm>=1.40.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: opentelemetry-api>=1.20
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc>=1.20
Requires-Dist: opentelemetry-sdk>=1.20
Requires-Dist: pydantic>=2.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: rich>=13.0
Requires-Dist: typer>=0.9.0
Provides-Extra: all
Requires-Dist: aiosqlite>=0.19.0; extra == 'all'
Requires-Dist: arize-phoenix-client>=2.0; extra == 'all'
Requires-Dist: arize-phoenix-otel>=0.6; extra == 'all'
Requires-Dist: asyncpg>=0.29.0; extra == 'all'
Requires-Dist: boto3>=1.35.0; extra == 'all'
Requires-Dist: datasets>=2.0.0; extra == 'all'
Requires-Dist: fastembed<1.0,>=0.5; extra == 'all'
Requires-Dist: httpx>=0.27.0; extra == 'all'
Requires-Dist: langchain-community>=0.3.0; extra == 'all'
Requires-Dist: langchain>=0.3.0; extra == 'all'
Requires-Dist: langgraph-checkpoint>=2.0.0; extra == 'all'
Requires-Dist: langgraph>=0.2.0; extra == 'all'
Requires-Dist: matplotlib>=3.7.0; extra == 'all'
Requires-Dist: mcp>=1.0.0; extra == 'all'
Requires-Dist: opensearch-py>=2.4.0; extra == 'all'
Requires-Dist: pgvector>=0.3.0; extra == 'all'
Requires-Dist: ragas>=0.2.0; extra == 'all'
Requires-Dist: sqlite-vec>=0.1.0; extra == 'all'
Provides-Extra: aws
Requires-Dist: boto3>=1.35.0; extra == 'aws'
Requires-Dist: httpx>=0.27.0; extra == 'aws'
Requires-Dist: opensearch-py>=2.4.0; extra == 'aws'
Provides-Extra: bedrock
Requires-Dist: boto3>=1.35.0; extra == 'bedrock'
Provides-Extra: dev
Requires-Dist: aiosqlite>=0.19.0; extra == 'dev'
Requires-Dist: boto3>=1.35.0; extra == 'dev'
Requires-Dist: fastembed<1.0,>=0.5; extra == 'dev'
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.5.0; extra == 'dev'
Provides-Extra: dynamodb
Requires-Dist: boto3>=1.35.0; extra == 'dynamodb'
Provides-Extra: eval
Requires-Dist: arize-phoenix-client>=2.0; extra == 'eval'
Requires-Dist: datasets>=2.0.0; extra == 'eval'
Requires-Dist: langchain-community>=0.3.0; extra == 'eval'
Requires-Dist: langchain>=0.3.0; extra == 'eval'
Requires-Dist: matplotlib>=3.7.0; extra == 'eval'
Requires-Dist: ragas>=0.2.0; extra == 'eval'
Provides-Extra: langgraph
Requires-Dist: langgraph-checkpoint>=2.0.0; extra == 'langgraph'
Requires-Dist: langgraph>=0.2.0; extra == 'langgraph'
Provides-Extra: local
Requires-Dist: fastembed<1.0,>=0.5; extra == 'local'
Provides-Extra: mcp
Requires-Dist: mcp>=1.0.0; extra == 'mcp'
Provides-Extra: opensearch
Requires-Dist: boto3>=1.35.0; extra == 'opensearch'
Requires-Dist: httpx>=0.27.0; extra == 'opensearch'
Requires-Dist: opensearch-py>=2.4.0; extra == 'opensearch'
Provides-Extra: pgvector
Requires-Dist: asyncpg>=0.29.0; extra == 'pgvector'
Requires-Dist: pgvector>=0.3.0; extra == 'pgvector'
Provides-Extra: sqlite
Requires-Dist: aiosqlite>=0.19.0; extra == 'sqlite'
Requires-Dist: sqlite-vec>=0.1.0; extra == 'sqlite'
Provides-Extra: telemetry
Requires-Dist: arize-phoenix-otel>=0.6; extra == 'telemetry'
Description-Content-Type: text/markdown

# memledger

**Memory governance and trust layer for multi-agent AI systems.**

memledger adds attribution, provenance, confidence gating, and quality measurement on top of any vector-backed memory store. Every memory carries a source, a confidence score, a derivation chain, and an audit trail — so when agents share memory, trust transfers become legible instead of invisible.

> ⚠️ **v0.5.0a0 — alpha release (name-reservation).** Phase A + B of the v1 OSS launch are done; Phase C/D/E are in flight. `pip install memledger` (no `--pre`) will not pick this up — you must explicitly opt in (`pip install memledger==0.5.0a0` or `--pre`). The stable `v1.0.0` will follow when the launch checklist signs off. See [CHANGELOG.md](CHANGELOG.md) and [docs/test-plan.md](docs/test-plan.md) for what's verified vs. what's still on the runway. **Do not use in production.**

## Why memledger

Existing memory frameworks (Mem0, Zep, Letta, AgentCore Memory) optimize for *recall quality* — how accurately the system retrieves relevant memory. None of them address *accountability* — who wrote this memory, how confident were they, what did they derive it from, and how has it been used since.

In a single-agent system, the accountability gap is academic. In a multi-agent system where agents read and act on each other's beliefs, it is the fault line where systems fail at scale.

## What it does

- **Attribution** — every memory carries `created_by`, `confidence`, `session_id`, `derived_from`, `supersedes`, `workflow_id`, `triggered_by`, `hedged`, `namespace`
- **Cross-agent lineage chains** — derivation chains tracked across agent boundaries; effective confidence is the weakest link in the chain
- **Confidence-gated retrieval** — per-namespace `PASS` / `FLAG` / `FILTER` policy applied at search time
- **Outcome feedback loop** — `record_outcome()` updates memory confidence based on observed downstream outcomes
- **Namespace RBAC** — declarative per-agent access control over hierarchical namespaces
- **Memory Attribution Integrity (MAI) evaluation** — calibrated scorer (deterministic + LLM-as-judge) for memory quality
- **OpenTelemetry observability** — every operation emits spans with memory trust attributes
- **MCP server** — framework-agnostic adoption via Model Context Protocol

## Install

```bash
pip install memledger
```

Backend extras (pick one or more):

```bash
pip install memledger[local,pgvector]   # zero-cloud OSS quickstart: local fastembed + Postgres+pgvector
pip install memledger[pgvector]         # bring your own LLM/embedding provider via LiteLLM
pip install memledger[sqlite]           # local SQLite (tests/demos only)
pip install memledger[aws]              # AWS path: Bedrock, OpenSearch SigV4, DynamoDB
```

**Backend contract (v1):** the only required backend is **open-source PostgreSQL ≥ 14 with the [pgvector](https://github.com/pgvector/pgvector) extension ≥ 0.5**. Aurora, RDS, Supabase, Neon and any other Postgres flavor work with the same backend class — only the DSN changes. See [docs/architecture.md](docs/architecture.md#memory-backend-contract-v1) for verified deployment patterns (Docker, Kubernetes, AWS).

## Quick start

```python
from memledger import Memledger

ml = await Memledger.create(backend_name="sqlite", connection_string=":memory:")

await ml.add(
    content="HikariCP maxPoolSize=50 fixes payment-service OOM",
    namespace="/ops/incidents/payment-svc",
    confidence=0.9,
    created_by="ops-agent",
)

results = await ml.search(query="connection pool fix", namespace="/ops/incidents/payment-svc")
for r in results:
    print(r.content, r.confidence, r.created_by)
```

## Architecture

System architecture, data model, and observability pipeline are documented in [docs/architecture.md](docs/architecture.md).

## Companion repositories

memledger is split across three repositories under the [memledger-ai](https://github.com/memledger-ai) organization:

- **[memledger-core](https://github.com/memledger-ai/memledger-core)** — Python SDK, MCP server, Helm chart (this repo)
- **[memledger-ui](https://github.com/memledger-ai/memledger-ui)** — Trust graph visualization (FastAPI + React)
- **[memledger-docs](https://github.com/memledger-ai/memledger-docs)** — Documentation site (Docusaurus)

## License

Apache 2.0. See [LICENSE](LICENSE).
