awareness-memory-cloud 2.4.3__tar.gz → 2.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/PKG-INFO +104 -3
- awareness_memory_cloud-2.5.0/README.md +405 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/awareness_memory_cloud.egg-info/PKG-INFO +104 -3
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/memory_cloud/client.py +29 -7
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/pyproject.toml +1 -1
- awareness_memory_cloud-2.4.3/README.md +0 -304
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/LICENSE +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/awareness_memory_cloud.egg-info/SOURCES.txt +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/awareness_memory_cloud.egg-info/dependency_links.txt +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/awareness_memory_cloud.egg-info/requires.txt +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/awareness_memory_cloud.egg-info/top_level.txt +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/memory_cloud/__init__.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/memory_cloud/errors.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/memory_cloud/export_reader.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/memory_cloud/integrations/__init__.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/memory_cloud/integrations/_base.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/memory_cloud/integrations/autogen.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/memory_cloud/integrations/crewai.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/memory_cloud/integrations/langchain.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/memory_cloud/integrations/praisonai.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/memory_cloud/interceptor.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/memory_cloud/query_rewrite.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/memory_cloud/quickstart.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/memory_cloud/types.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/setup.cfg +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/tests/test_client_chat_and_record.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/tests/test_client_crud.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/tests/test_client_extraction_passthrough.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/tests/test_client_recall_and_compaction.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/tests/test_client_tasks_agents_users.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/tests/test_client_upload_export_keys.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/tests/test_ecosystem_smoke.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/tests/test_export_reader.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/tests/test_integrations.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/tests/test_interceptor_response_format_fallback.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/tests/test_interceptor_wrap.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/tests/test_quickstart.py +0 -0
- {awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/tests/test_sdk_functional.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: awareness-memory-cloud
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.5.0
|
|
4
4
|
Summary: Python SDK for Awareness Memory Cloud
|
|
5
5
|
Author: Awareness Team
|
|
6
6
|
License: Apache License
|
|
@@ -249,12 +249,99 @@ Dynamic: license-file
|
|
|
249
249
|
|
|
250
250
|
# Awareness Memory SDK — Python
|
|
251
251
|
|
|
252
|
-
[](https://pypi.org/project/awareness-memory-cloud/) [](https://discord.com/invite/nMDrT538Qa)
|
|
252
|
+
[](https://pypi.org/project/awareness-memory-cloud/) [](https://arxiv.org/abs/2410.10813) [](https://discord.com/invite/nMDrT538Qa)
|
|
253
253
|
|
|
254
|
-
Python SDK for adding persistent memory to AI agents and apps.
|
|
254
|
+
Python SDK for adding persistent memory to AI agents and apps. **95.6% Recall@5 on [LongMemEval](https://arxiv.org/abs/2410.10813) (ICLR 2025)**.
|
|
255
255
|
|
|
256
256
|
Online docs: <https://awareness.market/docs?doc=python>
|
|
257
257
|
|
|
258
|
+
## Benchmark: LongMemEval (ICLR 2025)
|
|
259
|
+
|
|
260
|
+
Awareness Memory is evaluated on **[LongMemEval](https://arxiv.org/abs/2410.10813)** — the industry standard benchmark for long-term conversational memory, published at ICLR 2025. 500 human-curated questions across 5 core capabilities.
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
264
|
+
║ ║
|
|
265
|
+
║ Awareness Memory — LongMemEval Benchmark Results ║
|
|
266
|
+
║ ───────────────────────────────────────────────── ║
|
|
267
|
+
║ ║
|
|
268
|
+
║ Benchmark: LongMemEval (ICLR 2025) ║
|
|
269
|
+
║ Dataset: 500 human-curated questions ║
|
|
270
|
+
║ Variant: LongMemEval_S (~115k tokens per question) ║
|
|
271
|
+
║ ║
|
|
272
|
+
║ ┌─────────────────────────────────────────────────┐ ║
|
|
273
|
+
║ │ │ ║
|
|
274
|
+
║ │ Recall@1 77.6% (388 / 500) │ ║
|
|
275
|
+
║ │ Recall@3 91.8% (459 / 500) │ ║
|
|
276
|
+
║ │ Recall@5 95.6% (478 / 500) ◀ PRIMARY │ ║
|
|
277
|
+
║ │ Recall@10 97.4% (487 / 500) │ ║
|
|
278
|
+
║ │ │ ║
|
|
279
|
+
║ └─────────────────────────────────────────────────┘ ║
|
|
280
|
+
║ ║
|
|
281
|
+
║ Method: Hybrid RRF (BM25 + Semantic Vector Search) ║
|
|
282
|
+
║ Embedding: all-MiniLM-L6-v2 (384d) ║
|
|
283
|
+
║ LLM Calls: 0 (pure retrieval, no generation cost) ║
|
|
284
|
+
║ Hardware: Apple M1, 8GB RAM — 14 min total ║
|
|
285
|
+
║ ║
|
|
286
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Leaderboard
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
293
|
+
│ Long-Term Memory Retrieval — R@5 Leaderboard │
|
|
294
|
+
│ LongMemEval (ICLR 2025, 500 questions) │
|
|
295
|
+
├─────────────────────────────────┬───────────┬───────────────┤
|
|
296
|
+
│ System │ R@5 │ Note │
|
|
297
|
+
├─────────────────────────────────┼───────────┼───────────────┤
|
|
298
|
+
│ MemPalace (ChromaDB raw) │ 96.6% │ R@5 only * │
|
|
299
|
+
│ ★ Awareness Memory (Hybrid) │ 95.6% │ Hybrid RRF │
|
|
300
|
+
│ OMEGA │ 95.4% │ QA Accuracy │
|
|
301
|
+
│ Mastra (GPT-5-mini) │ 94.9% │ QA Accuracy │
|
|
302
|
+
│ Mastra (GPT-4o) │ 84.2% │ QA Accuracy │
|
|
303
|
+
│ Supermemory │ 81.6% │ QA Accuracy │
|
|
304
|
+
│ Zep / Graphiti │ 71.2% │ QA Accuracy │
|
|
305
|
+
│ GPT-4o (full context) │ 60.6% │ QA Accuracy │
|
|
306
|
+
├─────────────────────────────────┴───────────┴───────────────┤
|
|
307
|
+
│ * MemPalace 96.6% is Recall@5 only, not QA Accuracy. │
|
|
308
|
+
│ Palace hierarchy was NOT used in the evaluation. │
|
|
309
|
+
└─────────────────────────────────────────────────────────────┘
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### Accuracy by Question Type
|
|
313
|
+
|
|
314
|
+
```
|
|
315
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
316
|
+
│ Awareness Memory — R@5 by Question Type │
|
|
317
|
+
│ │
|
|
318
|
+
│ knowledge-update ████████████████████████████ 100% │
|
|
319
|
+
│ multi-session ███████████████████████████▋ 98.5%│
|
|
320
|
+
│ single-session-asst ███████████████████████████▌ 98.2%│
|
|
321
|
+
│ temporal-reasoning █████████████████████████▊ 94.7%│
|
|
322
|
+
│ single-session-user ████████████████████████▎ 88.6%│
|
|
323
|
+
│ single-session-pref ███████████████████████▏ 86.7%│
|
|
324
|
+
│ │
|
|
325
|
+
│ Overall █████████████████████████▉ 95.6%│
|
|
326
|
+
│ │
|
|
327
|
+
│ ┌───────────────────────────────────────────────┐ │
|
|
328
|
+
│ │ Ablation Study │ │
|
|
329
|
+
│ │ ───────────────────────────────────────── │ │
|
|
330
|
+
│ │ Vector-only: 92.6% ▓▓▓▓▓▓▓▓▓▓▓▓▓░░░ │ │
|
|
331
|
+
│ │ BM25-only: 91.4% ▓▓▓▓▓▓▓▓▓▓▓▓▓░░░ │ │
|
|
332
|
+
│ │ Hybrid RRF: 95.6% ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░ ★ │ │
|
|
333
|
+
│ │ Hybrid = +3% over any │ │
|
|
334
|
+
│ │ single method alone │ │
|
|
335
|
+
│ └───────────────────────────────────────────────┘ │
|
|
336
|
+
│ │
|
|
337
|
+
│ arxiv.org/abs/2410.10813 awareness.market │
|
|
338
|
+
└─────────────────────────────────────────────────────────────┘
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
Zero LLM calls. Runs on Apple M1 8GB in 14 minutes. [Reproducible benchmark scripts →](https://github.com/edwin-hao-ai/Awareness/tree/main/benchmarks/longmemeval)
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
258
345
|
## Install
|
|
259
346
|
|
|
260
347
|
```bash
|
|
@@ -551,3 +638,17 @@ export AWARENESS_OWNER_ID="your-owner-id"
|
|
|
551
638
|
|
|
552
639
|
python examples/e2e_langchain_cloud.py
|
|
553
640
|
```
|
|
641
|
+
|
|
642
|
+
---
|
|
643
|
+
|
|
644
|
+
## What makes Awareness different
|
|
645
|
+
|
|
646
|
+
Most memory systems pick one extraction strategy. Awareness combines them:
|
|
647
|
+
|
|
648
|
+
- **Hybrid retrieval by default** — BM25 full-text + vector cosine + knowledge-graph 1-hop expansion, fused with Reciprocal Rank Fusion. 95.6% R@5 on LongMemEval, zero LLM calls on the retrieval side.
|
|
649
|
+
- **Salience-aware extraction** — the client's own LLM self-scores every card on `novelty` / `durability` / `specificity`; cards below 0.4 on novelty or durability are dropped server-side. Framework metadata (`Sender (untrusted metadata)`, `turn_brief`) is filtered before extraction runs.
|
|
650
|
+
- **Project isolation** — `X-Awareness-Project-Dir` header scopes memory per project.
|
|
651
|
+
- **Zero-LLM backend** — all extraction runs on your LLM (Claude, GPT-4, Gemini, local Llama). The backend is a coordinator + storage layer; no inference costs pass through to you.
|
|
652
|
+
- **One memory, many clients** — same data reachable via Claude Code, OpenClaw, npm / pip / ClawHub, MCP server.
|
|
653
|
+
|
|
654
|
+
See [`docs/analysis/MEMPALACE_COMPARISON_2026-04-17.md`](https://github.com/edwin-hao-ai/Awareness/blob/main/docs/analysis/MEMPALACE_COMPARISON_2026-04-17.md) for the honest side-by-side against MemPalace.
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
# Awareness Memory SDK — Python
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/awareness-memory-cloud/) [](https://arxiv.org/abs/2410.10813) [](https://discord.com/invite/nMDrT538Qa)
|
|
4
|
+
|
|
5
|
+
Python SDK for adding persistent memory to AI agents and apps. **95.6% Recall@5 on [LongMemEval](https://arxiv.org/abs/2410.10813) (ICLR 2025)**.
|
|
6
|
+
|
|
7
|
+
Online docs: <https://awareness.market/docs?doc=python>
|
|
8
|
+
|
|
9
|
+
## Benchmark: LongMemEval (ICLR 2025)
|
|
10
|
+
|
|
11
|
+
Awareness Memory is evaluated on **[LongMemEval](https://arxiv.org/abs/2410.10813)** — the industry standard benchmark for long-term conversational memory, published at ICLR 2025. 500 human-curated questions across 5 core capabilities.
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
15
|
+
║ ║
|
|
16
|
+
║ Awareness Memory — LongMemEval Benchmark Results ║
|
|
17
|
+
║ ───────────────────────────────────────────────── ║
|
|
18
|
+
║ ║
|
|
19
|
+
║ Benchmark: LongMemEval (ICLR 2025) ║
|
|
20
|
+
║ Dataset: 500 human-curated questions ║
|
|
21
|
+
║ Variant: LongMemEval_S (~115k tokens per question) ║
|
|
22
|
+
║ ║
|
|
23
|
+
║ ┌─────────────────────────────────────────────────┐ ║
|
|
24
|
+
║ │ │ ║
|
|
25
|
+
║ │ Recall@1 77.6% (388 / 500) │ ║
|
|
26
|
+
║ │ Recall@3 91.8% (459 / 500) │ ║
|
|
27
|
+
║ │ Recall@5 95.6% (478 / 500) ◀ PRIMARY │ ║
|
|
28
|
+
║ │ Recall@10 97.4% (487 / 500) │ ║
|
|
29
|
+
║ │ │ ║
|
|
30
|
+
║ └─────────────────────────────────────────────────┘ ║
|
|
31
|
+
║ ║
|
|
32
|
+
║ Method: Hybrid RRF (BM25 + Semantic Vector Search) ║
|
|
33
|
+
║ Embedding: all-MiniLM-L6-v2 (384d) ║
|
|
34
|
+
║ LLM Calls: 0 (pure retrieval, no generation cost) ║
|
|
35
|
+
║ Hardware: Apple M1, 8GB RAM — 14 min total ║
|
|
36
|
+
║ ║
|
|
37
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Leaderboard
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
44
|
+
│ Long-Term Memory Retrieval — R@5 Leaderboard │
|
|
45
|
+
│ LongMemEval (ICLR 2025, 500 questions) │
|
|
46
|
+
├─────────────────────────────────┬───────────┬───────────────┤
|
|
47
|
+
│ System │ R@5 │ Note │
|
|
48
|
+
├─────────────────────────────────┼───────────┼───────────────┤
|
|
49
|
+
│ MemPalace (ChromaDB raw) │ 96.6% │ R@5 only * │
|
|
50
|
+
│ ★ Awareness Memory (Hybrid) │ 95.6% │ Hybrid RRF │
|
|
51
|
+
│ OMEGA │ 95.4% │ QA Accuracy │
|
|
52
|
+
│ Mastra (GPT-5-mini) │ 94.9% │ QA Accuracy │
|
|
53
|
+
│ Mastra (GPT-4o) │ 84.2% │ QA Accuracy │
|
|
54
|
+
│ Supermemory │ 81.6% │ QA Accuracy │
|
|
55
|
+
│ Zep / Graphiti │ 71.2% │ QA Accuracy │
|
|
56
|
+
│ GPT-4o (full context) │ 60.6% │ QA Accuracy │
|
|
57
|
+
├─────────────────────────────────┴───────────┴───────────────┤
|
|
58
|
+
│ * MemPalace 96.6% is Recall@5 only, not QA Accuracy. │
|
|
59
|
+
│ Palace hierarchy was NOT used in the evaluation. │
|
|
60
|
+
└─────────────────────────────────────────────────────────────┘
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Accuracy by Question Type
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
67
|
+
│ Awareness Memory — R@5 by Question Type │
|
|
68
|
+
│ │
|
|
69
|
+
│ knowledge-update ████████████████████████████ 100% │
|
|
70
|
+
│ multi-session ███████████████████████████▋ 98.5%│
|
|
71
|
+
│ single-session-asst ███████████████████████████▌ 98.2%│
|
|
72
|
+
│ temporal-reasoning █████████████████████████▊ 94.7%│
|
|
73
|
+
│ single-session-user ████████████████████████▎ 88.6%│
|
|
74
|
+
│ single-session-pref ███████████████████████▏ 86.7%│
|
|
75
|
+
│ │
|
|
76
|
+
│ Overall █████████████████████████▉ 95.6%│
|
|
77
|
+
│ │
|
|
78
|
+
│ ┌───────────────────────────────────────────────┐ │
|
|
79
|
+
│ │ Ablation Study │ │
|
|
80
|
+
│ │ ───────────────────────────────────────── │ │
|
|
81
|
+
│ │ Vector-only: 92.6% ▓▓▓▓▓▓▓▓▓▓▓▓▓░░░ │ │
|
|
82
|
+
│ │ BM25-only: 91.4% ▓▓▓▓▓▓▓▓▓▓▓▓▓░░░ │ │
|
|
83
|
+
│ │ Hybrid RRF: 95.6% ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░ ★ │ │
|
|
84
|
+
│ │ Hybrid = +3% over any │ │
|
|
85
|
+
│ │ single method alone │ │
|
|
86
|
+
│ └───────────────────────────────────────────────┘ │
|
|
87
|
+
│ │
|
|
88
|
+
│ arxiv.org/abs/2410.10813 awareness.market │
|
|
89
|
+
└─────────────────────────────────────────────────────────────┘
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Zero LLM calls. Runs on Apple M1 8GB in 14 minutes. [Reproducible benchmark scripts →](https://github.com/edwin-hao-ai/Awareness/tree/main/benchmarks/longmemeval)
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Install
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
pip install awareness-memory-cloud
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Framework extras:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pip install -e ".[langchain]" # LangChain adapter
|
|
106
|
+
pip install -e ".[crewai]" # CrewAI adapter
|
|
107
|
+
pip install -e ".[autogen]" # AutoGen adapter
|
|
108
|
+
pip install -e ".[frameworks]" # All frameworks
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Zero-Code Interceptor
|
|
114
|
+
|
|
115
|
+
**The fastest way to add memory.** One line — no changes to your AI logic.
|
|
116
|
+
|
|
117
|
+
### Local mode (no API key needed)
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
from openai import OpenAI
|
|
121
|
+
from memory_cloud import MemoryCloudClient, AwarenessInterceptor
|
|
122
|
+
|
|
123
|
+
client = MemoryCloudClient(mode="local") # data stays on your machine
|
|
124
|
+
interceptor = AwarenessInterceptor(client=client, memory_id="my-project")
|
|
125
|
+
|
|
126
|
+
openai_client = OpenAI()
|
|
127
|
+
interceptor.wrap_openai(openai_client) # one line — all conversations remembered
|
|
128
|
+
|
|
129
|
+
response = openai_client.chat.completions.create(
|
|
130
|
+
model="gpt-4",
|
|
131
|
+
messages=[{"role": "user", "content": "Refactor the auth module"}],
|
|
132
|
+
)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Cloud mode (team collaboration, semantic search, sync)
|
|
136
|
+
|
|
137
|
+
```python
|
|
138
|
+
from openai import OpenAI
|
|
139
|
+
from anthropic import Anthropic
|
|
140
|
+
from memory_cloud import MemoryCloudClient, AwarenessInterceptor
|
|
141
|
+
|
|
142
|
+
client = MemoryCloudClient(api_key="aw_...")
|
|
143
|
+
interceptor = AwarenessInterceptor(client=client, memory_id="memory_123")
|
|
144
|
+
|
|
145
|
+
# Wrap OpenAI
|
|
146
|
+
openai_client = OpenAI()
|
|
147
|
+
interceptor.wrap_openai(openai_client)
|
|
148
|
+
|
|
149
|
+
# Or wrap Anthropic
|
|
150
|
+
anthropic_client = Anthropic()
|
|
151
|
+
interceptor.wrap_anthropic(anthropic_client)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Direct API Quickstart
|
|
157
|
+
|
|
158
|
+
### Local mode
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
from memory_cloud import MemoryCloudClient
|
|
162
|
+
|
|
163
|
+
client = MemoryCloudClient(mode="local") # connects to local daemon at localhost:8765
|
|
164
|
+
|
|
165
|
+
client.record(content="Refactored auth middleware.")
|
|
166
|
+
result = client.retrieve(query="What did we refactor?")
|
|
167
|
+
print(result["results"])
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Cloud mode
|
|
171
|
+
|
|
172
|
+
```python
|
|
173
|
+
import os
|
|
174
|
+
from memory_cloud import MemoryCloudClient
|
|
175
|
+
|
|
176
|
+
client = MemoryCloudClient(
|
|
177
|
+
base_url=os.getenv("AWARENESS_API_BASE_URL", "https://awareness.market/api/v1"),
|
|
178
|
+
api_key="YOUR_API_KEY",
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
client.write(
|
|
182
|
+
memory_id="memory_123",
|
|
183
|
+
content="Customer asked for SOC2 evidence and retention policy.",
|
|
184
|
+
kwargs={"source": "python-sdk", "session_id": "demo-session"},
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
result = client.retrieve(
|
|
188
|
+
memory_id="memory_123",
|
|
189
|
+
query="What did customer ask for?",
|
|
190
|
+
custom_kwargs={"k": 3},
|
|
191
|
+
)
|
|
192
|
+
print(result["results"])
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## MCP-style Helpers
|
|
198
|
+
|
|
199
|
+
### Local mode
|
|
200
|
+
|
|
201
|
+
```python
|
|
202
|
+
client = MemoryCloudClient(mode="local")
|
|
203
|
+
client.record(content="Refactored auth middleware.")
|
|
204
|
+
ctx = client.recall_for_task(task="summarize auth changes", limit=8)
|
|
205
|
+
print(ctx["results"])
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Cloud mode
|
|
209
|
+
|
|
210
|
+
```python
|
|
211
|
+
client = MemoryCloudClient(
|
|
212
|
+
base_url="https://awareness.market/api/v1",
|
|
213
|
+
api_key="YOUR_API_KEY",
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
# Record a single step
|
|
217
|
+
client.record(memory_id="memory_123", content="Refactored auth middleware and added tests.")
|
|
218
|
+
|
|
219
|
+
# Record multiple steps at once
|
|
220
|
+
client.record(
|
|
221
|
+
memory_id="memory_123",
|
|
222
|
+
content=[
|
|
223
|
+
"Completed migration patch for user aliases.",
|
|
224
|
+
"Risk: API key owner mismatch can cause tenant leakage.",
|
|
225
|
+
],
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
# Record knowledge-scoped content
|
|
229
|
+
client.record(memory_id="memory_123", content="JWT decision doc", scope="knowledge")
|
|
230
|
+
|
|
231
|
+
ctx = client.recall_for_task(memory_id="memory_123", task="summarize latest auth changes", limit=8)
|
|
232
|
+
print(ctx["results"])
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## Framework Integrations
|
|
238
|
+
|
|
239
|
+
### LangChain
|
|
240
|
+
|
|
241
|
+
```python
|
|
242
|
+
from memory_cloud import MemoryCloudClient
|
|
243
|
+
from memory_cloud.integrations.langchain import MemoryCloudLangChain
|
|
244
|
+
import openai
|
|
245
|
+
|
|
246
|
+
# Local mode (no API key needed)
|
|
247
|
+
client = MemoryCloudClient(mode="local")
|
|
248
|
+
mc = MemoryCloudLangChain(client=client)
|
|
249
|
+
|
|
250
|
+
# Cloud mode (team collaboration, semantic search, multi-device sync)
|
|
251
|
+
client = MemoryCloudClient(base_url="https://awareness.market/api/v1", api_key="YOUR_API_KEY")
|
|
252
|
+
mc = MemoryCloudLangChain(client=client, memory_id="memory_123")
|
|
253
|
+
|
|
254
|
+
mc.wrap_llm(openai.OpenAI())
|
|
255
|
+
retriever = mc.as_retriever()
|
|
256
|
+
docs = retriever._get_relevant_documents("What did we decide yesterday?")
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### CrewAI
|
|
260
|
+
|
|
261
|
+
```python
|
|
262
|
+
from memory_cloud import MemoryCloudClient
|
|
263
|
+
from memory_cloud.integrations.crewai import MemoryCloudCrewAI
|
|
264
|
+
import openai
|
|
265
|
+
|
|
266
|
+
# Local mode (no API key needed)
|
|
267
|
+
client = MemoryCloudClient(mode="local")
|
|
268
|
+
mc = MemoryCloudCrewAI(client=client)
|
|
269
|
+
|
|
270
|
+
# Cloud mode (team collaboration, semantic search, multi-device sync)
|
|
271
|
+
client = MemoryCloudClient(base_url="https://awareness.market/api/v1", api_key="YOUR_API_KEY")
|
|
272
|
+
mc = MemoryCloudCrewAI(client=client, memory_id="memory_123")
|
|
273
|
+
|
|
274
|
+
mc.wrap_llm(openai.OpenAI())
|
|
275
|
+
result = mc.memory_search("What happened?")
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### PraisonAI
|
|
279
|
+
|
|
280
|
+
```python
|
|
281
|
+
from memory_cloud import MemoryCloudClient
|
|
282
|
+
from memory_cloud.integrations.praisonai import MemoryCloudPraisonAI
|
|
283
|
+
import openai
|
|
284
|
+
|
|
285
|
+
# Local mode (no API key needed)
|
|
286
|
+
client = MemoryCloudClient(mode="local")
|
|
287
|
+
mc = MemoryCloudPraisonAI(client=client)
|
|
288
|
+
|
|
289
|
+
# Cloud mode (team collaboration, semantic search, multi-device sync)
|
|
290
|
+
client = MemoryCloudClient(base_url="https://awareness.market/api/v1", api_key="YOUR_API_KEY")
|
|
291
|
+
mc = MemoryCloudPraisonAI(client=client, memory_id="memory_123")
|
|
292
|
+
|
|
293
|
+
mc.wrap_llm(openai.OpenAI())
|
|
294
|
+
tools = mc.build_tools()
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### AutoGen / AG2
|
|
298
|
+
|
|
299
|
+
```python
|
|
300
|
+
from memory_cloud import MemoryCloudClient
|
|
301
|
+
from memory_cloud.integrations.autogen import MemoryCloudAutoGen
|
|
302
|
+
|
|
303
|
+
# Local mode (no API key needed)
|
|
304
|
+
client = MemoryCloudClient(mode="local")
|
|
305
|
+
mc = MemoryCloudAutoGen(client=client)
|
|
306
|
+
|
|
307
|
+
# Cloud mode (team collaboration, semantic search, multi-device sync)
|
|
308
|
+
client = MemoryCloudClient(base_url="https://awareness.market/api/v1", api_key="YOUR_API_KEY")
|
|
309
|
+
mc = MemoryCloudAutoGen(client=client, memory_id="memory_123")
|
|
310
|
+
|
|
311
|
+
mc.inject_into_agent(assistant)
|
|
312
|
+
mc.register_tools(caller=assistant, executor=user_proxy)
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## Perception (Record-Time Signals)
|
|
318
|
+
|
|
319
|
+
When you call `record()`, the response may include a `perception` array -- automatic signals the system surfaces without you asking. These are computed from pure DB queries (no LLM calls), adding less than 50ms of latency.
|
|
320
|
+
|
|
321
|
+
**Signal types:**
|
|
322
|
+
|
|
323
|
+
| Type | Description |
|
|
324
|
+
|------|-------------|
|
|
325
|
+
| `contradiction` | New content conflicts with an existing knowledge card |
|
|
326
|
+
| `resonance` | Similar past experience found in memory |
|
|
327
|
+
| `pattern` | Recurring theme detected (e.g., same category appearing often) |
|
|
328
|
+
| `staleness` | A related knowledge card hasn't been updated in a long time |
|
|
329
|
+
| `related_decision` | A past decision is relevant to what you just recorded |
|
|
330
|
+
|
|
331
|
+
```python
|
|
332
|
+
result = client.record(memory_id, content="Decided to use RS256 for JWT signing", insights={
|
|
333
|
+
"knowledge_cards": [{"title": "JWT signing", "category": "decision", "summary": "Use RS256"}]
|
|
334
|
+
})
|
|
335
|
+
if result.get("perception"):
|
|
336
|
+
for signal in result["perception"]:
|
|
337
|
+
print(f"[{signal['type']}] {signal['message']}")
|
|
338
|
+
# [pattern] This is the 4th 'decision' card -- recurring theme
|
|
339
|
+
# [resonance] Similar past experience: "JWT auth migration"
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
## API Coverage
|
|
345
|
+
|
|
346
|
+
`MemoryCloudClient` includes:
|
|
347
|
+
|
|
348
|
+
- Memory: `create_memory`, `list_memories`, `get_memory`, `update_memory`, `delete_memory`
|
|
349
|
+
- Content: `write`, `list_memory_content`, `delete_memory_content`
|
|
350
|
+
- Retrieval/Chat: `retrieve`, `chat`, `chat_stream`, `memory_timeline`
|
|
351
|
+
- MCP ingest: `ingest_events`, `record`
|
|
352
|
+
- Export: `export_memory_package`, `save_export_memory_package`
|
|
353
|
+
- Async jobs & upload: `get_async_job_status`, `upload_file`, `get_upload_job_status`
|
|
354
|
+
- Insights/API keys/wizard: `insights`, `create_api_key`, `list_api_keys`, `revoke_api_key`, `memory_wizard`
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
## Read Exported Packages
|
|
359
|
+
|
|
360
|
+
```python
|
|
361
|
+
from memory_cloud import read_export_package
|
|
362
|
+
|
|
363
|
+
parsed = read_export_package("memory_export.zip")
|
|
364
|
+
print(parsed["manifest"])
|
|
365
|
+
print(len(parsed["chunks"]))
|
|
366
|
+
print(bool(parsed["safetensors"]))
|
|
367
|
+
print(parsed.get("kv_summary"))
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
Readers: `read_export_package(path)`, `read_export_package_bytes(bytes)`, `parse_jsonl_bytes(bytes)`
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
## Examples
|
|
375
|
+
|
|
376
|
+
- Basic flow: `examples/basic_flow.py`
|
|
377
|
+
- Export + read package: `examples/export_and_read.py`
|
|
378
|
+
- LangChain e2e (real cloud API): `examples/e2e_langchain_cloud.py`
|
|
379
|
+
- CrewAI e2e (real cloud API): `examples/e2e_crewai_cloud.py`
|
|
380
|
+
- PraisonAI e2e (real cloud API): `examples/e2e_praisonai_cloud.py`
|
|
381
|
+
- AutoGen e2e (real cloud API): `examples/e2e_autogen_cloud.py`
|
|
382
|
+
|
|
383
|
+
## End-to-End (Real Cloud API)
|
|
384
|
+
|
|
385
|
+
```bash
|
|
386
|
+
export AWARENESS_API_BASE_URL="https://awareness.market/api/v1"
|
|
387
|
+
export AWARENESS_API_KEY="aw_xxx"
|
|
388
|
+
export AWARENESS_OWNER_ID="your-owner-id"
|
|
389
|
+
|
|
390
|
+
python examples/e2e_langchain_cloud.py
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
## What makes Awareness different
|
|
396
|
+
|
|
397
|
+
Most memory systems pick one extraction strategy. Awareness combines them:
|
|
398
|
+
|
|
399
|
+
- **Hybrid retrieval by default** — BM25 full-text + vector cosine + knowledge-graph 1-hop expansion, fused with Reciprocal Rank Fusion. 95.6% R@5 on LongMemEval, zero LLM calls on the retrieval side.
|
|
400
|
+
- **Salience-aware extraction** — the client's own LLM self-scores every card on `novelty` / `durability` / `specificity`; cards below 0.4 on novelty or durability are dropped server-side. Framework metadata (`Sender (untrusted metadata)`, `turn_brief`) is filtered before extraction runs.
|
|
401
|
+
- **Project isolation** — `X-Awareness-Project-Dir` header scopes memory per project.
|
|
402
|
+
- **Zero-LLM backend** — all extraction runs on your LLM (Claude, GPT-4, Gemini, local Llama). The backend is a coordinator + storage layer; no inference costs pass through to you.
|
|
403
|
+
- **One memory, many clients** — same data reachable via Claude Code, OpenClaw, npm / pip / ClawHub, MCP server.
|
|
404
|
+
|
|
405
|
+
See [`docs/analysis/MEMPALACE_COMPARISON_2026-04-17.md`](https://github.com/edwin-hao-ai/Awareness/blob/main/docs/analysis/MEMPALACE_COMPARISON_2026-04-17.md) for the honest side-by-side against MemPalace.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: awareness-memory-cloud
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.5.0
|
|
4
4
|
Summary: Python SDK for Awareness Memory Cloud
|
|
5
5
|
Author: Awareness Team
|
|
6
6
|
License: Apache License
|
|
@@ -249,12 +249,99 @@ Dynamic: license-file
|
|
|
249
249
|
|
|
250
250
|
# Awareness Memory SDK — Python
|
|
251
251
|
|
|
252
|
-
[](https://pypi.org/project/awareness-memory-cloud/) [](https://discord.com/invite/nMDrT538Qa)
|
|
252
|
+
[](https://pypi.org/project/awareness-memory-cloud/) [](https://arxiv.org/abs/2410.10813) [](https://discord.com/invite/nMDrT538Qa)
|
|
253
253
|
|
|
254
|
-
Python SDK for adding persistent memory to AI agents and apps.
|
|
254
|
+
Python SDK for adding persistent memory to AI agents and apps. **95.6% Recall@5 on [LongMemEval](https://arxiv.org/abs/2410.10813) (ICLR 2025)**.
|
|
255
255
|
|
|
256
256
|
Online docs: <https://awareness.market/docs?doc=python>
|
|
257
257
|
|
|
258
|
+
## Benchmark: LongMemEval (ICLR 2025)
|
|
259
|
+
|
|
260
|
+
Awareness Memory is evaluated on **[LongMemEval](https://arxiv.org/abs/2410.10813)** — the industry standard benchmark for long-term conversational memory, published at ICLR 2025. 500 human-curated questions across 5 core capabilities.
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
264
|
+
║ ║
|
|
265
|
+
║ Awareness Memory — LongMemEval Benchmark Results ║
|
|
266
|
+
║ ───────────────────────────────────────────────── ║
|
|
267
|
+
║ ║
|
|
268
|
+
║ Benchmark: LongMemEval (ICLR 2025) ║
|
|
269
|
+
║ Dataset: 500 human-curated questions ║
|
|
270
|
+
║ Variant: LongMemEval_S (~115k tokens per question) ║
|
|
271
|
+
║ ║
|
|
272
|
+
║ ┌─────────────────────────────────────────────────┐ ║
|
|
273
|
+
║ │ │ ║
|
|
274
|
+
║ │ Recall@1 77.6% (388 / 500) │ ║
|
|
275
|
+
║ │ Recall@3 91.8% (459 / 500) │ ║
|
|
276
|
+
║ │ Recall@5 95.6% (478 / 500) ◀ PRIMARY │ ║
|
|
277
|
+
║ │ Recall@10 97.4% (487 / 500) │ ║
|
|
278
|
+
║ │ │ ║
|
|
279
|
+
║ └─────────────────────────────────────────────────┘ ║
|
|
280
|
+
║ ║
|
|
281
|
+
║ Method: Hybrid RRF (BM25 + Semantic Vector Search) ║
|
|
282
|
+
║ Embedding: all-MiniLM-L6-v2 (384d) ║
|
|
283
|
+
║ LLM Calls: 0 (pure retrieval, no generation cost) ║
|
|
284
|
+
║ Hardware: Apple M1, 8GB RAM — 14 min total ║
|
|
285
|
+
║ ║
|
|
286
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Leaderboard
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
293
|
+
│ Long-Term Memory Retrieval — R@5 Leaderboard │
|
|
294
|
+
│ LongMemEval (ICLR 2025, 500 questions) │
|
|
295
|
+
├─────────────────────────────────┬───────────┬───────────────┤
|
|
296
|
+
│ System │ R@5 │ Note │
|
|
297
|
+
├─────────────────────────────────┼───────────┼───────────────┤
|
|
298
|
+
│ MemPalace (ChromaDB raw) │ 96.6% │ R@5 only * │
|
|
299
|
+
│ ★ Awareness Memory (Hybrid) │ 95.6% │ Hybrid RRF │
|
|
300
|
+
│ OMEGA │ 95.4% │ QA Accuracy │
|
|
301
|
+
│ Mastra (GPT-5-mini) │ 94.9% │ QA Accuracy │
|
|
302
|
+
│ Mastra (GPT-4o) │ 84.2% │ QA Accuracy │
|
|
303
|
+
│ Supermemory │ 81.6% │ QA Accuracy │
|
|
304
|
+
│ Zep / Graphiti │ 71.2% │ QA Accuracy │
|
|
305
|
+
│ GPT-4o (full context) │ 60.6% │ QA Accuracy │
|
|
306
|
+
├─────────────────────────────────┴───────────┴───────────────┤
|
|
307
|
+
│ * MemPalace 96.6% is Recall@5 only, not QA Accuracy. │
|
|
308
|
+
│ Palace hierarchy was NOT used in the evaluation. │
|
|
309
|
+
└─────────────────────────────────────────────────────────────┘
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### Accuracy by Question Type
|
|
313
|
+
|
|
314
|
+
```
|
|
315
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
316
|
+
│ Awareness Memory — R@5 by Question Type │
|
|
317
|
+
│ │
|
|
318
|
+
│ knowledge-update ████████████████████████████ 100% │
|
|
319
|
+
│ multi-session ███████████████████████████▋ 98.5%│
|
|
320
|
+
│ single-session-asst ███████████████████████████▌ 98.2%│
|
|
321
|
+
│ temporal-reasoning █████████████████████████▊ 94.7%│
|
|
322
|
+
│ single-session-user ████████████████████████▎ 88.6%│
|
|
323
|
+
│ single-session-pref ███████████████████████▏ 86.7%│
|
|
324
|
+
│ │
|
|
325
|
+
│ Overall █████████████████████████▉ 95.6%│
|
|
326
|
+
│ │
|
|
327
|
+
│ ┌───────────────────────────────────────────────┐ │
|
|
328
|
+
│ │ Ablation Study │ │
|
|
329
|
+
│ │ ───────────────────────────────────────── │ │
|
|
330
|
+
│ │ Vector-only: 92.6% ▓▓▓▓▓▓▓▓▓▓▓▓▓░░░ │ │
|
|
331
|
+
│ │ BM25-only: 91.4% ▓▓▓▓▓▓▓▓▓▓▓▓▓░░░ │ │
|
|
332
|
+
│ │ Hybrid RRF: 95.6% ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░ ★ │ │
|
|
333
|
+
│ │ Hybrid = +3% over any │ │
|
|
334
|
+
│ │ single method alone │ │
|
|
335
|
+
│ └───────────────────────────────────────────────┘ │
|
|
336
|
+
│ │
|
|
337
|
+
│ arxiv.org/abs/2410.10813 awareness.market │
|
|
338
|
+
└─────────────────────────────────────────────────────────────┘
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
Zero LLM calls. Runs on Apple M1 8GB in 14 minutes. [Reproducible benchmark scripts →](https://github.com/edwin-hao-ai/Awareness/tree/main/benchmarks/longmemeval)
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
258
345
|
## Install
|
|
259
346
|
|
|
260
347
|
```bash
|
|
@@ -551,3 +638,17 @@ export AWARENESS_OWNER_ID="your-owner-id"
|
|
|
551
638
|
|
|
552
639
|
python examples/e2e_langchain_cloud.py
|
|
553
640
|
```
|
|
641
|
+
|
|
642
|
+
---
|
|
643
|
+
|
|
644
|
+
## What makes Awareness different
|
|
645
|
+
|
|
646
|
+
Most memory systems pick one extraction strategy. Awareness combines them:
|
|
647
|
+
|
|
648
|
+
- **Hybrid retrieval by default** — BM25 full-text + vector cosine + knowledge-graph 1-hop expansion, fused with Reciprocal Rank Fusion. 95.6% R@5 on LongMemEval, zero LLM calls on the retrieval side.
|
|
649
|
+
- **Salience-aware extraction** — the client's own LLM self-scores every card on `novelty` / `durability` / `specificity`; cards below 0.4 on novelty or durability are dropped server-side. Framework metadata (`Sender (untrusted metadata)`, `turn_brief`) is filtered before extraction runs.
|
|
650
|
+
- **Project isolation** — `X-Awareness-Project-Dir` header scopes memory per project.
|
|
651
|
+
- **Zero-LLM backend** — all extraction runs on your LLM (Claude, GPT-4, Gemini, local Llama). The backend is a coordinator + storage layer; no inference costs pass through to you.
|
|
652
|
+
- **One memory, many clients** — same data reachable via Claude Code, OpenClaw, npm / pip / ClawHub, MCP server.
|
|
653
|
+
|
|
654
|
+
See [`docs/analysis/MEMPALACE_COMPARISON_2026-04-17.md`](https://github.com/edwin-hao-ai/Awareness/blob/main/docs/analysis/MEMPALACE_COMPARISON_2026-04-17.md) for the honest side-by-side against MemPalace.
|
|
@@ -421,20 +421,34 @@ class MemoryCloudClient:
|
|
|
421
421
|
body["ids"] = ids
|
|
422
422
|
|
|
423
423
|
# Local daemon bridge: route through awareness_recall MCP tool.
|
|
424
|
+
# F-053 single-parameter surface — pass only `query` and let the daemon
|
|
425
|
+
# auto-route (query-type classifier + recency channel + budget-tier
|
|
426
|
+
# shaping). Legacy fields are still forwarded for backwards-compat with
|
|
427
|
+
# pre-F-053 daemons but marked explicitly so server-side deprecation
|
|
428
|
+
# logging can trace who's still sending them.
|
|
424
429
|
if self._should_use_daemon():
|
|
425
430
|
daemon_args: Dict[str, Any] = {
|
|
426
|
-
"
|
|
431
|
+
"query": query,
|
|
427
432
|
"limit": limit,
|
|
428
|
-
"detail": detail or "summary",
|
|
429
433
|
}
|
|
430
|
-
|
|
434
|
+
# Token budget drives bucket shaping (raw-heavy / mixed / card-only).
|
|
435
|
+
# Callers can override via custom_kwargs["token_budget"].
|
|
436
|
+
token_budget = (custom_kwargs or {}).get("token_budget")
|
|
437
|
+
if token_budget is not None:
|
|
438
|
+
daemon_args["token_budget"] = int(token_budget)
|
|
439
|
+
if agent_role:
|
|
440
|
+
daemon_args["agent_role"] = agent_role
|
|
441
|
+
# Legacy fields — only forwarded if caller explicitly passed them.
|
|
442
|
+
# Daemon will log [deprecated param used] for these.
|
|
443
|
+
if effective_keyword and keyword_query is not None:
|
|
431
444
|
daemon_args["keyword_query"] = effective_keyword
|
|
432
445
|
if scope:
|
|
433
446
|
daemon_args["scope"] = scope
|
|
434
|
-
if recall_mode:
|
|
447
|
+
if recall_mode and recall_mode != "precise":
|
|
448
|
+
# "precise" is the SDK default — don't forward it as legacy.
|
|
435
449
|
daemon_args["recall_mode"] = recall_mode
|
|
436
|
-
if
|
|
437
|
-
daemon_args["
|
|
450
|
+
if detail is not None:
|
|
451
|
+
daemon_args["detail"] = detail
|
|
438
452
|
if ids:
|
|
439
453
|
daemon_args["ids"] = ids
|
|
440
454
|
daemon_result = self.call_local_daemon("awareness_recall", daemon_args)
|
|
@@ -1521,22 +1535,30 @@ class MemoryCloudClient:
|
|
|
1521
1535
|
self,
|
|
1522
1536
|
memory_id: str,
|
|
1523
1537
|
skill_id: str,
|
|
1538
|
+
outcome: Optional[str] = "success",
|
|
1524
1539
|
trace_id: Optional[str] = None,
|
|
1525
1540
|
) -> Dict[str, Any]:
|
|
1526
1541
|
"""
|
|
1527
|
-
Mark a skill as used
|
|
1542
|
+
Mark a skill as used with outcome feedback.
|
|
1528
1543
|
|
|
1529
1544
|
Args:
|
|
1530
1545
|
memory_id: Target memory id.
|
|
1531
1546
|
skill_id: The skill to mark as used.
|
|
1547
|
+
outcome: "success" (default), "partial", or "failed".
|
|
1548
|
+
Failed outcomes decrease confidence; 3+ consecutive
|
|
1549
|
+
failures auto-flag the skill for review.
|
|
1532
1550
|
trace_id: Optional trace id.
|
|
1533
1551
|
|
|
1534
1552
|
Returns:
|
|
1535
1553
|
Updated skill data.
|
|
1536
1554
|
"""
|
|
1555
|
+
body = None
|
|
1556
|
+
if outcome and outcome != "success":
|
|
1557
|
+
body = {"outcome": outcome}
|
|
1537
1558
|
data, resolved_trace = self._request(
|
|
1538
1559
|
method="POST",
|
|
1539
1560
|
path=f"/memories/{memory_id}/skills/{skill_id}/use",
|
|
1561
|
+
json_payload=body,
|
|
1540
1562
|
trace_id=trace_id,
|
|
1541
1563
|
)
|
|
1542
1564
|
return self._attach_trace(data, resolved_trace)
|
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
# Awareness Memory SDK — Python
|
|
2
|
-
|
|
3
|
-
[](https://pypi.org/project/awareness-memory-cloud/) [](https://discord.com/invite/nMDrT538Qa)
|
|
4
|
-
|
|
5
|
-
Python SDK for adding persistent memory to AI agents and apps.
|
|
6
|
-
|
|
7
|
-
Online docs: <https://awareness.market/docs?doc=python>
|
|
8
|
-
|
|
9
|
-
## Install
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
pip install awareness-memory-cloud
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Framework extras:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
pip install -e ".[langchain]" # LangChain adapter
|
|
19
|
-
pip install -e ".[crewai]" # CrewAI adapter
|
|
20
|
-
pip install -e ".[autogen]" # AutoGen adapter
|
|
21
|
-
pip install -e ".[frameworks]" # All frameworks
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## Zero-Code Interceptor
|
|
27
|
-
|
|
28
|
-
**The fastest way to add memory.** One line — no changes to your AI logic.
|
|
29
|
-
|
|
30
|
-
### Local mode (no API key needed)
|
|
31
|
-
|
|
32
|
-
```python
|
|
33
|
-
from openai import OpenAI
|
|
34
|
-
from memory_cloud import MemoryCloudClient, AwarenessInterceptor
|
|
35
|
-
|
|
36
|
-
client = MemoryCloudClient(mode="local") # data stays on your machine
|
|
37
|
-
interceptor = AwarenessInterceptor(client=client, memory_id="my-project")
|
|
38
|
-
|
|
39
|
-
openai_client = OpenAI()
|
|
40
|
-
interceptor.wrap_openai(openai_client) # one line — all conversations remembered
|
|
41
|
-
|
|
42
|
-
response = openai_client.chat.completions.create(
|
|
43
|
-
model="gpt-4",
|
|
44
|
-
messages=[{"role": "user", "content": "Refactor the auth module"}],
|
|
45
|
-
)
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Cloud mode (team collaboration, semantic search, sync)
|
|
49
|
-
|
|
50
|
-
```python
|
|
51
|
-
from openai import OpenAI
|
|
52
|
-
from anthropic import Anthropic
|
|
53
|
-
from memory_cloud import MemoryCloudClient, AwarenessInterceptor
|
|
54
|
-
|
|
55
|
-
client = MemoryCloudClient(api_key="aw_...")
|
|
56
|
-
interceptor = AwarenessInterceptor(client=client, memory_id="memory_123")
|
|
57
|
-
|
|
58
|
-
# Wrap OpenAI
|
|
59
|
-
openai_client = OpenAI()
|
|
60
|
-
interceptor.wrap_openai(openai_client)
|
|
61
|
-
|
|
62
|
-
# Or wrap Anthropic
|
|
63
|
-
anthropic_client = Anthropic()
|
|
64
|
-
interceptor.wrap_anthropic(anthropic_client)
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
---
|
|
68
|
-
|
|
69
|
-
## Direct API Quickstart
|
|
70
|
-
|
|
71
|
-
### Local mode
|
|
72
|
-
|
|
73
|
-
```python
|
|
74
|
-
from memory_cloud import MemoryCloudClient
|
|
75
|
-
|
|
76
|
-
client = MemoryCloudClient(mode="local") # connects to local daemon at localhost:8765
|
|
77
|
-
|
|
78
|
-
client.record(content="Refactored auth middleware.")
|
|
79
|
-
result = client.retrieve(query="What did we refactor?")
|
|
80
|
-
print(result["results"])
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Cloud mode
|
|
84
|
-
|
|
85
|
-
```python
|
|
86
|
-
import os
|
|
87
|
-
from memory_cloud import MemoryCloudClient
|
|
88
|
-
|
|
89
|
-
client = MemoryCloudClient(
|
|
90
|
-
base_url=os.getenv("AWARENESS_API_BASE_URL", "https://awareness.market/api/v1"),
|
|
91
|
-
api_key="YOUR_API_KEY",
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
client.write(
|
|
95
|
-
memory_id="memory_123",
|
|
96
|
-
content="Customer asked for SOC2 evidence and retention policy.",
|
|
97
|
-
kwargs={"source": "python-sdk", "session_id": "demo-session"},
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
result = client.retrieve(
|
|
101
|
-
memory_id="memory_123",
|
|
102
|
-
query="What did customer ask for?",
|
|
103
|
-
custom_kwargs={"k": 3},
|
|
104
|
-
)
|
|
105
|
-
print(result["results"])
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
---
|
|
109
|
-
|
|
110
|
-
## MCP-style Helpers
|
|
111
|
-
|
|
112
|
-
### Local mode
|
|
113
|
-
|
|
114
|
-
```python
|
|
115
|
-
client = MemoryCloudClient(mode="local")
|
|
116
|
-
client.record(content="Refactored auth middleware.")
|
|
117
|
-
ctx = client.recall_for_task(task="summarize auth changes", limit=8)
|
|
118
|
-
print(ctx["results"])
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### Cloud mode
|
|
122
|
-
|
|
123
|
-
```python
|
|
124
|
-
client = MemoryCloudClient(
|
|
125
|
-
base_url="https://awareness.market/api/v1",
|
|
126
|
-
api_key="YOUR_API_KEY",
|
|
127
|
-
)
|
|
128
|
-
|
|
129
|
-
# Record a single step
|
|
130
|
-
client.record(memory_id="memory_123", content="Refactored auth middleware and added tests.")
|
|
131
|
-
|
|
132
|
-
# Record multiple steps at once
|
|
133
|
-
client.record(
|
|
134
|
-
memory_id="memory_123",
|
|
135
|
-
content=[
|
|
136
|
-
"Completed migration patch for user aliases.",
|
|
137
|
-
"Risk: API key owner mismatch can cause tenant leakage.",
|
|
138
|
-
],
|
|
139
|
-
)
|
|
140
|
-
|
|
141
|
-
# Record knowledge-scoped content
|
|
142
|
-
client.record(memory_id="memory_123", content="JWT decision doc", scope="knowledge")
|
|
143
|
-
|
|
144
|
-
ctx = client.recall_for_task(memory_id="memory_123", task="summarize latest auth changes", limit=8)
|
|
145
|
-
print(ctx["results"])
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
---
|
|
149
|
-
|
|
150
|
-
## Framework Integrations
|
|
151
|
-
|
|
152
|
-
### LangChain
|
|
153
|
-
|
|
154
|
-
```python
|
|
155
|
-
from memory_cloud import MemoryCloudClient
|
|
156
|
-
from memory_cloud.integrations.langchain import MemoryCloudLangChain
|
|
157
|
-
import openai
|
|
158
|
-
|
|
159
|
-
# Local mode (no API key needed)
|
|
160
|
-
client = MemoryCloudClient(mode="local")
|
|
161
|
-
mc = MemoryCloudLangChain(client=client)
|
|
162
|
-
|
|
163
|
-
# Cloud mode (team collaboration, semantic search, multi-device sync)
|
|
164
|
-
client = MemoryCloudClient(base_url="https://awareness.market/api/v1", api_key="YOUR_API_KEY")
|
|
165
|
-
mc = MemoryCloudLangChain(client=client, memory_id="memory_123")
|
|
166
|
-
|
|
167
|
-
mc.wrap_llm(openai.OpenAI())
|
|
168
|
-
retriever = mc.as_retriever()
|
|
169
|
-
docs = retriever._get_relevant_documents("What did we decide yesterday?")
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### CrewAI
|
|
173
|
-
|
|
174
|
-
```python
|
|
175
|
-
from memory_cloud import MemoryCloudClient
|
|
176
|
-
from memory_cloud.integrations.crewai import MemoryCloudCrewAI
|
|
177
|
-
import openai
|
|
178
|
-
|
|
179
|
-
# Local mode (no API key needed)
|
|
180
|
-
client = MemoryCloudClient(mode="local")
|
|
181
|
-
mc = MemoryCloudCrewAI(client=client)
|
|
182
|
-
|
|
183
|
-
# Cloud mode (team collaboration, semantic search, multi-device sync)
|
|
184
|
-
client = MemoryCloudClient(base_url="https://awareness.market/api/v1", api_key="YOUR_API_KEY")
|
|
185
|
-
mc = MemoryCloudCrewAI(client=client, memory_id="memory_123")
|
|
186
|
-
|
|
187
|
-
mc.wrap_llm(openai.OpenAI())
|
|
188
|
-
result = mc.memory_search("What happened?")
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
### PraisonAI
|
|
192
|
-
|
|
193
|
-
```python
|
|
194
|
-
from memory_cloud import MemoryCloudClient
|
|
195
|
-
from memory_cloud.integrations.praisonai import MemoryCloudPraisonAI
|
|
196
|
-
import openai
|
|
197
|
-
|
|
198
|
-
# Local mode (no API key needed)
|
|
199
|
-
client = MemoryCloudClient(mode="local")
|
|
200
|
-
mc = MemoryCloudPraisonAI(client=client)
|
|
201
|
-
|
|
202
|
-
# Cloud mode (team collaboration, semantic search, multi-device sync)
|
|
203
|
-
client = MemoryCloudClient(base_url="https://awareness.market/api/v1", api_key="YOUR_API_KEY")
|
|
204
|
-
mc = MemoryCloudPraisonAI(client=client, memory_id="memory_123")
|
|
205
|
-
|
|
206
|
-
mc.wrap_llm(openai.OpenAI())
|
|
207
|
-
tools = mc.build_tools()
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
### AutoGen / AG2
|
|
211
|
-
|
|
212
|
-
```python
|
|
213
|
-
from memory_cloud import MemoryCloudClient
|
|
214
|
-
from memory_cloud.integrations.autogen import MemoryCloudAutoGen
|
|
215
|
-
|
|
216
|
-
# Local mode (no API key needed)
|
|
217
|
-
client = MemoryCloudClient(mode="local")
|
|
218
|
-
mc = MemoryCloudAutoGen(client=client)
|
|
219
|
-
|
|
220
|
-
# Cloud mode (team collaboration, semantic search, multi-device sync)
|
|
221
|
-
client = MemoryCloudClient(base_url="https://awareness.market/api/v1", api_key="YOUR_API_KEY")
|
|
222
|
-
mc = MemoryCloudAutoGen(client=client, memory_id="memory_123")
|
|
223
|
-
|
|
224
|
-
mc.inject_into_agent(assistant)
|
|
225
|
-
mc.register_tools(caller=assistant, executor=user_proxy)
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
---
|
|
229
|
-
|
|
230
|
-
## Perception (Record-Time Signals)
|
|
231
|
-
|
|
232
|
-
When you call `record()`, the response may include a `perception` array -- automatic signals the system surfaces without you asking. These are computed from pure DB queries (no LLM calls), adding less than 50ms of latency.
|
|
233
|
-
|
|
234
|
-
**Signal types:**
|
|
235
|
-
|
|
236
|
-
| Type | Description |
|
|
237
|
-
|------|-------------|
|
|
238
|
-
| `contradiction` | New content conflicts with an existing knowledge card |
|
|
239
|
-
| `resonance` | Similar past experience found in memory |
|
|
240
|
-
| `pattern` | Recurring theme detected (e.g., same category appearing often) |
|
|
241
|
-
| `staleness` | A related knowledge card hasn't been updated in a long time |
|
|
242
|
-
| `related_decision` | A past decision is relevant to what you just recorded |
|
|
243
|
-
|
|
244
|
-
```python
|
|
245
|
-
result = client.record(memory_id, content="Decided to use RS256 for JWT signing", insights={
|
|
246
|
-
"knowledge_cards": [{"title": "JWT signing", "category": "decision", "summary": "Use RS256"}]
|
|
247
|
-
})
|
|
248
|
-
if result.get("perception"):
|
|
249
|
-
for signal in result["perception"]:
|
|
250
|
-
print(f"[{signal['type']}] {signal['message']}")
|
|
251
|
-
# [pattern] This is the 4th 'decision' card -- recurring theme
|
|
252
|
-
# [resonance] Similar past experience: "JWT auth migration"
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
---
|
|
256
|
-
|
|
257
|
-
## API Coverage
|
|
258
|
-
|
|
259
|
-
`MemoryCloudClient` includes:
|
|
260
|
-
|
|
261
|
-
- Memory: `create_memory`, `list_memories`, `get_memory`, `update_memory`, `delete_memory`
|
|
262
|
-
- Content: `write`, `list_memory_content`, `delete_memory_content`
|
|
263
|
-
- Retrieval/Chat: `retrieve`, `chat`, `chat_stream`, `memory_timeline`
|
|
264
|
-
- MCP ingest: `ingest_events`, `record`
|
|
265
|
-
- Export: `export_memory_package`, `save_export_memory_package`
|
|
266
|
-
- Async jobs & upload: `get_async_job_status`, `upload_file`, `get_upload_job_status`
|
|
267
|
-
- Insights/API keys/wizard: `insights`, `create_api_key`, `list_api_keys`, `revoke_api_key`, `memory_wizard`
|
|
268
|
-
|
|
269
|
-
---
|
|
270
|
-
|
|
271
|
-
## Read Exported Packages
|
|
272
|
-
|
|
273
|
-
```python
|
|
274
|
-
from memory_cloud import read_export_package
|
|
275
|
-
|
|
276
|
-
parsed = read_export_package("memory_export.zip")
|
|
277
|
-
print(parsed["manifest"])
|
|
278
|
-
print(len(parsed["chunks"]))
|
|
279
|
-
print(bool(parsed["safetensors"]))
|
|
280
|
-
print(parsed.get("kv_summary"))
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
Readers: `read_export_package(path)`, `read_export_package_bytes(bytes)`, `parse_jsonl_bytes(bytes)`
|
|
284
|
-
|
|
285
|
-
---
|
|
286
|
-
|
|
287
|
-
## Examples
|
|
288
|
-
|
|
289
|
-
- Basic flow: `examples/basic_flow.py`
|
|
290
|
-
- Export + read package: `examples/export_and_read.py`
|
|
291
|
-
- LangChain e2e (real cloud API): `examples/e2e_langchain_cloud.py`
|
|
292
|
-
- CrewAI e2e (real cloud API): `examples/e2e_crewai_cloud.py`
|
|
293
|
-
- PraisonAI e2e (real cloud API): `examples/e2e_praisonai_cloud.py`
|
|
294
|
-
- AutoGen e2e (real cloud API): `examples/e2e_autogen_cloud.py`
|
|
295
|
-
|
|
296
|
-
## End-to-End (Real Cloud API)
|
|
297
|
-
|
|
298
|
-
```bash
|
|
299
|
-
export AWARENESS_API_BASE_URL="https://awareness.market/api/v1"
|
|
300
|
-
export AWARENESS_API_KEY="aw_xxx"
|
|
301
|
-
export AWARENESS_OWNER_ID="your-owner-id"
|
|
302
|
-
|
|
303
|
-
python examples/e2e_langchain_cloud.py
|
|
304
|
-
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/memory_cloud/integrations/__init__.py
RENAMED
|
File without changes
|
{awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/memory_cloud/integrations/_base.py
RENAMED
|
File without changes
|
{awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/memory_cloud/integrations/autogen.py
RENAMED
|
File without changes
|
{awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/memory_cloud/integrations/crewai.py
RENAMED
|
File without changes
|
{awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/memory_cloud/integrations/langchain.py
RENAMED
|
File without changes
|
{awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/memory_cloud/integrations/praisonai.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/tests/test_client_chat_and_record.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{awareness_memory_cloud-2.4.3 → awareness_memory_cloud-2.5.0}/tests/test_interceptor_wrap.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|