memory-cli 0.1.0__tar.gz → 0.2.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 (310) hide show
  1. memory_cli-0.2.0/CHANGELOG.md +22 -0
  2. {memory_cli-0.1.0 → memory_cli-0.2.0}/PKG-INFO +16 -3
  3. {memory_cli-0.1.0 → memory_cli-0.2.0}/README.md +15 -2
  4. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/commands/__init__.py +2 -2
  5. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/commands/diagnostics.py +17 -3
  6. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/commands/hooks.py +1 -2
  7. memory_cli-0.2.0/memory_cli/commands/install.py +110 -0
  8. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/core/__init__.py +1 -0
  9. memory_cli-0.2.0/memory_cli/core/protocol.py +54 -0
  10. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/core/resources.py +29 -5
  11. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/entry/auto.py +2 -1
  12. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/entry/capture.py +2 -1
  13. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/entry/corroborate.py +3 -1
  14. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/entry/integrate.py +2 -1
  15. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/entry/research.py +2 -0
  16. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/entry/settle.py +2 -1
  17. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/entry/synthesize.py +2 -0
  18. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/mem.py +3 -3
  19. {memory_cli-0.1.0 → memory_cli-0.2.0}/pyproject.toml +1 -1
  20. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/architecture/test_import_graph.py +24 -5
  21. memory_cli-0.2.0/tests/commands/test_install_command.py +164 -0
  22. memory_cli-0.2.0/tests/core/test_protocol.py +167 -0
  23. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/golden/mem_cli.json +19 -14
  24. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/packaging/test_wheel.py +18 -2
  25. memory_cli-0.1.0/CHANGELOG.md +0 -13
  26. memory_cli-0.1.0/memory_cli/commands/install.py +0 -152
  27. memory_cli-0.1.0/tests/commands/test_install_command.py +0 -273
  28. {memory_cli-0.1.0 → memory_cli-0.2.0}/.gitignore +0 -0
  29. {memory_cli-0.1.0 → memory_cli-0.2.0}/LICENSE +0 -0
  30. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/__init__.py +0 -0
  31. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/__main__.py +0 -0
  32. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/capture/__init__.py +0 -0
  33. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/capture/codex_rollout.py +0 -0
  34. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/capture/event_lines.py +0 -0
  35. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/capture/extract.py +0 -0
  36. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/capture/state.py +0 -0
  37. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/commands/admin.py +0 -0
  38. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/commands/common.py +0 -0
  39. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/commands/curate.py +0 -0
  40. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/commands/edit.py +0 -0
  41. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/commands/import_recovery.py +0 -0
  42. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/commands/integrate.py +0 -0
  43. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/commands/memory.py +0 -0
  44. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/commands/read.py +0 -0
  45. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/commands/sources.py +0 -0
  46. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/commands/split.py +0 -0
  47. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/commands/split_plan.py +0 -0
  48. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/commands/split_transaction.py +0 -0
  49. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/commands/synthesis.py +0 -0
  50. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/core/auto_state.py +0 -0
  51. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/core/codex_pass.py +0 -0
  52. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/core/config.py +0 -0
  53. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/core/file_journal.py +0 -0
  54. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/core/headless.py +0 -0
  55. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/core/jobs.py +0 -0
  56. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/core/runner.py +0 -0
  57. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/core/safe_io.py +0 -0
  58. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/core/store_git.py +0 -0
  59. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/core/yaml_load.py +0 -0
  60. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/corroborate/__init__.py +0 -0
  61. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/corroborate/cli.py +0 -0
  62. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/corroborate/decide.py +0 -0
  63. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/corroborate/digest.py +0 -0
  64. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/corroborate/fill.py +0 -0
  65. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/corroborate/job.py +0 -0
  66. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/corroborate/reword.py +0 -0
  67. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/corroborate/run.py +0 -0
  68. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/corroborate/state.py +0 -0
  69. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/digest/__init__.py +0 -0
  70. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/digest/lessons.py +0 -0
  71. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/entry/__init__.py +0 -0
  72. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/entry/integrate_self_check.py +0 -0
  73. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/entry/split_auto.py +0 -0
  74. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/integrate/__init__.py +0 -0
  75. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/integrate/answers.py +0 -0
  76. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/integrate/briefs/check-brief.md +0 -0
  77. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/integrate/briefs/place-brief.md +0 -0
  78. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/integrate/log.py +0 -0
  79. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/integrate/plan.py +0 -0
  80. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/integrate/rows.py +0 -0
  81. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/integrate/state.py +0 -0
  82. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/integrate/undo.py +0 -0
  83. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/memories/__init__.py +0 -0
  84. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/memories/fingerprints.py +0 -0
  85. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/memories/journal.py +0 -0
  86. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/memories/locations.py +0 -0
  87. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/memories/matching.py +0 -0
  88. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/memories/model.py +0 -0
  89. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/memories/parse.py +0 -0
  90. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/memories/records.py +0 -0
  91. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/memories/rules.py +0 -0
  92. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/memories/sightings.py +0 -0
  93. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/memories/terms.py +0 -0
  94. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/memories/write.py +0 -0
  95. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/notes/__init__.py +0 -0
  96. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/notes/check.py +0 -0
  97. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/notes/due.py +0 -0
  98. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/notes/fields.py +0 -0
  99. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/notes/index.py +0 -0
  100. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/notes/links.py +0 -0
  101. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/notes/note.py +0 -0
  102. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/notes/search.py +0 -0
  103. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/notes/split_candidates.py +0 -0
  104. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/research/__init__.py +0 -0
  105. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/research/checks.py +0 -0
  106. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/research/pipeline.py +0 -0
  107. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/session/__init__.py +0 -0
  108. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/session/handoff.py +0 -0
  109. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/session/notices.py +0 -0
  110. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/settle/__init__.py +0 -0
  111. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/settle/state.py +0 -0
  112. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/settle/verdicts.py +0 -0
  113. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/split/briefs/checker-brief.md +0 -0
  114. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/split/briefs/editor-brief.md +0 -0
  115. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/syntheses/__init__.py +0 -0
  116. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/syntheses/document.py +0 -0
  117. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/syntheses/edit.py +0 -0
  118. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/syntheses/project.py +0 -0
  119. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/syntheses/split_conservation.py +0 -0
  120. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/syntheses/units.py +0 -0
  121. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/synthesize/__init__.py +0 -0
  122. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/synthesize/backfill.py +0 -0
  123. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/synthesize/briefs/backfill-brief.md +0 -0
  124. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/synthesize/briefs/checker-brief.md +0 -0
  125. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/synthesize/briefs/fixer-brief.md +0 -0
  126. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/synthesize/briefs/memory-brief.md +0 -0
  127. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/synthesize/briefs/settle-brief.md +0 -0
  128. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/synthesize/briefs/verdict-brief.md +0 -0
  129. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/synthesize/briefs/web-brief.md +0 -0
  130. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/synthesize/cli.py +0 -0
  131. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/synthesize/pipeline.py +0 -0
  132. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/synthesize/references.py +0 -0
  133. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/synthesize/run.py +0 -0
  134. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/synthesize/topics.py +0 -0
  135. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/templates/knowledge.md +0 -0
  136. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/templates/literature.md +0 -0
  137. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/templates/research.md +0 -0
  138. {memory_cli-0.1.0 → memory_cli-0.2.0}/memory_cli/templates/synthesis.md +0 -0
  139. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/architecture/test_claude_fake.py +0 -0
  140. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/architecture/test_env_isolation.py +0 -0
  141. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/architecture/test_mem_line_ceiling.py +0 -0
  142. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/architecture/test_mem_patch_guard.py +0 -0
  143. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/architecture/test_module_loaders.py +0 -0
  144. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/architecture/test_tree_imports.py +0 -0
  145. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/auto/test_auto_curation.py +0 -0
  146. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/auto/test_auto_split_default.py +0 -0
  147. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/capture/capture_world.py +0 -0
  148. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/capture/conftest.py +0 -0
  149. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/capture/fixtures/codex-rollout.jsonl +0 -0
  150. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/capture/test_capture.py +0 -0
  151. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/capture/test_capture_auto.py +0 -0
  152. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/capture/test_capture_exclusion.py +0 -0
  153. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/capture/test_capture_state.py +0 -0
  154. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/capture/test_capture_sweep.py +0 -0
  155. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/capture/test_capture_sweep_codex.py +0 -0
  156. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/capture/test_codex_rollout.py +0 -0
  157. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/capture/test_mem_capture.py +0 -0
  158. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/commands_world.py +0 -0
  159. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/split_world.py +0 -0
  160. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_compact_log.py +0 -0
  161. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_confirm_owner.py +0 -0
  162. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_consolidation.py +0 -0
  163. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_curate_apply.py +0 -0
  164. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_curation.py +0 -0
  165. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_diagnostics.py +0 -0
  166. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_fetch_sources.py +0 -0
  167. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_find_new.py +0 -0
  168. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_import.py +0 -0
  169. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_import_recovery.py +0 -0
  170. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_init_store.py +0 -0
  171. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_memory_edit.py +0 -0
  172. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_memory_search.py +0 -0
  173. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_new_body.py +0 -0
  174. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_note_edit.py +0 -0
  175. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_note_marks.py +0 -0
  176. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_origin.py +0 -0
  177. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_paging.py +0 -0
  178. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_passages.py +0 -0
  179. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_project_synthesis_commands.py +0 -0
  180. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_projects.py +0 -0
  181. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_remember.py +0 -0
  182. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_rename.py +0 -0
  183. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_resolve.py +0 -0
  184. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_search_scope.py +0 -0
  185. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_search_stats.py +0 -0
  186. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_short_by.py +0 -0
  187. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_short_topic.py +0 -0
  188. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_show.py +0 -0
  189. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_split_auto.py +0 -0
  190. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_split_command.py +0 -0
  191. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_split_plan.py +0 -0
  192. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_split_transaction.py +0 -0
  193. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_store.py +0 -0
  194. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_store_precedence.py +0 -0
  195. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_synthesis_structure.py +0 -0
  196. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_terms.py +0 -0
  197. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_transcript_records.py +0 -0
  198. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/commands/test_usage_log.py +0 -0
  199. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/conftest.py +0 -0
  200. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/core/test_codex_refusals.py +0 -0
  201. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/core/test_config.py +0 -0
  202. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/core/test_file_journal.py +0 -0
  203. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/core/test_headless.py +0 -0
  204. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/core/test_headless_golden.py +0 -0
  205. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/core/test_jobs.py +0 -0
  206. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/core/test_jobs_golden.py +0 -0
  207. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/core/test_lock_contention.py +0 -0
  208. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/core/test_lock_contract.py +0 -0
  209. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/core/test_runner.py +0 -0
  210. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/core/test_safe_io.py +0 -0
  211. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/core/test_store_git.py +0 -0
  212. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/corroborate/conftest.py +0 -0
  213. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/corroborate/corroborate_world.py +0 -0
  214. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/corroborate/test_corroborate.py +0 -0
  215. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/corroborate/test_corroborate_cli.py +0 -0
  216. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/corroborate/test_corroborate_codex.py +0 -0
  217. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/corroborate/test_corroborate_digest.py +0 -0
  218. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/corroborate/test_corroborate_fill.py +0 -0
  219. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/corroborate/test_corroborate_reword.py +0 -0
  220. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/corroborate/test_corroborate_run.py +0 -0
  221. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/corroborate/test_fill_auto.py +0 -0
  222. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/corroborate/test_repo_memories.py +0 -0
  223. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/corroborate/test_reword.py +0 -0
  224. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/digest/test_digest.py +0 -0
  225. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/fixtures/valid/knowledge/README.md +0 -0
  226. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/fixtures/valid/knowledge/computing/README.md +0 -0
  227. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/fixtures/valid/knowledge/computing/attention-replaces-recurrence.md +0 -0
  228. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/fixtures/valid/literature/README.md +0 -0
  229. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/fixtures/valid/literature/computing/2017-vaswani-attention.md +0 -0
  230. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/fixtures/valid/literature/computing/README.md +0 -0
  231. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/fixtures/valid/research/2026-11-llm-eval-methods/README.md +0 -0
  232. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/fixtures/valid/research/2026-11-llm-eval-methods/notes/reading-list.md +0 -0
  233. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/fixtures/valid/research/README.md +0 -0
  234. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/fixtures/valid/topics.yaml +0 -0
  235. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/integrate/integrate_store.py +0 -0
  236. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/integrate/integrate_world.py +0 -0
  237. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/integrate/test_auto_process.py +0 -0
  238. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/integrate/test_integrate_command.py +0 -0
  239. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/integrate/test_plan.py +0 -0
  240. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/integrate/test_reconcile.py +0 -0
  241. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/integrate/test_rows.py +0 -0
  242. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/integrate/test_run.py +0 -0
  243. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/integrate/test_self_check.py +0 -0
  244. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/integrate/test_state.py +0 -0
  245. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/integrate/test_undo.py +0 -0
  246. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/mem/test_main_module.py +0 -0
  247. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/mem/test_mem_cli_golden.py +0 -0
  248. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/mem/test_session_index_golden.py +0 -0
  249. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/memories/memories_world.py +0 -0
  250. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/memories/test_case_log.py +0 -0
  251. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/memories/test_pairs.py +0 -0
  252. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/memories/test_records.py +0 -0
  253. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/memories/test_records_facade.py +0 -0
  254. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/memories/test_rules.py +0 -0
  255. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/memories/test_rules_session.py +0 -0
  256. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/memories/test_short_check.py +0 -0
  257. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/memories/test_sightings.py +0 -0
  258. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/notes/notes_world.py +0 -0
  259. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/notes/test_check.py +0 -0
  260. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/notes/test_core.py +0 -0
  261. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/notes/test_index_links.py +0 -0
  262. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/notes/test_related_mentions.py +0 -0
  263. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/notes/test_requirements.py +0 -0
  264. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/notes/test_search_links.py +0 -0
  265. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/notes/test_size_topic_and_retest_rules.py +0 -0
  266. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/notes/test_split_candidates.py +0 -0
  267. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/pytest.ini +0 -0
  268. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/research/test_research_checks.py +0 -0
  269. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/research/test_research_run.py +0 -0
  270. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/session/session_world.py +0 -0
  271. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/session/test_codex_host.py +0 -0
  272. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/session/test_handoff.py +0 -0
  273. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/session/test_session_index.py +0 -0
  274. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/session/test_session_index_due.py +0 -0
  275. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/session/test_signal.py +0 -0
  276. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/session/test_triage.py +0 -0
  277. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/settle/settle_world.py +0 -0
  278. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/settle/test_inprocess_mem.py +0 -0
  279. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/settle/test_quarantine.py +0 -0
  280. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/settle/test_settle.py +0 -0
  281. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/settle/test_settle_codex.py +0 -0
  282. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/settle/test_settle_run.py +0 -0
  283. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/settle/test_settle_start.py +0 -0
  284. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/support/capture.py +0 -0
  285. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/support/fakes/claude.py +0 -0
  286. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/support/fakes/codex.py +0 -0
  287. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/support/installed_jobs.py +0 -0
  288. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/support/isolation.py +0 -0
  289. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/support/launch.py +0 -0
  290. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/support/lessons.py +0 -0
  291. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/support/markers.py +0 -0
  292. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/support/paths.py +0 -0
  293. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/support/store.py +0 -0
  294. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/syntheses/test_append_text.py +0 -0
  295. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/syntheses/test_note_fingerprint.py +0 -0
  296. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/syntheses/test_project_syntheses.py +0 -0
  297. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/syntheses/test_project_synthesis_curation.py +0 -0
  298. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/syntheses/test_split_conservation.py +0 -0
  299. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/syntheses/test_syntheses.py +0 -0
  300. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/syntheses/test_synthesis_inline_references.py +0 -0
  301. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/syntheses/test_synthesis_notes.py +0 -0
  302. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/syntheses/test_synthesis_refs.py +0 -0
  303. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/synthesize/synthesize_world.py +0 -0
  304. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/synthesize/test_backfill.py +0 -0
  305. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/synthesize/test_mem_synthesize_self_check.py +0 -0
  306. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/synthesize/test_parse_spend.py +0 -0
  307. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/synthesize/test_synth_pipeline_refs.py +0 -0
  308. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/synthesize/test_synth_session.py +0 -0
  309. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/synthesize/test_synthesize_cli_golden.py +0 -0
  310. {memory_cli-0.1.0 → memory_cli-0.2.0}/tests/synthesize/test_synthesize_references.py +0 -0
@@ -0,0 +1,22 @@
1
+ # Changelog
2
+
3
+ Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [0.2.0] - 2026-11-30
8
+
9
+ Host contract for plugin adapters.
10
+
11
+ - `MEM_PLUGIN_ROOT`: a plugin adapter names its folder (it must hold `hooks/`) for an installed `mem`; without it, `mem` falls back to its source tree, then to the folder the session-start hook recorded in `<state dir>/plugin-root`.
12
+ - `mem protocol` prints one JSON line `{"version": ..., "protocols": [1]}`; it reads no store and writes nothing. Protocol revision 1 starts here: 0.1.0 has no such command, which is how an adapter rejects it.
13
+ - `MEM_REQUIRE_PROTOCOL=<N>`: every entry point (`mem`, the seven `mem-*`, `python -m memory_cli`) exits 78 with one stderr line when it does not speak revision N. Unset or empty: no check.
14
+ - Breaking: `mem install-command` no longer creates launchers and exits 2; install the CLI with `uv tool install memory-cli`. `--remove` still deletes launchers an older plugin wrote, keeps files it does not own with a note on stderr, and exits 0. Migration: `uvx --from memory-cli mem install-command --remove && uv tool install memory-cli`.
15
+
16
+ ## [0.1.0] - 2026-11-29
17
+
18
+ First release on PyPI: `uv tool install memory-cli`.
19
+
20
+ - Python 3.12 to 3.15 on Linux and macOS (CI tests 3.12, 3.14 and 3.15).
21
+ - Release workflow: build once, test that wheel on Linux and macOS, install rehearsal, PyPI Trusted Publishing on a `v*` tag.
22
+ - Initial import from Agent-Skills@675ce579 (`plugins/memory/engine`).
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: memory-cli
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: The memory engine: the `mem` command and its background entries
5
5
  Project-URL: Repository, https://github.com/Mili-ssm/memory-cli
6
6
  Author: Mili-ssm
@@ -52,8 +52,11 @@ this engine until it switches to this package.
52
52
  | A checkout | `uv tool install .` |
53
53
 
54
54
  If `uv tool install` refuses because `~/.local/bin/mem*` already exists, those files are launchers an older plugin wrote.
55
- Remove them with `mem install-command --remove` (from the plugin's `mem`), or delete the `~/.local/bin/mem*` files whose
56
- second line is `# agent-memory launcher (mem install-command)`, then install again.
55
+ Remove them (files with another second line are kept) and install again:
56
+
57
+ ```
58
+ uvx --from memory-cli mem install-command --remove && uv tool install memory-cli
59
+ ```
57
60
 
58
61
  ## Commands
59
62
 
@@ -70,6 +73,16 @@ second line is `# agent-memory launcher (mem install-command)`, then install aga
70
73
 
71
74
  `<command> --help` lists the options. The background commands run a headless `claude` or `codex` session (`--runner`).
72
75
 
76
+ ## Use from a host plugin
77
+
78
+ A plugin adapter starts the installed CLI and can pin what it needs:
79
+
80
+ | Variable or command | Meaning |
81
+ |---|---|
82
+ | `mem protocol` | one JSON line `{"version": "0.2.0", "protocols": [1]}`; no store access, no writes; 0.1.0 lacks it |
83
+ | `MEM_REQUIRE_PROTOCOL=N` | every entry point exits 78 with one stderr line unless it speaks revision N; unset or empty skips the check |
84
+ | `MEM_PLUGIN_ROOT=DIR` | the plugin folder (must hold `hooks/`) for the synthesize skill, diagnostics and hooks; else the source tree, else the folder in `<state dir>/plugin-root` |
85
+
73
86
  ## Development
74
87
 
75
88
  ```sh
@@ -28,8 +28,11 @@ this engine until it switches to this package.
28
28
  | A checkout | `uv tool install .` |
29
29
 
30
30
  If `uv tool install` refuses because `~/.local/bin/mem*` already exists, those files are launchers an older plugin wrote.
31
- Remove them with `mem install-command --remove` (from the plugin's `mem`), or delete the `~/.local/bin/mem*` files whose
32
- second line is `# agent-memory launcher (mem install-command)`, then install again.
31
+ Remove them (files with another second line are kept) and install again:
32
+
33
+ ```
34
+ uvx --from memory-cli mem install-command --remove && uv tool install memory-cli
35
+ ```
33
36
 
34
37
  ## Commands
35
38
 
@@ -46,6 +49,16 @@ second line is `# agent-memory launcher (mem install-command)`, then install aga
46
49
 
47
50
  `<command> --help` lists the options. The background commands run a headless `claude` or `codex` session (`--runner`).
48
51
 
52
+ ## Use from a host plugin
53
+
54
+ A plugin adapter starts the installed CLI and can pin what it needs:
55
+
56
+ | Variable or command | Meaning |
57
+ |---|---|
58
+ | `mem protocol` | one JSON line `{"version": "0.2.0", "protocols": [1]}`; no store access, no writes; 0.1.0 lacks it |
59
+ | `MEM_REQUIRE_PROTOCOL=N` | every entry point exits 78 with one stderr line unless it speaks revision N; unset or empty skips the check |
60
+ | `MEM_PLUGIN_ROOT=DIR` | the plugin folder (must hold `hooks/`) for the synthesize skill, diagnostics and hooks; else the source tree, else the folder in `<state dir>/plugin-root` |
61
+
49
62
  ## Development
50
63
 
51
64
  ```sh
@@ -11,8 +11,8 @@ Modules:
11
11
  `memory`: `remember`, `confirm` (and `observe`), `refute`, `forget`, `triage`, `supersede`, `merge`, `distinct`, `restore`, `promote`, `memories`, `rules`, `memory` (edit) and `settle`
12
12
  `curate`: `curate`, and the session-start curation decisions (passes, marks, pair and note queues)
13
13
  `hooks`: `session-index`, `compact-log` and `signal`, with the session start text and the logic only they use
14
- `diagnostics`: read-only report of local plugin, store, roles and hooks
15
- `install`: `install-command`, which puts a `mem` launcher on PATH, and the plugin-root record the launcher follows
14
+ `diagnostics`: `diagnostics` (read-only report of local plugin, store, roles and hooks) and `protocol` (version and protocol revisions a host plugin probes)
15
+ `install`: `install-command --remove` (removes the launchers an older plugin wrote) and the plugin-root record they followed
16
16
  `synthesis`: `synthesis` (list, new, add, append, edit, attach, rename, remove, detach, topics, refs) and `project-synthesis`, with the logic only they use
17
17
  `split`: CLI for split proposals, preview, apply, status, recovery and undo
18
18
  `split_plan`: read-only synthesis split proposals and previews
@@ -1,4 +1,5 @@
1
- """Read-only report of local memory configuration and observed hook delivery."""
1
+ """Read-only reports: local memory configuration and observed hook delivery (`diagnostics`), and the version and
2
+ protocol revisions a host plugin probes (`protocol`, no store access)."""
2
3
 
3
4
  from __future__ import annotations
4
5
 
@@ -8,10 +9,13 @@ import shutil
8
9
  from collections import deque
9
10
  from datetime import datetime
10
11
  from pathlib import Path
11
- from typing import Any
12
+ from typing import TYPE_CHECKING, Any
12
13
 
13
14
  from memory_cli.commands import common
14
- from memory_cli.core import config, resources, runner
15
+ from memory_cli.core import config, protocol, resources, runner
16
+
17
+ if TYPE_CHECKING:
18
+ import argparse
15
19
 
16
20
  PLUGIN = resources.plugin_root() # None when the engine runs outside the plugin
17
21
  ROLES = (
@@ -114,7 +118,17 @@ def cmd_diagnostics(args: Any) -> int:
114
118
  return 0
115
119
 
116
120
 
121
+ def cmd_protocol(_args: argparse.Namespace) -> int:
122
+ print(
123
+ json.dumps({"version": protocol.package_version(), "protocols": list(protocol.PROTOCOLS)})
124
+ )
125
+ return 0
126
+
127
+
117
128
  def add_parser(sub: Any) -> None:
129
+ sub.add_parser(
130
+ "protocol", help="print the memory-cli version and the protocols it speaks as JSON"
131
+ ).set_defaults(func=cmd_protocol)
118
132
  parser = sub.add_parser(
119
133
  "diagnostics", help="report local host configuration and observed hook delivery"
120
134
  )
@@ -537,8 +537,7 @@ def cmd_session_index(args: argparse.Namespace) -> int:
537
537
  if _host() == "codex" and install.launcher_missing():
538
538
  mem = shlex.quote(resources.shell_mem())
539
539
  text += f"\nmemory: mem is not installed as a command; run it as {mem}"
540
- if resources.plugin_root() is not None: # only a plugin copy can install its launchers
541
- text += f", or install it once: {mem} install-command"
540
+ text += ", or install the CLI once: uv tool install memory-cli"
542
541
  print(text)
543
542
  if args.hook:
544
543
  source = data.get("source")
@@ -0,0 +1,110 @@
1
+ """`mem install-command --remove` and the plugin-root record (ADR 0036).
2
+
3
+ `install-command` no longer creates launchers: the CLI is installed with `uv tool install memory-cli`. `--remove` still
4
+ deletes the launchers an older plugin wrote (only files that carry `MARKER`). `record_root` keeps the plugin-root
5
+ record the old launchers followed, until a plugin adapter stops refreshing it."""
6
+
7
+ from __future__ import annotations
8
+
9
+ import contextlib
10
+ import shutil
11
+ import sys
12
+ from pathlib import Path
13
+ from typing import TYPE_CHECKING, Any
14
+
15
+ from memory_cli.core import jobs, resources, safe_io
16
+
17
+ if TYPE_CHECKING:
18
+ import argparse
19
+
20
+ MARKER = "# agent-memory launcher (mem install-command)"
21
+ RECORD_NAME = resources.PLUGIN_RECORD
22
+ # The launchers an older plugin wrote.
23
+ LAUNCHERS = ("mem", "mem-research", "mem-synthesize")
24
+
25
+
26
+ def default_bin_dir() -> Path:
27
+ return Path.home() / ".local" / "bin"
28
+
29
+
30
+ def launcher_missing() -> bool:
31
+ """True when no `mem` resolves on PATH (the rule of hooks/subagent-start.sh: `command -v mem`)."""
32
+ return shutil.which("mem") is None
33
+
34
+
35
+ def _write_record() -> None:
36
+ root = resources.plugin_root()
37
+ if root is None: # standalone: no plugin copy for a launcher to follow
38
+ return
39
+ state = jobs.state_dir()
40
+ target = state / RECORD_NAME
41
+ data = str(root).encode()
42
+ safe_io.refuse_symlink_chain(state, target) # raises UnsafePathError: record_root suppresses it
43
+ with contextlib.suppress(OSError):
44
+ if target.read_bytes() == data:
45
+ return
46
+ jobs.private_dir(target.parent)
47
+ safe_io.replace_file(target, data, 0o600)
48
+
49
+
50
+ def record_root() -> None:
51
+ """Record this copy's root for the launcher; writes only when it differs, never raises or prints."""
52
+ with contextlib.suppress(OSError, RuntimeError): # a failing hook disturbs every session
53
+ _write_record()
54
+
55
+
56
+ def _is_ours(path: Path) -> bool:
57
+ try:
58
+ if path.is_symlink():
59
+ return False
60
+ lines = path.read_text(encoding="utf-8").splitlines()
61
+ except (OSError, UnicodeDecodeError):
62
+ return False
63
+ return len(lines) > 1 and lines[1] == MARKER
64
+
65
+
66
+ def _remove_one(bin_dir: Path, name: str) -> bool:
67
+ """Delete the launcher `name` when it is ours; a file that is not ours stays, with a note on stderr.
68
+ False when the removal failed."""
69
+ target = bin_dir / name
70
+ exists = target.exists() or target.is_symlink()
71
+ if exists and not _is_ours(target):
72
+ print(
73
+ f"mem: {target} exists and is not an agent-memory launcher; left untouched",
74
+ file=sys.stderr,
75
+ )
76
+ return True
77
+ try:
78
+ if exists:
79
+ target.unlink()
80
+ except OSError as exc:
81
+ print(f"mem: could not remove {target}: {exc.strerror or exc}", file=sys.stderr)
82
+ return False
83
+ print(f"removed {target}" if exists else f"nothing to remove at {target}")
84
+ return True
85
+
86
+
87
+ def cmd_install_command(args: argparse.Namespace) -> int:
88
+ if not args.remove:
89
+ print(
90
+ "mem: install-command no longer creates launchers; install the CLI with: uv tool install memory-cli",
91
+ file=sys.stderr,
92
+ )
93
+ return 2
94
+ bin_dir = Path(args.bin_dir).expanduser() if args.bin_dir else default_bin_dir()
95
+ results = [_remove_one(bin_dir, name) for name in LAUNCHERS] # every launcher is tried
96
+ return 0 if all(results) else 1
97
+
98
+
99
+ def add_parser(sub: Any) -> None:
100
+ cmd = sub.add_parser(
101
+ "install-command",
102
+ help="no longer installs launchers (use `uv tool install memory-cli`); with --remove, delete the ones an older plugin wrote",
103
+ )
104
+ cmd.add_argument(
105
+ "--remove", action="store_true", help="delete the launchers an older plugin wrote"
106
+ )
107
+ cmd.add_argument(
108
+ "--bin-dir", metavar="DIR", help="where the launchers are (default: ~/.local/bin)"
109
+ )
110
+ cmd.set_defaults(func=cmd_install_command)
@@ -3,6 +3,7 @@
3
3
  `auto_state`: `mem-auto` state, run lock, failure line
4
4
  `config`: store resolution for every entry point
5
5
  `headless`: spec and runner of `claude -p` sessions
6
+ `protocol`: the protocol revisions a host plugin may require (`MEM_REQUIRE_PROTOCOL`) and the check that refuses an unsupported one
6
7
  `resources`: package data, the plugin folder when there is one, and the command that starts a child entry point
7
8
  `runner`: the `claude` or `codex` runner of a pass: resolution, Codex argv and environment, one `Outcome`
8
9
  `codex_pass`: one Codex session of a pass in the shape the builders read, the token cap, the refusal text
@@ -0,0 +1,54 @@
1
+ """The host contract a plugin adapter relies on: which command-surface revisions this `mem` speaks.
2
+
3
+ Revision 1 is introduced with memory-cli 0.2.0 (0.1.0 has no `mem protocol`, which is how an adapter rejects it). A plugin sets `MEM_REQUIRE_PROTOCOL=<N>` before it starts any
4
+ entry point; an entry that does not speak N refuses with exit 78 (EX_CONFIG) instead of failing in the middle of a command.
5
+ """
6
+
7
+ import os
8
+ import sys
9
+
10
+ PROTOCOLS = (1,)
11
+ REQUIRE_ENV = "MEM_REQUIRE_PROTOCOL"
12
+ EXIT_UNSUPPORTED = 78
13
+ _DIST = "memory-cli"
14
+
15
+
16
+ def package_version() -> str:
17
+ """The installed `memory-cli` version, `unknown` when the package metadata is absent.
18
+
19
+ Imported here, not at the top: every entry point loads this module, and the valid path never needs the version."""
20
+ from importlib.metadata import PackageNotFoundError, version # ruff: ignore[import-outside-top-level]
21
+
22
+ try:
23
+ return version(_DIST)
24
+ except PackageNotFoundError:
25
+ return "unknown"
26
+
27
+
28
+ def _wanted(raw: str) -> int | None:
29
+ try:
30
+ return int(raw)
31
+ except ValueError:
32
+ return None
33
+
34
+
35
+ def require() -> None:
36
+ """Exit 78 with one stderr line when `MEM_REQUIRE_PROTOCOL` names a revision this `mem` does not speak."""
37
+ raw = os.environ.get(REQUIRE_ENV, "")
38
+ if not raw:
39
+ return
40
+ wanted = _wanted(raw)
41
+ if wanted in PROTOCOLS:
42
+ return
43
+ fix = (
44
+ "update the plugin or install an older memory-cli"
45
+ if wanted is not None and wanted < min(PROTOCOLS)
46
+ else "run: uv tool install --upgrade memory-cli"
47
+ )
48
+ listed = ", ".join(map(str, PROTOCOLS))
49
+ print(
50
+ f"memory: this mem (memory-cli {package_version()}) supports protocol {listed}, "
51
+ f"the plugin needs {raw}; {fix}",
52
+ file=sys.stderr,
53
+ )
54
+ sys.exit(EXIT_UNSUPPORTED)
@@ -3,8 +3,8 @@
3
3
  Three kinds of lookup, so a caller names its need and never counts `parents[N]`:
4
4
 
5
5
  - package data (`TEMPLATES`, the `*_BRIEFS` folders) ships inside the wheel and is always there;
6
- - the plugin folder (`plugin_root`) exists only while the engine runs from the plugin's source tree (`engine/..`
7
- holding `hooks/`); an installed `memory-cli` has none;
6
+ - the plugin folder (`plugin_root`): `MEM_PLUGIN_ROOT`, else the plugin's source tree (`engine/..`), else the folder the
7
+ state record names, each only when it holds `hooks/`; an installed `memory-cli` that no plugin ever ran has none;
8
8
  - a child entry point (`mem_command`, `child_env`) always starts from the running installation: its interpreter and
9
9
  `-m memory_cli`, never a `mem` found on `PATH`, which may be an older copy.
10
10
  """
@@ -15,18 +15,42 @@ import sys
15
15
  from collections.abc import Mapping
16
16
  from pathlib import Path
17
17
 
18
+ from memory_cli.core import jobs
19
+
18
20
  PACKAGE_DIR = Path(__file__).resolve().parents[1]
19
21
  TEMPLATES = PACKAGE_DIR / "templates"
20
22
  MEM_PY = PACKAGE_DIR / "mem.py" # `mem stats` counts this file by name
21
23
  INTEGRATE_BRIEFS = PACKAGE_DIR / "integrate" / "briefs"
22
24
  SPLIT_BRIEFS = PACKAGE_DIR / "split" / "briefs"
23
25
  SYNTHESIZE_BRIEFS = PACKAGE_DIR / "synthesize" / "briefs"
26
+ PLUGIN_RECORD = "plugin-root" # file in the state dir; `mem session-index --hook` writes it
27
+
28
+
29
+ def _holds_hooks(root: Path) -> bool:
30
+ return (root / "hooks").is_dir()
31
+
32
+
33
+ def _recorded_root() -> Path | None:
34
+ """The folder `<state dir>/plugin-root` names (the session-start hook refreshes it), when it exists."""
35
+ try:
36
+ line = (jobs.state_dir() / PLUGIN_RECORD).read_text(encoding="utf-8").splitlines()[0]
37
+ except (OSError, UnicodeDecodeError, IndexError):
38
+ return None
39
+ return Path(line) if line else None
24
40
 
25
41
 
26
42
  def plugin_root() -> Path | None:
27
- """The plugin folder this source tree sits in (`engine/..` when it holds `hooks/`), else None."""
28
- root = PACKAGE_DIR.parent.parent
29
- return root if (root / "hooks").is_dir() else None
43
+ """The plugin folder, first that holds `hooks/`: `MEM_PLUGIN_ROOT` (a plugin adapter starting an installed CLI),
44
+ the source tree's own (`engine/..`), the folder the state record names (a bare installed `mem` run by an agent),
45
+ else None."""
46
+ for candidate in (
47
+ Path(given) if (given := os.environ.get("MEM_PLUGIN_ROOT")) else None,
48
+ PACKAGE_DIR.parent.parent,
49
+ _recorded_root(),
50
+ ):
51
+ if candidate is not None and _holds_hooks(candidate):
52
+ return candidate
53
+ return None
30
54
 
31
55
 
32
56
  def mem_command(entry: str | None = None) -> list[str]:
@@ -44,7 +44,7 @@ if TYPE_CHECKING:
44
44
  from collections.abc import Callable
45
45
 
46
46
  from memory_cli.core import auto_state as au
47
- from memory_cli.core import codex_pass, jobs, resources
47
+ from memory_cli.core import codex_pass, jobs, protocol, resources
48
48
  from memory_cli.core import runner as runners
49
49
  from memory_cli.entry import integrate, split_auto
50
50
  from memory_cli.synthesize import pipeline as sp
@@ -621,6 +621,7 @@ def _dispatch(args: argparse.Namespace, store: Path) -> int:
621
621
 
622
622
 
623
623
  def main(argv: list[str] | None = None) -> int:
624
+ protocol.require()
624
625
  parser = argparse.ArgumentParser(
625
626
  prog="mem-auto", description=(__doc__ or "mem-auto").splitlines()[0]
626
627
  )
@@ -39,7 +39,7 @@ from typing import Any
39
39
  from memory_cli.capture import codex_rollout
40
40
  from memory_cli.capture import extract as capture
41
41
  from memory_cli.capture import state as cs
42
- from memory_cli.core import codex_pass, headless, jobs, resources
42
+ from memory_cli.core import codex_pass, headless, jobs, protocol, resources
43
43
  from memory_cli.core import runner as runners
44
44
  from memory_cli.memories import records
45
45
  from memory_cli.synthesize import pipeline as sp
@@ -1317,6 +1317,7 @@ def cmd_exclude(args: argparse.Namespace) -> int:
1317
1317
 
1318
1318
 
1319
1319
  def main(argv: list[str] | None = None) -> int:
1320
+ protocol.require()
1320
1321
  parser = argparse.ArgumentParser(
1321
1322
  prog="mem-capture", description=(__doc__ or "").splitlines()[0]
1322
1323
  )
@@ -36,6 +36,7 @@ import sys
36
36
  import time
37
37
 
38
38
  from memory_cli.capture import state as cs
39
+ from memory_cli.core import protocol
39
40
  from memory_cli.core import runner as runners
40
41
  from memory_cli.corroborate import state as corroborate_state
41
42
 
@@ -87,7 +88,8 @@ def _command(name: str, without_engine=_no_engine):
87
88
  return without_engine if corroborate_cli is None else getattr(corroborate_cli, name)
88
89
 
89
90
 
90
- def main(argv: list[str] | None = None) -> int:
91
+ def main(argv: list[str] | None = None) -> int: # ruff: ignore[too-many-statements] # one parser, built in place
92
+ protocol.require()
91
93
  parser = argparse.ArgumentParser(
92
94
  prog="mem-corroborate", description=(__doc__ or "").splitlines()[0]
93
95
  )
@@ -33,7 +33,7 @@ from dataclasses import dataclass, field
33
33
  from pathlib import Path
34
34
  from typing import TYPE_CHECKING, Any
35
35
 
36
- from memory_cli.core import auto_state, codex_pass, headless, jobs, resources, runner
36
+ from memory_cli.core import auto_state, codex_pass, headless, jobs, protocol, resources, runner
37
37
  from memory_cli.core.file_journal import FileJournal
38
38
  from memory_cli.entry import integrate_self_check
39
39
  from memory_cli.integrate import answers, plan
@@ -665,6 +665,7 @@ def _dispatch(args: argparse.Namespace, store: Path) -> int:
665
665
 
666
666
 
667
667
  def main(argv: list[str] | None = None) -> int:
668
+ protocol.require()
668
669
  parser = _parser()
669
670
  args = parser.parse_args(argv)
670
671
  if args.self_check:
@@ -2,8 +2,10 @@
2
2
 
3
3
  import sys
4
4
 
5
+ from memory_cli.core import protocol
5
6
  from memory_cli.research import pipeline
6
7
 
7
8
 
8
9
  def main(argv: list[str] | None = None) -> int:
10
+ protocol.require()
9
11
  return pipeline.main(sys.argv[1:] if argv is None else argv)
@@ -29,7 +29,7 @@ from dataclasses import dataclass, field
29
29
  from pathlib import Path
30
30
 
31
31
  logger = logging.getLogger(__name__)
32
- from memory_cli.core import codex_pass, headless, jobs, resources
32
+ from memory_cli.core import codex_pass, headless, jobs, protocol, resources
33
33
  from memory_cli.core import runner as runners
34
34
  from memory_cli.settle import state as ss
35
35
  from memory_cli.synthesize import pipeline as sp
@@ -599,6 +599,7 @@ def _run(store: Path, args: argparse.Namespace) -> int:
599
599
 
600
600
 
601
601
  def main(argv: list[str] | None = None) -> int:
602
+ protocol.require()
602
603
  parser = _parser()
603
604
  args = parser.parse_args(argv)
604
605
  if args.self_check:
@@ -15,8 +15,10 @@ Usage: mem-synthesize [--topic T]... [--budget USD (3)] [--no-references] [--dry
15
15
  mem-synthesize --backfill [s:<handle> ...] [--budget USD] [--dry-run] [--store PATH] [--claude PATH]
16
16
  """
17
17
 
18
+ from memory_cli.core import protocol
18
19
  from memory_cli.synthesize import cli
19
20
 
20
21
 
21
22
  def main(argv: list[str] | None = None) -> int:
23
+ protocol.require()
22
24
  return cli.main(__doc__ or "", argv)
@@ -27,7 +27,7 @@ from memory_cli.commands import (
27
27
  )
28
28
  from memory_cli.commands.diagnostics import add_parser as _parser_add_diagnostics
29
29
  from memory_cli.commands.install import add_parser as _parser_add_install
30
- from memory_cli.core import config, safe_io
30
+ from memory_cli.core import config, protocol, safe_io
31
31
  from memory_cli.memories import records, rules
32
32
  from memory_cli.notes import due as due_queries
33
33
  from memory_cli.notes.fields import (
@@ -79,7 +79,6 @@ _NO_STORE_NEEDED = (
79
79
  "signal",
80
80
  "projects",
81
81
  "project-synthesis",
82
- "install-command",
83
82
  )
84
83
 
85
84
 
@@ -1090,6 +1089,7 @@ def build_parser() -> argparse.ArgumentParser:
1090
1089
 
1091
1090
 
1092
1091
  def main(argv: list[str] | None = None) -> int:
1092
+ protocol.require()
1093
1093
  try:
1094
1094
  return _dispatch(argv)
1095
1095
  except safe_io.UnsafePath as exc: # a symlink where a command refuses one
@@ -1139,7 +1139,7 @@ def _store_refusal(args: argparse.Namespace, root: Path | None) -> str | None:
1139
1139
 
1140
1140
  def _dispatch_store(args: argparse.Namespace) -> int | None:
1141
1141
  """Resolve the store into `args.root`; the exit code of a refusal, or None to run the command."""
1142
- if args.command in {"init", "diagnostics", "terms", "history"}:
1142
+ if args.command in {"init", "diagnostics", "terms", "history", "protocol", "install-command"}:
1143
1143
  return None
1144
1144
  if (
1145
1145
  args.command in _NO_STORE_NEEDED
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "memory-cli"
7
- version = "0.1.0"
7
+ version = "0.2.0"
8
8
  description = "The memory engine: the `mem` command and its background entries"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -163,16 +163,26 @@ def test_engine_modules_import_no_cycle():
163
163
  assert not cycles, "import cycles among engine modules:\n" + "\n".join(cycles)
164
164
 
165
165
 
166
- def _dynamic_import(node: ast.AST) -> str | None:
166
+ LAZY_METADATA_MODULE = "core.protocol" # the one module allowed to read `importlib.metadata`
167
+
168
+
169
+ def _dynamic_import(node: ast.AST, module: str = "") -> str | None:
167
170
  """Text of an `importlib` import or of a call named `import_module` or `__import__`, any argument.
168
171
 
169
- Banning `importlib` itself also catches an aliased `import_module`.
172
+ Banning `importlib` itself also catches an aliased `import_module`. `importlib.metadata` only reads installed
173
+ package data, and only `LAZY_METADATA_MODULE` (it takes the version from it) may import it.
170
174
  """
171
175
  if isinstance(node, ast.Import) and any(
172
- a.name.split(".")[0] == "importlib" for a in node.names
176
+ a.name.split(".")[0] == "importlib"
177
+ and not (a.name == "importlib.metadata" and module == LAZY_METADATA_MODULE)
178
+ for a in node.names
173
179
  ):
174
180
  return "import importlib"
175
- if isinstance(node, ast.ImportFrom) and (node.module or "").split(".")[0] == "importlib":
181
+ if (
182
+ isinstance(node, ast.ImportFrom)
183
+ and (node.module or "").split(".")[0] == "importlib"
184
+ and not (node.module == "importlib.metadata" and module == LAZY_METADATA_MODULE)
185
+ ):
176
186
  return f"from {node.module} import ..."
177
187
  if not isinstance(node, ast.Call):
178
188
  return None
@@ -187,7 +197,7 @@ def test_engine_modules_use_no_dynamic_import():
187
197
  f"{name}.py:{getattr(node, 'lineno', 0)} {call}"
188
198
  for name, tree in _trees().items()
189
199
  for node in ast.walk(tree)
190
- if (call := _dynamic_import(node))
200
+ if (call := _dynamic_import(node, name))
191
201
  ]
192
202
  assert not dynamic, "dynamic imports in engine modules:\n" + "\n".join(dynamic)
193
203
 
@@ -364,3 +374,12 @@ def test_package_docstring_maps_every_module():
364
374
  f"{init.parent.name}: entry for missing {name}" for name in sorted(listed - files)
365
375
  ]
366
376
  assert not problems, problems
377
+
378
+
379
+ @pytest.mark.parametrize(
380
+ "source", ["import importlib.metadata", "from importlib.metadata import version"]
381
+ )
382
+ def test_importlib_metadata_is_allowed_only_in_its_one_module(source):
383
+ node = ast.parse(source).body[0]
384
+ assert _dynamic_import(node, LAZY_METADATA_MODULE) is None
385
+ assert _dynamic_import(node, "core.jobs")