atomicmemory 1.0.0__tar.gz → 1.1.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.
Files changed (164) hide show
  1. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/.gitignore +6 -0
  2. atomicmemory-1.1.0/CHANGELOG.md +46 -0
  3. atomicmemory-1.1.0/LICENSE +201 -0
  4. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/PKG-INFO +108 -12
  5. atomicmemory-1.1.0/README.md +203 -0
  6. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/__init__.py +26 -0
  7. atomicmemory-1.1.0/atomicmemory/_version.py +7 -0
  8. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/client/async_memory_client.py +92 -11
  9. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/client/memory_client.py +44 -12
  10. atomicmemory-1.1.0/atomicmemory/contract/__init__.py +18 -0
  11. atomicmemory-1.1.0/atomicmemory/contract/v1.py +400 -0
  12. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/memory/__init__.py +26 -0
  13. atomicmemory-1.1.0/atomicmemory/memory/capability_profiles.py +79 -0
  14. atomicmemory-1.1.0/atomicmemory/memory/meta_fact_filter.py +122 -0
  15. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/memory/registry.py +2 -2
  16. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/memory/service.py +121 -20
  17. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/memory/types.py +42 -0
  18. atomicmemory-1.1.0/atomicmemory/providers/__init__.py +5 -0
  19. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/atomicmemory/__init__.py +1 -1
  20. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/atomicmemory/async_handle_impl.py +10 -7
  21. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/atomicmemory/async_provider.py +18 -4
  22. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/atomicmemory/config.py +7 -2
  23. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/atomicmemory/handle.py +2 -0
  24. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/atomicmemory/handle_impl.py +28 -8
  25. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/atomicmemory/mappers.py +33 -1
  26. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/atomicmemory/provider.py +44 -8
  27. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/atomicmemory/scope_mapper.py +28 -5
  28. atomicmemory-1.1.0/atomicmemory/providers/hindsight/__init__.py +52 -0
  29. atomicmemory-1.1.0/atomicmemory/providers/hindsight/async_provider.py +258 -0
  30. atomicmemory-1.1.0/atomicmemory/providers/hindsight/config.py +135 -0
  31. atomicmemory-1.1.0/atomicmemory/providers/hindsight/http.py +196 -0
  32. atomicmemory-1.1.0/atomicmemory/providers/hindsight/mappers.py +173 -0
  33. atomicmemory-1.1.0/atomicmemory/providers/hindsight/provider.py +315 -0
  34. atomicmemory-1.1.0/contract/CONTRACT.md +114 -0
  35. atomicmemory-1.1.0/contract/VENDORED.json +8 -0
  36. atomicmemory-1.1.0/contract/v1/capabilities-descriptor.schema.json +8 -0
  37. atomicmemory-1.1.0/contract/v1/conformance/capabilities-descriptor.json +20 -0
  38. atomicmemory-1.1.0/contract/v1/conformance/ingest-text.json +18 -0
  39. atomicmemory-1.1.0/contract/v1/conformance/ingest-verbatim.json +19 -0
  40. atomicmemory-1.1.0/contract/v1/conformance/manifest.json +12 -0
  41. atomicmemory-1.1.0/contract/v1/conformance/search-with-retrieval-receipt.json +39 -0
  42. atomicmemory-1.1.0/contract/v1/ingest-input.schema.json +8 -0
  43. atomicmemory-1.1.0/contract/v1/provider-contract.schema.json +336 -0
  44. atomicmemory-1.1.0/contract/v1/search-result-page.schema.json +8 -0
  45. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/examples/async_pipeline.py +1 -1
  46. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/examples/basic_ingest_search.py +2 -2
  47. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/pyproject.toml +10 -8
  48. atomicmemory-1.1.0/tests/_lifecycle_fakes.py +153 -0
  49. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/client/test_async_memory_client.py +10 -0
  50. atomicmemory-1.1.0/tests/client/test_client_lifecycle.py +312 -0
  51. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/client/test_memory_client.py +9 -0
  52. atomicmemory-1.1.0/tests/conftest.py +69 -0
  53. atomicmemory-1.1.0/tests/contract/_schema_registry.py +66 -0
  54. atomicmemory-1.1.0/tests/contract/test_codec.py +207 -0
  55. atomicmemory-1.1.0/tests/contract/test_conformance.py +142 -0
  56. atomicmemory-1.1.0/tests/contract/test_vendored_tree.py +101 -0
  57. atomicmemory-1.1.0/tests/memory/test_capability_profiles.py +60 -0
  58. atomicmemory-1.1.0/tests/memory/test_meta_fact_filter.py +80 -0
  59. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/memory/test_registry.py +7 -0
  60. atomicmemory-1.1.0/tests/memory/test_service_lifecycle.py +188 -0
  61. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/providers/atomicmemory/test_async_provider.py +101 -0
  62. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/providers/atomicmemory/test_handle_base.py +98 -0
  63. atomicmemory-1.1.0/tests/providers/atomicmemory/test_ingest_content_class.py +50 -0
  64. atomicmemory-1.1.0/tests/providers/atomicmemory/test_integration.py +89 -0
  65. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/providers/atomicmemory/test_mappers.py +57 -0
  66. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/providers/atomicmemory/test_provider.py +91 -1
  67. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/providers/atomicmemory/test_scope_mapper.py +33 -0
  68. atomicmemory-1.1.0/tests/providers/hindsight/__init__.py +1 -0
  69. atomicmemory-1.1.0/tests/providers/hindsight/test_async_provider.py +82 -0
  70. atomicmemory-1.1.0/tests/providers/hindsight/test_integration.py +127 -0
  71. atomicmemory-1.1.0/tests/providers/hindsight/test_mappers.py +115 -0
  72. atomicmemory-1.1.0/tests/providers/hindsight/test_provider.py +202 -0
  73. atomicmemory-1.1.0/tests/search/__init__.py +0 -0
  74. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/test_package_imports.py +1 -1
  75. atomicmemory-1.1.0/tests/test_version_consistency.py +26 -0
  76. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/uv.lock +445 -1
  77. atomicmemory-1.0.0/CHANGELOG.md +0 -20
  78. atomicmemory-1.0.0/LICENSE +0 -21
  79. atomicmemory-1.0.0/README.md +0 -108
  80. atomicmemory-1.0.0/atomicmemory/_version.py +0 -3
  81. atomicmemory-1.0.0/atomicmemory/providers/__init__.py +0 -5
  82. atomicmemory-1.0.0/tests/conftest.py +0 -36
  83. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/client/__init__.py +0 -0
  84. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/client/atomic_memory_client.py +0 -0
  85. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/core/__init__.py +0 -0
  86. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/core/errors.py +0 -0
  87. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/core/events.py +0 -0
  88. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/core/logging.py +0 -0
  89. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/core/retry.py +0 -0
  90. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/core/validation.py +0 -0
  91. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/embeddings/__init__.py +0 -0
  92. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/embeddings/base.py +0 -0
  93. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/embeddings/sentence_transformers.py +0 -0
  94. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/kv_cache/__init__.py +0 -0
  95. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/kv_cache/adapter.py +0 -0
  96. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/kv_cache/memory_storage.py +0 -0
  97. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/kv_cache/sqlite_storage.py +0 -0
  98. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/memory/filters.py +0 -0
  99. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/memory/pipeline.py +0 -0
  100. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/memory/provider.py +0 -0
  101. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/atomicmemory/agents.py +0 -0
  102. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/atomicmemory/audit.py +0 -0
  103. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/atomicmemory/config_handle.py +0 -0
  104. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/atomicmemory/http.py +0 -0
  105. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/atomicmemory/lessons.py +0 -0
  106. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/atomicmemory/lifecycle.py +0 -0
  107. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/atomicmemory/path.py +0 -0
  108. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/mem0/__init__.py +0 -0
  109. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/mem0/async_provider.py +0 -0
  110. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/mem0/config.py +0 -0
  111. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/mem0/http.py +0 -0
  112. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/mem0/mappers.py +0 -0
  113. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/providers/mem0/provider.py +0 -0
  114. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/py.typed +0 -0
  115. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/search/__init__.py +0 -0
  116. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/search/chunking.py +0 -0
  117. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/search/ranking.py +0 -0
  118. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/search/semantic_search.py +0 -0
  119. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/search/similarity.py +0 -0
  120. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/storage/__init__.py +0 -0
  121. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/storage/_mapping.py +0 -0
  122. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/storage/async_client.py +0 -0
  123. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/storage/client.py +0 -0
  124. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/storage/errors.py +0 -0
  125. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/storage/types.py +0 -0
  126. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/utils/__init__.py +0 -0
  127. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/atomicmemory/utils/environment.py +0 -0
  128. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/examples/local_search.py +0 -0
  129. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/__init__.py +0 -0
  130. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/client/__init__.py +0 -0
  131. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/client/test_atomic_memory_client.py +0 -0
  132. {atomicmemory-1.0.0/tests/core → atomicmemory-1.1.0/tests/contract}/__init__.py +0 -0
  133. {atomicmemory-1.0.0/tests/embeddings → atomicmemory-1.1.0/tests/core}/__init__.py +0 -0
  134. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/core/test_errors.py +0 -0
  135. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/core/test_events.py +0 -0
  136. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/core/test_retry.py +0 -0
  137. {atomicmemory-1.0.0/tests/kv_cache → atomicmemory-1.1.0/tests/embeddings}/__init__.py +0 -0
  138. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/embeddings/test_sentence_transformers.py +0 -0
  139. {atomicmemory-1.0.0/tests/memory → atomicmemory-1.1.0/tests/kv_cache}/__init__.py +0 -0
  140. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/kv_cache/test_memory_storage.py +0 -0
  141. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/kv_cache/test_sqlite_storage.py +0 -0
  142. {atomicmemory-1.0.0/tests/providers → atomicmemory-1.1.0/tests/memory}/__init__.py +0 -0
  143. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/memory/test_filters.py +0 -0
  144. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/memory/test_provider_base.py +0 -0
  145. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/memory/test_service.py +0 -0
  146. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/memory/test_types.py +0 -0
  147. {atomicmemory-1.0.0/tests/providers/atomicmemory → atomicmemory-1.1.0/tests/providers}/__init__.py +0 -0
  148. {atomicmemory-1.0.0/tests/providers/mem0 → atomicmemory-1.1.0/tests/providers/atomicmemory}/__init__.py +0 -0
  149. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/providers/atomicmemory/test_handle_agents.py +0 -0
  150. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/providers/atomicmemory/test_handle_audit.py +0 -0
  151. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/providers/atomicmemory/test_handle_config.py +0 -0
  152. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/providers/atomicmemory/test_handle_lessons.py +0 -0
  153. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/providers/atomicmemory/test_handle_lifecycle.py +0 -0
  154. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/providers/atomicmemory/test_http.py +0 -0
  155. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/providers/atomicmemory/test_path.py +0 -0
  156. {atomicmemory-1.0.0/tests/search → atomicmemory-1.1.0/tests/providers/mem0}/__init__.py +0 -0
  157. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/providers/mem0/test_mappers.py +0 -0
  158. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/providers/mem0/test_provider.py +0 -0
  159. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/search/test_chunking.py +0 -0
  160. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/search/test_semantic_search.py +0 -0
  161. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/search/test_similarity.py +0 -0
  162. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/storage/__init__.py +0 -0
  163. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/storage/test_async_storage_client.py +0 -0
  164. {atomicmemory-1.0.0 → atomicmemory-1.1.0}/tests/storage/test_storage_client.py +0 -0
@@ -53,3 +53,9 @@ Thumbs.db
53
53
  *.log
54
54
  .env
55
55
  .env.local
56
+
57
+ # Internal planning hub (specs/plans) — not published
58
+ localdocs/
59
+
60
+ # Local review/feature worktrees
61
+ .worktrees/
@@ -0,0 +1,46 @@
1
+ # Changelog
2
+
3
+ All notable changes to `atomicmemory` will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [1.1.0] - 2026-06-09
10
+
11
+ ### Added
12
+ - `atomicmemory.contract.v1`: a wire codec for the v1 provider contract's deliberately mixed-case encoding (`Memory.createdAt`/`updatedAt` and `SearchResult.rankingScore` are camelCase on the wire; `version_id`, `observed_at`, and retrieval-receipt fields are snake_case). Encode/decode helpers cover `Memory`, `Provenance`, `SearchResult`, `SearchResultPage`, `SearchRequest`, and ingest payloads (`IngestInput`, `IngestResult`). Dates follow the contract's ISO-8601 UTC millisecond `Z` form (`_to_iso_z`, equivalent to TS `toISOString()`). Naive datetimes in encode paths are assumed UTC. `encode_ingest_input` fails closed on the Python-ahead `content_class` field (no place in the v1 `additionalProperties: false` schemas; TS contract alignment is a recorded follow-up). Explicit-null `version_id` in `SearchResult` normalizes to absent on re-encode, matching the TS optional declaration. `encode_search_request` uses `by_alias=True` so Python-keyword-safe combinator field names (`and_`/`or_`/`not_`) emit their wire aliases; a recursive `_jsonify` walk converts any `datetime` operands in filter trees to the toISOString form. In-process models and provider mappers are unchanged.
13
+ - Vendored the TS SDK's versioned v1 wire contract (JSON Schemas, cross-provider conformance corpus, and CONTRACT.md) under `contract/`, with explicit provenance in `contract/VENDORED.json` and a documented refresh script (`scripts/refresh_contract.py`, never run in CI). A pytest conformance harness proves corpus fixtures decode into the Python models (directly for snake-on-wire types, through the codec for the mixed-case search response) and that SDK emissions validate against the vendored draft-2020-12 schemas, with the TS suite's negative cases mirrored against both schemas and Pydantic. The `capabilities-descriptor` case is schema-only (no Python model in this release — recorded follow-up).
14
+ - `atomicmemory.contract` re-exports `v1` as a specialty import surface; deliberately not re-exported from the package root to keep the root namespace focused on the core provider API.
15
+ - `AsyncProviderFactory` now accepts factories that return an `Awaitable[AsyncProviderRegistration]`, enabling lazy or async provider construction during `AsyncMemoryService.initialize()`.
16
+ - `MemoryService.initialize()` and `AsyncMemoryService.initialize()` raise `ConfigError` when the configured default provider has no registered factory, making a misconfigured default an immediate, explicit error rather than a silent no-op.
17
+
18
+ ### Changed
19
+ - `content_class` is now accepted on **every** ingest mode (`text`, `messages`, and `verbatim`), not just `verbatim`, and is forwarded to core for all modes. Extraction-based ingests (`text`/`messages`) can now satisfy a core running the default `RAW_CONTENT_POLICY=reject`. Still never defaulted — omitting it leaves the field off the wire and a reject-policy core fails closed.
20
+ - Both clients' `initialize()` is now concurrency-safe and idempotent: concurrent callers share a single initialization run (the first caller's registry wins), and the completed outcome — success or failure — is captured in loop-independent state for `AsyncMemoryClient`.
21
+ - A failed `initialize()` is sticky: retrying re-raises the original error from any caller; resolve the cause and construct a new client rather than retrying on the same instance.
22
+ - `AsyncMemoryClient.initialize()` shields each waiter from cancellation so that one waiter's timeout or cancellation never cancels the shared run for other concurrent callers.
23
+ - `AsyncMemoryClient.close()` during a pending initialization cancels the shared run; staged providers are torn down by the service's atomic-initialize cleanup, any concurrent `initialize()` waiter receives `CancelledError`, and the client ends in the not-initialized state without recording a sticky error.
24
+ - Both `MemoryService` and `AsyncMemoryService` stage provider registrations atomically: factories and provider `initialize()` calls run against a local staging area, and the maps are replaced only after every provider succeeds; on any failure, already-staged providers are torn down best-effort before the original error re-raises.
25
+ - `MemoryService.close()` and `AsyncMemoryService.close()` are best-effort: every provider gets a chance to close regardless of earlier failures, maps are cleared in a `finally` block, and the first failure is re-raised after all providers have been given the chance to close.
26
+
27
+ ### Fixed
28
+ - `atomicmemory.__version__` reported `1.0.0` while package metadata said `1.0.1`; all version sources now agree at `1.1.0`, guarded by a regression test that will fail if they drift again.
29
+
30
+ ## [1.0.1] - 2026-05-14
31
+
32
+ ### Changed
33
+ - Version bump for public package publication after internal-to-public repository sync.
34
+
35
+ ## [1.0.0]
36
+
37
+ Initial public stable release.
38
+
39
+ ### Added
40
+ - `AtomicMemoryClient` and `AsyncAtomicMemoryClient` as the primary public client surfaces.
41
+ - Memory ingestion, search, package, get, list, and delete support.
42
+ - AtomicMemory, Mem0, and Hindsight provider adapters.
43
+ - Typed AtomicMemory namespace handles for lifecycle, audit, lessons, agents, and runtime config.
44
+ - Direct artifact storage client with pointer and managed artifact workflows.
45
+ - Local embedding, semantic search, and KV cache helpers.
46
+ - Pydantic models, typed exceptions, and `py.typed` marker for downstream type checkers.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 AtomicMemory
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -1,17 +1,17 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atomicmemory
3
- Version: 1.0.0
3
+ Version: 1.1.0
4
4
  Summary: Python client SDK for AtomicMemory memory and artifact storage.
5
5
  Project-URL: Homepage, https://github.com/atomicstrata/atomicmemory-python
6
6
  Project-URL: Repository, https://github.com/atomicstrata/atomicmemory-python
7
7
  Project-URL: Issues, https://github.com/atomicstrata/atomicmemory-python/issues
8
8
  Author: AtomicMemory
9
- License: MIT
9
+ License: Apache-2.0
10
10
  License-File: LICENSE
11
- Keywords: agent,atomicmemory,llm,mem0,memory,rag
11
+ Keywords: agent,atomicmemory,hindsight,llm,mem0,memory,rag
12
12
  Classifier: Development Status :: 5 - Production/Stable
13
13
  Classifier: Intended Audience :: Developers
14
- Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
15
  Classifier: Programming Language :: Python :: 3
16
16
  Classifier: Programming Language :: Python :: 3 :: Only
17
17
  Classifier: Programming Language :: Python :: 3.10
@@ -25,6 +25,7 @@ Requires-Dist: httpx>=0.27
25
25
  Requires-Dist: numpy>=1.26
26
26
  Requires-Dist: pydantic>=2.7
27
27
  Provides-Extra: dev
28
+ Requires-Dist: jsonschema[format]>=4.21; extra == 'dev'
28
29
  Requires-Dist: mypy>=1.10; extra == 'dev'
29
30
  Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
30
31
  Requires-Dist: pytest-mock>=3.12; extra == 'dev'
@@ -38,9 +39,22 @@ Description-Content-Type: text/markdown
38
39
 
39
40
  # atomicmemory-python
40
41
 
42
+ [![CI](https://github.com/atomicstrata/atomicmemory-python/actions/workflows/ci.yml/badge.svg)](https://github.com/atomicstrata/atomicmemory-python/actions/workflows/ci.yml)
43
+ [![PyPI](https://img.shields.io/pypi/v/atomicmemory?label=pypi)](https://pypi.org/project/atomicmemory/)
44
+ [![Python](https://img.shields.io/pypi/pyversions/atomicmemory)](https://pypi.org/project/atomicmemory/)
45
+ [![Docs](https://img.shields.io/badge/docs-docs.atomicstrata.ai-blue)](https://docs.atomicstrata.ai)
46
+ [![License: Apache 2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
47
+
41
48
  Python client SDK for [AtomicMemory](https://github.com/atomicstrata) memory and artifact storage.
42
49
 
43
- A backend-agnostic memory and storage client: ingest conversations and documents, search them semantically, package retrieval-ready context, register or upload raw artifacts, and access AtomicMemory-specific features (lifecycle, audit, lessons, agents/trust, runtime config) through typed namespace handles.
50
+ **Docs:** [docs.atomicstrata.ai](https://docs.atomicstrata.ai)
51
+
52
+ AtomicMemory Core currently reaches cost-Pareto SOTA on BEAM-100K, BEAM-1M, and LoCoMo10, with BEAM-10M parity against the strongest published Mem0-new result. This package brings that memory layer to Python services, agents, notebooks, and evaluation workflows.
53
+
54
+ A backend-agnostic memory and storage client: ingest conversations and
55
+ documents, search them semantically, package retrieval-ready context, register
56
+ or upload raw artifacts, and access AtomicMemory-specific features (lifecycle,
57
+ audit, lessons, agents/trust, runtime config) through typed namespace handles.
44
58
 
45
59
  This is a Python port of the TypeScript [`atomicmemory-sdk`](https://github.com/atomicstrata/atomicmemory-sdk). It mirrors the public surface 1:1 while staying idiomatic to Python (Pydantic models, `httpx` sync + async clients, `match` statements, `snake_case`).
46
60
 
@@ -48,13 +62,22 @@ This is a Python port of the TypeScript [`atomicmemory-sdk`](https://github.com/
48
62
 
49
63
  Stable release — `1.0.0` on [PyPI](https://pypi.org/project/atomicmemory/).
50
64
 
65
+ ## Installation
66
+
67
+ ```bash
68
+ pip install atomicmemory # core + local search + SQLite store
69
+ pip install 'atomicmemory[embeddings]' # + sentence-transformers for local embeddings
70
+ ```
71
+
51
72
  ## Quick start
52
73
 
74
+ Prerequisite: start `atomicmemory-core` first. Follow the [Core Quickstart](https://docs.atomicstrata.ai/quickstart) if you do not already have a backend at `http://localhost:17350`.
75
+
53
76
  ```python
54
77
  from atomicmemory import AtomicMemoryClient
55
78
 
56
79
  with AtomicMemoryClient({
57
- "apiUrl": "http://localhost:3050",
80
+ "apiUrl": "http://localhost:17350",
58
81
  "apiKey": "server-api-key",
59
82
  "userId": "demo",
60
83
  }) as client:
@@ -88,7 +111,7 @@ from atomicmemory import AsyncAtomicMemoryClient
88
111
 
89
112
  async def main() -> None:
90
113
  async with AsyncAtomicMemoryClient({
91
- "apiUrl": "http://localhost:3050",
114
+ "apiUrl": "http://localhost:17350",
92
115
  "apiKey": "server-api-key",
93
116
  "userId": "demo",
94
117
  }) as client:
@@ -111,6 +134,30 @@ health = client.memory.atomicmemory.config.health()
111
134
 
112
135
  Categories: `lifecycle`, `audit`, `lessons`, `config`, `agents`.
113
136
 
137
+ ## Memory providers
138
+
139
+ The memory namespace supports the same provider family as the TypeScript SDK:
140
+
141
+ - `atomicmemory` — AtomicMemory core backend.
142
+ - `mem0` — Mem0 OSS or hosted backend.
143
+ - `hindsight` — Hindsight Cloud or self-hosted backend.
144
+
145
+ ```python
146
+ from atomicmemory import MemoryClient
147
+
148
+ with MemoryClient(
149
+ providers={
150
+ "hindsight": {
151
+ "apiUrl": "http://localhost:8888",
152
+ "apiVersion": "v1",
153
+ "projectId": "default",
154
+ }
155
+ }
156
+ ) as memory:
157
+ memory.initialize()
158
+ page = memory.search({"query": "seat preference", "scope": {"user": "demo"}})
159
+ ```
160
+
114
161
  ## Artifact storage
115
162
 
116
163
  The `client.storage` namespace mirrors the TypeScript SDK's direct storage API:
@@ -123,13 +170,50 @@ The `client.storage` namespace mirrors the TypeScript SDK's direct storage API:
123
170
 
124
171
  Every storage request sends `Authorization: Bearer <apiKey>` and `X-AtomicMemory-User-Id`. The SDK never sends the legacy `?user_id=` URL parameter.
125
172
 
126
- ## Installation
173
+ ## v1 wire contract
127
174
 
128
- ```bash
129
- pip install atomicmemory # core + local search + SQLite store
130
- pip install 'atomicmemory[embeddings]' # + sentence-transformers for local embeddings
175
+ `atomicmemory.contract.v1` is the wire codec for the v1 provider-contract encoding. The wire form is deliberately mixed-case — `Memory.createdAt`/`updatedAt` and `SearchResult.rankingScore` are camelCase; `version_id`, `observed_at`, and retrieval-receipt fields are snake_case — as pinned by the vendored `contract/CONTRACT.md`. This module is the only place that mapping lives; in-process models and provider mappers are unchanged.
176
+
177
+ ```python
178
+ from atomicmemory.contract import v1
179
+
180
+ # decode a wire search response (e.g. from a cross-SDK provider call)
181
+ wire_page = {
182
+ "results": [
183
+ {
184
+ "memory": {
185
+ "id": "mem_1",
186
+ "content": "I prefer aisle seats on flights.",
187
+ "scope": {"user": "demo"},
188
+ "kind": "fact",
189
+ "createdAt": "2026-05-30T12:00:00.000Z",
190
+ },
191
+ "score": 0.91,
192
+ "rankingScore": 0.87,
193
+ }
194
+ ],
195
+ "retrieval": {
196
+ "embedding_model": "text-embedding-x",
197
+ "embedding_model_version": "1",
198
+ "embedding_dimensions": 1536,
199
+ "query_text": "deploy gate",
200
+ "candidate_ids": ["mem_1"],
201
+ "trace_id": "trace-1",
202
+ },
203
+ }
204
+
205
+ page = v1.decode_search_result_page(wire_page)
206
+ for hit in page.results:
207
+ print(hit.memory.content, hit.score) # snake_case in-process models
208
+
209
+ # re-encode to the exact v1 wire form (millisecond-precision UTC datetimes)
210
+ wire_out = v1.encode_search_result_page(page)
131
211
  ```
132
212
 
213
+ Two behaviors to know: naive datetimes passed to encode functions are assumed UTC (bare `astimezone()` would shift by the host's UTC offset); `encode_ingest_input` rejects models carrying `content_class` with a clear error because the v1 schemas have `additionalProperties: false` and no such field — this is a Python-ahead field pending TS contract alignment.
214
+
215
+ This is NOT the AtomicMemory core HTTP API. That boundary stays in the provider mappers. The import path is `atomicmemory.contract` — deliberately not re-exported from the package root to keep the root namespace focused on the core provider API.
216
+
133
217
  ## Development
134
218
 
135
219
  ```bash
@@ -141,6 +225,18 @@ uv run mypy atomicmemory --strict
141
225
  uv run vulture atomicmemory tests .vulture_whitelist.py --min-confidence 90
142
226
  ```
143
227
 
228
+ ### Live provider smoke tests
229
+
230
+ Live provider tests are opt-in and are not required for normal development.
231
+ They assume the backend is already running and configured with its own model.
232
+
233
+ ```bash
234
+ ATOMICMEMORY_HINDSIGHT_INTEGRATION=1 \
235
+ HINDSIGHT_API_URL=http://localhost:8890 \
236
+ HINDSIGHT_TIMEOUT_SECONDS=120 \
237
+ uv run pytest tests/providers/hindsight/test_integration.py -m integration -ra
238
+ ```
239
+
144
240
  ## License
145
241
 
146
- MIT
242
+ Apache-2.0
@@ -0,0 +1,203 @@
1
+ # atomicmemory-python
2
+
3
+ [![CI](https://github.com/atomicstrata/atomicmemory-python/actions/workflows/ci.yml/badge.svg)](https://github.com/atomicstrata/atomicmemory-python/actions/workflows/ci.yml)
4
+ [![PyPI](https://img.shields.io/pypi/v/atomicmemory?label=pypi)](https://pypi.org/project/atomicmemory/)
5
+ [![Python](https://img.shields.io/pypi/pyversions/atomicmemory)](https://pypi.org/project/atomicmemory/)
6
+ [![Docs](https://img.shields.io/badge/docs-docs.atomicstrata.ai-blue)](https://docs.atomicstrata.ai)
7
+ [![License: Apache 2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
8
+
9
+ Python client SDK for [AtomicMemory](https://github.com/atomicstrata) memory and artifact storage.
10
+
11
+ **Docs:** [docs.atomicstrata.ai](https://docs.atomicstrata.ai)
12
+
13
+ AtomicMemory Core currently reaches cost-Pareto SOTA on BEAM-100K, BEAM-1M, and LoCoMo10, with BEAM-10M parity against the strongest published Mem0-new result. This package brings that memory layer to Python services, agents, notebooks, and evaluation workflows.
14
+
15
+ A backend-agnostic memory and storage client: ingest conversations and
16
+ documents, search them semantically, package retrieval-ready context, register
17
+ or upload raw artifacts, and access AtomicMemory-specific features (lifecycle,
18
+ audit, lessons, agents/trust, runtime config) through typed namespace handles.
19
+
20
+ This is a Python port of the TypeScript [`atomicmemory-sdk`](https://github.com/atomicstrata/atomicmemory-sdk). It mirrors the public surface 1:1 while staying idiomatic to Python (Pydantic models, `httpx` sync + async clients, `match` statements, `snake_case`).
21
+
22
+ ## Status
23
+
24
+ Stable release — `1.0.0` on [PyPI](https://pypi.org/project/atomicmemory/).
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ pip install atomicmemory # core + local search + SQLite store
30
+ pip install 'atomicmemory[embeddings]' # + sentence-transformers for local embeddings
31
+ ```
32
+
33
+ ## Quick start
34
+
35
+ Prerequisite: start `atomicmemory-core` first. Follow the [Core Quickstart](https://docs.atomicstrata.ai/quickstart) if you do not already have a backend at `http://localhost:17350`.
36
+
37
+ ```python
38
+ from atomicmemory import AtomicMemoryClient
39
+
40
+ with AtomicMemoryClient({
41
+ "apiUrl": "http://localhost:17350",
42
+ "apiKey": "server-api-key",
43
+ "userId": "demo",
44
+ }) as client:
45
+ client.memory.initialize()
46
+
47
+ client.memory.ingest({
48
+ "mode": "messages",
49
+ "messages": [
50
+ {"role": "user", "content": "I prefer aisle seats on flights."},
51
+ ],
52
+ "scope": {"user": "demo"},
53
+ })
54
+
55
+ page = client.memory.search({"query": "seat preference", "scope": {"user": "demo"}})
56
+ for hit in page.results:
57
+ print(hit.memory.content, hit.score)
58
+
59
+ artifact = client.storage.put({
60
+ "mode": "pointer",
61
+ "uri": "https://example.com/manual.pdf",
62
+ "contentType": "application/pdf",
63
+ })
64
+ print(artifact.artifact_id)
65
+ ```
66
+
67
+ ## Async usage
68
+
69
+ ```python
70
+ import asyncio
71
+ from atomicmemory import AsyncAtomicMemoryClient
72
+
73
+ async def main() -> None:
74
+ async with AsyncAtomicMemoryClient({
75
+ "apiUrl": "http://localhost:17350",
76
+ "apiKey": "server-api-key",
77
+ "userId": "demo",
78
+ }) as client:
79
+ await client.memory.initialize()
80
+ results = await client.memory.search({"query": "seat preference", "scope": {"user": "demo"}})
81
+ for hit in results.results:
82
+ print(hit.memory.content)
83
+
84
+ asyncio.run(main())
85
+ ```
86
+
87
+ ## AtomicMemory-specific features
88
+
89
+ When configured with the `atomicmemory` provider, the client exposes a typed handle for backend-specific routes:
90
+
91
+ ```python
92
+ trail = client.memory.atomicmemory.audit.trail(memory_id="mem-123", user_id="demo")
93
+ health = client.memory.atomicmemory.config.health()
94
+ ```
95
+
96
+ Categories: `lifecycle`, `audit`, `lessons`, `config`, `agents`.
97
+
98
+ ## Memory providers
99
+
100
+ The memory namespace supports the same provider family as the TypeScript SDK:
101
+
102
+ - `atomicmemory` — AtomicMemory core backend.
103
+ - `mem0` — Mem0 OSS or hosted backend.
104
+ - `hindsight` — Hindsight Cloud or self-hosted backend.
105
+
106
+ ```python
107
+ from atomicmemory import MemoryClient
108
+
109
+ with MemoryClient(
110
+ providers={
111
+ "hindsight": {
112
+ "apiUrl": "http://localhost:8888",
113
+ "apiVersion": "v1",
114
+ "projectId": "default",
115
+ }
116
+ }
117
+ ) as memory:
118
+ memory.initialize()
119
+ page = memory.search({"query": "seat preference", "scope": {"user": "demo"}})
120
+ ```
121
+
122
+ ## Artifact storage
123
+
124
+ The `client.storage` namespace mirrors the TypeScript SDK's direct storage API:
125
+
126
+ - `capabilities()` reports active backend support.
127
+ - `put({"mode": "pointer", ...})` registers a pointer to caller-owned bytes.
128
+ - `put({"mode": "managed", "body": b"...", ...})` uploads known-length bytes to the configured raw content store.
129
+ - `get`, `get_content`, `head`, `delete`, and `verify` address artifacts by `artifact_id`.
130
+ - `stream_content` streams large artifact bodies without buffering the entire response in memory.
131
+
132
+ Every storage request sends `Authorization: Bearer <apiKey>` and `X-AtomicMemory-User-Id`. The SDK never sends the legacy `?user_id=` URL parameter.
133
+
134
+ ## v1 wire contract
135
+
136
+ `atomicmemory.contract.v1` is the wire codec for the v1 provider-contract encoding. The wire form is deliberately mixed-case — `Memory.createdAt`/`updatedAt` and `SearchResult.rankingScore` are camelCase; `version_id`, `observed_at`, and retrieval-receipt fields are snake_case — as pinned by the vendored `contract/CONTRACT.md`. This module is the only place that mapping lives; in-process models and provider mappers are unchanged.
137
+
138
+ ```python
139
+ from atomicmemory.contract import v1
140
+
141
+ # decode a wire search response (e.g. from a cross-SDK provider call)
142
+ wire_page = {
143
+ "results": [
144
+ {
145
+ "memory": {
146
+ "id": "mem_1",
147
+ "content": "I prefer aisle seats on flights.",
148
+ "scope": {"user": "demo"},
149
+ "kind": "fact",
150
+ "createdAt": "2026-05-30T12:00:00.000Z",
151
+ },
152
+ "score": 0.91,
153
+ "rankingScore": 0.87,
154
+ }
155
+ ],
156
+ "retrieval": {
157
+ "embedding_model": "text-embedding-x",
158
+ "embedding_model_version": "1",
159
+ "embedding_dimensions": 1536,
160
+ "query_text": "deploy gate",
161
+ "candidate_ids": ["mem_1"],
162
+ "trace_id": "trace-1",
163
+ },
164
+ }
165
+
166
+ page = v1.decode_search_result_page(wire_page)
167
+ for hit in page.results:
168
+ print(hit.memory.content, hit.score) # snake_case in-process models
169
+
170
+ # re-encode to the exact v1 wire form (millisecond-precision UTC datetimes)
171
+ wire_out = v1.encode_search_result_page(page)
172
+ ```
173
+
174
+ Two behaviors to know: naive datetimes passed to encode functions are assumed UTC (bare `astimezone()` would shift by the host's UTC offset); `encode_ingest_input` rejects models carrying `content_class` with a clear error because the v1 schemas have `additionalProperties: false` and no such field — this is a Python-ahead field pending TS contract alignment.
175
+
176
+ This is NOT the AtomicMemory core HTTP API. That boundary stays in the provider mappers. The import path is `atomicmemory.contract` — deliberately not re-exported from the package root to keep the root namespace focused on the core provider API.
177
+
178
+ ## Development
179
+
180
+ ```bash
181
+ uv sync --extra dev --extra embeddings
182
+ uv run pytest
183
+ uv run ruff check .
184
+ uv run ruff format --check .
185
+ uv run mypy atomicmemory --strict
186
+ uv run vulture atomicmemory tests .vulture_whitelist.py --min-confidence 90
187
+ ```
188
+
189
+ ### Live provider smoke tests
190
+
191
+ Live provider tests are opt-in and are not required for normal development.
192
+ They assume the backend is already running and configured with its own model.
193
+
194
+ ```bash
195
+ ATOMICMEMORY_HINDSIGHT_INTEGRATION=1 \
196
+ HINDSIGHT_API_URL=http://localhost:8890 \
197
+ HINDSIGHT_TIMEOUT_SECONDS=120 \
198
+ uv run pytest tests/providers/hindsight/test_integration.py -m integration -ra
199
+ ```
200
+
201
+ ## License
202
+
203
+ Apache-2.0