shellbrain 0.1.57__tar.gz → 0.1.58__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 (457) hide show
  1. {shellbrain-0.1.57 → shellbrain-0.1.58}/PKG-INFO +5 -5
  2. {shellbrain-0.1.57 → shellbrain-0.1.58}/README.md +4 -4
  3. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/entities/inner_agents.py +1 -2
  4. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/entities/settings.py +0 -20
  5. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/policies/retrieval/ontology_semantics.py +5 -50
  6. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/host_apps/inner_agents.py +1 -4
  7. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/concepts/show/execute.py +27 -2
  8. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/concepts/show/request.py +1 -0
  9. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/concepts/views.py +62 -4
  10. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/knowledge_builder/build_knowledge/execute.py +23 -73
  11. shellbrain-0.1.58/app/core/use_cases/knowledge_builder/runs.py +46 -0
  12. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/knowledge_builder/teach_knowledge/execute.py +22 -73
  13. shellbrain-0.1.58/app/core/use_cases/knowledge_builder/teach_knowledge/result.py +22 -0
  14. shellbrain-0.1.58/app/core/use_cases/memories/add/execute.py +121 -0
  15. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/memories/add/request.py +1 -1
  16. shellbrain-0.1.58/app/core/use_cases/memories/add/result.py +24 -0
  17. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/memories/reference_checks.py +4 -16
  18. shellbrain-0.1.58/app/core/use_cases/memories/update/execute.py +267 -0
  19. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/memories/update/result.py +5 -16
  20. shellbrain-0.1.58/app/core/use_cases/memories/writes.py +126 -0
  21. shellbrain-0.1.58/app/core/use_cases/retrieval/build_context/execute.py +224 -0
  22. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/retrieval/context_pack_pipeline.py +0 -3
  23. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/retrieval/deterministic_graph_recall.py +109 -71
  24. shellbrain-0.1.58/app/core/use_cases/retrieval/read/__init__.py +19 -0
  25. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/retrieval/read/execute.py +4 -24
  26. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/retrieval/read/request.py +2 -35
  27. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/retrieval/read_concepts.py +15 -275
  28. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/retrieval/seed_retrieval.py +15 -10
  29. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/dependencies.py +0 -4
  30. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/internal_agent/memories/add.py +3 -4
  31. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/internal_agent/memories/update.py +3 -4
  32. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/parser/builder.py +5 -5
  33. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/request_parsing/hydration.py +2 -6
  34. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/request_parsing/memories.py +0 -2
  35. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/runner.py +0 -1
  36. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/runtime.py +0 -1
  37. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/assets/claude.py +1 -8
  38. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/assets/codex.py +3 -1
  39. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/assets/cursor.py +1 -8
  40. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/assets/cursor_statusline_config.py +9 -9
  41. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/assets/service.py +0 -4
  42. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/identity/claude_hook_install.py +5 -8
  43. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/inner_agents/claude_cli.py +5 -11
  44. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/inner_agents/codex_cli.py +21 -101
  45. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/inner_agents/output_parser.py +1 -17
  46. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/inner_agents/prompt.py +42 -247
  47. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/telemetry/sink.py +4 -4
  48. shellbrain-0.1.58/app/infrastructure/telemetry/write_records.py +156 -0
  49. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/settings/internal-agents/defaults.yaml +0 -1
  50. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/admin.py +0 -7
  51. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/cli.py +0 -2
  52. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/cli_runtime.py +0 -1
  53. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/operation_dependencies.py +0 -14
  54. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/settings.py +0 -12
  55. {shellbrain-0.1.57 → shellbrain-0.1.58}/pyproject.toml +1 -1
  56. {shellbrain-0.1.57 → shellbrain-0.1.58}/shellbrain.egg-info/PKG-INFO +5 -5
  57. {shellbrain-0.1.57 → shellbrain-0.1.58}/shellbrain.egg-info/SOURCES.txt +2 -14
  58. shellbrain-0.1.57/app/core/policies/memories/add_plan.py +0 -122
  59. shellbrain-0.1.57/app/core/policies/memories/update_plan.py +0 -153
  60. shellbrain-0.1.57/app/core/use_cases/knowledge_builder/teach_knowledge/result.py +0 -65
  61. shellbrain-0.1.57/app/core/use_cases/memories/add/execute.py +0 -55
  62. shellbrain-0.1.57/app/core/use_cases/memories/add/result.py +0 -35
  63. shellbrain-0.1.57/app/core/use_cases/memories/effect_plan.py +0 -137
  64. shellbrain-0.1.57/app/core/use_cases/memories/update/execute.py +0 -110
  65. shellbrain-0.1.57/app/core/use_cases/plan_execution.py +0 -370
  66. shellbrain-0.1.57/app/core/use_cases/retrieval/build_context/execute.py +0 -601
  67. shellbrain-0.1.57/app/core/use_cases/retrieval/read/__init__.py +0 -29
  68. shellbrain-0.1.57/app/entrypoints/host_hooks/__init__.py +0 -1
  69. shellbrain-0.1.57/app/entrypoints/host_hooks/claude_session_start.py +0 -11
  70. shellbrain-0.1.57/app/entrypoints/host_hooks/cursor_statusline.py +0 -9
  71. shellbrain-0.1.57/app/infrastructure/telemetry/write_records.py +0 -262
  72. shellbrain-0.1.57/app/settings/defaults/create_policy.yaml +0 -7
  73. shellbrain-0.1.57/app/settings/defaults/update_policy.yaml +0 -5
  74. shellbrain-0.1.57/app/startup/create_policy.py +0 -37
  75. shellbrain-0.1.57/app/startup/host_hooks.py +0 -24
  76. shellbrain-0.1.57/app/startup/update_policy.py +0 -30
  77. shellbrain-0.1.57/onboarding_assets/codex/clean-architecture/SKILL.md +0 -290
  78. shellbrain-0.1.57/onboarding_assets/codex/clean-code/SKILL.md +0 -243
  79. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/__init__.py +0 -0
  80. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/__main__.py +0 -0
  81. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/__init__.py +0 -0
  82. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/entities/__init__.py +0 -0
  83. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/entities/admin_errors.py +0 -0
  84. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/entities/associations.py +0 -0
  85. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/entities/backups.py +0 -0
  86. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/entities/concepts.py +0 -0
  87. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/entities/episodes.py +0 -0
  88. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/entities/evidence.py +0 -0
  89. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/entities/guidance.py +0 -0
  90. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/entities/identity.py +0 -0
  91. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/entities/ids.py +0 -0
  92. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/entities/knowledge_builder.py +0 -0
  93. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/entities/machine_config.py +0 -0
  94. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/entities/memories.py +0 -0
  95. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/entities/runtime_context.py +0 -0
  96. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/entities/scenarios.py +0 -0
  97. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/entities/session_state.py +0 -0
  98. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/entities/snapshots.py +0 -0
  99. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/entities/structural_memory_relations.py +0 -0
  100. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/entities/utility.py +0 -0
  101. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/errors.py +0 -0
  102. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/policies/__init__.py +0 -0
  103. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/policies/concepts/__init__.py +0 -0
  104. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/policies/concepts/relation_rules.py +0 -0
  105. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/policies/concepts/search_text.py +0 -0
  106. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/policies/episodes/__init__.py +0 -0
  107. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/policies/episodes/knowledge_building.py +0 -0
  108. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/policies/memories/__init__.py +0 -0
  109. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/policies/memories/link_rules.py +0 -0
  110. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/policies/retrieval/__init__.py +0 -0
  111. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/policies/retrieval/bm25.py +0 -0
  112. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/policies/retrieval/context_pack.py +0 -0
  113. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/policies/retrieval/expansion.py +0 -0
  114. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/policies/retrieval/fusion_rrf.py +0 -0
  115. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/policies/retrieval/lexical_query.py +0 -0
  116. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/policies/retrieval/scoring.py +0 -0
  117. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/__init__.py +0 -0
  118. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/db/__init__.py +0 -0
  119. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/db/concept_repositories.py +0 -0
  120. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/db/episode_repositories.py +0 -0
  121. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/db/guidance.py +0 -0
  122. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/db/knowledge_builder.py +0 -0
  123. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/db/memory_repositories.py +0 -0
  124. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/db/problem_runs.py +0 -0
  125. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/db/retrieval_repositories.py +0 -0
  126. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/db/snapshots.py +0 -0
  127. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/db/unit_of_work.py +0 -0
  128. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/embeddings/__init__.py +0 -0
  129. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/embeddings/provider.py +0 -0
  130. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/embeddings/retrieval.py +0 -0
  131. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/host_apps/__init__.py +0 -0
  132. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/local_state/__init__.py +0 -0
  133. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/local_state/session_state_store.py +0 -0
  134. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/local_state/shadow_git.py +0 -0
  135. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/system/__init__.py +0 -0
  136. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/system/clock.py +0 -0
  137. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/ports/system/idgen.py +0 -0
  138. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/__init__.py +0 -0
  139. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/admin/__init__.py +0 -0
  140. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/admin/analytics_diagnostics.py +0 -0
  141. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/admin/backfill_model_usage/__init__.py +0 -0
  142. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/admin/backfill_model_usage/backfill_model_usage.py +0 -0
  143. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/admin/backfill_model_usage/request.py +0 -0
  144. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/admin/backfill_model_usage/result.py +0 -0
  145. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/admin/diagnose_runtime.py +0 -0
  146. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/admin/generate_analytics_report.py +0 -0
  147. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/admin/initialize_runtime.py +0 -0
  148. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/admin/restore_backup.py +0 -0
  149. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/build_guidance.py +0 -0
  150. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/concepts/__init__.py +0 -0
  151. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/concepts/add/__init__.py +0 -0
  152. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/concepts/add/execute.py +0 -0
  153. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/concepts/add/request.py +0 -0
  154. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/concepts/add/result.py +0 -0
  155. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/concepts/embeddings.py +0 -0
  156. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/concepts/reference_checks.py +0 -0
  157. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/concepts/show/__init__.py +0 -0
  158. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/concepts/show/result.py +0 -0
  159. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/concepts/update/__init__.py +0 -0
  160. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/concepts/update/execute.py +0 -0
  161. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/concepts/update/request.py +0 -0
  162. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/concepts/update/result.py +0 -0
  163. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/episodes/__init__.py +0 -0
  164. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/episodes/events/__init__.py +0 -0
  165. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/episodes/events/request.py +0 -0
  166. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/episodes/sync_discovered_host_session.py +0 -0
  167. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/episodes/sync_episode/__init__.py +0 -0
  168. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/episodes/sync_episode/request.py +0 -0
  169. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/episodes/sync_episode/result.py +0 -0
  170. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/episodes/sync_episode/sync_episode.py +0 -0
  171. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/knowledge_builder/__init__.py +0 -0
  172. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/knowledge_builder/build_knowledge/__init__.py +0 -0
  173. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/knowledge_builder/build_knowledge/request.py +0 -0
  174. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/knowledge_builder/build_knowledge/result.py +0 -0
  175. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/knowledge_builder/teach_knowledge/__init__.py +0 -0
  176. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/knowledge_builder/teach_knowledge/request.py +0 -0
  177. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/memories/__init__.py +0 -0
  178. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/memories/add/__init__.py +0 -0
  179. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/memories/update/__init__.py +0 -0
  180. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/memories/update/request.py +0 -0
  181. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/metrics/__init__.py +0 -0
  182. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/metrics/analyze_agent_behavior.py +0 -0
  183. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/retrieval/__init__.py +0 -0
  184. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/retrieval/build_context/__init__.py +0 -0
  185. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/retrieval/concept_seed_retrieval.py +0 -0
  186. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/retrieval/expansion.py +0 -0
  187. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/retrieval/read/result.py +0 -0
  188. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/retrieval/recall/__init__.py +0 -0
  189. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/retrieval/recall/request.py +0 -0
  190. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/retrieval/recall/result.py +0 -0
  191. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/scenarios/__init__.py +0 -0
  192. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/scenarios/record/__init__.py +0 -0
  193. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/scenarios/record/execute.py +0 -0
  194. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/scenarios/record/request.py +0 -0
  195. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/scenarios/record/result.py +0 -0
  196. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/snapshots/__init__.py +0 -0
  197. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/snapshots/capture_snapshot/__init__.py +0 -0
  198. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/snapshots/capture_snapshot/execute.py +0 -0
  199. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/snapshots/capture_snapshot/request.py +0 -0
  200. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/snapshots/capture_snapshot/result.py +0 -0
  201. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/snapshots/code_delta_context/__init__.py +0 -0
  202. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/snapshots/code_delta_context/execute.py +0 -0
  203. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/core/use_cases/snapshots/code_delta_context/request.py +0 -0
  204. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/__init__.py +0 -0
  205. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/__init__.py +0 -0
  206. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/__init__.py +0 -0
  207. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/cli_operation.py +0 -0
  208. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/human/__init__.py +0 -0
  209. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/human/admin.py +0 -0
  210. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/human/admin_dependencies.py +0 -0
  211. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/human/init.py +0 -0
  212. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/internal_agent/__init__.py +0 -0
  213. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/internal_agent/concepts/__init__.py +0 -0
  214. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/internal_agent/concepts/add.py +0 -0
  215. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/internal_agent/concepts/show.py +0 -0
  216. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/internal_agent/concepts/update.py +0 -0
  217. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/internal_agent/episodes/__init__.py +0 -0
  218. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/internal_agent/episodes/events.py +0 -0
  219. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/internal_agent/episodes/selection.py +0 -0
  220. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/internal_agent/episodes/serialization.py +0 -0
  221. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/internal_agent/memories/__init__.py +0 -0
  222. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/internal_agent/memories/utility_vote_evidence.py +0 -0
  223. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/internal_agent/retrieval/__init__.py +0 -0
  224. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/internal_agent/retrieval/execution.py +0 -0
  225. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/internal_agent/retrieval/read.py +0 -0
  226. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/internal_agent/scenarios/__init__.py +0 -0
  227. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/internal_agent/scenarios/record.py +0 -0
  228. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/result_envelopes.py +0 -0
  229. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/session_state.py +0 -0
  230. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/working_agent/__init__.py +0 -0
  231. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/working_agent/recall.py +0 -0
  232. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/working_agent/snapshot.py +0 -0
  233. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/handlers/working_agent/teach.py +0 -0
  234. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/main.py +0 -0
  235. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/parser/__init__.py +0 -0
  236. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/presenters/__init__.py +0 -0
  237. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/presenters/init.py +0 -0
  238. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/request_parsing/__init__.py +0 -0
  239. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/request_parsing/concepts.py +0 -0
  240. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/request_parsing/episodes.py +0 -0
  241. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/request_parsing/payload_validation.py +0 -0
  242. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/request_parsing/prepared.py +0 -0
  243. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/request_parsing/retrieval.py +0 -0
  244. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/request_parsing/scenarios.py +0 -0
  245. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/cli/request_parsing/teach.py +0 -0
  246. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/jobs/__init__.py +0 -0
  247. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/entrypoints/jobs/episode_sync.py +0 -0
  248. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/__init__.py +0 -0
  249. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/__init__.py +0 -0
  250. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/admin/__init__.py +0 -0
  251. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/admin/app_role_safety.py +0 -0
  252. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/admin/backups/__init__.py +0 -0
  253. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/admin/backups/destructive_guard.py +0 -0
  254. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/admin/backups/logical_backup.py +0 -0
  255. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/admin/connection.py +0 -0
  256. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/admin/instance_guard.py +0 -0
  257. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/admin/migrations.py +0 -0
  258. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/admin/privileges.py +0 -0
  259. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/admin/provisioning/__init__.py +0 -0
  260. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/admin/provisioning/docker_prerequisites.py +0 -0
  261. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/admin/provisioning/external_postgres.py +0 -0
  262. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/admin/provisioning/managed_local.py +0 -0
  263. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/admin/storage_setup.py +0 -0
  264. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/__init__.py +0 -0
  265. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/engine.py +0 -0
  266. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/models/__init__.py +0 -0
  267. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/models/associations.py +0 -0
  268. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/models/concepts.py +0 -0
  269. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/models/episodes.py +0 -0
  270. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/models/evidence.py +0 -0
  271. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/models/experiences.py +0 -0
  272. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/models/instance_metadata.py +0 -0
  273. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/models/knowledge_builder.py +0 -0
  274. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/models/memories.py +0 -0
  275. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/models/metadata.py +0 -0
  276. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/models/problem_runs.py +0 -0
  277. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/models/registry.py +0 -0
  278. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/models/snapshots.py +0 -0
  279. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/models/telemetry.py +0 -0
  280. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/models/utility.py +0 -0
  281. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/queries/__init__.py +0 -0
  282. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/queries/agent_behavior.py +0 -0
  283. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/queries/analytics.py +0 -0
  284. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/queries/model_usage_backfill.py +0 -0
  285. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/repos/__init__.py +0 -0
  286. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/repos/memory_visibility.py +0 -0
  287. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/repos/relational/__init__.py +0 -0
  288. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/repos/relational/associations_repo.py +0 -0
  289. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/repos/relational/concepts_repo.py +0 -0
  290. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/repos/relational/episodes_repo.py +0 -0
  291. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/repos/relational/evidence_repo.py +0 -0
  292. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/repos/relational/experiences_repo.py +0 -0
  293. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/repos/relational/knowledge_builder_repo.py +0 -0
  294. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/repos/relational/memories_repo.py +0 -0
  295. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/repos/relational/problem_runs_repo.py +0 -0
  296. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/repos/relational/read_policy_repo.py +0 -0
  297. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/repos/relational/snapshots_repo.py +0 -0
  298. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/repos/relational/telemetry_repo.py +0 -0
  299. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/repos/relational/utility_repo.py +0 -0
  300. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/repos/semantic/__init__.py +0 -0
  301. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/repos/semantic/concept_retrieval_repo.py +0 -0
  302. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/repos/semantic/keyword_retrieval_repo.py +0 -0
  303. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/repos/semantic/semantic_retrieval_repo.py +0 -0
  304. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/session.py +0 -0
  305. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/db/runtime/uow.py +0 -0
  306. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/embeddings/__init__.py +0 -0
  307. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/embeddings/local_provider.py +0 -0
  308. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/embeddings/prewarm.py +0 -0
  309. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/embeddings/query_vector_search.py +0 -0
  310. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/__init__.py +0 -0
  311. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/assets/__init__.py +0 -0
  312. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/assets/inspection.py +0 -0
  313. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/assets/managed_markdown.py +0 -0
  314. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/assets/managed_tree.py +0 -0
  315. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/assets/packaged_assets.py +0 -0
  316. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/assets/paths.py +0 -0
  317. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/assets/types.py +0 -0
  318. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/identity/__init__.py +0 -0
  319. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/identity/claude_runtime.py +0 -0
  320. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/identity/codex_runtime.py +0 -0
  321. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/identity/compatibility.py +0 -0
  322. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/identity/cursor_statusline.py +0 -0
  323. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/identity/resolver.py +0 -0
  324. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/inner_agents/__init__.py +0 -0
  325. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/transcripts/__init__.py +0 -0
  326. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/transcripts/claude_code.py +0 -0
  327. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/transcripts/codex.py +0 -0
  328. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/transcripts/cursor.py +0 -0
  329. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/transcripts/model_usage.py +0 -0
  330. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/transcripts/normalization.py +0 -0
  331. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/transcripts/session_selection.py +0 -0
  332. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/transcripts/source_discovery.py +0 -0
  333. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/host_apps/transcripts/tool_filter.py +0 -0
  334. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/local_state/__init__.py +0 -0
  335. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/local_state/init_lock.py +0 -0
  336. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/local_state/machine_config_store.py +0 -0
  337. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/local_state/operation_registration.py +0 -0
  338. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/local_state/paths.py +0 -0
  339. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/local_state/recall_mode_store.py +0 -0
  340. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/local_state/repo_registration_store.py +0 -0
  341. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/local_state/session_state_file_store.py +0 -0
  342. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/local_state/shadow_git_store.py +0 -0
  343. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/process/__init__.py +0 -0
  344. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/process/episode_sync/__init__.py +0 -0
  345. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/process/episode_sync/autostart.py +0 -0
  346. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/process/episode_sync/launcher.py +0 -0
  347. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/process/episode_sync/lock_file.py +0 -0
  348. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/process/episode_sync/poller.py +0 -0
  349. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/process/episode_sync/status_store.py +0 -0
  350. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/system/__init__.py +0 -0
  351. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/system/clock.py +0 -0
  352. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/system/id_generator.py +0 -0
  353. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/system/package_upgrade.py +0 -0
  354. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/telemetry/__init__.py +0 -0
  355. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/telemetry/inner_agent_records.py +0 -0
  356. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/telemetry/operation_invocations.py +0 -0
  357. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/telemetry/operation_polling.py +0 -0
  358. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/telemetry/read_records.py +0 -0
  359. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/telemetry/recall_records.py +0 -0
  360. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/telemetry/recorder.py +0 -0
  361. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/telemetry/records.py +0 -0
  362. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/telemetry/storage_protocols.py +0 -0
  363. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/infrastructure/telemetry/sync_records.py +0 -0
  364. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/settings/__init__.py +0 -0
  365. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/settings/defaults/read_policy.yaml +0 -0
  366. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/settings/defaults/runtime.yaml +0 -0
  367. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/settings/defaults/thresholds.yaml +0 -0
  368. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/__init__.py +0 -0
  369. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/admin_db.py +0 -0
  370. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/admin_dependencies.py +0 -0
  371. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/admin_diagnose.py +0 -0
  372. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/analytics.py +0 -0
  373. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/backup.py +0 -0
  374. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/config.py +0 -0
  375. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/db.py +0 -0
  376. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/dsn_resolution.py +0 -0
  377. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/embeddings.py +0 -0
  378. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/episode_poller.py +0 -0
  379. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/episode_sync_launcher.py +0 -0
  380. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/internal_agent_config.py +0 -0
  381. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/internal_agents.py +0 -0
  382. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/knowledge_builder.py +0 -0
  383. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/migrations.py +0 -0
  384. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/model_usage_backfill.py +0 -0
  385. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/read_policy.py +0 -0
  386. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/repo_context.py +0 -0
  387. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/repos.py +0 -0
  388. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/runtime_admin.py +0 -0
  389. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/runtime_context.py +0 -0
  390. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/snapshot_baseline.py +0 -0
  391. {shellbrain-0.1.57 → shellbrain-0.1.58}/app/startup/thresholds.py +0 -0
  392. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/__init__.py +0 -0
  393. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/_legacy_usage_views.py +0 -0
  394. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/_usage_view_sql.py +0 -0
  395. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/env.py +0 -0
  396. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260226_0001_initial_schema.py +0 -0
  397. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260312_0002_add_hard_invariants.py +0 -0
  398. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260312_0003_drop_create_confidence.py +0 -0
  399. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260313_0004_episode_sync_hardening.py +0 -0
  400. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260313_0005_evidence_episode_event_refs.py +0 -0
  401. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260318_0006_usage_telemetry_schema.py +0 -0
  402. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260319_0007_identity_session_guidance.py +0 -0
  403. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260320_0008_instance_metadata_and_backup_safety.py +0 -0
  404. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260410_0009_frontier_memory_family.py +0 -0
  405. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260414_0010_model_usage_telemetry.py +0 -0
  406. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260414_0011_usage_problem_tokens_multi_solution_metrics.py +0 -0
  407. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260415_0012_read_pack_cost_and_read_roi.py +0 -0
  408. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260421_0013_concept_context_graph.py +0 -0
  409. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260422_0014_concept_read_telemetry.py +0 -0
  410. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260422_0015_problem_runs.py +0 -0
  411. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260508_0016_recall_telemetry.py +0 -0
  412. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260511_0017_inner_agent_invocations.py +0 -0
  413. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260513_0018_knowledge_build_runs.py +0 -0
  414. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260515_0019_scenario_records.py +0 -0
  415. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260516_0020_knowledge_build_observability.py +0 -0
  416. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260519_0021_knowledge_build_watermark_stable.py +0 -0
  417. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260519_0022_update_evidence_links.py +0 -0
  418. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260519_0023_explicit_teach_trigger.py +0 -0
  419. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260519_0024_read_retrieval_latency_indexes.py +0 -0
  420. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260519_0025_repair_recall_source_input_section_constraint.py +0 -0
  421. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260519_0026_repair_knowledge_build_trigger_constraint.py +0 -0
  422. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260519_0027_concept_embeddings.py +0 -0
  423. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260520_0028_knowledge_build_lifecycle.py +0 -0
  424. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260522_0029_remove_frontier_and_memory_anchors.py +0 -0
  425. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260522_0030_concept_lifecycle_events.py +0 -0
  426. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260522_0031_unified_evidence_storage.py +0 -0
  427. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260522_0032_memory_lifecycle_events.py +0 -0
  428. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260522_0033_concept_memory_role_cleanup.py +0 -0
  429. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260522_0034_structural_memory_relations.py +0 -0
  430. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260522_0035_retire_legacy_compatibility_tables.py +0 -0
  431. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260526_0036_shadow_snapshots.py +0 -0
  432. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260606_0037_wiki_summaries.py +0 -0
  433. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260815_0038_drop_wiki_summaries.py +0 -0
  434. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/20260901_0039_drop_unused_schema.py +0 -0
  435. {shellbrain-0.1.57 → shellbrain-0.1.58}/migrations/versions/__init__.py +0 -0
  436. {shellbrain-0.1.57 → shellbrain-0.1.58}/onboarding_assets/__init__.py +0 -0
  437. {shellbrain-0.1.57 → shellbrain-0.1.58}/onboarding_assets/claude/CLAUDE.md +0 -0
  438. {shellbrain-0.1.57 → shellbrain-0.1.58}/onboarding_assets/claude/skills/shellbrain/SKILL.md +0 -0
  439. {shellbrain-0.1.57 → shellbrain-0.1.58}/onboarding_assets/claude/skills/shellbrain-usage-review/SKILL.md +0 -0
  440. {shellbrain-0.1.57 → shellbrain-0.1.58}/onboarding_assets/codex/AGENTS.md +0 -0
  441. {shellbrain-0.1.57 → shellbrain-0.1.58}/onboarding_assets/codex/shellbrain/SKILL.md +0 -0
  442. {shellbrain-0.1.57 → shellbrain-0.1.58}/onboarding_assets/codex/shellbrain/agents/openai.yaml +0 -0
  443. {shellbrain-0.1.57 → shellbrain-0.1.58}/onboarding_assets/codex/shellbrain/assets/shellbrain-large.svg +0 -0
  444. {shellbrain-0.1.57 → shellbrain-0.1.58}/onboarding_assets/codex/shellbrain/assets/shellbrain-small.svg +0 -0
  445. {shellbrain-0.1.57 → shellbrain-0.1.58}/onboarding_assets/codex/shellbrain/assets/shellbrain_logo.png +0 -0
  446. {shellbrain-0.1.57 → shellbrain-0.1.58}/onboarding_assets/codex/shellbrain/references/session-workflow.md +0 -0
  447. {shellbrain-0.1.57 → shellbrain-0.1.58}/onboarding_assets/codex/shellbrain-usage-review/SKILL.md +0 -0
  448. {shellbrain-0.1.57 → shellbrain-0.1.58}/onboarding_assets/codex/shellbrain-usage-review/agents/openai.yaml +0 -0
  449. {shellbrain-0.1.57 → shellbrain-0.1.58}/onboarding_assets/codex/shellbrain-usage-review/assets/shellbrain-small.svg +0 -0
  450. {shellbrain-0.1.57 → shellbrain-0.1.58}/onboarding_assets/codex/shellbrain-usage-review/assets/shellbrain_logo.png +0 -0
  451. {shellbrain-0.1.57 → shellbrain-0.1.58}/onboarding_assets/cursor/skills/shellbrain/SKILL.md +0 -0
  452. {shellbrain-0.1.57 → shellbrain-0.1.58}/onboarding_assets/cursor/skills/shellbrain-usage-review/SKILL.md +0 -0
  453. {shellbrain-0.1.57 → shellbrain-0.1.58}/setup.cfg +0 -0
  454. {shellbrain-0.1.57 → shellbrain-0.1.58}/shellbrain.egg-info/dependency_links.txt +0 -0
  455. {shellbrain-0.1.57 → shellbrain-0.1.58}/shellbrain.egg-info/entry_points.txt +0 -0
  456. {shellbrain-0.1.57 → shellbrain-0.1.58}/shellbrain.egg-info/requires.txt +0 -0
  457. {shellbrain-0.1.57 → shellbrain-0.1.58}/shellbrain.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shellbrain
3
- Version: 0.1.57
3
+ Version: 0.1.58
4
4
  Summary: Repo-scoped Shellbrain CLI with explicit evidence-backed writes.
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -20,7 +20,7 @@ Requires-Dist: sentence-transformers<4.0,>=3.0
20
20
 
21
21
  <p align="center">Long-term Memory for AI Agents.</p>
22
22
 
23
- ShellBrain gives AI agents memory, so they can store and reuse what they learn over time.
23
+ ShellBrain carries useful lessons from one agent task to the next. It preserves decision reasons, failed approaches, product direction, and preferences that the resulting code does not explain.
24
24
 
25
25
  ## Install
26
26
 
@@ -53,13 +53,13 @@ You can also run `curl -L shellbrain.ai/upgrade | bash`. Manual alternative: `pi
53
53
 
54
54
  ## Architecture
55
55
 
56
- ShellBrain builds memory in three grounded layers:
56
+ ShellBrain stores evidence and two forms of reusable knowledge:
57
57
 
58
58
  - **Episodic knowledge records evidence.** It stores prompts, agent steps, tool calls, and outputs from each session.
59
59
  - **Empirical knowledge extracts concrete memories.** It organizes problems, solutions, failed tactics, facts, preferences, and changes in a semantic graph for **case-based reasoning**.
60
60
  - **Conceptual knowledge abstracts reusable ideas.** Its concept graph connects claims, relations, and implementations to empirical knowledge.
61
61
 
62
- Each higher layer links to evidence in the layer below it. Agents receive a compact orientation first, then request more detail when needed.
62
+ Memories and concept claims link to supporting evidence. A concept can express a product principle without a duplicate memory. Current code remains the source of truth for implementation details.
63
63
 
64
64
  ---
65
65
 
@@ -98,7 +98,7 @@ shellbrain recall "What is ShellBrain, and how does it help a working coding age
98
98
  }
99
99
  ```
100
100
 
101
- The brief lets the working agent focus on the current task.
101
+ Recall selects an evidence pack in code, then asks an inner agent to summarize it. Source attribution comes from the selected records. Fast mode and provider failures return a brief directly from that same pack.
102
102
 
103
103
  ### Teach
104
104
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  <p align="center">Long-term Memory for AI Agents.</p>
8
8
 
9
- ShellBrain gives AI agents memory, so they can store and reuse what they learn over time.
9
+ ShellBrain carries useful lessons from one agent task to the next. It preserves decision reasons, failed approaches, product direction, and preferences that the resulting code does not explain.
10
10
 
11
11
  ## Install
12
12
 
@@ -39,13 +39,13 @@ You can also run `curl -L shellbrain.ai/upgrade | bash`. Manual alternative: `pi
39
39
 
40
40
  ## Architecture
41
41
 
42
- ShellBrain builds memory in three grounded layers:
42
+ ShellBrain stores evidence and two forms of reusable knowledge:
43
43
 
44
44
  - **Episodic knowledge records evidence.** It stores prompts, agent steps, tool calls, and outputs from each session.
45
45
  - **Empirical knowledge extracts concrete memories.** It organizes problems, solutions, failed tactics, facts, preferences, and changes in a semantic graph for **case-based reasoning**.
46
46
  - **Conceptual knowledge abstracts reusable ideas.** Its concept graph connects claims, relations, and implementations to empirical knowledge.
47
47
 
48
- Each higher layer links to evidence in the layer below it. Agents receive a compact orientation first, then request more detail when needed.
48
+ Memories and concept claims link to supporting evidence. A concept can express a product principle without a duplicate memory. Current code remains the source of truth for implementation details.
49
49
 
50
50
  ---
51
51
 
@@ -84,7 +84,7 @@ shellbrain recall "What is ShellBrain, and how does it help a working coding age
84
84
  }
85
85
  ```
86
86
 
87
- The brief lets the working agent focus on the current task.
87
+ Recall selects an evidence pack in code, then asks an inner agent to summarize it. Source attribution comes from the selected records. Fast mode and provider failures return a brief directly from that same pack.
88
88
 
89
89
  ### Teach
90
90
 
@@ -15,7 +15,7 @@ InnerAgentName = Literal["build_context", "build_knowledge", "teach"]
15
15
  InnerAgentProviderName = str
16
16
  InnerAgentReasoningLevel = Literal["none", "minimal", "low", "medium", "high", "xhigh"]
17
17
  BuildContextStrategy = Literal[
18
- "deterministic_synthesis", "deterministic_only", "autonomous"
18
+ "deterministic_synthesis", "deterministic_only"
19
19
  ]
20
20
  TokenCaptureQuality = Literal["exact", "estimated"]
21
21
  InnerAgentRunStatus = Literal[
@@ -36,7 +36,6 @@ class BuildContextSettings(_StrictModel):
36
36
  model: str = Field(min_length=1)
37
37
  reasoning: InnerAgentReasoningLevel
38
38
  timeout_seconds: int = Field(ge=1, le=600)
39
- max_private_reads: int = Field(default=0, ge=0, le=10)
40
39
  max_brief_tokens: int | None = Field(default=None, ge=1, le=100_000)
41
40
 
42
41
 
@@ -89,28 +89,8 @@ class ReadPolicySettings:
89
89
  }
90
90
 
91
91
 
92
- @dataclass(frozen=True)
93
- class CreatePolicySettings:
94
- """Create-policy validation and hydration settings."""
95
-
96
- gates: tuple[str, ...]
97
- defaults: Mapping[str, Any]
98
-
99
- def hydration_defaults(self) -> dict[str, Any]:
100
- return dict(self.defaults)
101
-
102
- def to_dict(self) -> dict[str, Any]:
103
- return {"gates": list(self.gates), "defaults": dict(self.defaults)}
104
-
105
92
 
106
- @dataclass(frozen=True)
107
- class UpdatePolicySettings:
108
- """Update-policy validation settings."""
109
93
 
110
- gates: tuple[str, ...]
111
-
112
- def to_dict(self) -> dict[str, Any]:
113
- return {"gates": list(self.gates)}
114
94
 
115
95
 
116
96
  @dataclass(frozen=True)
@@ -24,15 +24,6 @@ LIFECYCLE_RETRIEVAL_MULTIPLIERS: Mapping[str, float] = {
24
24
  status.value: status.retrieval_multiplier for status in MemoryLifecycleStatus
25
25
  }
26
26
 
27
- BUNDLE_FRESHNESS_MULTIPLIERS: Mapping[str, float] = {
28
- ACTIVE_STATUS: 1.0,
29
- MAYBE_STALE_STATUS: 0.75,
30
- STALE_STATUS: 0.45,
31
- SUPERSEDED_STATUS: 0.0,
32
- WRONG_STATUS: 0.0,
33
- ARCHIVED_STATUS: 0.0,
34
- }
35
-
36
27
  CONCEPT_MEMORY_HIGH_SIGNAL_ROLES = frozenset(
37
28
  {
38
29
  "solution_for",
@@ -52,13 +43,6 @@ STRUCTURAL_FACT_UPDATE_RELATION_PREDICATES = (
52
43
 
53
44
  REVERSIBLE_ASSOCIATION_RELATION_TYPES = frozenset({"associated_with"})
54
45
 
55
- _STATUS_PRECEDENCE = (
56
- WRONG_STATUS,
57
- ARCHIVED_STATUS,
58
- SUPERSEDED_STATUS,
59
- STALE_STATUS,
60
- MAYBE_STALE_STATUS,
61
- )
62
46
  _STRUCTURAL_EXPANSION_BY_PREDICATE = {
63
47
  "solved_by": "problem_attempt",
64
48
  "failed_with": "problem_attempt",
@@ -85,6 +69,8 @@ def lifecycle_retrieval_multiplier(status: Any) -> float:
85
69
  """Return the default positive retrieval multiplier for one lifecycle status."""
86
70
 
87
71
  return LIFECYCLE_RETRIEVAL_MULTIPLIERS[normalize_lifecycle_status(status)]
72
+
73
+
88
74
  def is_active_lifecycle(status: Any) -> bool:
89
75
  """Return whether a lifecycle status is active."""
90
76
 
@@ -109,22 +95,6 @@ def lifecycle_status_counts(statuses: Iterable[Any]) -> dict[str, int]:
109
95
  }
110
96
 
111
97
 
112
- def dominant_lifecycle_status(statuses: Iterable[Any]) -> str:
113
- """Return the status that should dominate currentness interpretation."""
114
-
115
- normalized = tuple(normalize_lifecycle_status(status) for status in statuses)
116
- for status in _STATUS_PRECEDENCE:
117
- if status in normalized:
118
- return status
119
- return ACTIVE_STATUS
120
-
121
-
122
- def concept_bundle_retrieval_multiplier(statuses: Iterable[Any]) -> float:
123
- """Return the freshness multiplier for an aggregate concept bundle."""
124
-
125
- return BUNDLE_FRESHNESS_MULTIPLIERS[dominant_lifecycle_status(statuses)]
126
-
127
-
128
98
  def bundle_lifecycle_statuses(bundle: Mapping[str, Any]) -> tuple[str, ...]:
129
99
  """Return lifecycle status values across every truth-bearing concept facet."""
130
100
 
@@ -135,23 +105,6 @@ def bundle_lifecycle_statuses(bundle: Mapping[str, Any]) -> tuple[str, ...]:
135
105
  )
136
106
 
137
107
 
138
- def aggregate_currentness_payload(
139
- statuses: Iterable[Any], *, record_label: str
140
- ) -> dict[str, str]:
141
- """Return currentness text for a group of truth-bearing records."""
142
-
143
- status = dominant_lifecycle_status(statuses)
144
- if status == ACTIVE_STATUS:
145
- return {
146
- "currentness": "current",
147
- "temporal_reason": f"all included {record_label} are active",
148
- }
149
- return {
150
- "currentness": status,
151
- "temporal_reason": f"one or more {record_label} are marked {status}",
152
- }
153
-
154
-
155
108
  def lifecycle_currentness_payload(
156
109
  lifecycle: Any, *, active_reason: str, validated_reason: str
157
110
  ) -> dict[str, str]:
@@ -211,7 +164,9 @@ def structural_relation_expansion_type(predicate: Any) -> str:
211
164
  try:
212
165
  return _STRUCTURAL_EXPANSION_BY_PREDICATE[value]
213
166
  except KeyError as exc:
214
- raise ValueError(f"unsupported structural memory relation predicate: {value}") from exc
167
+ raise ValueError(
168
+ f"unsupported structural memory relation predicate: {value}"
169
+ ) from exc
215
170
 
216
171
 
217
172
  def why_included_for_expansion(expansion_type: str) -> str:
@@ -31,12 +31,10 @@ class InnerAgentRunRequest(_StrictModel):
31
31
  model: str = Field(min_length=1)
32
32
  reasoning: InnerAgentReasoningLevel
33
33
  timeout_seconds: int = Field(ge=1, le=600)
34
- max_private_reads: int = Field(default=0, ge=0, le=10)
35
34
  max_brief_tokens: int | None = Field(default=None, ge=1, le=100_000)
36
35
  query: str = Field(min_length=1)
37
36
  repo_root: str | None = None
38
- synthesis_only: bool = False
39
- deterministic_pack: dict[str, Any] | None = None
37
+ deterministic_pack: dict[str, Any]
40
38
 
41
39
 
42
40
  class InnerAgentRunResult(_StrictModel):
@@ -61,7 +59,6 @@ class InnerAgentRunResult(_StrictModel):
61
59
  concept_expansion_count: int = Field(default=0, ge=0)
62
60
  error_code: str | None = None
63
61
  error_message: str | None = None
64
- read_trace: dict[str, Any] = Field(default_factory=dict)
65
62
 
66
63
 
67
64
  class BuildKnowledgeAgentRequest(_StrictModel):
@@ -6,7 +6,7 @@ from app.core.errors import DomainValidationError, ErrorCode, ErrorDetail
6
6
  from app.core.ports.db.unit_of_work import IUnitOfWork
7
7
  from app.core.use_cases.concepts.show.request import ConceptShowRequest
8
8
  from app.core.use_cases.concepts.show.result import ConceptShowResult
9
- from app.core.use_cases.concepts.views import serialize_concept_bundle
9
+ from app.core.use_cases.concepts.views import serialize_concept_show
10
10
 
11
11
 
12
12
  def show_concept(request: ConceptShowRequest, uow: IUnitOfWork) -> ConceptShowResult:
@@ -27,6 +27,31 @@ def show_concept(request: ConceptShowRequest, uow: IUnitOfWork) -> ConceptShowRe
27
27
  )
28
28
  ]
29
29
  )
30
+ include = set(request.include)
31
+ endpoint_ids = {
32
+ concept_id
33
+ for relation in bundle["relations"]
34
+ if "relations" in include
35
+ for concept_id in (relation.subject_concept_id, relation.object_concept_id)
36
+ }
37
+ memory_ids = {
38
+ link.memory_id for link in bundle["memory_links"] if "memory_links" in include
39
+ }
40
+ related_concepts = (
41
+ uow.concepts.list_concepts_by_ids(
42
+ repo_id=request.repo_id, concept_ids=sorted(endpoint_ids)
43
+ )
44
+ if endpoint_ids
45
+ else []
46
+ )
47
+ related_memories = (
48
+ uow.memories.list_by_ids(sorted(memory_ids)) if memory_ids else []
49
+ )
30
50
  return ConceptShowResult(
31
- concept=serialize_concept_bundle(bundle, include=set(request.include))
51
+ concept=serialize_concept_show(
52
+ bundle,
53
+ include=include,
54
+ related_concepts={concept.id: concept for concept in related_concepts},
55
+ related_memories={memory.id: memory for memory in related_memories},
56
+ )
32
57
  )
@@ -12,6 +12,7 @@ ConceptShowIncludeValue = Literal[
12
12
  "relations",
13
13
  "groundings",
14
14
  "memory_links",
15
+ "evidence",
15
16
  "lifecycle_events",
16
17
  "preview_concept",
17
18
  ]
@@ -18,6 +18,8 @@ from app.core.entities.concepts import (
18
18
  ConceptRelation,
19
19
  )
20
20
 
21
+ from app.core.entities.memories import Memory
22
+
21
23
 
22
24
  def serialize_concept_bundle(
23
25
  bundle: dict[str, Any], *, include: set[str]
@@ -61,6 +63,8 @@ def serialize_concept_bundle(
61
63
  payload["groundings"] = groundings
62
64
  if "memory_links" in include:
63
65
  payload["memory_links"] = memory_links
66
+ if "evidence" in include:
67
+ payload["evidence"] = _evidence_payloads(bundle)
64
68
  if "lifecycle_events" in include:
65
69
  payload["lifecycle_events"] = _lifecycle_event_payloads(
66
70
  bundle["lifecycle_events"],
@@ -84,6 +88,62 @@ def serialize_concept_bundle(
84
88
  return payload
85
89
 
86
90
 
91
+ def serialize_concept_show(
92
+ bundle: dict[str, Any],
93
+ *,
94
+ include: set[str],
95
+ related_concepts: dict[str, Concept],
96
+ related_memories: dict[str, Memory],
97
+ ) -> dict[str, Any]:
98
+ """Add readable relation endpoints and linked memories to requested facets."""
99
+
100
+ payload = serialize_concept_bundle(bundle, include=include)
101
+ for relation in payload.get("relations", []):
102
+ for side in ("subject", "object"):
103
+ concept = related_concepts[relation[f"{side}_concept_id"]]
104
+ relation[side] = {
105
+ "id": concept.id,
106
+ "ref": concept.slug,
107
+ "name": concept.name,
108
+ "kind": concept.kind.value,
109
+ }
110
+ for link in payload.get("memory_links", []):
111
+ memory = related_memories[link["memory_id"]]
112
+ link.update(
113
+ kind=memory.kind.value,
114
+ text=memory.text,
115
+ memory_status=memory.status.value,
116
+ memory_created_at=_iso(memory.created_at),
117
+ )
118
+ return payload
119
+
120
+
121
+ def _evidence_payloads(bundle: dict[str, Any]) -> list[dict[str, Any]]:
122
+ return [
123
+ {
124
+ "id": evidence.id,
125
+ "target_type": evidence.target_type.value,
126
+ "target_id": evidence.target_id,
127
+ "kind": evidence.evidence_kind.value,
128
+ "anchor_id": evidence.anchor_id,
129
+ "memory_id": evidence.memory_id,
130
+ "commit_ref": evidence.commit_ref,
131
+ "transcript_ref": evidence.transcript_ref,
132
+ "note": evidence.note,
133
+ "created_at": _iso(evidence.created_at),
134
+ }
135
+ for evidence in sorted(
136
+ bundle["evidence"],
137
+ key=lambda item: (
138
+ item.target_type.value,
139
+ item.target_id,
140
+ item.evidence_kind.value,
141
+ item.id,
142
+ ),
143
+ )
144
+ ]
145
+
146
+
87
147
  def _alias_to_payload(alias) -> dict[str, Any]:
88
148
  return {
89
149
  "alias": alias.alias,
@@ -124,7 +184,7 @@ def _grounding_to_payload(
124
184
  "concept_id": grounding.concept_id,
125
185
  "role": grounding.role.value,
126
186
  "anchor_id": grounding.anchor_id,
127
- "anchor": anchors_by_id.get(grounding.anchor_id),
187
+ "anchor": anchors_by_id[grounding.anchor_id],
128
188
  "created_at": _iso(grounding.created_at),
129
189
  "updated_at": _iso(grounding.updated_at),
130
190
  **_lifecycle_payload(grounding.lifecycle),
@@ -213,9 +273,7 @@ def _lifecycle_event_payloads(
213
273
  "actor": event.actor.value,
214
274
  "superseded_by_id": event.superseded_by_id,
215
275
  "created_at": _iso(event.created_at),
216
- "evidence_count": evidence_counts.get(
217
- f"lifecycle_event:{event.id}", 0
218
- ),
276
+ "evidence_count": evidence_counts.get(f"lifecycle_event:{event.id}", 0),
219
277
  }
220
278
  for event in sorted(
221
279
  events, key=lambda item: (_iso(item.created_at) or "", item.id)
@@ -3,7 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  from collections.abc import Callable
6
- from datetime import datetime, timedelta
6
+ from datetime import datetime
7
7
 
8
8
  from app.core.entities.inner_agents import BuildKnowledgeSettings
9
9
  from app.core.entities.knowledge_builder import (
@@ -11,6 +11,7 @@ from app.core.entities.knowledge_builder import (
11
11
  KnowledgeBuildRunStatus,
12
12
  )
13
13
  from app.core.ports.db.unit_of_work import IUnitOfWork
14
+ from app.core.use_cases.knowledge_builder.runs import has_running_build
14
15
  from app.core.ports.host_apps.inner_agents import (
15
16
  BuildKnowledgeAgentRequest,
16
17
  BuildKnowledgeAgentResult,
@@ -79,42 +80,20 @@ def execute_build_knowledge(
79
80
  previous_event_watermark=previous_watermark,
80
81
  error_code="no_new_events",
81
82
  )
82
- running_runs = uow.knowledge_build_runs.list_running_runs(
83
+ if has_running_build(
84
+ uow.knowledge_build_runs,
83
85
  repo_id=request.repo_id,
84
86
  episode_id=request.episode_id,
85
- )
86
- fresh_running_run = _fresh_running_run(
87
- running_runs=running_runs,
88
87
  now=now,
89
88
  stale_seconds=settings.running_run_stale_seconds,
90
- )
91
- if fresh_running_run is not None:
89
+ error_message="running build_knowledge run exceeded stale timeout",
90
+ ):
92
91
  return _skipped_result(
93
92
  settings=settings,
94
93
  event_watermark=event_watermark,
95
94
  previous_event_watermark=previous_watermark,
96
95
  error_code="build_already_running",
97
96
  )
98
- for stale_run in running_runs:
99
- uow.knowledge_build_runs.complete(
100
- run_id=stale_run.id,
101
- status=KnowledgeBuildRunStatus.TIMEOUT,
102
- write_count=stale_run.write_count,
103
- skipped_item_count=stale_run.skipped_item_count,
104
- input_tokens=stale_run.input_tokens,
105
- output_tokens=stale_run.output_tokens,
106
- reasoning_output_tokens=stale_run.reasoning_output_tokens,
107
- cached_input_tokens_total=stale_run.cached_input_tokens_total,
108
- cache_read_input_tokens=stale_run.cache_read_input_tokens,
109
- cache_creation_input_tokens=stale_run.cache_creation_input_tokens,
110
- capture_quality=stale_run.capture_quality,
111
- run_summary=stale_run.run_summary,
112
- error_code="stale_running_run",
113
- error_message="running build_knowledge run exceeded stale timeout",
114
- read_trace=stale_run.read_trace,
115
- code_trace=stale_run.code_trace,
116
- finished_at=now,
117
- )
118
97
 
119
98
  if request.baseline_only and previous_watermark is None:
120
99
  return _record_baseline_run(
@@ -155,43 +134,29 @@ def execute_build_knowledge(
155
134
  with uow_factory() as uow:
156
135
  uow.knowledge_build_runs.complete(
157
136
  run_id=run_id,
158
- status=provider_result.status,
159
- write_count=provider_result.write_count,
160
- skipped_item_count=provider_result.skipped_item_count,
161
- input_tokens=provider_result.input_tokens,
162
- output_tokens=provider_result.output_tokens,
163
- reasoning_output_tokens=provider_result.reasoning_output_tokens,
164
- cached_input_tokens_total=provider_result.cached_input_tokens_total,
165
- cache_read_input_tokens=provider_result.cache_read_input_tokens,
166
- cache_creation_input_tokens=provider_result.cache_creation_input_tokens,
167
- capture_quality=provider_result.capture_quality,
168
- run_summary=provider_result.run_summary,
169
- error_code=provider_result.error_code,
170
- error_message=provider_result.error_message,
171
- read_trace=provider_result.read_trace,
172
- code_trace=provider_result.code_trace,
137
+ **provider_result.model_dump(
138
+ exclude={
139
+ "provider",
140
+ "model",
141
+ "reasoning",
142
+ "timeout_seconds",
143
+ "duration_ms",
144
+ }
145
+ ),
173
146
  finished_at=clock.now(),
174
147
  )
175
148
  return BuildKnowledgeResult(
176
- status=provider_result.status,
149
+ **provider_result.model_dump(
150
+ exclude={
151
+ "timeout_seconds",
152
+ "duration_ms",
153
+ "read_trace",
154
+ "code_trace",
155
+ }
156
+ ),
177
157
  run_id=run_id,
178
158
  event_watermark=event_watermark,
179
159
  previous_event_watermark=previous_watermark,
180
- provider=provider_result.provider,
181
- model=provider_result.model,
182
- reasoning=provider_result.reasoning,
183
- write_count=provider_result.write_count,
184
- skipped_item_count=provider_result.skipped_item_count,
185
- input_tokens=provider_result.input_tokens,
186
- output_tokens=provider_result.output_tokens,
187
- reasoning_output_tokens=provider_result.reasoning_output_tokens,
188
- cached_input_tokens_total=provider_result.cached_input_tokens_total,
189
- cache_read_input_tokens=provider_result.cache_read_input_tokens,
190
- cache_creation_input_tokens=provider_result.cache_creation_input_tokens,
191
- capture_quality=provider_result.capture_quality,
192
- run_summary=provider_result.run_summary,
193
- error_code=provider_result.error_code,
194
- error_message=provider_result.error_message,
195
160
  )
196
161
 
197
162
 
@@ -247,21 +212,6 @@ def _run_provider(
247
212
  )
248
213
 
249
214
 
250
- def _fresh_running_run(
251
- *,
252
- running_runs: tuple[KnowledgeBuildRun, ...],
253
- now: datetime,
254
- stale_seconds: int,
255
- ) -> KnowledgeBuildRun | None:
256
- """Return a fresh running row when any active run is still inside its lease."""
257
-
258
- stale_before = now - timedelta(seconds=stale_seconds)
259
- for run in running_runs:
260
- if run.started_at is None or run.started_at > stale_before:
261
- return run
262
- return None
263
-
264
-
265
215
  def _record_baseline_run(
266
216
  *,
267
217
  request: BuildKnowledgeRequest,
@@ -0,0 +1,46 @@
1
+ """Shared lease handling for teaching and session consolidation."""
2
+
3
+ from datetime import datetime, timedelta
4
+
5
+ from app.core.entities.knowledge_builder import KnowledgeBuildRunStatus
6
+ from app.core.ports.db.knowledge_builder import IKnowledgeBuildRunsRepo
7
+
8
+
9
+ def has_running_build(
10
+ repo: IKnowledgeBuildRunsRepo,
11
+ *,
12
+ repo_id: str,
13
+ episode_id: str,
14
+ now: datetime,
15
+ stale_seconds: int,
16
+ error_message: str,
17
+ ) -> bool:
18
+ """Keep fresh runs and finalize expired runs under the caller's episode lock."""
19
+
20
+ running_runs = repo.list_running_runs(repo_id=repo_id, episode_id=episode_id)
21
+ stale_before = now - timedelta(seconds=stale_seconds)
22
+ if any(
23
+ run.started_at is None or run.started_at > stale_before for run in running_runs
24
+ ):
25
+ return True
26
+ for stale_run in running_runs:
27
+ repo.complete(
28
+ run_id=stale_run.id,
29
+ status=KnowledgeBuildRunStatus.TIMEOUT,
30
+ write_count=stale_run.write_count,
31
+ skipped_item_count=stale_run.skipped_item_count,
32
+ input_tokens=stale_run.input_tokens,
33
+ output_tokens=stale_run.output_tokens,
34
+ reasoning_output_tokens=stale_run.reasoning_output_tokens,
35
+ cached_input_tokens_total=stale_run.cached_input_tokens_total,
36
+ cache_read_input_tokens=stale_run.cache_read_input_tokens,
37
+ cache_creation_input_tokens=stale_run.cache_creation_input_tokens,
38
+ capture_quality=stale_run.capture_quality,
39
+ run_summary=stale_run.run_summary,
40
+ error_code="stale_running_run",
41
+ error_message=error_message,
42
+ read_trace=stale_run.read_trace,
43
+ code_trace=stale_run.code_trace,
44
+ finished_at=now,
45
+ )
46
+ return False