shellbrain 0.1.0__tar.gz → 0.1.2__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 (184) hide show
  1. shellbrain-0.1.2/PKG-INFO +78 -0
  2. shellbrain-0.1.2/README.md +64 -0
  3. shellbrain-0.1.2/app/onboarding_assets/__init__.py +2 -0
  4. shellbrain-0.1.2/app/onboarding_assets/claude/skills/shellbrain-session-start/SKILL.md +520 -0
  5. shellbrain-0.1.2/app/onboarding_assets/codex/shellbrain-session-start/SKILL.md +128 -0
  6. shellbrain-0.1.2/app/onboarding_assets/codex/shellbrain-session-start/agents/openai.yaml +6 -0
  7. shellbrain-0.1.2/app/onboarding_assets/codex/shellbrain-session-start/assets/shellbrain-large.svg +18 -0
  8. shellbrain-0.1.2/app/onboarding_assets/codex/shellbrain-session-start/assets/shellbrain-small.svg +11 -0
  9. shellbrain-0.1.2/app/onboarding_assets/codex/shellbrain-session-start/references/request-shapes.md +180 -0
  10. shellbrain-0.1.2/app/onboarding_assets/codex/shellbrain-session-start/references/session-workflow.md +232 -0
  11. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/admin/backup.py +4 -1
  12. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/admin/doctor.py +9 -3
  13. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/admin/init.py +36 -58
  14. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/admin/repo_state.py +87 -1
  15. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/cli/hydration.py +24 -9
  16. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/cli/main.py +93 -22
  17. shellbrain-0.1.2/app/periphery/identity/claude_hook_install.py +176 -0
  18. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/identity/claude_runtime.py +11 -0
  19. shellbrain-0.1.2/app/periphery/onboarding/__init__.py +2 -0
  20. shellbrain-0.1.2/app/periphery/onboarding/host_assets.py +204 -0
  21. {shellbrain-0.1.0 → shellbrain-0.1.2}/pyproject.toml +4 -1
  22. shellbrain-0.1.2/shellbrain.egg-info/PKG-INFO +78 -0
  23. {shellbrain-0.1.0 → shellbrain-0.1.2}/shellbrain.egg-info/SOURCES.txt +10 -0
  24. shellbrain-0.1.0/PKG-INFO +0 -130
  25. shellbrain-0.1.0/README.md +0 -116
  26. shellbrain-0.1.0/app/periphery/identity/claude_hook_install.py +0 -67
  27. shellbrain-0.1.0/shellbrain.egg-info/PKG-INFO +0 -130
  28. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/__init__.py +0 -0
  29. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/__main__.py +0 -0
  30. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/boot/__init__.py +0 -0
  31. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/boot/admin_db.py +0 -0
  32. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/boot/config.py +0 -0
  33. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/boot/create_policy.py +0 -0
  34. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/boot/db.py +0 -0
  35. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/boot/embeddings.py +0 -0
  36. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/boot/home.py +0 -0
  37. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/boot/migrations.py +0 -0
  38. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/boot/read_policy.py +0 -0
  39. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/boot/repos.py +0 -0
  40. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/boot/retrieval.py +0 -0
  41. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/boot/thresholds.py +0 -0
  42. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/boot/update_policy.py +0 -0
  43. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/boot/use_cases.py +0 -0
  44. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/config/__init__.py +0 -0
  45. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/config/defaults/create_policy.yaml +0 -0
  46. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/config/defaults/read_policy.yaml +0 -0
  47. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/config/defaults/runtime.yaml +0 -0
  48. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/config/defaults/thresholds.yaml +0 -0
  49. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/config/defaults/update_policy.yaml +0 -0
  50. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/config/loader.py +0 -0
  51. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/__init__.py +0 -0
  52. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/contracts/__init__.py +0 -0
  53. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/contracts/errors.py +0 -0
  54. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/contracts/requests.py +0 -0
  55. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/contracts/responses.py +0 -0
  56. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/entities/__init__.py +0 -0
  57. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/entities/associations.py +0 -0
  58. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/entities/episodes.py +0 -0
  59. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/entities/evidence.py +0 -0
  60. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/entities/facts.py +0 -0
  61. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/entities/guidance.py +0 -0
  62. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/entities/identity.py +0 -0
  63. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/entities/memory.py +0 -0
  64. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/entities/runtime_context.py +0 -0
  65. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/entities/session_state.py +0 -0
  66. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/entities/telemetry.py +0 -0
  67. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/entities/utility.py +0 -0
  68. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/interfaces/__init__.py +0 -0
  69. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/interfaces/clock.py +0 -0
  70. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/interfaces/config.py +0 -0
  71. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/interfaces/embeddings.py +0 -0
  72. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/interfaces/idgen.py +0 -0
  73. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/interfaces/repos.py +0 -0
  74. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/interfaces/retrieval.py +0 -0
  75. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/interfaces/session_state_store.py +0 -0
  76. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/interfaces/unit_of_work.py +0 -0
  77. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/policies/__init__.py +0 -0
  78. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/policies/_shared/__init__.py +0 -0
  79. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/policies/_shared/executor.py +0 -0
  80. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/policies/_shared/side_effects.py +0 -0
  81. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/policies/create_policy/__init__.py +0 -0
  82. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/policies/create_policy/pipeline.py +0 -0
  83. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/policies/read_policy/__init__.py +0 -0
  84. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/policies/read_policy/bm25.py +0 -0
  85. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/policies/read_policy/context_pack_builder.py +0 -0
  86. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/policies/read_policy/expansion.py +0 -0
  87. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/policies/read_policy/fusion_rrf.py +0 -0
  88. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/policies/read_policy/lexical_query.py +0 -0
  89. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/policies/read_policy/pipeline.py +0 -0
  90. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/policies/read_policy/scenario_lift.py +0 -0
  91. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/policies/read_policy/scoring.py +0 -0
  92. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/policies/read_policy/seed_retrieval.py +0 -0
  93. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/policies/read_policy/utility_prior.py +0 -0
  94. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/policies/update_policy/__init__.py +0 -0
  95. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/policies/update_policy/pipeline.py +0 -0
  96. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/use_cases/__init__.py +0 -0
  97. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/use_cases/build_guidance.py +0 -0
  98. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/use_cases/create_memory.py +0 -0
  99. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/use_cases/manage_session_state.py +0 -0
  100. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/use_cases/read_memory.py +0 -0
  101. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/use_cases/record_episode_sync_telemetry.py +0 -0
  102. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/use_cases/record_operation_telemetry.py +0 -0
  103. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/use_cases/sync_episode.py +0 -0
  104. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/core/use_cases/update_memory.py +0 -0
  105. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/migrations/__init__.py +0 -0
  106. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/migrations/env.py +0 -0
  107. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/migrations/versions/20260226_0001_initial_schema.py +0 -0
  108. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/migrations/versions/20260312_0002_add_hard_invariants.py +0 -0
  109. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/migrations/versions/20260312_0003_drop_create_confidence.py +0 -0
  110. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/migrations/versions/20260313_0004_episode_sync_hardening.py +0 -0
  111. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/migrations/versions/20260313_0005_evidence_episode_event_refs.py +0 -0
  112. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/migrations/versions/20260318_0006_usage_telemetry_schema.py +0 -0
  113. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/migrations/versions/20260319_0007_identity_session_guidance.py +0 -0
  114. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/migrations/versions/20260320_0008_instance_metadata_and_backup_safety.py +0 -0
  115. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/migrations/versions/__init__.py +0 -0
  116. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/__init__.py +0 -0
  117. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/admin/__init__.py +0 -0
  118. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/admin/destructive_guard.py +0 -0
  119. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/admin/instance_guard.py +0 -0
  120. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/admin/machine_state.py +0 -0
  121. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/admin/privileges.py +0 -0
  122. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/admin/restore.py +0 -0
  123. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/cli/__init__.py +0 -0
  124. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/cli/handlers.py +0 -0
  125. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/cli/presenter_json.py +0 -0
  126. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/cli/schema_validation.py +0 -0
  127. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/__init__.py +0 -0
  128. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/engine.py +0 -0
  129. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/models/__init__.py +0 -0
  130. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/models/associations.py +0 -0
  131. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/models/episodes.py +0 -0
  132. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/models/evidence.py +0 -0
  133. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/models/experiences.py +0 -0
  134. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/models/instance_metadata.py +0 -0
  135. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/models/memories.py +0 -0
  136. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/models/metadata.py +0 -0
  137. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/models/registry.py +0 -0
  138. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/models/telemetry.py +0 -0
  139. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/models/utility.py +0 -0
  140. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/models/views.py +0 -0
  141. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/repos/__init__.py +0 -0
  142. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/repos/relational/__init__.py +0 -0
  143. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/repos/relational/associations_repo.py +0 -0
  144. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/repos/relational/episodes_repo.py +0 -0
  145. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/repos/relational/evidence_repo.py +0 -0
  146. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/repos/relational/experiences_repo.py +0 -0
  147. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/repos/relational/memories_repo.py +0 -0
  148. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/repos/relational/read_policy_repo.py +0 -0
  149. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/repos/relational/telemetry_repo.py +0 -0
  150. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/repos/relational/utility_repo.py +0 -0
  151. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/repos/semantic/__init__.py +0 -0
  152. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/repos/semantic/keyword_retrieval_repo.py +0 -0
  153. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/repos/semantic/semantic_retrieval_repo.py +0 -0
  154. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/session.py +0 -0
  155. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/db/uow.py +0 -0
  156. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/embeddings/__init__.py +0 -0
  157. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/embeddings/local_provider.py +0 -0
  158. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/embeddings/query_vector_search.py +0 -0
  159. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/episodes/__init__.py +0 -0
  160. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/episodes/claude_code.py +0 -0
  161. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/episodes/codex.py +0 -0
  162. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/episodes/launcher.py +0 -0
  163. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/episodes/normalization.py +0 -0
  164. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/episodes/poller.py +0 -0
  165. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/episodes/source_discovery.py +0 -0
  166. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/episodes/tool_filter.py +0 -0
  167. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/identity/__init__.py +0 -0
  168. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/identity/codex_runtime.py +0 -0
  169. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/identity/compatibility.py +0 -0
  170. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/identity/resolver.py +0 -0
  171. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/session_state/__init__.py +0 -0
  172. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/session_state/file_store.py +0 -0
  173. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/telemetry/__init__.py +0 -0
  174. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/telemetry/operation_summary.py +0 -0
  175. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/telemetry/session_selection.py +0 -0
  176. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/telemetry/sync_summary.py +0 -0
  177. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/validation/__init__.py +0 -0
  178. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/validation/integrity_validation.py +0 -0
  179. {shellbrain-0.1.0 → shellbrain-0.1.2}/app/periphery/validation/semantic_validation.py +0 -0
  180. {shellbrain-0.1.0 → shellbrain-0.1.2}/setup.cfg +0 -0
  181. {shellbrain-0.1.0 → shellbrain-0.1.2}/shellbrain.egg-info/dependency_links.txt +0 -0
  182. {shellbrain-0.1.0 → shellbrain-0.1.2}/shellbrain.egg-info/entry_points.txt +0 -0
  183. {shellbrain-0.1.0 → shellbrain-0.1.2}/shellbrain.egg-info/requires.txt +0 -0
  184. {shellbrain-0.1.0 → shellbrain-0.1.2}/shellbrain.egg-info/top_level.txt +0 -0
@@ -0,0 +1,78 @@
1
+ Metadata-Version: 2.4
2
+ Name: shellbrain
3
+ Version: 0.1.2
4
+ Summary: Repo-scoped Shellbrain CLI with explicit evidence-backed writes.
5
+ Requires-Python: >=3.11
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: SQLAlchemy<3.0,>=2.0
8
+ Requires-Dist: alembic<2.0,>=1.13
9
+ Requires-Dist: pydantic<3.0,>=2.7
10
+ Requires-Dist: PyYAML<7.0,>=6.0
11
+ Requires-Dist: psycopg[binary]<4.0,>=3.1
12
+ Requires-Dist: pgvector<1.0,>=0.3
13
+ Requires-Dist: sentence-transformers<4.0,>=3.0
14
+
15
+ # Building a Brain
16
+
17
+ `shellbrain` is a machine-level CLI that gives agent sessions repo-scoped long-term memory.
18
+
19
+ It stores durable memories like `problem`, `solution`, `fact`, and `preference`, grounded by transcript-derived evidence from the active host session.
20
+
21
+ ## Install
22
+
23
+ Primary install path:
24
+
25
+ ```bash
26
+ curl -L shellbrain.ai/install | bash
27
+ ```
28
+
29
+ The installer already runs `shellbrain init` for you.
30
+
31
+ That makes the machine ready immediately, installs the Codex and Claude integrations, and lets repos register themselves later on first real Shellbrain use.
32
+
33
+ Manual install path:
34
+
35
+ ```bash
36
+ pipx install shellbrain
37
+ shellbrain init
38
+ ```
39
+
40
+ ## What Install Does
41
+
42
+ - installs the `shellbrain` CLI once per machine
43
+ - provisions or reuses the managed local runtime on first `init`
44
+ - installs the personal Codex skill
45
+ - installs the personal Claude skill
46
+ - installs the Claude global SessionStart hook in `~/.claude/settings.json`
47
+ - auto-registers repos later on first use inside a repo
48
+
49
+ If readiness is unclear after install, run:
50
+
51
+ ```bash
52
+ shellbrain admin doctor
53
+ ```
54
+
55
+ If `doctor` reports `repair_needed`, rerun:
56
+
57
+ ```bash
58
+ shellbrain init
59
+ ```
60
+
61
+ ## First Useful Command
62
+
63
+ From inside a repo, start with a concrete retrieval query:
64
+
65
+ ```bash
66
+ shellbrain read --json '{"query":"Have we seen this failure mode before?","kinds":["problem","solution","failed_tactic"]}'
67
+ ```
68
+
69
+ If direct calls fail in a tool shell, retry through a login shell first:
70
+
71
+ ```bash
72
+ zsh -lc 'source ~/.zprofile >/dev/null 2>&1; shellbrain --help'
73
+ ```
74
+
75
+ ## More
76
+
77
+ - Advanced/operator guide: [`docs/external-quickstart.md`](docs/external-quickstart.md)
78
+ - Codex session-start skill: [`skills/shellbrain-session-start/SKILL.md`](skills/shellbrain-session-start/SKILL.md)
@@ -0,0 +1,64 @@
1
+ # Building a Brain
2
+
3
+ `shellbrain` is a machine-level CLI that gives agent sessions repo-scoped long-term memory.
4
+
5
+ It stores durable memories like `problem`, `solution`, `fact`, and `preference`, grounded by transcript-derived evidence from the active host session.
6
+
7
+ ## Install
8
+
9
+ Primary install path:
10
+
11
+ ```bash
12
+ curl -L shellbrain.ai/install | bash
13
+ ```
14
+
15
+ The installer already runs `shellbrain init` for you.
16
+
17
+ That makes the machine ready immediately, installs the Codex and Claude integrations, and lets repos register themselves later on first real Shellbrain use.
18
+
19
+ Manual install path:
20
+
21
+ ```bash
22
+ pipx install shellbrain
23
+ shellbrain init
24
+ ```
25
+
26
+ ## What Install Does
27
+
28
+ - installs the `shellbrain` CLI once per machine
29
+ - provisions or reuses the managed local runtime on first `init`
30
+ - installs the personal Codex skill
31
+ - installs the personal Claude skill
32
+ - installs the Claude global SessionStart hook in `~/.claude/settings.json`
33
+ - auto-registers repos later on first use inside a repo
34
+
35
+ If readiness is unclear after install, run:
36
+
37
+ ```bash
38
+ shellbrain admin doctor
39
+ ```
40
+
41
+ If `doctor` reports `repair_needed`, rerun:
42
+
43
+ ```bash
44
+ shellbrain init
45
+ ```
46
+
47
+ ## First Useful Command
48
+
49
+ From inside a repo, start with a concrete retrieval query:
50
+
51
+ ```bash
52
+ shellbrain read --json '{"query":"Have we seen this failure mode before?","kinds":["problem","solution","failed_tactic"]}'
53
+ ```
54
+
55
+ If direct calls fail in a tool shell, retry through a login shell first:
56
+
57
+ ```bash
58
+ zsh -lc 'source ~/.zprofile >/dev/null 2>&1; shellbrain --help'
59
+ ```
60
+
61
+ ## More
62
+
63
+ - Advanced/operator guide: [`docs/external-quickstart.md`](docs/external-quickstart.md)
64
+ - Codex session-start skill: [`skills/shellbrain-session-start/SKILL.md`](skills/shellbrain-session-start/SKILL.md)
@@ -0,0 +1,2 @@
1
+ """Packaged host-onboarding assets for Shellbrain."""
2
+
@@ -0,0 +1,520 @@
1
+ # Shellbrain Session Start
2
+
3
+ ## Overview
4
+
5
+ Use Shellbrain as a case-based reasoning system for long-running agent work.
6
+
7
+ Shellbrain has two layers:
8
+
9
+ - durable memories:
10
+ - `problem`
11
+ - `solution`
12
+ - `failed_tactic`
13
+ - `fact`
14
+ - `preference`
15
+ - `change`
16
+ - episodic evidence:
17
+ - transcript-derived `episode_events` that justify writes
18
+
19
+ `read` recalls durable abstractions. `events` inspects the episodic evidence stream. `create` and `update` let the agent turn what happened in a session into reusable long-term memory.
20
+
21
+ Treat current repo state as ground truth. Treat Shellbrain as advisory long-term memory that helps answer: "Have I seen anything like this before, and what was useful?"
22
+
23
+ ## Quick Start
24
+
25
+ `shellbrain init` is first-time bootstrap and repair. It is not a per-session ritual.
26
+
27
+ 1. If Shellbrain has never been bootstrapped on this machine, the current repo has never been registered, or the user says Shellbrain setup is broken, run `shellbrain init`.
28
+ 2. Otherwise, do not rerun `init` just because a new agent session started. Start with focused `read` queries right away.
29
+ 3. If readiness is unclear, inspect with `shellbrain admin doctor` instead of rerunning `init` by reflex.
30
+ 4. If `doctor` reports `repair_needed`, rerun `shellbrain init` instead of trying to repair Shellbrain manually.
31
+ 5. In Claude Code, if direct `shellbrain` calls fail in the current session, retry through a login shell that sources `~/.zprofile`:
32
+ `zsh -lc 'source ~/.zprofile >/dev/null 2>&1; shellbrain --help'`
33
+ 6. Only drop to the advanced/operator recovery notes if `doctor` says the managed runtime is blocked.
34
+ 7. Resolve the target repo:
35
+ - Use the current working directory when already inside the repo.
36
+ - Pass `--repo-root /absolute/path/to/repo` when working from somewhere else.
37
+ - Treat repo path as operational context; Shellbrain should normally derive durable repo identity from normalized git remote, not from `basename(repo_root)`.
38
+ - Shellbrain prefers `origin`, then a single remaining remote. If multiple remotes exist and none is `origin`, pass `--repo-id`.
39
+ - If there is no usable remote, Shellbrain falls back to a weak-local identity tied to the current path.
40
+ 8. Start with focused `read` queries about the concrete problem, subsystem, decision, or constraint you are working on. Do not start with vague prompts like "what should I know about this repo?"
41
+ 9. Use a startup read bundle:
42
+ - prior attempts:
43
+ `shellbrain read --json '{"query":"Have we seen this failure mode before?","kinds":["problem","solution","failed_tactic"]}'`
44
+ - constraints and preferences:
45
+ `shellbrain read --json '{"query":"What repo constraints or user preferences matter for this task?","kinds":["fact","preference","change"]}'`
46
+ - area-specific facts:
47
+ `shellbrain read --json '{"query":"What facts or changes matter in this subsystem?","kinds":["fact","change","problem","solution"]}'`
48
+ 10. When the `shellbrain` command is not on PATH in the current shell, wrap invocations:
49
+ `zsh -lc "source ~/.zprofile >/dev/null 2>&1; shellbrain read --json '{\"query\":\"Have we seen this failure mode before?\",\"kinds\":[\"problem\",\"solution\",\"failed_tactic\"]}'"`
50
+ 11. Inspect the returned context pack:
51
+ - `direct` = direct matches
52
+ - `explicit_related` = linked memories, including authored associations and problem/fact chains
53
+ - `implicit_related` = semantic neighbors and bounded associative hops
54
+ 12. Re-run `read` liberally during the task whenever the search shifts, you hit a new subproblem, or you suspect the right memory will only become relevant mid-journey.
55
+ 13. Before `create` or any evidence-bearing `update`, run `shellbrain events --json '{"limit":10}'`.
56
+ 14. Reuse returned `data.events[].id` values verbatim as `evidence_refs`.
57
+ 15. At session end, normalize the episode into durable memories:
58
+ - store the `problem`
59
+ - store each `failed_tactic`
60
+ - store the `solution`
61
+ - store any durable `fact`, `preference`, or `change`
62
+ - record `utility_vote` updates for memories that helped or misled
63
+ 16. Use the exact payload shapes documented below.
64
+
65
+ Trusted session note:
66
+
67
+ - `events` now syncs the exact trusted caller thread instead of mixing same-repo agent threads.
68
+ - Claude trusted identity normally comes from the global Shellbrain SessionStart hook in `~/.claude/settings.json`. Repo-local `.claude/settings.local.json` is only the explicit override or repair path.
69
+ - Successful responses may include `data.guidance`; treat that as an internal Shellbrain nudge about pending utility votes or workflow reminders.
70
+
71
+ ## Memory Kinds
72
+
73
+ - `problem`:
74
+ the obstacle, failure mode, or recurring issue that future agents may face again
75
+ - `solution`:
76
+ what worked for a specific `problem`
77
+ - `failed_tactic`:
78
+ what was tried and did not work for a specific `problem`
79
+ - `fact`:
80
+ durable truth about the repo, architecture, workflow, or environment
81
+ - `preference`:
82
+ durable user or repo convention about how work should be done
83
+ - `change`:
84
+ something that invalidated or revised prior truth
85
+
86
+ Invariant:
87
+
88
+ - `solution` and `failed_tactic` require `links.problem_id`
89
+ - `problem`, `fact`, `preference`, and `change` do not accept `links.problem_id`
90
+
91
+ ## Updates and Links
92
+
93
+ - `utility_vote`:
94
+ score whether a memory helped solve a specific `problem`
95
+ on a `-1.0` to `1.0` scale:
96
+ negative = unhelpful or misleading
97
+ `0.0` = neutral or unclear
98
+ positive = helpful
99
+ - `fact_update_link`:
100
+ connect an older fact to a newer fact through a `change` memory
101
+ - `association_link`:
102
+ add an explicit durable relation between two memories
103
+ - `archive_state`:
104
+ hide or restore an existing memory without rewriting history
105
+
106
+ Use explicit associations when two memories are similar or one depends on the other in a way you want future retrieval to honor. Shellbrain also has implicit associations via semantic neighbors; those show up in `implicit_related` during `read`, but only explicit authored links become durable graph structure.
107
+
108
+ ## Operating Rules
109
+
110
+ - Never invent `evidence_refs`.
111
+ - Skip the write if `events` returns nothing useful or the evidence is ambiguous.
112
+ - Prefer `scope: "repo"` unless the knowledge is intentionally cross-repo. Use `scope: "global"` for cross-repo user preferences, coding conventions, or project-wide facts.
113
+ - Store durable, reusable knowledge. Do not store transient chatter, raw logs, or short-lived status.
114
+ - `shellbrain init` is the normal first-time bootstrap and repair path, not the default way to start every agent session.
115
+ - `shellbrain admin doctor` is the inspect path when readiness is unclear.
116
+ - Background episodic capture runs automatically. `events` still performs an inline sync before it returns fresh transcript evidence.
117
+ - Use `read` again before writing when you need to check whether a memory already exists or whether an `update` is more appropriate than a new `create`.
118
+
119
+ ---
120
+
121
+ ## Session Workflow
122
+
123
+ ### Mental Model
124
+
125
+ Shellbrain is not an LLM chat endpoint. It is a retrieval and write system for structured long-term memory.
126
+
127
+ Think in four layers:
128
+
129
+ - procedural / experiential memory:
130
+ - `problem`
131
+ - `solution`
132
+ - `failed_tactic`
133
+ - semantic memory:
134
+ - `fact`
135
+ - `preference`
136
+ - `change`
137
+ - associative memory:
138
+ - explicit durable links between memories
139
+ - implicit semantic-neighbor expansion during `read`
140
+ - episodic memory:
141
+ - transcript-derived `episode_events` captured from the active host session
142
+
143
+ The point is case-based reasoning: query for similar prior problems, plans, constraints, and facts; use current repo state as ground truth; and then write back durable lessons from the finished episode.
144
+
145
+ ### Bootstrap
146
+
147
+ Treat `shellbrain init` as first-time bootstrap plus repair, not as a routine start-of-session command.
148
+
149
+ Normal session rhythm:
150
+
151
+ - if Shellbrain already works in this repo, go straight to `read`
152
+ - if readiness is unclear, run `shellbrain admin doctor`
153
+ - if Shellbrain has never been bootstrapped on this machine, this repo has never been registered, or `doctor` says `repair_needed`, run `shellbrain init`
154
+
155
+ Bootstrap and repair path:
156
+
157
+ ```bash
158
+ shellbrain init
159
+ shellbrain admin doctor
160
+ ```
161
+
162
+ Use Shellbrain normally after `doctor` shows the machine bootstrap is `ready` and the current repo is registered.
163
+
164
+ If `doctor` reports `repair_needed`, rerun `shellbrain init` instead of trying to patch Shellbrain manually.
165
+
166
+ In Claude Code, if direct `shellbrain` calls fail in the current session, retry through a login shell that sources `~/.zprofile`:
167
+
168
+ ```bash
169
+ zsh -lc 'source ~/.zprofile >/dev/null 2>&1; shellbrain --help'
170
+ ```
171
+
172
+ Assume Shellbrain comes from a one-time machine install. Do not rerun `init` just because a new agent starts. If direct calls fail in the current Claude Code session, keep using the `zsh -lc 'source ~/.zprofile ...'` wrapper for Shellbrain invocations before declaring Shellbrain blocked. Only if the wrapped check fails should you ask the operator to restore the machine-level install.
173
+
174
+ Drop into the advanced/operator path only when `doctor` says the managed runtime is blocked.
175
+
176
+ ### Repo Targeting
177
+
178
+ - Default to the current working directory when it is the repo you are working in.
179
+ - Use `--repo-root /absolute/path/to/repo` when your shell is elsewhere.
180
+ - Treat path as operational context, not durable identity.
181
+ - Shellbrain should normally derive durable repo identity from normalized git remote.
182
+ - It prefers `origin`, then a single remaining remote.
183
+ - If multiple remotes exist and none is `origin`, `init` stops and asks for `--repo-id`.
184
+ - If no usable remote exists, Shellbrain falls back to a weak-local identity tied to the current path.
185
+
186
+ ### Query Playbook
187
+
188
+ `read` uses lexical retrieval plus embedding similarity, then expands through explicit links and implicit semantic neighbors. Query it like a search and retrieval system, not like an open-ended chat model.
189
+
190
+ Good query families:
191
+
192
+ 1. Prior attempts for the current problem:
193
+
194
+ ```bash
195
+ shellbrain read --json '{"query":"Have we seen this migration lock timeout before?","kinds":["problem","solution","failed_tactic"]}'
196
+ ```
197
+
198
+ 2. Constraints and preferences for the current task:
199
+
200
+ ```bash
201
+ shellbrain read --json '{"query":"What repo constraints or user preferences matter for this auth refactor?","kinds":["fact","preference","change"]}'
202
+ ```
203
+
204
+ 3. Facts and changes for the subsystem you are entering:
205
+
206
+ ```bash
207
+ shellbrain read --json '{"query":"What facts or recent changes matter around the payments retry worker?","kinds":["fact","change","problem","solution"]}'
208
+ ```
209
+
210
+ Avoid generic prompts like:
211
+
212
+ - "what should I know about this repo?"
213
+ - "what should I know before I start?"
214
+
215
+ Those are too vague for the actual retrieval model.
216
+
217
+ ### How To Read The Pack
218
+
219
+ `read` returns a bounded context pack:
220
+
221
+ - `direct`:
222
+ direct matches to the current query
223
+ - `explicit_related`:
224
+ memories reached through explicit link structure such as problem-attempt relations, fact-update chains, and authored associations
225
+ - `implicit_related`:
226
+ semantic neighbors and bounded associative hops
227
+
228
+ Use `why_included` and `anchor_memory_id` to understand why a related item appeared.
229
+
230
+ ### Session Cadence
231
+
232
+ #### Start of session
233
+
234
+ 1. Resolve the target repo.
235
+ 2. Run one or more focused `read` queries tied to the actual problem.
236
+ 3. Process the context pack and extract candidate prior cases, facts, and preferences.
237
+
238
+ #### During the task
239
+
240
+ Re-run `read` whenever:
241
+
242
+ - the search shifts to a new subproblem
243
+ - you hit a blocker and want similar prior failures or tactics
244
+ - you move into a new subsystem
245
+ - you suspect a fact, preference, or change memory may matter halfway through the journey
246
+
247
+ Do not treat Shellbrain as startup-only. Query liberally while solving.
248
+
249
+ #### Before any write
250
+
251
+ Inspect fresh evidence:
252
+
253
+ ```bash
254
+ shellbrain events --json '{"limit":10}'
255
+ ```
256
+
257
+ Then reuse returned `data.events[].id` values verbatim as `evidence_refs`.
258
+
259
+ #### Session end
260
+
261
+ Normalize the episode into durable memory:
262
+
263
+ 1. Store the `problem`.
264
+ 2. Store each `failed_tactic`.
265
+ 3. Store the `solution`.
266
+ 4. Store any durable `fact`, `preference`, or `change` discovered while working.
267
+ 5. Record `utility_vote` updates for memories that helped or misled.
268
+
269
+ This is where Shellbrain compounds: future agents can ask, with high fidelity, whether they have seen anything like the current problem before.
270
+
271
+ ### Memory Kinds and Scope
272
+
273
+ Link invariant:
274
+
275
+ - `solution` and `failed_tactic` require `links.problem_id`
276
+ - the other kinds do not accept `links.problem_id`
277
+
278
+ Scope guidance:
279
+
280
+ - default to `scope: "repo"`
281
+ - use `scope: "global"` for cross-repo user preferences, coding style preferences, architectural preferences, or project facts that are not repo-specific
282
+
283
+ ### Links and Utility
284
+
285
+ - explicit associations:
286
+ memories you deliberately link because they are similar or one depends on the other
287
+ - implicit associations:
288
+ semantic-neighbor expansion during `read`
289
+ - `utility_vote`:
290
+ problem-scoped feedback about whether a retrieved memory helped solve the current `problem`
291
+ on a `-1.0` to `1.0` scale:
292
+ negative = unhelpful or misleading
293
+ `0.0` = neutral or unclear
294
+ positive = helpful
295
+ - `fact_update_link`:
296
+ how you represent truth evolution when a `change` supersedes one fact with another
297
+
298
+ Important modeling pattern for changed truth:
299
+
300
+ 1. create a `change` memory
301
+ 2. create the new `fact`
302
+ 3. connect old and new facts through `fact_update_link`
303
+
304
+ ### Evidence Model
305
+
306
+ - `events` syncs the exact trusted caller thread when Shellbrain can identify the host session cleanly.
307
+ - Supported hosts are Claude Code and Codex.
308
+ - Claude trusted identity normally comes from the global Shellbrain SessionStart hook in `~/.claude/settings.json`.
309
+ - Successful Shellbrain commands keep background episodic capture warm automatically.
310
+ - `events` also performs an inline sync before returning recent stored events.
311
+ - The transcript log is evidence, not the memory itself. Do not store raw transcript chunks as durable memories.
312
+ - Successful responses may include `data.guidance`; treat it as an internal nudge from Shellbrain about pending utility votes or workflow reminders.
313
+
314
+ ### Recovery
315
+
316
+ - New agent session, but Shellbrain was already set up
317
+ Do not rerun `init`. Start with `read`. Use `doctor` only if readiness is unclear.
318
+
319
+ - `shellbrain: command not found`
320
+ Retry through `zsh -lc 'source ~/.zprofile >/dev/null 2>&1; shellbrain --help'` first. Only if that still fails should you ask the operator to restore the one-time machine install.
321
+
322
+ - `shellbrain init` fails or `doctor` shows `repair_needed`
323
+ Rerun `shellbrain init`. That is the normal repair path.
324
+
325
+ - `doctor` says the managed runtime is blocked
326
+ Escalate to the operator path only after `doctor` gives a specific failure. That path may still involve manual DSN, migration, or Docker repair.
327
+
328
+ - No active host session found
329
+ Verify that the user is working in Claude Code, that transcript files exist, and that `repo_root` matches the repo used in that session.
330
+
331
+ - Claude integration missing or untrusted
332
+ Rerun `shellbrain init` or `shellbrain admin install-host-assets --host claude` to restore the global Claude integration. Use `shellbrain admin install-claude-hook --repo-root ...` only when you intentionally need the repo-local override path. Do not hand-edit Claude hook config in the normal path.
333
+
334
+ - `init` asks for `--repo-id`
335
+ That means multiple remotes exist and none is `origin`. Pick the durable identity you want and rerun with an explicit repo id.
336
+
337
+ - Evidence ref rejected or event not visible
338
+ Rerun `shellbrain events` and use the returned ids verbatim. Do not reuse stale ids from memory.
339
+
340
+ ---
341
+
342
+ ## Request Shapes
343
+
344
+ The public CLI expects agent-facing payloads. It hydrates `op` and `repo_id` automatically.
345
+
346
+ Assume the normal product bootstrap has already happened:
347
+
348
+ - `shellbrain init` has succeeded for the machine
349
+ - the current repo has been registered
350
+ - `shellbrain admin doctor` reports Shellbrain as ready
351
+
352
+ Do not rerun `shellbrain init` at the start of an ordinary agent session. If readiness is unclear, inspect with `shellbrain admin doctor` before debugging individual request payloads.
353
+
354
+ Shellbrain should normally infer durable repo identity from normalized git remote. Use `--repo-root` when your shell is elsewhere; reserve explicit repo-id overrides for rare advanced cases.
355
+
356
+ More precisely:
357
+
358
+ - Shellbrain prefers the normalized `origin` fetch URL.
359
+ - If `origin` is absent but exactly one remote exists, it uses that remote.
360
+ - If multiple remotes exist and none is `origin`, rerun `init` with `--repo-id`.
361
+ - If no usable remote exists, Shellbrain falls back to a weak-local identity tied to the current path.
362
+
363
+ ### Read
364
+
365
+ Use `read` to retrieve durable memories related to the current problem or subproblem.
366
+
367
+ Shellbrain `read` is retrieval, not chat. Query it with concrete failure modes, subsystem names, decisions, or constraints. Avoid vague prompts like "what should I know about this repo?"
368
+
369
+ Prior attempts:
370
+
371
+ ```bash
372
+ shellbrain read --json '{"query":"Have we seen this migration lock timeout before?","kinds":["problem","solution","failed_tactic"]}'
373
+ ```
374
+
375
+ Constraints and preferences:
376
+
377
+ ```bash
378
+ shellbrain read --json '{"query":"What repo constraints or user preferences matter for this auth refactor?","kinds":["fact","preference","change"]}'
379
+ ```
380
+
381
+ Area-specific facts and changes:
382
+
383
+ ```bash
384
+ shellbrain read --json '{"query":"What facts or recent changes matter around the payments retry worker?","kinds":["fact","change","problem","solution"]}'
385
+ ```
386
+
387
+ Allowed kinds:
388
+
389
+ - `problem`
390
+ - `solution`
391
+ - `failed_tactic`
392
+ - `fact`
393
+ - `preference`
394
+ - `change`
395
+
396
+ Read returns a context pack with:
397
+
398
+ - `direct`
399
+ - `explicit_related`
400
+ - `implicit_related`
401
+
402
+ Use `why_included` and `anchor_memory_id` to understand why related memories appeared.
403
+
404
+ ### Events
405
+
406
+ Use `events` before any create or evidence-bearing update:
407
+
408
+ ```bash
409
+ shellbrain events --json '{"limit":10}'
410
+ ```
411
+
412
+ Read returned ids from `data.events[].id`.
413
+
414
+ `events` inspects normalized episodic evidence. Those ids are the canonical grounding for durable writes.
415
+
416
+ When caller identity is trusted, `events` reads from the exact caller thread instead of guessing from the repo alone.
417
+ `shellbrain init` normally installs Claude integration through the global Shellbrain SessionStart hook in `~/.claude/settings.json`. Use `shellbrain admin install-claude-hook --repo-root ...` only when you intentionally need the repo-local override path.
418
+
419
+ ### Create
420
+
421
+ Minimal create:
422
+
423
+ ```bash
424
+ shellbrain create --json '{"memory":{"text":"Deploy failed because APP_ENV was unset","kind":"problem","evidence_refs":["evt-123"]}}'
425
+ ```
426
+
427
+ Notes:
428
+
429
+ - `scope` is optional and defaults to repo scope.
430
+ - `kind` must be one of the six allowed kinds listed above.
431
+ - `solution` and `failed_tactic` require `links.problem_id`.
432
+ - `problem`, `fact`, `preference`, and `change` do not accept `links.problem_id`.
433
+ - `evidence_refs` must contain stored `episode_event` ids returned by `events`.
434
+
435
+ When to use each create kind:
436
+
437
+ - `problem`:
438
+ the obstacle or failure mode
439
+ - `solution`:
440
+ what worked for a specific problem
441
+ - `failed_tactic`:
442
+ what did not work for a specific problem
443
+ - `fact`:
444
+ durable truth about the repo or workflow
445
+ - `preference`:
446
+ durable user or repo convention
447
+ - `change`:
448
+ something that invalidates or revises prior truth
449
+
450
+ ### Update
451
+
452
+ #### Archive State
453
+
454
+ Archive or unarchive an existing memory:
455
+
456
+ ```bash
457
+ shellbrain update --json '{"memory_id":"mem-123","update":{"type":"archive_state","archived":true}}'
458
+ ```
459
+
460
+ #### Utility Vote
461
+
462
+ Record whether something helped solve a problem:
463
+
464
+ ```bash
465
+ shellbrain update --json '{"memory_id":"mem-123","update":{"type":"utility_vote","problem_id":"mem-problem","vote":1.0,"evidence_refs":["evt-123"]}}'
466
+ ```
467
+
468
+ Batch utility votes are also supported:
469
+
470
+ ```bash
471
+ shellbrain update --json '{"updates":[{"memory_id":"mem-123","update":{"type":"utility_vote","problem_id":"mem-problem","vote":1.0,"evidence_refs":["evt-123"]}},{"memory_id":"mem-456","update":{"type":"utility_vote","problem_id":"mem-problem","vote":-0.25,"evidence_refs":["evt-123"]}}]}'
472
+ ```
473
+
474
+ Use `utility_vote` after solving a problem to judge whether a retrieved memory was actually useful or misleading in that specific context.
475
+
476
+ Vote semantics:
477
+
478
+ - `-1.0` to `< 0`:
479
+ unhelpful or misleading
480
+ - `0.0`:
481
+ neutral, mixed, or unclear
482
+ - `> 0` to `1.0`:
483
+ helpful
484
+
485
+ #### Fact Update Link
486
+
487
+ Link an older fact to a newer fact through a change memory:
488
+
489
+ ```bash
490
+ shellbrain update --json '{"memory_id":"mem-change","update":{"type":"fact_update_link","old_fact_id":"mem-old-fact","new_fact_id":"mem-new-fact","evidence_refs":["evt-123"]}}'
491
+ ```
492
+
493
+ Use this when ground truth changed:
494
+
495
+ 1. create a `change` memory
496
+ 2. create the replacement `fact`
497
+ 3. connect the old and new facts through `fact_update_link`
498
+
499
+ #### Association Link
500
+
501
+ Link two memories explicitly:
502
+
503
+ ```bash
504
+ shellbrain update --json '{"memory_id":"mem-123","update":{"type":"association_link","to_memory_id":"mem-456","relation_type":"associated_with","evidence_refs":["evt-123"]}}'
505
+ ```
506
+
507
+ Use `association_link` when two memories are similar or one depends on the other in a way you want future retrieval to preserve explicitly. This is the explicit side of associative memory; semantic-neighbor expansion remains the implicit side.
508
+
509
+ Allowed update types:
510
+
511
+ - `archive_state`
512
+ - `utility_vote`
513
+ - `fact_update_link`
514
+ - `association_link`
515
+
516
+ Important nuance:
517
+
518
+ - `archive_state` does not carry `evidence_refs`.
519
+ - The evidence-bearing update types carry `evidence_refs` inside the `update` object, not at the top level.
520
+ - `utility_vote` is about usefulness for a specific problem, not about changing truth.