htm 0.0.32 → 0.1.0

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 (580) hide show
  1. checksums.yaml +4 -4
  2. data/.architecture/decisions/adrs/005-rag-based-retrieval-with-hybrid-search.md +4 -0
  3. data/.architecture/decisions/adrs/017-bitemporal-event-time.md +78 -0
  4. data/.architecture/decisions/adrs/018-memory-timelines-and-node-links.md +64 -0
  5. data/.architecture/decisions/adrs/019-epistemic-status.md +66 -0
  6. data/.claude.json +11 -0
  7. data/.envrc +9 -7
  8. data/.irbrc +14 -14
  9. data/.reek.yml +104 -0
  10. data/.rubocop.yml +0 -11
  11. data/.ruby-version +1 -0
  12. data/CHANGELOG.md +160 -98
  13. data/README.md +22 -17
  14. data/SETUP.md +49 -46
  15. data/_typos.toml +17 -0
  16. data/bin/htm +18 -0
  17. data/db/migrate/00010_convert_embedding_to_sparsevec.rb +47 -0
  18. data/db/migrate/00011_strip_frontmatter_from_chunks.rb +66 -0
  19. data/db/migrate/00012_add_event_time_to_nodes.rb +110 -0
  20. data/db/migrate/00013_create_node_links.rb +158 -0
  21. data/db/migrate/00014_add_epistemic_status.rb +110 -0
  22. data/db/schema.sql +238 -7
  23. data/db/seed_data/README.md +11 -11
  24. data/db/seeds.rb +11 -11
  25. data/docs/api/database.md +8 -8
  26. data/docs/api/embedding-service.md +138 -262
  27. data/docs/api/htm.md +128 -12
  28. data/docs/api/index.md +8 -8
  29. data/docs/api/long-term-memory.md +8 -19
  30. data/docs/api/working-memory.md +34 -46
  31. data/docs/api/yard/HTM/Admin/Console.md +53 -0
  32. data/docs/api/yard/HTM/Admin/DatabaseCommands/Console.md +38 -0
  33. data/docs/api/yard/HTM/Admin/DatabaseCommands.md +127 -0
  34. data/docs/api/yard/HTM/Admin/EnrichCommands.md +85 -0
  35. data/docs/api/yard/HTM/Admin/Error.md +9 -0
  36. data/docs/api/yard/HTM/Admin/FileCommands/Console.md +50 -0
  37. data/docs/api/yard/HTM/Admin/FileCommands.md +83 -0
  38. data/docs/api/yard/HTM/Admin/MemoryCommands/Base.md +17 -0
  39. data/docs/api/yard/HTM/Admin/MemoryCommands/Edit.md +74 -0
  40. data/docs/api/yard/HTM/Admin/MemoryCommands/Search.md +77 -0
  41. data/docs/api/yard/HTM/Admin/MemoryCommands/TagSearch.md +46 -0
  42. data/docs/api/yard/HTM/Admin/MemoryCommands/WorkingMemory.md +36 -0
  43. data/docs/api/yard/HTM/Admin/MemoryCommands.md +67 -0
  44. data/docs/api/yard/HTM/Admin/TagCommands/Console.md +48 -0
  45. data/docs/api/yard/HTM/Admin/TagCommands.md +105 -0
  46. data/docs/api/yard/HTM/Admin/TagGraph.md +149 -0
  47. data/docs/api/yard/HTM/Admin/YardDocs.md +60 -0
  48. data/docs/api/yard/HTM/Admin.md +102 -0
  49. data/docs/api/yard/HTM/AuthorizationError.md +6 -6
  50. data/docs/api/yard/HTM/CLI/ConfigFile.md +40 -0
  51. data/docs/api/yard/HTM/CLI/Db.md +63 -0
  52. data/docs/api/yard/HTM/CLI/Enrich.md +39 -0
  53. data/docs/api/yard/HTM/CLI/ErrorSuggestion.md +56 -0
  54. data/docs/api/yard/HTM/CLI/Files.md +36 -0
  55. data/docs/api/yard/HTM/CLI/Group/ClassMethods.md +11 -0
  56. data/docs/api/yard/HTM/CLI/Group.md +13 -0
  57. data/docs/api/yard/HTM/CLI/MemoryCommand/ClassMethods.md +20 -0
  58. data/docs/api/yard/HTM/CLI/MemoryCommand.md +9 -0
  59. data/docs/api/yard/HTM/CLI/Robots.md +31 -0
  60. data/docs/api/yard/HTM/CLI/Support.md +9 -0
  61. data/docs/api/yard/HTM/CLI/Tags.md +57 -0
  62. data/docs/api/yard/HTM/CLI/WorkingMemory.md +24 -0
  63. data/docs/api/yard/HTM/CLI.md +84 -0
  64. data/docs/api/yard/HTM/CircuitBreaker/Guarded.md +29 -0
  65. data/docs/api/yard/HTM/CircuitBreaker/Settings.md +21 -0
  66. data/docs/api/yard/HTM/CircuitBreaker/Status.md +42 -0
  67. data/docs/api/yard/HTM/CircuitBreaker.md +54 -49
  68. data/docs/api/yard/HTM/CircuitBreakerOpenError.md +9 -9
  69. data/docs/api/yard/HTM/Config/Builder.md +87 -0
  70. data/docs/api/yard/HTM/Config/Coercion.md +59 -0
  71. data/docs/api/yard/HTM/Config/Database.md +102 -0
  72. data/docs/api/yard/HTM/Config/Readers.md +30 -0
  73. data/docs/api/yard/HTM/Config/RubyLlmSettings.md +32 -0
  74. data/docs/api/yard/HTM/Config/Validator.md +59 -0
  75. data/docs/api/yard/HTM/Config.md +224 -105
  76. data/docs/api/yard/HTM/ConfigurationError.md +20 -0
  77. data/docs/api/yard/HTM/Confirmation.md +22 -0
  78. data/docs/api/yard/HTM/Database/Connection.md +26 -0
  79. data/docs/api/yard/HTM/Database/Migrations.md +32 -0
  80. data/docs/api/yard/HTM/Database/Report.md +26 -0
  81. data/docs/api/yard/HTM/Database/SchemaFile.md +52 -0
  82. data/docs/api/yard/HTM/Database/Teardown.md +15 -0
  83. data/docs/api/yard/HTM/Database.md +58 -70
  84. data/docs/api/yard/HTM/DatabaseDocs.md +67 -0
  85. data/docs/api/yard/HTM/DatabaseError.md +6 -6
  86. data/docs/api/yard/HTM/Deletion.md +32 -0
  87. data/docs/api/yard/HTM/EmbeddingError.md +6 -6
  88. data/docs/api/yard/HTM/EmbeddingService.md +37 -38
  89. data/docs/api/yard/HTM/Epistemics.md +135 -0
  90. data/docs/api/yard/HTM/Error.md +6 -6
  91. data/docs/api/yard/HTM/EventTime.md +110 -0
  92. data/docs/api/yard/HTM/FileMemory.md +76 -0
  93. data/docs/api/yard/HTM/InputValidator.md +82 -0
  94. data/docs/api/yard/HTM/JobAdapter/Job.md +26 -0
  95. data/docs/api/yard/HTM/JobAdapter.md +35 -16
  96. data/docs/api/yard/HTM/Jobs/FailureLogging.md +14 -0
  97. data/docs/api/yard/HTM/Jobs/GenerateEmbeddingJob.md +16 -0
  98. data/docs/api/yard/HTM/Jobs/GeneratePropositionsJob.md +17 -0
  99. data/docs/api/yard/HTM/Jobs/GenerateRelationshipsJob.md +26 -0
  100. data/docs/api/yard/HTM/Jobs/GenerateTagsJob.md +17 -0
  101. data/docs/api/yard/HTM/Jobs/LlmCallTimer.md +58 -0
  102. data/docs/api/yard/HTM/Jobs/NodeLookup.md +14 -0
  103. data/docs/api/yard/HTM/Jobs.md +13 -0
  104. data/docs/api/yard/HTM/Loaders/ChunkSync/Chunk.md +22 -0
  105. data/docs/api/yard/HTM/Loaders/ChunkSync.md +50 -0
  106. data/docs/api/yard/HTM/Loaders/MarkdownChunker/Coalescer.md +24 -0
  107. data/docs/api/yard/HTM/Loaders/MarkdownChunker/Packer.md +20 -0
  108. data/docs/api/yard/HTM/Loaders/MarkdownChunker/Splitter.md +18 -0
  109. data/docs/api/yard/HTM/Loaders/MarkdownChunker.md +83 -0
  110. data/docs/api/yard/HTM/Loaders/MarkdownLoader/Document.md +43 -0
  111. data/docs/api/yard/HTM/Loaders/MarkdownLoader.md +62 -0
  112. data/docs/api/yard/HTM/Loaders.md +5 -0
  113. data/docs/api/yard/HTM/LongTermMemory/FulltextSearch.md +36 -0
  114. data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfMerger.md +25 -0
  115. data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfRows.md +30 -0
  116. data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfSql/Query.md +79 -0
  117. data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfSql/Source.md +45 -0
  118. data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfSql.md +11 -0
  119. data/docs/api/yard/HTM/LongTermMemory/HybridSearch/TagDepth.md +52 -0
  120. data/docs/api/yard/HTM/LongTermMemory/HybridSearch.md +52 -0
  121. data/docs/api/yard/HTM/LongTermMemory/NodeOperations.md +95 -0
  122. data/docs/api/yard/HTM/LongTermMemory/RelevanceScorer/HierarchicalJaccard.md +58 -0
  123. data/docs/api/yard/HTM/LongTermMemory/RelevanceScorer/TagSearch.md +27 -0
  124. data/docs/api/yard/HTM/LongTermMemory/RelevanceScorer.md +81 -0
  125. data/docs/api/yard/HTM/LongTermMemory/RobotOperations.md +22 -0
  126. data/docs/api/yard/HTM/LongTermMemory/TagOperations/ExpiringValue.md +24 -0
  127. data/docs/api/yard/HTM/LongTermMemory/TagOperations/TagMatchSql.md +40 -0
  128. data/docs/api/yard/HTM/LongTermMemory/TagOperations.md +129 -0
  129. data/docs/api/yard/HTM/LongTermMemory/VectorSearch.md +30 -0
  130. data/docs/api/yard/HTM/LongTermMemory.md +279 -31
  131. data/docs/api/yard/HTM/MCP/AssembleContextTool.md +16 -0
  132. data/docs/api/yard/HTM/MCP/ClearGroupWorkingMemoryTool.md +12 -0
  133. data/docs/api/yard/HTM/MCP/ClearWorkingMemoryTool.md +12 -0
  134. data/docs/api/yard/HTM/MCP/ConfigResource.md +12 -0
  135. data/docs/api/yard/HTM/MCP/ConfirmTool.md +12 -0
  136. data/docs/api/yard/HTM/MCP/CreateGroupTool.md +12 -0
  137. data/docs/api/yard/HTM/MCP/EnrichPendingTool.md +16 -0
  138. data/docs/api/yard/HTM/MCP/ExtractPropositionsTool.md +12 -0
  139. data/docs/api/yard/HTM/MCP/FailoverTool.md +12 -0
  140. data/docs/api/yard/HTM/MCP/FileInfoTool.md +13 -0
  141. data/docs/api/yard/HTM/MCP/FileSourcesResource.md +12 -0
  142. data/docs/api/yard/HTM/MCP/FileSupport.md +7 -0
  143. data/docs/api/yard/HTM/MCP/FindByTopicTool.md +12 -0
  144. data/docs/api/yard/HTM/MCP/FirstMentionTool.md +12 -0
  145. data/docs/api/yard/HTM/MCP/ForgetContentTool.md +12 -0
  146. data/docs/api/yard/HTM/MCP/ForgetTool.md +12 -0
  147. data/docs/api/yard/HTM/MCP/GetGroupStatusTool.md +12 -0
  148. data/docs/api/yard/HTM/MCP/GetGroupWorkingMemoryTool.md +12 -0
  149. data/docs/api/yard/HTM/MCP/GetNodeTool.md +12 -0
  150. data/docs/api/yard/HTM/MCP/GetRobotTool.md +12 -0
  151. data/docs/api/yard/HTM/MCP/GetWorkingMemoryTool.md +12 -0
  152. data/docs/api/yard/HTM/MCP/GroupRecallTool.md +12 -0
  153. data/docs/api/yard/HTM/MCP/GroupRememberTool.md +12 -0
  154. data/docs/api/yard/HTM/MCP/GroupSession.md +23 -0
  155. data/docs/api/yard/HTM/MCP/JoinGroupTool.md +12 -0
  156. data/docs/api/yard/HTM/MCP/LeaveGroupTool.md +12 -0
  157. data/docs/api/yard/HTM/MCP/ListDeletedTool.md +12 -0
  158. data/docs/api/yard/HTM/MCP/ListFilesTool.md +13 -0
  159. data/docs/api/yard/HTM/MCP/ListGroupsTool.md +12 -0
  160. data/docs/api/yard/HTM/MCP/ListRobotsTool.md +12 -0
  161. data/docs/api/yard/HTM/MCP/ListTagsTool.md +12 -0
  162. data/docs/api/yard/HTM/MCP/LoadDirectoryTool.md +13 -0
  163. data/docs/api/yard/HTM/MCP/LoadFileTool.md +13 -0
  164. data/docs/api/yard/HTM/MCP/MemoryStatsResource.md +13 -0
  165. data/docs/api/yard/HTM/MCP/PopularTagsTool.md +12 -0
  166. data/docs/api/yard/HTM/MCP/PromoteRobotTool.md +12 -0
  167. data/docs/api/yard/HTM/MCP/PurgeDeletedTool.md +12 -0
  168. data/docs/api/yard/HTM/MCP/RecallTool.md +16 -0
  169. data/docs/api/yard/HTM/MCP/RecentMemoriesResource.md +13 -0
  170. data/docs/api/yard/HTM/MCP/RelatedNodesTool.md +12 -0
  171. data/docs/api/yard/HTM/MCP/RememberTool.md +12 -0
  172. data/docs/api/yard/HTM/MCP/RestoreTool.md +12 -0
  173. data/docs/api/yard/HTM/MCP/RobotGroupsResource.md +13 -0
  174. data/docs/api/yard/HTM/MCP/RobotTeamsStatusTool.md +13 -0
  175. data/docs/api/yard/HTM/MCP/RunRobotTeamsTool.md +13 -0
  176. data/docs/api/yard/HTM/MCP/SearchByTagsTool.md +16 -0
  177. data/docs/api/yard/HTM/MCP/SearchTagsTool.md +12 -0
  178. data/docs/api/yard/HTM/MCP/Server.md +37 -0
  179. data/docs/api/yard/HTM/MCP/Session.md +32 -0
  180. data/docs/api/yard/HTM/MCP/SetRobotTool.md +12 -0
  181. data/docs/api/yard/HTM/MCP/ShutdownGroupTool.md +12 -0
  182. data/docs/api/yard/HTM/MCP/StartupPromptResource.md +16 -0
  183. data/docs/api/yard/HTM/MCP/StatsTool.md +12 -0
  184. data/docs/api/yard/HTM/MCP/SyncFilesTool.md +13 -0
  185. data/docs/api/yard/HTM/MCP/SyncGroupTool.md +12 -0
  186. data/docs/api/yard/HTM/MCP/TagHierarchyResource.md +16 -0
  187. data/docs/api/yard/HTM/MCP/TagNodeTool.md +12 -0
  188. data/docs/api/yard/HTM/MCP/TagTreeTool.md +22 -0
  189. data/docs/api/yard/HTM/MCP/TeamNames.md +7 -0
  190. data/docs/api/yard/HTM/MCP/TimelineTool.md +12 -0
  191. data/docs/api/yard/HTM/MCP/Tool.md +24 -0
  192. data/docs/api/yard/HTM/MCP/ToolSupport.md +17 -0
  193. data/docs/api/yard/HTM/MCP/TopicRelationshipsTool.md +12 -0
  194. data/docs/api/yard/HTM/MCP/TransferWorkingMemoryTool.md +12 -0
  195. data/docs/api/yard/HTM/MCP/UnloadFileTool.md +13 -0
  196. data/docs/api/yard/HTM/MCP/UntagNodeTool.md +12 -0
  197. data/docs/api/yard/HTM/MCP.md +30 -0
  198. data/docs/api/yard/HTM/Migration.md +44 -0
  199. data/docs/api/yard/HTM/Models/FileSource.md +66 -0
  200. data/docs/api/yard/HTM/Models/Node/Scopes.md +74 -0
  201. data/docs/api/yard/HTM/Models/Node/SoftDeletion.md +22 -0
  202. data/docs/api/yard/HTM/Models/Node/VectorSimilarity.md +28 -0
  203. data/docs/api/yard/HTM/Models/Node.md +113 -0
  204. data/docs/api/yard/HTM/Models/NodeLink.md +65 -0
  205. data/docs/api/yard/HTM/Models/NodeRelationship.md +31 -0
  206. data/docs/api/yard/HTM/Models/NodeTag.md +38 -0
  207. data/docs/api/yard/HTM/Models/Robot.md +50 -0
  208. data/docs/api/yard/HTM/Models/RobotNode.md +35 -0
  209. data/docs/api/yard/HTM/Models/Tag/Scopes.md +32 -0
  210. data/docs/api/yard/HTM/Models/Tag.md +112 -0
  211. data/docs/api/yard/HTM/Models.md +5 -0
  212. data/docs/api/yard/HTM/NodeEnrichment.md +36 -0
  213. data/docs/api/yard/HTM/NodeView.md +113 -0
  214. data/docs/api/yard/HTM/NotFoundError.md +6 -5
  215. data/docs/api/yard/HTM/Observability.md +58 -40
  216. data/docs/api/yard/HTM/PropositionError.md +6 -6
  217. data/docs/api/yard/HTM/PropositionService.md +63 -29
  218. data/docs/api/yard/HTM/QueryCache/KeyNormalizer.md +25 -0
  219. data/docs/api/yard/HTM/QueryCache/NullStore.md +19 -0
  220. data/docs/api/yard/HTM/QueryCache/Store.md +43 -0
  221. data/docs/api/yard/HTM/QueryCache.md +41 -46
  222. data/docs/api/yard/HTM/QueryTimeoutError.md +9 -8
  223. data/docs/api/yard/HTM/Railtie.md +11 -7
  224. data/docs/api/yard/HTM/RecallQuery.md +111 -0
  225. data/docs/api/yard/HTM/ResourceExhaustedError.md +6 -6
  226. data/docs/api/yard/HTM/RobotGroup/CacheSync.md +35 -0
  227. data/docs/api/yard/HTM/RobotGroup/Membership.md +96 -0
  228. data/docs/api/yard/HTM/RobotGroup/TransferOptions.md +14 -0
  229. data/docs/api/yard/HTM/RobotGroup/WorkingMemoryLedger.md +65 -0
  230. data/docs/api/yard/HTM/RobotGroup.md +116 -360
  231. data/docs/api/yard/HTM/Robots/Actions/TagMove.md +31 -0
  232. data/docs/api/yard/HTM/Robots/Actions.md +153 -0
  233. data/docs/api/yard/HTM/Robots/Neighbors.md +20 -0
  234. data/docs/api/yard/HTM/Robots/Supervisor/Idler.md +26 -0
  235. data/docs/api/yard/HTM/Robots/Supervisor/Roster.md +26 -0
  236. data/docs/api/yard/HTM/Robots/Supervisor.md +42 -0
  237. data/docs/api/yard/HTM/Robots/Team.md +60 -0
  238. data/docs/api/yard/HTM/Robots/Teams/Archivist.md +43 -0
  239. data/docs/api/yard/HTM/Robots/Teams/Consolidator.md +29 -0
  240. data/docs/api/yard/HTM/Robots/Teams/ContradictionDetector.md +33 -0
  241. data/docs/api/yard/HTM/Robots/Teams/TagCurator.md +37 -0
  242. data/docs/api/yard/HTM/Robots/Teams.md +5 -0
  243. data/docs/api/yard/HTM/Robots/Tools/ArchiveNodes.md +12 -0
  244. data/docs/api/yard/HTM/Robots/Tools/Base.md +16 -0
  245. data/docs/api/yard/HTM/Robots/Tools/MergeNodes.md +12 -0
  246. data/docs/api/yard/HTM/Robots/Tools/MergeTags.md +12 -0
  247. data/docs/api/yard/HTM/Robots/Tools/Pass.md +12 -0
  248. data/docs/api/yard/HTM/Robots/Tools/RecordConflict.md +12 -0
  249. data/docs/api/yard/HTM/Robots/Tools/SupersedeNode.md +12 -0
  250. data/docs/api/yard/HTM/Robots/Tools.md +14 -0
  251. data/docs/api/yard/HTM/Robots.md +72 -0
  252. data/docs/api/yard/HTM/SearchFilters.md +82 -0
  253. data/docs/api/yard/HTM/SequelConfig.md +97 -0
  254. data/docs/api/yard/HTM/Settings.md +39 -0
  255. data/docs/api/yard/HTM/Sinatra/Helpers.md +37 -0
  256. data/docs/api/yard/HTM/Sinatra/Middleware.md +29 -0
  257. data/docs/api/yard/HTM/Sinatra.md +44 -0
  258. data/docs/api/yard/HTM/SqlBuilder/Sparsevec.md +69 -0
  259. data/docs/api/yard/HTM/SqlBuilder.md +62 -75
  260. data/docs/api/yard/HTM/StartupPrompt.md +45 -0
  261. data/docs/api/yard/HTM/TagError.md +6 -6
  262. data/docs/api/yard/HTM/TagService.md +100 -37
  263. data/docs/api/yard/HTM/TagTree/Branch.md +43 -0
  264. data/docs/api/yard/HTM/TagTree/SvgRenderer/Layout.md +51 -0
  265. data/docs/api/yard/HTM/TagTree/SvgRenderer.md +25 -0
  266. data/docs/api/yard/HTM/TagTree.md +65 -0
  267. data/docs/api/yard/HTM/Telemetry/NullInstrument.md +12 -9
  268. data/docs/api/yard/HTM/Telemetry/NullMeter.md +17 -9
  269. data/docs/api/yard/HTM/Telemetry.md +53 -50
  270. data/docs/api/yard/HTM/Timeframe/Result.md +13 -16
  271. data/docs/api/yard/HTM/Timeframe.md +17 -20
  272. data/docs/api/yard/HTM/TimeframeExtractor/Patterns.md +18 -0
  273. data/docs/api/yard/HTM/TimeframeExtractor/Result.md +13 -16
  274. data/docs/api/yard/HTM/TimeframeExtractor.md +27 -16
  275. data/docs/api/yard/HTM/Timeline.md +113 -0
  276. data/docs/api/yard/HTM/ValidationError.md +6 -5
  277. data/docs/api/yard/HTM/Workflows/RememberWorkflow/NodeState.md +73 -0
  278. data/docs/api/yard/HTM/Workflows/RememberWorkflow.md +80 -0
  279. data/docs/api/yard/HTM/Workflows.md +5 -0
  280. data/docs/api/yard/HTM/WorkingMemory/Entry.md +67 -0
  281. data/docs/api/yard/HTM/WorkingMemory/Store.md +54 -0
  282. data/docs/api/yard/HTM/WorkingMemory.md +113 -87
  283. data/docs/api/yard/HTM/WorkingMemoryChannel/Subscribers.md +28 -0
  284. data/docs/api/yard/HTM/WorkingMemoryChannel.md +108 -102
  285. data/docs/api/yard/HTM.md +483 -5
  286. data/docs/api/yard/README.md +211 -0
  287. data/docs/api/yard/Sinatra/Base.md +30 -0
  288. data/docs/api/yard/Sinatra.md +7 -0
  289. data/docs/api/yard/index.csv +1834 -181
  290. data/docs/api/yard-reference.md +228 -9
  291. data/docs/architecture/adrs/005-rag-retrieval.md +3 -0
  292. data/docs/architecture/adrs/index.md +1 -1
  293. data/docs/architecture/index.md +2 -2
  294. data/docs/architecture/overview.md +3 -3
  295. data/docs/assets/images/project-structure.svg +2 -2
  296. data/docs/database/INDEX.md +113 -0
  297. data/docs/database/README.md +60 -176
  298. data/docs/database/file_sources.md +51 -0
  299. data/docs/database/file_sources.svg +120 -0
  300. data/docs/database/naming-convention.md +12 -12
  301. data/docs/database/node_links.md +65 -0
  302. data/docs/database/node_links.svg +171 -0
  303. data/docs/database/node_relationships.md +62 -0
  304. data/docs/database/node_relationships.svg +124 -0
  305. data/docs/database/node_tags.md +50 -0
  306. data/docs/database/node_tags.svg +125 -0
  307. data/docs/database/nodes.md +120 -0
  308. data/docs/database/nodes.svg +394 -0
  309. data/docs/database/robot_nodes.md +57 -0
  310. data/docs/database/robot_nodes.svg +155 -0
  311. data/docs/database/robots.md +40 -0
  312. data/docs/database/robots.svg +131 -0
  313. data/docs/database/schema.svg +384 -275
  314. data/docs/database/schema_migrations.md +19 -0
  315. data/docs/database/schema_migrations.svg +31 -0
  316. data/docs/database/tags.md +47 -0
  317. data/docs/database/tags.svg +90 -0
  318. data/docs/development/asgard-tasks.md +114 -0
  319. data/docs/development/contributing.md +6 -6
  320. data/docs/development/index.md +15 -17
  321. data/docs/development/schema.md +43 -14
  322. data/docs/development/setup.md +60 -70
  323. data/docs/development/testing.md +57 -65
  324. data/docs/examples/basic-usage.md +9 -9
  325. data/docs/examples/config-files.md +8 -8
  326. data/docs/examples/file-loading.md +12 -12
  327. data/docs/examples/index.md +15 -8
  328. data/docs/examples/llm-configuration.md +13 -9
  329. data/docs/examples/mcp-client.md +61 -59
  330. data/docs/examples/rails-integration.md +5 -4
  331. data/docs/examples/sinatra-integration.md +5 -4
  332. data/docs/examples/standalone-app.md +17 -16
  333. data/docs/getting-started/index.md +3 -3
  334. data/docs/getting-started/installation.md +76 -83
  335. data/docs/getting-started/quick-start.md +24 -22
  336. data/docs/guides/adding-memories.md +14 -3
  337. data/docs/guides/cli.md +458 -0
  338. data/docs/guides/configuration.md +72 -37
  339. data/docs/guides/epistemic-status.md +138 -0
  340. data/docs/guides/event-time.md +106 -0
  341. data/docs/guides/file-loading.md +26 -22
  342. data/docs/guides/getting-started.md +21 -17
  343. data/docs/guides/long-term-memory.md +1 -1
  344. data/docs/guides/mcp-server.md +416 -173
  345. data/docs/guides/propositions.md +18 -29
  346. data/docs/guides/recalling-memories.md +22 -7
  347. data/docs/guides/robot-teams.md +96 -0
  348. data/docs/guides/search-strategies.md +10 -7
  349. data/docs/guides/tags.md +19 -19
  350. data/docs/guides/timeline.md +106 -0
  351. data/docs/index.md +7 -7
  352. data/docs/llms.txt +35 -0
  353. data/docs/multi_framework_support.md +13 -13
  354. data/docs/robots/robot-groups.md +9 -9
  355. data/docs/robots/two-tier-memory.md +13 -26
  356. data/docs/setup_local_database.md +33 -31
  357. data/examples/00_create_examples_db.rb +20 -7
  358. data/examples/01_basic_usage.rb +20 -18
  359. data/examples/02_config_file_example/README.md +13 -12
  360. data/examples/02_config_file_example/config/htm.local.yml +8 -8
  361. data/examples/02_config_file_example/show_config.rb +3 -4
  362. data/examples/03_custom_llm_configuration.rb +12 -12
  363. data/examples/04_file_loader_usage.rb +15 -21
  364. data/examples/05_timeframe_demo.rb +282 -234
  365. data/examples/06_example_app/.loki +36 -0
  366. data/examples/06_example_app/app.rb +21 -33
  367. data/examples/07_cli_app/README.md +18 -18
  368. data/examples/07_cli_app/htm_cli.rb +25 -19
  369. data/examples/08_sinatra_app/Gemfile +1 -0
  370. data/examples/08_sinatra_app/Gemfile.lock +101 -67
  371. data/examples/08_sinatra_app/app.rb +64 -62
  372. data/examples/09_mcp_client.rb +92 -119
  373. data/examples/10_telemetry/README.md +3 -3
  374. data/examples/10_telemetry/SETUP_README.md +2 -2
  375. data/examples/10_telemetry/demo.rb +5 -5
  376. data/examples/11_robot_groups/README.md +5 -4
  377. data/examples/11_robot_groups/lib/robot_worker.rb +0 -5
  378. data/examples/11_robot_groups/multi_process.rb +5 -4
  379. data/examples/11_robot_groups/same_process.rb +18 -17
  380. data/examples/12_rails_app/Gemfile +1 -1
  381. data/examples/12_rails_app/Gemfile.lock +146 -97
  382. data/examples/12_rails_app/README.md +21 -17
  383. data/examples/12_rails_app/app/controllers/chats_controller.rb +33 -63
  384. data/examples/12_rails_app/app/controllers/memories_controller.rb +7 -1
  385. data/examples/12_rails_app/app/controllers/messages_controller.rb +21 -58
  386. data/examples/12_rails_app/app/controllers/search_controller.rb +7 -2
  387. data/examples/12_rails_app/app/models/chat.rb +0 -33
  388. data/examples/12_rails_app/app/models/message.rb +0 -2
  389. data/examples/12_rails_app/app/views/chats/show.html.erb +2 -2
  390. data/examples/12_rails_app/app/views/files/new.html.erb +1 -1
  391. data/examples/12_rails_app/app/views/memories/_memory_card.html.erb +1 -1
  392. data/examples/12_rails_app/app/views/memories/new.html.erb +12 -0
  393. data/examples/12_rails_app/app/views/memories/show.html.erb +13 -0
  394. data/examples/12_rails_app/app/views/search/index.html.erb +18 -2
  395. data/examples/12_rails_app/config/initializers/ruby_llm.rb +11 -15
  396. data/examples/12_rails_app/db/migrate/20261205061932_create_ruby_llm_records.rb +160 -0
  397. data/examples/12_rails_app/db/migrate/20261205061933_create_chats.rb +13 -0
  398. data/examples/12_rails_app/db/migrate/20261205061934_create_messages.rb +23 -0
  399. data/examples/12_rails_app/db/schema.rb +163 -20
  400. data/examples/README.md +53 -44
  401. data/examples/examples_helper.rb +29 -5
  402. data/htm.gemspec +68 -0
  403. data/lib/htm/admin/database_commands.rb +454 -0
  404. data/lib/htm/admin/enrich_commands.rb +209 -0
  405. data/lib/htm/admin/file_commands.rb +323 -0
  406. data/lib/htm/admin/memory_commands/edit.rb +157 -0
  407. data/lib/htm/admin/memory_commands/search.rb +178 -0
  408. data/lib/htm/admin/memory_commands/tag_search.rb +98 -0
  409. data/lib/htm/admin/memory_commands/text.rb +164 -0
  410. data/lib/htm/admin/memory_commands/working_memory.rb +71 -0
  411. data/lib/htm/admin/memory_commands.rb +179 -0
  412. data/lib/htm/admin/tag_commands.rb +352 -0
  413. data/lib/htm/admin/tag_graph.rb +290 -0
  414. data/lib/htm/admin/templates/tag_graph.html +295 -0
  415. data/lib/htm/admin/yard_docs.rb +206 -0
  416. data/lib/htm/admin.rb +253 -0
  417. data/lib/htm/circuit_breaker.rb +142 -68
  418. data/lib/htm/class_methods.rb +136 -0
  419. data/lib/htm/cli/config_file.rb +86 -0
  420. data/lib/htm/cli/db.rb +77 -0
  421. data/lib/htm/cli/enrich.rb +44 -0
  422. data/lib/htm/cli/environment.rb +74 -0
  423. data/lib/htm/cli/error_suggestion.rb +97 -0
  424. data/lib/htm/cli/files.rb +41 -0
  425. data/lib/htm/cli/group.rb +32 -0
  426. data/lib/htm/cli/memory.rb +320 -0
  427. data/lib/htm/cli/memory_command.rb +71 -0
  428. data/lib/htm/cli/robots.rb +71 -0
  429. data/lib/htm/cli/support.rb +46 -0
  430. data/lib/htm/cli/tags.rb +103 -0
  431. data/lib/htm/cli/working_memory.rb +41 -0
  432. data/lib/htm/cli.rb +75 -0
  433. data/lib/htm/config/builder.rb +99 -68
  434. data/lib/htm/config/coercion.rb +91 -0
  435. data/lib/htm/config/database.rb +81 -52
  436. data/lib/htm/config/defaults.yml +52 -16
  437. data/lib/htm/config/readers.rb +85 -0
  438. data/lib/htm/config/ruby_llm_settings.rb +58 -0
  439. data/lib/htm/config/validator.rb +45 -26
  440. data/lib/htm/config.rb +112 -297
  441. data/lib/htm/database.rb +305 -396
  442. data/lib/htm/database_docs.rb +149 -0
  443. data/lib/htm/embedding_service.rb +26 -66
  444. data/lib/htm/epistemics.rb +254 -0
  445. data/lib/htm/errors.rb +4 -4
  446. data/lib/htm/event_time.rb +201 -0
  447. data/lib/htm/file_memory.rb +106 -0
  448. data/lib/htm/input_validator.rb +158 -0
  449. data/lib/htm/integrations/sinatra.rb +43 -31
  450. data/lib/htm/job_adapter.rb +78 -83
  451. data/lib/htm/jobs/failure_logging.rb +49 -0
  452. data/lib/htm/jobs/generate_embedding_job.rb +21 -28
  453. data/lib/htm/jobs/generate_propositions_job.rb +56 -28
  454. data/lib/htm/jobs/generate_relationships_job.rb +28 -24
  455. data/lib/htm/jobs/generate_tags_job.rb +32 -37
  456. data/lib/htm/jobs/llm_call_timer.rb +53 -0
  457. data/lib/htm/jobs/node_lookup.rb +27 -0
  458. data/lib/htm/knowledge_memory.rb +153 -0
  459. data/lib/htm/loaders/chunk_sync.rb +168 -0
  460. data/lib/htm/loaders/markdown_chunker.rb +207 -36
  461. data/lib/htm/loaders/markdown_loader.rb +76 -120
  462. data/lib/htm/long_term_memory/fulltext_search.rb +15 -36
  463. data/lib/htm/long_term_memory/hybrid_search.rb +471 -544
  464. data/lib/htm/long_term_memory/node_operations.rb +110 -81
  465. data/lib/htm/long_term_memory/relevance_scorer.rb +232 -237
  466. data/lib/htm/long_term_memory/tag_operations.rb +201 -130
  467. data/lib/htm/long_term_memory/vector_search.rb +33 -61
  468. data/lib/htm/long_term_memory.rb +5 -17
  469. data/lib/htm/mcp/file_tools.rb +190 -0
  470. data/lib/htm/mcp/group_tools.rb +223 -233
  471. data/lib/htm/mcp/node_tools.rb +350 -0
  472. data/lib/htm/mcp/resources.rb +102 -28
  473. data/lib/htm/mcp/robot_team_tools.rb +119 -0
  474. data/lib/htm/mcp/server.rb +26 -14
  475. data/lib/htm/mcp/tag_tools.rb +130 -0
  476. data/lib/htm/mcp/tool.rb +40 -0
  477. data/lib/htm/mcp/tool_support.rb +88 -0
  478. data/lib/htm/mcp/tools.rb +232 -283
  479. data/lib/htm/models/file_source.rb +35 -20
  480. data/lib/htm/models/node.rb +287 -193
  481. data/lib/htm/models/node_link.rb +97 -0
  482. data/lib/htm/models/node_relationship.rb +3 -2
  483. data/lib/htm/models/node_tag.rb +22 -2
  484. data/lib/htm/models/robot.rb +4 -8
  485. data/lib/htm/models/robot_node.rb +5 -2
  486. data/lib/htm/models/tag.rb +53 -207
  487. data/lib/htm/node_enrichment.rb +75 -0
  488. data/lib/htm/node_view.rb +295 -0
  489. data/lib/htm/observability.rb +114 -98
  490. data/lib/htm/proposition_service.rb +38 -74
  491. data/lib/htm/query_cache.rb +145 -91
  492. data/lib/htm/railtie.rb +3 -7
  493. data/lib/htm/request_options.rb +149 -0
  494. data/lib/htm/robot_group/cache_sync.rb +69 -0
  495. data/lib/htm/robot_group/membership.rb +147 -0
  496. data/lib/htm/robot_group/working_memory_ledger.rb +111 -0
  497. data/lib/htm/robot_group.rb +128 -521
  498. data/lib/htm/robots/actions.rb +371 -0
  499. data/lib/htm/robots/neighbors.rb +63 -0
  500. data/lib/htm/robots/node_brief.rb +49 -0
  501. data/lib/htm/robots/supervisor.rb +140 -0
  502. data/lib/htm/robots/team.rb +124 -0
  503. data/lib/htm/robots/teams/archivist.rb +88 -0
  504. data/lib/htm/robots/teams/consolidator.rb +52 -0
  505. data/lib/htm/robots/teams/contradiction_detector.rb +67 -0
  506. data/lib/htm/robots/teams/tag_curator.rb +75 -0
  507. data/lib/htm/robots/tools.rb +127 -0
  508. data/lib/htm/robots.rb +125 -0
  509. data/lib/htm/search_filters.rb +116 -0
  510. data/lib/htm/sequel_config.rb +95 -59
  511. data/lib/htm/sql_builder.rb +162 -53
  512. data/lib/htm/startup_prompt.rb +73 -0
  513. data/lib/htm/tag_service.rb +104 -109
  514. data/lib/htm/tag_tree.rb +206 -0
  515. data/lib/htm/telemetry.rb +15 -16
  516. data/lib/htm/timeframe.rb +27 -9
  517. data/lib/htm/timeframe_extractor.rb +77 -55
  518. data/lib/htm/timeline.rb +230 -0
  519. data/lib/htm/version.rb +1 -1
  520. data/lib/htm/workflows/remember_workflow.rb +145 -136
  521. data/lib/htm/working_memory/entry.rb +53 -0
  522. data/lib/htm/working_memory/store.rb +97 -0
  523. data/lib/htm/working_memory.rb +137 -139
  524. data/lib/htm/working_memory_channel.rb +90 -40
  525. data/lib/htm.rb +177 -501
  526. data/mkdocs.yml +100 -23
  527. data/scripts/install_local_database.sh +7 -6
  528. metadata +1032 -594
  529. data/.tbls.yml +0 -31
  530. data/Rakefile +0 -240
  531. data/bin/htm_mcp +0 -27
  532. data/docs/api/yard/HTM/ActiveRecordConfig.md +0 -29
  533. data/docs/api/yard/HTM/ConfigSection.md +0 -28
  534. data/docs/database/public.file_sources.md +0 -42
  535. data/docs/database/public.file_sources.svg +0 -219
  536. data/docs/database/public.node_stats.md +0 -48
  537. data/docs/database/public.node_stats.svg +0 -41
  538. data/docs/database/public.node_tags.md +0 -41
  539. data/docs/database/public.node_tags.svg +0 -251
  540. data/docs/database/public.nodes.md +0 -61
  541. data/docs/database/public.nodes.svg +0 -283
  542. data/docs/database/public.nodes_tags.md +0 -39
  543. data/docs/database/public.nodes_tags.svg +0 -112
  544. data/docs/database/public.ontology_structure.md +0 -48
  545. data/docs/database/public.ontology_structure.svg +0 -38
  546. data/docs/database/public.operations_log.md +0 -42
  547. data/docs/database/public.operations_log.svg +0 -130
  548. data/docs/database/public.relationships.md +0 -39
  549. data/docs/database/public.relationships.svg +0 -41
  550. data/docs/database/public.robot_activity.md +0 -46
  551. data/docs/database/public.robot_activity.svg +0 -35
  552. data/docs/database/public.robot_nodes.md +0 -48
  553. data/docs/database/public.robot_nodes.svg +0 -251
  554. data/docs/database/public.robots.md +0 -34
  555. data/docs/database/public.robots.svg +0 -165
  556. data/docs/database/public.schema_migrations.md +0 -29
  557. data/docs/database/public.schema_migrations.svg +0 -26
  558. data/docs/database/public.tags.md +0 -38
  559. data/docs/database/public.tags.svg +0 -147
  560. data/docs/database/public.topic_relationships.md +0 -45
  561. data/docs/database/public.topic_relationships.svg +0 -32
  562. data/docs/database/schema.json +0 -1814
  563. data/docs/database_rake_tasks.md +0 -345
  564. data/docs/development/rake-tasks.md +0 -1113
  565. data/docs/using_rake_tasks_in_your_app.md +0 -383
  566. data/examples/06_example_app/Rakefile +0 -71
  567. data/examples/12_rails_app/app/models/model.rb +0 -5
  568. data/examples/12_rails_app/app/models/tool_call.rb +0 -5
  569. data/examples/12_rails_app/db/migrate/20250124000001_create_ruby_llm_tables.rb +0 -34
  570. data/examples/12_rails_app/db/migrate/20250124000002_create_models_table.rb +0 -28
  571. data/lib/htm/mcp/cli.rb +0 -583
  572. data/lib/htm/tasks.rb +0 -79
  573. data/lib/tasks/db.rake +0 -15
  574. data/lib/tasks/doc.rake +0 -301
  575. data/lib/tasks/files.rake +0 -285
  576. data/lib/tasks/htm.rake +0 -703
  577. data/lib/tasks/jobs.rake +0 -429
  578. data/lib/tasks/tags.rake +0 -184
  579. data/scripts/backfill_parent_tags.rb +0 -376
  580. data/scripts/normalize_plural_tags.rb +0 -335
data/CHANGELOG.md CHANGED
@@ -7,111 +7,173 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.0] - 2026-12-05
11
+
12
+ Memories now record when things happened, how they changed and how they are known. This release also changes the storage format, the default LLM provider and the command line, and renames or removes several APIs. It does not keep backward compatibility.
13
+
14
+ ### Upgrading from 0.0.32
15
+ - **Ruby 4.0 or later** is required.
16
+ - **Run `htm db migrate`.** Migrations 00010–00014 convert embeddings to `sparsevec`, strip YAML frontmatter from file chunks, add event time, create `node_links` and add epistemic status. Then run `htm enrich process_embeddings` and `htm enrich process_tags` to re-enrich the chunks migration 00011 repaired.
17
+ - **Embedding models over 1,000 dimensions are rejected** (for example OpenAI `text-embedding-3-small`), because the `sparsevec` HNSW index allows at most 1,000 non-zero values. The default model is LM Studio's 768-dimension `text-embedding-nomic-embed-text-v1.5`.
18
+ - **Ollama is no longer supported.** LM Studio (`:lms`) is the default provider; set `providers.lms.url` (default `http://localhost:1234/v1`) instead of `providers.ollama.url`.
19
+ - **MCP client configs** change from `"command": "htm_mcp"` to `"command": "htm", "args": ["mcp"]`.
20
+ - **Re-chunk loaded files** with `htm files load_dir DIR --force` to get the new sentence-boundary chunks.
21
+
22
+ ### Added
23
+ - **Bitemporal event time** (#110, ADR-017). Nodes record `occurred_at`/`occurred_until` (when it happened), `valid_from`/`valid_until` (when it was true) and `time_source` (`recorded`, `stated`, `inferred`, `derived`, `frontmatter`, `file`).
24
+ - `remember` takes the times, or infers them from the text ("yesterday", "March 3, 2025"; `HTM_EVENT_TIME__INFER`).
25
+ - `recall(timeframe:)` now matches event spans. `time_axis: :recorded` filters on `created_at` instead, and `as_of:` returns what was valid at a moment.
26
+ - Propositions, merges, digests and file chunks derive their event time.
27
+ - `HTM::EventTime` and `HTM::SearchFilters` are new.
28
+ - See `docs/guides/event-time.md`.
29
+ - **Memory timelines** (#111, ADR-018).
30
+ - The new `node_links` table records `supersedes`, `merged_into`, `archived_into` and `derived_from` links, each with a reason, transition (`removed`, `restored`, `changed`) and robot.
31
+ - `remember(supersedes:, reason:, transition:)` retires the old state in the same transaction.
32
+ - `htm.timeline(id_or_query)` and `recall(include_history: true)` show how a memory changed.
33
+ - `content_hash` is unique only among active nodes, so a retired state is never revived.
34
+ - **Epistemic status** (#112, ADR-019).
35
+ - Nodes carry `epistemic_status` (`asserted`, `extracted`, `inferred`, `hypothesis`) and `confidence`. Evidence is recorded as `derived_from` links.
36
+ - New methods: `remember(status:, confidence:, evidence:)`, `recall(status:, min_confidence:)`, `confirm` and `first_mention`.
37
+ - Working memory labels each memory with its status, and the robot teams keep stated memories over inferred ones.
38
+ - **`htm` command line**, built on Thor (`HTM::CLI`):
39
+ - Groups: `db`, `enrich`, `files`, `robots`, `tags` and `wm`, plus `htm mcp`, `config`, `env` and `version`.
40
+ - Memory commands: `recall`/`search`, `remember`, `show`, `related`, `forget`, `restore`, `deleted`, `purge`, `tag`, `untag`, `propositions`, `stats`, `timeline`, `confirm` and `first_mention`.
41
+ - Every command takes `-c/--config`. The memory commands also take `--robot` and `--json`.
42
+ - Database errors print a suggested fix.
43
+ - The logic lives in `HTM::Admin`. See `docs/guides/cli.md`.
44
+ - **MCP server covers the whole API**: 52 tools (was 23), all with snake_case names.
45
+ - `recall` takes `timeframe`, `time_axis`, `as_of`, `metadata`, `query_tags`, `status`, `min_confidence` and `include_history`.
46
+ - New tools cover nodes, tags, files, working memory, robot teams, enrichment, timelines and epistemic status.
47
+ - New resources: `htm://config`, `htm://files` and `htm://prompts/startup`.
48
+ - **Startup prompt.** `HTM.startup_prompt(robot_name:, user:, channel:)` tells a robot that it has long-term memory and how to use it (#12).
49
+ - **Robot teams** (`HTM::Robots`, built on robot_lab) maintain memory in the background:
50
+ - `tag_curator` merges duplicate tags.
51
+ - `consolidator` merges near-duplicate nodes.
52
+ - `contradiction_detector` retires contradicted nodes.
53
+ - `archivist` digests cold nodes.
54
+ - Run them with `htm robots work|once|status` or `HTM::Robots.start`. Removals are soft deletes.
55
+ - **More providers**: `apfel` (Apple's on-device Foundation Models), `claude_code`, `codex` and `copilot`, through the ruby_llm-providers-* gems. All four are chat only.
56
+ - **`htm tags graph PREFIX`** writes an interactive force-directed graph of nodes and their shared-tag links to one self-contained HTML file.
57
+ - **`htm tags restore_plurals [--apply]`** renames tags that the old singularizer trimmed (`ruby-on-rail`, `necropsi`).
58
+ - **`database.statement_timeout`** (`HTM_DATABASE__STATEMENT_TIMEOUT`) is set on every pooled connection.
59
+ - **`RobotGroup#member(name)`** and `docs/llms.txt`.
60
+
61
+ ### Changed
62
+ - **LM Studio replaces Ollama as the default provider.**
63
+ - Embeddings default to `text-embedding-nomic-embed-text-v1.5`; tags and propositions to `google/gemma-3-4b`.
64
+ - ruby_llm 2.2.3 is required (was 1.x), and calls pass `provider:` explicitly.
65
+ - **Embeddings are stored as `sparsevec(2000)`** with no zero padding. `embedding_dimension` now records the real size.
66
+ - **Hybrid search takes vector candidates from the whole corpus.** Previously it ranked only nodes that fulltext or tag search had already found, so a semantically close node sharing no keyword or tag was never returned. RRF now fuses three independent rankings (#13).
67
+ - **File chunks end on sentences.**
68
+ - `HTM::Loaders::MarkdownChunker` replaces Baran.
69
+ - It cuts at headers, code fences, rules, blank lines, then sentence ends. Overlap repeats whole sentences, and a heading joins the section after it.
70
+ - Chunks never exceed `chunk_size`, and `cursor` is the chunk's real offset in the file.
71
+ - Frontmatter stays on `file_sources` and is no longer copied into the first chunk's text.
72
+ - **Database session settings reach every pooled connection.** The pool is process-wide, so `database.pool_size` and `database.statement_timeout` are now global settings. `database.timeout` now sets Sequel's `pool_timeout`; it was ignored.
73
+ - **Code reorganized** so every quality gate (RuboCop, Reek, Flay, Flog, Typos) passes:
74
+ - `remember`, `confirm` and `first_mention` live in `HTM::KnowledgeMemory`.
75
+ - The node and search views are shared by the MCP tools and the CLI (`HTM::NodeView`).
76
+ - Large classes are split into collaborators.
77
+ - **Development tasks run on asgard** (`.loki` files, repo only). There is no Rakefile.
78
+ - `asgard test` runs the suite in parallel, one database per worker, cutting the run from 48s to 11s.
79
+ - Database docs are generated by pgdd instead of tbls.
80
+ - **`RobotGroup` loads shared memory into a member's in-memory working memory** when the member joins, on `sync_robot` and on `transfer_working_memory`. Before, only the database flags changed.
81
+ - **Examples refreshed** for event time, the configured models, RubyLLM 2.2 (the Rails chat app) and Ruby 4. `bin/htm` and the examples use the repo's bundle when run from a checkout.
82
+
83
+ ### Breaking API changes
84
+ - `HTM.new` no longer takes `db_pool_size:` or `db_query_timeout:`, and `LongTermMemory.new` no longer takes `pool_size:` or `query_timeout:`.
85
+ - `LongTermMemory#search_hybrid` takes `candidate_limit:` instead of `prefilter_limit:`.
86
+ - `search_by_tags` takes `match: :any`/`:all` instead of `match_all:`.
87
+ - `find_query_matching_tags` drops `include_extracted:`; use `query_tag_matches`.
88
+ - `TagSearch.query` requires a `SearchFilters`; use `SearchFilters.none` instead of `nil`.
89
+ - `HTM::Robots::Actions.supersede_node` drops `allow_weaker:`; use `strict_supersede_node`.
90
+ - `WorkingMemory#add` drops `from_recall:` and `last_accessed:`; use `add_entry` with `Entry.recalled`.
91
+ - `Session.logger=` is now `Session.attach_logger`, and `register_htm` takes `logger:`.
92
+ - `Database.setup` always migrates, and `migrate`, `migration_status` and `seed` no longer take `db_url`.
93
+ - `Robots.teams([])` now means the configured teams.
94
+ - Removed: `EmbeddingService.pad_embedding`, `SqlBuilder.pad_embedding`, the `:storage_dimension` result key, `ollama_url`, `normalize_ollama_model` and `refresh_ollama_models!`.
95
+
96
+ ### Fixed
97
+ - **Search and recall**
98
+ - `search_by_tags` with all tags required always raised `NoMethodError`.
99
+ - `Node#nearest_neighbors` ignored `distance:`.
100
+ - `recall` served stale cached results after `restore` or after `remember` revived a forgotten node (#70, #73, #75).
101
+ - "this week" spanned eight days on Sundays and ignored `week_start`. Current periods ("this month") now run from the start of the period to now (#41, #88).
102
+ - Tag prefix filters and `forget_content` treated `%` and `_` as wildcards (#45, #76).
103
+ - `topic_relationships` counted forgotten memories.
104
+ - **Soft delete**
105
+ - The `deleted` scopes never matched a row (#69).
106
+ - `Tag#restore!`, `RobotNode#restore!` and `NodeTag#restore!` raised `Sequel::NoExistingObject`.
107
+ - Tagging again after a soft delete hit a unique-index error (#19, #28).
108
+ - `forget` and `restore` raised a raw PG error for a non-integer id (#42).
109
+ - **File loading**
110
+ - `unload_file` left the chunks' tags, robot links, working memory entries and propositions active, and could drop the chunks but keep the source.
111
+ - A file edited within 5 seconds of its last load was skipped (#90).
112
+ - Frontmatter that was not a mapping, or that used aliases, crashed `load_file` (#92).
113
+ - A re-chunked file's old propositions stayed in recall; they are now soft-deleted and restored with their chunk.
114
+ - **Background jobs**
115
+ - Concurrent `:fiber` jobs shared one database connection and read each other's results or hung.
116
+ - One duplicate proposition dropped the rest of its batch.
117
+ - Merged nodes kept their stale embedding.
118
+ - Enrichment commands held one transaction for the whole run, so a crash lost hours of work.
119
+ - **Tags**
120
+ - The singularizer trimmed names that end in "s" (`AlchemyCMS` became `alchemycm`, `ruby-on-rails` became `ruby-on-rail`, `civil-rights` became `civil-right`).
121
+ - A multi-line tag passed `TagService` validation.
122
+ - `enrich process_tags` linked only the leaf tag, not its parents (#85).
123
+ - "Nodes with tags" counted tag links instead of nodes (#84).
124
+ - **Configuration and database**
125
+ - Setting one `HTM_<SECTION>__<KEY>` variable hid the rest of that section of `htm.yml`.
126
+ - `HTM_PROPOSITION__ENABLED=false` was treated as true.
127
+ - Config files ignored `HTM_ENV`.
128
+ - The embedding, tag and proposition timeouts were never applied (#79).
129
+ - OpenAI organization and project and the Azure endpoint never reached ruby_llm (#91).
130
+ - A database user or password containing URL-reserved characters broke the connection URL (#78).
131
+ - `HTM::Database.drop` left `node_relationships` behind (#38).
132
+ - `Database.info` skipped tables (#80).
133
+ - A failed connection left `SequelConfig` half set.
134
+ - **Robot groups and MCP**
135
+ - Group names over 56 characters broke every working memory notification (#89).
136
+ - Synced working memory entries were keyed by a string id and duplicated (#46).
137
+ - `failover!` printed into the MCP stdio stream (#87).
138
+ - The MCP server rejected databases configured outside the environment (#33).
139
+ - The MCP server crashed instead of printing a database error hint.
140
+ - `PropositionService` ignored the circuit breaker settings.
141
+
142
+ ### Removed
143
+ - `htm_mcp` and `HTM::MCP::CLI`; use `htm`.
144
+ - Rake: the `Rakefile`, `lib/tasks/*.rake` and the Railtie's `rake_tasks`.
145
+ - The gem-shipped asgard tasks (`HTM.loki_dir`); host applications run `htm` instead.
146
+ - The `baran` dependency, tbls, and the Ollama provider.
147
+
148
+ ## [0.0.32] - 2026-05-23
149
+
150
+ Covers 0.0.21 through 0.0.32, which were released without changelog entries.
151
+
10
152
  ### Added
11
- - **`node_relationships` table** - Weighted directed edges between related nodes
12
- - Stores Jaccard-similarity scores computed from tag co-occurrence
13
- - Both directions (A→B and B→A) stored explicitly for O(1) index lookups during CTE traversal
14
- - Unique constraint on `(source_id, target_id, rel_type)` — re-runs refresh stale weights via upsert
15
- - DB CHECK constraints enforce weight in [0.0, 1.0] and prevent self-loops
16
- - FK constraints (ON DELETE CASCADE) from both `source_id` and `target_id` to nodes
17
- - **`HTM::Models::NodeRelationship`** - Sequel model for the new table
18
- - Constants: `REL_TYPES` (`related_to`, `supports`, `contradicts`, `derived_from`) and `ORIGINS` (`tag_cooccurrence`, `tag_hierarchy`, `explicit`)
19
- - Dataset scopes: `neighbors_of`, `above_weight`, `by_origin`, `by_rel_type`, `between_nodes`
20
- - Full validation: presence, allowed values, weight range, self-loop rejection, uniqueness
21
- - **`HTM::Jobs::GenerateRelationshipsJob`** - Background job that computes and upserts Jaccard edges
22
- - Chained automatically after `GenerateTagsJob` completes
23
- - Single SQL query computes Jaccard similarity for all tag-sharing nodes at once
24
- - Skips edges below `MIN_WEIGHT_THRESHOLD` (0.1); caps at `MAX_EDGES_PER_NODE` (50) per node
25
- - Idempotent: `INSERT ... ON CONFLICT DO UPDATE` refreshes stale weights on re-run
26
- - **Migrations** `00008_create_node_relationships` and `00009_fix_node_relationships_column_types`
27
-
28
-
29
- - **`sslmode` database configuration support** - SSL mode now extracted from URL and included when building URL
30
- - `parse_database_url` extracts `sslmode` from URL query string (e.g., `?sslmode=require`)
31
- - `build_database_url` includes `sslmode` as query parameter when set
32
- - `reconcile_from_url` syncs `sslmode` along with other database components
33
- - Default `sslmode` is `prefer` (from `defaults.yml`)
34
- - **`htm:db:purge_all` rake task** - Permanently remove all soft-deleted records from database
35
- - Displays record counts by table before deletion
36
- - Detects and removes orphaned join table entries (`node_tags`, `robot_nodes`)
37
- - Detects and removes orphaned propositions (where `source_node_id` no longer exists)
38
- - Detects and removes orphaned robots (with no associated memory nodes)
39
- - Requires confirmation before proceeding
40
- - Deletes in correct order for referential integrity
41
- - **`htm:jobs:process_propositions` rake task** - Incremental proposition extraction for unprocessed nodes
42
- - Uses `ruby-progressbar` with ETA display
43
- - Only processes nodes not yet extracted (tracks via `source_node_id` metadata)
44
- - Added to `htm:jobs:process_all` task chain
45
- - **Rake task passthrough in MCP CLI** - Run rake tasks via `htm_mcp rake <task>`
46
- - `htm_mcp rake htm:db:stats` - Run any HTM rake task
47
- - `htm_mcp rake -T` / `htm_mcp rake --tasks` - List available tasks
48
- - **Pattern filtering** - `htm_mcp rake -T htm:jobs` filters to matching namespace (like standard rake)
49
- - **Meta-response filtering in PropositionService** - Filters LLM responses that ask for input
50
- - `META_RESPONSE_PATTERNS` constant with common patterns ("please provide", "I need the text", etc.)
51
- - `meta_response?` method for detecting invalid responses
52
- - Prevents storing "Please provide the text" as propositions
53
- - **Progress bars for job processing tasks** - Visual progress with ETA for long-running operations
54
- - `htm:jobs:process_embeddings` - Shows progress when generating embeddings
55
- - `htm:jobs:process_tags` - Shows progress when extracting tags
56
- - Format: `Processing: |████████████████| 50/100 (50%) ETA: 00:01:30`
153
+ - **`node_relationships` table** (migrations 00008, 00009) with `HTM::Models::NodeRelationship`.
154
+ - Stores weighted, directed edges between nodes that share tags (Jaccard similarity).
155
+ - `GenerateRelationshipsJob`, chained after `GenerateTagsJob`, upserts them. Edges under 0.1 are skipped, and each node keeps at most 50.
156
+ - **`sslmode`** is read from and written to database URLs (default `prefer`).
157
+ - **Rake tasks**:
158
+ - `htm:db:purge_all` removes soft-deleted and orphaned rows.
159
+ - `htm:jobs:process_propositions` extracts propositions for unprocessed nodes, with progress bars.
160
+ - `htm_mcp rake <task>` runs a task from the MCP CLI.
161
+ - **`PropositionService` ignores meta-responses** such as "please provide the text".
57
162
 
58
163
  ### Changed
59
- - **Centralized HTM loading in rake tasks** - Single `require_relative` in `lib/htm/tasks.rb`
60
- - HTM is now loaded once before any rake task files are loaded
61
- - Removed ~25 redundant `require 'htm'` statements from individual rake tasks
62
- - Ensures local development codebase is always used via `require_relative`
63
- - Removed `$LOAD_PATH` manipulation that was previously needed for `require 'htm'`
64
- - **Removed `:validate` rake task dependency** - Config validation now automatic
65
- - `HTM::Config.new` handles all validation at require time (environment, URL/component reconciliation, naming convention)
66
- - Rake tasks no longer need explicit validation step
67
- - **Cleaned up Rakefile** - Removed unnecessary code
68
- - Removed deprecated `db_setup` and `db_test` backward-compatibility tasks
69
- - Removed redundant `task :test` block (`:set_test_env` prerequisite handles environment setup)
70
- - **PropositionService validation now fully configurable** - Moved hardcoded constants to `defaults.yml`
71
- - `proposition.min_length` (default: 10) - Minimum characters for valid proposition
72
- - `proposition.max_length` (default: 1000) - Maximum characters for valid proposition
73
- - `proposition.min_words` (default: 5) - Minimum words for valid proposition
74
- - Added `min_length`, `max_length`, `min_words` class methods that read from config
75
- - **Improved proposition extraction prompt** - Better quality propositions
76
- - Added explicit BAD/GOOD examples for pronoun replacement
77
- - Added context enrichment examples (e.g., "wiring" → "solar panel wiring for Oklahoma barndominium")
78
- - System prompt now explicitly prevents meta-responses
79
- - Increased specificity requirements for self-contained facts
164
+ - Proposition validation limits are configurable: `proposition.min_length`, `max_length` and `min_words`.
165
+ - Improved the proposition prompt: it replaces pronouns and adds context to each fact.
166
+ - Rake tasks load HTM once, and config validation runs at load time.
80
167
 
81
168
  ### Fixed
82
- - **`token_counter` never set on config load** - `setup_defaults` on-load hook assigned to `@setup_defaults` (typo) instead of `@token_counter`, causing `HTM::ValidationError: token_counter must be callable` in any test that triggered a fresh config load via `HTM.configure`
83
- - **`reset_htm_configuration` lost mock services** - After `HTM.reset_configuration!` the helper only set `job.backend = :inline`, leaving the real Ollama embedding generator active; subsequent tests accumulated circuit breaker failures and left nodes without embeddings. Now calls `configure_htm_with_mocks` to fully restore test defaults
84
- - **Integration test circuit breaker leak** - `IntegrationTest#setup` now explicitly resets `EmbeddingService` and `TagService` circuit breakers before each test to prevent state bleed from other test classes
85
- - **Duplicate rescue branches** - Merged redundant `rescue HTM::CircuitBreakerOpenError` + service-specific error rescues (both just `raise`) into single `rescue A, B` in `EmbeddingService`, `TagService`, and `PropositionService`
86
- - **Duplicate `when "cosine"` branch in Node distance operator** - Removed branch whose body was identical to the `else` fallback (`"<=>"`), eliminating the `Lint/DuplicateBranch` offense
87
- - **Identical conditional branches in `Tag.format_tree_branch`** - `branch = is_last ? '+-- ' : '+-- '` both sides were identical; simplified to a direct string literal
88
- - **`EmptyElse` in `Observability#process_memory_mb`** - Removed redundant `else nil` branch from the platform detection conditional
169
+ - `token_counter` was never set on config load (a typo in the on-load hook).
170
+ - Tests could run against a non-test database; the test environment now always overrides `HTM_DATABASE__URL` and aborts unless the database name contains `_test`.
171
+ - Circuit breaker state leaked between tests, and so did the mock services after a configuration reset.
89
172
 
90
173
  ### Refactored
91
- - **Flog complexity reduced across 15+ files** - All methods now score below the 50.0 failure threshold (previously 9 methods failed):
92
- - `HTM::Models::Tag::generate_tree_svg` (93.6 → passing): extracted `svg_title_element`, `svg_node_elements`, `svg_node_coords`, `svg_edge_path`, `svg_node_rect`, `svg_node_label`
93
- - `HybridSearch#search_hybrid_rrf` (83.2 → passing): extracted `extract_rrf_tag_info`, `build_rrf_literals`, `build_rrf_filter_sql`, `post_process_rrf_results`
94
- - `HybridSearch#merge_with_rrf` (65.7 → passing): extracted `merge_vector_rrf_entry`, `merge_fulltext_rrf_entry`, `merge_tag_rrf_entry`
95
- - `RelevanceScorer#fetch_nodes_by_tags` (62.6 → passing): extracted `build_tag_base_query`, `apply_match_all_constraint`
96
- - `MarkdownLoader#sync_chunks` (61.2 → passing): extracted `update_existing_chunk`, `soft_delete_removed_chunks`
97
- - `HybridSearch#build_hybrid_cte_sql` (55.9 → passing): extracted per-CTE builder methods
98
- - `Config::Database#build_database_url` (55.6 → passing): extracted `database_auth_segment`
99
- - `MCP::GetWorkingMemoryTool#call` (56.0 → passing): extracted `format_working_memory_entry`
100
- - `MarkdownLoader#load_file` (50.1 → passing): extracted `validate_file_path!`, `read_file_content`, `prepend_frontmatter_to_chunk`
101
- - `Config#apply_provider_config` (77.4 → passing): replaced `case` statement with dynamic dispatch (`send(:"apply_#{provider}_provider_config", config)`)
102
- - `RememberWorkflow#finalize_step` (50.7 → passing): extracted `finalize_node`, `evict_working_memory_if_needed`
103
- - `HTM#remember`: extracted `validate_remember_content!`, `validate_remember_tags!`, `enqueue_background_jobs`, `handle_existing_node_tags`, `store_in_working_memory`
104
- - **RuboCop: 128 offenses resolved** - Zero offenses across 89 files:
105
- - Replaced all `[[x, min].max, max].min` patterns with `x.clamp(min, max)` in `tag_operations.rb`, `fulltext_search.rb`, `vector_search.rb`, `hybrid_search.rb`
106
- - Broke all `end.sort_by {}` / `end.map {}` multiline block chains into two statements across `database.rb`, `hybrid_search.rb`, `relevance_scorer.rb`, `mcp/cli.rb`, `working_memory.rb`
107
- - Updated `.rubocop.yml`: added `AllowedMethods` for bang methods (`soft_delete!`, `restore!`) and MCP DSL (`arguments` block), excluded `lib/tasks/**/*` from `BlockLength`, `MethodLength`, `FormatStringToken`, and `LineLength` cops
108
- - Removed development dependencies from `htm.gemspec` in favour of `Gemfile` group blocks (enforced by `Gemspec/DevelopmentDependencies`)
109
-
110
- - **Test database isolation** - Two-layer protection prevents tests from polluting development/production
111
- - `Rakefile`: `set_test_env` task now ALWAYS overrides `HTM_DATABASE__URL` to test database
112
- - Uses `#{service_name}_test` pattern (e.g., `htm_test`) based on `HTM_SERVICE__NAME` env var
113
- - `test_helper.rb`: Safety check aborts with helpful message if database URL doesn't contain `_test`
114
- - Prevents accidental test execution against non-test databases
174
+ - Every method scores under Flog's limit of 50.
175
+ - RuboCop reports no offenses (128 resolved).
176
+ - Development dependencies moved from the gemspec to the Gemfile.
115
177
 
116
178
  ## [0.0.20] - 2025-12-22
117
179
  ### Added
data/README.md CHANGED
@@ -1,10 +1,7 @@
1
1
 
2
2
  <div align="center">
3
3
  <div style="background: linear-gradient(135deg, #90EE90 0%, #32CD32 100%); border: 4px solid #228B22; border-radius: 12px; padding: 20px; margin: 20px auto; max-width: 800px; box-shadow: 0 8px 16px rgba(34, 139, 34, 0.3);">
4
- <p style="color: #000000; font-size: 42px; font-weight: bold; margin: 0;">
5
- 🚀 v0.0.20 🚀
6
- </p>
7
- <p style="color: #000; font-size: 27px; font-weight: bold; margin: 10px 0 0 0; line-height: 1.6;">
4
+ <p style="color: #000; font-size: 27px; font-weight: bold; margin: 0; line-height: 1.6;">
8
5
  <strong>Fiber-based concurrency</strong> is now the default.<br/>
9
6
  Parallel embedding, tagging, and proposition extraction via simple_flow.
10
7
  </p>
@@ -44,29 +41,35 @@ HTM is a Ruby gem that provides durable, shared memory for LLM-powered applicati
44
41
 
45
42
  ### MCP Server — Connect Any AI Tool
46
43
 
47
- HTM includes a Model Context Protocol server with 23 tools for memory management. Connect Claude Desktop, Claude Code, AIA, or any MCP-compatible client:
44
+ HTM includes a Model Context Protocol server with 52 tools covering memory, tags, files, robot teams and robot groups. Connect Claude Desktop, Claude Code, AIA, or any MCP-compatible client:
48
45
 
49
46
  ```json
50
47
  {
51
48
  "mcpServers": {
52
49
  "htm": {
53
- "command": "htm_mcp",
50
+ "command": "htm",
51
+ "args": ["mcp"],
54
52
  "env": { "HTM_DATABASE__URL": "postgresql://localhost/htm" }
55
53
  }
56
54
  }
57
55
  }
58
56
  ```
59
57
 
60
- The `htm_mcp` executable includes CLI commands for database management:
58
+ The `htm` executable starts the server and manages HTM from the command line:
61
59
 
62
60
  ```bash
63
- htm_mcp setup # Initialize database schema
64
- htm_mcp verify # Check connection and migrations
65
- htm_mcp stats # Show memory statistics
66
- htm_mcp help # Full help with environment variables
67
- htm_mcp # Start MCP server (default)
61
+ htm mcp # Start the MCP server
62
+ htm db setup # Initialize database schema
63
+ htm db verify # Check the connection and pgvector
64
+ htm db stats # Show memory statistics
65
+ htm recall "how do we store embeddings" # Search memory
66
+ htm remember "We chose pgvector" -t database:postgresql
67
+ htm env # List the configuration environment variables
68
+ htm help # Every command (recall, remember, forget, wm, db, tags, ...)
68
69
  ```
69
70
 
71
+ See the [Command Line reference](https://madbomber.github.io/htm/guides/cli/) for every command.
72
+
70
73
  Now your AI assistant can remember and recall across sessions:
71
74
  - Store decisions, preferences, and context
72
75
  - Search memories with natural language
@@ -146,12 +149,14 @@ For MCP integration, database setup, and configuration options, see the [full do
146
149
 
147
150
  | Feature | Description |
148
151
  |---------|-------------|
149
- | **MCP Server** | 23 tools for AI assistant integration |
152
+ | **MCP Server** | 52 tools for AI assistant integration |
150
153
  | **Hive Mind** | Shared memory across all robots |
151
154
  | **Vector Search** | Semantic retrieval with pgvector |
152
155
  | **Hybrid Search** | Combines vector + full-text matching |
153
156
  | **Graph Traversal** | CTE-based relationship traversal via Jaccard-weighted edges |
154
- | **Temporal Queries** | "last week", "yesterday", date ranges |
157
+ | **Temporal Queries** | "last week", "yesterday", date ranges, filtered by when events happened (or were recorded), plus `as_of` validity |
158
+ | **Memory Timelines** | `remember(supersedes:)` retires outdated facts; `timeline` and `recall(include_history:)` show how a memory changed |
159
+ | **Epistemic Status** | Each memory is stated, extracted, inferred or a hypothesis, with evidence and confidence; `confirm` and `first_mention` |
155
160
  | **Auto-Tagging** | LLM extracts hierarchical tags automatically |
156
161
  | **Auto-Relationships** | Tag co-occurrence edges computed after tagging |
157
162
  | **Robot Groups** | High-availability with failover |
@@ -160,9 +165,9 @@ For MCP integration, database setup, and configuration options, see the [full do
160
165
 
161
166
  ## Requirements
162
167
 
163
- - Ruby 3.0+
168
+ - Ruby 4.0+
164
169
  - PostgreSQL with pgvector and pg_trgm extensions
165
- - Ollama (default) or any local/private provider for embeddings and classifications
170
+ - [LM Studio](https://lmstudio.ai) (default, `:lms` provider) or any supported local or cloud provider for embeddings and classifications
166
171
 
167
172
  ## Documentation
168
173
 
@@ -170,7 +175,7 @@ For MCP integration, database setup, and configuration options, see the [full do
170
175
 
171
176
  - [Installation & Setup](https://madbomber.github.io/htm/getting-started/)
172
177
  - [MCP Server Guide](https://madbomber.github.io/htm/guides/mcp-server/)
173
- - [Rails Integration](https://madbomber.github.io/htm/guides/rails/)
178
+ - [Rails Integration](https://madbomber.github.io/htm/examples/rails-integration/)
174
179
  - [API Reference](https://madbomber.github.io/htm/api/)
175
180
 
176
181
  ## Why "Robots" Instead of "Agents"?
data/SETUP.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  1. **Ruby** (version 3.0 or higher)
6
6
  2. **PostgreSQL** (14+ with pgvector and pg_trgm extensions)
7
- 3. **Ollama** (for embeddings via RubyLLM)
7
+ 3. **LM Studio** (for embeddings and tag extraction via RubyLLM)
8
8
 
9
9
  ## PostgreSQL Setup
10
10
 
@@ -80,56 +80,56 @@ You should see:
80
80
  ✓ pg_trgm Extension: Version 1.6
81
81
  ```
82
82
 
83
- ## Ollama Setup
83
+ ## LM Studio Setup
84
84
 
85
- HTM uses RubyLLM with the Ollama provider for generating embeddings. You need to install and run Ollama locally.
85
+ HTM uses RubyLLM with the LM Studio provider (`:lms`, from the `ruby_llm-providers-lms` gem, installed and loaded automatically with HTM) for embeddings, tag extraction and proposition extraction. You need to install and run LM Studio locally.
86
86
 
87
- ### 1. Install Ollama
87
+ ### 1. Install LM Studio
88
88
 
89
- **macOS:**
90
- ```bash
91
- curl https://ollama.ai/install.sh | sh
92
- ```
89
+ Download LM Studio from https://lmstudio.ai. It ships the `lms` command-line tool; if `lms` is not on your PATH after installing, run LM Studio once and follow its prompt to install the CLI.
93
90
 
94
- **Or download from:** https://ollama.ai/download
95
-
96
- ### 2. Start Ollama Service
91
+ ### 2. Start the LM Studio Server
97
92
 
98
93
  ```bash
99
- # Ollama typically starts automatically after installation
100
- # Verify it's running:
101
- curl http://localhost:11434/api/version
94
+ lms server start
95
+
96
+ # Verify it's running (OpenAI-compatible API):
97
+ curl http://localhost:1234/v1/models
102
98
  ```
103
99
 
104
- ### 3. Pull Required Models
100
+ ### 3. Download Required Models
105
101
 
106
102
  ```bash
107
- # Pull the embedding model
108
- ollama pull nomic-embed-text
103
+ # Embedding model (768 dimensions)
104
+ lms get nomic-embed-text-v1.5
109
105
 
110
- # Pull the chat model (for tag extraction)
111
- ollama pull llama3
106
+ # Chat model (for tag and proposition extraction)
107
+ lms get google/gemma-3-4b
112
108
 
113
109
  # Verify models are available
114
- ollama list
110
+ lms ls
115
111
  ```
116
112
 
113
+ LM Studio loads a model just in time on the first request, so `lms load <model>` is optional.
114
+
117
115
  ### 4. Test Embedding Generation
118
116
 
119
117
  ```bash
120
118
  # Test that embeddings work
121
- curl http://localhost:11434/api/embeddings -d '{
122
- "model": "nomic-embed-text",
123
- "prompt": "Hello, world!"
119
+ curl http://localhost:1234/v1/embeddings \
120
+ -H "Content-Type: application/json" \
121
+ -d '{
122
+ "model": "text-embedding-nomic-embed-text-v1.5",
123
+ "input": "Hello, world!"
124
124
  }'
125
125
  ```
126
126
 
127
- ### Optional: Custom Ollama URL
127
+ ### Optional: Custom LM Studio URL
128
128
 
129
- If Ollama is running on a different host/port, set the environment variable:
129
+ If LM Studio is running on a different host/port, set the environment variable:
130
130
 
131
131
  ```bash
132
- export OLLAMA_URL="http://custom-host:11434"
132
+ export HTM_PROVIDERS__LMS__URL="http://custom-host:1234/v1"
133
133
  ```
134
134
 
135
135
  ## Environment Variables Reference
@@ -142,7 +142,7 @@ export OLLAMA_URL="http://custom-host:11434"
142
142
  | `HTM_DATABASE__PASSWORD` | Database password (fallback) | `` |
143
143
  | `HTM_DATABASE__HOST` | Database host (fallback) | `localhost` |
144
144
  | `HTM_DATABASE__PORT` | Database port (fallback) | `5432` |
145
- | `OLLAMA_URL` | Ollama server URL | `http://localhost:11434` |
145
+ | `HTM_PROVIDERS__LMS__URL` | LM Studio server URL | `http://localhost:1234/v1` |
146
146
 
147
147
  ## Development Workflow
148
148
 
@@ -156,10 +156,10 @@ export HTM_DATABASE__URL="postgresql://postgres@localhost:5432/htm_development"
156
156
  bundle install
157
157
 
158
158
  # 3. Initialize database schema
159
- rake db_setup
159
+ bundle exec bin/htm db setup
160
160
 
161
161
  # 4. Run tests
162
- rake test
162
+ asgard test
163
163
 
164
164
  # 5. Try the basic example
165
165
  ruby examples/basic_usage.rb
@@ -171,7 +171,7 @@ HTM uses Minitest for testing:
171
171
 
172
172
  ```bash
173
173
  # Run all tests
174
- rake test
174
+ asgard test
175
175
 
176
176
  # Run specific test file
177
177
  ruby test/htm_test.rb
@@ -213,34 +213,37 @@ HTM/
213
213
  ├── CLAUDE.md # AI assistant instructions
214
214
  ├── Gemfile
215
215
  ├── htm.gemspec
216
- └── Rakefile # Rake tasks
216
+ ├── bin/htm # htm command line (MCP server, db, tags, files, ...)
217
+ ├── .loki # asgard tasks for developing HTM
218
+ └── test.loki, examples.loki, doc.loki # repo-only asgard tasks
217
219
  ```
218
220
 
219
221
  ## Troubleshooting
220
222
 
221
- ### Ollama Issues
223
+ ### LM Studio Issues
222
224
 
223
225
  If you encounter embedding errors:
224
226
 
225
227
  ```bash
226
- # Verify Ollama is running
227
- curl http://localhost:11434/api/version
228
+ # Verify the LM Studio server is running
229
+ curl http://localhost:1234/v1/models
228
230
 
229
- # Check if models are available
230
- ollama list
231
+ # Check if models are downloaded
232
+ lms ls
231
233
 
232
234
  # Test embedding generation
233
- curl http://localhost:11434/api/embeddings -d '{"model": "nomic-embed-text", "prompt": "Test"}'
235
+ curl http://localhost:1234/v1/embeddings -H "Content-Type: application/json" \
236
+ -d '{"model": "text-embedding-nomic-embed-text-v1.5", "input": "Test"}'
234
237
 
235
- # View Ollama logs (macOS)
236
- # Check Console.app or Activity Monitor
238
+ # Stream LM Studio server logs
239
+ lms log stream
237
240
  ```
238
241
 
239
- **Common Ollama Errors:**
242
+ **Common LM Studio Errors:**
240
243
 
241
- - **"connection refused"**: Ollama service is not running. Start Ollama from Applications or via CLI.
242
- - **"model not found"**: Run `ollama pull nomic-embed-text` to download the model.
243
- - **Custom URL not working**: Ensure `OLLAMA_URL` environment variable is set correctly.
244
+ - **"connection refused"**: The LM Studio server is not running. Start it with `lms server start` or from the Developer tab in the LM Studio app.
245
+ - **"model not found"**: Run `lms get nomic-embed-text-v1.5` (or `lms get google/gemma-3-4b` for tag extraction) to download the model.
246
+ - **Custom URL not working**: Ensure `HTM_PROVIDERS__LMS__URL` is set correctly and ends in `/v1`.
244
247
 
245
248
  ### Database Connection Issues
246
249
 
@@ -284,7 +287,7 @@ psql htm_development_test -c "CREATE EXTENSION IF NOT EXISTS vector; CREATE EXTE
284
287
 
285
288
  ## Resources
286
289
 
287
- - **Ollama**: https://ollama.ai/
290
+ - **LM Studio**: https://lmstudio.ai/
288
291
  - **RubyLLM**: https://github.com/crmne/ruby_llm
289
292
  - **pgvector Docs**: https://github.com/pgvector/pgvector
290
293
  - **PostgreSQL Docs**: https://www.postgresql.org/docs/
@@ -295,5 +298,5 @@ psql htm_development_test -c "CREATE EXTENSION IF NOT EXISTS vector; CREATE EXTE
295
298
  For issues or questions:
296
299
  1. Check `htm_teamwork.md` for design decisions
297
300
  2. Review examples in `examples/` directory
298
- 3. Run tests with `rake test` (Minitest framework)
299
- 4. Check Ollama status for embedding issues
301
+ 3. Run tests with `asgard test` (Minitest framework)
302
+ 4. Check LM Studio server status (`curl http://localhost:1234/v1/models`) for embedding issues
data/_typos.toml ADDED
@@ -0,0 +1,17 @@
1
+ # typos configuration: https://github.com/crate-ci/typos
2
+ [files]
3
+ # pg_dump writes a random \restrict token into the schema dump
4
+ extend-exclude = ["db/schema.sql"]
5
+
6
+ [default.extend-words]
7
+ # Deliberate misspellings used to demonstrate fuzzy (pg_trgm) matching
8
+ postgrsql = "postgrsql"
9
+ retreval = "retreval"
10
+ # "as a service" suffix (saas, paas) that the tag singularizer leaves alone
11
+ aas = "aas"
12
+ # Accepted spelling
13
+ unparseable = "unparseable"
14
+ # Thor truncates long help lines ("rebuil...") in the quoted CLI output
15
+ rebuil = "rebuil"
16
+ # Ordinal suffix ("2nd") in the date patterns of lib/htm/event_time.rb
17
+ nd = "nd"
data/bin/htm ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # The htm command line: `htm mcp` starts the MCP server, `htm help` lists
5
+ # the rest.
6
+
7
+ # Run from a checkout (the gem does not ship the Gemfile), use its bundle so
8
+ # gems resolve as Gemfile.lock pins them. Without it RubyGems activates the
9
+ # newest version of each gem, which can conflict (fast-mcp needs json ~> 2.0).
10
+ gemfile = File.expand_path("../Gemfile", __dir__)
11
+ if File.exist?(gemfile) && !defined?(Bundler)
12
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
13
+ require "bundler/setup"
14
+ end
15
+
16
+ require_relative "../lib/htm/cli"
17
+
18
+ HTM::CLI.start(ARGV)