memoryforge 1.0.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.
- memoryforge-1.0.0/.gitignore +1 -0
- memoryforge-1.0.0/ARCHITECTURE.md +332 -0
- memoryforge-1.0.0/LICENSE +21 -0
- memoryforge-1.0.0/PKG-INFO +314 -0
- memoryforge-1.0.0/README.md +270 -0
- memoryforge-1.0.0/memoryforge/__init__.py +21 -0
- memoryforge-1.0.0/memoryforge/__main__.py +6 -0
- memoryforge-1.0.0/memoryforge/cli.py +2075 -0
- memoryforge-1.0.0/memoryforge/config.py +140 -0
- memoryforge-1.0.0/memoryforge/core/__init__.py +28 -0
- memoryforge-1.0.0/memoryforge/core/confidence_scorer.py +173 -0
- memoryforge-1.0.0/memoryforge/core/conflict_resolver.py +153 -0
- memoryforge-1.0.0/memoryforge/core/embedding_factory.py +85 -0
- memoryforge-1.0.0/memoryforge/core/embedding_service.py +137 -0
- memoryforge-1.0.0/memoryforge/core/git_integration.py +334 -0
- memoryforge-1.0.0/memoryforge/core/git_scanner.py +424 -0
- memoryforge-1.0.0/memoryforge/core/graph_builder.py +164 -0
- memoryforge-1.0.0/memoryforge/core/local_embedding_service.py +109 -0
- memoryforge-1.0.0/memoryforge/core/memory_consolidator.py +614 -0
- memoryforge-1.0.0/memoryforge/core/memory_manager.py +266 -0
- memoryforge-1.0.0/memoryforge/core/project_router.py +316 -0
- memoryforge-1.0.0/memoryforge/core/retrieval.py +310 -0
- memoryforge-1.0.0/memoryforge/core/validation.py +157 -0
- memoryforge-1.0.0/memoryforge/mcp/__init__.py +15 -0
- memoryforge-1.0.0/memoryforge/mcp/server.py +570 -0
- memoryforge-1.0.0/memoryforge/migrate.py +444 -0
- memoryforge-1.0.0/memoryforge/models.py +221 -0
- memoryforge-1.0.0/memoryforge/storage/__init__.py +6 -0
- memoryforge-1.0.0/memoryforge/storage/qdrant_store.py +212 -0
- memoryforge-1.0.0/memoryforge/storage/sqlite_db.py +1075 -0
- memoryforge-1.0.0/memoryforge/sync/adapter.py +50 -0
- memoryforge-1.0.0/memoryforge/sync/encryption.py +100 -0
- memoryforge-1.0.0/memoryforge/sync/local_file_adapter.py +69 -0
- memoryforge-1.0.0/memoryforge/sync/manager.py +305 -0
- memoryforge-1.0.0/pyproject.toml +83 -0
- memoryforge-1.0.0/scripts/benchmark.py +187 -0
- memoryforge-1.0.0/tests/__init__.py +1 -0
- memoryforge-1.0.0/tests/test_consolidation.py +354 -0
- memoryforge-1.0.0/tests/test_git_integration.py +222 -0
- memoryforge-1.0.0/tests/test_memory_manager.py +240 -0
- memoryforge-1.0.0/tests/test_migration.py +318 -0
- memoryforge-1.0.0/tests/test_project_router.py +220 -0
- memoryforge-1.0.0/tests/test_retrieval.py +333 -0
- memoryforge-1.0.0/tests/test_storage.py +300 -0
- memoryforge-1.0.0/tests/test_sync_encryption.py +152 -0
- memoryforge-1.0.0/tests/test_sync_manager.py +274 -0
- memoryforge-1.0.0/tests/test_v3_features.py +466 -0
- memoryforge-1.0.0/tests/test_validation.py +114 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* .pdf
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
# MemoryForge Architecture
|
|
2
|
+
|
|
3
|
+
## System Overview
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
┌────────────────────────────────────────────────────────────────────────────┐
|
|
7
|
+
│ MemoryForge v1.0 │
|
|
8
|
+
├────────────────────────────────────────────────────────────────────────────┤
|
|
9
|
+
│ │
|
|
10
|
+
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
|
|
11
|
+
│ │ CLI │ │ MCP Server │ │ Python API │ │
|
|
12
|
+
│ │ (click) │ │ (stdio) │ │ (direct) │ │
|
|
13
|
+
│ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │
|
|
14
|
+
│ │ │ │ │
|
|
15
|
+
│ └───────────────────┼───────────────────┘ │
|
|
16
|
+
│ ▼ │
|
|
17
|
+
│ ┌─────────────────────────────────────────────────────────────────────┐ │
|
|
18
|
+
│ │ Core Services Layer │ │
|
|
19
|
+
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌──────────────┐ │ │
|
|
20
|
+
│ │ │ Memory │ │ Retrieval │ │ Project │ │ Git │ │ │
|
|
21
|
+
│ │ │ Manager │ │ Engine │ │ Router │ │ Integration │ │ │
|
|
22
|
+
│ │ └─────────────┘ └─────────────┘ └─────────────┘ └──────────────┘ │ │
|
|
23
|
+
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │
|
|
24
|
+
│ │ │ Validation │ │Consolidation│ │ Sync │ │ │
|
|
25
|
+
│ │ │ Layer │ │ Engine │ │ Manager │ │ │
|
|
26
|
+
│ │ └─────────────┘ └─────────────┘ └─────────────┘ │ │
|
|
27
|
+
│ └─────────────────────────────────────────────────────────────────────┘ │
|
|
28
|
+
│ │ │
|
|
29
|
+
│ ┌───────────────────┼───────────────────┐ │
|
|
30
|
+
│ ▼ ▼ ▼ │
|
|
31
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
32
|
+
│ │ SQLite │ │ Qdrant │ │ Embedding │ │
|
|
33
|
+
│ │ (Primary) │◄────│ (Vectors) │◄────│ Factory │ │
|
|
34
|
+
│ └─────────────┘ └─────────────┘ └──────┬──────┘ │
|
|
35
|
+
│ │ │
|
|
36
|
+
│ ┌───────────────────┼───────────────────┐ │
|
|
37
|
+
│ ▼ ▼ │
|
|
38
|
+
│ ┌─────────────┐ ┌──────────┐ │
|
|
39
|
+
│ │ Local │ │ OpenAI │ │
|
|
40
|
+
│ │ (MiniLM-L6) │ │ API │ │
|
|
41
|
+
│ └─────────────┘ └──────────┘ │
|
|
42
|
+
│ │
|
|
43
|
+
└────────────────────────────────────────────────────────────────────────────┘
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Directory Structure
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
memoryforge/
|
|
52
|
+
├── __init__.py # Package exports
|
|
53
|
+
├── __main__.py # Entry point
|
|
54
|
+
├── cli.py # CLI commands (click)
|
|
55
|
+
├── config.py # Configuration management
|
|
56
|
+
├── models.py # Pydantic data models
|
|
57
|
+
├── migrate.py # Database migration logic
|
|
58
|
+
│
|
|
59
|
+
├── core/ # Core business logic
|
|
60
|
+
│ ├── memory_manager.py # CRUD operations for memories
|
|
61
|
+
│ ├── retrieval.py # Semantic search engine
|
|
62
|
+
│ ├── validation.py # Input validation rules
|
|
63
|
+
│ ├── project_router.py # Multi-project management
|
|
64
|
+
│ ├── memory_consolidator.py # Memory merging
|
|
65
|
+
│ ├── embedding_factory.py # Embedding provider selector
|
|
66
|
+
│ ├── embedding_service.py # OpenAI embeddings
|
|
67
|
+
│ ├── local_embedding_service.py # sentence-transformers
|
|
68
|
+
│ ├── git_integration.py # Git-memory links
|
|
69
|
+
│ └── git_scanner.py # Architectural commit detection
|
|
70
|
+
│
|
|
71
|
+
├── storage/ # Persistence layer
|
|
72
|
+
│ ├── sqlite_db.py # SQLite operations
|
|
73
|
+
│ └── qdrant_store.py # Vector store operations
|
|
74
|
+
│
|
|
75
|
+
├── sync/ # Team sync (v2.1)
|
|
76
|
+
│ ├── adapter.py # Sync backend interface
|
|
77
|
+
│ ├── encryption.py # AES-256 encryption
|
|
78
|
+
│ ├── local_file_adapter.py # File-based sync
|
|
79
|
+
│ └── manager.py # Sync orchestration
|
|
80
|
+
│
|
|
81
|
+
└── mcp/ # MCP integration
|
|
82
|
+
├── __init__.py
|
|
83
|
+
└── server.py # MCP server implementation
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Data Flow
|
|
89
|
+
|
|
90
|
+
### Memory Creation
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
User Input
|
|
94
|
+
│
|
|
95
|
+
▼
|
|
96
|
+
┌─────────────┐
|
|
97
|
+
│ Validation │ ← Type, content length, format checks
|
|
98
|
+
└──────┬──────┘
|
|
99
|
+
│
|
|
100
|
+
▼
|
|
101
|
+
┌─────────────┐
|
|
102
|
+
│ SQLite │ ← Memory stored (confirmed=false)
|
|
103
|
+
└──────┬──────┘
|
|
104
|
+
│
|
|
105
|
+
▼
|
|
106
|
+
┌─────────────┐
|
|
107
|
+
│ Confirm │ ← User confirms memory is correct
|
|
108
|
+
└──────┬──────┘
|
|
109
|
+
│
|
|
110
|
+
▼
|
|
111
|
+
┌─────────────┐
|
|
112
|
+
│ Embedding │ ← Generate vector (local or OpenAI)
|
|
113
|
+
│ Factory │
|
|
114
|
+
└──────┬──────┘
|
|
115
|
+
│
|
|
116
|
+
▼
|
|
117
|
+
┌─────────────┐
|
|
118
|
+
│ Qdrant │ ← Store vector with memory ID
|
|
119
|
+
└─────────────┘
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Semantic Search
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
Search Query
|
|
126
|
+
│
|
|
127
|
+
▼
|
|
128
|
+
┌─────────────┐
|
|
129
|
+
│ Embedding │ ← Query → Vector
|
|
130
|
+
│ Factory │
|
|
131
|
+
└──────┬──────┘
|
|
132
|
+
│
|
|
133
|
+
▼
|
|
134
|
+
┌─────────────┐
|
|
135
|
+
│ Qdrant │ ← ANN search, return top-k IDs
|
|
136
|
+
└──────┬──────┘
|
|
137
|
+
│
|
|
138
|
+
▼
|
|
139
|
+
┌─────────────┐
|
|
140
|
+
│ SQLite │ ← Fetch full memory data
|
|
141
|
+
└──────┬──────┘
|
|
142
|
+
│
|
|
143
|
+
▼
|
|
144
|
+
┌─────────────┐
|
|
145
|
+
│ Retrieval │ ← Score, rank, filter stale
|
|
146
|
+
│ Engine │
|
|
147
|
+
└──────┬──────┘
|
|
148
|
+
│
|
|
149
|
+
▼
|
|
150
|
+
Search Results
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Core Components
|
|
156
|
+
|
|
157
|
+
### Memory Manager
|
|
158
|
+
**File:** `core/memory_manager.py`
|
|
159
|
+
|
|
160
|
+
Handles CRUD operations for memories:
|
|
161
|
+
- Create (unconfirmed) → Confirm → Generate embedding
|
|
162
|
+
- Update with version history
|
|
163
|
+
- Delete (removes from SQLite and Qdrant)
|
|
164
|
+
|
|
165
|
+
### Retrieval Engine
|
|
166
|
+
**File:** `core/retrieval.py`
|
|
167
|
+
|
|
168
|
+
Semantic search with:
|
|
169
|
+
- Query embedding generation
|
|
170
|
+
- Qdrant similarity search
|
|
171
|
+
- Staleness filtering
|
|
172
|
+
- Score-based ranking
|
|
173
|
+
|
|
174
|
+
### Project Router
|
|
175
|
+
**File:** `core/project_router.py`
|
|
176
|
+
|
|
177
|
+
Multi-project support:
|
|
178
|
+
- Project creation/switching
|
|
179
|
+
- Path-based auto-detection
|
|
180
|
+
- Separate Qdrant collections per project
|
|
181
|
+
|
|
182
|
+
### Memory Consolidator
|
|
183
|
+
**File:** `core/memory_consolidator.py`
|
|
184
|
+
|
|
185
|
+
Memory merging:
|
|
186
|
+
- Similarity detection (threshold: 0.90)
|
|
187
|
+
- Archive originals with rollback support
|
|
188
|
+
- Stats tracking
|
|
189
|
+
|
|
190
|
+
### Embedding Factory
|
|
191
|
+
**File:** `core/embedding_factory.py`
|
|
192
|
+
|
|
193
|
+
Provider abstraction:
|
|
194
|
+
- Local: `sentence-transformers` (all-MiniLM-L6-v2, 384 dims)
|
|
195
|
+
- OpenAI: text-embedding-3-small (1536 dims)
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Storage Layer
|
|
200
|
+
|
|
201
|
+
### SQLite (Primary Store)
|
|
202
|
+
**File:** `storage/sqlite_db.py`
|
|
203
|
+
|
|
204
|
+
Source of truth for all data:
|
|
205
|
+
|
|
206
|
+
| Table | Description |
|
|
207
|
+
|-------|-------------|
|
|
208
|
+
| `projects` | Project metadata |
|
|
209
|
+
| `memories` | Memory content, type, flags |
|
|
210
|
+
| `memory_versions` | Content history for rollback |
|
|
211
|
+
| `memory_links` | Git commit associations |
|
|
212
|
+
| `embeddings` | Memory-to-vector-ID mapping |
|
|
213
|
+
|
|
214
|
+
### Qdrant (Derived Store)
|
|
215
|
+
**File:** `storage/qdrant_store.py`
|
|
216
|
+
|
|
217
|
+
Vector storage (can be rebuilt from SQLite):
|
|
218
|
+
- One collection per project
|
|
219
|
+
- Dimension matches embedding provider
|
|
220
|
+
- Supports filtered search
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Data Models
|
|
225
|
+
|
|
226
|
+
**File:** `models.py`
|
|
227
|
+
|
|
228
|
+
```python
|
|
229
|
+
class MemoryType(Enum):
|
|
230
|
+
STACK = "stack" # Languages, frameworks, libraries
|
|
231
|
+
DECISION = "decision" # Architecture decisions
|
|
232
|
+
CONSTRAINT = "constraint" # Performance, deadlines
|
|
233
|
+
CONVENTION = "convention" # Code conventions
|
|
234
|
+
NOTE = "note" # General notes
|
|
235
|
+
|
|
236
|
+
class Memory(BaseModel):
|
|
237
|
+
id: UUID
|
|
238
|
+
content: str # Max 10KB
|
|
239
|
+
type: MemoryType
|
|
240
|
+
project_id: UUID
|
|
241
|
+
confirmed: bool
|
|
242
|
+
is_stale: bool
|
|
243
|
+
is_archived: bool
|
|
244
|
+
created_at: datetime
|
|
245
|
+
last_accessed: datetime # Updated on retrieval
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## MCP Integration
|
|
251
|
+
|
|
252
|
+
**File:** `mcp/server.py`
|
|
253
|
+
|
|
254
|
+
Exposes tools via Model Context Protocol:
|
|
255
|
+
|
|
256
|
+
| Tool | Operation |
|
|
257
|
+
|------|-----------|
|
|
258
|
+
| `store_memory` | Create + optional confirm |
|
|
259
|
+
| `search_memory` | Semantic search |
|
|
260
|
+
| `list_memory` | Recent memories |
|
|
261
|
+
| `delete_memory` | Remove by ID |
|
|
262
|
+
| `memory_timeline` | Chronological view |
|
|
263
|
+
| `list_projects` | All projects |
|
|
264
|
+
| `switch_project` | Change active project |
|
|
265
|
+
| `project_status` | Current project info |
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## Team Sync
|
|
270
|
+
|
|
271
|
+
**Files:** `sync/manager.py`, `sync/encryption.py`
|
|
272
|
+
|
|
273
|
+
Encrypted sync to shared storage:
|
|
274
|
+
|
|
275
|
+
```
|
|
276
|
+
Local SQLite
|
|
277
|
+
│
|
|
278
|
+
▼
|
|
279
|
+
┌─────────────┐
|
|
280
|
+
│ Export │ ← Serialize memories to JSON
|
|
281
|
+
└──────┬──────┘
|
|
282
|
+
│
|
|
283
|
+
▼
|
|
284
|
+
┌─────────────┐
|
|
285
|
+
│ Encryption │ ← AES-256-GCM
|
|
286
|
+
└──────┬──────┘
|
|
287
|
+
│
|
|
288
|
+
▼
|
|
289
|
+
┌─────────────┐
|
|
290
|
+
│ Adapter │ ← Write to shared path
|
|
291
|
+
└─────────────┘
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
Conflict detection via timestamps and checksums.
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Performance
|
|
299
|
+
|
|
300
|
+
| Operation | Latency | Notes |
|
|
301
|
+
|-----------|---------|-------|
|
|
302
|
+
| Memory creation | <50ms | SQLite write |
|
|
303
|
+
| Confirmation | 100-500ms | Embedding + Qdrant |
|
|
304
|
+
| Semantic search | 50-200ms | Depends on collection size |
|
|
305
|
+
| Max memories | ~100K | Per project, limited by RAM |
|
|
306
|
+
|
|
307
|
+
### Embedding Providers
|
|
308
|
+
|
|
309
|
+
| Provider | Dimensions | Speed | Cost |
|
|
310
|
+
|----------|------------|-------|------|
|
|
311
|
+
| Local (MiniLM) | 384 | Fast | Free |
|
|
312
|
+
| OpenAI (3-small) | 1536 | Network | ~$0.02/1K |
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Key Design Decisions
|
|
317
|
+
|
|
318
|
+
1. **SQLite as Source of Truth**
|
|
319
|
+
- All data restorable from SQLite
|
|
320
|
+
- Qdrant is derived (can rebuild via `reindex`)
|
|
321
|
+
|
|
322
|
+
2. **Two-Phase Confirmation**
|
|
323
|
+
- Memories created as unconfirmed
|
|
324
|
+
- Embedding only on confirmation (saves cost/compute)
|
|
325
|
+
|
|
326
|
+
3. **Local-First Architecture**
|
|
327
|
+
- All data stored locally by default
|
|
328
|
+
- Sync is opt-in, encrypted
|
|
329
|
+
|
|
330
|
+
4. **Provider Abstraction**
|
|
331
|
+
- Switch embedding providers without code changes
|
|
332
|
+
- Dimension mismatch requires reindex
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 MemoryForge Team
|
|
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,314 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: memoryforge
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Local-first memory layer for AI coding assistants
|
|
5
|
+
Project-URL: Homepage, https://memoryforge.dev
|
|
6
|
+
Project-URL: Repository, https://github.com/memoryforge/core
|
|
7
|
+
Project-URL: Documentation, https://docs.memoryforge.dev
|
|
8
|
+
Author: MemoryForge Team
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ai,coding-assistant,mcp,memory,vector-database
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Requires-Dist: click>=8.1.0
|
|
20
|
+
Requires-Dist: mcp>=1.0.0
|
|
21
|
+
Requires-Dist: pydantic-settings>=2.0.0
|
|
22
|
+
Requires-Dist: pydantic>=2.0.0
|
|
23
|
+
Requires-Dist: pyyaml>=6.0.0
|
|
24
|
+
Requires-Dist: qdrant-client>=1.7.0
|
|
25
|
+
Requires-Dist: rich>=13.0.0
|
|
26
|
+
Provides-Extra: all
|
|
27
|
+
Requires-Dist: openai>=1.0.0; extra == 'all'
|
|
28
|
+
Requires-Dist: sentence-transformers>=2.2.0; extra == 'all'
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: mypy>=1.0.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: openai>=1.0.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
36
|
+
Provides-Extra: local
|
|
37
|
+
Requires-Dist: sentence-transformers>=2.2.0; extra == 'local'
|
|
38
|
+
Provides-Extra: openai
|
|
39
|
+
Requires-Dist: openai>=1.0.0; extra == 'openai'
|
|
40
|
+
Provides-Extra: sync
|
|
41
|
+
Requires-Dist: cryptography>=41.0.0; extra == 'sync'
|
|
42
|
+
Requires-Dist: gitpython>=3.1.0; extra == 'sync'
|
|
43
|
+
Description-Content-Type: text/markdown
|
|
44
|
+
|
|
45
|
+
# MemoryForge
|
|
46
|
+
|
|
47
|
+

|
|
48
|
+

|
|
49
|
+

|
|
50
|
+

|
|
51
|
+
|
|
52
|
+
> **Local-first memory layer for AI coding assistants**
|
|
53
|
+
|
|
54
|
+
MemoryForge provides persistent, semantic memory for AI pair programmers. Store decisions, constraints, and context that survives across sessions.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Features
|
|
59
|
+
|
|
60
|
+
| Feature | Description |
|
|
61
|
+
|---------|-------------|
|
|
62
|
+
| **Semantic Search** | Vector-based retrieval using Qdrant |
|
|
63
|
+
| **Memory Types** | Stack, Decision, Constraint, Convention, Note |
|
|
64
|
+
| **Multi-Project** | Separate memory indexes per project |
|
|
65
|
+
| **Consolidation** | Merge similar memories with rollback support |
|
|
66
|
+
| **Staleness Tracking** | Mark outdated memories, filter from search |
|
|
67
|
+
| **Git Integration** | Link memories to commits |
|
|
68
|
+
| **Team Sync** | Encrypted sync to shared storage |
|
|
69
|
+
| **Graph Memory** | Memory-to-memory relationships (v3) |
|
|
70
|
+
| **Confidence Scoring** | Trust scores for prioritized retrieval (v3) |
|
|
71
|
+
| **Conflict Resolution** | Sync conflict detection and logging (v3) |
|
|
72
|
+
| **MCP Server** | IDE integration via Model Context Protocol |
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Installation
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# From GitHub (recommended)
|
|
80
|
+
pip install git+https://github.com/agusain2001/memoryforge.git
|
|
81
|
+
|
|
82
|
+
# With local embeddings (free, recommended)
|
|
83
|
+
pip install "memoryforge[local] @ git+https://github.com/agusain2001/memoryforge.git"
|
|
84
|
+
|
|
85
|
+
# With OpenAI embeddings
|
|
86
|
+
pip install "memoryforge[openai] @ git+https://github.com/agusain2001/memoryforge.git"
|
|
87
|
+
|
|
88
|
+
# With team sync
|
|
89
|
+
pip install "memoryforge[sync] @ git+https://github.com/agusain2001/memoryforge.git"
|
|
90
|
+
|
|
91
|
+
# Everything
|
|
92
|
+
pip install "memoryforge[all] @ git+https://github.com/agusain2001/memoryforge.git"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Requirements:** Python 3.11+
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Quick Start
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# Initialize MemoryForge
|
|
103
|
+
cd your-project
|
|
104
|
+
memoryforge init --name "my-project"
|
|
105
|
+
|
|
106
|
+
# Add a memory
|
|
107
|
+
memoryforge add "Using FastAPI for backend, PostgreSQL for data" --type stack
|
|
108
|
+
|
|
109
|
+
# Search memories
|
|
110
|
+
memoryforge search "what database?"
|
|
111
|
+
|
|
112
|
+
# List recent memories
|
|
113
|
+
memoryforge list --limit 5
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## CLI Reference
|
|
119
|
+
|
|
120
|
+
### Core Commands
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
memoryforge init [OPTIONS] # Initialize MemoryForge
|
|
124
|
+
-n, --name TEXT # Project name
|
|
125
|
+
-p, --provider [local|openai] # Embedding provider (default: local)
|
|
126
|
+
-k, --api-key TEXT # OpenAI API key (if using openai)
|
|
127
|
+
|
|
128
|
+
memoryforge add CONTENT [OPTIONS] # Add a memory
|
|
129
|
+
-t, --type [stack|decision|constraint|convention|note]
|
|
130
|
+
--confirm / --no-confirm # Immediately confirm
|
|
131
|
+
|
|
132
|
+
memoryforge list [OPTIONS] # List memories
|
|
133
|
+
-t, --type TYPE # Filter by type
|
|
134
|
+
-a, --all # Include unconfirmed
|
|
135
|
+
-l, --limit INTEGER # Max results
|
|
136
|
+
|
|
137
|
+
memoryforge search QUERY [OPTIONS] # Semantic search
|
|
138
|
+
-t, --type TYPE # Filter by type
|
|
139
|
+
-l, --limit INTEGER # Max results
|
|
140
|
+
|
|
141
|
+
memoryforge confirm MEMORY_ID # Confirm a pending memory
|
|
142
|
+
memoryforge delete MEMORY_ID # Delete a memory
|
|
143
|
+
memoryforge timeline [--limit N] # Chronological view
|
|
144
|
+
memoryforge status # Show project status
|
|
145
|
+
memoryforge reindex [--force] # Rebuild vector index
|
|
146
|
+
memoryforge serve # Start MCP server
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Project Management
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
memoryforge project create --name NAME [--path PATH]
|
|
153
|
+
memoryforge project list
|
|
154
|
+
memoryforge project switch NAME_OR_ID
|
|
155
|
+
memoryforge project delete NAME_OR_ID
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Memory Consolidation
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
memoryforge consolidate suggest [--limit N]
|
|
162
|
+
memoryforge consolidate apply ID1 ID2 ... --content "merged content"
|
|
163
|
+
memoryforge consolidate rollback CONSOLIDATED_ID
|
|
164
|
+
memoryforge consolidate stats
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Staleness Management
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
memoryforge stale list
|
|
171
|
+
memoryforge stale mark MEMORY_ID --reason "outdated"
|
|
172
|
+
memoryforge stale clear MEMORY_ID
|
|
173
|
+
memoryforge stale unused [--days N]
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Git Integration
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
memoryforge git status
|
|
180
|
+
memoryforge git sync [--limit N] # Find architectural commits
|
|
181
|
+
memoryforge git link MEMORY_ID COMMIT_SHA
|
|
182
|
+
memoryforge git activity [--days N]
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Team Sync
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
memoryforge sync init --path ./shared-folder
|
|
189
|
+
memoryforge sync push [--force]
|
|
190
|
+
memoryforge sync pull
|
|
191
|
+
memoryforge sync status
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Database Migration
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
memoryforge migrate [--rollback] [--backup-file FILE]
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Graph Memory (v3)
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
memoryforge graph view MEMORY_ID # View memory relationships
|
|
204
|
+
memoryforge graph link SRC_ID TGT_ID # Create relationship
|
|
205
|
+
-t, --type [caused_by|supersedes|relates_to|blocks|depends_on]
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Conflict Management (v3)
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
memoryforge conflicts list [--memory-id ID] # List sync conflicts
|
|
212
|
+
memoryforge conflicts show MEMORY_ID # Detailed conflict history
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Confidence Scoring (v3)
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
memoryforge confidence show MEMORY_ID # View confidence breakdown
|
|
219
|
+
memoryforge confidence update MEMORY_ID # Recalculate score
|
|
220
|
+
memoryforge confidence low [--threshold N] # List low-confidence memories
|
|
221
|
+
memoryforge confidence refresh # Batch update all scores
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Memory Sharing (v3)
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
memoryforge share memory MEMORY_ID # Share a memory with team
|
|
228
|
+
--with TEAM # Share target (default: team)
|
|
229
|
+
-n, --note TEXT # Add a note for recipients
|
|
230
|
+
memoryforge share list # List shared memories
|
|
231
|
+
memoryforge share import FILENAME # Import shared memory
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Configuration
|
|
237
|
+
|
|
238
|
+
Configuration stored in `~/.memoryforge/config.yaml`:
|
|
239
|
+
|
|
240
|
+
```yaml
|
|
241
|
+
embedding_provider: local # "local" or "openai"
|
|
242
|
+
local_embedding_model: all-MiniLM-L6-v2
|
|
243
|
+
openai_api_key: sk-... # Required if using openai
|
|
244
|
+
openai_embedding_model: text-embedding-3-small
|
|
245
|
+
max_results: 5
|
|
246
|
+
min_score: 0.5
|
|
247
|
+
active_project_id: <uuid>
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
> **Note:** Changing `embedding_provider` requires re-indexing: `memoryforge reindex --force`
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## MCP Server
|
|
255
|
+
|
|
256
|
+
MemoryForge integrates with AI IDEs via the Model Context Protocol:
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
memoryforge serve
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### IDE Configuration (Cursor/VSCode)
|
|
263
|
+
|
|
264
|
+
```json
|
|
265
|
+
{
|
|
266
|
+
"mcpServers": {
|
|
267
|
+
"memoryforge": {
|
|
268
|
+
"command": "memoryforge",
|
|
269
|
+
"args": ["serve"]
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Available Tools
|
|
276
|
+
|
|
277
|
+
| Tool | Description |
|
|
278
|
+
|------|-------------|
|
|
279
|
+
| `store_memory` | Store a new memory |
|
|
280
|
+
| `search_memory` | Semantic search |
|
|
281
|
+
| `list_memory` | List recent memories |
|
|
282
|
+
| `delete_memory` | Delete a memory |
|
|
283
|
+
| `memory_timeline` | Chronological view |
|
|
284
|
+
| `list_projects` | List all projects |
|
|
285
|
+
| `switch_project` | Switch active project |
|
|
286
|
+
| `project_status` | Current project info |
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## Troubleshooting
|
|
291
|
+
|
|
292
|
+
| Error | Cause | Fix |
|
|
293
|
+
|-------|-------|-----|
|
|
294
|
+
| `vector dimension mismatch` | Embedding provider changed | `rm -rf ~/.memoryforge/qdrant && memoryforge reindex` |
|
|
295
|
+
| `Memory not found in search` | Qdrant indexing failed | `memoryforge confirm <id> --force` |
|
|
296
|
+
| `database is locked` | Multiple processes | Ensure single CLI/MCP instance |
|
|
297
|
+
| `SyncConflictError` | Concurrent team edits | `memoryforge sync push --force` |
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## Development
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
git clone https://github.com/agusain2001/memoryforge.git
|
|
305
|
+
cd memoryforge
|
|
306
|
+
pip install -e ".[dev]"
|
|
307
|
+
pytest tests/ -v
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## License
|
|
313
|
+
|
|
314
|
+
MIT License - see [LICENSE](LICENSE)
|