carrymem 0.1.2__py3-none-any.whl
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.
- carrymem-0.1.2.dist-info/METADATA +433 -0
- carrymem-0.1.2.dist-info/RECORD +63 -0
- carrymem-0.1.2.dist-info/WHEEL +5 -0
- carrymem-0.1.2.dist-info/entry_points.txt +7 -0
- carrymem-0.1.2.dist-info/licenses/LICENSE +21 -0
- carrymem-0.1.2.dist-info/top_level.txt +1 -0
- memory_classification_engine/__init__.py +78 -0
- memory_classification_engine/__main__.py +115 -0
- memory_classification_engine/__version__.py +1 -0
- memory_classification_engine/adapters/__init__.py +13 -0
- memory_classification_engine/adapters/base.py +527 -0
- memory_classification_engine/adapters/json_adapter.py +258 -0
- memory_classification_engine/adapters/loader.py +61 -0
- memory_classification_engine/adapters/obsidian_adapter.py +433 -0
- memory_classification_engine/adapters/sqlite_adapter.py +1280 -0
- memory_classification_engine/async_carrymem.py +164 -0
- memory_classification_engine/backup.py +161 -0
- memory_classification_engine/cache.py +121 -0
- memory_classification_engine/carrymem.py +991 -0
- memory_classification_engine/cli.py +1296 -0
- memory_classification_engine/conflict_detector.py +417 -0
- memory_classification_engine/context.py +245 -0
- memory_classification_engine/coordinators/__init__.py +7 -0
- memory_classification_engine/coordinators/classification_pipeline.py +257 -0
- memory_classification_engine/engine.py +195 -0
- memory_classification_engine/exceptions.py +51 -0
- memory_classification_engine/integration/__init__.py +8 -0
- memory_classification_engine/integration/layer2_mcp/__init__.py +21 -0
- memory_classification_engine/integration/layer2_mcp/__main__.py +18 -0
- memory_classification_engine/integration/layer2_mcp/handlers.py +396 -0
- memory_classification_engine/integration/layer2_mcp/http_server.py +249 -0
- memory_classification_engine/integration/layer2_mcp/server.py +296 -0
- memory_classification_engine/integration/layer2_mcp/tools.py +501 -0
- memory_classification_engine/layers/__init__.py +1 -0
- memory_classification_engine/layers/feedback_loop.py +377 -0
- memory_classification_engine/layers/pattern_analyzer.py +1434 -0
- memory_classification_engine/layers/rule_matcher.py +100 -0
- memory_classification_engine/layers/semantic_classifier.py +100 -0
- memory_classification_engine/merge.py +124 -0
- memory_classification_engine/py.typed +0 -0
- memory_classification_engine/quality_scorer.py +414 -0
- memory_classification_engine/scoring.py +84 -0
- memory_classification_engine/security/__init__.py +33 -0
- memory_classification_engine/security/audit.py +161 -0
- memory_classification_engine/security/encryption.py +218 -0
- memory_classification_engine/security/input_validator.py +494 -0
- memory_classification_engine/semantic/__init__.py +16 -0
- memory_classification_engine/semantic/data/__init__.py +15 -0
- memory_classification_engine/semantic/data/synonyms_daily_en.yaml +383 -0
- memory_classification_engine/semantic/data/synonyms_jp.yaml +501 -0
- memory_classification_engine/semantic/data/synonyms_technical_cn.yaml +454 -0
- memory_classification_engine/semantic/expander.py +320 -0
- memory_classification_engine/semantic/merger.py +245 -0
- memory_classification_engine/tui.py +320 -0
- memory_classification_engine/utils/__init__.py +1 -0
- memory_classification_engine/utils/config.py +93 -0
- memory_classification_engine/utils/confirmation.py +39 -0
- memory_classification_engine/utils/constants.py +68 -0
- memory_classification_engine/utils/helpers.py +146 -0
- memory_classification_engine/utils/language.py +293 -0
- memory_classification_engine/utils/logger.py +55 -0
- memory_classification_engine/utils/performance.py +303 -0
- memory_classification_engine/utils/validators.py +261 -0
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: carrymem
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Your portable AI memory layer. Classify, store, and recall what matters across models, tools, and devices.
|
|
5
|
+
Home-page: https://github.com/lulin70/carrymem
|
|
6
|
+
Author: lulin70
|
|
7
|
+
Author-email: lulin70@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: ai memory classification mcp agent persistence portable
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: PyYAML>=5.0
|
|
24
|
+
Provides-Extra: language
|
|
25
|
+
Requires-Dist: pycld2>=0.41; extra == "language"
|
|
26
|
+
Requires-Dist: langdetect>=1.0.9; extra == "language"
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-mock>=3.10; extra == "dev"
|
|
31
|
+
Requires-Dist: coverage[toml]>=7.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pre-commit>=3.0; extra == "dev"
|
|
33
|
+
Requires-Dist: build>=0.10; extra == "dev"
|
|
34
|
+
Requires-Dist: twine>=4.0; extra == "dev"
|
|
35
|
+
Requires-Dist: pycld2>=0.41; extra == "dev"
|
|
36
|
+
Requires-Dist: langdetect>=1.0.9; extra == "dev"
|
|
37
|
+
Requires-Dist: flake8>=6.0; extra == "dev"
|
|
38
|
+
Requires-Dist: black>=23.0; extra == "dev"
|
|
39
|
+
Requires-Dist: isort>=5.12; extra == "dev"
|
|
40
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
41
|
+
Provides-Extra: encryption
|
|
42
|
+
Requires-Dist: cryptography>=41.0; extra == "encryption"
|
|
43
|
+
Provides-Extra: tui
|
|
44
|
+
Requires-Dist: textual>=0.40; extra == "tui"
|
|
45
|
+
Dynamic: author
|
|
46
|
+
Dynamic: author-email
|
|
47
|
+
Dynamic: classifier
|
|
48
|
+
Dynamic: description
|
|
49
|
+
Dynamic: description-content-type
|
|
50
|
+
Dynamic: home-page
|
|
51
|
+
Dynamic: keywords
|
|
52
|
+
Dynamic: license
|
|
53
|
+
Dynamic: license-file
|
|
54
|
+
Dynamic: provides-extra
|
|
55
|
+
Dynamic: requires-dist
|
|
56
|
+
Dynamic: requires-python
|
|
57
|
+
Dynamic: summary
|
|
58
|
+
|
|
59
|
+
# CarryMem — The Identity Layer for AI
|
|
60
|
+
|
|
61
|
+
**AI remembers who you are. Not just what you said.**
|
|
62
|
+
|
|
63
|
+
> Your portable AI identity layer — preferences, decisions, and corrections that follow you across models, tools, and devices.
|
|
64
|
+
|
|
65
|
+
CarryMem is a lightweight, zero-dependency AI memory system that stores **who you are** — your preferences, decisions, corrections — and makes that identity available to any AI tool. Switch from Cursor to Claude Code, from GPT to Claude, your AI always knows you.
|
|
66
|
+
|
|
67
|
+
**English** | [中文](docs/i18n/README-CN.md) | [日本語](docs/i18n/README-JP.md)
|
|
68
|
+
|
|
69
|
+
<p align="center">
|
|
70
|
+
<img src="https://img.shields.io/badge/version-0.1.2-blue" alt="Version">
|
|
71
|
+
<img src="https://img.shields.io/badge/tests-490%20passing-green" alt="Tests">
|
|
72
|
+
<img src="https://img.shields.io/badge/coverage-61%25-yellow" alt="Coverage">
|
|
73
|
+
<img src="https://img.shields.io/badge/accuracy-90.6%25-green" alt="Accuracy">
|
|
74
|
+
<img src="https://img.shields.io/badge/zero--dependencies-core-brightgreen" alt="Zero Deps">
|
|
75
|
+
</p>
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Why CarryMem?
|
|
80
|
+
|
|
81
|
+
### The Problem: AI Always Forgets Who You Are
|
|
82
|
+
|
|
83
|
+
Every new conversation, AI starts from zero:
|
|
84
|
+
- You prefer dark mode? **Forgotten.**
|
|
85
|
+
- You corrected it last time? **Forgotten.**
|
|
86
|
+
- You decided to use React? **Forgotten.**
|
|
87
|
+
|
|
88
|
+
Switch tools (Cursor → Windsurf), switch models (Claude → GPT) — start from scratch every time.
|
|
89
|
+
|
|
90
|
+
### The Solution: CarryMem Identity Layer
|
|
91
|
+
|
|
92
|
+
CarryMem doesn't just store text — it understands **who you are**:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
$ carrymem whoami
|
|
96
|
+
|
|
97
|
+
Who You Are (according to your AI)
|
|
98
|
+
==================================================
|
|
99
|
+
|
|
100
|
+
Your Preferences:
|
|
101
|
+
⭐ I prefer dark mode for all editors
|
|
102
|
+
⭐ I use PostgreSQL for databases
|
|
103
|
+
⭐ I always use Python for data analysis
|
|
104
|
+
|
|
105
|
+
Your Decisions:
|
|
106
|
+
🎯 Let's use React for the frontend
|
|
107
|
+
|
|
108
|
+
Your Corrections:
|
|
109
|
+
🔧 The port should be 5432, not 3306
|
|
110
|
+
|
|
111
|
+
Memory Profile:
|
|
112
|
+
Total: 19 | Dominant: user_preference | Avg Confidence: 73%
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Quick Start
|
|
118
|
+
|
|
119
|
+
### Install
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
pip install -e .
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### 5 Lines of Code
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
from memory_classification_engine import CarryMem
|
|
129
|
+
|
|
130
|
+
cm = CarryMem()
|
|
131
|
+
cm.classify_and_remember("I prefer dark mode") # Auto-classified as preference
|
|
132
|
+
cm.classify_and_remember("Use PostgreSQL not MySQL") # Auto-classified as correction
|
|
133
|
+
memories = cm.recall_memories("database") # Semantic recall
|
|
134
|
+
print(cm.build_system_prompt()) # Inject into any AI
|
|
135
|
+
cm.close()
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### CLI (19 commands)
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
carrymem init # Initialize
|
|
142
|
+
carrymem add "I prefer dark mode" # Store a memory
|
|
143
|
+
carrymem add "test note" --force # Force store (bypass classification)
|
|
144
|
+
carrymem list # List memories
|
|
145
|
+
carrymem search "theme" # Search memories
|
|
146
|
+
carrymem show <key> # View memory details
|
|
147
|
+
carrymem edit <key> "new content" # Edit a memory
|
|
148
|
+
carrymem forget <key> # Delete a memory
|
|
149
|
+
carrymem whoami # Who your AI thinks you are
|
|
150
|
+
carrymem profile export identity.json # Export your AI identity
|
|
151
|
+
carrymem stats # Memory statistics
|
|
152
|
+
carrymem check # Quality & conflict check
|
|
153
|
+
carrymem clean --expired --dry-run # Preview cleanup
|
|
154
|
+
carrymem doctor # Diagnose installation
|
|
155
|
+
carrymem setup-mcp --tool cursor # One-line MCP config
|
|
156
|
+
carrymem tui # Terminal UI
|
|
157
|
+
carrymem export backup.json # Export all memories
|
|
158
|
+
carrymem import backup.json # Import memories
|
|
159
|
+
carrymem version # Show version
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Core Features
|
|
165
|
+
|
|
166
|
+
### 1. Auto-Classification (7 Memory Types)
|
|
167
|
+
|
|
168
|
+
CarryMem automatically identifies what kind of information you're sharing:
|
|
169
|
+
|
|
170
|
+
| Type | Icon | Example |
|
|
171
|
+
|------|------|---------|
|
|
172
|
+
| `user_preference` | ⭐ | "I prefer dark mode" |
|
|
173
|
+
| `correction` | 🔧 | "No, I meant Python 3.11 not 3.10" |
|
|
174
|
+
| `decision` | 🎯 | "Let's use React for the frontend" |
|
|
175
|
+
| `fact_declaration` | 📌 | "Python 3.12 is the runtime version" |
|
|
176
|
+
| `relationship` | ❓ | "Sarah is my manager" |
|
|
177
|
+
| `task_pattern` | 🔄 | "I always write tests first" |
|
|
178
|
+
| `sentiment_marker` | 💭 | "This build is too slow" |
|
|
179
|
+
|
|
180
|
+
### 2. Semantic Recall (Cross-Language)
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
cm.classify_and_remember("我偏好使用PostgreSQL")
|
|
184
|
+
|
|
185
|
+
# All of these find it:
|
|
186
|
+
cm.recall_memories("PostgreSQL") # Exact match
|
|
187
|
+
cm.recall_memories("数据库") # Synonym expansion
|
|
188
|
+
cm.recall_memories("Postgres") # Spell correction
|
|
189
|
+
cm.recall_memories("データベース") # Cross-language (Japanese)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### 3. Identity Layer (whoami)
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
identity = cm.whoami()
|
|
196
|
+
print(identity["preferences"]) # ["I prefer dark mode", ...]
|
|
197
|
+
print(identity["decisions"]) # ["Let's use React", ...]
|
|
198
|
+
print(identity["corrections"]) # ["The port should be 5432", ...]
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### 4. Importance Scoring & Lifecycle
|
|
202
|
+
|
|
203
|
+
Every memory has an importance score that evolves over time:
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
importance = confidence × type_weight × recency_factor × access_factor
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
- **30-day half-life decay** — old memories fade unless accessed
|
|
210
|
+
- **Access reinforcement** — frequently recalled memories stay fresh
|
|
211
|
+
- **Type weighting** — corrections (1.3x) > decisions (1.2x) > preferences (1.1x)
|
|
212
|
+
|
|
213
|
+
### 5. Quality Management
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
carrymem check # Check all
|
|
217
|
+
carrymem check --conflicts # Detect contradictions
|
|
218
|
+
carrymem check --quality # Find low-quality memories
|
|
219
|
+
carrymem check --expired # Find expired memories
|
|
220
|
+
carrymem clean --expired --dry-run # Preview cleanup
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### 6. Security & Reliability
|
|
224
|
+
|
|
225
|
+
| Feature | Description |
|
|
226
|
+
|---------|-------------|
|
|
227
|
+
| **Encryption** | AES-128 (Fernet) or HMAC-CTR fallback, zero-dep |
|
|
228
|
+
| **Backup** | Zero-downtime SQLite VACUUM INTO |
|
|
229
|
+
| **Audit Log** | Append-only operation history |
|
|
230
|
+
| **Version History** | Every edit tracked, rollback supported |
|
|
231
|
+
| **Input Validation** | SQL injection, XSS, path traversal protection |
|
|
232
|
+
|
|
233
|
+
### 7. MCP Integration (One-Line Setup)
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
# Configure for Cursor
|
|
237
|
+
carrymem setup-mcp --tool cursor
|
|
238
|
+
|
|
239
|
+
# Configure for Claude Code
|
|
240
|
+
carrymem setup-mcp --tool claude-code
|
|
241
|
+
|
|
242
|
+
# Configure for all
|
|
243
|
+
carrymem setup-mcp --tool all
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
12 MCP tools available: Core (3) · Storage (3) · Knowledge (3) · Profile (2) · Prompt (1)
|
|
247
|
+
|
|
248
|
+
### 8. Terminal UI
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
pip install textual
|
|
252
|
+
carrymem tui
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Interactive terminal interface with sidebar filters, search, and add mode.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Comparison
|
|
260
|
+
|
|
261
|
+
| | CarryMem | Mem0 | OpenChronicle | ima |
|
|
262
|
+
|--|----------|------|---------------|-----|
|
|
263
|
+
| **Zero Dependencies** | ✅ SQLite only | ❌ Milvus needed | ✅ | ❌ Cloud |
|
|
264
|
+
| **Auto-Classification** | ✅ 7 types | ❌ | ❌ Manual | ❌ |
|
|
265
|
+
| **Identity Portrait** | ✅ whoami | ❌ | ❌ | ❌ |
|
|
266
|
+
| **CLI** | ✅ 19 commands | ❌ | ❌ | ❌ |
|
|
267
|
+
| **TUI** | ✅ textual | ❌ | ❌ | ✅ App |
|
|
268
|
+
| **Encryption** | ✅ Built-in | ❌ | ❌ | ❌ |
|
|
269
|
+
| **Version History** | ✅ Rollback | ❌ | ❌ | ❌ |
|
|
270
|
+
| **Conflict Detection** | ✅ Built-in | ❌ | ❌ | ❌ |
|
|
271
|
+
| **Data Ownership** | ✅ Local files | ⚠️ Cloud | ✅ Local | ❌ Cloud |
|
|
272
|
+
| **5-Line Integration** | ✅ | ❌ | ❌ | ❌ |
|
|
273
|
+
| **Cross-Language Recall** | ✅ EN/CN/JP | ❌ | ❌ | ❌ |
|
|
274
|
+
|
|
275
|
+
**Key Difference**: Other products store *what you read*. CarryMem stores *who you are*.
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## Performance
|
|
280
|
+
|
|
281
|
+
| Metric | Value |
|
|
282
|
+
|--------|-------|
|
|
283
|
+
| Classification Accuracy | **90.6%** |
|
|
284
|
+
| F1 Score | **97.9%** |
|
|
285
|
+
| Zero-Cost Classification | **60%+** |
|
|
286
|
+
| Recall Latency (P50) | **~45ms** |
|
|
287
|
+
| Tests Passing | **507/507** |
|
|
288
|
+
| Test Coverage | **62.54%** |
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Architecture
|
|
293
|
+
|
|
294
|
+
```
|
|
295
|
+
User Input
|
|
296
|
+
↓
|
|
297
|
+
Auto-Classification (7 types, 4 tiers)
|
|
298
|
+
↓
|
|
299
|
+
Importance Scoring (confidence × type × recency × access)
|
|
300
|
+
↓
|
|
301
|
+
Smart Storage (SQLite + FTS5, dedup, TTL, encryption)
|
|
302
|
+
↓
|
|
303
|
+
Semantic Recall (FTS5 + synonyms + spell fix + cross-language)
|
|
304
|
+
↓
|
|
305
|
+
Context Injection (token budget, relevance ranking)
|
|
306
|
+
↓
|
|
307
|
+
AI Tool (Cursor / Claude Code / any MCP client)
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
**Three-Tier Classification**:
|
|
311
|
+
```
|
|
312
|
+
Rule Engine (60%+) → Pattern Analysis (30%) → Semantic (10%)
|
|
313
|
+
↓ ↓ ↓
|
|
314
|
+
Zero cost Near-zero cost Token cost
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## Advanced Usage
|
|
320
|
+
|
|
321
|
+
### Obsidian Knowledge Base
|
|
322
|
+
|
|
323
|
+
```python
|
|
324
|
+
from memory_classification_engine import CarryMem, ObsidianAdapter
|
|
325
|
+
|
|
326
|
+
cm = CarryMem(knowledge_adapter=ObsidianAdapter("/path/to/vault"))
|
|
327
|
+
cm.index_knowledge()
|
|
328
|
+
results = cm.recall_from_knowledge("Python design patterns")
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Async API
|
|
332
|
+
|
|
333
|
+
```python
|
|
334
|
+
from memory_classification_engine import AsyncCarryMem
|
|
335
|
+
|
|
336
|
+
async with AsyncCarryMem() as cm:
|
|
337
|
+
await cm.classify_and_remember("I prefer dark mode")
|
|
338
|
+
memories = await cm.recall_memories("theme")
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### JSON Adapter (No SQLite)
|
|
342
|
+
|
|
343
|
+
```python
|
|
344
|
+
from memory_classification_engine import CarryMem, JSONAdapter
|
|
345
|
+
|
|
346
|
+
cm = CarryMem(adapter=JSONAdapter("/path/to/memories.json"))
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Encryption
|
|
350
|
+
|
|
351
|
+
```python
|
|
352
|
+
cm = CarryMem(encryption_key="my-secret-key")
|
|
353
|
+
# All content encrypted at rest, decrypted on read
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### Memory Versioning
|
|
357
|
+
|
|
358
|
+
```python
|
|
359
|
+
cm.update_memory(key, "Updated content") # Creates version 2
|
|
360
|
+
history = cm.get_memory_history(key) # [v1, v2]
|
|
361
|
+
cm.rollback_memory(key, version=1) # Restore v1
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Export Identity for Other AIs
|
|
365
|
+
|
|
366
|
+
```python
|
|
367
|
+
# Export your AI identity
|
|
368
|
+
cm.export_profile(output_path="my_identity.json")
|
|
369
|
+
|
|
370
|
+
# On another device or AI tool
|
|
371
|
+
cm.import_memories(input_path="backup.json")
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
## Documentation
|
|
377
|
+
|
|
378
|
+
- [Quick Start Guide](docs/QUICK_START_GUIDE.md)
|
|
379
|
+
- [Architecture](docs/ARCHITECTURE.md)
|
|
380
|
+
- [API Reference](docs/API_REFERENCE.md)
|
|
381
|
+
- [User Stories](docs/USER_STORIES.md)
|
|
382
|
+
- [Roadmap](docs/ROADMAP.md)
|
|
383
|
+
- [Contributing](CONTRIBUTING.md)
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
## Who Is This For?
|
|
388
|
+
|
|
389
|
+
**Developers** — Building AI agents that need to remember users across sessions
|
|
390
|
+
|
|
391
|
+
**Power Users** — Want AI tools (Cursor, Claude Code, Windsurf) to remember them
|
|
392
|
+
|
|
393
|
+
**Teams** — Share organizational knowledge through shared memory namespaces
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
## Project Status
|
|
398
|
+
|
|
399
|
+
**Current Version**: v0.1.2
|
|
400
|
+
**Tests**: 507/507 passing
|
|
401
|
+
**Coverage**: 62.54%
|
|
402
|
+
**Accuracy**: 90.6%
|
|
403
|
+
|
|
404
|
+
**v0.8.x Changelog**:
|
|
405
|
+
- v0.1.2: Identity layer (whoami, profile export), competitive differentiation
|
|
406
|
+
- v0.8.1: User-perspective CLI improvements (show/edit/clean, color output, --force)
|
|
407
|
+
- v0.8.0: Enhanced CLI (19 commands), TUI, MCP setup, doctor, quality management
|
|
408
|
+
- v0.7.0: MCP HTTP/SSE, JSON adapter, async API
|
|
409
|
+
- v0.6.0: Encryption, backup, audit logging
|
|
410
|
+
- v0.5.0: Smart context injection, importance scoring, cache, merge, versioning
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
## Contributing
|
|
415
|
+
|
|
416
|
+
```bash
|
|
417
|
+
git clone https://github.com/lulin70/carrymem.git
|
|
418
|
+
cd carrymem
|
|
419
|
+
pip install -e ".[dev]"
|
|
420
|
+
pytest
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
See [Contributing Guide](CONTRIBUTING.md) for details.
|
|
424
|
+
|
|
425
|
+
---
|
|
426
|
+
|
|
427
|
+
## License
|
|
428
|
+
|
|
429
|
+
MIT License — see [LICENSE](LICENSE)
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
**CarryMem — AI remembers who you are. Only you own the data.** 🚀
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
carrymem-0.1.2.dist-info/licenses/LICENSE,sha256=IyQ8KJWiNHXfkWd0NFq2g7V_7QOBZOrheFxBxPkPCls,1069
|
|
2
|
+
memory_classification_engine/__init__.py,sha256=pirWlJtwGNERFITLN4eCKO0d5HD6qDQtnLtmIP1-dgU,2376
|
|
3
|
+
memory_classification_engine/__main__.py,sha256=Gc-2tcJQ85nFX9_njHjzrSlxIx62rLtTYH2ewJx_Spo,3466
|
|
4
|
+
memory_classification_engine/__version__.py,sha256=YvuYzWnKtqBb-IqG8HAu-nhIYAsgj9Vmc_b9o7vO-js,22
|
|
5
|
+
memory_classification_engine/async_carrymem.py,sha256=FUhobyKXRsjIy1pDsM9rggNdnNYWcBQipK5UyYjmSag,5439
|
|
6
|
+
memory_classification_engine/backup.py,sha256=Tu0sN_BmiEbq7hqryP4Iw5XoZJN-CPPv0ttKLiZrbeY,5300
|
|
7
|
+
memory_classification_engine/cache.py,sha256=fA6js9xpyD5tCi0g9huCjck0rXmMJtoEjSg90fthvRE,3779
|
|
8
|
+
memory_classification_engine/carrymem.py,sha256=Ezf9ekpMDJl-Ofw3Hbt147b_iXOcNihuCc3XneAdOkU,35693
|
|
9
|
+
memory_classification_engine/cli.py,sha256=QbHK4O92X99l-dTYilJ_x5kSeMOWDTlSSiENRhCNjVM,45706
|
|
10
|
+
memory_classification_engine/conflict_detector.py,sha256=8p1xFSPoB-FqBKZ0LNVFEHDWjsRtr1bQb0kpVDnZ1wM,14722
|
|
11
|
+
memory_classification_engine/context.py,sha256=H5nPNL19KQGDm3UNyLec8FTVDZGQ1nSOn1Qu7SNBo1Q,8711
|
|
12
|
+
memory_classification_engine/engine.py,sha256=hQfpdLiIm7CpkV-WlT7lTlSfj6RvBNuJjz274bxJrew,7560
|
|
13
|
+
memory_classification_engine/exceptions.py,sha256=ToipK2mWFb2wx5iVaD5g0_fxyrLB7114E-hnZcKd-Dk,1036
|
|
14
|
+
memory_classification_engine/merge.py,sha256=O8qpKWAVP-4jx48sUUTDsFHMpnHmuYYBiNJj5nP05sU,3831
|
|
15
|
+
memory_classification_engine/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
|
+
memory_classification_engine/quality_scorer.py,sha256=GaZGWMZbRVBOA7QFbCVKWhaSPHWOzy9KtWxWqm3K1gg,14155
|
|
17
|
+
memory_classification_engine/scoring.py,sha256=v05_SNrwbP3EB8qpN5zA5sbBM-GL9EpTvwKJ3LI2Lxs,2152
|
|
18
|
+
memory_classification_engine/tui.py,sha256=aiGZok5Z0xH9x7V-a4jmM_0c5FQoLo231UsPae74u0w,11146
|
|
19
|
+
memory_classification_engine/adapters/__init__.py,sha256=X9aqTxjSdlrkrTuwQZZCRs2a-UPkozdU9cWnxs8_emg,452
|
|
20
|
+
memory_classification_engine/adapters/base.py,sha256=dnyvrG9t7xpqYCnGVhNlft5b3cGjiTLaXIGdGll8VCU,17972
|
|
21
|
+
memory_classification_engine/adapters/json_adapter.py,sha256=jC36CqDwormNRAS8ylDsECG6qIo_3pJcxO5fiN0-orU,8834
|
|
22
|
+
memory_classification_engine/adapters/loader.py,sha256=-RIUexk0io0oKpmTc4Uj5Z9kzG0SIyRhxxm5xJ-ErJI,1964
|
|
23
|
+
memory_classification_engine/adapters/obsidian_adapter.py,sha256=DQMhofpBAHEdIRwagU360-uPwbRByWoh3rgJCD7kjVw,14207
|
|
24
|
+
memory_classification_engine/adapters/sqlite_adapter.py,sha256=vDbfh5lY9sd6b4ZnUH7iepjYjdYkS7mhDJCsqFudXCo,47831
|
|
25
|
+
memory_classification_engine/coordinators/__init__.py,sha256=7l8s03dgvySdtvO9SrxWoQKOusJ1mVhevhWpAqpVXh8,207
|
|
26
|
+
memory_classification_engine/coordinators/classification_pipeline.py,sha256=B9QXbcA92e1RHJLBhG542iBuwODLKs6r7DDKtHaeVtk,10939
|
|
27
|
+
memory_classification_engine/integration/__init__.py,sha256=UxyGF5kOWDtERkKJ_Vq_1ve98jgfuNV_1bfhnznjtNc,256
|
|
28
|
+
memory_classification_engine/integration/layer2_mcp/__init__.py,sha256=PnwSnzjmxMoV_THDM5oVCW14i6RKF2_jzdQ5eEp27I4,672
|
|
29
|
+
memory_classification_engine/integration/layer2_mcp/__main__.py,sha256=Dd5Pz17wZhF83NMTTNI1wZQV8ft8mI_ryq7qVlHo3Rs,408
|
|
30
|
+
memory_classification_engine/integration/layer2_mcp/handlers.py,sha256=0h3pt9l3NQK_eLzjj_eihG_L7C6bt9QwshaOFdzbw4k,13545
|
|
31
|
+
memory_classification_engine/integration/layer2_mcp/http_server.py,sha256=p3Qy4wuCBcHHWmvF_C42JMDap6LnF46k4mmvyXhTBSg,8908
|
|
32
|
+
memory_classification_engine/integration/layer2_mcp/server.py,sha256=siYIxxVj9BFeGZJtkB4xkSL3roRe9Q1Vsd7-B-0Hf4g,9186
|
|
33
|
+
memory_classification_engine/integration/layer2_mcp/tools.py,sha256=6LWNrMtp3r9Y39N40lCN-QomExsb8_RMt3gWMjJpl00,20711
|
|
34
|
+
memory_classification_engine/layers/__init__.py,sha256=-vGtS-60ysipJtPvZP1qcP3cnILcV8rWABkvXWzbTZY,42
|
|
35
|
+
memory_classification_engine/layers/feedback_loop.py,sha256=EpHsNkmrfXHCr8spxm0AjxPGhOWnvvt8s5b7BhR2YxA,15036
|
|
36
|
+
memory_classification_engine/layers/pattern_analyzer.py,sha256=HhHQRNcb8eKVlmUynjHKptKnonHDn8ThSb7ey3qGfkM,68560
|
|
37
|
+
memory_classification_engine/layers/rule_matcher.py,sha256=eGvVAT3beGEqs-NMsb8QFyUj5vqmmTNdsuREXbRkn80,3595
|
|
38
|
+
memory_classification_engine/layers/semantic_classifier.py,sha256=eRIT0j0CI_mlKKcA6N8IWdEaO9JakQNF4sastmH57qs,4170
|
|
39
|
+
memory_classification_engine/security/__init__.py,sha256=yCn65alpfR8D3ddWANWtQW03UtezoSd4Xxl6NjmLvd8,635
|
|
40
|
+
memory_classification_engine/security/audit.py,sha256=ekgUSFq5LxrkDwVWIp0J-TqoT-10rSq0FwnRpXqTHd8,5364
|
|
41
|
+
memory_classification_engine/security/encryption.py,sha256=8Q--xQB2lN3-1ySvYW64J3OU4xKSHfcXRDYZ9eSm7HU,6905
|
|
42
|
+
memory_classification_engine/security/input_validator.py,sha256=0W_pyHjjaNg7wStyALQ1jXbV_BAaiEa9zsNWOJh0IEg,14715
|
|
43
|
+
memory_classification_engine/semantic/__init__.py,sha256=G8UX34s7QUHy7UbN0Nhlu0Su3TqS4a7iPKqfcE2YFoI,433
|
|
44
|
+
memory_classification_engine/semantic/expander.py,sha256=xt4vMZ0wsJ9GDbPYe2mxu1SV_jvdL-woXTtdg4nB3yI,10810
|
|
45
|
+
memory_classification_engine/semantic/merger.py,sha256=0c2__8yOCw9x_bKl8xwHhrY2X-9f9bg7PvtvX8S9djc,8616
|
|
46
|
+
memory_classification_engine/semantic/data/__init__.py,sha256=F7w9c4fbjm_MVCi67b-iGa64L1OLCvIfnWrpgYf-6GI,509
|
|
47
|
+
memory_classification_engine/semantic/data/synonyms_daily_en.yaml,sha256=uAJVrZg0KQl4bf5LHI8zre4Gz3rg7x-p6DboaE1bBjs,4576
|
|
48
|
+
memory_classification_engine/semantic/data/synonyms_jp.yaml,sha256=vh1nCtQVXICkds-70fu2b_V0-FpddMRVI2Wuy4BMwEE,6707
|
|
49
|
+
memory_classification_engine/semantic/data/synonyms_technical_cn.yaml,sha256=6V4N0z-6eXhLNQudPk3i3CyBKppUZjAulzXby19KJJ8,5515
|
|
50
|
+
memory_classification_engine/utils/__init__.py,sha256=MAwLQHvhSD6usiJ-z90mBlwkk_Wc18rBwS2ZYWk5r9A,36
|
|
51
|
+
memory_classification_engine/utils/config.py,sha256=iKTyF03I9EoK7N6PfI9LlM9wXtnEAjFvdClz2YN_9bI,3090
|
|
52
|
+
memory_classification_engine/utils/confirmation.py,sha256=BOx1oaNMstF3fQ5Wfd-Gs30kBjOxNlS4dFYfpfhgq24,1438
|
|
53
|
+
memory_classification_engine/utils/constants.py,sha256=oPPEDLa9tFi3SSP_U1s9lVRnX53cP52uRKk25esbcog,1798
|
|
54
|
+
memory_classification_engine/utils/helpers.py,sha256=PPwlZURyyx617Mbj9-CfeqEj2Eek3DSGs-ZMV5qjolc,4133
|
|
55
|
+
memory_classification_engine/utils/language.py,sha256=D5gUqERgSqLO9X5R1TGxKz_feMk3igthhq2HzmV9aCE,13514
|
|
56
|
+
memory_classification_engine/utils/logger.py,sha256=umdSegCpJUfLprwePG35l1cbI0r6qEGEuB-bfFxqwFA,1839
|
|
57
|
+
memory_classification_engine/utils/performance.py,sha256=162u2E2-8fe0aHe57kw5C7SUKE2FwKvabWAOX3luE8Q,9628
|
|
58
|
+
memory_classification_engine/utils/validators.py,sha256=y5SCImL6u72SXOcJGYbUPENCqd0r9PKhzAym_9DiEvQ,7860
|
|
59
|
+
carrymem-0.1.2.dist-info/METADATA,sha256=sGf2LbDCgtVZFINgTctyy-380C7c2ZqUEHKuLeeoxHs,13007
|
|
60
|
+
carrymem-0.1.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
61
|
+
carrymem-0.1.2.dist-info/entry_points.txt,sha256=BLYcTwwxvMxeghUD3FCjU8G60KVBaFLrBOpiUQWyA_I,316
|
|
62
|
+
carrymem-0.1.2.dist-info/top_level.txt,sha256=KXlWhebfpZ8WwwAKTpbLm2ksurYQ1rWoiz3caOudmZ8,29
|
|
63
|
+
carrymem-0.1.2.dist-info/RECORD,,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
[carrymem.adapters]
|
|
2
|
+
json = memory_classification_engine.adapters.json_adapter:JSONAdapter
|
|
3
|
+
obsidian = memory_classification_engine.adapters.obsidian_adapter:ObsidianAdapter
|
|
4
|
+
sqlite = memory_classification_engine.adapters.sqlite_adapter:SQLiteAdapter
|
|
5
|
+
|
|
6
|
+
[console_scripts]
|
|
7
|
+
carrymem = memory_classification_engine.cli:main
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 lulin70
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
memory_classification_engine
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"""CarryMem — Your Portable AI Memory Layer.
|
|
2
|
+
|
|
3
|
+
CarryMem = MCE Classification Engine + SQLite Default Storage + Replaceable Adapters
|
|
4
|
+
|
|
5
|
+
v0.8.0: Enhanced CLI, TUI, MCP setup, carrymem doctor, quality management
|
|
6
|
+
|
|
7
|
+
Quick Start:
|
|
8
|
+
from memory_classification_engine import CarryMem
|
|
9
|
+
|
|
10
|
+
cm = CarryMem()
|
|
11
|
+
result = cm.classify_and_remember("I prefer dark mode")
|
|
12
|
+
memories = cm.recall_memories("dark mode") # Also finds "深色模式", "ダークモード", etc.
|
|
13
|
+
|
|
14
|
+
CLI:
|
|
15
|
+
carrymem add "I prefer dark mode"
|
|
16
|
+
carrymem list
|
|
17
|
+
carrymem search "theme"
|
|
18
|
+
carrymem setup-mcp --tool cursor
|
|
19
|
+
carrymem doctor
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from memory_classification_engine.carrymem import CarryMem, StorageNotConfiguredError, KnowledgeNotConfiguredError
|
|
23
|
+
from memory_classification_engine.engine import MemoryClassificationEngine
|
|
24
|
+
from memory_classification_engine.adapters.base import MemoryEntry, StorageAdapter, StoredMemory
|
|
25
|
+
from memory_classification_engine.adapters.sqlite_adapter import SQLiteAdapter
|
|
26
|
+
from memory_classification_engine.adapters.obsidian_adapter import ObsidianAdapter
|
|
27
|
+
from memory_classification_engine.adapters.json_adapter import JSONAdapter
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
from memory_classification_engine.semantic.expander import SemanticExpander
|
|
31
|
+
from memory_classification_engine.semantic.merger import ResultMerger
|
|
32
|
+
except ImportError:
|
|
33
|
+
SemanticExpander = None
|
|
34
|
+
ResultMerger = None
|
|
35
|
+
|
|
36
|
+
# v0.5.0 security module
|
|
37
|
+
try:
|
|
38
|
+
from memory_classification_engine.security import (
|
|
39
|
+
InputValidator,
|
|
40
|
+
ValidationError,
|
|
41
|
+
validate_content,
|
|
42
|
+
validate_query,
|
|
43
|
+
validate_namespace,
|
|
44
|
+
)
|
|
45
|
+
except ImportError:
|
|
46
|
+
InputValidator = None
|
|
47
|
+
ValidationError = None
|
|
48
|
+
validate_content = None
|
|
49
|
+
validate_query = None
|
|
50
|
+
validate_namespace = None
|
|
51
|
+
|
|
52
|
+
try:
|
|
53
|
+
from memory_classification_engine.async_carrymem import AsyncCarryMem
|
|
54
|
+
except ImportError:
|
|
55
|
+
AsyncCarryMem = None
|
|
56
|
+
|
|
57
|
+
from memory_classification_engine.__version__ import __version__
|
|
58
|
+
|
|
59
|
+
__all__ = [
|
|
60
|
+
"CarryMem",
|
|
61
|
+
"MemoryClassificationEngine",
|
|
62
|
+
"MemoryEntry",
|
|
63
|
+
"StorageAdapter",
|
|
64
|
+
"StoredMemory",
|
|
65
|
+
"SQLiteAdapter",
|
|
66
|
+
"ObsidianAdapter",
|
|
67
|
+
"JSONAdapter",
|
|
68
|
+
"StorageNotConfiguredError",
|
|
69
|
+
"KnowledgeNotConfiguredError",
|
|
70
|
+
"SemanticExpander",
|
|
71
|
+
"ResultMerger",
|
|
72
|
+
"InputValidator",
|
|
73
|
+
"ValidationError",
|
|
74
|
+
"validate_content",
|
|
75
|
+
"validate_query",
|
|
76
|
+
"validate_namespace",
|
|
77
|
+
"AsyncCarryMem",
|
|
78
|
+
]
|