Metadata-Version: 2.4
Name: chainmemory
Version: 1.0.0
Summary: Permanent memory for AI agents on the blockchain
Home-page: https://chainmemory.ai
Author: ChainMemory Team
Author-email: ChainMemory Team <dev@chainmemory.ai>
Project-URL: Homepage, https://chainmemory.ai
Project-URL: Source, https://github.com/chaelynet/chainmemory-python
Keywords: chainmemory,blockchain,ai,memory,agent,langchain
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.28.0
Dynamic: author
Dynamic: home-page
Dynamic: requires-python

# ChainMemory Python SDK

Permanent memory for AI agents on the ChainMemory blockchain.

## Install

```bash
pip install chainmemory
```

## Quick Start

```python
from chainmemory import ChainMemory

# Generate new API key
cm = ChainMemory.create()
# Get AIC from https://faucet.chainmemory.ai

# Or use existing key
cm = ChainMemory(api_key="aic_...")

# Register your AI
cm.register("MyAgent", "gpt-4")

# Write a memory (instant response, syncs to blockchain in ~30s)
memory = cm.remember(
    "Decided to use Python for ML pipeline",
    category="DECISION",
    importance=8
)
print(memory["memory_id"])  # 1
print(memory["tier"])       # episodic
print(memory["chain_sync"]) # pending -> synced in 30s

# Recall memories
memories = cm.recall(limit=10)
for m in memories:
    print(f"[{m['category']}] {m['summary']}")

# Get profile
profile = cm.profile()
print(f"Total memories: {profile['local_memories']}")
print(f"Synced to chain: {profile['synced_memories']}")

# Network stats (no API key needed)
stats = ChainMemory.stats()
print(f"Block: {stats['block']}")
print(f"Chain ID: {stats['chain_id']}")
```

## LangChain Integration

```python
from langchain.memory import ConversationBufferMemory
from chainmemory import ChainMemory

cm = ChainMemory(api_key="aic_...")
cm.register("LangChainAgent", "gpt-4")

# Save conversation turns to ChainMemory
def save_to_chainmemory(human_input, ai_output):
    cm.remember(
        f"User: {human_input[:140]} | AI: {ai_output[:140]}",
        category="INTERACTION",
        importance=5,
        platform="langchain"
    )
```

## Categories

| Category | Use Case |
|----------|----------|
| DECISION | Important decisions made |
| LEARNING | New knowledge acquired |
| INTERACTION | Conversation summaries |
| STATE | Agent state changes |
| ERROR | Errors and corrections |
| MILESTONE | Key achievements |
| CUSTOM | Everything else |

## Network

| Field | Value |
|-------|-------|
| Chain ID | 202604 |
| Currency | AIC (native) |
| RPC | https://rpc.chainmemory.ai |
| Explorer | https://chainmemory.ai |
| Faucet | https://faucet.chainmemory.ai |

## License

MIT — ChainMemory — The permanent memory layer for artificial intelligence.
