htm 0.0.31 → 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 (616) 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 +16 -17
  9. data/.reek.yml +104 -0
  10. data/.rubocop.yml +173 -0
  11. data/.ruby-version +1 -0
  12. data/CHANGELOG.md +162 -54
  13. data/README.md +24 -17
  14. data/SETUP.md +49 -46
  15. data/_typos.toml +17 -0
  16. data/bin/htm +18 -0
  17. data/db/migrate/00008_create_node_relationships.rb +54 -0
  18. data/db/migrate/00009_fix_node_relationships_column_types.rb +17 -0
  19. data/db/migrate/00010_convert_embedding_to_sparsevec.rb +47 -0
  20. data/db/migrate/00011_strip_frontmatter_from_chunks.rb +66 -0
  21. data/db/migrate/00012_add_event_time_to_nodes.rb +110 -0
  22. data/db/migrate/00013_create_node_links.rb +158 -0
  23. data/db/migrate/00014_add_epistemic_status.rb +110 -0
  24. data/db/schema.sql +361 -7
  25. data/db/seed_data/README.md +11 -11
  26. data/db/seeds.rb +11 -11
  27. data/docs/api/database.md +43 -65
  28. data/docs/api/embedding-service.md +139 -263
  29. data/docs/api/htm.md +128 -12
  30. data/docs/api/index.md +34 -23
  31. data/docs/api/long-term-memory.md +8 -19
  32. data/docs/api/working-memory.md +42 -54
  33. data/docs/api/yard/HTM/Admin/Console.md +53 -0
  34. data/docs/api/yard/HTM/Admin/DatabaseCommands/Console.md +38 -0
  35. data/docs/api/yard/HTM/Admin/DatabaseCommands.md +127 -0
  36. data/docs/api/yard/HTM/Admin/EnrichCommands.md +85 -0
  37. data/docs/api/yard/HTM/Admin/Error.md +9 -0
  38. data/docs/api/yard/HTM/Admin/FileCommands/Console.md +50 -0
  39. data/docs/api/yard/HTM/Admin/FileCommands.md +83 -0
  40. data/docs/api/yard/HTM/Admin/MemoryCommands/Base.md +17 -0
  41. data/docs/api/yard/HTM/Admin/MemoryCommands/Edit.md +74 -0
  42. data/docs/api/yard/HTM/Admin/MemoryCommands/Search.md +77 -0
  43. data/docs/api/yard/HTM/Admin/MemoryCommands/TagSearch.md +46 -0
  44. data/docs/api/yard/HTM/Admin/MemoryCommands/WorkingMemory.md +36 -0
  45. data/docs/api/yard/HTM/Admin/MemoryCommands.md +67 -0
  46. data/docs/api/yard/HTM/Admin/TagCommands/Console.md +48 -0
  47. data/docs/api/yard/HTM/Admin/TagCommands.md +105 -0
  48. data/docs/api/yard/HTM/Admin/TagGraph.md +149 -0
  49. data/docs/api/yard/HTM/Admin/YardDocs.md +60 -0
  50. data/docs/api/yard/HTM/Admin.md +102 -0
  51. data/docs/api/yard/HTM/AuthorizationError.md +6 -6
  52. data/docs/api/yard/HTM/CLI/ConfigFile.md +40 -0
  53. data/docs/api/yard/HTM/CLI/Db.md +63 -0
  54. data/docs/api/yard/HTM/CLI/Enrich.md +39 -0
  55. data/docs/api/yard/HTM/CLI/ErrorSuggestion.md +56 -0
  56. data/docs/api/yard/HTM/CLI/Files.md +36 -0
  57. data/docs/api/yard/HTM/CLI/Group/ClassMethods.md +11 -0
  58. data/docs/api/yard/HTM/CLI/Group.md +13 -0
  59. data/docs/api/yard/HTM/CLI/MemoryCommand/ClassMethods.md +20 -0
  60. data/docs/api/yard/HTM/CLI/MemoryCommand.md +9 -0
  61. data/docs/api/yard/HTM/CLI/Robots.md +31 -0
  62. data/docs/api/yard/HTM/CLI/Support.md +9 -0
  63. data/docs/api/yard/HTM/CLI/Tags.md +57 -0
  64. data/docs/api/yard/HTM/CLI/WorkingMemory.md +24 -0
  65. data/docs/api/yard/HTM/CLI.md +84 -0
  66. data/docs/api/yard/HTM/CircuitBreaker/Guarded.md +29 -0
  67. data/docs/api/yard/HTM/CircuitBreaker/Settings.md +21 -0
  68. data/docs/api/yard/HTM/CircuitBreaker/Status.md +42 -0
  69. data/docs/api/yard/HTM/CircuitBreaker.md +54 -49
  70. data/docs/api/yard/HTM/CircuitBreakerOpenError.md +9 -9
  71. data/docs/api/yard/HTM/Config/Builder.md +87 -0
  72. data/docs/api/yard/HTM/Config/Coercion.md +59 -0
  73. data/docs/api/yard/HTM/Config/Database.md +102 -0
  74. data/docs/api/yard/HTM/Config/Readers.md +30 -0
  75. data/docs/api/yard/HTM/Config/RubyLlmSettings.md +32 -0
  76. data/docs/api/yard/HTM/Config/Validator.md +59 -0
  77. data/docs/api/yard/HTM/Config.md +224 -105
  78. data/docs/api/yard/HTM/ConfigurationError.md +20 -0
  79. data/docs/api/yard/HTM/Confirmation.md +22 -0
  80. data/docs/api/yard/HTM/Database/Connection.md +26 -0
  81. data/docs/api/yard/HTM/Database/Migrations.md +32 -0
  82. data/docs/api/yard/HTM/Database/Report.md +26 -0
  83. data/docs/api/yard/HTM/Database/SchemaFile.md +52 -0
  84. data/docs/api/yard/HTM/Database/Teardown.md +15 -0
  85. data/docs/api/yard/HTM/Database.md +58 -70
  86. data/docs/api/yard/HTM/DatabaseDocs.md +67 -0
  87. data/docs/api/yard/HTM/DatabaseError.md +6 -6
  88. data/docs/api/yard/HTM/Deletion.md +32 -0
  89. data/docs/api/yard/HTM/EmbeddingError.md +6 -6
  90. data/docs/api/yard/HTM/EmbeddingService.md +37 -38
  91. data/docs/api/yard/HTM/Epistemics.md +135 -0
  92. data/docs/api/yard/HTM/Error.md +6 -6
  93. data/docs/api/yard/HTM/EventTime.md +110 -0
  94. data/docs/api/yard/HTM/FileMemory.md +76 -0
  95. data/docs/api/yard/HTM/InputValidator.md +82 -0
  96. data/docs/api/yard/HTM/JobAdapter/Job.md +26 -0
  97. data/docs/api/yard/HTM/JobAdapter.md +35 -16
  98. data/docs/api/yard/HTM/Jobs/FailureLogging.md +14 -0
  99. data/docs/api/yard/HTM/Jobs/GenerateEmbeddingJob.md +16 -0
  100. data/docs/api/yard/HTM/Jobs/GeneratePropositionsJob.md +17 -0
  101. data/docs/api/yard/HTM/Jobs/GenerateRelationshipsJob.md +26 -0
  102. data/docs/api/yard/HTM/Jobs/GenerateTagsJob.md +17 -0
  103. data/docs/api/yard/HTM/Jobs/LlmCallTimer.md +58 -0
  104. data/docs/api/yard/HTM/Jobs/NodeLookup.md +14 -0
  105. data/docs/api/yard/HTM/Jobs.md +13 -0
  106. data/docs/api/yard/HTM/Loaders/ChunkSync/Chunk.md +22 -0
  107. data/docs/api/yard/HTM/Loaders/ChunkSync.md +50 -0
  108. data/docs/api/yard/HTM/Loaders/MarkdownChunker/Coalescer.md +24 -0
  109. data/docs/api/yard/HTM/Loaders/MarkdownChunker/Packer.md +20 -0
  110. data/docs/api/yard/HTM/Loaders/MarkdownChunker/Splitter.md +18 -0
  111. data/docs/api/yard/HTM/Loaders/MarkdownChunker.md +83 -0
  112. data/docs/api/yard/HTM/Loaders/MarkdownLoader/Document.md +43 -0
  113. data/docs/api/yard/HTM/Loaders/MarkdownLoader.md +62 -0
  114. data/docs/api/yard/HTM/Loaders.md +5 -0
  115. data/docs/api/yard/HTM/LongTermMemory/FulltextSearch.md +36 -0
  116. data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfMerger.md +25 -0
  117. data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfRows.md +30 -0
  118. data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfSql/Query.md +79 -0
  119. data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfSql/Source.md +45 -0
  120. data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfSql.md +11 -0
  121. data/docs/api/yard/HTM/LongTermMemory/HybridSearch/TagDepth.md +52 -0
  122. data/docs/api/yard/HTM/LongTermMemory/HybridSearch.md +52 -0
  123. data/docs/api/yard/HTM/LongTermMemory/NodeOperations.md +95 -0
  124. data/docs/api/yard/HTM/LongTermMemory/RelevanceScorer/HierarchicalJaccard.md +58 -0
  125. data/docs/api/yard/HTM/LongTermMemory/RelevanceScorer/TagSearch.md +27 -0
  126. data/docs/api/yard/HTM/LongTermMemory/RelevanceScorer.md +81 -0
  127. data/docs/api/yard/HTM/LongTermMemory/RobotOperations.md +22 -0
  128. data/docs/api/yard/HTM/LongTermMemory/TagOperations/ExpiringValue.md +24 -0
  129. data/docs/api/yard/HTM/LongTermMemory/TagOperations/TagMatchSql.md +40 -0
  130. data/docs/api/yard/HTM/LongTermMemory/TagOperations.md +129 -0
  131. data/docs/api/yard/HTM/LongTermMemory/VectorSearch.md +30 -0
  132. data/docs/api/yard/HTM/LongTermMemory.md +279 -31
  133. data/docs/api/yard/HTM/MCP/AssembleContextTool.md +16 -0
  134. data/docs/api/yard/HTM/MCP/ClearGroupWorkingMemoryTool.md +12 -0
  135. data/docs/api/yard/HTM/MCP/ClearWorkingMemoryTool.md +12 -0
  136. data/docs/api/yard/HTM/MCP/ConfigResource.md +12 -0
  137. data/docs/api/yard/HTM/MCP/ConfirmTool.md +12 -0
  138. data/docs/api/yard/HTM/MCP/CreateGroupTool.md +12 -0
  139. data/docs/api/yard/HTM/MCP/EnrichPendingTool.md +16 -0
  140. data/docs/api/yard/HTM/MCP/ExtractPropositionsTool.md +12 -0
  141. data/docs/api/yard/HTM/MCP/FailoverTool.md +12 -0
  142. data/docs/api/yard/HTM/MCP/FileInfoTool.md +13 -0
  143. data/docs/api/yard/HTM/MCP/FileSourcesResource.md +12 -0
  144. data/docs/api/yard/HTM/MCP/FileSupport.md +7 -0
  145. data/docs/api/yard/HTM/MCP/FindByTopicTool.md +12 -0
  146. data/docs/api/yard/HTM/MCP/FirstMentionTool.md +12 -0
  147. data/docs/api/yard/HTM/MCP/ForgetContentTool.md +12 -0
  148. data/docs/api/yard/HTM/MCP/ForgetTool.md +12 -0
  149. data/docs/api/yard/HTM/MCP/GetGroupStatusTool.md +12 -0
  150. data/docs/api/yard/HTM/MCP/GetGroupWorkingMemoryTool.md +12 -0
  151. data/docs/api/yard/HTM/MCP/GetNodeTool.md +12 -0
  152. data/docs/api/yard/HTM/MCP/GetRobotTool.md +12 -0
  153. data/docs/api/yard/HTM/MCP/GetWorkingMemoryTool.md +12 -0
  154. data/docs/api/yard/HTM/MCP/GroupRecallTool.md +12 -0
  155. data/docs/api/yard/HTM/MCP/GroupRememberTool.md +12 -0
  156. data/docs/api/yard/HTM/MCP/GroupSession.md +23 -0
  157. data/docs/api/yard/HTM/MCP/JoinGroupTool.md +12 -0
  158. data/docs/api/yard/HTM/MCP/LeaveGroupTool.md +12 -0
  159. data/docs/api/yard/HTM/MCP/ListDeletedTool.md +12 -0
  160. data/docs/api/yard/HTM/MCP/ListFilesTool.md +13 -0
  161. data/docs/api/yard/HTM/MCP/ListGroupsTool.md +12 -0
  162. data/docs/api/yard/HTM/MCP/ListRobotsTool.md +12 -0
  163. data/docs/api/yard/HTM/MCP/ListTagsTool.md +12 -0
  164. data/docs/api/yard/HTM/MCP/LoadDirectoryTool.md +13 -0
  165. data/docs/api/yard/HTM/MCP/LoadFileTool.md +13 -0
  166. data/docs/api/yard/HTM/MCP/MemoryStatsResource.md +13 -0
  167. data/docs/api/yard/HTM/MCP/PopularTagsTool.md +12 -0
  168. data/docs/api/yard/HTM/MCP/PromoteRobotTool.md +12 -0
  169. data/docs/api/yard/HTM/MCP/PurgeDeletedTool.md +12 -0
  170. data/docs/api/yard/HTM/MCP/RecallTool.md +16 -0
  171. data/docs/api/yard/HTM/MCP/RecentMemoriesResource.md +13 -0
  172. data/docs/api/yard/HTM/MCP/RelatedNodesTool.md +12 -0
  173. data/docs/api/yard/HTM/MCP/RememberTool.md +12 -0
  174. data/docs/api/yard/HTM/MCP/RestoreTool.md +12 -0
  175. data/docs/api/yard/HTM/MCP/RobotGroupsResource.md +13 -0
  176. data/docs/api/yard/HTM/MCP/RobotTeamsStatusTool.md +13 -0
  177. data/docs/api/yard/HTM/MCP/RunRobotTeamsTool.md +13 -0
  178. data/docs/api/yard/HTM/MCP/SearchByTagsTool.md +16 -0
  179. data/docs/api/yard/HTM/MCP/SearchTagsTool.md +12 -0
  180. data/docs/api/yard/HTM/MCP/Server.md +37 -0
  181. data/docs/api/yard/HTM/MCP/Session.md +32 -0
  182. data/docs/api/yard/HTM/MCP/SetRobotTool.md +12 -0
  183. data/docs/api/yard/HTM/MCP/ShutdownGroupTool.md +12 -0
  184. data/docs/api/yard/HTM/MCP/StartupPromptResource.md +16 -0
  185. data/docs/api/yard/HTM/MCP/StatsTool.md +12 -0
  186. data/docs/api/yard/HTM/MCP/SyncFilesTool.md +13 -0
  187. data/docs/api/yard/HTM/MCP/SyncGroupTool.md +12 -0
  188. data/docs/api/yard/HTM/MCP/TagHierarchyResource.md +16 -0
  189. data/docs/api/yard/HTM/MCP/TagNodeTool.md +12 -0
  190. data/docs/api/yard/HTM/MCP/TagTreeTool.md +22 -0
  191. data/docs/api/yard/HTM/MCP/TeamNames.md +7 -0
  192. data/docs/api/yard/HTM/MCP/TimelineTool.md +12 -0
  193. data/docs/api/yard/HTM/MCP/Tool.md +24 -0
  194. data/docs/api/yard/HTM/MCP/ToolSupport.md +17 -0
  195. data/docs/api/yard/HTM/MCP/TopicRelationshipsTool.md +12 -0
  196. data/docs/api/yard/HTM/MCP/TransferWorkingMemoryTool.md +12 -0
  197. data/docs/api/yard/HTM/MCP/UnloadFileTool.md +13 -0
  198. data/docs/api/yard/HTM/MCP/UntagNodeTool.md +12 -0
  199. data/docs/api/yard/HTM/MCP.md +30 -0
  200. data/docs/api/yard/HTM/Migration.md +44 -0
  201. data/docs/api/yard/HTM/Models/FileSource.md +66 -0
  202. data/docs/api/yard/HTM/Models/Node/Scopes.md +74 -0
  203. data/docs/api/yard/HTM/Models/Node/SoftDeletion.md +22 -0
  204. data/docs/api/yard/HTM/Models/Node/VectorSimilarity.md +28 -0
  205. data/docs/api/yard/HTM/Models/Node.md +113 -0
  206. data/docs/api/yard/HTM/Models/NodeLink.md +65 -0
  207. data/docs/api/yard/HTM/Models/NodeRelationship.md +31 -0
  208. data/docs/api/yard/HTM/Models/NodeTag.md +38 -0
  209. data/docs/api/yard/HTM/Models/Robot.md +50 -0
  210. data/docs/api/yard/HTM/Models/RobotNode.md +35 -0
  211. data/docs/api/yard/HTM/Models/Tag/Scopes.md +32 -0
  212. data/docs/api/yard/HTM/Models/Tag.md +112 -0
  213. data/docs/api/yard/HTM/Models.md +5 -0
  214. data/docs/api/yard/HTM/NodeEnrichment.md +36 -0
  215. data/docs/api/yard/HTM/NodeView.md +113 -0
  216. data/docs/api/yard/HTM/NotFoundError.md +6 -5
  217. data/docs/api/yard/HTM/Observability.md +58 -40
  218. data/docs/api/yard/HTM/PropositionError.md +6 -6
  219. data/docs/api/yard/HTM/PropositionService.md +63 -29
  220. data/docs/api/yard/HTM/QueryCache/KeyNormalizer.md +25 -0
  221. data/docs/api/yard/HTM/QueryCache/NullStore.md +19 -0
  222. data/docs/api/yard/HTM/QueryCache/Store.md +43 -0
  223. data/docs/api/yard/HTM/QueryCache.md +41 -46
  224. data/docs/api/yard/HTM/QueryTimeoutError.md +9 -8
  225. data/docs/api/yard/HTM/Railtie.md +11 -7
  226. data/docs/api/yard/HTM/RecallQuery.md +111 -0
  227. data/docs/api/yard/HTM/ResourceExhaustedError.md +6 -6
  228. data/docs/api/yard/HTM/RobotGroup/CacheSync.md +35 -0
  229. data/docs/api/yard/HTM/RobotGroup/Membership.md +96 -0
  230. data/docs/api/yard/HTM/RobotGroup/TransferOptions.md +14 -0
  231. data/docs/api/yard/HTM/RobotGroup/WorkingMemoryLedger.md +65 -0
  232. data/docs/api/yard/HTM/RobotGroup.md +116 -360
  233. data/docs/api/yard/HTM/Robots/Actions/TagMove.md +31 -0
  234. data/docs/api/yard/HTM/Robots/Actions.md +153 -0
  235. data/docs/api/yard/HTM/Robots/Neighbors.md +20 -0
  236. data/docs/api/yard/HTM/Robots/Supervisor/Idler.md +26 -0
  237. data/docs/api/yard/HTM/Robots/Supervisor/Roster.md +26 -0
  238. data/docs/api/yard/HTM/Robots/Supervisor.md +42 -0
  239. data/docs/api/yard/HTM/Robots/Team.md +60 -0
  240. data/docs/api/yard/HTM/Robots/Teams/Archivist.md +43 -0
  241. data/docs/api/yard/HTM/Robots/Teams/Consolidator.md +29 -0
  242. data/docs/api/yard/HTM/Robots/Teams/ContradictionDetector.md +33 -0
  243. data/docs/api/yard/HTM/Robots/Teams/TagCurator.md +37 -0
  244. data/docs/api/yard/HTM/Robots/Teams.md +5 -0
  245. data/docs/api/yard/HTM/Robots/Tools/ArchiveNodes.md +12 -0
  246. data/docs/api/yard/HTM/Robots/Tools/Base.md +16 -0
  247. data/docs/api/yard/HTM/Robots/Tools/MergeNodes.md +12 -0
  248. data/docs/api/yard/HTM/Robots/Tools/MergeTags.md +12 -0
  249. data/docs/api/yard/HTM/Robots/Tools/Pass.md +12 -0
  250. data/docs/api/yard/HTM/Robots/Tools/RecordConflict.md +12 -0
  251. data/docs/api/yard/HTM/Robots/Tools/SupersedeNode.md +12 -0
  252. data/docs/api/yard/HTM/Robots/Tools.md +14 -0
  253. data/docs/api/yard/HTM/Robots.md +72 -0
  254. data/docs/api/yard/HTM/SearchFilters.md +82 -0
  255. data/docs/api/yard/HTM/SequelConfig.md +97 -0
  256. data/docs/api/yard/HTM/Settings.md +39 -0
  257. data/docs/api/yard/HTM/Sinatra/Helpers.md +37 -0
  258. data/docs/api/yard/HTM/Sinatra/Middleware.md +29 -0
  259. data/docs/api/yard/HTM/Sinatra.md +44 -0
  260. data/docs/api/yard/HTM/SqlBuilder/Sparsevec.md +69 -0
  261. data/docs/api/yard/HTM/SqlBuilder.md +62 -75
  262. data/docs/api/yard/HTM/StartupPrompt.md +45 -0
  263. data/docs/api/yard/HTM/TagError.md +6 -6
  264. data/docs/api/yard/HTM/TagService.md +100 -37
  265. data/docs/api/yard/HTM/TagTree/Branch.md +43 -0
  266. data/docs/api/yard/HTM/TagTree/SvgRenderer/Layout.md +51 -0
  267. data/docs/api/yard/HTM/TagTree/SvgRenderer.md +25 -0
  268. data/docs/api/yard/HTM/TagTree.md +65 -0
  269. data/docs/api/yard/HTM/Telemetry/NullInstrument.md +12 -9
  270. data/docs/api/yard/HTM/Telemetry/NullMeter.md +17 -9
  271. data/docs/api/yard/HTM/Telemetry.md +53 -50
  272. data/docs/api/yard/HTM/Timeframe/Result.md +13 -16
  273. data/docs/api/yard/HTM/Timeframe.md +17 -20
  274. data/docs/api/yard/HTM/TimeframeExtractor/Patterns.md +18 -0
  275. data/docs/api/yard/HTM/TimeframeExtractor/Result.md +13 -16
  276. data/docs/api/yard/HTM/TimeframeExtractor.md +27 -16
  277. data/docs/api/yard/HTM/Timeline.md +113 -0
  278. data/docs/api/yard/HTM/ValidationError.md +6 -5
  279. data/docs/api/yard/HTM/Workflows/RememberWorkflow/NodeState.md +73 -0
  280. data/docs/api/yard/HTM/Workflows/RememberWorkflow.md +80 -0
  281. data/docs/api/yard/HTM/Workflows.md +5 -0
  282. data/docs/api/yard/HTM/WorkingMemory/Entry.md +67 -0
  283. data/docs/api/yard/HTM/WorkingMemory/Store.md +54 -0
  284. data/docs/api/yard/HTM/WorkingMemory.md +113 -87
  285. data/docs/api/yard/HTM/WorkingMemoryChannel/Subscribers.md +28 -0
  286. data/docs/api/yard/HTM/WorkingMemoryChannel.md +108 -102
  287. data/docs/api/yard/HTM.md +483 -5
  288. data/docs/api/yard/README.md +211 -0
  289. data/docs/api/yard/Sinatra/Base.md +30 -0
  290. data/docs/api/yard/Sinatra.md +7 -0
  291. data/docs/api/yard/index.csv +1834 -181
  292. data/docs/api/yard-reference.md +228 -9
  293. data/docs/architecture/adrs/005-rag-retrieval.md +3 -0
  294. data/docs/architecture/adrs/index.md +1 -1
  295. data/docs/architecture/index.md +7 -9
  296. data/docs/architecture/overview.md +8 -11
  297. data/docs/assets/images/htm-architecture-overview.svg +1 -1
  298. data/docs/assets/images/htm-context-assembly-flow.svg +2 -2
  299. data/docs/assets/images/htm-layered-architecture.svg +3 -3
  300. data/docs/assets/images/project-structure.svg +2 -2
  301. data/docs/assets/images/two-tier-memory-architecture.svg +1 -1
  302. data/docs/database/INDEX.md +113 -0
  303. data/docs/database/README.md +60 -175
  304. data/docs/database/file_sources.md +51 -0
  305. data/docs/database/file_sources.svg +120 -0
  306. data/docs/database/naming-convention.md +12 -12
  307. data/docs/database/node_links.md +65 -0
  308. data/docs/database/node_links.svg +171 -0
  309. data/docs/database/node_relationships.md +62 -0
  310. data/docs/database/node_relationships.svg +124 -0
  311. data/docs/database/node_tags.md +50 -0
  312. data/docs/database/node_tags.svg +125 -0
  313. data/docs/database/nodes.md +120 -0
  314. data/docs/database/nodes.svg +394 -0
  315. data/docs/database/robot_nodes.md +57 -0
  316. data/docs/database/robot_nodes.svg +155 -0
  317. data/docs/database/robots.md +40 -0
  318. data/docs/database/robots.svg +131 -0
  319. data/docs/database/schema.svg +384 -275
  320. data/docs/database/schema_migrations.md +19 -0
  321. data/docs/database/schema_migrations.svg +31 -0
  322. data/docs/database/tags.md +47 -0
  323. data/docs/database/tags.svg +90 -0
  324. data/docs/development/asgard-tasks.md +114 -0
  325. data/docs/development/contributing.md +11 -11
  326. data/docs/development/index.md +19 -24
  327. data/docs/development/schema.md +113 -14
  328. data/docs/development/setup.md +99 -151
  329. data/docs/development/testing.md +58 -66
  330. data/docs/examples/basic-usage.md +9 -9
  331. data/docs/examples/config-files.md +8 -8
  332. data/docs/examples/file-loading.md +16 -16
  333. data/docs/examples/index.md +15 -8
  334. data/docs/examples/llm-configuration.md +13 -9
  335. data/docs/examples/mcp-client.md +61 -59
  336. data/docs/examples/rails-integration.md +5 -4
  337. data/docs/examples/sinatra-integration.md +5 -4
  338. data/docs/examples/standalone-app.md +17 -16
  339. data/docs/getting-started/index.md +3 -3
  340. data/docs/getting-started/installation.md +76 -83
  341. data/docs/getting-started/quick-start.md +28 -26
  342. data/docs/guides/adding-memories.md +28 -4
  343. data/docs/guides/cli.md +458 -0
  344. data/docs/guides/configuration.md +77 -42
  345. data/docs/guides/context-assembly.md +4 -4
  346. data/docs/guides/epistemic-status.md +138 -0
  347. data/docs/guides/event-time.md +106 -0
  348. data/docs/guides/file-loading.md +36 -32
  349. data/docs/guides/getting-started.md +23 -19
  350. data/docs/guides/long-term-memory.md +8 -28
  351. data/docs/guides/mcp-server.md +416 -173
  352. data/docs/guides/propositions.md +30 -40
  353. data/docs/guides/recalling-memories.md +27 -12
  354. data/docs/guides/robot-teams.md +96 -0
  355. data/docs/guides/search-strategies.md +10 -7
  356. data/docs/guides/tags.md +37 -32
  357. data/docs/guides/timeline.md +106 -0
  358. data/docs/index.md +7 -7
  359. data/docs/llms.txt +35 -0
  360. data/docs/multi_framework_support.md +14 -14
  361. data/docs/robots/hive-mind.md +1 -1
  362. data/docs/robots/multi-robot.md +2 -2
  363. data/docs/robots/robot-groups.md +10 -10
  364. data/docs/robots/two-tier-memory.md +85 -120
  365. data/docs/setup_local_database.md +41 -85
  366. data/examples/00_create_examples_db.rb +20 -7
  367. data/examples/01_basic_usage.rb +21 -18
  368. data/examples/02_config_file_example/README.md +13 -12
  369. data/examples/02_config_file_example/config/htm.local.yml +8 -8
  370. data/examples/02_config_file_example/show_config.rb +3 -4
  371. data/examples/03_custom_llm_configuration.rb +13 -12
  372. data/examples/04_file_loader_usage.rb +16 -21
  373. data/examples/05_timeframe_demo.rb +283 -234
  374. data/examples/06_example_app/.loki +36 -0
  375. data/examples/06_example_app/app.rb +22 -33
  376. data/examples/07_cli_app/README.md +18 -18
  377. data/examples/07_cli_app/htm_cli.rb +26 -19
  378. data/examples/08_sinatra_app/Gemfile +1 -0
  379. data/examples/08_sinatra_app/Gemfile.lock +101 -67
  380. data/examples/08_sinatra_app/app.rb +64 -62
  381. data/examples/09_mcp_client.rb +93 -119
  382. data/examples/10_telemetry/README.md +3 -3
  383. data/examples/10_telemetry/SETUP_README.md +2 -2
  384. data/examples/10_telemetry/demo.rb +6 -5
  385. data/examples/11_robot_groups/README.md +5 -4
  386. data/examples/11_robot_groups/lib/robot_worker.rb +0 -5
  387. data/examples/11_robot_groups/multi_process.rb +6 -4
  388. data/examples/11_robot_groups/same_process.rb +19 -17
  389. data/examples/12_rails_app/.envrc +12 -0
  390. data/examples/12_rails_app/Gemfile +8 -3
  391. data/examples/12_rails_app/Gemfile.lock +226 -172
  392. data/examples/12_rails_app/README.md +77 -22
  393. data/examples/12_rails_app/app/controllers/application_controller.rb +6 -0
  394. data/examples/12_rails_app/app/controllers/chats_controller.rb +275 -0
  395. data/examples/12_rails_app/app/controllers/dashboard_controller.rb +3 -0
  396. data/examples/12_rails_app/app/controllers/files_controller.rb +17 -2
  397. data/examples/12_rails_app/app/controllers/home_controller.rb +8 -0
  398. data/examples/12_rails_app/app/controllers/memories_controller.rb +16 -5
  399. data/examples/12_rails_app/app/controllers/messages_controller.rb +177 -0
  400. data/examples/12_rails_app/app/controllers/robots_controller.rb +11 -1
  401. data/examples/12_rails_app/app/controllers/search_controller.rb +7 -2
  402. data/examples/12_rails_app/app/controllers/tags_controller.rb +14 -1
  403. data/examples/12_rails_app/app/javascript/application.js +1 -1
  404. data/examples/12_rails_app/app/models/application_record.rb +5 -0
  405. data/examples/12_rails_app/app/models/chat.rb +3 -0
  406. data/examples/12_rails_app/app/models/message.rb +3 -0
  407. data/examples/12_rails_app/app/views/chats/index.html.erb +61 -0
  408. data/examples/12_rails_app/app/views/chats/show.html.erb +213 -0
  409. data/examples/12_rails_app/app/views/dashboard/index.html.erb +3 -0
  410. data/examples/12_rails_app/app/views/files/index.html.erb +10 -5
  411. data/examples/12_rails_app/app/views/files/new.html.erb +5 -3
  412. data/examples/12_rails_app/app/views/files/show.html.erb +19 -3
  413. data/examples/12_rails_app/app/views/home/index.html.erb +45 -0
  414. data/examples/12_rails_app/app/views/layouts/application.html.erb +20 -18
  415. data/examples/12_rails_app/app/views/memories/_memory_card.html.erb +2 -2
  416. data/examples/12_rails_app/app/views/memories/deleted.html.erb +3 -1
  417. data/examples/12_rails_app/app/views/memories/edit.html.erb +2 -0
  418. data/examples/12_rails_app/app/views/memories/index.html.erb +2 -0
  419. data/examples/12_rails_app/app/views/memories/new.html.erb +14 -0
  420. data/examples/12_rails_app/app/views/memories/show.html.erb +17 -2
  421. data/examples/12_rails_app/app/views/messages/_message.html.erb +20 -0
  422. data/examples/12_rails_app/app/views/robots/index.html.erb +2 -0
  423. data/examples/12_rails_app/app/views/robots/new.html.erb +2 -0
  424. data/examples/12_rails_app/app/views/robots/show.html.erb +2 -0
  425. data/examples/12_rails_app/app/views/search/index.html.erb +77 -10
  426. data/examples/12_rails_app/app/views/shared/_navbar.html.erb +75 -29
  427. data/examples/12_rails_app/app/views/tags/index.html.erb +2 -0
  428. data/examples/12_rails_app/app/views/tags/show.html.erb +3 -1
  429. data/examples/12_rails_app/config/application.rb +1 -1
  430. data/examples/12_rails_app/config/database.yml +9 -5
  431. data/examples/12_rails_app/config/importmap.rb +1 -1
  432. data/examples/12_rails_app/config/initializers/htm.rb +9 -2
  433. data/examples/12_rails_app/config/initializers/ruby_llm.rb +29 -0
  434. data/examples/12_rails_app/config/routes.rb +39 -23
  435. data/examples/12_rails_app/db/migrate/20261205061932_create_ruby_llm_records.rb +160 -0
  436. data/examples/12_rails_app/db/migrate/20261205061933_create_chats.rb +13 -0
  437. data/examples/12_rails_app/db/migrate/20261205061934_create_messages.rb +23 -0
  438. data/examples/12_rails_app/db/schema.rb +210 -0
  439. data/examples/README.md +53 -44
  440. data/examples/examples_helper.rb +52 -3
  441. data/htm.gemspec +68 -0
  442. data/lib/htm/admin/database_commands.rb +454 -0
  443. data/lib/htm/admin/enrich_commands.rb +209 -0
  444. data/lib/htm/admin/file_commands.rb +323 -0
  445. data/lib/htm/admin/memory_commands/edit.rb +157 -0
  446. data/lib/htm/admin/memory_commands/search.rb +178 -0
  447. data/lib/htm/admin/memory_commands/tag_search.rb +98 -0
  448. data/lib/htm/admin/memory_commands/text.rb +164 -0
  449. data/lib/htm/admin/memory_commands/working_memory.rb +71 -0
  450. data/lib/htm/admin/memory_commands.rb +179 -0
  451. data/lib/htm/admin/tag_commands.rb +352 -0
  452. data/lib/htm/admin/tag_graph.rb +290 -0
  453. data/lib/htm/admin/templates/tag_graph.html +295 -0
  454. data/lib/htm/admin/yard_docs.rb +206 -0
  455. data/lib/htm/admin.rb +253 -0
  456. data/lib/htm/circuit_breaker.rb +142 -69
  457. data/lib/htm/class_methods.rb +136 -0
  458. data/lib/htm/cli/config_file.rb +86 -0
  459. data/lib/htm/cli/db.rb +77 -0
  460. data/lib/htm/cli/enrich.rb +44 -0
  461. data/lib/htm/cli/environment.rb +74 -0
  462. data/lib/htm/cli/error_suggestion.rb +97 -0
  463. data/lib/htm/cli/files.rb +41 -0
  464. data/lib/htm/cli/group.rb +32 -0
  465. data/lib/htm/cli/memory.rb +320 -0
  466. data/lib/htm/cli/memory_command.rb +71 -0
  467. data/lib/htm/cli/robots.rb +71 -0
  468. data/lib/htm/cli/support.rb +46 -0
  469. data/lib/htm/cli/tags.rb +103 -0
  470. data/lib/htm/cli/working_memory.rb +41 -0
  471. data/lib/htm/cli.rb +75 -0
  472. data/lib/htm/config/builder.rb +106 -75
  473. data/lib/htm/config/coercion.rb +91 -0
  474. data/lib/htm/config/database.rb +94 -71
  475. data/lib/htm/config/defaults.yml +52 -16
  476. data/lib/htm/config/readers.rb +85 -0
  477. data/lib/htm/config/ruby_llm_settings.rb +58 -0
  478. data/lib/htm/config/validator.rb +47 -34
  479. data/lib/htm/config.rb +122 -296
  480. data/lib/htm/database.rb +330 -427
  481. data/lib/htm/database_docs.rb +149 -0
  482. data/lib/htm/embedding_service.rb +29 -74
  483. data/lib/htm/epistemics.rb +254 -0
  484. data/lib/htm/errors.rb +4 -4
  485. data/lib/htm/event_time.rb +201 -0
  486. data/lib/htm/file_memory.rb +106 -0
  487. data/lib/htm/input_validator.rb +158 -0
  488. data/lib/htm/integrations/sinatra.rb +45 -33
  489. data/lib/htm/job_adapter.rb +79 -91
  490. data/lib/htm/jobs/failure_logging.rb +49 -0
  491. data/lib/htm/jobs/generate_embedding_job.rb +28 -51
  492. data/lib/htm/jobs/generate_propositions_job.rb +59 -57
  493. data/lib/htm/jobs/generate_relationships_job.rb +141 -0
  494. data/lib/htm/jobs/generate_tags_job.rb +44 -71
  495. data/lib/htm/jobs/llm_call_timer.rb +53 -0
  496. data/lib/htm/jobs/node_lookup.rb +27 -0
  497. data/lib/htm/knowledge_memory.rb +153 -0
  498. data/lib/htm/loaders/chunk_sync.rb +168 -0
  499. data/lib/htm/loaders/markdown_chunker.rb +207 -36
  500. data/lib/htm/loaders/markdown_loader.rb +99 -190
  501. data/lib/htm/long_term_memory/fulltext_search.rb +16 -37
  502. data/lib/htm/long_term_memory/hybrid_search.rb +484 -385
  503. data/lib/htm/long_term_memory/node_operations.rb +111 -82
  504. data/lib/htm/long_term_memory/relevance_scorer.rb +254 -227
  505. data/lib/htm/long_term_memory/tag_operations.rb +225 -187
  506. data/lib/htm/long_term_memory/vector_search.rb +34 -62
  507. data/lib/htm/long_term_memory.rb +5 -16
  508. data/lib/htm/mcp/file_tools.rb +190 -0
  509. data/lib/htm/mcp/group_tools.rb +223 -233
  510. data/lib/htm/mcp/node_tools.rb +350 -0
  511. data/lib/htm/mcp/resources.rb +102 -28
  512. data/lib/htm/mcp/robot_team_tools.rb +119 -0
  513. data/lib/htm/mcp/server.rb +26 -15
  514. data/lib/htm/mcp/tag_tools.rb +130 -0
  515. data/lib/htm/mcp/tool.rb +40 -0
  516. data/lib/htm/mcp/tool_support.rb +88 -0
  517. data/lib/htm/mcp/tools.rb +230 -287
  518. data/lib/htm/migration.rb +10 -10
  519. data/lib/htm/models/file_source.rb +35 -20
  520. data/lib/htm/models/node.rb +288 -195
  521. data/lib/htm/models/node_link.rb +97 -0
  522. data/lib/htm/models/node_relationship.rb +73 -0
  523. data/lib/htm/models/node_tag.rb +24 -4
  524. data/lib/htm/models/robot.rb +4 -8
  525. data/lib/htm/models/robot_node.rb +7 -4
  526. data/lib/htm/models/tag.rb +54 -195
  527. data/lib/htm/node_enrichment.rb +75 -0
  528. data/lib/htm/node_view.rb +295 -0
  529. data/lib/htm/observability.rb +125 -115
  530. data/lib/htm/proposition_service.rb +41 -81
  531. data/lib/htm/query_cache.rb +148 -96
  532. data/lib/htm/railtie.rb +4 -9
  533. data/lib/htm/request_options.rb +149 -0
  534. data/lib/htm/robot_group/cache_sync.rb +69 -0
  535. data/lib/htm/robot_group/membership.rb +147 -0
  536. data/lib/htm/robot_group/working_memory_ledger.rb +111 -0
  537. data/lib/htm/robot_group.rb +130 -523
  538. data/lib/htm/robots/actions.rb +371 -0
  539. data/lib/htm/robots/neighbors.rb +63 -0
  540. data/lib/htm/robots/node_brief.rb +49 -0
  541. data/lib/htm/robots/supervisor.rb +140 -0
  542. data/lib/htm/robots/team.rb +124 -0
  543. data/lib/htm/robots/teams/archivist.rb +88 -0
  544. data/lib/htm/robots/teams/consolidator.rb +52 -0
  545. data/lib/htm/robots/teams/contradiction_detector.rb +67 -0
  546. data/lib/htm/robots/teams/tag_curator.rb +75 -0
  547. data/lib/htm/robots/tools.rb +127 -0
  548. data/lib/htm/robots.rb +125 -0
  549. data/lib/htm/search_filters.rb +116 -0
  550. data/lib/htm/sequel_config.rb +96 -59
  551. data/lib/htm/sql_builder.rb +162 -53
  552. data/lib/htm/startup_prompt.rb +73 -0
  553. data/lib/htm/tag_service.rb +105 -114
  554. data/lib/htm/tag_tree.rb +206 -0
  555. data/lib/htm/telemetry.rb +15 -16
  556. data/lib/htm/timeframe.rb +30 -13
  557. data/lib/htm/timeframe_extractor.rb +104 -123
  558. data/lib/htm/timeline.rb +230 -0
  559. data/lib/htm/version.rb +1 -1
  560. data/lib/htm/workflows/remember_workflow.rb +147 -141
  561. data/lib/htm/working_memory/entry.rb +53 -0
  562. data/lib/htm/working_memory/store.rb +97 -0
  563. data/lib/htm/working_memory.rb +135 -142
  564. data/lib/htm/working_memory_channel.rb +90 -40
  565. data/lib/htm.rb +185 -522
  566. data/mkdocs.yml +100 -23
  567. data/scripts/install_local_database.sh +7 -6
  568. metadata +1032 -669
  569. data/.tbls.yml +0 -31
  570. data/Rakefile +0 -159
  571. data/bin/htm_mcp +0 -27
  572. data/docs/api/yard/HTM/ActiveRecordConfig.md +0 -29
  573. data/docs/api/yard/HTM/ConfigSection.md +0 -28
  574. data/docs/database/public.file_sources.md +0 -42
  575. data/docs/database/public.file_sources.svg +0 -219
  576. data/docs/database/public.node_stats.md +0 -48
  577. data/docs/database/public.node_stats.svg +0 -41
  578. data/docs/database/public.node_tags.md +0 -41
  579. data/docs/database/public.node_tags.svg +0 -251
  580. data/docs/database/public.nodes.md +0 -61
  581. data/docs/database/public.nodes.svg +0 -283
  582. data/docs/database/public.nodes_tags.md +0 -39
  583. data/docs/database/public.nodes_tags.svg +0 -112
  584. data/docs/database/public.ontology_structure.md +0 -48
  585. data/docs/database/public.ontology_structure.svg +0 -38
  586. data/docs/database/public.operations_log.md +0 -42
  587. data/docs/database/public.operations_log.svg +0 -130
  588. data/docs/database/public.relationships.md +0 -39
  589. data/docs/database/public.relationships.svg +0 -41
  590. data/docs/database/public.robot_activity.md +0 -46
  591. data/docs/database/public.robot_activity.svg +0 -35
  592. data/docs/database/public.robot_nodes.md +0 -48
  593. data/docs/database/public.robot_nodes.svg +0 -251
  594. data/docs/database/public.robots.md +0 -34
  595. data/docs/database/public.robots.svg +0 -165
  596. data/docs/database/public.schema_migrations.md +0 -29
  597. data/docs/database/public.schema_migrations.svg +0 -26
  598. data/docs/database/public.tags.md +0 -38
  599. data/docs/database/public.tags.svg +0 -147
  600. data/docs/database/public.topic_relationships.md +0 -45
  601. data/docs/database/public.topic_relationships.svg +0 -32
  602. data/docs/database/schema.json +0 -1814
  603. data/docs/database_rake_tasks.md +0 -353
  604. data/docs/development/rake-tasks.md +0 -1113
  605. data/docs/using_rake_tasks_in_your_app.md +0 -383
  606. data/examples/06_example_app/Rakefile +0 -71
  607. data/lib/htm/mcp/cli.rb +0 -582
  608. data/lib/htm/tasks.rb +0 -79
  609. data/lib/tasks/db.rake +0 -17
  610. data/lib/tasks/doc.rake +0 -300
  611. data/lib/tasks/files.rake +0 -292
  612. data/lib/tasks/htm.rake +0 -704
  613. data/lib/tasks/jobs.rake +0 -435
  614. data/lib/tasks/tags.rake +0 -189
  615. data/scripts/backfill_parent_tags.rb +0 -376
  616. data/scripts/normalize_plural_tags.rb +0 -335
data/CHANGELOG.md CHANGED
@@ -7,65 +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
- - **`sslmode` database configuration support** - SSL mode now extracted from URL and included when building URL
12
- - `parse_database_url` extracts `sslmode` from URL query string (e.g., `?sslmode=require`)
13
- - `build_database_url` includes `sslmode` as query parameter when set
14
- - `reconcile_from_url` syncs `sslmode` along with other database components
15
- - Default `sslmode` is `prefer` (from `defaults.yml`)
16
- - **`htm:db:purge_all` rake task** - Permanently remove all soft-deleted records from database
17
- - Displays record counts by table before deletion
18
- - Detects and removes orphaned join table entries (`node_tags`, `robot_nodes`)
19
- - Detects and removes orphaned propositions (where `source_node_id` no longer exists)
20
- - Detects and removes orphaned robots (with no associated memory nodes)
21
- - Requires confirmation before proceeding
22
- - Deletes in correct order for referential integrity
23
- - **`htm:jobs:process_propositions` rake task** - Incremental proposition extraction for unprocessed nodes
24
- - Uses `ruby-progressbar` with ETA display
25
- - Only processes nodes not yet extracted (tracks via `source_node_id` metadata)
26
- - Added to `htm:jobs:process_all` task chain
27
- - **Rake task passthrough in MCP CLI** - Run rake tasks via `htm_mcp rake <task>`
28
- - `htm_mcp rake htm:db:stats` - Run any HTM rake task
29
- - `htm_mcp rake -T` / `htm_mcp rake --tasks` - List available tasks
30
- - **Pattern filtering** - `htm_mcp rake -T htm:jobs` filters to matching namespace (like standard rake)
31
- - **Meta-response filtering in PropositionService** - Filters LLM responses that ask for input
32
- - `META_RESPONSE_PATTERNS` constant with common patterns ("please provide", "I need the text", etc.)
33
- - `meta_response?` method for detecting invalid responses
34
- - Prevents storing "Please provide the text" as propositions
35
- - **Progress bars for job processing tasks** - Visual progress with ETA for long-running operations
36
- - `htm:jobs:process_embeddings` - Shows progress when generating embeddings
37
- - `htm:jobs:process_tags` - Shows progress when extracting tags
38
- - 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".
39
162
 
40
163
  ### Changed
41
- - **Centralized HTM loading in rake tasks** - Single `require_relative` in `lib/htm/tasks.rb`
42
- - HTM is now loaded once before any rake task files are loaded
43
- - Removed ~25 redundant `require 'htm'` statements from individual rake tasks
44
- - Ensures local development codebase is always used via `require_relative`
45
- - Removed `$LOAD_PATH` manipulation that was previously needed for `require 'htm'`
46
- - **Removed `:validate` rake task dependency** - Config validation now automatic
47
- - `HTM::Config.new` handles all validation at require time (environment, URL/component reconciliation, naming convention)
48
- - Rake tasks no longer need explicit validation step
49
- - **Cleaned up Rakefile** - Removed unnecessary code
50
- - Removed deprecated `db_setup` and `db_test` backward-compatibility tasks
51
- - Removed redundant `task :test` block (`:set_test_env` prerequisite handles environment setup)
52
- - **PropositionService validation now fully configurable** - Moved hardcoded constants to `defaults.yml`
53
- - `proposition.min_length` (default: 10) - Minimum characters for valid proposition
54
- - `proposition.max_length` (default: 1000) - Maximum characters for valid proposition
55
- - `proposition.min_words` (default: 5) - Minimum words for valid proposition
56
- - Added `min_length`, `max_length`, `min_words` class methods that read from config
57
- - **Improved proposition extraction prompt** - Better quality propositions
58
- - Added explicit BAD/GOOD examples for pronoun replacement
59
- - Added context enrichment examples (e.g., "wiring" → "solar panel wiring for Oklahoma barndominium")
60
- - System prompt now explicitly prevents meta-responses
61
- - 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.
62
167
 
63
168
  ### Fixed
64
- - **Test database isolation** - Two-layer protection prevents tests from polluting development/production
65
- - `Rakefile`: `set_test_env` task now ALWAYS overrides `HTM_DATABASE__URL` to test database
66
- - Uses `#{service_name}_test` pattern (e.g., `htm_test`) based on `HTM_SERVICE__NAME` env var
67
- - `test_helper.rb`: Safety check aborts with helpful message if database URL doesn't contain `_test`
68
- - Prevents accidental test execution against non-test databases
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.
172
+
173
+ ### Refactored
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.
69
177
 
70
178
  ## [0.0.20] - 2025-12-22
71
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,21 +149,25 @@ 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
- | **Temporal Queries** | "last week", "yesterday", date ranges |
156
+ | **Graph Traversal** | CTE-based relationship traversal via Jaccard-weighted edges |
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` |
154
160
  | **Auto-Tagging** | LLM extracts hierarchical tags automatically |
161
+ | **Auto-Relationships** | Tag co-occurrence edges computed after tagging |
155
162
  | **Robot Groups** | High-availability with failover |
156
163
  | **Rails Integration** | Auto-configures via Railtie, uses ActiveJob |
157
164
  | **Telemetry** | Optional OpenTelemetry metrics |
158
165
 
159
166
  ## Requirements
160
167
 
161
- - Ruby 3.0+
168
+ - Ruby 4.0+
162
169
  - PostgreSQL with pgvector and pg_trgm extensions
163
- - 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
164
171
 
165
172
  ## Documentation
166
173
 
@@ -168,7 +175,7 @@ For MCP integration, database setup, and configuration options, see the [full do
168
175
 
169
176
  - [Installation & Setup](https://madbomber.github.io/htm/getting-started/)
170
177
  - [MCP Server Guide](https://madbomber.github.io/htm/guides/mcp-server/)
171
- - [Rails Integration](https://madbomber.github.io/htm/guides/rails/)
178
+ - [Rails Integration](https://madbomber.github.io/htm/examples/rails-integration/)
172
179
  - [API Reference](https://madbomber.github.io/htm/api/)
173
180
 
174
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)
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../lib/htm/migration'
4
+
5
+ class CreateNodeRelationships < HTM::Migration
6
+ def up
7
+ create_table(:node_relationships) do
8
+ primary_key :id
9
+ Bignum :source_id, null: false
10
+ Bignum :target_id, null: false
11
+ String :rel_type, null: false, default: 'related_to'
12
+ String :origin, null: false, default: 'tag_cooccurrence'
13
+ Float :weight, null: false, default: 1.0
14
+ DateTime :created_at, default: Sequel::CURRENT_TIMESTAMP
15
+ DateTime :updated_at, default: Sequel::CURRENT_TIMESTAMP
16
+ end
17
+
18
+ add_index :node_relationships, [:source_id, :target_id, :rel_type],
19
+ unique: true, name: :idx_node_relationships_unique
20
+ add_index :node_relationships, :source_id, name: :idx_node_relationships_source_id
21
+ add_index :node_relationships, :target_id, name: :idx_node_relationships_target_id
22
+ add_index :node_relationships, :weight, name: :idx_node_relationships_weight
23
+ add_index :node_relationships, :origin, name: :idx_node_relationships_origin
24
+
25
+ alter_table(:node_relationships) do
26
+ add_foreign_key [:source_id], :nodes, name: :fk_node_relationships_source, on_delete: :cascade
27
+ add_foreign_key [:target_id], :nodes, name: :fk_node_relationships_target, on_delete: :cascade
28
+ end
29
+
30
+ run <<~SQL
31
+ ALTER TABLE node_relationships
32
+ ADD CONSTRAINT chk_node_relationships_weight
33
+ CHECK (weight >= 0.0 AND weight <= 1.0)
34
+ SQL
35
+
36
+ run <<~SQL
37
+ ALTER TABLE node_relationships
38
+ ADD CONSTRAINT chk_node_relationships_no_self_loop
39
+ CHECK (source_id <> target_id)
40
+ SQL
41
+
42
+ run "COMMENT ON TABLE node_relationships IS 'Weighted directed edges between nodes for graph traversal'"
43
+ run "COMMENT ON COLUMN node_relationships.source_id IS 'Starting node of the relationship'"
44
+ run "COMMENT ON COLUMN node_relationships.target_id IS 'Ending node of the relationship'"
45
+ run "COMMENT ON COLUMN node_relationships.rel_type IS 'Semantic label: related_to, supports, contradicts, derived_from'"
46
+ run "COMMENT ON COLUMN node_relationships.origin IS 'How created: tag_cooccurrence, tag_hierarchy, explicit'"
47
+ run "COMMENT ON COLUMN node_relationships.weight IS 'Relationship strength 0.0-1.0 (Jaccard similarity for tag_cooccurrence)'"
48
+ run "COMMENT ON COLUMN node_relationships.updated_at IS 'When weight was last recalculated'"
49
+ end
50
+
51
+ def down
52
+ drop_table(:node_relationships)
53
+ end
54
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../lib/htm/migration'
4
+
5
+ class FixNodeRelationshipsColumnTypes < HTM::Migration
6
+ def up
7
+ run "ALTER TABLE node_relationships ALTER COLUMN id TYPE bigint"
8
+ run "ALTER TABLE node_relationships ALTER COLUMN created_at TYPE timestamp with time zone"
9
+ run "ALTER TABLE node_relationships ALTER COLUMN updated_at TYPE timestamp with time zone"
10
+ end
11
+
12
+ def down
13
+ run "ALTER TABLE node_relationships ALTER COLUMN id TYPE integer"
14
+ run "ALTER TABLE node_relationships ALTER COLUMN created_at TYPE timestamp without time zone"
15
+ run "ALTER TABLE node_relationships ALTER COLUMN updated_at TYPE timestamp without time zone"
16
+ end
17
+ end