memorygraphMCP 0.11.7__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.
Files changed (65) hide show
  1. memorygraph/__init__.py +50 -0
  2. memorygraph/__main__.py +12 -0
  3. memorygraph/advanced_tools.py +509 -0
  4. memorygraph/analytics/__init__.py +46 -0
  5. memorygraph/analytics/advanced_queries.py +727 -0
  6. memorygraph/backends/__init__.py +21 -0
  7. memorygraph/backends/base.py +179 -0
  8. memorygraph/backends/cloud.py +75 -0
  9. memorygraph/backends/cloud_backend.py +858 -0
  10. memorygraph/backends/factory.py +577 -0
  11. memorygraph/backends/falkordb_backend.py +749 -0
  12. memorygraph/backends/falkordblite_backend.py +746 -0
  13. memorygraph/backends/ladybugdb_backend.py +242 -0
  14. memorygraph/backends/memgraph_backend.py +327 -0
  15. memorygraph/backends/neo4j_backend.py +298 -0
  16. memorygraph/backends/sqlite_fallback.py +463 -0
  17. memorygraph/backends/turso.py +448 -0
  18. memorygraph/cli.py +743 -0
  19. memorygraph/cloud_database.py +297 -0
  20. memorygraph/config.py +295 -0
  21. memorygraph/database.py +933 -0
  22. memorygraph/graph_analytics.py +631 -0
  23. memorygraph/integration/__init__.py +69 -0
  24. memorygraph/integration/context_capture.py +426 -0
  25. memorygraph/integration/project_analysis.py +583 -0
  26. memorygraph/integration/workflow_tracking.py +492 -0
  27. memorygraph/intelligence/__init__.py +59 -0
  28. memorygraph/intelligence/context_retrieval.py +447 -0
  29. memorygraph/intelligence/entity_extraction.py +386 -0
  30. memorygraph/intelligence/pattern_recognition.py +420 -0
  31. memorygraph/intelligence/temporal.py +374 -0
  32. memorygraph/migration/__init__.py +27 -0
  33. memorygraph/migration/manager.py +579 -0
  34. memorygraph/migration/models.py +142 -0
  35. memorygraph/migration/scripts/__init__.py +17 -0
  36. memorygraph/migration/scripts/bitemporal_migration.py +595 -0
  37. memorygraph/migration/scripts/multitenancy_migration.py +452 -0
  38. memorygraph/migration_tools_module.py +146 -0
  39. memorygraph/models.py +684 -0
  40. memorygraph/proactive/__init__.py +46 -0
  41. memorygraph/proactive/outcome_learning.py +444 -0
  42. memorygraph/proactive/predictive.py +410 -0
  43. memorygraph/proactive/session_briefing.py +399 -0
  44. memorygraph/relationships.py +668 -0
  45. memorygraph/server.py +883 -0
  46. memorygraph/sqlite_database.py +1876 -0
  47. memorygraph/tools/__init__.py +59 -0
  48. memorygraph/tools/activity_tools.py +262 -0
  49. memorygraph/tools/memory_tools.py +315 -0
  50. memorygraph/tools/migration_tools.py +181 -0
  51. memorygraph/tools/relationship_tools.py +147 -0
  52. memorygraph/tools/search_tools.py +406 -0
  53. memorygraph/tools/temporal_tools.py +339 -0
  54. memorygraph/utils/__init__.py +10 -0
  55. memorygraph/utils/context_extractor.py +429 -0
  56. memorygraph/utils/error_handling.py +151 -0
  57. memorygraph/utils/export_import.py +425 -0
  58. memorygraph/utils/graph_algorithms.py +200 -0
  59. memorygraph/utils/pagination.py +149 -0
  60. memorygraph/utils/project_detection.py +133 -0
  61. memorygraphmcp-0.11.7.dist-info/METADATA +970 -0
  62. memorygraphmcp-0.11.7.dist-info/RECORD +65 -0
  63. memorygraphmcp-0.11.7.dist-info/WHEEL +4 -0
  64. memorygraphmcp-0.11.7.dist-info/entry_points.txt +2 -0
  65. memorygraphmcp-0.11.7.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,970 @@
1
+ Metadata-Version: 2.4
2
+ Name: memorygraphMCP
3
+ Version: 0.11.7
4
+ Summary: Graph-based MCP memory server for AI coding agents with intelligent relationship tracking and multi-backend support
5
+ Project-URL: Homepage, https://github.com/gregorydickson/memory-graph
6
+ Project-URL: Repository, https://github.com/gregorydickson/memory-graph
7
+ Project-URL: Issues, https://github.com/gregorydickson/memory-graph/issues
8
+ Project-URL: Documentation, https://github.com/gregorydickson/memory-graph/blob/main/docs/
9
+ Author-email: Gregory Dickson <gregory.d.dickson@gmail.com>
10
+ License: MIT License
11
+
12
+ Copyright (c) 2024 Claude Code Memory Contributors
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+ License-File: LICENSE
32
+ Keywords: ai,claude-code,coding-agent,graph-database,knowledge-graph,mcp,memgraph,memory,neo4j,sqlite
33
+ Classifier: Development Status :: 5 - Production/Stable
34
+ Classifier: Intended Audience :: Developers
35
+ Classifier: License :: OSI Approved :: MIT License
36
+ Classifier: Programming Language :: Python :: 3
37
+ Classifier: Programming Language :: Python :: 3.10
38
+ Classifier: Programming Language :: Python :: 3.11
39
+ Classifier: Programming Language :: Python :: 3.12
40
+ Classifier: Topic :: Database :: Database Engines/Servers
41
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
42
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
43
+ Requires-Python: >=3.10
44
+ Requires-Dist: mcp>=1.23.0
45
+ Requires-Dist: networkx>=3.0.0
46
+ Requires-Dist: pydantic>=2.10.0
47
+ Requires-Dist: python-dotenv>=1.0.0
48
+ Requires-Dist: typing-extensions>=4.0.0
49
+ Provides-Extra: all
50
+ Requires-Dist: falkordb>=1.0.0; extra == 'all'
51
+ Requires-Dist: falkordblite>=0.4.0; extra == 'all'
52
+ Requires-Dist: libsql-experimental>=0.0.30; extra == 'all'
53
+ Requires-Dist: neo4j>=6.0.0; extra == 'all'
54
+ Requires-Dist: real-ladybug>=0.12.2; extra == 'all'
55
+ Requires-Dist: sentence-transformers>=5.0.0; extra == 'all'
56
+ Requires-Dist: spacy>=3.0.0; extra == 'all'
57
+ Provides-Extra: dev
58
+ Requires-Dist: black>=24.0.0; extra == 'dev'
59
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
60
+ Requires-Dist: pre-commit>=4.0.0; extra == 'dev'
61
+ Requires-Dist: pytest-asyncio>=1.0.0; extra == 'dev'
62
+ Requires-Dist: pytest-cov>=6.0.0; extra == 'dev'
63
+ Requires-Dist: pytest-mock>=3.10.0; extra == 'dev'
64
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
65
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
66
+ Provides-Extra: falkordb
67
+ Requires-Dist: falkordb>=1.0.0; extra == 'falkordb'
68
+ Provides-Extra: falkordblite
69
+ Requires-Dist: falkordblite>=0.4.0; extra == 'falkordblite'
70
+ Provides-Extra: intelligence
71
+ Requires-Dist: sentence-transformers>=5.0.0; extra == 'intelligence'
72
+ Requires-Dist: spacy>=3.0.0; extra == 'intelligence'
73
+ Provides-Extra: ladybugdb
74
+ Requires-Dist: real-ladybug>=0.12.2; extra == 'ladybugdb'
75
+ Provides-Extra: memgraph
76
+ Requires-Dist: neo4j>=6.0.0; extra == 'memgraph'
77
+ Provides-Extra: neo4j
78
+ Requires-Dist: neo4j>=6.0.0; extra == 'neo4j'
79
+ Provides-Extra: turso
80
+ Requires-Dist: libsql-experimental>=0.0.30; extra == 'turso'
81
+ Description-Content-Type: text/markdown
82
+
83
+ <p align="center">
84
+ <img src="docs/html/logo-220.png" alt="MemoryGraph Logo" width="220">
85
+ </p>
86
+
87
+ <h1 align="center">MemoryGraph</h1>
88
+
89
+ <p align="center">
90
+ <strong>Graph-based MCP Memory Server for AI Coding Agents</strong>
91
+ </p>
92
+
93
+ <p align="center">
94
+ <a href="https://github.com/gregorydickson/memory-graph/actions/workflows/test.yml"><img src="https://github.com/gregorydickson/memory-graph/actions/workflows/test.yml/badge.svg" alt="Tests"></a>
95
+ <a href="https://pypi.org/project/memorygraphMCP/"><img src="https://img.shields.io/pypi/v/memorygraphMCP" alt="PyPI MCP"></a>
96
+ <a href="https://pypi.org/project/memorygraphsdk/"><img src="https://img.shields.io/pypi/v/memorygraphsdk" alt="PyPI SDK"></a>
97
+ <a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-3.9%2B-blue" alt="Python"></a>
98
+ <a href="docs/CONFIGURATION.md"><img src="https://img.shields.io/badge/setup-zero--config-green" alt="Zero Config"></a>
99
+ <a href="docs/CONFIGURATION.md"><img src="https://img.shields.io/badge/backends-8%20options-purple" alt="8 Backends"></a>
100
+ </p>
101
+
102
+ <p align="center">
103
+ A graph-based <a href="https://modelcontextprotocol.io">Model Context Protocol (MCP)</a> server that gives AI coding agents persistent memory.<br>
104
+ Store patterns, track relationships, retrieve knowledge across sessions.
105
+ </p>
106
+
107
+ ---
108
+
109
+ ## Quick Start
110
+
111
+ ### Claude Code CLI (30 seconds)
112
+
113
+ ```bash
114
+ # 1. Install (will use default SQLite database)
115
+ pipx install memorygraphMCP
116
+
117
+ # 1b. Optionally, you can specify a backend
118
+ pipx install "memorygraphMCP[falkordblite]"
119
+
120
+ # 2. Add to Claude Code (see docs/quickstart/ for other coding agents)
121
+ claude mcp add --scope user memorygraph -- memorygraph
122
+
123
+ # 3. Restart Claude Code (exit and run 'claude' again)
124
+ ```
125
+
126
+ **Verify it works:**
127
+ ```bash
128
+ claude mcp list # Should show memorygraph with "Connected"
129
+ ```
130
+
131
+ Then in your coding agent you can ask it to remember important items: *"Remember this for later: Use pytest for Python testing"*
132
+
133
+ ![Memory Creation](docs/images/memory-creation.jpg)
134
+
135
+ > **Other MCP clients?** See [Supported Clients](#supported-mcp-clients) below.
136
+ >
137
+ > **Need pipx?** `pip install --user pipx && pipx ensurepath`
138
+ >
139
+ > **Command not found?** Run `pipx ensurepath` and restart your terminal.
140
+
141
+ **Important:** MemoryGraph provides memory tools, but your coding agent won't use them automatically. You need to prompt or configure it to store memories. See [Memory Best Practices](#memory-best-practices) below.
142
+
143
+ **Quick setup:** Add this to your `~/.claude/CLAUDE.md` or `AGENTS.md` to enable automatic memory storage:
144
+ ```markdown
145
+ ## Memory Protocol
146
+
147
+ ### REQUIRED: Before Starting Work
148
+ You MUST use `recall_memories` before any task. Query by project, tech, or task type.
149
+
150
+ ### REQUIRED: Automatic Storage Triggers
151
+ Store memories on ANY of:
152
+ - **Git commit** → what was fixed/added
153
+ - **Bug fix** → problem + solution
154
+ - **Version release** → summarize changes
155
+ - **Architecture decision** → choice + rationale
156
+ - **Pattern discovered** → reusable approach
157
+
158
+ ### Timing Mode (default: on-commit)
159
+ `memory_mode: immediate | on-commit | session-end`
160
+
161
+ ### Memory Fields
162
+ - **Type**: solution | problem | code_pattern | fix | error | workflow
163
+ - **Title**: Specific, searchable (not generic)
164
+ - **Content**: Accomplishment, decisions, patterns
165
+ - **Tags**: project, tech, category (REQUIRED)
166
+ - **Importance**: 0.8+ critical, 0.5-0.7 standard, 0.3-0.4 minor
167
+ - **Relationships**: Link related memories when they exist
168
+
169
+ Do NOT wait to be asked. Memory storage is automatic.
170
+ ```
171
+
172
+ See [CLAUDE.md Examples](docs/examples/CLAUDE_MD_EXAMPLES.md) for more configuration templates.
173
+
174
+ ## Supported MCP Clients
175
+
176
+ MemoryGraph works with any MCP-compliant AI coding tool:
177
+
178
+ | Client | Type | Quick Start |
179
+ |--------|------|-------------|
180
+ | **Claude Code** | CLI/IDE | [Setup Guide](docs/CLAUDE_CODE_SETUP.md) |
181
+ | **Claude Desktop** | Desktop App | [Setup Guide](docs/quickstart/CLAUDE_DESKTOP.md) |
182
+ | **ChatGPT Desktop** | Desktop App | [Setup Guide](docs/quickstart/CHATGPT_DESKTOP.md) |
183
+ | **Cursor AI** | IDE | [Setup Guide](docs/quickstart/CURSOR_SETUP.md) |
184
+ | **Windsurf** | IDE | [Setup Guide](docs/quickstart/WINDSURF_SETUP.md) |
185
+ | **VS Code + Copilot** | IDE (1.102+) | [Setup Guide](docs/quickstart/VSCODE_COPILOT_SETUP.md) |
186
+ | **Continue.dev** | VS Code/JetBrains | [Setup Guide](docs/quickstart/CONTINUE_SETUP.md) |
187
+ | **Cline** | VS Code | [Setup Guide](docs/quickstart/CLINE_SETUP.md) |
188
+ | **Gemini CLI** | CLI | [Setup Guide](docs/quickstart/GEMINI_CLI_SETUP.md) |
189
+
190
+ See [CONFIGURATION.md](docs/CONFIGURATION.md) for detailed compatibility info.
191
+
192
+ ---
193
+
194
+ ## Why MemoryGraph?
195
+
196
+ ### Graph Relationships Make the Difference
197
+
198
+ Research shows that naive vector search degrades on long-horizon and temporal tasks. Benchmarks such as Deep Memory Retrieval (DMR) and LongMemEval were introduced precisely because graph-based systems excel at temporal queries ("what did the user decide last week"), cross-session reasoning, and multi-hop questions requiring explicit relational paths.
199
+
200
+ Graph memory captures entities, relationships, and temporal markers that traditional vector stores miss. For example: `Alice COMPLETED authentication_service`, `Bob BLOCKED_BY schema_conflicts` with timeline information about when events occurred.
201
+
202
+ **Flat storage** (CLAUDE.md, vector stores):
203
+ ```
204
+ Memory 1: "Fixed timeout by adding retry logic"
205
+ Memory 2: "Retry logic caused memory leak"
206
+ Memory 3: "Fixed memory leak with connection pooling"
207
+ ```
208
+ No connection between these - search finds them separately. Best for static rules and prime directives.
209
+
210
+ **Graph storage** (MemoryGraph):
211
+ ```
212
+ [timeout_fix] --CAUSES--> [memory_leak] --SOLVED_BY--> [connection_pooling]
213
+ | |
214
+ +------------------SUPERSEDED_BY------------------------+
215
+ ```
216
+ Query: "What happened with retry logic?" → Returns the full causal chain.
217
+
218
+ ### When to Use What
219
+
220
+ | Use CLAUDE.md For | Use MemoryGraph For |
221
+ |-------------------|---------------------|
222
+ | "Always use 2-space indentation" | "Last time we used 4-space, it broke the linter" |
223
+ | "Run tests before committing" | "The auth tests failed because of X, fixed by Y" |
224
+ | Static rules, prime directives | Dynamic learnings with relationships |
225
+
226
+ ### Relationship Types
227
+
228
+ MemoryGraph tracks 7 categories of relationships:
229
+ - **Causal**: CAUSES, TRIGGERS, LEADS_TO, PREVENTS
230
+ - **Solution**: SOLVES, ADDRESSES, ALTERNATIVE_TO, IMPROVES
231
+ - **Context**: OCCURS_IN, APPLIES_TO, WORKS_WITH, REQUIRES
232
+ - **Learning**: BUILDS_ON, CONTRADICTS, CONFIRMS
233
+ - **Similarity**: SIMILAR_TO, VARIANT_OF, RELATED_TO
234
+ - **Workflow**: FOLLOWS, DEPENDS_ON, ENABLES, BLOCKS
235
+ - **Quality**: EFFECTIVE_FOR, PREFERRED_OVER, DEPRECATED_BY
236
+
237
+ ---
238
+
239
+ ## Choose Your Mode
240
+
241
+ | Feature | Core (Default) | Extended |
242
+ |---------|----------------|----------|
243
+ | Memory Storage | 9 tools | 12 tools |
244
+ | Relationships | Yes | Yes |
245
+ | Session Briefings | Yes | Yes |
246
+ | Database Stats | - | Yes |
247
+ | Complex Queries | - | Yes |
248
+ | Contextual Search | - | Yes |
249
+ | Backend | SQLite | SQLite |
250
+ | Setup Time | 30 sec | 30 sec |
251
+
252
+ ```bash
253
+ memorygraph # Core (default, 9 tools)
254
+ memorygraph --profile extended # Extended (12 tools)
255
+ ```
256
+
257
+ ### Core Mode (Default)
258
+
259
+ Provides all essential tools for daily use. Store memories, create relationships, search with fuzzy matching, and get session briefings. **This is all most users need.**
260
+
261
+ ### When to Use Extended Mode
262
+
263
+ Switch to extended mode when you need:
264
+
265
+ - **Database statistics** (`get_memory_statistics`) - See total memories, breakdown by type, average importance scores, and graph metrics. Useful for understanding how your knowledge base is growing.
266
+
267
+ - **Complex relationship queries** (`search_relationships_by_context`) - Search relationships by structured context fields like scope, conditions, and evidence. Example: "Find all partial implementations" or "Show relationships with experimental evidence."
268
+
269
+ **Common extended mode scenarios:**
270
+ - Auditing your memory graph before a major refactor
271
+ - Analyzing patterns across hundreds of memories
272
+ - Finding all conditionally-applied solutions
273
+ - Generating reports on project knowledge coverage
274
+
275
+ ```bash
276
+ # Enable extended mode in Claude Code
277
+ claude mcp add --scope user memorygraph -- memorygraph --profile extended
278
+ ```
279
+
280
+ See [TOOL_PROFILES.md](docs/TOOL_PROFILES.md) for complete tool list and details.
281
+
282
+ ---
283
+
284
+ ## Installation Options
285
+
286
+ ### pipx (Recommended)
287
+
288
+ ```bash
289
+ pipx install memorygraphMCP # Core mode (default, SQLite)
290
+ pipx install "memorygraphMCP[neo4j]" # With Neo4j backend support
291
+ pipx install "memorygraphMCP[falkordblite]" # With FalkorDBLite backend (embedded)
292
+ pipx install "memorygraphMCP[ladybugdb]" # With LadybugDB backend (embedded)
293
+ pipx install "memorygraphMCP[falkordb]" # With FalkorDB backend (client-server)
294
+ ```
295
+
296
+ ### pip
297
+
298
+ ```bash
299
+ pip install --user memorygraphMCP
300
+ ```
301
+
302
+ ### Docker
303
+
304
+ ```bash
305
+ docker compose up -d # SQLite
306
+ docker compose -f docker-compose.neo4j.yml up -d # Neo4j
307
+ ```
308
+
309
+ ### uvx (Quick Test)
310
+
311
+ ```bash
312
+ uvx memorygraph --version # No install needed
313
+ ```
314
+
315
+ | Method | Best For | Persistence |
316
+ |--------|----------|-------------|
317
+ | pipx | Most users | Yes |
318
+ | pip | PATH already configured | Yes |
319
+ | Docker | Teams, production | Yes |
320
+ | uvx | Quick testing | No |
321
+
322
+ See [CONFIGURATION.md](docs/CONFIGURATION.md) for detailed options.
323
+
324
+ ---
325
+
326
+ ## Claude Code Web Support
327
+
328
+ MemoryGraph works in Claude Code Web (remote) environments via project hooks.
329
+
330
+ ### Quick Setup
331
+
332
+ Copy the hook files to your project:
333
+
334
+ ```bash
335
+ # From memorygraph repo
336
+ cp -r examples/claude-code-hooks/.claude /path/to/your/project/
337
+
338
+ # Commit to your repo
339
+ cd /path/to/your/project
340
+ git add .claude/
341
+ git commit -m "Add MemoryGraph auto-install hooks"
342
+ ```
343
+
344
+ When you open this project in Claude Code Web, MemoryGraph installs automatically.
345
+
346
+ ### Persistent Storage (Optional)
347
+
348
+ Remote environments are ephemeral. For persistent memories, configure cloud storage
349
+ in your Claude Code Web environment variables:
350
+
351
+ | Variable | Description |
352
+ |----------|-------------|
353
+ | `MEMORYGRAPH_API_KEY` | API key from memorygraph.dev (coming soon) |
354
+ | `MEMORYGRAPH_TURSO_URL` | Your Turso database URL |
355
+ | `MEMORYGRAPH_TURSO_TOKEN` | Your Turso auth token |
356
+
357
+ See [Claude Code Web Setup](docs/claude-code-web.md) for detailed instructions.
358
+
359
+ ---
360
+
361
+ ## Configuration
362
+
363
+ ### Claude Code CLI
364
+
365
+ ```bash
366
+ # Core mode (default)
367
+ claude mcp add --scope user memorygraph -- memorygraph
368
+
369
+ # Extended mode
370
+ claude mcp add --scope user memorygraph -- memorygraph --profile extended
371
+
372
+ # Extended mode with Neo4j backend
373
+ claude mcp add --scope user memorygraph \
374
+ --env MEMORY_NEO4J_URI=bolt://localhost:7687 \
375
+ --env MEMORY_NEO4J_USER=neo4j \
376
+ --env MEMORY_NEO4J_PASSWORD=password \
377
+ -- memorygraph --profile extended --backend neo4j
378
+
379
+ # Cloud backend (multi-device sync, zero setup)
380
+ claude mcp add --scope user memorygraph \
381
+ --env MEMORYGRAPH_API_KEY=mg_your_key_here \
382
+ -- memorygraph --backend cloud
383
+ ```
384
+
385
+ > **Get your API key**: Sign up at [memorygraph.dev](https://memorygraph.dev) to get your free API key.
386
+
387
+ ### Other MCP Clients
388
+
389
+ ```json
390
+ {
391
+ "mcpServers": {
392
+ "memorygraph": {
393
+ "command": "memorygraph",
394
+ "args": ["--profile", "extended"]
395
+ }
396
+ }
397
+ }
398
+ ```
399
+
400
+ See [CONFIGURATION.md](docs/CONFIGURATION.md) for all options.
401
+
402
+ ### Recommended: Add to CLAUDE.md
403
+
404
+ For best results, add this to your `CLAUDE.md` or project instructions:
405
+
406
+ ```markdown
407
+ ## Memory Tools
408
+ When recalling past work or learnings, always start with `recall_memories`
409
+ before using `search_memories`. The recall tool has optimized defaults
410
+ for natural language queries (fuzzy matching, relationship context included).
411
+ ```
412
+
413
+ This helps Claude use the optimal tool for memory recall.
414
+
415
+ ---
416
+
417
+ ## Usage
418
+
419
+ ### Store Memories
420
+
421
+ ```json
422
+ {
423
+ "tool": "store_memory",
424
+ "content": "Use bcrypt for password hashing",
425
+ "memory_type": "CodePattern",
426
+ "tags": ["security", "authentication"]
427
+ }
428
+ ```
429
+
430
+ ### Recall Memories (Recommended)
431
+
432
+ ```json
433
+ {
434
+ "tool": "recall_memories",
435
+ "query": "authentication security"
436
+ }
437
+ ```
438
+
439
+ Returns fuzzy-matched results with relationship context and match quality hints.
440
+
441
+ ### Search Memories (Advanced)
442
+
443
+ ```json
444
+ {
445
+ "tool": "search_memories",
446
+ "query": "authentication",
447
+ "search_tolerance": "strict",
448
+ "limit": 5
449
+ }
450
+ ```
451
+
452
+ Use when you need exact matching or advanced filtering.
453
+
454
+ ### Create Relationships
455
+
456
+ ```json
457
+ {
458
+ "tool": "create_relationship",
459
+ "from_memory_id": "mem_123",
460
+ "to_memory_id": "mem_456",
461
+ "relationship_type": "SOLVES"
462
+ }
463
+ ```
464
+
465
+ ![Memory Report](docs/images/memory-report.jpg)
466
+
467
+ See [docs/examples/](docs/examples/) for more use cases.
468
+
469
+ ---
470
+
471
+ ## Memory Best Practices
472
+
473
+ ### Why Memories Aren't Automatic
474
+
475
+ MemoryGraph is an MCP tool provider, not an autonomous agent. This means:
476
+ - **Claude needs to be prompted** to use the memory tools
477
+ - **You control what gets stored** - nothing is saved without explicit instruction
478
+ - **Configuration is key** - Add memory protocols to your CLAUDE.md for consistent behavior
479
+
480
+ This design gives you full control over your memory graph, but requires setup to work effectively.
481
+
482
+ ### How to Encourage Memory Creation
483
+
484
+ #### 1. Configure CLAUDE.md (Recommended)
485
+
486
+ Add a memory protocol to `~/.claude/CLAUDE.md` for persistent behavior across all sessions:
487
+
488
+ ```markdown
489
+ ## Memory Protocol
490
+
491
+ ### REQUIRED: Before Starting Work
492
+ You MUST use `recall_memories` before any task. Query by project, tech, or task type.
493
+
494
+ ### REQUIRED: Automatic Storage Triggers
495
+ Store memories on ANY of:
496
+ - **Git commit** → what was fixed/added
497
+ - **Bug fix** → problem + solution
498
+ - **Version release** → summarize changes
499
+ - **Architecture decision** → choice + rationale
500
+ - **Pattern discovered** → reusable approach
501
+
502
+ ### Timing Mode (default: on-commit)
503
+ `memory_mode: immediate | on-commit | session-end`
504
+
505
+ ### Memory Fields
506
+ - **Type**: solution | problem | code_pattern | fix | error | workflow
507
+ - **Title**: Specific, searchable (not generic)
508
+ - **Content**: Accomplishment, decisions, patterns
509
+ - **Tags**: project, tech, category (REQUIRED)
510
+ - **Importance**: 0.8+ critical, 0.5-0.7 standard, 0.3-0.4 minor
511
+ - **Relationships**: Link related memories when they exist
512
+
513
+ Do NOT wait to be asked. Memory storage is automatic.
514
+ ```
515
+
516
+ #### 2. Use Trigger Phrases
517
+
518
+ Claude responds well to explicit memory-related requests:
519
+
520
+ **For storing**:
521
+ - "Store this for later..."
522
+ - "Remember that..."
523
+ - "Save this pattern..."
524
+ - "Record this decision..."
525
+ - "Create a memory about..."
526
+
527
+ **For recalling**:
528
+ - "What do you remember about...?"
529
+ - "Have we solved this before?"
530
+ - "Recall any patterns for..."
531
+ - "What did we decide about...?"
532
+
533
+ **For session management**:
534
+ - "Summarize and store what we accomplished today"
535
+ - "Store a summary of this session"
536
+ - "Catch me up on this project" (uses stored memories)
537
+
538
+ #### 3. Establish Workflow Habits
539
+
540
+ **Start of session**:
541
+ ```
542
+ You: "What do you remember about the authentication system?"
543
+ Claude: [Uses recall_memories to find relevant context]
544
+ ```
545
+
546
+ **During work**:
547
+ ```
548
+ You: "We fixed the Redis timeout by increasing the connection pool to 50. Store this solution."
549
+ Claude: [Uses store_memory, then create_relationship to link to the problem]
550
+ ```
551
+
552
+ **End of session**:
553
+ ```
554
+ You: "Store a summary of what we accomplished today"
555
+ Claude: [Creates a task-type memory with summary and links]
556
+ ```
557
+
558
+ #### 4. Project-Specific Configuration
559
+
560
+ For team projects or specific repositories, add `.claude/CLAUDE.md` to the project:
561
+
562
+ ```markdown
563
+ ## Project Memory Protocol
564
+
565
+ This project uses MemoryGraph for team knowledge sharing.
566
+
567
+ ### When to Store
568
+ - Solutions to project-specific problems
569
+ - Architecture decisions and rationale
570
+ - Deployment procedures and gotchas
571
+ - Performance optimizations
572
+ - Bug fixes and root causes
573
+
574
+ ### Tagging Convention
575
+ Always include these tags:
576
+ - Project name: "my-app"
577
+ - Component: "auth", "api", "database", etc.
578
+ - Type: "fix", "feature", "optimization", etc.
579
+
580
+ ### Example
581
+ When fixing a bug:
582
+ 1. Store the problem (type: problem)
583
+ 2. Store the solution (type: solution)
584
+ 3. Link them: solution SOLVES problem
585
+ 4. Tag both with component and "bug-fix"
586
+ ```
587
+
588
+ ### Memory Types Guide
589
+
590
+ Choose the right type for better organization:
591
+
592
+ | Type | Use For | Example |
593
+ |------|---------|---------|
594
+ | **solution** | Working fixes and implementations | "Fixed N+1 query with eager loading" |
595
+ | **problem** | Issues encountered | "Database deadlock under high concurrency" |
596
+ | **code_pattern** | Reusable patterns | "Repository pattern for database access" |
597
+ | **decision** | Architecture choices | "Chose PostgreSQL over MongoDB for transactions" |
598
+ | **task** | Work completed | "Implemented user authentication" |
599
+ | **technology** | Tool/framework knowledge | "FastAPI dependency injection best practices" |
600
+ | **error** | Specific errors | "ImportError: module not found" |
601
+ | **fix** | Error resolutions | "Added missing import statement" |
602
+
603
+ ### Relationship Types Guide
604
+
605
+ Common relationship patterns:
606
+
607
+ ```markdown
608
+ # Causal relationships
609
+ problem --CAUSES--> error
610
+ change --TRIGGERS--> bug
611
+
612
+ # Solution relationships
613
+ solution --SOLVES--> problem
614
+ fix --ADDRESSES--> error
615
+ pattern --IMPROVES--> code
616
+
617
+ # Context relationships
618
+ pattern --APPLIES_TO--> project
619
+ solution --REQUIRES--> dependency
620
+ pattern --WORKS_WITH--> technology
621
+
622
+ # Learning relationships
623
+ new_approach --BUILDS_ON--> old_approach
624
+ finding --CONTRADICTS--> assumption
625
+ result --CONFIRMS--> hypothesis
626
+ ```
627
+
628
+ ### Example Workflows
629
+
630
+ **Debugging workflow**:
631
+ ```
632
+ 1. Encounter error → Store as type: error
633
+ 2. Find root cause → Store as type: problem, link: error TRIGGERS problem
634
+ 3. Implement fix → Store as type: solution, link: solution SOLVES problem
635
+ 4. Result: Complete chain for future reference
636
+ ```
637
+
638
+ **Feature development workflow**:
639
+ ```
640
+ 1. Start: "Recall any patterns for user authentication"
641
+ 2. Implement: [Work on feature]
642
+ 3. Store: "Store this authentication pattern" → type: code_pattern
643
+ 4. Link: pattern APPLIES_TO project
644
+ 5. End: "Store summary of authentication implementation"
645
+ ```
646
+
647
+ **Optimization workflow**:
648
+ ```
649
+ 1. Identify issue → Store as type: problem
650
+ 2. Test solutions → Store each as type: solution
651
+ 3. Compare → Link: best_solution IMPROVES other_solutions
652
+ 4. Document → Store decision with rationale
653
+ ```
654
+
655
+ ### More Examples and Templates
656
+
657
+ For comprehensive CLAUDE.md configuration examples including:
658
+ - Domain-specific setups (web dev, ML, DevOps)
659
+ - Team collaboration protocols
660
+ - Migration strategies from other systems
661
+
662
+ See: [CLAUDE.md Configuration Examples](docs/examples/CLAUDE_MD_EXAMPLES.md)
663
+
664
+ ---
665
+
666
+ ## Backends
667
+
668
+ MemoryGraph supports 8 backend options to fit your deployment needs:
669
+
670
+ | Backend | Type | Config | Native Graph | Zero-Config | Best For |
671
+ |---------|------|--------|--------------|-------------|----------|
672
+ | **sqlite** | Embedded | File path | No (simulated) | ✅ | Default, simple use |
673
+ | **falkordblite** | Embedded | File path | ✅ Cypher | ✅ | Graph queries without server |
674
+ | **ladybugdb** | Embedded | File path | ✅ Cypher | ✅ | Graph queries without server |
675
+ | **falkordb** | Client-server | Host:port | ✅ Cypher | ❌ | High-performance production |
676
+ | **neo4j** | Client-server | URI | ✅ Cypher | ❌ | Enterprise features |
677
+ | **memgraph** | Client-server | Host:port | ✅ Cypher | ❌ | Real-time analytics |
678
+ | **turso** | Cloud | URL + Token | No (simulated) | ❌ | Distributed SQLite, edge deployments |
679
+ | **cloud** | Cloud | API Key | ✅ Cypher | ❌ | MemoryGraph Cloud (production ready) |
680
+
681
+ **New: FalkorDB Options**
682
+ - **FalkorDBLite**: Zero-config embedded database with native Cypher support, perfect upgrade from SQLite
683
+ - **LadybugDB**: Leading columnar embedded graph database with Cypher support
684
+ - **FalkorDB**: Redis-based graph DB with 500x faster p99 than Neo4j ([docs](https://docs.falkordb.com/))
685
+
686
+ **New: Cloud Backend**
687
+ - **Multi-device sync**: Access your memories from anywhere
688
+ - **Team collaboration**: Share memories with your team
689
+ - **Automatic backups**: Never lose your knowledge graph
690
+ - **Zero maintenance**: No database setup required
691
+
692
+ See [CONFIGURATION.md](docs/CONFIGURATION.md) for setup details and [Cloud Backend Guide](docs/CLOUD_BACKEND.md) for cloud-specific configuration.
693
+
694
+ ---
695
+
696
+ ## Multi-Tenancy (v0.10.0+)
697
+
698
+ MemoryGraph now supports optional multi-tenancy for team memory sharing and organizational deployments. Phase 1 provides the foundational schema with 100% backward compatibility.
699
+
700
+ **Key Features:**
701
+ - **Optional**: Disabled by default, zero impact on existing single-tenant deployments
702
+ - **Tenant Isolation**: Scope memories to specific organizations/teams
703
+ - **Visibility Levels**: Control access with `private`, `project`, `team`, or `public` visibility
704
+ - **Migration Support**: Migrate existing databases with built-in CLI command
705
+ - **Performance Optimized**: Conditional indexes only created when multi-tenant mode is enabled
706
+
707
+ **Quick Start:**
708
+ ```bash
709
+ # Migrate existing database to multi-tenant mode
710
+ memorygraph migrate-to-multitenant --tenant-id="acme-corp" --dry-run
711
+
712
+ # Enable multi-tenant mode
713
+ export MEMORY_MULTI_TENANT_MODE=true
714
+ memorygraph
715
+ ```
716
+
717
+ **Use Cases:**
718
+ - Team collaboration and shared memory
719
+ - Multi-team organizations
720
+ - Department-specific knowledge bases
721
+ - Enterprise deployments
722
+
723
+ See [MULTI_TENANCY.md](docs/MULTI_TENANCY.md) for complete guide including architecture, migration steps, and usage patterns.
724
+
725
+ **Roadmap:**
726
+ - ✅ Phase 1 (v0.10.0): Schema enhancement with optional tenant fields
727
+ - Phase 2 (v0.11.0): Query filtering and visibility enforcement
728
+ - Phase 3 (v1.0.0): Authentication integration (JWT, OAuth2)
729
+ - Phase 4 (v1.1.0): Advanced RBAC and audit logging
730
+
731
+ ---
732
+
733
+ ## Architecture
734
+
735
+ ### Memory Types
736
+ - **Task** - Development tasks and patterns
737
+ - **CodePattern** - Reusable solutions
738
+ - **Problem** - Issues encountered
739
+ - **Solution** - How problems were resolved
740
+ - **Project** - Codebase context
741
+ - **Technology** - Framework/tool knowledge
742
+
743
+ ### Project Structure
744
+ ```
745
+ memorygraph/
746
+ ├── src/memorygraph/ # Main source
747
+ │ ├── server.py # MCP server (11 tools)
748
+ │ ├── backends/ # SQLite, Neo4j, Memgraph, FalkorDB, Turso, Cloud
749
+ │ ├── migration/ # Backend-to-backend migration
750
+ │ └── tools/ # Tool implementations
751
+ ├── tests/ # 1,068 tests
752
+ └── docs/ # Documentation
753
+ ```
754
+
755
+ See [schema.md](docs/schema.md) for complete data model.
756
+
757
+ ---
758
+
759
+ ## Troubleshooting
760
+
761
+ **Command not found?**
762
+ ```bash
763
+ pipx ensurepath && source ~/.bashrc # or ~/.zshrc
764
+ ```
765
+
766
+ **MCP connection failed?**
767
+ ```bash
768
+ memorygraph --version # Check installation
769
+ claude mcp list # Check connection status
770
+ ```
771
+
772
+ **Multiple version conflict?**
773
+ ```bash
774
+ # Option A: Use full path to avoid venv conflicts (recommended)
775
+ claude mcp add memorygraph -- ~/.local/bin/memorygraph
776
+
777
+ # Option B: Create symlink for cleaner config (requires sudo once)
778
+ sudo ln -s ~/.local/bin/memorygraph /usr/local/bin/memorygraph
779
+ # Then use simple command
780
+ claude mcp add memorygraph -- memorygraph
781
+ ```
782
+
783
+ See [TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md) for more solutions.
784
+
785
+ ---
786
+
787
+ ## Development
788
+
789
+ ```bash
790
+ git clone https://github.com/gregorydickson/memorygraph.git
791
+ cd memorygraph
792
+ pip install -e ".[dev]"
793
+ pytest tests/ -v --cov=memorygraph
794
+ ```
795
+
796
+ ---
797
+
798
+ ## What's New in v0.11.0
799
+
800
+ ### Python SDK for Agent Frameworks
801
+
802
+ **NEW:** `memorygraphsdk` - Native integrations for popular AI frameworks!
803
+
804
+ ```bash
805
+ pip install memorygraphsdk[all] # All integrations
806
+ ```
807
+
808
+ | Framework | Integration | Description |
809
+ |-----------|-------------|-------------|
810
+ | **LlamaIndex** | `MemoryGraphChatMemory`, `MemoryGraphRetriever` | Chat memory + RAG retrieval |
811
+ | **LangChain** | `MemoryGraphMemory` | BaseMemory with session support |
812
+ | **CrewAI** | `MemoryGraphCrewMemory` | Multi-agent persistent memory |
813
+ | **AutoGen** | `MemoryGraphAutoGenHistory` | Conversation history |
814
+
815
+ ```python
816
+ from memorygraphsdk import MemoryGraphClient
817
+
818
+ client = MemoryGraphClient(api_key="mg_...")
819
+ memory = client.create_memory(
820
+ type="solution",
821
+ title="Fixed Redis timeout",
822
+ content="Used exponential backoff",
823
+ tags=["redis", "fix"]
824
+ )
825
+ ```
826
+
827
+ See [SDK Documentation](sdk/README.md) for full integration guides.
828
+
829
+ ---
830
+
831
+ ## What's New in v0.10.0
832
+
833
+ ### Context Budget Optimization (60-70% token savings)
834
+ - **Leaner tool profiles** - Removed 29 unimplemented tools, keeping only production-ready features
835
+ - **9 core tools / 12 extended** - Focused toolset that fits in any context window
836
+ - **~40k tokens saved** - More room for your actual work
837
+ - **ADR-017** - Context budget as architectural constraint ([docs/adr/017-context-budget-constraint.md](docs/adr/017-context-budget-constraint.md))
838
+
839
+ ### Cloud Backend (Production Ready)
840
+ - **Multi-device sync** - Access memories from anywhere
841
+ - **Circuit breaker pattern** - Resilient to network failures with automatic recovery
842
+ - **Zero setup** - Just add your API key from [memorygraph.dev](https://memorygraph.dev)
843
+ - **Team collaboration ready** - Share knowledge graphs with your team
844
+
845
+ ```bash
846
+ # Enable cloud backend
847
+ claude mcp add --scope user memorygraph \
848
+ --env MEMORYGRAPH_API_KEY=mg_your_key_here \
849
+ -- memorygraph --backend cloud
850
+ ```
851
+
852
+ ### Bi-Temporal Memory Tracking
853
+ - **Time-travel queries** - Query what was known at any point in time
854
+ - **Knowledge evolution** - Track how solutions and understanding changed
855
+ - **Four temporal fields** - `valid_from`, `valid_until`, `recorded_at`, `invalidated_by`
856
+ - **Migration support** - Upgrade existing databases with `migrate_to_bitemporal()`
857
+ - **Inspired by Graphiti** - Learned from Zep AI's proven temporal model
858
+
859
+ ```python
860
+ # Query what solutions existed in March 2024
861
+ march_2024 = datetime(2024, 3, 1, tzinfo=timezone.utc)
862
+ relationships = await db.get_related_memories("error_id", as_of=march_2024)
863
+
864
+ # Get full history of how understanding evolved
865
+ history = await db.get_relationship_history("problem_id")
866
+
867
+ # See what changed in the last week
868
+ changes = await db.what_changed(since=one_week_ago)
869
+ ```
870
+
871
+ ### Semantic Navigation
872
+ - **Contextual search** - LLM-powered graph traversal without embeddings
873
+ - **Graph-first approach** - Validated by Cipher's shift away from vector search
874
+ - **Scoped queries** - Search within related memory contexts
875
+
876
+ See [temporal-memory.md](docs/temporal-memory.md) for comprehensive temporal tracking guide and [CLOUD_BACKEND.md](docs/CLOUD_BACKEND.md) for cloud setup.
877
+
878
+ ---
879
+
880
+ ## What's New in v0.9.5
881
+
882
+ ### Cloud Backend & Turso Support
883
+ - **MemoryGraph Cloud** - REST API client with circuit breaker for resilience (coming soon)
884
+ - **Turso Backend** - Distributed SQLite with embedded replica support for edge deployments
885
+ - **8 total backends** - sqlite, neo4j, memgraph, falkordb, falkordblite, ladybugdb, turso, cloud
886
+
887
+ ### Backend Migration
888
+ - **`memorygraph migrate`** - Migrate data between any two backends
889
+ - **5-phase validation** - Pre-flight checks, export, validate, import, verify
890
+ - **Dry-run mode** - Test migrations without writing data
891
+ - **Rollback support** - Automatic cleanup on failure
892
+
893
+ ```bash
894
+ # Migrate from SQLite to FalkorDB
895
+ memorygraph migrate --from sqlite --to falkordb --to-uri redis://localhost:6379
896
+
897
+ # Test migration first
898
+ memorygraph migrate --from sqlite --to neo4j --dry-run
899
+ ```
900
+
901
+ ### Universal Export/Import
902
+ - **Works with ALL backends** - Export from any backend, import to any backend
903
+ - **Progress reporting** - Track long-running operations
904
+ - **Format v2.0** - Enhanced metadata with backend info and counts
905
+
906
+ ```bash
907
+ memorygraph export --format json --output backup.json
908
+ memorygraph import --format json --input backup.json --skip-duplicates
909
+ ```
910
+
911
+ ### Architecture Improvements
912
+ - **Circuit breaker** - Prevents cascading failures in cloud backend
913
+ - **Thread-safe backend creation** - Safe for concurrent migrations
914
+ - **Async correctness** - All Turso operations properly non-blocking
915
+
916
+ ## What's New in v0.9.0
917
+
918
+ ### Pagination & Cycle Detection
919
+ - **Result pagination** for large datasets with `limit` and `offset` parameters
920
+ - **Cycle detection** prevents circular relationships by default
921
+
922
+ ### Health Check CLI
923
+ - **Quick diagnostics** with `memorygraph --health`
924
+ - **JSON output** with `--health-json` for scripting
925
+
926
+ ---
927
+
928
+ ## Roadmap
929
+
930
+ ### Current (v0.11.0) ✅
931
+ - **Python SDK** - `memorygraphsdk` with LlamaIndex, LangChain, CrewAI, AutoGen integrations
932
+ - **Cloud Backend** - Multi-device sync via memorygraph.dev
933
+ - **Bi-temporal tracking** - Track knowledge evolution over time
934
+ - **Semantic navigation** - LLM-powered contextual search
935
+ - 8 backend options (SQLite, Neo4j, Memgraph, FalkorDB, FalkorDBLite, LadybugDB, Turso, Cloud)
936
+ - 1,200+ tests passing
937
+ - Two PyPI packages: `memorygraphMCP` + `memorygraphsdk`
938
+
939
+ ### Planned (v1.0+)
940
+ - Real-time team sync
941
+ - Multi-tenancy features
942
+ - Enhanced SDK documentation
943
+
944
+ See [PRODUCT_ROADMAP.md](docs/planning/PRODUCT_ROADMAP.md) for details.
945
+
946
+ ---
947
+
948
+ ## Contributing
949
+
950
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
951
+
952
+ ---
953
+
954
+ ## License
955
+
956
+ MIT License - see [LICENSE](LICENSE).
957
+
958
+ ---
959
+
960
+ ## Links
961
+
962
+ - [Documentation](docs/)
963
+ - [GitHub Issues](https://github.com/gregorydickson/memorygraph/issues)
964
+ - [Discussions](https://github.com/gregorydickson/memorygraph/discussions)
965
+
966
+ ---
967
+
968
+ **Made for the Claude Code community**
969
+
970
+ *Start simple. Upgrade when needed. Never lose context again.*