Metadata-Version: 2.4
Name: causalmem
Version: 0.1.0
Summary: Causal memory graph for AI agents with belief revision and semantic retrieval
Requires-Python: >=3.10
Requires-Dist: claudette>=0.3.14
Requires-Dist: fastcore
Requires-Dist: sentence-transformers
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Description-Content-Type: text/markdown

# causalmem

Causal memory graph for AI agents with belief revision and semantic retrieval.

## Overview

`causalmem` provides a structured memory system for AI agents that:
- Records episodes (action + outcome) in an append-only buffer
- Consolidates episodes into a causal graph using LLM-based belief revision
- Classifies relationships as REFINEMENT, UPDATE, CORRECTION, or UNRELATED
- Retrieves relevant memory chains using semantic similarity

## Installation

```bash
pip install causalmem
```

## Quick Start

```python
from causalmem import Episode, EpisodeBuffer, Consolidator

buf = EpisodeBuffer()
c = Consolidator(buf)

buf.add(Episode("user wants report", "fetch data", ["fetch(db)"], "retrieved 100 rows", "need data first"), c)
buf.add(Episode("have data", "analyze data", ["analyze(data)"], "found 3 trends", "data available"), c)

await buf._queue.join()
result = c.retrieve("how was the analysis done?")
for node in result:
    print(node.episode.action, "->", node.episode.outcome)
```

## License

Apache 2.0
