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
@@ -4,16 +4,21 @@ HTM includes a Model Context Protocol (MCP) server that exposes memory capabilit
4
4
 
5
5
  ## Overview
6
6
 
7
- The MCP server (`bin/htm_mcp`) uses [FastMCP](https://github.com/yjacket/fast-mcp) to expose HTM's memory operations as MCP tools and resources. Any MCP-compatible client can connect to the server and use HTM's memory capabilities.
7
+ The MCP server (`htm mcp`, in `bin/htm`) uses [FastMCP](https://github.com/yjacket/fast-mcp) to expose HTM's memory operations as MCP tools and resources. Any MCP-compatible client can connect to the server and use HTM's memory capabilities.
8
8
 
9
9
  ### Key Features
10
10
 
11
- - **Session-based robot identity**: Each client session has its own robot identity
12
- - **Full HTM API access**: Remember, recall, forget, restore, and manage tags
13
- - **Session restore**: Restore previous session context from working memory
14
- - **Fuzzy search**: Typo-tolerant tag and topic search
15
- - **Resource access**: Query statistics, tag hierarchy, and recent memories
16
- - **Robot Groups (High-Availability)**: Coordinate multiple robots with shared working memory, failover, and real-time sync
11
+ - **Session-based robot identity**: Each client session has its own robot identity; `set_robot` reloads that robot's working memory
12
+ - **Full HTM API access**: Remember, recall (timeframe, metadata and relevance filters), forget, restore, purge, and node-level tag editing
13
+ - **Working memory**: Assemble an LLM context string, clear it, or restore it from a previous session
14
+ - **Tag analysis**: Popular tags, co-occurring tags, tag search, and the tag tree as text, Mermaid or SVG
15
+ - **File loading**: Load, inspect, sync and unload markdown files
16
+ - **Propositions and relationships**: Extract atomic facts; follow the node relationship graph
17
+ - **Maintenance**: Robot-team status and one-shot runs, plus catch-up enrichment (embeddings, tags, propositions)
18
+ - **Resource access**: Statistics, configuration, loaded files, tag hierarchy, and recent memories
19
+ - **Robot Groups (High-Availability)**: Coordinate multiple robots with shared working memory, failover, transfer and real-time sync
20
+
21
+ Tool names are snake_case (`set_robot`, `recall`, `load_file`, ...). Tools that only read are marked read-only and tools that delete are marked destructive (MCP tool annotations), so clients can ask before running them. Every tool returns JSON with `success: true`, or `success: false` and an `error` message.
17
22
 
18
23
  ## Prerequisites
19
24
 
@@ -27,16 +32,19 @@ Before using the MCP server, ensure you have:
27
32
  2. **PostgreSQL database set up**
28
33
  ```bash
29
34
  export HTM_DATABASE__URL="postgresql://user@localhost:5432/htm_development"
30
- htm_mcp setup
35
+ htm db create
36
+ htm db setup
31
37
  ```
32
38
 
33
39
  3. **LLM provider configured** (for embeddings and tag extraction)
34
40
 
35
- **Option A: Ollama (default for local development)**
41
+ **Option A: LM Studio (default for local development)**
42
+
43
+ Install LM Studio from [lmstudio.ai](https://lmstudio.ai) (it ships the `lms` CLI), then:
36
44
  ```bash
37
- ollama serve
38
- ollama pull nomic-embed-text
39
- ollama pull gemma3:latest
45
+ lms get nomic-embed-text-v1.5
46
+ lms get google/gemma-3-4b
47
+ lms server start # serves http://localhost:1234/v1
40
48
  ```
41
49
 
42
50
  **Option B: Cloud providers** (OpenAI, Anthropic, etc.)
@@ -47,31 +55,33 @@ Before using the MCP server, ensure you have:
47
55
 
48
56
  ## Starting the Server
49
57
 
50
- The MCP server uses STDIO transport which is compatible with most MCP clients. When you do a `gem install htm`, the `htm_mcp` executable is placed on your $PATH.
58
+ The MCP server uses STDIO transport which is compatible with most MCP clients. When you do a `gem install htm`, the `htm` executable is placed on your $PATH; `htm mcp` starts the server.
51
59
 
52
60
  ```bash
53
- htm_mcp
61
+ htm mcp
62
+ htm mcp --config my_htm.yml # with a YAML config file (start from `htm config`)
54
63
  ```
55
64
 
65
+ Running `htm` with no arguments prints the help; it does not start the server. MCP clients launch `htm mcp` themselves (see [Client Configuration](#client-configuration)).
66
+
56
67
  The server logs to STDERR to avoid corrupting the JSON-RPC protocol on STDOUT.
57
68
 
58
- ## CLI Commands
69
+ ## Managing HTM from the Command Line
59
70
 
60
- The `htm_mcp` executable includes management commands for database setup, diagnostics, and rake task execution:
71
+ The same `htm` executable manages the database, enrichment, loaded files, robot teams and tags. See the [Command Line reference](cli.md) for every command.
61
72
 
62
73
  | Command | Description |
63
74
  |---------|-------------|
64
- | `htm_mcp` | Start the MCP server (default) |
65
- | `htm_mcp server` | Start the MCP server (explicit) |
66
- | `htm_mcp setup` | Initialize database schema and run migrations |
67
- | `htm_mcp init` | Alias for setup |
68
- | `htm_mcp verify` | Verify database connection, extensions, and migration status |
69
- | `htm_mcp stats` | Show memory statistics (nodes, tags, robots, database size) |
70
- | `htm_mcp version` | Show HTM version |
71
- | `htm_mcp help` | Show help with all environment variables |
72
- | `htm_mcp rake <task>` | Run any HTM rake task |
73
- | `htm_mcp rake -T` | List all available HTM rake tasks |
74
- | `htm_mcp rake -T <pattern>` | List HTM rake tasks matching pattern |
75
+ | `htm mcp` | Start the MCP server |
76
+ | `htm db setup` | Initialize database schema and run migrations |
77
+ | `htm db verify` | Verify the database connection and pgvector |
78
+ | `htm db status` | Show applied and pending migrations |
79
+ | `htm db stats` | Show record counts, top robots and top tag categories |
80
+ | `htm enrich process_all` | Catch up on missing embeddings, tags and propositions |
81
+ | `htm config` | Print the default configuration (YAML) |
82
+ | `htm env` | List the environment variables that configure HTM |
83
+ | `htm version` | Show HTM version |
84
+ | `htm help [COMMAND]` | Describe the commands, or one command |
75
85
 
76
86
  ### First-Time Setup
77
87
 
@@ -79,102 +89,22 @@ The `htm_mcp` executable includes management commands for database setup, diagno
79
89
  # Set your database URL
80
90
  export HTM_DATABASE__URL="postgresql://user@localhost:5432/htm_development"
81
91
 
82
- # Initialize the database
83
- htm_mcp setup
92
+ # Create and initialize the database
93
+ htm db create
94
+ htm db setup
84
95
 
85
96
  # Verify everything is working
86
- htm_mcp verify
97
+ htm db verify
87
98
 
88
99
  # Check memory statistics
89
- htm_mcp stats
90
- ```
91
-
92
- ### Migration Status
93
-
94
- The `verify` command shows migration status with `+` (applied) and `-` (pending) indicators:
95
-
96
- ```
97
- Migration Status
98
- --------------------------------------------------------------------------------
99
- + 20250101000001_create_schema_migrations
100
- + 20250101000002_create_robots
101
- + 20250101000003_create_nodes
102
- - 20250612000001_add_new_feature
103
- --------------------------------------------------------------------------------
104
- 3 applied, 1 pending
105
- ```
106
-
107
- ### Rake Task Passthrough
108
-
109
- The `htm_mcp rake` command allows you to run any HTM rake task directly through the MCP CLI. This is useful when working with HTM without a full Rails/Rake environment.
110
-
111
- **List all available tasks:**
112
-
113
- ```bash
114
- $ htm_mcp rake -T
115
- # or
116
- $ htm_mcp rake --tasks
117
-
118
- HTM Rake Tasks
119
- ================================================================================
120
- htm:db:console # Open psql console to database
121
- htm:db:create # Create the database if it doesn't exist
122
- htm:db:drop # Drop all HTM tables (WARNING: destructive!)
123
- htm:db:info # Show database information
124
- htm:db:migrate # Run pending database migrations
125
- htm:db:purge_all # Permanently delete all soft-deleted records
126
- ...
127
- ```
128
-
129
- **Filter tasks by pattern** (like standard `rake -T`):
130
-
131
- ```bash
132
- $ htm_mcp rake -T htm:jobs
133
-
134
- HTM Rake Tasks
135
- ================================================================================
136
- htm:jobs:process_all # Process all pending jobs (embeddings, tags, propositions)
137
- htm:jobs:process_embeddings # Process pending embedding jobs
138
- htm:jobs:process_propositions # Process pending proposition extraction jobs
139
- htm:jobs:process_tags # Process pending tag extraction jobs
140
- htm:jobs:stats # Show job processing statistics
141
-
142
- $ htm_mcp rake -T db:rebuild
143
-
144
- HTM Rake Tasks
145
- ================================================================================
146
- htm:db:rebuild:embeddings # Clear and regenerate all embeddings
147
- htm:db:rebuild:propositions # Extract propositions from all non-proposition nodes
148
- ```
149
-
150
- **Run specific tasks:**
151
-
152
- ```bash
153
- # Database tasks
154
- $ htm_mcp rake htm:db:stats
155
- $ htm_mcp rake htm:db:verify
156
- $ htm_mcp rake htm:db:purge_all
157
-
158
- # Job processing tasks
159
- $ htm_mcp rake htm:jobs:process_all
160
- $ htm_mcp rake htm:jobs:process_embeddings
161
-
162
- # Tag tasks
163
- $ htm_mcp rake htm:tags:tree
164
- $ htm_mcp rake 'htm:tags:tree[database]' # With argument
165
-
166
- # File tasks
167
- $ htm_mcp rake htm:files:list
168
- $ htm_mcp rake htm:files:sync
100
+ htm db stats
169
101
  ```
170
102
 
171
- **Note:** Tasks requiring arguments use the standard rake syntax with brackets quoted for shell safety: `htm_mcp rake 'htm:files:load[path/to/file.md]'`
172
-
173
103
  ## Tools Reference
174
104
 
175
- ### SetRobotTool
105
+ ### set_robot
176
106
 
177
- Set the robot identity for this session. **Call this first** to establish your robot name.
107
+ Set the robot identity for this session. **Call this first** to establish your robot name. The robot's working memory from earlier sessions is reloaded (as many nodes as fit the token budget).
178
108
 
179
109
  **Parameters:**
180
110
  - `name` (String, required): The robot name (will be created if it doesn't exist)
@@ -186,6 +116,7 @@ Set the robot identity for this session. **Call this first** to establish your r
186
116
  "robot_id": 5,
187
117
  "robot_name": "my-assistant",
188
118
  "node_count": 12,
119
+ "working_memory_nodes": 8,
189
120
  "message": "Robot 'my-assistant' is now active for this session"
190
121
  }
191
122
  ```
@@ -197,7 +128,7 @@ Set robot name to "research-bot"
197
128
 
198
129
  ---
199
130
 
200
- ### GetRobotTool
131
+ ### get_robot
201
132
 
202
133
  Get information about the current robot for this session.
203
134
 
@@ -219,7 +150,7 @@ Get information about the current robot for this session.
219
150
 
220
151
  ---
221
152
 
222
- ### GetWorkingMemoryTool
153
+ ### get_working_memory
223
154
 
224
155
  Get all working memory contents for the current robot. Use this to restore a previous session.
225
156
 
@@ -247,7 +178,7 @@ Get all working memory contents for the current robot. Use this to restore a pre
247
178
 
248
179
  ---
249
180
 
250
- ### RememberTool
181
+ ### remember
251
182
 
252
183
  Store information in HTM long-term memory with optional tags.
253
184
 
@@ -255,6 +186,15 @@ Store information in HTM long-term memory with optional tags.
255
186
  - `content` (String, required): The content to remember
256
187
  - `tags` (Array<String>, optional): Tags for categorization (e.g., `["database:postgresql", "config"]`)
257
188
  - `metadata` (Hash, optional): Key-value metadata pairs
189
+ - `occurred_at` (String, optional): When it happened (ISO8601 or natural language). Default: a time the content states, else now
190
+ - `occurred_until` (String, optional): When it stopped happening, for a span
191
+ - `valid_from`, `valid_until` (String, optional): When the stated state was true
192
+ - `supersedes` (Array<Integer>, optional): Memories this one replaces. They are retired in the same transaction (soft-deleted, `valid_until` ended) and stay in its [timeline](timeline.md)
193
+ - `reason` (String, optional): Why the superseded memories are wrong now
194
+ - `transition` (String, optional): The kind of change: `"removed"`, `"restored"` or `"changed"`
195
+ - `status` (String, optional): How it is known (its [epistemic status](epistemic-status.md)): `"asserted"` (default; stated directly), `"extracted"` (copied from a source), `"inferred"` (concluded from other memories) or `"hypothesis"`
196
+ - `confidence` (Float, optional): Confidence in it, 0.0 to 1.0 (default: unrated)
197
+ - `evidence` (Array<Integer>, optional): Memories it rests on; each is linked `derived_from`
258
198
 
259
199
  **Returns:**
260
200
  ```json
@@ -264,7 +204,13 @@ Store information in HTM long-term memory with optional tags.
264
204
  "robot_id": 5,
265
205
  "robot_name": "my-assistant",
266
206
  "content": "PostgreSQL uses pgvector for similarity search",
207
+ "superseded": [],
208
+ "epistemic_status": "asserted",
209
+ "confidence": null,
210
+ "evidence": [],
267
211
  "tags": ["database:postgresql", "vector-search"],
212
+ "occurred_at": "2024-01-15T14:30:00Z",
213
+ "time_source": "recorded",
268
214
  "created_at": "2024-01-15T14:30:00Z"
269
215
  }
270
216
  ```
@@ -276,7 +222,7 @@ Remember that the user prefers Ruby over Python for scripting tasks
276
222
 
277
223
  ---
278
224
 
279
- ### RecallTool
225
+ ### recall
280
226
 
281
227
  Search and retrieve memories from HTM using semantic, full-text, or hybrid search.
282
228
 
@@ -284,7 +230,17 @@ Search and retrieve memories from HTM using semantic, full-text, or hybrid searc
284
230
  - `query` (String, required): Search query (natural language or keywords)
285
231
  - `limit` (Integer, optional): Maximum results (default: 10)
286
232
  - `strategy` (String, optional): Search strategy - `"vector"`, `"fulltext"`, or `"hybrid"` (default: `"hybrid"`)
287
- - `timeframe` (String, optional): Time filter - `"today"`, `"this week"`, `"this month"`, or ISO8601 date range
233
+ - `timeframe` (String, optional): Time filter. `"auto"` extracts it from the query ("what did we decide last week"); natural language (`"today"`, `"yesterday"`, `"last week"`, `"this month"`, `"since monday"`) is parsed by `HTM::Timeframe`; `"2024-01-01T00:00:00Z..2024-02-01T00:00:00Z"` is an ISO8601 range; a lone ISO8601 date means "since then"
234
+ - `metadata` (Hash, optional): Only memories whose metadata contains these pairs (JSONB `@>`)
235
+ - `time_axis` (String, optional): What `timeframe` reads: `"event"` (default: when the memory happened) or `"recorded"` (when it was stored)
236
+ - `as_of` (String, optional): Only memories whose state was true at this time
237
+ - `query_tags` (Array<String>, optional): Tags that boost relevance (with `with_relevance`)
238
+ - `with_relevance` (Boolean, optional): Rank by HTM's composite relevance score (semantic, tag, recency and access) (default: false)
239
+ - `include_history` (Boolean, optional): Follow each result with the earlier states it replaced. Every result gets a `status` (`current`, `superseded`, `merged`, `archived`), and each earlier state gets a `history_note` such as `"(superseded by #41 on 2026-03-03, changed: moved)"` (default: false)
240
+ - `status` (Array<String>, optional): Only memories with these epistemic statuses (`["asserted", "extracted"]` keeps direct evidence only)
241
+ - `min_confidence` (Float, optional): Only memories at least this confident (an unrated memory counts as 1.0)
242
+
243
+ Every result carries `epistemic_status`, `confidence`, `evidence` (ids it rests on) and `conflicts` (ids it was found to contradict).
288
244
 
289
245
  **Returns:**
290
246
  ```json
@@ -299,7 +255,13 @@ Search and retrieve memories from HTM using semantic, full-text, or hybrid searc
299
255
  "id": 123,
300
256
  "content": "Decided to use PostgreSQL for vector search",
301
257
  "tags": ["database:postgresql", "decision"],
258
+ "occurred_at": "2024-01-08T00:00:00Z",
259
+ "occurred_until": null,
302
260
  "created_at": "2024-01-10T08:00:00Z",
261
+ "epistemic_status": "asserted",
262
+ "confidence": null,
263
+ "evidence": [],
264
+ "conflicts": [],
303
265
  "score": 0.89
304
266
  }
305
267
  ]
@@ -313,12 +275,14 @@ Recall what we discussed about database architecture last week
313
275
 
314
276
  ---
315
277
 
316
- ### ForgetTool
278
+ ### forget
317
279
 
318
- Soft-delete a memory from HTM (can be restored later).
280
+ Soft-delete a memory from HTM (can be restored later), or delete it permanently.
319
281
 
320
282
  **Parameters:**
321
283
  - `node_id` (Integer, required): The ID of the node to forget
284
+ - `permanent` (Boolean, optional): Delete permanently (default: false)
285
+ - `confirm` (String, optional): Must be `"confirmed"` when `permanent` is true
322
286
 
323
287
  **Returns:**
324
288
  ```json
@@ -332,7 +296,7 @@ Soft-delete a memory from HTM (can be restored later).
332
296
 
333
297
  ---
334
298
 
335
- ### RestoreTool
299
+ ### restore
336
300
 
337
301
  Restore a soft-deleted memory.
338
302
 
@@ -351,7 +315,7 @@ Restore a soft-deleted memory.
351
315
 
352
316
  ---
353
317
 
354
- ### ListTagsTool
318
+ ### list_tags
355
319
 
356
320
  List all tags in HTM, optionally filtered by prefix.
357
321
 
@@ -374,7 +338,7 @@ List all tags in HTM, optionally filtered by prefix.
374
338
 
375
339
  ---
376
340
 
377
- ### SearchTagsTool
341
+ ### search_tags
378
342
 
379
343
  Search for tags using fuzzy matching (typo-tolerant). Use this when you're unsure of exact tag names.
380
344
 
@@ -399,7 +363,7 @@ Search for tags using fuzzy matching (typo-tolerant). Use this when you're unsur
399
363
 
400
364
  ---
401
365
 
402
- ### FindByTopicTool
366
+ ### find_by_topic
403
367
 
404
368
  Find memory nodes by topic/tag with optional fuzzy matching for typo tolerance.
405
369
 
@@ -431,7 +395,7 @@ Find memory nodes by topic/tag with optional fuzzy matching for typo tolerance.
431
395
 
432
396
  ---
433
397
 
434
- ### StatsTool
398
+ ### stats
435
399
 
436
400
  Get statistics about HTM memory usage.
437
401
 
@@ -459,11 +423,243 @@ Get statistics about HTM memory usage.
459
423
  }
460
424
  ```
461
425
 
426
+ ## Node and Working Memory Tools
427
+
428
+ ### get_node
429
+
430
+ Get one memory in full: content, tags, metadata, token and access counts, timestamps, embedding status (not the vector), proposition flag and source file. Finds soft-deleted nodes too. It also returns `status` (`current`, `superseded`, `merged`, `archived` or `deleted`) and `links`, the node's `node_links` rows (`kind`, `from`, `to`, `transition`, `reason`, `process`, `prior_status`, `robot_id`, `created_at`), plus `epistemic_status`, `confidence`, `evidence` and `conflicts` (see [Epistemic Status](epistemic-status.md)).
431
+
432
+ **Parameters:**
433
+ - `node_id` (Integer, required)
434
+
435
+ ---
436
+
437
+ ### timeline
438
+
439
+ Show how a memory changed over time: every state it went through, including the superseded, merged and archived states that `recall` leaves out, plus each change between them, oldest first. See [Memory Timelines](timeline.md).
440
+
441
+ **Parameters:**
442
+ - `query` (String) or `node_id` (Integer): what to show. A `node_id` may be any state in the history. A `query` is searched, and the histories of its top matches are returned (one per distinct history)
443
+ - `strategy` (String, optional): Search strategy for `query`: `"fulltext"` (default), `"vector"` or `"hybrid"`
444
+ - `limit` (Integer, optional): Matches to seed histories from (default: 5)
445
+ - `max_depth` (Integer, optional): Links to follow at most (default: 25)
446
+
447
+ **Returns:**
448
+ ```json
449
+ {
450
+ "success": true,
451
+ "subject": "where does Alice live",
452
+ "count": 1,
453
+ "histories": [
454
+ {
455
+ "node_ids": [40, 41],
456
+ "entries": [
457
+ { "type": "state", "node_id": 40, "status": "superseded", "content": "Alice lives in Paris", "at": "2025-01-01T00:00:00Z", "...": "..." },
458
+ { "type": "transition", "kind": "supersedes", "transition": "changed", "node_id": 41, "replaces": 40,
459
+ "reason": "moved", "at": "2026-03-03T00:00:00Z", "robot_id": 5 },
460
+ { "type": "state", "node_id": 41, "status": "current", "content": "Alice lives in Berlin", "at": "2026-03-03T00:00:00Z", "...": "..." }
461
+ ]
462
+ }
463
+ ]
464
+ }
465
+ ```
466
+
467
+ ---
468
+
469
+ ### confirm
470
+
471
+ Confirm a memory: upgrade an inferred memory or hypothesis (or an extracted fact) to `asserted` on the strength of other memories. Each evidence memory gets a `confirms` link to it that keeps the prior status. See [Epistemic Status](epistemic-status.md#confirming-a-memory).
472
+
473
+ **Parameters:**
474
+ - `node_id` (Integer, required): The memory to confirm
475
+ - `evidence` (Array<Integer>, required): Memories that confirm it (at least one)
476
+ - `reason` (String, optional): Why the evidence settles it
477
+ - `confidence` (Float, optional): Its new confidence, 0.0 to 1.0
478
+
479
+ **Returns:** `{ "success": true, "node_id": 88, "epistemic_status": "asserted", "prior_status": "inferred", "confidence": 0.95, "evidence": [91] }`
480
+
481
+ ---
482
+
483
+ ### first_mention
484
+
485
+ Find when something was first mentioned and whether memory can establish it. Direct evidence is a memory stated or extracted from a source, with a known event time. Inferred memories, hypotheses and dates read from text are indirect. See [Epistemic Status](epistemic-status.md#first-mention).
486
+
487
+ **Parameters:**
488
+ - `query` (String, required): What was mentioned
489
+ - `strategy` (String, optional): `"fulltext"` (default), `"vector"` or `"hybrid"`
490
+ - `limit` (Integer, optional): Matches to judge (default: 50)
491
+ - `timeframe` (String, optional): Only memories from this time (as for `recall`)
492
+
493
+ **Returns:**
494
+ ```json
495
+ {
496
+ "success": true,
497
+ "topic": "Alice moved to Berlin",
498
+ "established": false,
499
+ "earliest_direct": { "node_id": 90, "content": "...", "epistemic_status": "asserted", "confidence": null,
500
+ "at": "2026-03-01T00:00:00Z", "time_source": "stated", "evidence": [] },
501
+ "earlier_indirect": [{ "node_id": 88, "epistemic_status": "inferred", "at": "2026-02-02T00:00:00Z", "evidence": [87], "...": "..." }],
502
+ "earliest_known": "2026-02-02T00:00:00Z",
503
+ "matches": 3
504
+ }
505
+ ```
506
+
507
+ ---
508
+
509
+ ### forget_content
510
+
511
+ Forget every memory whose content contains the text (case-insensitive).
512
+
513
+ **Parameters:**
514
+ - `content` (String, required): Text to look for
515
+ - `permanent` (Boolean, optional): Delete permanently (default: false)
516
+ - `confirm` (String, optional): Must be `"confirmed"` when `permanent` is true
517
+
518
+ **Returns:** `{ "success": true, "count": 2, "node_ids": [12, 40], ... }`
519
+
520
+ ---
521
+
522
+ ### list_deleted
523
+
524
+ List soft-deleted memories, newest deletions first, with `deleted_at`.
525
+
526
+ **Parameters:**
527
+ - `limit` (Integer, optional): default 20
528
+
529
+ ---
530
+
531
+ ### purge_deleted
532
+
533
+ Permanently delete memories soft-deleted before a cutoff.
534
+
535
+ **Parameters:**
536
+ - `older_than_days` (Integer, optional): default 30
537
+ - `older_than` (String, optional): ISO8601 cutoff; overrides `older_than_days`
538
+ - `confirm` (String, required): Must be `"confirmed"`
539
+
540
+ ---
541
+
542
+ ### clear_working_memory
543
+
544
+ Clear the current robot's working memory. Memories stay in long-term memory.
545
+
546
+ ---
547
+
548
+ ### assemble_context
549
+
550
+ Assemble the robot's working memory into one context string for an LLM prompt.
551
+
552
+ **Parameters:**
553
+ - `strategy` (String, optional): `"recent"`, `"frequent"` or `"balanced"` (default)
554
+ - `max_tokens` (Integer, optional): Token budget (default: the working memory size)
555
+
556
+ **Returns:** `{ "success": true, "strategy": "balanced", "node_count": 12, "token_count": 1830, "context": "..." }`
557
+
558
+ ---
559
+
560
+ ### tag_node / untag_node
561
+
562
+ `tag_node` adds tags to a node (`node_id`, `tags`); parents are created too, so `a:b:c` also adds `a` and `a:b`. `untag_node` removes one exact tag (`node_id`, `tag`). Both return the node's tags.
563
+
564
+ ---
565
+
566
+ ### related_nodes
567
+
568
+ Follow the node relationship graph (edges weighted by shared tags), strongest first.
569
+
570
+ **Parameters:**
571
+ - `node_id` (Integer, required)
572
+ - `limit` (Integer, optional): default 10
573
+ - `min_weight` (Float, optional): 0.0-1.0, default 0.0
574
+
575
+ ---
576
+
577
+ ### extract_propositions
578
+
579
+ Break text into atomic, self-contained facts with the configured proposition model.
580
+
581
+ **Parameters:**
582
+ - `text` (String, required)
583
+ - `remember` (Boolean, optional): Store each proposition as a memory (default: false)
584
+
585
+ ---
586
+
587
+ ### list_robots
588
+
589
+ List the robots sharing memory (the hive mind), most recently active first, with node counts.
590
+
591
+ **Parameters:**
592
+ - `limit` (Integer, optional): default 50
593
+
594
+ ## Tag Analysis Tools
595
+
596
+ ### popular_tags
597
+
598
+ The most used tags. **Parameters:** `limit` (default 20), `timeframe` (natural language or ISO8601 range).
599
+
600
+ ### topic_relationships
601
+
602
+ Pairs of tags used on the same memories. **Parameters:** `min_shared_nodes` (default 2), `limit` (default 50).
603
+
604
+ ### search_by_tags
605
+
606
+ Memories carrying `tags`, ranked by relevance. **Parameters:** `tags` (required), `match` (`"any"` default, or `"all"`), `limit` (default 20), `timeframe`.
607
+
608
+ ### tag_tree
609
+
610
+ The tag hierarchy, or the branch under `prefix`, as `format` `"text"` (default), `"mermaid"` (with `direction` `TD`/`LR`/`BT`/`RL`) or `"svg"`.
611
+
612
+ ## File Tools
613
+
614
+ Paths are resolved against the server's working directory; any readable markdown file can be loaded.
615
+
616
+ ### load_file
617
+
618
+ Chunk a markdown file into memories and track it for re-sync. Unchanged files are skipped unless `force` is true.
619
+
620
+ **Parameters:** `path` (required), `force` (Boolean)
621
+
622
+ **Returns:** `{ "success": true, "file_path": "/abs/docs/guide.md", "file_source_id": 3, "chunks_created": 5, "chunks_updated": 0, "chunks_deleted": 0, "skipped": false }`
623
+
624
+ ### load_directory
625
+
626
+ Load every file matching `pattern` (default `"**/*.md"`) under `path`. Returns per-file results and totals.
627
+
628
+ ### list_files
629
+
630
+ Loaded files with chunk counts and `sync_state` (`"synced"`, `"needs_sync"` or `"missing"`).
631
+
632
+ ### file_info
633
+
634
+ A loaded file's frontmatter, sync state and (unless `include_chunks` is false) its chunks.
635
+
636
+ ### unload_file
637
+
638
+ Soft-delete a file's chunks and forget the file source.
639
+
640
+ ### sync_files
641
+
642
+ Reload every loaded file that changed on disk. Returns the synced, skipped (unchanged) and missing files.
643
+
644
+ ## Maintenance Tools
645
+
646
+ ### robot_teams_status
647
+
648
+ Cases waiting for each memory-maintenance robot team (`tag_curator`, `consolidator`, `contradiction_detector`, `archivist`). SQL only; no LLM calls. **Parameters:** `teams` (optional; default the configured teams).
649
+
650
+ ### run_robot_teams
651
+
652
+ Run one batch of each team. Teams act directly (merging tags and near-duplicate memories, retiring contradicted memories, archiving cold ones); removals are soft deletes that `restore` undoes. Uses the configured LLM. See the [Robot Teams guide](robot-teams.md). **Parameters:** `teams` (optional).
653
+
654
+ ### enrich_pending
655
+
656
+ Do what background jobs missed: embeddings and tags for nodes without them, and propositions for nodes not yet decomposed. **Parameters:** `kinds` (any of `"embeddings"`, `"tags"`, `"propositions"`; default all).
657
+
462
658
  ## Robot Group Tools
463
659
 
464
660
  Robot Groups enable high-availability configurations with multiple robots sharing working memory. Groups support active/passive roles, automatic failover, and real-time synchronization via PostgreSQL LISTEN/NOTIFY.
465
661
 
466
- ### CreateGroupTool
662
+ ### create_group
467
663
 
468
664
  Create a new robot group with shared working memory.
469
665
 
@@ -487,7 +683,7 @@ Create a new robot group with shared working memory.
487
683
 
488
684
  ---
489
685
 
490
- ### ListGroupsTool
686
+ ### list_groups
491
687
 
492
688
  List all active robot groups in the current MCP session.
493
689
 
@@ -515,7 +711,7 @@ List all active robot groups in the current MCP session.
515
711
 
516
712
  ---
517
713
 
518
- ### GetGroupStatusTool
714
+ ### get_group_status
519
715
 
520
716
  Get detailed status of a robot group.
521
717
 
@@ -544,7 +740,7 @@ Get detailed status of a robot group.
544
740
 
545
741
  ---
546
742
 
547
- ### JoinGroupTool
743
+ ### join_group
548
744
 
549
745
  Add a robot to an existing group.
550
746
 
@@ -566,7 +762,7 @@ Add a robot to an existing group.
566
762
 
567
763
  ---
568
764
 
569
- ### LeaveGroupTool
765
+ ### leave_group
570
766
 
571
767
  Remove a robot from a group.
572
768
 
@@ -586,7 +782,7 @@ Remove a robot from a group.
586
782
 
587
783
  ---
588
784
 
589
- ### GroupRememberTool
785
+ ### group_remember
590
786
 
591
787
  Store memory shared across all group members. Only the active robot can write to group memory.
592
788
 
@@ -610,15 +806,16 @@ Store memory shared across all group members. Only the active robot can write to
610
806
 
611
807
  ---
612
808
 
613
- ### GroupRecallTool
809
+ ### group_recall
614
810
 
615
- Recall memories from a group's shared context.
811
+ Recall memories through the group's primary robot.
616
812
 
617
813
  **Parameters:**
618
814
  - `group_name` (String, required): The target group
619
815
  - `query` (String, required): Search query
620
816
  - `limit` (Integer, optional): Maximum results (default: 10)
621
817
  - `strategy` (String, optional): `"vector"`, `"fulltext"`, or `"hybrid"` (default: `"hybrid"`)
818
+ - `timeframe`, `metadata`, `query_tags`, `with_relevance` (optional): As for [recall](#recall)
622
819
 
623
820
  **Returns:**
624
821
  ```json
@@ -640,7 +837,7 @@ Recall memories from a group's shared context.
640
837
 
641
838
  ---
642
839
 
643
- ### GetGroupWorkingMemoryTool
840
+ ### get_group_working_memory
644
841
 
645
842
  Get a group's working memory contents.
646
843
 
@@ -668,7 +865,7 @@ Get a group's working memory contents.
668
865
 
669
866
  ---
670
867
 
671
- ### PromoteRobotTool
868
+ ### promote_robot
672
869
 
673
870
  Promote a passive robot to active role. The current active robot becomes passive.
674
871
 
@@ -689,7 +886,7 @@ Promote a passive robot to active role. The current active robot becomes passive
689
886
 
690
887
  ---
691
888
 
692
- ### FailoverTool
889
+ ### failover
693
890
 
694
891
  Trigger failover to the next available robot in the group.
695
892
 
@@ -709,7 +906,7 @@ Trigger failover to the next available robot in the group.
709
906
 
710
907
  ---
711
908
 
712
- ### SyncGroupTool
909
+ ### sync_group
713
910
 
714
911
  Manually synchronize group state across all members.
715
912
 
@@ -728,7 +925,30 @@ Manually synchronize group state across all members.
728
925
 
729
926
  ---
730
927
 
731
- ### ShutdownGroupTool
928
+ ### clear_group_working_memory
929
+
930
+ Clear the group's shared working memory for every member. Memories stay in long-term memory.
931
+
932
+ **Parameters:**
933
+ - `group_name` (String, required)
934
+
935
+ ---
936
+
937
+ ### transfer_working_memory
938
+
939
+ Hand one member's working memory to another (e.g., before a robot leaves the group).
940
+
941
+ **Parameters:**
942
+ - `group_name` (String, required)
943
+ - `from_robot` (String, required)
944
+ - `to_robot` (String, required)
945
+ - `clear_source` (Boolean, optional): Clear the source robot's working memory afterwards (default: true)
946
+
947
+ **Returns:** `{ "success": true, "transferred": 15, ... }`
948
+
949
+ ---
950
+
951
+ ### shutdown_group
732
952
 
733
953
  Gracefully shutdown a robot group, removing all members.
734
954
 
@@ -746,6 +966,17 @@ Gracefully shutdown a robot group, removing all members.
746
966
 
747
967
  ## Resources Reference
748
968
 
969
+ ### htm://prompts/startup
970
+
971
+ A system prompt (plain text) that tells the robot it has HTM as its long-term memory: recall from memory before saying it does not know, remember what is worth keeping with hierarchical tags, treat memories as dated evidence, and which MCP tools to use for each. It names the session's robot once `set_robot` has been called, and the user from `$USER`.
972
+
973
+ Load it into the client's system prompt at the start of a session. Outside MCP, the same text comes from Ruby:
974
+
975
+ ```ruby
976
+ HTM.startup_prompt(robot_name: htm.robot_name) # Ruby API robots
977
+ HTM.startup_prompt(robot_name: "Assistant", channel: :mcp) # adds the MCP tool guidance
978
+ ```
979
+
749
980
  ### htm://statistics
750
981
 
751
982
  Memory statistics as JSON.
@@ -758,8 +989,8 @@ Memory statistics as JSON.
758
989
  "current_robot": "my-assistant",
759
990
  "robot_id": 5,
760
991
  "robot_initialized": true,
761
- "embedding_provider": "ollama", // or "openai", "gemini", etc.
762
- "embedding_model": "nomic-embed-text" // provider-specific model
992
+ "embedding_provider": "lms", // or "openai", "gemini", etc.
993
+ "embedding_model": "text-embedding-nomic-embed-text-v1.5" // provider-specific model
763
994
  }
764
995
  ```
765
996
 
@@ -810,6 +1041,14 @@ Active robot groups and their status:
810
1041
  }
811
1042
  ```
812
1043
 
1044
+ ### htm://config
1045
+
1046
+ The active configuration, without credentials: environment, embedding/tag/proposition providers and models, chunking, job backend, week start, and robot-team settings.
1047
+
1048
+ ### htm://files
1049
+
1050
+ Loaded files with chunk counts and sync state, plus totals.
1051
+
813
1052
  ## Client Configuration
814
1053
 
815
1054
  ### Claude Desktop
@@ -820,7 +1059,8 @@ Add to `~/.config/claude/claude_desktop_config.json` (Linux/macOS) or `%APPDATA%
820
1059
  {
821
1060
  "mcpServers": {
822
1061
  "htm-memory": {
823
- "command": "htm_mcp",
1062
+ "command": "htm",
1063
+ "args": ["mcp"],
824
1064
  "env": {
825
1065
  "HTM_DATABASE__URL": "postgresql://user@localhost:5432/htm_development"
826
1066
  }
@@ -829,13 +1069,14 @@ Add to `~/.config/claude/claude_desktop_config.json` (Linux/macOS) or `%APPDATA%
829
1069
  }
830
1070
  ```
831
1071
 
832
- If `htm_mcp` is not in your PATH, use the absolute path:
1072
+ If `htm` is not in your PATH, use the absolute path:
833
1073
 
834
1074
  ```json
835
1075
  {
836
1076
  "mcpServers": {
837
1077
  "htm-memory": {
838
- "command": "/path/to/htm_mcp",
1078
+ "command": "/path/to/htm",
1079
+ "args": ["mcp"],
839
1080
  "env": {
840
1081
  "HTM_DATABASE__URL": "postgresql://user@localhost:5432/htm_development"
841
1082
  }
@@ -857,7 +1098,8 @@ Add to `~/.claude/claude_code_config.json`:
857
1098
  {
858
1099
  "mcpServers": {
859
1100
  "htm-memory": {
860
- "command": "htm_mcp",
1101
+ "command": "htm",
1102
+ "args": ["mcp"],
861
1103
  "env": {
862
1104
  "HTM_DATABASE__URL": "postgresql://user@localhost:5432/htm_development"
863
1105
  }
@@ -887,7 +1129,8 @@ Add to `~/.config/aia/config.yml`:
887
1129
  ```yaml
888
1130
  mcp_servers:
889
1131
  htm-memory:
890
- command: htm_mcp
1132
+ command: htm
1133
+ args: ["mcp"]
891
1134
  env:
892
1135
  HTM_DATABASE__URL: postgresql://user@localhost:5432/htm_development
893
1136
  ```
@@ -897,7 +1140,8 @@ For project-specific configuration, add to `.aia/config.yml` in your project roo
897
1140
  ```yaml
898
1141
  mcp_servers:
899
1142
  htm-memory:
900
- command: htm_mcp
1143
+ command: htm
1144
+ args: ["mcp"]
901
1145
  env:
902
1146
  HTM_DATABASE__URL: postgresql://user@localhost:5432/my_project_htm
903
1147
  ```
@@ -1009,15 +1253,15 @@ This will find `database:postgresql` even with the typo.
1009
1253
  ### How Sessions Work
1010
1254
 
1011
1255
  1. **Per-client isolation**: Each MCP client spawns its own server process
1012
- 2. **Robot identity**: The `SetRobotTool` establishes which robot you're using
1256
+ 2. **Robot identity**: The `set_robot` tool establishes which robot you're using
1013
1257
  3. **Working memory**: Each robot has its own working memory tracked in the database
1014
1258
  4. **Hive mind**: All robots share the same long-term memory
1015
1259
 
1016
1260
  ### Best Practices
1017
1261
 
1018
- 1. **Always set robot identity first**: Call `SetRobotTool` at the start of each session
1262
+ 1. **Always set robot identity first**: Call `set_robot` at the start of each session
1019
1263
  2. **Use consistent robot names**: Use the same name to maintain continuity
1020
- 3. **Restore previous sessions**: Use `GetWorkingMemoryTool` to restore context
1264
+ 3. **Restore previous sessions**: Use `get_working_memory` to restore context
1021
1265
  4. **Use descriptive robot names**: e.g., `"code-review-assistant"`, `"project-x-helper"`
1022
1266
 
1023
1267
  ## Troubleshooting
@@ -1039,7 +1283,7 @@ export HTM_DATABASE__URL="postgresql://user@localhost:5432/htm_development"
1039
1283
  **Error: `could not connect to server`**
1040
1284
  1. Verify PostgreSQL is running
1041
1285
  2. Check your connection URL
1042
- 3. Test with: `rake htm:db:test`
1286
+ 3. Test with: `htm db verify`
1043
1287
 
1044
1288
  **Error: `extension "vector" does not exist`**
1045
1289
  ```bash
@@ -1052,7 +1296,7 @@ psql htm_development -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
1052
1296
 
1053
1297
  **Claude Desktop doesn't show HTM tools:**
1054
1298
  1. Verify the config file path is correct for your OS
1055
- 2. Check that `htm_mcp` is in your PATH or use an absolute path
1299
+ 2. Check that `htm` is in your PATH (or use an absolute path) and that `"args": ["mcp"]` is set
1056
1300
  3. Restart Claude Desktop completely
1057
1301
  4. Check Claude Desktop logs for errors
1058
1302
 
@@ -1063,12 +1307,12 @@ psql htm_development -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
1063
1307
 
1064
1308
  ### Embedding/Tag Errors
1065
1309
 
1066
- **Error: `Connection refused` (when using Ollama)**
1067
- 1. Start Ollama: `ollama serve`
1068
- 2. Pull required models:
1310
+ **Error: `Connection refused` (when using LM Studio)**
1311
+ 1. Start the server: `lms server start` (check with `curl http://localhost:1234/v1/models`)
1312
+ 2. Download required models:
1069
1313
  ```bash
1070
- ollama pull nomic-embed-text
1071
- ollama pull gemma3:latest
1314
+ lms get nomic-embed-text-v1.5
1315
+ lms get google/gemma-3-4b
1072
1316
  ```
1073
1317
 
1074
1318
  **Error: `API key invalid` (when using cloud providers)**
@@ -1081,14 +1325,14 @@ psql htm_development -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
1081
1325
 
1082
1326
  Enable verbose logging by checking STDERR output:
1083
1327
  ```bash
1084
- htm_mcp 2>&1 | tee mcp_debug.log
1328
+ htm mcp 2>&1 | tee mcp_debug.log
1085
1329
  ```
1086
1330
 
1087
1331
  The server logs all tool calls and errors to STDERR.
1088
1332
 
1089
1333
  ## Environment Variables
1090
1334
 
1091
- Run `htm_mcp help` for a complete list. Key variables:
1335
+ Run `htm env` for a complete list. Key variables:
1092
1336
 
1093
1337
  ### Database (required)
1094
1338
 
@@ -1105,31 +1349,29 @@ Run `htm_mcp help` for a complete list. Key variables:
1105
1349
  | `HTM_DATABASE__PORT` | Database port | `5432` |
1106
1350
  | `HTM_DATABASE__USER` | Database username | - |
1107
1351
  | `HTM_DATABASE__PASSWORD` | Database password | - |
1108
- | `HTM_DBSSLMODE` | SSL mode | `prefer` |
1352
+ | `HTM_DATABASE__SSLMODE` | SSL mode | `prefer` |
1109
1353
 
1110
1354
  ### LLM Providers
1111
1355
 
1112
- HTM uses RubyLLM which supports multiple providers. Defaults to Ollama for local development.
1356
+ HTM uses RubyLLM which supports multiple providers. Defaults to LM Studio (`lms`) for local development.
1113
1357
 
1114
1358
  | Variable | Description | Default |
1115
1359
  |----------|-------------|---------|
1116
- | `HTM_EMBEDDING_PROVIDER` | Embedding provider (`ollama`, `openai`, `gemini`, etc.) | `ollama` |
1117
- | `HTM_EMBEDDING_MODEL` | Embedding model (provider-specific) | `nomic-embed-text` |
1118
- | `HTM_TAG_PROVIDER` | Tag extraction provider | `ollama` |
1119
- | `HTM_TAG_MODEL` | Tag model | `gemma3:latest` |
1120
- | `HTM_OLLAMA_URL` | Ollama server URL (if using Ollama) | `http://localhost:11434` |
1360
+ | `HTM_EMBEDDING__PROVIDER` | Embedding provider (`lms`, `openai`, `gemini`, etc.) | `lms` |
1361
+ | `HTM_EMBEDDING__MODEL` | Embedding model (provider-specific) | `text-embedding-nomic-embed-text-v1.5` |
1362
+ | `HTM_TAG__PROVIDER` | Tag extraction provider (also `claude_code`, `codex`, `copilot`, `apfel`) | `lms` |
1363
+ | `HTM_TAG__MODEL` | Tag model | `google/gemma-3-4b` |
1364
+ | `HTM_PROVIDERS__LMS__URL` | LM Studio server URL (if using LM Studio) | `http://localhost:1234/v1` |
1121
1365
 
1122
1366
  ### Cloud Provider API Keys
1123
1367
 
1124
1368
  | Variable | Description |
1125
1369
  |----------|-------------|
1126
- | `OPENAI_API_KEY` | OpenAI API key |
1127
- | `ANTHROPIC_API_KEY` | Anthropic API key |
1128
- | `GEMINI_API_KEY` | Google Gemini API key |
1129
- | `HTM_ANTHROPIC_API_KEY` | Anthropic API key |
1130
- | `HTM_GEMINI_API_KEY` | Google Gemini API key |
1131
- | `HTM_AZURE_API_KEY` | Azure OpenAI API key |
1132
- | `HTM_AZURE_ENDPOINT` | Azure OpenAI endpoint |
1370
+ | `HTM_PROVIDERS__OPENAI__API_KEY` | OpenAI API key |
1371
+ | `HTM_PROVIDERS__ANTHROPIC__API_KEY` | Anthropic API key |
1372
+ | `HTM_PROVIDERS__GEMINI__API_KEY` | Google Gemini API key |
1373
+ | `HTM_PROVIDERS__AZURE__API_KEY` | Azure OpenAI API key |
1374
+ | `HTM_PROVIDERS__AZURE__ENDPOINT` | Azure OpenAI endpoint |
1133
1375
 
1134
1376
  ## Next Steps
1135
1377
 
@@ -1137,3 +1379,4 @@ HTM uses RubyLLM which supports multiple providers. Defaults to Ollama for local
1137
1379
  - [Adding Memories](adding-memories.md) - Learn about tags and metadata
1138
1380
  - [Recalling Memories](recalling-memories.md) - Search strategies
1139
1381
  - [Multi-Robot Systems](../robots/multi-robot.md) - Working with multiple robots
1382
+ - [Command Line (`htm`)](cli.md) - Every `htm` command