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.
- checksums.yaml +4 -4
- data/.architecture/decisions/adrs/005-rag-based-retrieval-with-hybrid-search.md +4 -0
- data/.architecture/decisions/adrs/017-bitemporal-event-time.md +78 -0
- data/.architecture/decisions/adrs/018-memory-timelines-and-node-links.md +64 -0
- data/.architecture/decisions/adrs/019-epistemic-status.md +66 -0
- data/.claude.json +11 -0
- data/.envrc +9 -7
- data/.irbrc +14 -14
- data/.reek.yml +104 -0
- data/.rubocop.yml +0 -11
- data/.ruby-version +1 -0
- data/CHANGELOG.md +160 -98
- data/README.md +22 -17
- data/SETUP.md +49 -46
- data/_typos.toml +17 -0
- data/bin/htm +18 -0
- data/db/migrate/00010_convert_embedding_to_sparsevec.rb +47 -0
- data/db/migrate/00011_strip_frontmatter_from_chunks.rb +66 -0
- data/db/migrate/00012_add_event_time_to_nodes.rb +110 -0
- data/db/migrate/00013_create_node_links.rb +158 -0
- data/db/migrate/00014_add_epistemic_status.rb +110 -0
- data/db/schema.sql +238 -7
- data/db/seed_data/README.md +11 -11
- data/db/seeds.rb +11 -11
- data/docs/api/database.md +8 -8
- data/docs/api/embedding-service.md +138 -262
- data/docs/api/htm.md +128 -12
- data/docs/api/index.md +8 -8
- data/docs/api/long-term-memory.md +8 -19
- data/docs/api/working-memory.md +34 -46
- data/docs/api/yard/HTM/Admin/Console.md +53 -0
- data/docs/api/yard/HTM/Admin/DatabaseCommands/Console.md +38 -0
- data/docs/api/yard/HTM/Admin/DatabaseCommands.md +127 -0
- data/docs/api/yard/HTM/Admin/EnrichCommands.md +85 -0
- data/docs/api/yard/HTM/Admin/Error.md +9 -0
- data/docs/api/yard/HTM/Admin/FileCommands/Console.md +50 -0
- data/docs/api/yard/HTM/Admin/FileCommands.md +83 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands/Base.md +17 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands/Edit.md +74 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands/Search.md +77 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands/TagSearch.md +46 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands/WorkingMemory.md +36 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands.md +67 -0
- data/docs/api/yard/HTM/Admin/TagCommands/Console.md +48 -0
- data/docs/api/yard/HTM/Admin/TagCommands.md +105 -0
- data/docs/api/yard/HTM/Admin/TagGraph.md +149 -0
- data/docs/api/yard/HTM/Admin/YardDocs.md +60 -0
- data/docs/api/yard/HTM/Admin.md +102 -0
- data/docs/api/yard/HTM/AuthorizationError.md +6 -6
- data/docs/api/yard/HTM/CLI/ConfigFile.md +40 -0
- data/docs/api/yard/HTM/CLI/Db.md +63 -0
- data/docs/api/yard/HTM/CLI/Enrich.md +39 -0
- data/docs/api/yard/HTM/CLI/ErrorSuggestion.md +56 -0
- data/docs/api/yard/HTM/CLI/Files.md +36 -0
- data/docs/api/yard/HTM/CLI/Group/ClassMethods.md +11 -0
- data/docs/api/yard/HTM/CLI/Group.md +13 -0
- data/docs/api/yard/HTM/CLI/MemoryCommand/ClassMethods.md +20 -0
- data/docs/api/yard/HTM/CLI/MemoryCommand.md +9 -0
- data/docs/api/yard/HTM/CLI/Robots.md +31 -0
- data/docs/api/yard/HTM/CLI/Support.md +9 -0
- data/docs/api/yard/HTM/CLI/Tags.md +57 -0
- data/docs/api/yard/HTM/CLI/WorkingMemory.md +24 -0
- data/docs/api/yard/HTM/CLI.md +84 -0
- data/docs/api/yard/HTM/CircuitBreaker/Guarded.md +29 -0
- data/docs/api/yard/HTM/CircuitBreaker/Settings.md +21 -0
- data/docs/api/yard/HTM/CircuitBreaker/Status.md +42 -0
- data/docs/api/yard/HTM/CircuitBreaker.md +54 -49
- data/docs/api/yard/HTM/CircuitBreakerOpenError.md +9 -9
- data/docs/api/yard/HTM/Config/Builder.md +87 -0
- data/docs/api/yard/HTM/Config/Coercion.md +59 -0
- data/docs/api/yard/HTM/Config/Database.md +102 -0
- data/docs/api/yard/HTM/Config/Readers.md +30 -0
- data/docs/api/yard/HTM/Config/RubyLlmSettings.md +32 -0
- data/docs/api/yard/HTM/Config/Validator.md +59 -0
- data/docs/api/yard/HTM/Config.md +224 -105
- data/docs/api/yard/HTM/ConfigurationError.md +20 -0
- data/docs/api/yard/HTM/Confirmation.md +22 -0
- data/docs/api/yard/HTM/Database/Connection.md +26 -0
- data/docs/api/yard/HTM/Database/Migrations.md +32 -0
- data/docs/api/yard/HTM/Database/Report.md +26 -0
- data/docs/api/yard/HTM/Database/SchemaFile.md +52 -0
- data/docs/api/yard/HTM/Database/Teardown.md +15 -0
- data/docs/api/yard/HTM/Database.md +58 -70
- data/docs/api/yard/HTM/DatabaseDocs.md +67 -0
- data/docs/api/yard/HTM/DatabaseError.md +6 -6
- data/docs/api/yard/HTM/Deletion.md +32 -0
- data/docs/api/yard/HTM/EmbeddingError.md +6 -6
- data/docs/api/yard/HTM/EmbeddingService.md +37 -38
- data/docs/api/yard/HTM/Epistemics.md +135 -0
- data/docs/api/yard/HTM/Error.md +6 -6
- data/docs/api/yard/HTM/EventTime.md +110 -0
- data/docs/api/yard/HTM/FileMemory.md +76 -0
- data/docs/api/yard/HTM/InputValidator.md +82 -0
- data/docs/api/yard/HTM/JobAdapter/Job.md +26 -0
- data/docs/api/yard/HTM/JobAdapter.md +35 -16
- data/docs/api/yard/HTM/Jobs/FailureLogging.md +14 -0
- data/docs/api/yard/HTM/Jobs/GenerateEmbeddingJob.md +16 -0
- data/docs/api/yard/HTM/Jobs/GeneratePropositionsJob.md +17 -0
- data/docs/api/yard/HTM/Jobs/GenerateRelationshipsJob.md +26 -0
- data/docs/api/yard/HTM/Jobs/GenerateTagsJob.md +17 -0
- data/docs/api/yard/HTM/Jobs/LlmCallTimer.md +58 -0
- data/docs/api/yard/HTM/Jobs/NodeLookup.md +14 -0
- data/docs/api/yard/HTM/Jobs.md +13 -0
- data/docs/api/yard/HTM/Loaders/ChunkSync/Chunk.md +22 -0
- data/docs/api/yard/HTM/Loaders/ChunkSync.md +50 -0
- data/docs/api/yard/HTM/Loaders/MarkdownChunker/Coalescer.md +24 -0
- data/docs/api/yard/HTM/Loaders/MarkdownChunker/Packer.md +20 -0
- data/docs/api/yard/HTM/Loaders/MarkdownChunker/Splitter.md +18 -0
- data/docs/api/yard/HTM/Loaders/MarkdownChunker.md +83 -0
- data/docs/api/yard/HTM/Loaders/MarkdownLoader/Document.md +43 -0
- data/docs/api/yard/HTM/Loaders/MarkdownLoader.md +62 -0
- data/docs/api/yard/HTM/Loaders.md +5 -0
- data/docs/api/yard/HTM/LongTermMemory/FulltextSearch.md +36 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfMerger.md +25 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfRows.md +30 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfSql/Query.md +79 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfSql/Source.md +45 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfSql.md +11 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/TagDepth.md +52 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch.md +52 -0
- data/docs/api/yard/HTM/LongTermMemory/NodeOperations.md +95 -0
- data/docs/api/yard/HTM/LongTermMemory/RelevanceScorer/HierarchicalJaccard.md +58 -0
- data/docs/api/yard/HTM/LongTermMemory/RelevanceScorer/TagSearch.md +27 -0
- data/docs/api/yard/HTM/LongTermMemory/RelevanceScorer.md +81 -0
- data/docs/api/yard/HTM/LongTermMemory/RobotOperations.md +22 -0
- data/docs/api/yard/HTM/LongTermMemory/TagOperations/ExpiringValue.md +24 -0
- data/docs/api/yard/HTM/LongTermMemory/TagOperations/TagMatchSql.md +40 -0
- data/docs/api/yard/HTM/LongTermMemory/TagOperations.md +129 -0
- data/docs/api/yard/HTM/LongTermMemory/VectorSearch.md +30 -0
- data/docs/api/yard/HTM/LongTermMemory.md +279 -31
- data/docs/api/yard/HTM/MCP/AssembleContextTool.md +16 -0
- data/docs/api/yard/HTM/MCP/ClearGroupWorkingMemoryTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ClearWorkingMemoryTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ConfigResource.md +12 -0
- data/docs/api/yard/HTM/MCP/ConfirmTool.md +12 -0
- data/docs/api/yard/HTM/MCP/CreateGroupTool.md +12 -0
- data/docs/api/yard/HTM/MCP/EnrichPendingTool.md +16 -0
- data/docs/api/yard/HTM/MCP/ExtractPropositionsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/FailoverTool.md +12 -0
- data/docs/api/yard/HTM/MCP/FileInfoTool.md +13 -0
- data/docs/api/yard/HTM/MCP/FileSourcesResource.md +12 -0
- data/docs/api/yard/HTM/MCP/FileSupport.md +7 -0
- data/docs/api/yard/HTM/MCP/FindByTopicTool.md +12 -0
- data/docs/api/yard/HTM/MCP/FirstMentionTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ForgetContentTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ForgetTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GetGroupStatusTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GetGroupWorkingMemoryTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GetNodeTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GetRobotTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GetWorkingMemoryTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GroupRecallTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GroupRememberTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GroupSession.md +23 -0
- data/docs/api/yard/HTM/MCP/JoinGroupTool.md +12 -0
- data/docs/api/yard/HTM/MCP/LeaveGroupTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ListDeletedTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ListFilesTool.md +13 -0
- data/docs/api/yard/HTM/MCP/ListGroupsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ListRobotsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ListTagsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/LoadDirectoryTool.md +13 -0
- data/docs/api/yard/HTM/MCP/LoadFileTool.md +13 -0
- data/docs/api/yard/HTM/MCP/MemoryStatsResource.md +13 -0
- data/docs/api/yard/HTM/MCP/PopularTagsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/PromoteRobotTool.md +12 -0
- data/docs/api/yard/HTM/MCP/PurgeDeletedTool.md +12 -0
- data/docs/api/yard/HTM/MCP/RecallTool.md +16 -0
- data/docs/api/yard/HTM/MCP/RecentMemoriesResource.md +13 -0
- data/docs/api/yard/HTM/MCP/RelatedNodesTool.md +12 -0
- data/docs/api/yard/HTM/MCP/RememberTool.md +12 -0
- data/docs/api/yard/HTM/MCP/RestoreTool.md +12 -0
- data/docs/api/yard/HTM/MCP/RobotGroupsResource.md +13 -0
- data/docs/api/yard/HTM/MCP/RobotTeamsStatusTool.md +13 -0
- data/docs/api/yard/HTM/MCP/RunRobotTeamsTool.md +13 -0
- data/docs/api/yard/HTM/MCP/SearchByTagsTool.md +16 -0
- data/docs/api/yard/HTM/MCP/SearchTagsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/Server.md +37 -0
- data/docs/api/yard/HTM/MCP/Session.md +32 -0
- data/docs/api/yard/HTM/MCP/SetRobotTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ShutdownGroupTool.md +12 -0
- data/docs/api/yard/HTM/MCP/StartupPromptResource.md +16 -0
- data/docs/api/yard/HTM/MCP/StatsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/SyncFilesTool.md +13 -0
- data/docs/api/yard/HTM/MCP/SyncGroupTool.md +12 -0
- data/docs/api/yard/HTM/MCP/TagHierarchyResource.md +16 -0
- data/docs/api/yard/HTM/MCP/TagNodeTool.md +12 -0
- data/docs/api/yard/HTM/MCP/TagTreeTool.md +22 -0
- data/docs/api/yard/HTM/MCP/TeamNames.md +7 -0
- data/docs/api/yard/HTM/MCP/TimelineTool.md +12 -0
- data/docs/api/yard/HTM/MCP/Tool.md +24 -0
- data/docs/api/yard/HTM/MCP/ToolSupport.md +17 -0
- data/docs/api/yard/HTM/MCP/TopicRelationshipsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/TransferWorkingMemoryTool.md +12 -0
- data/docs/api/yard/HTM/MCP/UnloadFileTool.md +13 -0
- data/docs/api/yard/HTM/MCP/UntagNodeTool.md +12 -0
- data/docs/api/yard/HTM/MCP.md +30 -0
- data/docs/api/yard/HTM/Migration.md +44 -0
- data/docs/api/yard/HTM/Models/FileSource.md +66 -0
- data/docs/api/yard/HTM/Models/Node/Scopes.md +74 -0
- data/docs/api/yard/HTM/Models/Node/SoftDeletion.md +22 -0
- data/docs/api/yard/HTM/Models/Node/VectorSimilarity.md +28 -0
- data/docs/api/yard/HTM/Models/Node.md +113 -0
- data/docs/api/yard/HTM/Models/NodeLink.md +65 -0
- data/docs/api/yard/HTM/Models/NodeRelationship.md +31 -0
- data/docs/api/yard/HTM/Models/NodeTag.md +38 -0
- data/docs/api/yard/HTM/Models/Robot.md +50 -0
- data/docs/api/yard/HTM/Models/RobotNode.md +35 -0
- data/docs/api/yard/HTM/Models/Tag/Scopes.md +32 -0
- data/docs/api/yard/HTM/Models/Tag.md +112 -0
- data/docs/api/yard/HTM/Models.md +5 -0
- data/docs/api/yard/HTM/NodeEnrichment.md +36 -0
- data/docs/api/yard/HTM/NodeView.md +113 -0
- data/docs/api/yard/HTM/NotFoundError.md +6 -5
- data/docs/api/yard/HTM/Observability.md +58 -40
- data/docs/api/yard/HTM/PropositionError.md +6 -6
- data/docs/api/yard/HTM/PropositionService.md +63 -29
- data/docs/api/yard/HTM/QueryCache/KeyNormalizer.md +25 -0
- data/docs/api/yard/HTM/QueryCache/NullStore.md +19 -0
- data/docs/api/yard/HTM/QueryCache/Store.md +43 -0
- data/docs/api/yard/HTM/QueryCache.md +41 -46
- data/docs/api/yard/HTM/QueryTimeoutError.md +9 -8
- data/docs/api/yard/HTM/Railtie.md +11 -7
- data/docs/api/yard/HTM/RecallQuery.md +111 -0
- data/docs/api/yard/HTM/ResourceExhaustedError.md +6 -6
- data/docs/api/yard/HTM/RobotGroup/CacheSync.md +35 -0
- data/docs/api/yard/HTM/RobotGroup/Membership.md +96 -0
- data/docs/api/yard/HTM/RobotGroup/TransferOptions.md +14 -0
- data/docs/api/yard/HTM/RobotGroup/WorkingMemoryLedger.md +65 -0
- data/docs/api/yard/HTM/RobotGroup.md +116 -360
- data/docs/api/yard/HTM/Robots/Actions/TagMove.md +31 -0
- data/docs/api/yard/HTM/Robots/Actions.md +153 -0
- data/docs/api/yard/HTM/Robots/Neighbors.md +20 -0
- data/docs/api/yard/HTM/Robots/Supervisor/Idler.md +26 -0
- data/docs/api/yard/HTM/Robots/Supervisor/Roster.md +26 -0
- data/docs/api/yard/HTM/Robots/Supervisor.md +42 -0
- data/docs/api/yard/HTM/Robots/Team.md +60 -0
- data/docs/api/yard/HTM/Robots/Teams/Archivist.md +43 -0
- data/docs/api/yard/HTM/Robots/Teams/Consolidator.md +29 -0
- data/docs/api/yard/HTM/Robots/Teams/ContradictionDetector.md +33 -0
- data/docs/api/yard/HTM/Robots/Teams/TagCurator.md +37 -0
- data/docs/api/yard/HTM/Robots/Teams.md +5 -0
- data/docs/api/yard/HTM/Robots/Tools/ArchiveNodes.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools/Base.md +16 -0
- data/docs/api/yard/HTM/Robots/Tools/MergeNodes.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools/MergeTags.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools/Pass.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools/RecordConflict.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools/SupersedeNode.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools.md +14 -0
- data/docs/api/yard/HTM/Robots.md +72 -0
- data/docs/api/yard/HTM/SearchFilters.md +82 -0
- data/docs/api/yard/HTM/SequelConfig.md +97 -0
- data/docs/api/yard/HTM/Settings.md +39 -0
- data/docs/api/yard/HTM/Sinatra/Helpers.md +37 -0
- data/docs/api/yard/HTM/Sinatra/Middleware.md +29 -0
- data/docs/api/yard/HTM/Sinatra.md +44 -0
- data/docs/api/yard/HTM/SqlBuilder/Sparsevec.md +69 -0
- data/docs/api/yard/HTM/SqlBuilder.md +62 -75
- data/docs/api/yard/HTM/StartupPrompt.md +45 -0
- data/docs/api/yard/HTM/TagError.md +6 -6
- data/docs/api/yard/HTM/TagService.md +100 -37
- data/docs/api/yard/HTM/TagTree/Branch.md +43 -0
- data/docs/api/yard/HTM/TagTree/SvgRenderer/Layout.md +51 -0
- data/docs/api/yard/HTM/TagTree/SvgRenderer.md +25 -0
- data/docs/api/yard/HTM/TagTree.md +65 -0
- data/docs/api/yard/HTM/Telemetry/NullInstrument.md +12 -9
- data/docs/api/yard/HTM/Telemetry/NullMeter.md +17 -9
- data/docs/api/yard/HTM/Telemetry.md +53 -50
- data/docs/api/yard/HTM/Timeframe/Result.md +13 -16
- data/docs/api/yard/HTM/Timeframe.md +17 -20
- data/docs/api/yard/HTM/TimeframeExtractor/Patterns.md +18 -0
- data/docs/api/yard/HTM/TimeframeExtractor/Result.md +13 -16
- data/docs/api/yard/HTM/TimeframeExtractor.md +27 -16
- data/docs/api/yard/HTM/Timeline.md +113 -0
- data/docs/api/yard/HTM/ValidationError.md +6 -5
- data/docs/api/yard/HTM/Workflows/RememberWorkflow/NodeState.md +73 -0
- data/docs/api/yard/HTM/Workflows/RememberWorkflow.md +80 -0
- data/docs/api/yard/HTM/Workflows.md +5 -0
- data/docs/api/yard/HTM/WorkingMemory/Entry.md +67 -0
- data/docs/api/yard/HTM/WorkingMemory/Store.md +54 -0
- data/docs/api/yard/HTM/WorkingMemory.md +113 -87
- data/docs/api/yard/HTM/WorkingMemoryChannel/Subscribers.md +28 -0
- data/docs/api/yard/HTM/WorkingMemoryChannel.md +108 -102
- data/docs/api/yard/HTM.md +483 -5
- data/docs/api/yard/README.md +211 -0
- data/docs/api/yard/Sinatra/Base.md +30 -0
- data/docs/api/yard/Sinatra.md +7 -0
- data/docs/api/yard/index.csv +1834 -181
- data/docs/api/yard-reference.md +228 -9
- data/docs/architecture/adrs/005-rag-retrieval.md +3 -0
- data/docs/architecture/adrs/index.md +1 -1
- data/docs/architecture/index.md +2 -2
- data/docs/architecture/overview.md +3 -3
- data/docs/assets/images/project-structure.svg +2 -2
- data/docs/database/INDEX.md +113 -0
- data/docs/database/README.md +60 -176
- data/docs/database/file_sources.md +51 -0
- data/docs/database/file_sources.svg +120 -0
- data/docs/database/naming-convention.md +12 -12
- data/docs/database/node_links.md +65 -0
- data/docs/database/node_links.svg +171 -0
- data/docs/database/node_relationships.md +62 -0
- data/docs/database/node_relationships.svg +124 -0
- data/docs/database/node_tags.md +50 -0
- data/docs/database/node_tags.svg +125 -0
- data/docs/database/nodes.md +120 -0
- data/docs/database/nodes.svg +394 -0
- data/docs/database/robot_nodes.md +57 -0
- data/docs/database/robot_nodes.svg +155 -0
- data/docs/database/robots.md +40 -0
- data/docs/database/robots.svg +131 -0
- data/docs/database/schema.svg +384 -275
- data/docs/database/schema_migrations.md +19 -0
- data/docs/database/schema_migrations.svg +31 -0
- data/docs/database/tags.md +47 -0
- data/docs/database/tags.svg +90 -0
- data/docs/development/asgard-tasks.md +114 -0
- data/docs/development/contributing.md +6 -6
- data/docs/development/index.md +15 -17
- data/docs/development/schema.md +43 -14
- data/docs/development/setup.md +60 -70
- data/docs/development/testing.md +57 -65
- data/docs/examples/basic-usage.md +9 -9
- data/docs/examples/config-files.md +8 -8
- data/docs/examples/file-loading.md +12 -12
- data/docs/examples/index.md +15 -8
- data/docs/examples/llm-configuration.md +13 -9
- data/docs/examples/mcp-client.md +61 -59
- data/docs/examples/rails-integration.md +5 -4
- data/docs/examples/sinatra-integration.md +5 -4
- data/docs/examples/standalone-app.md +17 -16
- data/docs/getting-started/index.md +3 -3
- data/docs/getting-started/installation.md +76 -83
- data/docs/getting-started/quick-start.md +24 -22
- data/docs/guides/adding-memories.md +14 -3
- data/docs/guides/cli.md +458 -0
- data/docs/guides/configuration.md +72 -37
- data/docs/guides/epistemic-status.md +138 -0
- data/docs/guides/event-time.md +106 -0
- data/docs/guides/file-loading.md +26 -22
- data/docs/guides/getting-started.md +21 -17
- data/docs/guides/long-term-memory.md +1 -1
- data/docs/guides/mcp-server.md +416 -173
- data/docs/guides/propositions.md +18 -29
- data/docs/guides/recalling-memories.md +22 -7
- data/docs/guides/robot-teams.md +96 -0
- data/docs/guides/search-strategies.md +10 -7
- data/docs/guides/tags.md +19 -19
- data/docs/guides/timeline.md +106 -0
- data/docs/index.md +7 -7
- data/docs/llms.txt +35 -0
- data/docs/multi_framework_support.md +13 -13
- data/docs/robots/robot-groups.md +9 -9
- data/docs/robots/two-tier-memory.md +13 -26
- data/docs/setup_local_database.md +33 -31
- data/examples/00_create_examples_db.rb +20 -7
- data/examples/01_basic_usage.rb +20 -18
- data/examples/02_config_file_example/README.md +13 -12
- data/examples/02_config_file_example/config/htm.local.yml +8 -8
- data/examples/02_config_file_example/show_config.rb +3 -4
- data/examples/03_custom_llm_configuration.rb +12 -12
- data/examples/04_file_loader_usage.rb +15 -21
- data/examples/05_timeframe_demo.rb +282 -234
- data/examples/06_example_app/.loki +36 -0
- data/examples/06_example_app/app.rb +21 -33
- data/examples/07_cli_app/README.md +18 -18
- data/examples/07_cli_app/htm_cli.rb +25 -19
- data/examples/08_sinatra_app/Gemfile +1 -0
- data/examples/08_sinatra_app/Gemfile.lock +101 -67
- data/examples/08_sinatra_app/app.rb +64 -62
- data/examples/09_mcp_client.rb +92 -119
- data/examples/10_telemetry/README.md +3 -3
- data/examples/10_telemetry/SETUP_README.md +2 -2
- data/examples/10_telemetry/demo.rb +5 -5
- data/examples/11_robot_groups/README.md +5 -4
- data/examples/11_robot_groups/lib/robot_worker.rb +0 -5
- data/examples/11_robot_groups/multi_process.rb +5 -4
- data/examples/11_robot_groups/same_process.rb +18 -17
- data/examples/12_rails_app/Gemfile +1 -1
- data/examples/12_rails_app/Gemfile.lock +146 -97
- data/examples/12_rails_app/README.md +21 -17
- data/examples/12_rails_app/app/controllers/chats_controller.rb +33 -63
- data/examples/12_rails_app/app/controllers/memories_controller.rb +7 -1
- data/examples/12_rails_app/app/controllers/messages_controller.rb +21 -58
- data/examples/12_rails_app/app/controllers/search_controller.rb +7 -2
- data/examples/12_rails_app/app/models/chat.rb +0 -33
- data/examples/12_rails_app/app/models/message.rb +0 -2
- data/examples/12_rails_app/app/views/chats/show.html.erb +2 -2
- data/examples/12_rails_app/app/views/files/new.html.erb +1 -1
- data/examples/12_rails_app/app/views/memories/_memory_card.html.erb +1 -1
- data/examples/12_rails_app/app/views/memories/new.html.erb +12 -0
- data/examples/12_rails_app/app/views/memories/show.html.erb +13 -0
- data/examples/12_rails_app/app/views/search/index.html.erb +18 -2
- data/examples/12_rails_app/config/initializers/ruby_llm.rb +11 -15
- data/examples/12_rails_app/db/migrate/20261205061932_create_ruby_llm_records.rb +160 -0
- data/examples/12_rails_app/db/migrate/20261205061933_create_chats.rb +13 -0
- data/examples/12_rails_app/db/migrate/20261205061934_create_messages.rb +23 -0
- data/examples/12_rails_app/db/schema.rb +163 -20
- data/examples/README.md +53 -44
- data/examples/examples_helper.rb +29 -5
- data/htm.gemspec +68 -0
- data/lib/htm/admin/database_commands.rb +454 -0
- data/lib/htm/admin/enrich_commands.rb +209 -0
- data/lib/htm/admin/file_commands.rb +323 -0
- data/lib/htm/admin/memory_commands/edit.rb +157 -0
- data/lib/htm/admin/memory_commands/search.rb +178 -0
- data/lib/htm/admin/memory_commands/tag_search.rb +98 -0
- data/lib/htm/admin/memory_commands/text.rb +164 -0
- data/lib/htm/admin/memory_commands/working_memory.rb +71 -0
- data/lib/htm/admin/memory_commands.rb +179 -0
- data/lib/htm/admin/tag_commands.rb +352 -0
- data/lib/htm/admin/tag_graph.rb +290 -0
- data/lib/htm/admin/templates/tag_graph.html +295 -0
- data/lib/htm/admin/yard_docs.rb +206 -0
- data/lib/htm/admin.rb +253 -0
- data/lib/htm/circuit_breaker.rb +142 -68
- data/lib/htm/class_methods.rb +136 -0
- data/lib/htm/cli/config_file.rb +86 -0
- data/lib/htm/cli/db.rb +77 -0
- data/lib/htm/cli/enrich.rb +44 -0
- data/lib/htm/cli/environment.rb +74 -0
- data/lib/htm/cli/error_suggestion.rb +97 -0
- data/lib/htm/cli/files.rb +41 -0
- data/lib/htm/cli/group.rb +32 -0
- data/lib/htm/cli/memory.rb +320 -0
- data/lib/htm/cli/memory_command.rb +71 -0
- data/lib/htm/cli/robots.rb +71 -0
- data/lib/htm/cli/support.rb +46 -0
- data/lib/htm/cli/tags.rb +103 -0
- data/lib/htm/cli/working_memory.rb +41 -0
- data/lib/htm/cli.rb +75 -0
- data/lib/htm/config/builder.rb +99 -68
- data/lib/htm/config/coercion.rb +91 -0
- data/lib/htm/config/database.rb +81 -52
- data/lib/htm/config/defaults.yml +52 -16
- data/lib/htm/config/readers.rb +85 -0
- data/lib/htm/config/ruby_llm_settings.rb +58 -0
- data/lib/htm/config/validator.rb +45 -26
- data/lib/htm/config.rb +112 -297
- data/lib/htm/database.rb +305 -396
- data/lib/htm/database_docs.rb +149 -0
- data/lib/htm/embedding_service.rb +26 -66
- data/lib/htm/epistemics.rb +254 -0
- data/lib/htm/errors.rb +4 -4
- data/lib/htm/event_time.rb +201 -0
- data/lib/htm/file_memory.rb +106 -0
- data/lib/htm/input_validator.rb +158 -0
- data/lib/htm/integrations/sinatra.rb +43 -31
- data/lib/htm/job_adapter.rb +78 -83
- data/lib/htm/jobs/failure_logging.rb +49 -0
- data/lib/htm/jobs/generate_embedding_job.rb +21 -28
- data/lib/htm/jobs/generate_propositions_job.rb +56 -28
- data/lib/htm/jobs/generate_relationships_job.rb +28 -24
- data/lib/htm/jobs/generate_tags_job.rb +32 -37
- data/lib/htm/jobs/llm_call_timer.rb +53 -0
- data/lib/htm/jobs/node_lookup.rb +27 -0
- data/lib/htm/knowledge_memory.rb +153 -0
- data/lib/htm/loaders/chunk_sync.rb +168 -0
- data/lib/htm/loaders/markdown_chunker.rb +207 -36
- data/lib/htm/loaders/markdown_loader.rb +76 -120
- data/lib/htm/long_term_memory/fulltext_search.rb +15 -36
- data/lib/htm/long_term_memory/hybrid_search.rb +471 -544
- data/lib/htm/long_term_memory/node_operations.rb +110 -81
- data/lib/htm/long_term_memory/relevance_scorer.rb +232 -237
- data/lib/htm/long_term_memory/tag_operations.rb +201 -130
- data/lib/htm/long_term_memory/vector_search.rb +33 -61
- data/lib/htm/long_term_memory.rb +5 -17
- data/lib/htm/mcp/file_tools.rb +190 -0
- data/lib/htm/mcp/group_tools.rb +223 -233
- data/lib/htm/mcp/node_tools.rb +350 -0
- data/lib/htm/mcp/resources.rb +102 -28
- data/lib/htm/mcp/robot_team_tools.rb +119 -0
- data/lib/htm/mcp/server.rb +26 -14
- data/lib/htm/mcp/tag_tools.rb +130 -0
- data/lib/htm/mcp/tool.rb +40 -0
- data/lib/htm/mcp/tool_support.rb +88 -0
- data/lib/htm/mcp/tools.rb +232 -283
- data/lib/htm/models/file_source.rb +35 -20
- data/lib/htm/models/node.rb +287 -193
- data/lib/htm/models/node_link.rb +97 -0
- data/lib/htm/models/node_relationship.rb +3 -2
- data/lib/htm/models/node_tag.rb +22 -2
- data/lib/htm/models/robot.rb +4 -8
- data/lib/htm/models/robot_node.rb +5 -2
- data/lib/htm/models/tag.rb +53 -207
- data/lib/htm/node_enrichment.rb +75 -0
- data/lib/htm/node_view.rb +295 -0
- data/lib/htm/observability.rb +114 -98
- data/lib/htm/proposition_service.rb +38 -74
- data/lib/htm/query_cache.rb +145 -91
- data/lib/htm/railtie.rb +3 -7
- data/lib/htm/request_options.rb +149 -0
- data/lib/htm/robot_group/cache_sync.rb +69 -0
- data/lib/htm/robot_group/membership.rb +147 -0
- data/lib/htm/robot_group/working_memory_ledger.rb +111 -0
- data/lib/htm/robot_group.rb +128 -521
- data/lib/htm/robots/actions.rb +371 -0
- data/lib/htm/robots/neighbors.rb +63 -0
- data/lib/htm/robots/node_brief.rb +49 -0
- data/lib/htm/robots/supervisor.rb +140 -0
- data/lib/htm/robots/team.rb +124 -0
- data/lib/htm/robots/teams/archivist.rb +88 -0
- data/lib/htm/robots/teams/consolidator.rb +52 -0
- data/lib/htm/robots/teams/contradiction_detector.rb +67 -0
- data/lib/htm/robots/teams/tag_curator.rb +75 -0
- data/lib/htm/robots/tools.rb +127 -0
- data/lib/htm/robots.rb +125 -0
- data/lib/htm/search_filters.rb +116 -0
- data/lib/htm/sequel_config.rb +95 -59
- data/lib/htm/sql_builder.rb +162 -53
- data/lib/htm/startup_prompt.rb +73 -0
- data/lib/htm/tag_service.rb +104 -109
- data/lib/htm/tag_tree.rb +206 -0
- data/lib/htm/telemetry.rb +15 -16
- data/lib/htm/timeframe.rb +27 -9
- data/lib/htm/timeframe_extractor.rb +77 -55
- data/lib/htm/timeline.rb +230 -0
- data/lib/htm/version.rb +1 -1
- data/lib/htm/workflows/remember_workflow.rb +145 -136
- data/lib/htm/working_memory/entry.rb +53 -0
- data/lib/htm/working_memory/store.rb +97 -0
- data/lib/htm/working_memory.rb +137 -139
- data/lib/htm/working_memory_channel.rb +90 -40
- data/lib/htm.rb +177 -501
- data/mkdocs.yml +100 -23
- data/scripts/install_local_database.sh +7 -6
- metadata +1032 -594
- data/.tbls.yml +0 -31
- data/Rakefile +0 -240
- data/bin/htm_mcp +0 -27
- data/docs/api/yard/HTM/ActiveRecordConfig.md +0 -29
- data/docs/api/yard/HTM/ConfigSection.md +0 -28
- data/docs/database/public.file_sources.md +0 -42
- data/docs/database/public.file_sources.svg +0 -219
- data/docs/database/public.node_stats.md +0 -48
- data/docs/database/public.node_stats.svg +0 -41
- data/docs/database/public.node_tags.md +0 -41
- data/docs/database/public.node_tags.svg +0 -251
- data/docs/database/public.nodes.md +0 -61
- data/docs/database/public.nodes.svg +0 -283
- data/docs/database/public.nodes_tags.md +0 -39
- data/docs/database/public.nodes_tags.svg +0 -112
- data/docs/database/public.ontology_structure.md +0 -48
- data/docs/database/public.ontology_structure.svg +0 -38
- data/docs/database/public.operations_log.md +0 -42
- data/docs/database/public.operations_log.svg +0 -130
- data/docs/database/public.relationships.md +0 -39
- data/docs/database/public.relationships.svg +0 -41
- data/docs/database/public.robot_activity.md +0 -46
- data/docs/database/public.robot_activity.svg +0 -35
- data/docs/database/public.robot_nodes.md +0 -48
- data/docs/database/public.robot_nodes.svg +0 -251
- data/docs/database/public.robots.md +0 -34
- data/docs/database/public.robots.svg +0 -165
- data/docs/database/public.schema_migrations.md +0 -29
- data/docs/database/public.schema_migrations.svg +0 -26
- data/docs/database/public.tags.md +0 -38
- data/docs/database/public.tags.svg +0 -147
- data/docs/database/public.topic_relationships.md +0 -45
- data/docs/database/public.topic_relationships.svg +0 -32
- data/docs/database/schema.json +0 -1814
- data/docs/database_rake_tasks.md +0 -345
- data/docs/development/rake-tasks.md +0 -1113
- data/docs/using_rake_tasks_in_your_app.md +0 -383
- data/examples/06_example_app/Rakefile +0 -71
- data/examples/12_rails_app/app/models/model.rb +0 -5
- data/examples/12_rails_app/app/models/tool_call.rb +0 -5
- data/examples/12_rails_app/db/migrate/20250124000001_create_ruby_llm_tables.rb +0 -34
- data/examples/12_rails_app/db/migrate/20250124000002_create_models_table.rb +0 -28
- data/lib/htm/mcp/cli.rb +0 -583
- data/lib/htm/tasks.rb +0 -79
- data/lib/tasks/db.rake +0 -15
- data/lib/tasks/doc.rake +0 -301
- data/lib/tasks/files.rake +0 -285
- data/lib/tasks/htm.rake +0 -703
- data/lib/tasks/jobs.rake +0 -429
- data/lib/tasks/tags.rake +0 -184
- data/scripts/backfill_parent_tags.rb +0 -376
- data/scripts/normalize_plural_tags.rb +0 -335
data/CHANGELOG.md
CHANGED
|
@@ -7,111 +7,173 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.0] - 2026-12-05
|
|
11
|
+
|
|
12
|
+
Memories now record when things happened, how they changed and how they are known. This release also changes the storage format, the default LLM provider and the command line, and renames or removes several APIs. It does not keep backward compatibility.
|
|
13
|
+
|
|
14
|
+
### Upgrading from 0.0.32
|
|
15
|
+
- **Ruby 4.0 or later** is required.
|
|
16
|
+
- **Run `htm db migrate`.** Migrations 00010–00014 convert embeddings to `sparsevec`, strip YAML frontmatter from file chunks, add event time, create `node_links` and add epistemic status. Then run `htm enrich process_embeddings` and `htm enrich process_tags` to re-enrich the chunks migration 00011 repaired.
|
|
17
|
+
- **Embedding models over 1,000 dimensions are rejected** (for example OpenAI `text-embedding-3-small`), because the `sparsevec` HNSW index allows at most 1,000 non-zero values. The default model is LM Studio's 768-dimension `text-embedding-nomic-embed-text-v1.5`.
|
|
18
|
+
- **Ollama is no longer supported.** LM Studio (`:lms`) is the default provider; set `providers.lms.url` (default `http://localhost:1234/v1`) instead of `providers.ollama.url`.
|
|
19
|
+
- **MCP client configs** change from `"command": "htm_mcp"` to `"command": "htm", "args": ["mcp"]`.
|
|
20
|
+
- **Re-chunk loaded files** with `htm files load_dir DIR --force` to get the new sentence-boundary chunks.
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
- **Bitemporal event time** (#110, ADR-017). Nodes record `occurred_at`/`occurred_until` (when it happened), `valid_from`/`valid_until` (when it was true) and `time_source` (`recorded`, `stated`, `inferred`, `derived`, `frontmatter`, `file`).
|
|
24
|
+
- `remember` takes the times, or infers them from the text ("yesterday", "March 3, 2025"; `HTM_EVENT_TIME__INFER`).
|
|
25
|
+
- `recall(timeframe:)` now matches event spans. `time_axis: :recorded` filters on `created_at` instead, and `as_of:` returns what was valid at a moment.
|
|
26
|
+
- Propositions, merges, digests and file chunks derive their event time.
|
|
27
|
+
- `HTM::EventTime` and `HTM::SearchFilters` are new.
|
|
28
|
+
- See `docs/guides/event-time.md`.
|
|
29
|
+
- **Memory timelines** (#111, ADR-018).
|
|
30
|
+
- The new `node_links` table records `supersedes`, `merged_into`, `archived_into` and `derived_from` links, each with a reason, transition (`removed`, `restored`, `changed`) and robot.
|
|
31
|
+
- `remember(supersedes:, reason:, transition:)` retires the old state in the same transaction.
|
|
32
|
+
- `htm.timeline(id_or_query)` and `recall(include_history: true)` show how a memory changed.
|
|
33
|
+
- `content_hash` is unique only among active nodes, so a retired state is never revived.
|
|
34
|
+
- **Epistemic status** (#112, ADR-019).
|
|
35
|
+
- Nodes carry `epistemic_status` (`asserted`, `extracted`, `inferred`, `hypothesis`) and `confidence`. Evidence is recorded as `derived_from` links.
|
|
36
|
+
- New methods: `remember(status:, confidence:, evidence:)`, `recall(status:, min_confidence:)`, `confirm` and `first_mention`.
|
|
37
|
+
- Working memory labels each memory with its status, and the robot teams keep stated memories over inferred ones.
|
|
38
|
+
- **`htm` command line**, built on Thor (`HTM::CLI`):
|
|
39
|
+
- Groups: `db`, `enrich`, `files`, `robots`, `tags` and `wm`, plus `htm mcp`, `config`, `env` and `version`.
|
|
40
|
+
- Memory commands: `recall`/`search`, `remember`, `show`, `related`, `forget`, `restore`, `deleted`, `purge`, `tag`, `untag`, `propositions`, `stats`, `timeline`, `confirm` and `first_mention`.
|
|
41
|
+
- Every command takes `-c/--config`. The memory commands also take `--robot` and `--json`.
|
|
42
|
+
- Database errors print a suggested fix.
|
|
43
|
+
- The logic lives in `HTM::Admin`. See `docs/guides/cli.md`.
|
|
44
|
+
- **MCP server covers the whole API**: 52 tools (was 23), all with snake_case names.
|
|
45
|
+
- `recall` takes `timeframe`, `time_axis`, `as_of`, `metadata`, `query_tags`, `status`, `min_confidence` and `include_history`.
|
|
46
|
+
- New tools cover nodes, tags, files, working memory, robot teams, enrichment, timelines and epistemic status.
|
|
47
|
+
- New resources: `htm://config`, `htm://files` and `htm://prompts/startup`.
|
|
48
|
+
- **Startup prompt.** `HTM.startup_prompt(robot_name:, user:, channel:)` tells a robot that it has long-term memory and how to use it (#12).
|
|
49
|
+
- **Robot teams** (`HTM::Robots`, built on robot_lab) maintain memory in the background:
|
|
50
|
+
- `tag_curator` merges duplicate tags.
|
|
51
|
+
- `consolidator` merges near-duplicate nodes.
|
|
52
|
+
- `contradiction_detector` retires contradicted nodes.
|
|
53
|
+
- `archivist` digests cold nodes.
|
|
54
|
+
- Run them with `htm robots work|once|status` or `HTM::Robots.start`. Removals are soft deletes.
|
|
55
|
+
- **More providers**: `apfel` (Apple's on-device Foundation Models), `claude_code`, `codex` and `copilot`, through the ruby_llm-providers-* gems. All four are chat only.
|
|
56
|
+
- **`htm tags graph PREFIX`** writes an interactive force-directed graph of nodes and their shared-tag links to one self-contained HTML file.
|
|
57
|
+
- **`htm tags restore_plurals [--apply]`** renames tags that the old singularizer trimmed (`ruby-on-rail`, `necropsi`).
|
|
58
|
+
- **`database.statement_timeout`** (`HTM_DATABASE__STATEMENT_TIMEOUT`) is set on every pooled connection.
|
|
59
|
+
- **`RobotGroup#member(name)`** and `docs/llms.txt`.
|
|
60
|
+
|
|
61
|
+
### Changed
|
|
62
|
+
- **LM Studio replaces Ollama as the default provider.**
|
|
63
|
+
- Embeddings default to `text-embedding-nomic-embed-text-v1.5`; tags and propositions to `google/gemma-3-4b`.
|
|
64
|
+
- ruby_llm 2.2.3 is required (was 1.x), and calls pass `provider:` explicitly.
|
|
65
|
+
- **Embeddings are stored as `sparsevec(2000)`** with no zero padding. `embedding_dimension` now records the real size.
|
|
66
|
+
- **Hybrid search takes vector candidates from the whole corpus.** Previously it ranked only nodes that fulltext or tag search had already found, so a semantically close node sharing no keyword or tag was never returned. RRF now fuses three independent rankings (#13).
|
|
67
|
+
- **File chunks end on sentences.**
|
|
68
|
+
- `HTM::Loaders::MarkdownChunker` replaces Baran.
|
|
69
|
+
- It cuts at headers, code fences, rules, blank lines, then sentence ends. Overlap repeats whole sentences, and a heading joins the section after it.
|
|
70
|
+
- Chunks never exceed `chunk_size`, and `cursor` is the chunk's real offset in the file.
|
|
71
|
+
- Frontmatter stays on `file_sources` and is no longer copied into the first chunk's text.
|
|
72
|
+
- **Database session settings reach every pooled connection.** The pool is process-wide, so `database.pool_size` and `database.statement_timeout` are now global settings. `database.timeout` now sets Sequel's `pool_timeout`; it was ignored.
|
|
73
|
+
- **Code reorganized** so every quality gate (RuboCop, Reek, Flay, Flog, Typos) passes:
|
|
74
|
+
- `remember`, `confirm` and `first_mention` live in `HTM::KnowledgeMemory`.
|
|
75
|
+
- The node and search views are shared by the MCP tools and the CLI (`HTM::NodeView`).
|
|
76
|
+
- Large classes are split into collaborators.
|
|
77
|
+
- **Development tasks run on asgard** (`.loki` files, repo only). There is no Rakefile.
|
|
78
|
+
- `asgard test` runs the suite in parallel, one database per worker, cutting the run from 48s to 11s.
|
|
79
|
+
- Database docs are generated by pgdd instead of tbls.
|
|
80
|
+
- **`RobotGroup` loads shared memory into a member's in-memory working memory** when the member joins, on `sync_robot` and on `transfer_working_memory`. Before, only the database flags changed.
|
|
81
|
+
- **Examples refreshed** for event time, the configured models, RubyLLM 2.2 (the Rails chat app) and Ruby 4. `bin/htm` and the examples use the repo's bundle when run from a checkout.
|
|
82
|
+
|
|
83
|
+
### Breaking API changes
|
|
84
|
+
- `HTM.new` no longer takes `db_pool_size:` or `db_query_timeout:`, and `LongTermMemory.new` no longer takes `pool_size:` or `query_timeout:`.
|
|
85
|
+
- `LongTermMemory#search_hybrid` takes `candidate_limit:` instead of `prefilter_limit:`.
|
|
86
|
+
- `search_by_tags` takes `match: :any`/`:all` instead of `match_all:`.
|
|
87
|
+
- `find_query_matching_tags` drops `include_extracted:`; use `query_tag_matches`.
|
|
88
|
+
- `TagSearch.query` requires a `SearchFilters`; use `SearchFilters.none` instead of `nil`.
|
|
89
|
+
- `HTM::Robots::Actions.supersede_node` drops `allow_weaker:`; use `strict_supersede_node`.
|
|
90
|
+
- `WorkingMemory#add` drops `from_recall:` and `last_accessed:`; use `add_entry` with `Entry.recalled`.
|
|
91
|
+
- `Session.logger=` is now `Session.attach_logger`, and `register_htm` takes `logger:`.
|
|
92
|
+
- `Database.setup` always migrates, and `migrate`, `migration_status` and `seed` no longer take `db_url`.
|
|
93
|
+
- `Robots.teams([])` now means the configured teams.
|
|
94
|
+
- Removed: `EmbeddingService.pad_embedding`, `SqlBuilder.pad_embedding`, the `:storage_dimension` result key, `ollama_url`, `normalize_ollama_model` and `refresh_ollama_models!`.
|
|
95
|
+
|
|
96
|
+
### Fixed
|
|
97
|
+
- **Search and recall**
|
|
98
|
+
- `search_by_tags` with all tags required always raised `NoMethodError`.
|
|
99
|
+
- `Node#nearest_neighbors` ignored `distance:`.
|
|
100
|
+
- `recall` served stale cached results after `restore` or after `remember` revived a forgotten node (#70, #73, #75).
|
|
101
|
+
- "this week" spanned eight days on Sundays and ignored `week_start`. Current periods ("this month") now run from the start of the period to now (#41, #88).
|
|
102
|
+
- Tag prefix filters and `forget_content` treated `%` and `_` as wildcards (#45, #76).
|
|
103
|
+
- `topic_relationships` counted forgotten memories.
|
|
104
|
+
- **Soft delete**
|
|
105
|
+
- The `deleted` scopes never matched a row (#69).
|
|
106
|
+
- `Tag#restore!`, `RobotNode#restore!` and `NodeTag#restore!` raised `Sequel::NoExistingObject`.
|
|
107
|
+
- Tagging again after a soft delete hit a unique-index error (#19, #28).
|
|
108
|
+
- `forget` and `restore` raised a raw PG error for a non-integer id (#42).
|
|
109
|
+
- **File loading**
|
|
110
|
+
- `unload_file` left the chunks' tags, robot links, working memory entries and propositions active, and could drop the chunks but keep the source.
|
|
111
|
+
- A file edited within 5 seconds of its last load was skipped (#90).
|
|
112
|
+
- Frontmatter that was not a mapping, or that used aliases, crashed `load_file` (#92).
|
|
113
|
+
- A re-chunked file's old propositions stayed in recall; they are now soft-deleted and restored with their chunk.
|
|
114
|
+
- **Background jobs**
|
|
115
|
+
- Concurrent `:fiber` jobs shared one database connection and read each other's results or hung.
|
|
116
|
+
- One duplicate proposition dropped the rest of its batch.
|
|
117
|
+
- Merged nodes kept their stale embedding.
|
|
118
|
+
- Enrichment commands held one transaction for the whole run, so a crash lost hours of work.
|
|
119
|
+
- **Tags**
|
|
120
|
+
- The singularizer trimmed names that end in "s" (`AlchemyCMS` became `alchemycm`, `ruby-on-rails` became `ruby-on-rail`, `civil-rights` became `civil-right`).
|
|
121
|
+
- A multi-line tag passed `TagService` validation.
|
|
122
|
+
- `enrich process_tags` linked only the leaf tag, not its parents (#85).
|
|
123
|
+
- "Nodes with tags" counted tag links instead of nodes (#84).
|
|
124
|
+
- **Configuration and database**
|
|
125
|
+
- Setting one `HTM_<SECTION>__<KEY>` variable hid the rest of that section of `htm.yml`.
|
|
126
|
+
- `HTM_PROPOSITION__ENABLED=false` was treated as true.
|
|
127
|
+
- Config files ignored `HTM_ENV`.
|
|
128
|
+
- The embedding, tag and proposition timeouts were never applied (#79).
|
|
129
|
+
- OpenAI organization and project and the Azure endpoint never reached ruby_llm (#91).
|
|
130
|
+
- A database user or password containing URL-reserved characters broke the connection URL (#78).
|
|
131
|
+
- `HTM::Database.drop` left `node_relationships` behind (#38).
|
|
132
|
+
- `Database.info` skipped tables (#80).
|
|
133
|
+
- A failed connection left `SequelConfig` half set.
|
|
134
|
+
- **Robot groups and MCP**
|
|
135
|
+
- Group names over 56 characters broke every working memory notification (#89).
|
|
136
|
+
- Synced working memory entries were keyed by a string id and duplicated (#46).
|
|
137
|
+
- `failover!` printed into the MCP stdio stream (#87).
|
|
138
|
+
- The MCP server rejected databases configured outside the environment (#33).
|
|
139
|
+
- The MCP server crashed instead of printing a database error hint.
|
|
140
|
+
- `PropositionService` ignored the circuit breaker settings.
|
|
141
|
+
|
|
142
|
+
### Removed
|
|
143
|
+
- `htm_mcp` and `HTM::MCP::CLI`; use `htm`.
|
|
144
|
+
- Rake: the `Rakefile`, `lib/tasks/*.rake` and the Railtie's `rake_tasks`.
|
|
145
|
+
- The gem-shipped asgard tasks (`HTM.loki_dir`); host applications run `htm` instead.
|
|
146
|
+
- The `baran` dependency, tbls, and the Ollama provider.
|
|
147
|
+
|
|
148
|
+
## [0.0.32] - 2026-05-23
|
|
149
|
+
|
|
150
|
+
Covers 0.0.21 through 0.0.32, which were released without changelog entries.
|
|
151
|
+
|
|
10
152
|
### Added
|
|
11
|
-
- **`node_relationships` table**
|
|
12
|
-
- Stores
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
- Full validation: presence, allowed values, weight range, self-loop rejection, uniqueness
|
|
21
|
-
- **`HTM::Jobs::GenerateRelationshipsJob`** - Background job that computes and upserts Jaccard edges
|
|
22
|
-
- Chained automatically after `GenerateTagsJob` completes
|
|
23
|
-
- Single SQL query computes Jaccard similarity for all tag-sharing nodes at once
|
|
24
|
-
- Skips edges below `MIN_WEIGHT_THRESHOLD` (0.1); caps at `MAX_EDGES_PER_NODE` (50) per node
|
|
25
|
-
- Idempotent: `INSERT ... ON CONFLICT DO UPDATE` refreshes stale weights on re-run
|
|
26
|
-
- **Migrations** `00008_create_node_relationships` and `00009_fix_node_relationships_column_types`
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- **`sslmode` database configuration support** - SSL mode now extracted from URL and included when building URL
|
|
30
|
-
- `parse_database_url` extracts `sslmode` from URL query string (e.g., `?sslmode=require`)
|
|
31
|
-
- `build_database_url` includes `sslmode` as query parameter when set
|
|
32
|
-
- `reconcile_from_url` syncs `sslmode` along with other database components
|
|
33
|
-
- Default `sslmode` is `prefer` (from `defaults.yml`)
|
|
34
|
-
- **`htm:db:purge_all` rake task** - Permanently remove all soft-deleted records from database
|
|
35
|
-
- Displays record counts by table before deletion
|
|
36
|
-
- Detects and removes orphaned join table entries (`node_tags`, `robot_nodes`)
|
|
37
|
-
- Detects and removes orphaned propositions (where `source_node_id` no longer exists)
|
|
38
|
-
- Detects and removes orphaned robots (with no associated memory nodes)
|
|
39
|
-
- Requires confirmation before proceeding
|
|
40
|
-
- Deletes in correct order for referential integrity
|
|
41
|
-
- **`htm:jobs:process_propositions` rake task** - Incremental proposition extraction for unprocessed nodes
|
|
42
|
-
- Uses `ruby-progressbar` with ETA display
|
|
43
|
-
- Only processes nodes not yet extracted (tracks via `source_node_id` metadata)
|
|
44
|
-
- Added to `htm:jobs:process_all` task chain
|
|
45
|
-
- **Rake task passthrough in MCP CLI** - Run rake tasks via `htm_mcp rake <task>`
|
|
46
|
-
- `htm_mcp rake htm:db:stats` - Run any HTM rake task
|
|
47
|
-
- `htm_mcp rake -T` / `htm_mcp rake --tasks` - List available tasks
|
|
48
|
-
- **Pattern filtering** - `htm_mcp rake -T htm:jobs` filters to matching namespace (like standard rake)
|
|
49
|
-
- **Meta-response filtering in PropositionService** - Filters LLM responses that ask for input
|
|
50
|
-
- `META_RESPONSE_PATTERNS` constant with common patterns ("please provide", "I need the text", etc.)
|
|
51
|
-
- `meta_response?` method for detecting invalid responses
|
|
52
|
-
- Prevents storing "Please provide the text" as propositions
|
|
53
|
-
- **Progress bars for job processing tasks** - Visual progress with ETA for long-running operations
|
|
54
|
-
- `htm:jobs:process_embeddings` - Shows progress when generating embeddings
|
|
55
|
-
- `htm:jobs:process_tags` - Shows progress when extracting tags
|
|
56
|
-
- Format: `Processing: |████████████████| 50/100 (50%) ETA: 00:01:30`
|
|
153
|
+
- **`node_relationships` table** (migrations 00008, 00009) with `HTM::Models::NodeRelationship`.
|
|
154
|
+
- Stores weighted, directed edges between nodes that share tags (Jaccard similarity).
|
|
155
|
+
- `GenerateRelationshipsJob`, chained after `GenerateTagsJob`, upserts them. Edges under 0.1 are skipped, and each node keeps at most 50.
|
|
156
|
+
- **`sslmode`** is read from and written to database URLs (default `prefer`).
|
|
157
|
+
- **Rake tasks**:
|
|
158
|
+
- `htm:db:purge_all` removes soft-deleted and orphaned rows.
|
|
159
|
+
- `htm:jobs:process_propositions` extracts propositions for unprocessed nodes, with progress bars.
|
|
160
|
+
- `htm_mcp rake <task>` runs a task from the MCP CLI.
|
|
161
|
+
- **`PropositionService` ignores meta-responses** such as "please provide the text".
|
|
57
162
|
|
|
58
163
|
### Changed
|
|
59
|
-
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
- Ensures local development codebase is always used via `require_relative`
|
|
63
|
-
- Removed `$LOAD_PATH` manipulation that was previously needed for `require 'htm'`
|
|
64
|
-
- **Removed `:validate` rake task dependency** - Config validation now automatic
|
|
65
|
-
- `HTM::Config.new` handles all validation at require time (environment, URL/component reconciliation, naming convention)
|
|
66
|
-
- Rake tasks no longer need explicit validation step
|
|
67
|
-
- **Cleaned up Rakefile** - Removed unnecessary code
|
|
68
|
-
- Removed deprecated `db_setup` and `db_test` backward-compatibility tasks
|
|
69
|
-
- Removed redundant `task :test` block (`:set_test_env` prerequisite handles environment setup)
|
|
70
|
-
- **PropositionService validation now fully configurable** - Moved hardcoded constants to `defaults.yml`
|
|
71
|
-
- `proposition.min_length` (default: 10) - Minimum characters for valid proposition
|
|
72
|
-
- `proposition.max_length` (default: 1000) - Maximum characters for valid proposition
|
|
73
|
-
- `proposition.min_words` (default: 5) - Minimum words for valid proposition
|
|
74
|
-
- Added `min_length`, `max_length`, `min_words` class methods that read from config
|
|
75
|
-
- **Improved proposition extraction prompt** - Better quality propositions
|
|
76
|
-
- Added explicit BAD/GOOD examples for pronoun replacement
|
|
77
|
-
- Added context enrichment examples (e.g., "wiring" → "solar panel wiring for Oklahoma barndominium")
|
|
78
|
-
- System prompt now explicitly prevents meta-responses
|
|
79
|
-
- Increased specificity requirements for self-contained facts
|
|
164
|
+
- Proposition validation limits are configurable: `proposition.min_length`, `max_length` and `min_words`.
|
|
165
|
+
- Improved the proposition prompt: it replaces pronouns and adds context to each fact.
|
|
166
|
+
- Rake tasks load HTM once, and config validation runs at load time.
|
|
80
167
|
|
|
81
168
|
### Fixed
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
- **Duplicate rescue branches** - Merged redundant `rescue HTM::CircuitBreakerOpenError` + service-specific error rescues (both just `raise`) into single `rescue A, B` in `EmbeddingService`, `TagService`, and `PropositionService`
|
|
86
|
-
- **Duplicate `when "cosine"` branch in Node distance operator** - Removed branch whose body was identical to the `else` fallback (`"<=>"`), eliminating the `Lint/DuplicateBranch` offense
|
|
87
|
-
- **Identical conditional branches in `Tag.format_tree_branch`** - `branch = is_last ? '+-- ' : '+-- '` both sides were identical; simplified to a direct string literal
|
|
88
|
-
- **`EmptyElse` in `Observability#process_memory_mb`** - Removed redundant `else nil` branch from the platform detection conditional
|
|
169
|
+
- `token_counter` was never set on config load (a typo in the on-load hook).
|
|
170
|
+
- Tests could run against a non-test database; the test environment now always overrides `HTM_DATABASE__URL` and aborts unless the database name contains `_test`.
|
|
171
|
+
- Circuit breaker state leaked between tests, and so did the mock services after a configuration reset.
|
|
89
172
|
|
|
90
173
|
### Refactored
|
|
91
|
-
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
- `HybridSearch#merge_with_rrf` (65.7 → passing): extracted `merge_vector_rrf_entry`, `merge_fulltext_rrf_entry`, `merge_tag_rrf_entry`
|
|
95
|
-
- `RelevanceScorer#fetch_nodes_by_tags` (62.6 → passing): extracted `build_tag_base_query`, `apply_match_all_constraint`
|
|
96
|
-
- `MarkdownLoader#sync_chunks` (61.2 → passing): extracted `update_existing_chunk`, `soft_delete_removed_chunks`
|
|
97
|
-
- `HybridSearch#build_hybrid_cte_sql` (55.9 → passing): extracted per-CTE builder methods
|
|
98
|
-
- `Config::Database#build_database_url` (55.6 → passing): extracted `database_auth_segment`
|
|
99
|
-
- `MCP::GetWorkingMemoryTool#call` (56.0 → passing): extracted `format_working_memory_entry`
|
|
100
|
-
- `MarkdownLoader#load_file` (50.1 → passing): extracted `validate_file_path!`, `read_file_content`, `prepend_frontmatter_to_chunk`
|
|
101
|
-
- `Config#apply_provider_config` (77.4 → passing): replaced `case` statement with dynamic dispatch (`send(:"apply_#{provider}_provider_config", config)`)
|
|
102
|
-
- `RememberWorkflow#finalize_step` (50.7 → passing): extracted `finalize_node`, `evict_working_memory_if_needed`
|
|
103
|
-
- `HTM#remember`: extracted `validate_remember_content!`, `validate_remember_tags!`, `enqueue_background_jobs`, `handle_existing_node_tags`, `store_in_working_memory`
|
|
104
|
-
- **RuboCop: 128 offenses resolved** - Zero offenses across 89 files:
|
|
105
|
-
- Replaced all `[[x, min].max, max].min` patterns with `x.clamp(min, max)` in `tag_operations.rb`, `fulltext_search.rb`, `vector_search.rb`, `hybrid_search.rb`
|
|
106
|
-
- Broke all `end.sort_by {}` / `end.map {}` multiline block chains into two statements across `database.rb`, `hybrid_search.rb`, `relevance_scorer.rb`, `mcp/cli.rb`, `working_memory.rb`
|
|
107
|
-
- Updated `.rubocop.yml`: added `AllowedMethods` for bang methods (`soft_delete!`, `restore!`) and MCP DSL (`arguments` block), excluded `lib/tasks/**/*` from `BlockLength`, `MethodLength`, `FormatStringToken`, and `LineLength` cops
|
|
108
|
-
- Removed development dependencies from `htm.gemspec` in favour of `Gemfile` group blocks (enforced by `Gemspec/DevelopmentDependencies`)
|
|
109
|
-
|
|
110
|
-
- **Test database isolation** - Two-layer protection prevents tests from polluting development/production
|
|
111
|
-
- `Rakefile`: `set_test_env` task now ALWAYS overrides `HTM_DATABASE__URL` to test database
|
|
112
|
-
- Uses `#{service_name}_test` pattern (e.g., `htm_test`) based on `HTM_SERVICE__NAME` env var
|
|
113
|
-
- `test_helper.rb`: Safety check aborts with helpful message if database URL doesn't contain `_test`
|
|
114
|
-
- Prevents accidental test execution against non-test databases
|
|
174
|
+
- Every method scores under Flog's limit of 50.
|
|
175
|
+
- RuboCop reports no offenses (128 resolved).
|
|
176
|
+
- Development dependencies moved from the gemspec to the Gemfile.
|
|
115
177
|
|
|
116
178
|
## [0.0.20] - 2025-12-22
|
|
117
179
|
### Added
|
data/README.md
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
<div align="center">
|
|
3
3
|
<div style="background: linear-gradient(135deg, #90EE90 0%, #32CD32 100%); border: 4px solid #228B22; border-radius: 12px; padding: 20px; margin: 20px auto; max-width: 800px; box-shadow: 0 8px 16px rgba(34, 139, 34, 0.3);">
|
|
4
|
-
<p style="color: #
|
|
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
|
|
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": "
|
|
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 `
|
|
58
|
+
The `htm` executable starts the server and manages HTM from the command line:
|
|
61
59
|
|
|
62
60
|
```bash
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
htm mcp # Start the MCP server
|
|
62
|
+
htm db setup # Initialize database schema
|
|
63
|
+
htm db verify # Check the connection and pgvector
|
|
64
|
+
htm db stats # Show memory statistics
|
|
65
|
+
htm recall "how do we store embeddings" # Search memory
|
|
66
|
+
htm remember "We chose pgvector" -t database:postgresql
|
|
67
|
+
htm env # List the configuration environment variables
|
|
68
|
+
htm help # Every command (recall, remember, forget, wm, db, tags, ...)
|
|
68
69
|
```
|
|
69
70
|
|
|
71
|
+
See the [Command Line reference](https://madbomber.github.io/htm/guides/cli/) for every command.
|
|
72
|
+
|
|
70
73
|
Now your AI assistant can remember and recall across sessions:
|
|
71
74
|
- Store decisions, preferences, and context
|
|
72
75
|
- Search memories with natural language
|
|
@@ -146,12 +149,14 @@ For MCP integration, database setup, and configuration options, see the [full do
|
|
|
146
149
|
|
|
147
150
|
| Feature | Description |
|
|
148
151
|
|---------|-------------|
|
|
149
|
-
| **MCP Server** |
|
|
152
|
+
| **MCP Server** | 52 tools for AI assistant integration |
|
|
150
153
|
| **Hive Mind** | Shared memory across all robots |
|
|
151
154
|
| **Vector Search** | Semantic retrieval with pgvector |
|
|
152
155
|
| **Hybrid Search** | Combines vector + full-text matching |
|
|
153
156
|
| **Graph Traversal** | CTE-based relationship traversal via Jaccard-weighted edges |
|
|
154
|
-
| **Temporal Queries** | "last week", "yesterday", date ranges |
|
|
157
|
+
| **Temporal Queries** | "last week", "yesterday", date ranges, filtered by when events happened (or were recorded), plus `as_of` validity |
|
|
158
|
+
| **Memory Timelines** | `remember(supersedes:)` retires outdated facts; `timeline` and `recall(include_history:)` show how a memory changed |
|
|
159
|
+
| **Epistemic Status** | Each memory is stated, extracted, inferred or a hypothesis, with evidence and confidence; `confirm` and `first_mention` |
|
|
155
160
|
| **Auto-Tagging** | LLM extracts hierarchical tags automatically |
|
|
156
161
|
| **Auto-Relationships** | Tag co-occurrence edges computed after tagging |
|
|
157
162
|
| **Robot Groups** | High-availability with failover |
|
|
@@ -160,9 +165,9 @@ For MCP integration, database setup, and configuration options, see the [full do
|
|
|
160
165
|
|
|
161
166
|
## Requirements
|
|
162
167
|
|
|
163
|
-
- Ruby
|
|
168
|
+
- Ruby 4.0+
|
|
164
169
|
- PostgreSQL with pgvector and pg_trgm extensions
|
|
165
|
-
-
|
|
170
|
+
- [LM Studio](https://lmstudio.ai) (default, `:lms` provider) or any supported local or cloud provider for embeddings and classifications
|
|
166
171
|
|
|
167
172
|
## Documentation
|
|
168
173
|
|
|
@@ -170,7 +175,7 @@ For MCP integration, database setup, and configuration options, see the [full do
|
|
|
170
175
|
|
|
171
176
|
- [Installation & Setup](https://madbomber.github.io/htm/getting-started/)
|
|
172
177
|
- [MCP Server Guide](https://madbomber.github.io/htm/guides/mcp-server/)
|
|
173
|
-
- [Rails Integration](https://madbomber.github.io/htm/
|
|
178
|
+
- [Rails Integration](https://madbomber.github.io/htm/examples/rails-integration/)
|
|
174
179
|
- [API Reference](https://madbomber.github.io/htm/api/)
|
|
175
180
|
|
|
176
181
|
## Why "Robots" Instead of "Agents"?
|
data/SETUP.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
1. **Ruby** (version 3.0 or higher)
|
|
6
6
|
2. **PostgreSQL** (14+ with pgvector and pg_trgm extensions)
|
|
7
|
-
3. **
|
|
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
|
-
##
|
|
83
|
+
## LM Studio Setup
|
|
84
84
|
|
|
85
|
-
HTM uses RubyLLM with the
|
|
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
|
|
87
|
+
### 1. Install LM Studio
|
|
88
88
|
|
|
89
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
### 2. Start Ollama Service
|
|
91
|
+
### 2. Start the LM Studio Server
|
|
97
92
|
|
|
98
93
|
```bash
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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.
|
|
100
|
+
### 3. Download Required Models
|
|
105
101
|
|
|
106
102
|
```bash
|
|
107
|
-
#
|
|
108
|
-
|
|
103
|
+
# Embedding model (768 dimensions)
|
|
104
|
+
lms get nomic-embed-text-v1.5
|
|
109
105
|
|
|
110
|
-
#
|
|
111
|
-
|
|
106
|
+
# Chat model (for tag and proposition extraction)
|
|
107
|
+
lms get google/gemma-3-4b
|
|
112
108
|
|
|
113
109
|
# Verify models are available
|
|
114
|
-
|
|
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:
|
|
122
|
-
"
|
|
123
|
-
|
|
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
|
|
127
|
+
### Optional: Custom LM Studio URL
|
|
128
128
|
|
|
129
|
-
If
|
|
129
|
+
If LM Studio is running on a different host/port, set the environment variable:
|
|
130
130
|
|
|
131
131
|
```bash
|
|
132
|
-
export
|
|
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
|
-
| `
|
|
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
|
-
|
|
159
|
+
bundle exec bin/htm db setup
|
|
160
160
|
|
|
161
161
|
# 4. Run tests
|
|
162
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
###
|
|
223
|
+
### LM Studio Issues
|
|
222
224
|
|
|
223
225
|
If you encounter embedding errors:
|
|
224
226
|
|
|
225
227
|
```bash
|
|
226
|
-
# Verify
|
|
227
|
-
curl http://localhost:
|
|
228
|
+
# Verify the LM Studio server is running
|
|
229
|
+
curl http://localhost:1234/v1/models
|
|
228
230
|
|
|
229
|
-
# Check if models are
|
|
230
|
-
|
|
231
|
+
# Check if models are downloaded
|
|
232
|
+
lms ls
|
|
231
233
|
|
|
232
234
|
# Test embedding generation
|
|
233
|
-
curl http://localhost:
|
|
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
|
-
#
|
|
236
|
-
|
|
238
|
+
# Stream LM Studio server logs
|
|
239
|
+
lms log stream
|
|
237
240
|
```
|
|
238
241
|
|
|
239
|
-
**Common
|
|
242
|
+
**Common LM Studio Errors:**
|
|
240
243
|
|
|
241
|
-
- **"connection refused"**:
|
|
242
|
-
- **"model not found"**: Run `
|
|
243
|
-
- **Custom URL not working**: Ensure `
|
|
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
|
-
- **
|
|
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 `
|
|
299
|
-
4. Check
|
|
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)
|