htm 0.0.31 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +16 -17
- data/.reek.yml +104 -0
- data/.rubocop.yml +173 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +162 -54
- data/README.md +24 -17
- data/SETUP.md +49 -46
- data/_typos.toml +17 -0
- data/bin/htm +18 -0
- data/db/migrate/00008_create_node_relationships.rb +54 -0
- data/db/migrate/00009_fix_node_relationships_column_types.rb +17 -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 +361 -7
- data/db/seed_data/README.md +11 -11
- data/db/seeds.rb +11 -11
- data/docs/api/database.md +43 -65
- data/docs/api/embedding-service.md +139 -263
- data/docs/api/htm.md +128 -12
- data/docs/api/index.md +34 -23
- data/docs/api/long-term-memory.md +8 -19
- data/docs/api/working-memory.md +42 -54
- 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 +7 -9
- data/docs/architecture/overview.md +8 -11
- data/docs/assets/images/htm-architecture-overview.svg +1 -1
- data/docs/assets/images/htm-context-assembly-flow.svg +2 -2
- data/docs/assets/images/htm-layered-architecture.svg +3 -3
- data/docs/assets/images/project-structure.svg +2 -2
- data/docs/assets/images/two-tier-memory-architecture.svg +1 -1
- data/docs/database/INDEX.md +113 -0
- data/docs/database/README.md +60 -175
- 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 +11 -11
- data/docs/development/index.md +19 -24
- data/docs/development/schema.md +113 -14
- data/docs/development/setup.md +99 -151
- data/docs/development/testing.md +58 -66
- data/docs/examples/basic-usage.md +9 -9
- data/docs/examples/config-files.md +8 -8
- data/docs/examples/file-loading.md +16 -16
- 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 +28 -26
- data/docs/guides/adding-memories.md +28 -4
- data/docs/guides/cli.md +458 -0
- data/docs/guides/configuration.md +77 -42
- data/docs/guides/context-assembly.md +4 -4
- data/docs/guides/epistemic-status.md +138 -0
- data/docs/guides/event-time.md +106 -0
- data/docs/guides/file-loading.md +36 -32
- data/docs/guides/getting-started.md +23 -19
- data/docs/guides/long-term-memory.md +8 -28
- data/docs/guides/mcp-server.md +416 -173
- data/docs/guides/propositions.md +30 -40
- data/docs/guides/recalling-memories.md +27 -12
- data/docs/guides/robot-teams.md +96 -0
- data/docs/guides/search-strategies.md +10 -7
- data/docs/guides/tags.md +37 -32
- 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 +14 -14
- data/docs/robots/hive-mind.md +1 -1
- data/docs/robots/multi-robot.md +2 -2
- data/docs/robots/robot-groups.md +10 -10
- data/docs/robots/two-tier-memory.md +85 -120
- data/docs/setup_local_database.md +41 -85
- data/examples/00_create_examples_db.rb +20 -7
- data/examples/01_basic_usage.rb +21 -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 +13 -12
- data/examples/04_file_loader_usage.rb +16 -21
- data/examples/05_timeframe_demo.rb +283 -234
- data/examples/06_example_app/.loki +36 -0
- data/examples/06_example_app/app.rb +22 -33
- data/examples/07_cli_app/README.md +18 -18
- data/examples/07_cli_app/htm_cli.rb +26 -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 +93 -119
- data/examples/10_telemetry/README.md +3 -3
- data/examples/10_telemetry/SETUP_README.md +2 -2
- data/examples/10_telemetry/demo.rb +6 -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 +6 -4
- data/examples/11_robot_groups/same_process.rb +19 -17
- data/examples/12_rails_app/.envrc +12 -0
- data/examples/12_rails_app/Gemfile +8 -3
- data/examples/12_rails_app/Gemfile.lock +226 -172
- data/examples/12_rails_app/README.md +77 -22
- data/examples/12_rails_app/app/controllers/application_controller.rb +6 -0
- data/examples/12_rails_app/app/controllers/chats_controller.rb +275 -0
- data/examples/12_rails_app/app/controllers/dashboard_controller.rb +3 -0
- data/examples/12_rails_app/app/controllers/files_controller.rb +17 -2
- data/examples/12_rails_app/app/controllers/home_controller.rb +8 -0
- data/examples/12_rails_app/app/controllers/memories_controller.rb +16 -5
- data/examples/12_rails_app/app/controllers/messages_controller.rb +177 -0
- data/examples/12_rails_app/app/controllers/robots_controller.rb +11 -1
- data/examples/12_rails_app/app/controllers/search_controller.rb +7 -2
- data/examples/12_rails_app/app/controllers/tags_controller.rb +14 -1
- data/examples/12_rails_app/app/javascript/application.js +1 -1
- data/examples/12_rails_app/app/models/application_record.rb +5 -0
- data/examples/12_rails_app/app/models/chat.rb +3 -0
- data/examples/12_rails_app/app/models/message.rb +3 -0
- data/examples/12_rails_app/app/views/chats/index.html.erb +61 -0
- data/examples/12_rails_app/app/views/chats/show.html.erb +213 -0
- data/examples/12_rails_app/app/views/dashboard/index.html.erb +3 -0
- data/examples/12_rails_app/app/views/files/index.html.erb +10 -5
- data/examples/12_rails_app/app/views/files/new.html.erb +5 -3
- data/examples/12_rails_app/app/views/files/show.html.erb +19 -3
- data/examples/12_rails_app/app/views/home/index.html.erb +45 -0
- data/examples/12_rails_app/app/views/layouts/application.html.erb +20 -18
- data/examples/12_rails_app/app/views/memories/_memory_card.html.erb +2 -2
- data/examples/12_rails_app/app/views/memories/deleted.html.erb +3 -1
- data/examples/12_rails_app/app/views/memories/edit.html.erb +2 -0
- data/examples/12_rails_app/app/views/memories/index.html.erb +2 -0
- data/examples/12_rails_app/app/views/memories/new.html.erb +14 -0
- data/examples/12_rails_app/app/views/memories/show.html.erb +17 -2
- data/examples/12_rails_app/app/views/messages/_message.html.erb +20 -0
- data/examples/12_rails_app/app/views/robots/index.html.erb +2 -0
- data/examples/12_rails_app/app/views/robots/new.html.erb +2 -0
- data/examples/12_rails_app/app/views/robots/show.html.erb +2 -0
- data/examples/12_rails_app/app/views/search/index.html.erb +77 -10
- data/examples/12_rails_app/app/views/shared/_navbar.html.erb +75 -29
- data/examples/12_rails_app/app/views/tags/index.html.erb +2 -0
- data/examples/12_rails_app/app/views/tags/show.html.erb +3 -1
- data/examples/12_rails_app/config/application.rb +1 -1
- data/examples/12_rails_app/config/database.yml +9 -5
- data/examples/12_rails_app/config/importmap.rb +1 -1
- data/examples/12_rails_app/config/initializers/htm.rb +9 -2
- data/examples/12_rails_app/config/initializers/ruby_llm.rb +29 -0
- data/examples/12_rails_app/config/routes.rb +39 -23
- 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 +210 -0
- data/examples/README.md +53 -44
- data/examples/examples_helper.rb +52 -3
- 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 -69
- 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 +106 -75
- data/lib/htm/config/coercion.rb +91 -0
- data/lib/htm/config/database.rb +94 -71
- 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 +47 -34
- data/lib/htm/config.rb +122 -296
- data/lib/htm/database.rb +330 -427
- data/lib/htm/database_docs.rb +149 -0
- data/lib/htm/embedding_service.rb +29 -74
- 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 +45 -33
- data/lib/htm/job_adapter.rb +79 -91
- data/lib/htm/jobs/failure_logging.rb +49 -0
- data/lib/htm/jobs/generate_embedding_job.rb +28 -51
- data/lib/htm/jobs/generate_propositions_job.rb +59 -57
- data/lib/htm/jobs/generate_relationships_job.rb +141 -0
- data/lib/htm/jobs/generate_tags_job.rb +44 -71
- 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 +99 -190
- data/lib/htm/long_term_memory/fulltext_search.rb +16 -37
- data/lib/htm/long_term_memory/hybrid_search.rb +484 -385
- data/lib/htm/long_term_memory/node_operations.rb +111 -82
- data/lib/htm/long_term_memory/relevance_scorer.rb +254 -227
- data/lib/htm/long_term_memory/tag_operations.rb +225 -187
- data/lib/htm/long_term_memory/vector_search.rb +34 -62
- data/lib/htm/long_term_memory.rb +5 -16
- 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 -15
- 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 +230 -287
- data/lib/htm/migration.rb +10 -10
- data/lib/htm/models/file_source.rb +35 -20
- data/lib/htm/models/node.rb +288 -195
- data/lib/htm/models/node_link.rb +97 -0
- data/lib/htm/models/node_relationship.rb +73 -0
- data/lib/htm/models/node_tag.rb +24 -4
- data/lib/htm/models/robot.rb +4 -8
- data/lib/htm/models/robot_node.rb +7 -4
- data/lib/htm/models/tag.rb +54 -195
- data/lib/htm/node_enrichment.rb +75 -0
- data/lib/htm/node_view.rb +295 -0
- data/lib/htm/observability.rb +125 -115
- data/lib/htm/proposition_service.rb +41 -81
- data/lib/htm/query_cache.rb +148 -96
- data/lib/htm/railtie.rb +4 -9
- 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 +130 -523
- 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 +96 -59
- data/lib/htm/sql_builder.rb +162 -53
- data/lib/htm/startup_prompt.rb +73 -0
- data/lib/htm/tag_service.rb +105 -114
- data/lib/htm/tag_tree.rb +206 -0
- data/lib/htm/telemetry.rb +15 -16
- data/lib/htm/timeframe.rb +30 -13
- data/lib/htm/timeframe_extractor.rb +104 -123
- data/lib/htm/timeline.rb +230 -0
- data/lib/htm/version.rb +1 -1
- data/lib/htm/workflows/remember_workflow.rb +147 -141
- data/lib/htm/working_memory/entry.rb +53 -0
- data/lib/htm/working_memory/store.rb +97 -0
- data/lib/htm/working_memory.rb +135 -142
- data/lib/htm/working_memory_channel.rb +90 -40
- data/lib/htm.rb +185 -522
- data/mkdocs.yml +100 -23
- data/scripts/install_local_database.sh +7 -6
- metadata +1032 -669
- data/.tbls.yml +0 -31
- data/Rakefile +0 -159
- 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 -353
- 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/lib/htm/mcp/cli.rb +0 -582
- data/lib/htm/tasks.rb +0 -79
- data/lib/tasks/db.rake +0 -17
- data/lib/tasks/doc.rake +0 -300
- data/lib/tasks/files.rake +0 -292
- data/lib/tasks/htm.rake +0 -704
- data/lib/tasks/jobs.rake +0 -435
- data/lib/tasks/tags.rake +0 -189
- data/scripts/backfill_parent_tags.rb +0 -376
- data/scripts/normalize_plural_tags.rb +0 -335
data/docs/guides/mcp-server.md
CHANGED
|
@@ -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/
|
|
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
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
16
|
-
- **
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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 `
|
|
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
|
-
|
|
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
|
-
##
|
|
69
|
+
## Managing HTM from the Command Line
|
|
59
70
|
|
|
60
|
-
The `
|
|
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
|
-
| `
|
|
65
|
-
| `
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
70
|
-
| `
|
|
71
|
-
| `
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
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
|
-
#
|
|
83
|
-
|
|
92
|
+
# Create and initialize the database
|
|
93
|
+
htm db create
|
|
94
|
+
htm db setup
|
|
84
95
|
|
|
85
96
|
# Verify everything is working
|
|
86
|
-
|
|
97
|
+
htm db verify
|
|
87
98
|
|
|
88
99
|
# Check memory statistics
|
|
89
|
-
|
|
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
|
-
###
|
|
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
|
-
###
|
|
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
|
-
###
|
|
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
|
-
###
|
|
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
|
-
###
|
|
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
|
|
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
|
-
###
|
|
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
|
-
###
|
|
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
|
-
###
|
|
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
|
-
###
|
|
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
|
-
###
|
|
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
|
-
###
|
|
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
|
-
###
|
|
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
|
-
###
|
|
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
|
-
###
|
|
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
|
-
###
|
|
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
|
-
###
|
|
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
|
-
###
|
|
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
|
-
###
|
|
809
|
+
### group_recall
|
|
614
810
|
|
|
615
|
-
Recall memories
|
|
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
|
-
###
|
|
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
|
-
###
|
|
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
|
-
###
|
|
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
|
-
###
|
|
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
|
-
###
|
|
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": "
|
|
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": "
|
|
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 `
|
|
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/
|
|
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": "
|
|
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:
|
|
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:
|
|
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 `
|
|
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 `
|
|
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 `
|
|
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: `
|
|
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 `
|
|
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
|
|
1067
|
-
1. Start
|
|
1068
|
-
2.
|
|
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
|
-
|
|
1071
|
-
|
|
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
|
-
|
|
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 `
|
|
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
|
-
| `
|
|
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
|
|
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
|
-
| `
|
|
1117
|
-
| `
|
|
1118
|
-
| `
|
|
1119
|
-
| `
|
|
1120
|
-
| `
|
|
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
|
-
| `
|
|
1127
|
-
| `
|
|
1128
|
-
| `
|
|
1129
|
-
| `
|
|
1130
|
-
| `
|
|
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
|