spatial-memory-mcp 1.5.3__tar.gz → 1.6.1__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.

Potentially problematic release.


This version of spatial-memory-mcp might be problematic. Click here for more details.

Files changed (147) hide show
  1. spatial_memory_mcp-1.6.1/CHANGELOG.md +139 -0
  2. spatial_memory_mcp-1.6.1/CLAUDE.md +102 -0
  3. spatial_memory_mcp-1.6.1/ISSUES-TRACKER.md +303 -0
  4. spatial_memory_mcp-1.6.1/MARKETING.md +265 -0
  5. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/PKG-INFO +131 -9
  6. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/README.md +130 -8
  7. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/docs/MCP_SERVER_INSTRUCTIONS.md +1 -1
  8. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/pyproject.toml +1 -1
  9. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/__init__.py +1 -1
  10. spatial_memory_mcp-1.6.1/spatial_memory/__main__.py +270 -0
  11. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/adapters/lancedb_repository.py +74 -5
  12. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/config.py +10 -2
  13. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/core/__init__.py +9 -0
  14. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/core/connection_pool.py +41 -3
  15. spatial_memory_mcp-1.6.1/spatial_memory/core/consolidation_strategies.py +402 -0
  16. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/core/database.py +774 -918
  17. spatial_memory_mcp-1.6.1/spatial_memory/core/db_idempotency.py +242 -0
  18. spatial_memory_mcp-1.6.1/spatial_memory/core/db_indexes.py +575 -0
  19. spatial_memory_mcp-1.6.1/spatial_memory/core/db_migrations.py +584 -0
  20. spatial_memory_mcp-1.6.1/spatial_memory/core/db_search.py +509 -0
  21. spatial_memory_mcp-1.6.1/spatial_memory/core/db_versioning.py +177 -0
  22. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/core/embeddings.py +65 -18
  23. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/core/errors.py +75 -3
  24. spatial_memory_mcp-1.6.1/spatial_memory/core/filesystem.py +178 -0
  25. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/core/models.py +4 -0
  26. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/core/rate_limiter.py +26 -9
  27. spatial_memory_mcp-1.6.1/spatial_memory/core/response_types.py +497 -0
  28. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/core/validation.py +86 -2
  29. spatial_memory_mcp-1.6.1/spatial_memory/factory.py +407 -0
  30. spatial_memory_mcp-1.6.1/spatial_memory/migrations/__init__.py +40 -0
  31. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/ports/repositories.py +52 -2
  32. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/server.py +131 -189
  33. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/services/export_import.py +61 -43
  34. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/services/lifecycle.py +397 -122
  35. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/services/memory.py +2 -2
  36. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/services/spatial.py +129 -46
  37. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/conftest.py +9 -3
  38. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/integration/test_cross_process_locking.py +11 -0
  39. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/integration/test_enterprise_features.py +9 -6
  40. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_errors_phase5.py +17 -4
  41. spatial_memory_mcp-1.6.1/tests/unit/test_filesystem.py +160 -0
  42. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_hybrid_search_ops.py +15 -0
  43. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_lifecycle_service.py +132 -28
  44. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_memory_service.py +2 -1
  45. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_spatial_service.py +42 -0
  46. spatial_memory_mcp-1.5.3/CHANGELOG.md +0 -69
  47. spatial_memory_mcp-1.5.3/CLAUDE.md +0 -34
  48. spatial_memory_mcp-1.5.3/spatial_memory/__main__.py +0 -14
  49. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/.env.example +0 -0
  50. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/.gitignore +0 -0
  51. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/CONTRIBUTING.md +0 -0
  52. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/LICENSE +0 -0
  53. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/LIFECYCLE_PHASE_PLAN.md +0 -0
  54. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/PHASE4B_PLAN.md +0 -0
  55. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/PHASE4_PLAN.md +0 -0
  56. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/PHASE5_UTILITIES_PLAN.md +0 -0
  57. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/SECURITY.md +0 -0
  58. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/SPATIAL-MEMORY-ARCHITECTURE-DIAGRAMS.md +0 -0
  59. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/SPATIAL-MEMORY-MCP-SERVER-PLAN (1).md +0 -0
  60. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/docs/API.md +0 -0
  61. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/docs/BENCHMARKS.md +0 -0
  62. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/docs/METRICS.md +0 -0
  63. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/docs/troubleshooting.md +0 -0
  64. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/examples/demo_config_logging.py +0 -0
  65. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/scripts/benchmark.py +0 -0
  66. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/scripts/inspect_db.py +0 -0
  67. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/scripts/populate_test_data.py +0 -0
  68. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/scripts/test_all_tools.py +0 -0
  69. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/adapters/__init__.py +0 -0
  70. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/core/cache.py +0 -0
  71. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/core/circuit_breaker.py +0 -0
  72. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/core/file_security.py +0 -0
  73. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/core/health.py +0 -0
  74. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/core/helpers.py +0 -0
  75. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/core/import_security.py +0 -0
  76. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/core/lifecycle_ops.py +0 -0
  77. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/core/logging.py +0 -0
  78. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/core/metrics.py +0 -0
  79. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/core/security.py +0 -0
  80. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/core/spatial_ops.py +0 -0
  81. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/core/tracing.py +0 -0
  82. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/core/utils.py +0 -0
  83. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/ports/__init__.py +0 -0
  84. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/py.typed +0 -0
  85. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/services/__init__.py +0 -0
  86. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/services/utility.py +0 -0
  87. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/tools/__init__.py +0 -0
  88. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/tools/definitions.py +0 -0
  89. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/spatial_memory/verify.py +0 -0
  90. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/stubs/hdbscan/__init__.pyi +0 -0
  91. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/stubs/lancedb/__init__.pyi +0 -0
  92. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/stubs/lancedb/index.pyi +0 -0
  93. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/stubs/lancedb/rerankers.pyi +0 -0
  94. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/stubs/lancedb/table.pyi +0 -0
  95. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/stubs/mcp/__init__.pyi +0 -0
  96. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/stubs/mcp/server/__init__.pyi +0 -0
  97. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/stubs/mcp/server/stdio.pyi +0 -0
  98. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/stubs/mcp/types.pyi +0 -0
  99. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/stubs/openai/__init__.pyi +0 -0
  100. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/stubs/pyarrow/__init__.pyi +0 -0
  101. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/stubs/pyarrow/parquet.pyi +0 -0
  102. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/stubs/sklearn/__init__.pyi +0 -0
  103. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/stubs/sklearn/metrics/__init__.pyi +0 -0
  104. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/stubs/umap/__init__.pyi +0 -0
  105. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/__init__.py +0 -0
  106. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/integration/__init__.py +0 -0
  107. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/integration/conftest.py +0 -0
  108. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/integration/test_backup_restore.py +0 -0
  109. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/integration/test_concurrent_writes.py +0 -0
  110. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/integration/test_database.py +0 -0
  111. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/integration/test_database_safeguards.py +0 -0
  112. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/integration/test_embeddings.py +0 -0
  113. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/integration/test_indexing.py +0 -0
  114. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/integration/test_mcp_server.py +0 -0
  115. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/integration/test_namespace_ops.py +0 -0
  116. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/integration/test_phase5_tools.py +0 -0
  117. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/integration/test_security_edge_cases.py +0 -0
  118. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/integration/test_server_v153.py +0 -0
  119. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/integration/test_ttl_snapshots.py +0 -0
  120. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/test_config.py +0 -0
  121. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/test_connection_pool.py +0 -0
  122. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/test_health.py +0 -0
  123. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/test_helpers.py +0 -0
  124. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/test_logging.py +0 -0
  125. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/test_metrics.py +0 -0
  126. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/test_models.py +0 -0
  127. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/test_rate_limiter.py +0 -0
  128. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/test_validation.py +0 -0
  129. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/__init__.py +0 -0
  130. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_cache.py +0 -0
  131. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_circuit_breaker.py +0 -0
  132. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_config_phase5.py +0 -0
  133. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_export_import_service.py +0 -0
  134. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_export_ops.py +0 -0
  135. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_file_security.py +0 -0
  136. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_import_ops.py +0 -0
  137. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_import_security.py +0 -0
  138. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_lancedb_repository_phase5.py +0 -0
  139. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_lifecycle_ops.py +0 -0
  140. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_models_phase5.py +0 -0
  141. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_process_lock.py +0 -0
  142. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_security_facade.py +0 -0
  143. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_spatial_ops.py +0 -0
  144. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_stats_ops.py +0 -0
  145. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_tracing.py +0 -0
  146. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_utility_service.py +0 -0
  147. {spatial_memory_mcp-1.5.3 → spatial_memory_mcp-1.6.1}/tests/unit/test_utils.py +0 -0
@@ -0,0 +1,139 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Planned
11
+ - Medium severity architectural improvements (MED-ARCH-001 through MED-ARCH-004)
12
+ - Migration system (MED-DB-005)
13
+
14
+ ## [1.6.1] - 2026-02-02
15
+
16
+ ### Added
17
+ - `spatial-memory instructions` CLI command to view the MCP instructions injected into Claude's context
18
+
19
+ ### Changed
20
+ - Updated CLAUDE.md to be contributor documentation (removed stale claude-memory references)
21
+
22
+ ## [1.6.0] - 2026-02-02
23
+
24
+ ### Fixed
25
+
26
+ #### Critical Issues
27
+ - **CRIT-001**: Fixed consolidation data loss window - implemented add-before-delete pattern with pending status marker
28
+ - **CRIT-002**: Fixed journey N+1 query pattern - plumbed `include_vector` parameter through search pipeline
29
+
30
+ #### High Severity Issues
31
+ - **HIGH-001**: Fixed sequential DB calls in wander (resolved via CRIT-002)
32
+ - **HIGH-002**: Fixed O(n²) similarity calculation in visualize - replaced with `scipy.spatial.distance.cdist` vectorized operation
33
+ - **HIGH-003**: Fixed inefficient batch search - implemented native LanceDB batch search
34
+ - **HIGH-004**: Fixed duplicate embedding generation in extract - batch embed upfront with `embed_batch()`
35
+ - **HIGH-005**: Fixed sequential updates in decay - added `update_batch()` method
36
+ - **HIGH-006**: Fixed sequential fetches in reinforce - added `get_batch()` method
37
+ - **HIGH-007**: Fixed non-atomic batch insert - added `PartialBatchInsertError` with rollback capability
38
+ - **HIGH-008**: Fixed rename_namespace lacking rollback - track renamed IDs with `_rollback_namespace_rename()`
39
+ - **HIGH-009**: Fixed consolidation loading entire namespace - added streaming `_consolidate_chunked()`
40
+ - **HIGH-010**: Fixed file lock on NFS/SMB - added detection and startup warning
41
+
42
+ #### Medium Severity Issues
43
+ - **MED-SEC-002**: Fixed memory exhaustion in JSON/CSV export - implemented streaming export
44
+ - **MED-CQ-001**: Fixed `forget_batch` returning incorrect IDs
45
+ - **MED-CQ-002**: Added missing `backend` to `EmbeddingServiceProtocol`
46
+ - **MED-CQ-003**: Fixed rate limiter token consumption issue
47
+ - **MED-CQ-004**: Fixed embedding cache leak in batch operations
48
+ - **MED-DB-001**: Added missing index to idempotency table
49
+ - **MED-DB-003**: Fixed `get_namespace_stats()` loading all records
50
+ - **MED-DB-004**: Added vector dimension validation at insert
51
+
52
+ #### Low Severity Issues
53
+ - **LOW-001**: Made embedding cache size configurable (was hardcoded 1000)
54
+ - **LOW-002**: Standardized datetime handling in lifecycle.py
55
+ - **LOW-003**: Extracted magic numbers in retry logic to constants
56
+ - **LOW-004**: Added Literal type validation for `index_type`
57
+ - **LOW-006**: Fixed `validate_namespace` docstring mismatch
58
+ - **LOW-007**: Normalized mock embedding vectors in conftest.py
59
+ - **LOW-008**: Documented content validation security approach
60
+ - **LOW-009**: Added metadata depth validation
61
+ - **LOW-010**: Sanitized paths in error messages
62
+ - **LOW-011**: Added proactive connection health check
63
+ - **LOW-012**: Fixed `close()` to remove from connection pool
64
+ - **LOW-013**: Implemented auto-compaction scheduling
65
+ - **LOW-014**: Cached stop words set (was recreated per call)
66
+ - **LOW-015**: Improved cache key hashing
67
+
68
+ ### Added
69
+ - `get_batch()` method for bulk memory retrieval
70
+ - `update_batch()` method returning `(success_count, failed_ids)` tuple
71
+ - Native LanceDB batch vector search
72
+ - `PartialBatchInsertError` exception with `succeeded_ids` for recovery
73
+ - `atomic=True` parameter to `insert_batch()` with rollback capability
74
+ - Streaming consolidation with configurable `consolidate_chunk_size`
75
+ - NFS/SMB filesystem detection in `core/filesystem.py`
76
+ - Config option `acknowledge_network_filesystem_risk` to suppress warnings
77
+
78
+ ### Changed
79
+ - Refactored `database.py` into separate manager modules for maintainability
80
+ - Improved type safety across async operations
81
+
82
+ ### Closed (By Design)
83
+ - **MED-SEC-001**: No namespace-level authorization - single-developer local use is intended
84
+ - **MED-DB-002**: `get_namespaces()` loads all values - TTL caching is sufficient
85
+ - **LOW-005**: Duplicate local imports - intentional circular import avoidance
86
+
87
+ ## [0.1.0] - 2026-01-20
88
+
89
+ ### Added
90
+
91
+ #### Configuration System
92
+ - Pydantic-based settings with environment variable support
93
+ - Dependency injection pattern for testability
94
+ - Full configuration validation with bounds checking
95
+ - Support for `.env` files
96
+
97
+ #### Database Layer
98
+ - LanceDB integration for vector storage
99
+ - SQL injection prevention with pattern detection
100
+ - UUID validation for memory IDs
101
+ - Namespace format validation
102
+ - Atomic updates with rollback support
103
+
104
+ #### Embedding Service
105
+ - Local embedding support via sentence-transformers
106
+ - OpenAI API embedding support
107
+ - Dual-backend architecture with automatic routing
108
+ - Model: `all-MiniLM-L6-v2` (384 dimensions) as default
109
+
110
+ #### Data Models
111
+ - `Memory` - Core memory representation
112
+ - `MemoryResult` - Search result with similarity score
113
+ - `Filter` / `FilterGroup` - Query filtering system
114
+ - `ClusterInfo` - Cluster metadata for regions
115
+ - `JourneyStep` - Step in journey interpolation
116
+ - `VisualizationData` - Visualization output format
117
+
118
+ #### Error Handling
119
+ - Custom exception hierarchy
120
+ - `SpatialMemoryError` base class
121
+ - Specific errors: `MemoryNotFoundError`, `NamespaceNotFoundError`, `EmbeddingError`, `StorageError`, `ValidationError`, `ConfigurationError`, `ClusteringError`, `VisualizationError`
122
+
123
+ #### Testing
124
+ - 71 unit tests covering all Phase 1 components
125
+ - Pytest fixtures for isolated testing
126
+ - Mock embedding service for fast tests
127
+
128
+ #### Documentation
129
+ - README with project overview and roadmap
130
+ - Architecture diagrams (Mermaid)
131
+ - Security documentation
132
+ - Contributing guidelines
133
+ - Configuration reference (`.env.example`)
134
+
135
+ ### Security
136
+ - Input validation on all user-provided data
137
+ - SQL injection prevention
138
+ - Namespace isolation
139
+ - Sanitized error messages
@@ -0,0 +1,102 @@
1
+ # Spatial Memory MCP - Contributor Guide
2
+
3
+ This document helps AI assistants (and human contributors) work effectively on this codebase.
4
+
5
+ ## Project Overview
6
+
7
+ **spatial-memory-mcp** is a persistent semantic memory MCP server for LLMs. It provides vector-based memory storage with spatial navigation capabilities using LanceDB and sentence-transformers.
8
+
9
+ ## Architecture
10
+
11
+ ```
12
+ spatial_memory/
13
+ ├── server.py # MCP server, tool handlers, instructions injection
14
+ ├── factory.py # Dependency injection, service instantiation
15
+ ├── config.py # Settings (Pydantic), environment configuration
16
+ ├── core/ # Core infrastructure
17
+ │ ├── database.py # LanceDB wrapper, CRUD operations
18
+ │ ├── embeddings.py # Sentence-transformer embedding service
19
+ │ ├── models.py # Pydantic data models (Memory, etc.)
20
+ │ ├── errors.py # Exception hierarchy
21
+ │ ├── validation.py # Input validation, security checks
22
+ │ ├── security.py # Security utilities
23
+ │ ├── db_*.py # Database utilities (search, indexes, migrations)
24
+ │ └── spatial_ops.py # SLERP, vector operations
25
+ ├── services/ # Business logic layer
26
+ │ ├── memory.py # Core memory operations (remember, recall, forget)
27
+ │ ├── spatial.py # Spatial operations (journey, wander, regions)
28
+ │ ├── lifecycle.py # Decay, reinforce, consolidate, extract
29
+ │ ├── export_import.py# Import/export functionality
30
+ │ └── utility.py # Stats, namespaces, health
31
+ ├── adapters/ # External service adapters
32
+ ├── ports/ # Interface definitions
33
+ └── tools/ # MCP tool definitions
34
+ ```
35
+
36
+ ## Key Commands
37
+
38
+ ```bash
39
+ # Run tests (unit tests only by default)
40
+ pytest tests/ -v
41
+
42
+ # Run all tests including integration
43
+ pytest tests/ -v -m ""
44
+
45
+ # Run integration tests only
46
+ pytest tests/ -v -m integration
47
+
48
+ # Type checking
49
+ mypy spatial_memory/
50
+
51
+ # Linting
52
+ ruff check spatial_memory/ tests/
53
+
54
+ # Format code
55
+ ruff format spatial_memory/ tests/
56
+
57
+ # Run the server directly
58
+ python -m spatial_memory
59
+ ```
60
+
61
+ ## Test Markers
62
+
63
+ - `@pytest.mark.unit` - Fast tests with mocked dependencies
64
+ - `@pytest.mark.integration` - Tests with real database/embeddings (slower)
65
+ - `@pytest.mark.slow` - Tests taking >1 second
66
+ - `@pytest.mark.requires_model` - Tests needing the embedding model loaded
67
+
68
+ ## Configuration
69
+
70
+ Settings via environment variables or `.env` file:
71
+ - `SPATIAL_MEMORY_PATH` - Database storage location (default: `.spatial-memory/`)
72
+ - `SPATIAL_MEMORY_EMBEDDING_MODEL` - Model name (default: `all-MiniLM-L6-v2`)
73
+ - `SPATIAL_MEMORY_LOG_LEVEL` - Logging level
74
+ - See `config.py` and `.env.example` for full list
75
+
76
+ ## Code Style
77
+
78
+ - Line length: 100 characters
79
+ - Python 3.10+ (use modern syntax: `|` unions, etc.)
80
+ - Type hints required (strict mypy)
81
+ - Ruff for linting/formatting
82
+
83
+ ## Important Patterns
84
+
85
+ 1. **Dependency Injection**: Services receive dependencies via constructor, not global imports
86
+ 2. **Async Throughout**: All database and service methods are async
87
+ 3. **Pydantic Models**: Use for data validation and serialization
88
+ 4. **Error Hierarchy**: Custom exceptions in `core/errors.py`
89
+
90
+ ## MCP Tool Categories
91
+
92
+ The server exposes these tool groups:
93
+ - **Memory**: `remember`, `recall`, `hybrid_recall`, `nearby`, `forget`
94
+ - **Spatial**: `journey`, `wander`, `regions`, `visualize`
95
+ - **Lifecycle**: `decay`, `reinforce`, `extract`, `consolidate`
96
+ - **Admin**: `stats`, `namespaces`, `export_memories`, `import_memories`
97
+
98
+ ## Notes
99
+
100
+ - MCP server instructions are auto-injected via `_get_server_instructions()` in `server.py`
101
+ - Database uses LanceDB (embedded vector database)
102
+ - Embeddings default to ONNX-optimized sentence-transformers for performance
@@ -0,0 +1,303 @@
1
+ # Spatial Memory MCP - Issues Tracker
2
+
3
+ > Generated: 2026-02-01
4
+ > Status: **All Phases Complete - Released v1.6.0**
5
+ > Last Updated: 2026-02-02
6
+
7
+ ---
8
+
9
+ ## Overview
10
+
11
+ This document tracks all identified issues from the comprehensive codebase review and their resolutions.
12
+
13
+ | Severity | Count | Status |
14
+ |----------|-------|--------|
15
+ | Critical | 2 | ✅ All Complete |
16
+ | High | 10 | ✅ All Complete |
17
+ | Medium | 18 | ✅ 8 Complete, 10 Backlog |
18
+ | Low | 15+ | ✅ 4 Complete, 11+ Backlog |
19
+
20
+ ### Design Decisions Made
21
+
22
+ | Decision | Choice | Rationale |
23
+ |----------|--------|-----------|
24
+ | CRIT-001 Data Safety | Add-before-delete pattern | Simpler than soft-delete, no schema change required |
25
+ | HIGH-010 Deployment | Single-machine only | Document limitation, detect and warn at startup |
26
+ | MED-SEC-001 Multi-tenant | Not a priority | Current behavior is intended for single-developer local use |
27
+
28
+ ---
29
+
30
+ ## Critical Issues
31
+
32
+ ### CRIT-001: Consolidation Data Loss Window
33
+
34
+ - **Location:** `spatial_memory/services/lifecycle.py:690-720`
35
+ - **Description:** "merge_content" strategy deletes originals before adding merged memory. If add fails (e.g., embedding timeout), originals are permanently lost.
36
+ - **Status:** ✅ COMPLETED (2026-02-01)
37
+ - **Priority:** P0
38
+
39
+ #### Solution Implemented
40
+ Add-before-delete pattern with pending status marker in metadata.
41
+
42
+ ---
43
+
44
+ ### CRIT-002: Journey N+1 Query Pattern
45
+
46
+ - **Location:** `spatial_memory/services/spatial.py:231-237`
47
+ - **Description:** For each neighbor in journey results, `_get_vector_for_memory()` hits the database. 10-step journey with 3 neighbors = 30 extra DB calls.
48
+ - **Status:** ✅ COMPLETED (2026-02-01)
49
+ - **Priority:** P0
50
+
51
+ #### Solution Implemented
52
+ Plumbed `include_vector` parameter through search pipeline.
53
+
54
+ ---
55
+
56
+ ## High Severity Issues
57
+
58
+ ### HIGH-001: Sequential DB Calls in Wander
59
+ - **Location:** `spatial_memory/services/spatial.py:331-383`
60
+ - **Description:** 2 DB calls per step (search + get_with_vector)
61
+ - **Status:** ✅ COMPLETED (2026-02-01) - Fixed as part of CRIT-002
62
+ - **Priority:** P1
63
+
64
+ ---
65
+
66
+ ### HIGH-002: O(n²) Similarity in Visualize
67
+ - **Location:** `spatial_memory/services/spatial.py:668-679`
68
+ - **Description:** 124,750 pairwise similarity calculations for 500 memories
69
+ - **Status:** ✅ COMPLETED (2026-02-02)
70
+ - **Priority:** P1
71
+
72
+ #### Solution Implemented
73
+ Replaced O(n²) loop with `scipy.spatial.distance.cdist` vectorized operation. Falls back to numpy if scipy unavailable.
74
+
75
+ ---
76
+
77
+ ### HIGH-003: Inefficient Batch Search (Sequential)
78
+ - **Location:** `spatial_memory/services/spatial.py:781-805`
79
+ - **Description:** `_batch_vector_search` iterates and calls search individually
80
+ - **Status:** ✅ COMPLETED (2026-02-02)
81
+ - **Priority:** P1
82
+
83
+ #### Solution Implemented
84
+ Implemented native LanceDB batch search at database layer using `table.search([vec1, vec2, ...])`.
85
+
86
+ ---
87
+
88
+ ### HIGH-004: Duplicate Embedding Generation in Extract
89
+ - **Location:** `spatial_memory/services/lifecycle.py:481-485, 781`
90
+ - **Description:** Embedding generated twice - once for dedup check, once for storage
91
+ - **Status:** ✅ COMPLETED (2026-02-02)
92
+ - **Priority:** P1
93
+
94
+ #### Solution Implemented
95
+ Batch embed all candidates upfront with `embed_batch()`, pass vectors through dedup check and store operations.
96
+
97
+ ---
98
+
99
+ ### HIGH-005: Sequential Updates in Decay
100
+ - **Location:** `spatial_memory/services/lifecycle.py:276-283`
101
+ - **Description:** 500 individual writes instead of batch update
102
+ - **Status:** ✅ COMPLETED (2026-02-02)
103
+ - **Priority:** P1
104
+
105
+ #### Solution Implemented
106
+ Added `update_batch()` method returning `(success_count, failed_ids)` tuple.
107
+
108
+ ---
109
+
110
+ ### HIGH-006: Sequential Fetches in Reinforce
111
+ - **Location:** `spatial_memory/services/lifecycle.py:348-387`
112
+ - **Description:** 2 DB calls per memory (get + update)
113
+ - **Status:** ✅ COMPLETED (2026-02-02)
114
+ - **Priority:** P1
115
+
116
+ #### Solution Implemented
117
+ Added `get_batch()` method returning `{id: Memory}` dict. Combined with `update_batch()` for 2 calls total.
118
+
119
+ ---
120
+
121
+ ### HIGH-007: Batch Insert NOT Atomic
122
+ - **Location:** `spatial_memory/core/database.py:1350`
123
+ - **Description:** Partial failures leave orphaned records
124
+ - **Status:** ✅ COMPLETED (2026-02-02)
125
+ - **Priority:** P1
126
+
127
+ #### Solution Implemented
128
+ Added `PartialBatchInsertError` with `succeeded_ids` for recovery. Added `atomic=True` parameter to `insert_batch()` with rollback capability.
129
+
130
+ ---
131
+
132
+ ### HIGH-008: rename_namespace Lacks Rollback
133
+ - **Location:** `spatial_memory/core/database.py:1684-1736`
134
+ - **Description:** Partial renames leave namespace in mixed state
135
+ - **Status:** ✅ COMPLETED (2026-02-02)
136
+ - **Priority:** P1
137
+
138
+ #### Solution Implemented
139
+ Track renamed IDs during operation. On failure, `_rollback_namespace_rename()` reverts records to original namespace.
140
+
141
+ ---
142
+
143
+ ### HIGH-009: Consolidation Loads Entire Namespace
144
+ - **Location:** `spatial_memory/services/lifecycle.py:573-577`
145
+ - **Description:** Memory exhaustion risk for large namespaces
146
+ - **Status:** ✅ COMPLETED (2026-02-02)
147
+ - **Priority:** P1
148
+
149
+ #### Solution Implemented
150
+ Added `_consolidate_chunked()` for streaming consolidation with configurable `consolidate_chunk_size` (default: 200).
151
+
152
+ ---
153
+
154
+ ### HIGH-010: File Lock Doesn't Work on NFS/SMB
155
+ - **Location:** `spatial_memory/core/database.py:239-388`
156
+ - **Description:** Data corruption risk in shared filesystem
157
+ - **Status:** ✅ COMPLETED (2026-02-01)
158
+ - **Priority:** P1
159
+
160
+ #### Solution Implemented
161
+ Added `core/filesystem.py` with detection. Startup warning if NFS/SMB detected. Config `acknowledge_network_filesystem_risk` to suppress.
162
+
163
+ ---
164
+
165
+ ## Medium Severity Issues
166
+
167
+ ### Security
168
+
169
+ | ID | Issue | Location | Status | Notes |
170
+ |----|-------|----------|--------|-------|
171
+ | MED-SEC-001 | No namespace-level authorization | server.py | Closed - By Design | Single-developer local use is intended |
172
+ | MED-SEC-002 | Memory exhaustion in JSON/CSV export | export_import.py:616-695 | ✅ COMPLETED (2026-02-01) | Streaming export implemented |
173
+
174
+ ### Code Quality
175
+
176
+ | ID | Issue | Location | Status |
177
+ |----|-------|----------|--------|
178
+ | MED-CQ-001 | forget_batch returns incorrect IDs | memory.py:407-412 | ✅ COMPLETED (2026-02-01) |
179
+ | MED-CQ-002 | Missing backend in EmbeddingServiceProtocol | ports/repositories.py:543-581 | ✅ COMPLETED (2026-02-01) |
180
+ | MED-CQ-003 | Rate limiter token consumption issue | rate_limiter.py:213-227 | ✅ COMPLETED (2026-02-01) |
181
+ | MED-CQ-004 | Embedding cache leak in batch operations | embeddings.py:211-214 | ✅ COMPLETED (2026-02-01) |
182
+
183
+ ### Database
184
+
185
+ | ID | Issue | Location | Status |
186
+ |----|-------|----------|--------|
187
+ | MED-DB-001 | Idempotency table missing index | database.py:3073-3081 | ✅ COMPLETED (2026-02-01) |
188
+ | MED-DB-002 | get_namespaces() loads all values | database.py:2676 | ✅ CLOSED (Acceptable - TTL caching sufficient) |
189
+ | MED-DB-003 | get_namespace_stats() loads all records | database.py:1839-1845 | ✅ COMPLETED (2026-02-01) |
190
+ | MED-DB-004 | Vector dimension not validated at insert | database.py:1267-1336 | ✅ COMPLETED (2026-02-01) |
191
+ | MED-DB-005 | No migration system | Project-wide | Backlog |
192
+
193
+ ### Architecture
194
+
195
+ | ID | Issue | Location | Status |
196
+ |----|-------|----------|--------|
197
+ | MED-ARCH-001 | LifecycleService.consolidate complexity | lifecycle.py:520-752 | Backlog |
198
+ | MED-ARCH-002 | SpatialMemoryServer.__init__ complexity | server.py:140-345 | Backlog |
199
+ | MED-ARCH-003 | Tool handlers return untyped dicts | server.py:469-1012 | Backlog |
200
+ | MED-ARCH-004 | Synchronous embedding in async context | server.py:355-423 | Backlog |
201
+
202
+ ---
203
+
204
+ ## Low Severity Issues
205
+
206
+ | ID | Issue | Location | Status |
207
+ |----|-------|----------|--------|
208
+ | LOW-001 | Hardcoded embedding cache size (1000) | embeddings.py | ✅ COMPLETED (2026-02-01) |
209
+ | LOW-002 | Inconsistent datetime handling | lifecycle.py | ✅ COMPLETED |
210
+ | LOW-003 | Magic numbers in retry logic | database.py | ✅ COMPLETED (2026-02-01) |
211
+ | LOW-004 | Missing validation for index_type | config.py | ✅ COMPLETED |
212
+ | LOW-005 | Duplicate local imports | lancedb_repository.py | ✅ CLOSED (False Positive) |
213
+ | LOW-006 | validate_namespace docstring mismatch | validation.py | ✅ COMPLETED |
214
+ | LOW-007 | Test mocks return non-normalized vectors | conftest.py | ✅ COMPLETED |
215
+ | LOW-008 | Memory content not validated for injection | validation.py | ✅ COMPLETED (Documented as by-design) |
216
+ | LOW-009 | Metadata values not deeply validated | validation.py | ✅ COMPLETED |
217
+ | LOW-010 | Exception messages may leak paths | Various | ✅ COMPLETED |
218
+ | LOW-011 | Connection pool never validates health | connection_pool.py | ✅ COMPLETED |
219
+ | LOW-012 | Database.close() doesn't remove from pool | database.py | ✅ COMPLETED |
220
+ | LOW-013 | No automatic compaction scheduling | database.py | ✅ COMPLETED |
221
+ | LOW-014 | Stop words set recreated per call | spatial.py | ✅ COMPLETED (2026-02-01) |
222
+ | LOW-015 | MD5 for cache keys | embeddings.py | ✅ COMPLETED (2026-02-01) |
223
+
224
+ ---
225
+
226
+ ## Implementation Phases
227
+
228
+ ### Phase 1: Critical Issues + Quick Wins ✅ COMPLETE
229
+ **Completed:** 2026-02-01
230
+ **Issues:** CRIT-001, CRIT-002, HIGH-010
231
+
232
+ ### Phase 2: Batch Operations Infrastructure ✅ COMPLETE
233
+ **Completed:** 2026-02-02
234
+ **Issues:** HIGH-001, HIGH-003, HIGH-005, HIGH-006
235
+
236
+ ### Phase 3: Remaining High Severity ✅ COMPLETE
237
+ **Completed:** 2026-02-02
238
+ **Issues:** HIGH-002, HIGH-004, HIGH-007, HIGH-008, HIGH-009
239
+
240
+ ### Phase 4: Medium Severity ✅ COMPLETE
241
+ **Completed:** 2026-02-01
242
+ **Issues:** MED-SEC-002, MED-CQ-001-004, MED-DB-001, MED-DB-003, MED-DB-004
243
+
244
+ ### Phase 5: Low Severity ✅ COMPLETE
245
+ **Completed:** 2026-02-01
246
+ **Issues:** LOW-001, LOW-003, LOW-014, LOW-015
247
+
248
+ ---
249
+
250
+ ## Summary
251
+
252
+ **All Critical, High, and most Low severity issues have been resolved.**
253
+
254
+ | Category | Resolved | Backlog |
255
+ |----------|----------|---------|
256
+ | Critical | 2/2 | 0 |
257
+ | High | 10/10 | 0 |
258
+ | Medium | 8/18 | 8 (architecture items) |
259
+ | Low | 15/15 | 0 |
260
+
261
+ Remaining backlog items are Medium severity architectural improvements (refactoring, migration system) that don't affect functionality or data integrity.
262
+
263
+ ---
264
+
265
+ ## Change Log
266
+
267
+ | Date | Issue | Change | Author |
268
+ |------|-------|--------|--------|
269
+ | 2026-02-01 | All | Initial tracking document created | Claude |
270
+ | 2026-02-01 | All | Solution plans added for Critical and High severity | Claude |
271
+ | 2026-02-01 | MED-SEC-001 | Closed as "By Design" - single-developer local use | Claude |
272
+ | 2026-02-01 | HIGH-010 | Decision: Single-machine only with detection/warning | User |
273
+ | 2026-02-01 | CRIT-001 | Decision: Add-before-delete pattern | User |
274
+ | 2026-02-01 | CRIT-001 | ✅ Implemented add-before-delete pattern in consolidation | Claude |
275
+ | 2026-02-01 | CRIT-002 | ✅ Plumbed include_vector through search pipeline (also fixes HIGH-001) | Claude |
276
+ | 2026-02-01 | HIGH-010 | ✅ Added NFS/SMB detection and warning at startup | Claude |
277
+ | 2026-02-02 | Phase 2 | ✅ Implemented batch operations: get_batch, update_batch, batch_vector_search | Claude |
278
+ | 2026-02-02 | Phase 3 | ✅ Implemented scipy.cdist, batch embedding, atomic insert, namespace rollback, streaming consolidation | Claude |
279
+ | 2026-02-01 | Phase 4 | ✅ Implemented MED-SEC-002, MED-CQ-001-004, MED-DB-001, MED-DB-003, MED-DB-004 | Claude |
280
+ | 2026-02-01 | Phase 5 | ✅ Implemented LOW-001, LOW-003, LOW-014, LOW-015 | Claude |
281
+ | 2026-02-01 | All | **All phases complete** - 1360 tests passing | Claude |
282
+ | 2026-02-02 | All | **Released v1.6.0** - Pushed to repository | User |
283
+ | 2026-02-01 | Phase A-C Backlog | ✅ Implemented remaining Low severity issues: | Claude |
284
+ | | LOW-002 | Standardized datetime handling in lifecycle.py | |
285
+ | | LOW-004 | Added Literal type validation for index_type | |
286
+ | | LOW-005 | Closed as FALSE POSITIVE (intentional circular import avoidance) | |
287
+ | | LOW-006 | Fixed validate_namespace docstring | |
288
+ | | LOW-007 | Normalized mock embedding vectors in conftest.py | |
289
+ | | LOW-008 | Documented content validation security approach | |
290
+ | | LOW-009 | Added metadata depth validation | |
291
+ | | LOW-010 | Sanitized paths in error messages | |
292
+ | | LOW-011 | Added proactive connection health check | |
293
+ | | LOW-012 | Fixed close() to remove from pool | |
294
+ | | LOW-013 | Implemented auto-compaction | |
295
+ | | MED-DB-002 | Closed as ACCEPTABLE (TTL caching sufficient) | |
296
+
297
+ ---
298
+
299
+ ## References
300
+
301
+ - [LanceDB Batch Search Documentation](https://docs.lancedb.com/search/vector-search)
302
+ - [LanceDB merge_insert API](https://lancedb.github.io/lancedb/python/python/)
303
+ - Code Review Report: Saved to spatial-memory namespace (memory ID: 55cd072b-8bc6-4426-a80b-fa07edaee7e7)