core-memory 1.0.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.
Files changed (236) hide show
  1. core_memory-1.0.1/LICENSE +21 -0
  2. core_memory-1.0.1/PKG-INFO +212 -0
  3. core_memory-1.0.1/README.md +185 -0
  4. core_memory-1.0.1/core_memory/__init__.py +41 -0
  5. core_memory-1.0.1/core_memory/association/__init__.py +4 -0
  6. core_memory-1.0.1/core_memory/association/crawler_contract.py +388 -0
  7. core_memory-1.0.1/core_memory/association/preview.py +88 -0
  8. core_memory-1.0.1/core_memory/cli.py +798 -0
  9. core_memory-1.0.1/core_memory/dreamer.py +365 -0
  10. core_memory-1.0.1/core_memory/graph/__init__.py +4 -0
  11. core_memory-1.0.1/core_memory/graph/api.py +1059 -0
  12. core_memory-1.0.1/core_memory/graph/semantic.py +288 -0
  13. core_memory-1.0.1/core_memory/graph/structural.py +315 -0
  14. core_memory-1.0.1/core_memory/graph/traversal.py +153 -0
  15. core_memory-1.0.1/core_memory/integrations/__init__.py +9 -0
  16. core_memory-1.0.1/core_memory/integrations/api.py +101 -0
  17. core_memory-1.0.1/core_memory/integrations/http/__init__.py +23 -0
  18. core_memory-1.0.1/core_memory/integrations/http/server.py +204 -0
  19. core_memory-1.0.1/core_memory/integrations/openclaw_agent_end_bridge.py +282 -0
  20. core_memory-1.0.1/core_memory/integrations/openclaw_compaction_bridge.py +77 -0
  21. core_memory-1.0.1/core_memory/integrations/openclaw_compaction_queue.py +171 -0
  22. core_memory-1.0.1/core_memory/integrations/openclaw_onboard.py +77 -0
  23. core_memory-1.0.1/core_memory/integrations/openclaw_runtime.py +101 -0
  24. core_memory-1.0.1/core_memory/integrations/pydanticai/__init__.py +3 -0
  25. core_memory-1.0.1/core_memory/integrations/pydanticai/run.py +143 -0
  26. core_memory-1.0.1/core_memory/integrations/springai/__init__.py +9 -0
  27. core_memory-1.0.1/core_memory/integrations/springai/bridge.py +15 -0
  28. core_memory-1.0.1/core_memory/persistence/__init__.py +5 -0
  29. core_memory-1.0.1/core_memory/persistence/archive_index.py +120 -0
  30. core_memory-1.0.1/core_memory/persistence/events.py +330 -0
  31. core_memory-1.0.1/core_memory/persistence/io_utils.py +53 -0
  32. core_memory-1.0.1/core_memory/persistence/rolling_record_store.py +54 -0
  33. core_memory-1.0.1/core_memory/persistence/store.py +2564 -0
  34. core_memory-1.0.1/core_memory/policy/association_contract.py +74 -0
  35. core_memory-1.0.1/core_memory/policy/bead_typing.py +106 -0
  36. core_memory-1.0.1/core_memory/policy/hygiene.py +334 -0
  37. core_memory-1.0.1/core_memory/policy/incidents.py +113 -0
  38. core_memory-1.0.1/core_memory/policy/promotion.py +261 -0
  39. core_memory-1.0.1/core_memory/policy/promotion_contract.py +42 -0
  40. core_memory-1.0.1/core_memory/py.typed +1 -0
  41. core_memory-1.0.1/core_memory/retrieval/__init__.py +2 -0
  42. core_memory-1.0.1/core_memory/retrieval/config.py +57 -0
  43. core_memory-1.0.1/core_memory/retrieval/context_recall.py +144 -0
  44. core_memory-1.0.1/core_memory/retrieval/failure_patterns.py +79 -0
  45. core_memory-1.0.1/core_memory/retrieval/hybrid.py +118 -0
  46. core_memory-1.0.1/core_memory/retrieval/lexical.py +72 -0
  47. core_memory-1.0.1/core_memory/retrieval/pipeline/__init__.py +47 -0
  48. core_memory-1.0.1/core_memory/retrieval/pipeline/catalog.py +55 -0
  49. core_memory-1.0.1/core_memory/retrieval/pipeline/execute.py +332 -0
  50. core_memory-1.0.1/core_memory/retrieval/pipeline/explain.py +25 -0
  51. core_memory-1.0.1/core_memory/retrieval/pipeline/search.py +154 -0
  52. core_memory-1.0.1/core_memory/retrieval/pipeline/snap.py +96 -0
  53. core_memory-1.0.1/core_memory/retrieval/quality_gate.py +54 -0
  54. core_memory-1.0.1/core_memory/retrieval/query_norm.py +184 -0
  55. core_memory-1.0.1/core_memory/retrieval/rerank.py +348 -0
  56. core_memory-1.0.1/core_memory/retrieval/search_form.py +25 -0
  57. core_memory-1.0.1/core_memory/retrieval/semantic_index.py +215 -0
  58. core_memory-1.0.1/core_memory/retrieval/tools/__init__.py +3 -0
  59. core_memory-1.0.1/core_memory/retrieval/tools/memory.py +75 -0
  60. core_memory-1.0.1/core_memory/retrieval/tools/memory_reason.py +1010 -0
  61. core_memory-1.0.1/core_memory/retrieval/tools/memory_search.py +23 -0
  62. core_memory-1.0.1/core_memory/retrieval/types.py +16 -0
  63. core_memory-1.0.1/core_memory/runtime/__init__.py +5 -0
  64. core_memory-1.0.1/core_memory/runtime/association_pass.py +24 -0
  65. core_memory-1.0.1/core_memory/runtime/decision_pass.py +17 -0
  66. core_memory-1.0.1/core_memory/runtime/engine.py +802 -0
  67. core_memory-1.0.1/core_memory/runtime/ingress.py +177 -0
  68. core_memory-1.0.1/core_memory/runtime/live_session.py +53 -0
  69. core_memory-1.0.1/core_memory/runtime/session_surface.py +36 -0
  70. core_memory-1.0.1/core_memory/runtime/state.py +295 -0
  71. core_memory-1.0.1/core_memory/runtime/worker.py +103 -0
  72. core_memory-1.0.1/core_memory/schema/__init__.py +2 -0
  73. core_memory-1.0.1/core_memory/schema/models.py +319 -0
  74. core_memory-1.0.1/core_memory/schema/normalization.py +120 -0
  75. core_memory-1.0.1/core_memory/write_pipeline/__init__.py +1 -0
  76. core_memory-1.0.1/core_memory/write_pipeline/consolidate.py +78 -0
  77. core_memory-1.0.1/core_memory/write_pipeline/continuity_injection.py +56 -0
  78. core_memory-1.0.1/core_memory/write_pipeline/orchestrate.py +45 -0
  79. core_memory-1.0.1/core_memory/write_pipeline/rolling_window.py +197 -0
  80. core_memory-1.0.1/core_memory.egg-info/PKG-INFO +212 -0
  81. core_memory-1.0.1/core_memory.egg-info/SOURCES.txt +234 -0
  82. core_memory-1.0.1/core_memory.egg-info/dependency_links.txt +1 -0
  83. core_memory-1.0.1/core_memory.egg-info/entry_points.txt +2 -0
  84. core_memory-1.0.1/core_memory.egg-info/requires.txt +10 -0
  85. core_memory-1.0.1/core_memory.egg-info/top_level.txt +1 -0
  86. core_memory-1.0.1/pyproject.toml +53 -0
  87. core_memory-1.0.1/setup.cfg +4 -0
  88. core_memory-1.0.1/tests/test_adapter_contract_markers.py +23 -0
  89. core_memory-1.0.1/tests/test_archive_index.py +60 -0
  90. core_memory-1.0.1/tests/test_association_crawler_contract.py +82 -0
  91. core_memory-1.0.1/tests/test_association_fallback_grounding.py +32 -0
  92. core_memory-1.0.1/tests/test_association_pass_contract.py +43 -0
  93. core_memory-1.0.1/tests/test_association_pass_strengthened.py +67 -0
  94. core_memory-1.0.1/tests/test_association_policy_contract.py +18 -0
  95. core_memory-1.0.1/tests/test_association_type_policy.py +22 -0
  96. core_memory-1.0.1/tests/test_auto_archive_hold.py +27 -0
  97. core_memory-1.0.1/tests/test_backfill_causal_links.py +28 -0
  98. core_memory-1.0.1/tests/test_backfill_causal_links_targeted.py +26 -0
  99. core_memory-1.0.1/tests/test_catalog_relation_source.py +31 -0
  100. core_memory-1.0.1/tests/test_causal_retry_guard.py +25 -0
  101. core_memory-1.0.1/tests/test_centrality_r3.py +31 -0
  102. core_memory-1.0.1/tests/test_chain_diversity_r4.py +32 -0
  103. core_memory-1.0.1/tests/test_chain_priority_why.py +18 -0
  104. core_memory-1.0.1/tests/test_citation_confidence_r4.py +30 -0
  105. core_memory-1.0.1/tests/test_cli_canonical_health.py +34 -0
  106. core_memory-1.0.1/tests/test_compaction_phase_a.py +75 -0
  107. core_memory-1.0.1/tests/test_compaction_queue_bridge.py +36 -0
  108. core_memory-1.0.1/tests/test_compression_ratio.py +30 -0
  109. core_memory-1.0.1/tests/test_continuity_injection_authority.py +64 -0
  110. core_memory-1.0.1/tests/test_decide_promotion.py +79 -0
  111. core_memory-1.0.1/tests/test_decision_conflicts.py +60 -0
  112. core_memory-1.0.1/tests/test_e2e.py +51 -0
  113. core_memory-1.0.1/tests/test_e2e_lifecycle_query.py +76 -0
  114. core_memory-1.0.1/tests/test_e2e_program_scenarios.py +189 -0
  115. core_memory-1.0.1/tests/test_e2e_sidecar_per_turn.py +50 -0
  116. core_memory-1.0.1/tests/test_edge_traversal_logging.py +44 -0
  117. core_memory-1.0.1/tests/test_edges.py +38 -0
  118. core_memory-1.0.1/tests/test_evaluate_candidates.py +29 -0
  119. core_memory-1.0.1/tests/test_event_import_migration_guard.py +46 -0
  120. core_memory-1.0.1/tests/test_event_module_aliases.py +22 -0
  121. core_memory-1.0.1/tests/test_explain_contains_snaps_and_scores.py +29 -0
  122. core_memory-1.0.1/tests/test_explain_report_contains_required_fields.py +30 -0
  123. core_memory-1.0.1/tests/test_flush_cycle_guard.py +56 -0
  124. core_memory-1.0.1/tests/test_flush_report_artifact.py +41 -0
  125. core_memory-1.0.1/tests/test_flush_sequence_trace.py +28 -0
  126. core_memory-1.0.1/tests/test_form_schema_stable.py +18 -0
  127. core_memory-1.0.1/tests/test_fusion_tie_break.py +24 -0
  128. core_memory-1.0.1/tests/test_graph_r2.py +42 -0
  129. core_memory-1.0.1/tests/test_http_ingress.py +192 -0
  130. core_memory-1.0.1/tests/test_hybrid_determinism.py +22 -0
  131. core_memory-1.0.1/tests/test_hygiene_curated.py +25 -0
  132. core_memory-1.0.1/tests/test_idempotency_effects.py +52 -0
  133. core_memory-1.0.1/tests/test_incident_alias_match.py +16 -0
  134. core_memory-1.0.1/tests/test_incident_boost_is_deterministic.py +26 -0
  135. core_memory-1.0.1/tests/test_index_projection_cache.py +28 -0
  136. core_memory-1.0.1/tests/test_integrations_api.py +69 -0
  137. core_memory-1.0.1/tests/test_intent_class_normalization.py +27 -0
  138. core_memory-1.0.1/tests/test_intent_router_r4.py +33 -0
  139. core_memory-1.0.1/tests/test_intent_weighted_rerank.py +26 -0
  140. core_memory-1.0.1/tests/test_lexical_field_weights.py +23 -0
  141. core_memory-1.0.1/tests/test_lexical_recall_smoke.py +21 -0
  142. core_memory-1.0.1/tests/test_live_session_authority.py +66 -0
  143. core_memory-1.0.1/tests/test_memory_engine.py +43 -0
  144. core_memory-1.0.1/tests/test_memory_execute_causal_fallback.py +33 -0
  145. core_memory-1.0.1/tests/test_memory_execute_confidence_edge_cases.py +34 -0
  146. core_memory-1.0.1/tests/test_memory_execute_contract.py +33 -0
  147. core_memory-1.0.1/tests/test_memory_execute_deterministic_order.py +40 -0
  148. core_memory-1.0.1/tests/test_memory_execute_feature_flags.py +30 -0
  149. core_memory-1.0.1/tests/test_memory_execute_field_mapping.py +37 -0
  150. core_memory-1.0.1/tests/test_memory_execute_next_action_policy.py +31 -0
  151. core_memory-1.0.1/tests/test_memory_execute_surface_metadata.py +31 -0
  152. core_memory-1.0.1/tests/test_memory_reason_pins.py +29 -0
  153. core_memory-1.0.1/tests/test_memory_reason_r4.py +31 -0
  154. core_memory-1.0.1/tests/test_memory_search_smoke_eval.py +33 -0
  155. core_memory-1.0.1/tests/test_memory_search_tool_wrapper.py +35 -0
  156. core_memory-1.0.1/tests/test_memory_search_typed_confidence_unified.py +26 -0
  157. core_memory-1.0.1/tests/test_metrics.py +59 -0
  158. core_memory-1.0.1/tests/test_metrics_aggregation.py +38 -0
  159. core_memory-1.0.1/tests/test_models_schema_alignment.py +22 -0
  160. core_memory-1.0.1/tests/test_normalization_rank_fallback.py +14 -0
  161. core_memory-1.0.1/tests/test_openclaw_agent_end_bridge.py +46 -0
  162. core_memory-1.0.1/tests/test_openclaw_integration.py +62 -0
  163. core_memory-1.0.1/tests/test_p13_authority_enforcement.py +59 -0
  164. core_memory-1.0.1/tests/test_p8b_read_path_purification.py +33 -0
  165. core_memory-1.0.1/tests/test_p8c_retrieval_path_purity.py +20 -0
  166. core_memory-1.0.1/tests/test_p9_session_purity_invariants.py +63 -0
  167. core_memory-1.0.1/tests/test_persistence_shim_import_audit.py +32 -0
  168. core_memory-1.0.1/tests/test_phase_b_promotion.py +65 -0
  169. core_memory-1.0.1/tests/test_pre_oss_matrix.py +31 -0
  170. core_memory-1.0.1/tests/test_process_flush_checkpoint_bead.py +76 -0
  171. core_memory-1.0.1/tests/test_promotion_kpis.py +29 -0
  172. core_memory-1.0.1/tests/test_promotion_slate.py +28 -0
  173. core_memory-1.0.1/tests/test_pydanticai_adapter.py +87 -0
  174. core_memory-1.0.1/tests/test_quality_gate_bucket_thresholds.py +16 -0
  175. core_memory-1.0.1/tests/test_quality_gate_single_retry.py +31 -0
  176. core_memory-1.0.1/tests/test_query_anchor_resolution.py +18 -0
  177. core_memory-1.0.1/tests/test_r3_graph_semantic.py +57 -0
  178. core_memory-1.0.1/tests/test_radius1_fallback_grounding.py +26 -0
  179. core_memory-1.0.1/tests/test_radius1_graph_fallback_grounding.py +26 -0
  180. core_memory-1.0.1/tests/test_rationale_recall.py +45 -0
  181. core_memory-1.0.1/tests/test_rebuild_integrity.py +48 -0
  182. core_memory-1.0.1/tests/test_required_fields_v2.py +47 -0
  183. core_memory-1.0.1/tests/test_reranker_feature_extraction.py +36 -0
  184. core_memory-1.0.1/tests/test_reranker_scoring_is_bounded.py +25 -0
  185. core_memory-1.0.1/tests/test_retrieval_eval_grounding_details.py +26 -0
  186. core_memory-1.0.1/tests/test_retrieve_deep_recall.py +55 -0
  187. core_memory-1.0.1/tests/test_retrieve_query_expansion.py +33 -0
  188. core_memory-1.0.1/tests/test_rolling_fifo_determinism.py +59 -0
  189. core_memory-1.0.1/tests/test_rolling_record_store.py +39 -0
  190. core_memory-1.0.1/tests/test_rolling_surface_contract.py +35 -0
  191. core_memory-1.0.1/tests/test_rolling_surface_owner.py +32 -0
  192. core_memory-1.0.1/tests/test_rolling_surface_separation.py +42 -0
  193. core_memory-1.0.1/tests/test_router_hint_retry_r4.py +21 -0
  194. core_memory-1.0.1/tests/test_runtime_association_pass.py +36 -0
  195. core_memory-1.0.1/tests/test_runtime_decision_pass.py +19 -0
  196. core_memory-1.0.1/tests/test_schema_normalization.py +29 -0
  197. core_memory-1.0.1/tests/test_schema_quality_report.py +27 -0
  198. core_memory-1.0.1/tests/test_search_form_module_primary.py +19 -0
  199. core_memory-1.0.1/tests/test_search_typed_filters_work.py +28 -0
  200. core_memory-1.0.1/tests/test_search_typed_relation_filters.py +36 -0
  201. core_memory-1.0.1/tests/test_search_typed_time_range.py +45 -0
  202. core_memory-1.0.1/tests/test_secret_redaction.py +43 -0
  203. core_memory-1.0.1/tests/test_semantic_active_k.py +27 -0
  204. core_memory-1.0.1/tests/test_semantic_backend_modes.py +24 -0
  205. core_memory-1.0.1/tests/test_session_first_query_authority.py +31 -0
  206. core_memory-1.0.1/tests/test_session_first_write_authority.py +40 -0
  207. core_memory-1.0.1/tests/test_session_surface.py +21 -0
  208. core_memory-1.0.1/tests/test_sidecar_cli.py +52 -0
  209. core_memory-1.0.1/tests/test_sidecar_contracts.py +41 -0
  210. core_memory-1.0.1/tests/test_sidecar_hook.py +72 -0
  211. core_memory-1.0.1/tests/test_sidecar_sync_session_semantics.py +33 -0
  212. core_memory-1.0.1/tests/test_sidecar_worker.py +55 -0
  213. core_memory-1.0.1/tests/test_snap_confidence_labels.py +29 -0
  214. core_memory-1.0.1/tests/test_snap_deterministic.py +27 -0
  215. core_memory-1.0.1/tests/test_snap_unknowns_safe.py +28 -0
  216. core_memory-1.0.1/tests/test_springai_bridge.py +14 -0
  217. core_memory-1.0.1/tests/test_store_boundary_contract.py +22 -0
  218. core_memory-1.0.1/tests/test_store_shim_import_audit.py +19 -0
  219. core_memory-1.0.1/tests/test_structural_constraint_metadata.py +21 -0
  220. core_memory-1.0.1/tests/test_structural_enrichment_after_weak_chains.py +35 -0
  221. core_memory-1.0.1/tests/test_structural_features_radius1.py +31 -0
  222. core_memory-1.0.1/tests/test_structural_inference_hardening.py +50 -0
  223. core_memory-1.0.1/tests/test_sync_structural_pipeline.py +45 -0
  224. core_memory-1.0.1/tests/test_topic_key_tagging.py +21 -0
  225. core_memory-1.0.1/tests/test_trigger_authority_markers.py +25 -0
  226. core_memory-1.0.1/tests/test_trigger_orchestrator.py +43 -0
  227. core_memory-1.0.1/tests/test_trigger_orchestrator_flush.py +40 -0
  228. core_memory-1.0.1/tests/test_trigger_orchestrator_flush_recovery.py +40 -0
  229. core_memory-1.0.1/tests/test_turn_association_visibility.py +42 -0
  230. core_memory-1.0.1/tests/test_turn_decision_pass.py +85 -0
  231. core_memory-1.0.1/tests/test_v2_p2_enforcement_matrix.py +98 -0
  232. core_memory-1.0.1/tests/test_v2_p5_canonical_path_enforcement.py +46 -0
  233. core_memory-1.0.1/tests/test_v2p19_turn_to_retrieval_contract.py +72 -0
  234. core_memory-1.0.1/tests/test_v2p21_store_integrity.py +57 -0
  235. core_memory-1.0.1/tests/test_write_pipeline_consolidate_parity.py +32 -0
  236. core_memory-1.0.1/tests/test_write_pipeline_internalization.py +32 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Core Memory contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,212 @@
1
+ Metadata-Version: 2.4
2
+ Name: core-memory
3
+ Version: 1.0.1
4
+ Summary: Persistent causal agent memory with lossless compaction
5
+ Author-email: Krusty <krusty@clawdio.dev>
6
+ License: MIT
7
+ Keywords: memory,agent,causal,beads,compaction
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Provides-Extra: dev
19
+ Requires-Dist: pytest; extra == "dev"
20
+ Requires-Dist: ruff; extra == "dev"
21
+ Requires-Dist: mypy; extra == "dev"
22
+ Provides-Extra: http
23
+ Requires-Dist: fastapi; extra == "http"
24
+ Requires-Dist: uvicorn; extra == "http"
25
+ Requires-Dist: httpx; extra == "http"
26
+ Dynamic: license-file
27
+
28
+ <p align="center">
29
+ <img src="docs/assets/core-memory-hero-banner.jpg" alt="Core Memory" width="100%" />
30
+ </p>
31
+
32
+ <p align="center">
33
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License"></a>
34
+ <a href="#"><img src="https://img.shields.io/badge/python-3.10%2B-blue.svg" alt="Python 3.10+"></a>
35
+ </p>
36
+
37
+ <p align="center">
38
+ <b>Causal memory for AI agents.</b><br>
39
+ Structured event storage with deterministic, debuggable recall — so agents remember <i>why</i>, not just <i>what</i>.
40
+ </p>
41
+
42
+ <p align="center">
43
+ <a href="#quick-start">Quick Start</a> · <a href="docs/architecture_overview.md">Architecture</a> · <a href="docs/public_surface.md">API Surface</a> · <a href="#contributing">Contributing</a>
44
+ </p>
45
+
46
+ ---
47
+
48
+ ## What is Core Memory?
49
+
50
+ Most agent memory systems store *what happened*. Core Memory stores **why it happened**.
51
+
52
+ It records structured memory events called **beads** — decisions, lessons, outcomes, evidence, context — and the causal links between them. When an agent asks "why did we change strategy?", Core Memory retrieves a decision chain, not just keyword matches.
53
+
54
+ **How it's different:**
55
+
56
+ | Approach | Failure Mode | Core Memory |
57
+ |---|---|---|
58
+ | Chat log replay | Context window explodes | Bounded rolling window with compaction |
59
+ | Vector similarity | "Similar" ≠ "relevant" | Typed causal edges + hybrid retrieval |
60
+ | Tool call logs | No reasoning structure | Explicit bead → bead associations |
61
+
62
+ **Zero required runtime dependencies for core local flow.** Pure Python. Optional extras exist for HTTP/dev workflows.
63
+
64
+ ---
65
+
66
+ ## Quick Start
67
+
68
+ Install from source:
69
+
70
+ ```bash
71
+ git clone https://github.com/JohnnyFiv3r/Core-Memory.git
72
+ cd Core-Memory
73
+ pip install -e .
74
+ ```
75
+
76
+ If/when published on PyPI, you can also install via:
77
+
78
+ ```bash
79
+ pip install core-memory
80
+ ```
81
+
82
+ ### Write and recall a causal chain
83
+
84
+ ```python
85
+ from core_memory import MemoryStore, BeadType
86
+
87
+ store = MemoryStore("./memory")
88
+
89
+ store.add_bead(
90
+ type=BeadType.LESSON,
91
+ title="Redis timeouts under high load",
92
+ summary=["Worker count exceeded connection pool limit"],
93
+ )
94
+ store.add_bead(
95
+ type=BeadType.DECISION,
96
+ title="Increased Redis max connections to 200",
97
+ summary=["Pool exhaustion was root cause", "Resolved P1 incident"],
98
+ )
99
+
100
+ packet = store.query(limit=5)
101
+ for bead in packet:
102
+ print(f" [{bead['type']}] {bead['title']}")
103
+ ```
104
+
105
+ ```text
106
+ [lesson] Redis timeouts under high load
107
+ [decision] Increased Redis max connections to 200
108
+ ```
109
+
110
+ ---
111
+
112
+ ## How It Works
113
+
114
+ <p align="center">
115
+ <img src="docs/assets/core-memory-architecture-new.png" alt="Core Memory Architecture — Retrieval and Write sides" width="100%" />
116
+ </p>
117
+
118
+ Core Memory separates **retrieval** from **writes**, connected through session-scoped bead storage. Each agent turn follows the same loop:
119
+
120
+ 1. **Inject** — bounded context packet is built from store
121
+ 2. **Execute** — agent runs turn
122
+ 3. **Extract** — structured events captured as beads
123
+ 4. **Store** — append-only session log write
124
+ 5. **Compact** — peripheral beads degrade to compact form, promoted beads preserved
125
+ 6. **Repeat**
126
+
127
+ ---
128
+
129
+ ## Core Concepts
130
+
131
+ ### Beads
132
+ A bead is a structured memory event — the atomic unit of recall.
133
+
134
+ ### Associations
135
+ Associations are explicit links between beads and remain queryable as memory compacts.
136
+
137
+ ### Retrieval Pipeline
138
+ Core Memory uses hybrid retrieval:
139
+ - field-weighted lexical search
140
+ - semantic retrieval (when available)
141
+ - score fusion
142
+ - structural rerank with causal traversal
143
+
144
+ Retrieval is deterministic from indexed state.
145
+
146
+ ---
147
+
148
+ ## Integrations
149
+
150
+ Canonical ingress port:
151
+
152
+ ```python
153
+ from core_memory.integrations.api import emit_turn_finalized
154
+ ```
155
+
156
+ Framework adapters:
157
+ - OpenClaw (bridge)
158
+ - PydanticAI (native adapter)
159
+ - SpringAI (HTTP ingress)
160
+
161
+ See [`examples/pydanticai_basic.py`](examples/pydanticai_basic.py).
162
+
163
+ ---
164
+
165
+ ## Repo Map
166
+
167
+ ```
168
+ core_memory/
169
+ ├── persistence/
170
+ ├── schema/
171
+ ├── retrieval/
172
+ ├── graph/
173
+ ├── write_pipeline/
174
+ ├── runtime/
175
+ ├── association/
176
+ ├── integrations/
177
+ ├── policy/
178
+ └── cli.py
179
+ ```
180
+
181
+ - `examples/` runnable demos
182
+ - `tests/` behavioral + regression tests
183
+ - `docs/` architecture/contracts/specs
184
+ - `scripts/` setup + diagnostics
185
+
186
+ ---
187
+
188
+ ## Contributing
189
+
190
+ ```bash
191
+ git clone https://github.com/JohnnyFiv3r/Core-Memory.git
192
+ cd Core-Memory
193
+ pip install -e ".[dev]"
194
+ pytest
195
+ ```
196
+
197
+ - [CONTRIBUTING.md](CONTRIBUTING.md)
198
+ - [docs/public_surface.md](docs/public_surface.md)
199
+ - [docs/index.md](docs/index.md)
200
+
201
+ ---
202
+
203
+ ## Inspiration
204
+
205
+ Inspired in part by Steve Yegge’s writing on beads/memory systems:
206
+ https://github.com/steveyegge/beads
207
+
208
+ ---
209
+
210
+ <p align="center">
211
+ <a href="LICENSE">MIT License</a> · <a href="CODE_OF_CONDUCT.md">Code of Conduct</a> · <a href="CHANGELOG.md">Changelog</a>
212
+ </p>
@@ -0,0 +1,185 @@
1
+ <p align="center">
2
+ <img src="docs/assets/core-memory-hero-banner.jpg" alt="Core Memory" width="100%" />
3
+ </p>
4
+
5
+ <p align="center">
6
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License"></a>
7
+ <a href="#"><img src="https://img.shields.io/badge/python-3.10%2B-blue.svg" alt="Python 3.10+"></a>
8
+ </p>
9
+
10
+ <p align="center">
11
+ <b>Causal memory for AI agents.</b><br>
12
+ Structured event storage with deterministic, debuggable recall — so agents remember <i>why</i>, not just <i>what</i>.
13
+ </p>
14
+
15
+ <p align="center">
16
+ <a href="#quick-start">Quick Start</a> · <a href="docs/architecture_overview.md">Architecture</a> · <a href="docs/public_surface.md">API Surface</a> · <a href="#contributing">Contributing</a>
17
+ </p>
18
+
19
+ ---
20
+
21
+ ## What is Core Memory?
22
+
23
+ Most agent memory systems store *what happened*. Core Memory stores **why it happened**.
24
+
25
+ It records structured memory events called **beads** — decisions, lessons, outcomes, evidence, context — and the causal links between them. When an agent asks "why did we change strategy?", Core Memory retrieves a decision chain, not just keyword matches.
26
+
27
+ **How it's different:**
28
+
29
+ | Approach | Failure Mode | Core Memory |
30
+ |---|---|---|
31
+ | Chat log replay | Context window explodes | Bounded rolling window with compaction |
32
+ | Vector similarity | "Similar" ≠ "relevant" | Typed causal edges + hybrid retrieval |
33
+ | Tool call logs | No reasoning structure | Explicit bead → bead associations |
34
+
35
+ **Zero required runtime dependencies for core local flow.** Pure Python. Optional extras exist for HTTP/dev workflows.
36
+
37
+ ---
38
+
39
+ ## Quick Start
40
+
41
+ Install from source:
42
+
43
+ ```bash
44
+ git clone https://github.com/JohnnyFiv3r/Core-Memory.git
45
+ cd Core-Memory
46
+ pip install -e .
47
+ ```
48
+
49
+ If/when published on PyPI, you can also install via:
50
+
51
+ ```bash
52
+ pip install core-memory
53
+ ```
54
+
55
+ ### Write and recall a causal chain
56
+
57
+ ```python
58
+ from core_memory import MemoryStore, BeadType
59
+
60
+ store = MemoryStore("./memory")
61
+
62
+ store.add_bead(
63
+ type=BeadType.LESSON,
64
+ title="Redis timeouts under high load",
65
+ summary=["Worker count exceeded connection pool limit"],
66
+ )
67
+ store.add_bead(
68
+ type=BeadType.DECISION,
69
+ title="Increased Redis max connections to 200",
70
+ summary=["Pool exhaustion was root cause", "Resolved P1 incident"],
71
+ )
72
+
73
+ packet = store.query(limit=5)
74
+ for bead in packet:
75
+ print(f" [{bead['type']}] {bead['title']}")
76
+ ```
77
+
78
+ ```text
79
+ [lesson] Redis timeouts under high load
80
+ [decision] Increased Redis max connections to 200
81
+ ```
82
+
83
+ ---
84
+
85
+ ## How It Works
86
+
87
+ <p align="center">
88
+ <img src="docs/assets/core-memory-architecture-new.png" alt="Core Memory Architecture — Retrieval and Write sides" width="100%" />
89
+ </p>
90
+
91
+ Core Memory separates **retrieval** from **writes**, connected through session-scoped bead storage. Each agent turn follows the same loop:
92
+
93
+ 1. **Inject** — bounded context packet is built from store
94
+ 2. **Execute** — agent runs turn
95
+ 3. **Extract** — structured events captured as beads
96
+ 4. **Store** — append-only session log write
97
+ 5. **Compact** — peripheral beads degrade to compact form, promoted beads preserved
98
+ 6. **Repeat**
99
+
100
+ ---
101
+
102
+ ## Core Concepts
103
+
104
+ ### Beads
105
+ A bead is a structured memory event — the atomic unit of recall.
106
+
107
+ ### Associations
108
+ Associations are explicit links between beads and remain queryable as memory compacts.
109
+
110
+ ### Retrieval Pipeline
111
+ Core Memory uses hybrid retrieval:
112
+ - field-weighted lexical search
113
+ - semantic retrieval (when available)
114
+ - score fusion
115
+ - structural rerank with causal traversal
116
+
117
+ Retrieval is deterministic from indexed state.
118
+
119
+ ---
120
+
121
+ ## Integrations
122
+
123
+ Canonical ingress port:
124
+
125
+ ```python
126
+ from core_memory.integrations.api import emit_turn_finalized
127
+ ```
128
+
129
+ Framework adapters:
130
+ - OpenClaw (bridge)
131
+ - PydanticAI (native adapter)
132
+ - SpringAI (HTTP ingress)
133
+
134
+ See [`examples/pydanticai_basic.py`](examples/pydanticai_basic.py).
135
+
136
+ ---
137
+
138
+ ## Repo Map
139
+
140
+ ```
141
+ core_memory/
142
+ ├── persistence/
143
+ ├── schema/
144
+ ├── retrieval/
145
+ ├── graph/
146
+ ├── write_pipeline/
147
+ ├── runtime/
148
+ ├── association/
149
+ ├── integrations/
150
+ ├── policy/
151
+ └── cli.py
152
+ ```
153
+
154
+ - `examples/` runnable demos
155
+ - `tests/` behavioral + regression tests
156
+ - `docs/` architecture/contracts/specs
157
+ - `scripts/` setup + diagnostics
158
+
159
+ ---
160
+
161
+ ## Contributing
162
+
163
+ ```bash
164
+ git clone https://github.com/JohnnyFiv3r/Core-Memory.git
165
+ cd Core-Memory
166
+ pip install -e ".[dev]"
167
+ pytest
168
+ ```
169
+
170
+ - [CONTRIBUTING.md](CONTRIBUTING.md)
171
+ - [docs/public_surface.md](docs/public_surface.md)
172
+ - [docs/index.md](docs/index.md)
173
+
174
+ ---
175
+
176
+ ## Inspiration
177
+
178
+ Inspired in part by Steve Yegge’s writing on beads/memory systems:
179
+ https://github.com/steveyegge/beads
180
+
181
+ ---
182
+
183
+ <p align="center">
184
+ <a href="LICENSE">MIT License</a> · <a href="CODE_OF_CONDUCT.md">Code of Conduct</a> · <a href="CHANGELOG.md">Changelog</a>
185
+ </p>
@@ -0,0 +1,41 @@
1
+ """
2
+ Core-Memory: event/session-first memory layer for agent runtimes.
3
+
4
+ High-level architecture:
5
+ - finalized-turn event ingestion is canonical write ingress
6
+ - live session authority is session JSONL surface
7
+ - index/projection surfaces are rebuildable caches/projections
8
+
9
+ Canonical contributor docs:
10
+ - docs/architecture_overview.md
11
+ - docs/public_surface.md
12
+ """
13
+
14
+ from .persistence.store import MemoryStore, DEFAULT_ROOT
15
+ from .schema.models import (
16
+ Bead,
17
+ BeadType,
18
+ Scope,
19
+ Status,
20
+ Authority,
21
+ RelationshipType,
22
+ ImpactLevel,
23
+ Association,
24
+ Event,
25
+ )
26
+
27
+ __version__ = "1.0.1"
28
+
29
+ __all__ = [
30
+ "MemoryStore",
31
+ "DEFAULT_ROOT",
32
+ "Bead",
33
+ "BeadType",
34
+ "Scope",
35
+ "Status",
36
+ "Authority",
37
+ "RelationshipType",
38
+ "ImpactLevel",
39
+ "Association",
40
+ "Event",
41
+ ]
@@ -0,0 +1,4 @@
1
+ from .preview import run_association_pass
2
+ from .crawler_contract import build_crawler_context, apply_crawler_updates, merge_crawler_updates_for_flush
3
+
4
+ __all__ = ["run_association_pass", "build_crawler_context", "apply_crawler_updates", "merge_crawler_updates_for_flush"]