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
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Module HTM::Admin::DatabaseCommands <a id="module-HTM-Admin-DatabaseCommands"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Defined in** | lib/htm/admin/database_commands.rb |
|
|
6
|
+
|
|
7
|
+
The `htm db ...` commands that are more than one HTM::Database call
|
|
8
|
+
|
|
9
|
+
## Constants
|
|
10
|
+
### `DROP_PROMPT` <a id="constant-DROP_PROMPT"></a> <a id="DROP_PROMPT-constant"></a>
|
|
11
|
+
Not documented.
|
|
12
|
+
|
|
13
|
+
### `ORPHANED_ROWS` <a id="constant-ORPHANED_ROWS"></a> <a id="ORPHANED_ROWS-constant"></a>
|
|
14
|
+
Labels, purge_counts keys and notes of the orphaned rows purge_all reports
|
|
15
|
+
|
|
16
|
+
### `SOFT_DELETED_ROWS` <a id="constant-SOFT_DELETED_ROWS"></a> <a id="SOFT_DELETED_ROWS-constant"></a>
|
|
17
|
+
Labels, purge_counts keys and notes of the soft-deleted rows purge_all reports
|
|
18
|
+
|
|
19
|
+
## Public Class Methods
|
|
20
|
+
### `console_command(config = HTM::SequelConfig.load_database_config)` <a id="method-c-console_command"></a> <a id="console_command-class_method"></a>
|
|
21
|
+
- **`@return`** [Array<String>] the psql command line for the configured database
|
|
22
|
+
|
|
23
|
+
### `count_line(label, count, width, gap: 2)` <a id="method-c-count_line"></a> <a id="count_line-class_method"></a>
|
|
24
|
+
- **`@return`** [String] +label+ padded to +width+ and +count+ right-aligned in 8 columns
|
|
25
|
+
|
|
26
|
+
### `create(config = HTM::SequelConfig.load_database_config, out: $stdout)` <a id="method-c-create"></a> <a id="create-class_method"></a>
|
|
27
|
+
Create the configured database (with pgvector and pg_trgm) unless it exists
|
|
28
|
+
- **`@raise`** [HTM::Admin::Error] when PostgreSQL refuses
|
|
29
|
+
- **`@return`** [Symbol] :created or :exists
|
|
30
|
+
|
|
31
|
+
### `create_database(config)` <a id="method-c-create_database"></a> <a id="create_database-class_method"></a>
|
|
32
|
+
Create the configured database unless the server already has it
|
|
33
|
+
- **`@param`** `config` [Hash] HTM::SequelConfig.load_database_config
|
|
34
|
+
- **`@return`** [Boolean] true when created, false when it already existed
|
|
35
|
+
|
|
36
|
+
### `database_exists?(conn, name)` <a id="method-c-database_exists-3F"></a> <a id="database_exists?-class_method"></a>
|
|
37
|
+
- **`@return`** [Boolean] whether the server behind +conn+ has database +name+
|
|
38
|
+
|
|
39
|
+
### `drop(confirm: nil)` <a id="method-c-drop"></a> <a id="drop-class_method"></a>
|
|
40
|
+
Drop all HTM tables, asking first unless `confirm`
|
|
41
|
+
- **`@return`** [Symbol, nil] :dropped, nil when cancelled
|
|
42
|
+
|
|
43
|
+
### `enable_extensions(config, extensions: %w[vector pg_trgm]))` <a id="method-c-enable_extensions"></a> <a id="enable_extensions-class_method"></a>
|
|
44
|
+
Enable the extensions HTM needs in the configured database
|
|
45
|
+
|
|
46
|
+
### `extract_all_propositions(sources, robot, out)` <a id="method-c-extract_all_propositions"></a> <a id="extract_all_propositions-class_method"></a>
|
|
47
|
+
Extract propositions for every node of `sources` under a progress bar
|
|
48
|
+
- **`@return`** [Hash] { ok:, failed:, created: }
|
|
49
|
+
|
|
50
|
+
### `orphaned_links(model)` <a id="method-c-orphaned_links"></a> <a id="orphaned_links-class_method"></a>
|
|
51
|
+
- **`@return`** [Sequel::Dataset] rows of +model+ (node_tags, robot_nodes) pointing to missing nodes
|
|
52
|
+
|
|
53
|
+
### `orphaned_propositions()` <a id="method-c-orphaned_propositions"></a> <a id="orphaned_propositions-class_method"></a>
|
|
54
|
+
Proposition nodes (active or soft-deleted) with no derived_from link: their
|
|
55
|
+
source node was purged, which cascades away the link
|
|
56
|
+
- **`@return`** [Sequel::Dataset]
|
|
57
|
+
|
|
58
|
+
### `orphaned_robots()` <a id="method-c-orphaned_robots"></a> <a id="orphaned_robots-class_method"></a>
|
|
59
|
+
- **`@return`** [Sequel::Dataset] robots with no memory nodes
|
|
60
|
+
|
|
61
|
+
### `pg_connect(config, dbname: config[:database])` <a id="method-c-pg_connect"></a> <a id="pg_connect-class_method"></a>
|
|
62
|
+
Open a PG connection from an HTM database config
|
|
63
|
+
- **`@param`** `config` [Hash] HTM::SequelConfig.load_database_config
|
|
64
|
+
- **`@param`** `dbname` [String] Database to connect to
|
|
65
|
+
- **`@return`** [PG::Connection]
|
|
66
|
+
|
|
67
|
+
### `pgvector_version(conn)` <a id="method-c-pgvector_version"></a> <a id="pgvector_version-class_method"></a>
|
|
68
|
+
- **`@return`** [String, nil] the installed pgvector version, nil when absent
|
|
69
|
+
|
|
70
|
+
### `print_purge_counts(counts, out)` <a id="method-c-print_purge_counts"></a> <a id="print_purge_counts-class_method"></a>
|
|
71
|
+
Not documented.
|
|
72
|
+
|
|
73
|
+
### `print_purge_rows(specs, counts, out)` <a id="method-c-print_purge_rows"></a> <a id="print_purge_rows-class_method"></a>
|
|
74
|
+
Print one line per [label, key, note] of `specs` with its count from `counts`
|
|
75
|
+
|
|
76
|
+
### `print_purged(purged, out)` <a id="method-c-print_purged"></a> <a id="print_purged-class_method"></a>
|
|
77
|
+
Not documented.
|
|
78
|
+
|
|
79
|
+
### `print_ranking(title, rows, out)` <a id="method-c-print_ranking"></a> <a id="print_ranking-class_method"></a>
|
|
80
|
+
Not documented.
|
|
81
|
+
|
|
82
|
+
### `print_table_counts(rows, out)` <a id="method-c-print_table_counts"></a> <a id="print_table_counts-class_method"></a>
|
|
83
|
+
Not documented.
|
|
84
|
+
|
|
85
|
+
### `purge!()` <a id="method-c-purge-21"></a> <a id="purge!-class_method"></a>
|
|
86
|
+
Permanently delete soft-deleted and orphaned records, children first
|
|
87
|
+
- **`@return`** [Hash{Symbol => Integer}] rows deleted per kind
|
|
88
|
+
|
|
89
|
+
### `purge_all()` <a id="method-c-purge_all"></a> <a id="purge_all-class_method"></a>
|
|
90
|
+
Report what would be purged, ask, then purge (see Console#purge_all)
|
|
91
|
+
|
|
92
|
+
### `purge_counts()` <a id="method-c-purge_counts"></a> <a id="purge_counts-class_method"></a>
|
|
93
|
+
What purge_all would delete
|
|
94
|
+
- **`@return`** [Hash{Symbol => Integer}]
|
|
95
|
+
|
|
96
|
+
### `rebuild_embeddings()` <a id="method-c-rebuild_embeddings"></a> <a id="rebuild_embeddings-class_method"></a>
|
|
97
|
+
Clear every embedding and regenerate them all, after confirmation (see
|
|
98
|
+
Console#rebuild_embeddings)
|
|
99
|
+
|
|
100
|
+
### `rebuild_propositions()` <a id="method-c-rebuild_propositions"></a> <a id="rebuild_propositions-class_method"></a>
|
|
101
|
+
Delete every proposition node and extract them all again, after confirmation
|
|
102
|
+
(see Console#rebuild_propositions)
|
|
103
|
+
|
|
104
|
+
### `reset(confirm: nil)` <a id="method-c-reset"></a> <a id="reset-class_method"></a>
|
|
105
|
+
Drop all HTM tables and set the schema up again, asking first unless `confirm`
|
|
106
|
+
- **`@return`** [Symbol, nil] :reset, nil when cancelled
|
|
107
|
+
|
|
108
|
+
### `robot_label(id)` <a id="method-c-robot_label"></a> <a id="robot_label-class_method"></a>
|
|
109
|
+
- **`@return`** [String] the name of robot +id+, or "Unknown (id)" when it is gone
|
|
110
|
+
|
|
111
|
+
### `stats(out: $stdout)` <a id="method-c-stats"></a> <a id="stats-class_method"></a>
|
|
112
|
+
Print record counts for every HTM table, top robots and top root tags
|
|
113
|
+
|
|
114
|
+
### `table_counts()` <a id="method-c-table_counts"></a> <a id="table_counts-class_method"></a>
|
|
115
|
+
Row counts per HTM table, with a note for nodes
|
|
116
|
+
- **`@return`** [Array<Array(String, Integer, String)>] [table, count, note]
|
|
117
|
+
|
|
118
|
+
### `top_robots(limit = 5)` <a id="method-c-top_robots"></a> <a id="top_robots-class_method"></a>
|
|
119
|
+
- **`@return`** [Array<Array(String, Integer)>] robots with the most active nodes
|
|
120
|
+
|
|
121
|
+
### `top_root_tags(limit = 5)` <a id="method-c-top_root_tags"></a> <a id="top_root_tags-class_method"></a>
|
|
122
|
+
- **`@return`** [Array<Array(String, Integer)>] root tag names with the most tags under them
|
|
123
|
+
|
|
124
|
+
### `verify(config = HTM::SequelConfig.load_database_config, out: $stdout)` <a id="method-c-verify"></a> <a id="verify-class_method"></a>
|
|
125
|
+
Connect to the configured database and report pgvector
|
|
126
|
+
- **`@raise`** [HTM::Admin::Error] when the connection fails
|
|
127
|
+
- **`@return`** [true]
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Module HTM::Admin::EnrichCommands <a id="module-HTM-Admin-EnrichCommands"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Defined in** | lib/htm/admin/enrich_commands.rb |
|
|
6
|
+
|
|
7
|
+
The `htm enrich ...` commands: catch up on, inspect and redo the work HTM's
|
|
8
|
+
background jobs do for each node (embeddings, tags, propositions).
|
|
9
|
+
|
|
10
|
+
## Constants
|
|
11
|
+
### `ONTOLOGY_SIZE` <a id="constant-ONTOLOGY_SIZE"></a> <a id="ONTOLOGY_SIZE-constant"></a>
|
|
12
|
+
Existing tags offered to the tag extractor as ontology context
|
|
13
|
+
|
|
14
|
+
### `STALE_AFTER` <a id="constant-STALE_AFTER"></a> <a id="STALE_AFTER-constant"></a>
|
|
15
|
+
Nodes older than this without an embedding or tags count as failed
|
|
16
|
+
|
|
17
|
+
## Public Class Methods
|
|
18
|
+
### `clear_all(input: $stdin, out: $stdout)` <a id="method-c-clear_all"></a> <a id="clear_all-class_method"></a>
|
|
19
|
+
Clear every embedding and tag, after confirmation
|
|
20
|
+
- **`@return`** [Boolean, nil] true once cleared, nil when cancelled
|
|
21
|
+
|
|
22
|
+
### `coverage_shares(total, with_embeddings, with_tags)` <a id="method-c-coverage_shares"></a> <a id="coverage_shares-class_method"></a>
|
|
23
|
+
- **`@return`** [Hash{String => Integer}] node counts with and without embeddings and tags, by label
|
|
24
|
+
|
|
25
|
+
### `failed(out: $stdout, now: Time.now)` <a id="method-c-failed"></a> <a id="failed-class_method"></a>
|
|
26
|
+
Print nodes older than STALE_AFTER still missing an embedding or tags
|
|
27
|
+
|
|
28
|
+
### `nodes_without_embeddings()` <a id="method-c-nodes_without_embeddings"></a> <a id="nodes_without_embeddings-class_method"></a>
|
|
29
|
+
- **`@return`** [Sequel::Dataset] active nodes with no embedding
|
|
30
|
+
|
|
31
|
+
### `nodes_without_propositions(processed_ids = proposition_source_ids)` <a id="method-c-nodes_without_propositions"></a> <a id="nodes_without_propositions-class_method"></a>
|
|
32
|
+
- **`@return`** [Sequel::Dataset] non-proposition nodes no proposition points back to
|
|
33
|
+
|
|
34
|
+
### `nodes_without_tags()` <a id="method-c-nodes_without_tags"></a> <a id="nodes_without_tags-class_method"></a>
|
|
35
|
+
- **`@return`** [Sequel::Dataset] active nodes with no active tag link
|
|
36
|
+
|
|
37
|
+
### `none_pending(out, what)` <a id="method-c-none_pending"></a> <a id="none_pending-class_method"></a>
|
|
38
|
+
Not documented.
|
|
39
|
+
|
|
40
|
+
### `prepare!()` <a id="method-c-prepare-21"></a> <a id="prepare!-class_method"></a>
|
|
41
|
+
Not documented.
|
|
42
|
+
|
|
43
|
+
### `print_share(out, label, part, whole)` <a id="method-c-print_share"></a> <a id="print_share-class_method"></a>
|
|
44
|
+
Not documented.
|
|
45
|
+
|
|
46
|
+
### `print_stale(dataset, missing, out, now)` <a id="method-c-print_stale"></a> <a id="print_stale-class_method"></a>
|
|
47
|
+
Not documented.
|
|
48
|
+
|
|
49
|
+
### `print_tag_breakdown(names, nodes_with_tags, out)` <a id="method-c-print_tag_breakdown"></a> <a id="print_tag_breakdown-class_method"></a>
|
|
50
|
+
Not documented.
|
|
51
|
+
|
|
52
|
+
### `process(dataset, title, what, out)` <a id="method-c-process"></a> <a id="process-class_method"></a>
|
|
53
|
+
Run the block over `dataset` under a progress bar and report the counts
|
|
54
|
+
|
|
55
|
+
### `process_all(out: $stdout)` <a id="method-c-process_all"></a> <a id="process_all-class_method"></a>
|
|
56
|
+
Run every process_* command in turn
|
|
57
|
+
|
|
58
|
+
### `process_embeddings(out: $stdout)` <a id="method-c-process_embeddings"></a> <a id="process_embeddings-class_method"></a>
|
|
59
|
+
Generate embeddings for nodes that have none
|
|
60
|
+
- **`@return`** [Hash, nil] { ok:, failed: }, nil when nothing was pending
|
|
61
|
+
|
|
62
|
+
### `process_propositions(out: $stdout)` <a id="method-c-process_propositions"></a> <a id="process_propositions-class_method"></a>
|
|
63
|
+
Extract propositions for nodes not yet processed
|
|
64
|
+
- **`@return`** [Hash, nil] { ok:, failed:, created: }, nil when nothing was pending
|
|
65
|
+
|
|
66
|
+
### `process_tags(out: $stdout)` <a id="method-c-process_tags"></a> <a id="process_tags-class_method"></a>
|
|
67
|
+
Extract tags for nodes that have none
|
|
68
|
+
- **`@return`** [Hash, nil] { ok:, failed: }, nil when nothing was pending
|
|
69
|
+
|
|
70
|
+
### `proposition_source_ids()` <a id="method-c-proposition_source_ids"></a> <a id="proposition_source_ids-class_method"></a>
|
|
71
|
+
- **`@return`** [Array<Integer>] ids of nodes that already have proposition nodes
|
|
72
|
+
|
|
73
|
+
### `reprocess_embeddings(input: $stdin, out: $stdout)` <a id="method-c-reprocess_embeddings"></a> <a id="reprocess_embeddings-class_method"></a>
|
|
74
|
+
Regenerate the embedding of every node, after confirmation
|
|
75
|
+
- **`@return`** [Hash, nil] { ok:, failed: }, nil when cancelled or there are no nodes
|
|
76
|
+
|
|
77
|
+
### `stats(out: $stdout)` <a id="method-c-stats"></a> <a id="stats-class_method"></a>
|
|
78
|
+
Print node and tag coverage
|
|
79
|
+
|
|
80
|
+
### `tag!(node)` <a id="method-c-tag-21"></a> <a id="tag!-class_method"></a>
|
|
81
|
+
Extract tags for `node` (with recent tags as ontology context), link them, and
|
|
82
|
+
rebuild the node's tag co-occurrence links as GenerateTagsJob does
|
|
83
|
+
|
|
84
|
+
### `tag_depth_counts(names)` <a id="method-c-tag_depth_counts"></a> <a id="tag_depth_counts-class_method"></a>
|
|
85
|
+
- **`@return`** [Hash{Integer => Integer}] tag count per depth (colons in the name), by depth
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Class HTM::Admin::Error <a id="class-HTM-Admin-Error"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | HTM::Error |
|
|
6
|
+
| **Defined in** | lib/htm/admin.rb |
|
|
7
|
+
|
|
8
|
+
A command that cannot proceed (a missing file, an unknown path). The task
|
|
9
|
+
reports the message and exits non-zero.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Class HTM::Admin::FileCommands::Console <a id="class-HTM-Admin-FileCommands-Console"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | Admin::Console |
|
|
6
|
+
| **Defined in** | lib/htm/admin/file_commands.rb |
|
|
7
|
+
|
|
8
|
+
The `htm files ...` commands, reporting to `out` and loading through `memory`
|
|
9
|
+
(an HTM; the FileLoader robot when nil)
|
|
10
|
+
|
|
11
|
+
**`@example`**
|
|
12
|
+
```ruby
|
|
13
|
+
HTM::Admin::FileCommands::Console.new(out: StringIO.new, memory: htm).load("docs/guide.md")
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Public Instance Methods
|
|
17
|
+
### `info(path)` <a id="method-i-info"></a> <a id="info-instance_method"></a>
|
|
18
|
+
Print the details of one loaded file
|
|
19
|
+
- **`@raise`** [HTM::Admin::Error] when +path+ was never loaded
|
|
20
|
+
- **`@return`** [HTM::Models::FileSource]
|
|
21
|
+
|
|
22
|
+
### `initialize(memory: nil)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
|
|
23
|
+
- **`@param`** `memory` [HTM, nil]
|
|
24
|
+
- **`@return`** [Console] a new instance of Console
|
|
25
|
+
|
|
26
|
+
### `list()` <a id="method-i-list"></a> <a id="list-instance_method"></a>
|
|
27
|
+
Print every loaded file source
|
|
28
|
+
- **`@return`** [Integer] how many there are
|
|
29
|
+
|
|
30
|
+
### `load(path, force: nil)` <a id="method-i-load"></a> <a id="load-instance_method"></a>
|
|
31
|
+
Load one markdown file
|
|
32
|
+
- **`@raise`** [HTM::Admin::Error] when +path+ is not a file
|
|
33
|
+
- **`@return`** [Hash] HTM#load_file's result
|
|
34
|
+
|
|
35
|
+
### `load_dir(path, pattern: '**/*.md', force: nil)` <a id="method-i-load_dir"></a> <a id="load_dir-instance_method"></a>
|
|
36
|
+
Load every file matching `pattern` under `path`
|
|
37
|
+
- **`@raise`** [HTM::Admin::Error] when +path+ is not a directory
|
|
38
|
+
- **`@return`** [Array<Hash>] HTM#load_directory's results
|
|
39
|
+
|
|
40
|
+
### `stats()` <a id="method-i-stats"></a> <a id="stats-instance_method"></a>
|
|
41
|
+
Print totals over every loaded file
|
|
42
|
+
- **`@return`** [Hash] { files:, chunks:, needs_sync:, missing: }
|
|
43
|
+
|
|
44
|
+
### `sync()` <a id="method-i-sync"></a> <a id="sync-instance_method"></a>
|
|
45
|
+
Reload every loaded file that changed on disk
|
|
46
|
+
- **`@return`** [Hash] { synced:, skipped:, missing: }
|
|
47
|
+
|
|
48
|
+
### `unload(path)` <a id="method-i-unload"></a> <a id="unload-instance_method"></a>
|
|
49
|
+
Soft delete the chunks loaded from `path`
|
|
50
|
+
- **`@return`** [Integer] chunks unloaded (0 when +path+ was never loaded)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Module HTM::Admin::FileCommands <a id="module-HTM-Admin-FileCommands"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Defined in** | lib/htm/admin/file_commands.rb |
|
|
6
|
+
|
|
7
|
+
The `htm files ...` commands: load markdown files into long-term memory and
|
|
8
|
+
keep them in sync
|
|
9
|
+
|
|
10
|
+
The module functions are the task entry points and the helpers that print
|
|
11
|
+
nothing; Console runs the commands against a given terminal and memory.
|
|
12
|
+
|
|
13
|
+
## Constants
|
|
14
|
+
### `CHUNK_TOTALS` <a id="constant-CHUNK_TOTALS"></a> <a id="CHUNK_TOTALS-constant"></a>
|
|
15
|
+
Chunk counts load_totals reports, by the HTM#load_file result key they sum
|
|
16
|
+
|
|
17
|
+
### `INFO_NOTES` <a id="constant-INFO_NOTES"></a> <a id="INFO_NOTES-constant"></a>
|
|
18
|
+
info's "Needs sync" value per sync_state
|
|
19
|
+
|
|
20
|
+
### `LIST_NOTES` <a id="constant-LIST_NOTES"></a> <a id="LIST_NOTES-constant"></a>
|
|
21
|
+
list's note per sync_state
|
|
22
|
+
|
|
23
|
+
### `ROBOT_NAME` <a id="constant-ROBOT_NAME"></a> <a id="ROBOT_NAME-constant"></a>
|
|
24
|
+
Not documented.
|
|
25
|
+
|
|
26
|
+
## Public Class Methods
|
|
27
|
+
### `chunk_summary(result)` <a id="method-c-chunk_summary"></a> <a id="chunk_summary-class_method"></a>
|
|
28
|
+
- **`@return`** [String] "created, updated, deleted" counts of one load result
|
|
29
|
+
|
|
30
|
+
### `file_totals()` <a id="method-c-file_totals"></a> <a id="file_totals-class_method"></a>
|
|
31
|
+
- **`@return`** [Hash] { files:, chunks:, needs_sync:, missing: } over every loaded file
|
|
32
|
+
|
|
33
|
+
### `find_source(path)` <a id="method-c-find_source"></a> <a id="find_source-class_method"></a>
|
|
34
|
+
- **`@return`** [HTM::Models::FileSource, nil] the source loaded from +path+, as given or expanded
|
|
35
|
+
|
|
36
|
+
### `htm()` <a id="method-c-htm"></a> <a id="htm-class_method"></a>
|
|
37
|
+
- **`@return`** [HTM] the robot the files are loaded as
|
|
38
|
+
|
|
39
|
+
### `info(path)` <a id="method-c-info"></a> <a id="info-class_method"></a>
|
|
40
|
+
Print the details of one loaded file (see Console#info)
|
|
41
|
+
|
|
42
|
+
### `list()` <a id="method-c-list"></a> <a id="list-class_method"></a>
|
|
43
|
+
Print every loaded file source (see Console#list)
|
|
44
|
+
|
|
45
|
+
### `load(path, force: nil)` <a id="method-c-load"></a> <a id="load-class_method"></a>
|
|
46
|
+
Load one markdown file (see Console#load)
|
|
47
|
+
|
|
48
|
+
### `load_counts(result)` <a id="method-c-load_counts"></a> <a id="load_counts-class_method"></a>
|
|
49
|
+
- **`@return`** [Hash{String => Object}] the counts of one HTM#load_file result, by label
|
|
50
|
+
|
|
51
|
+
### `load_dir(path, pattern: '**/*.md', force: nil)` <a id="method-c-load_dir"></a> <a id="load_dir-class_method"></a>
|
|
52
|
+
Load every file matching `pattern` under `path` (see Console#load_dir)
|
|
53
|
+
|
|
54
|
+
### `load_totals(results)` <a id="method-c-load_totals"></a> <a id="load_totals-class_method"></a>
|
|
55
|
+
Totals over HTM#load_directory's results
|
|
56
|
+
- **`@return`** [Hash] { files:, skipped:, created:, updated:, deleted: }
|
|
57
|
+
|
|
58
|
+
### `preview(content)` <a id="method-c-preview"></a> <a id="preview-class_method"></a>
|
|
59
|
+
- **`@return`** [String] the first 60 characters of +content+ on one line
|
|
60
|
+
|
|
61
|
+
### `source_details(source)` <a id="method-c-source_details"></a> <a id="source_details-class_method"></a>
|
|
62
|
+
- **`@return`** [Hash{String => Object}] info's details of +source+, by label
|
|
63
|
+
|
|
64
|
+
### `source_lines(source)` <a id="method-c-source_lines"></a> <a id="source_lines-class_method"></a>
|
|
65
|
+
- **`@return`** [Array<String>] list's two lines for +source+
|
|
66
|
+
|
|
67
|
+
### `stat_notes(totals)` <a id="method-c-stat_notes"></a> <a id="stat_notes-class_method"></a>
|
|
68
|
+
- **`@return`** [Array<String>] stats' lines on missing files and chunks per file, when they apply
|
|
69
|
+
|
|
70
|
+
### `stats()` <a id="method-c-stats"></a> <a id="stats-class_method"></a>
|
|
71
|
+
Print totals over every loaded file (see Console#stats)
|
|
72
|
+
|
|
73
|
+
### `sum_of(results, key)` <a id="method-c-sum_of"></a> <a id="sum_of-class_method"></a>
|
|
74
|
+
- **`@return`** [Integer] the sum of +key+ over +results+
|
|
75
|
+
|
|
76
|
+
### `sync()` <a id="method-c-sync"></a> <a id="sync-class_method"></a>
|
|
77
|
+
Reload every loaded file that changed on disk (see Console#sync)
|
|
78
|
+
|
|
79
|
+
### `sync_state(source)` <a id="method-c-sync_state"></a> <a id="sync_state-class_method"></a>
|
|
80
|
+
- **`@return`** [Symbol] :missing, :needs_sync or :synced for a file source
|
|
81
|
+
|
|
82
|
+
### `unload(path)` <a id="method-c-unload"></a> <a id="unload-class_method"></a>
|
|
83
|
+
Soft delete the chunks loaded from `path` (see Console#unload)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Class HTM::Admin::MemoryCommands::Base <a id="class-HTM-Admin-MemoryCommands-Base"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | [HTM::Admin::Console](../Console.md) |
|
|
6
|
+
| **Defined in** | lib/htm/admin/memory_commands.rb |
|
|
7
|
+
|
|
8
|
+
The memory commands' shared terminal: the robot's HTM, JSON or text output,
|
|
9
|
+
and how a node or result is printed
|
|
10
|
+
|
|
11
|
+
## Public Instance Methods
|
|
12
|
+
### `initialize(robot: nil, json: nil, full: nil, memory: nil)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
|
|
13
|
+
- **`@param`** `robot` [String, nil] robot name (see MemoryCommands.robot_name)
|
|
14
|
+
- **`@param`** `json` [Boolean, nil] print JSON instead of text
|
|
15
|
+
- **`@param`** `full` [Boolean, nil] print whole contents instead of previews
|
|
16
|
+
- **`@param`** `memory` [HTM, nil] the memory to use (a test's); built from +robot+ when nil
|
|
17
|
+
- **`@return`** [Base] a new instance of Base
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Class HTM::Admin::MemoryCommands::Edit <a id="class-HTM-Admin-MemoryCommands-Edit"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | [HTM::Admin::MemoryCommands::Base](Base.md) |
|
|
6
|
+
| **Defined in** | lib/htm/admin/memory_commands/edit.rb |
|
|
7
|
+
|
|
8
|
+
Commands that change memory: remember, forget, restore, purge and tagging.
|
|
9
|
+
Permanent deletes ask first unless assume_yes.
|
|
10
|
+
|
|
11
|
+
**`@example`**
|
|
12
|
+
```ruby
|
|
13
|
+
HTM::Admin::MemoryCommands::Edit.new.remember("We use pgvector", tags: ["database:postgresql"])
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Constants
|
|
17
|
+
### `FORGOT` <a id="constant-FORGOT"></a> <a id="FORGOT-constant"></a>
|
|
18
|
+
The verb and closing hint of a forget report, by whether it was permanent
|
|
19
|
+
|
|
20
|
+
## Public Instance Methods
|
|
21
|
+
### `confirm(node_id, evidence:, reason: nil, confidence: nil)` <a id="method-i-confirm"></a> <a id="confirm-instance_method"></a>
|
|
22
|
+
Confirm a memory: upgrade it to asserted on the strength of `evidence`
|
|
23
|
+
- **`@param`** `node_id` [Integer]
|
|
24
|
+
- **`@param`** `evidence` [Array<Integer>] nodes that confirm it
|
|
25
|
+
- **`@param`** `reason` [String, nil]
|
|
26
|
+
- **`@param`** `confidence` [Float, String, nil] its new confidence
|
|
27
|
+
- **`@return`** [Hash] { node_id:, epistemic_status:, prior_status:, confidence:, evidence: }
|
|
28
|
+
|
|
29
|
+
### `deleted(limit: 20)` <a id="method-i-deleted"></a> <a id="deleted-instance_method"></a>
|
|
30
|
+
Soft-deleted nodes, newest deletions first
|
|
31
|
+
- **`@return`** [Hash] { count:, nodes: }
|
|
32
|
+
|
|
33
|
+
### `forget(node_ids, permanent: nil)` <a id="method-i-forget"></a> <a id="forget-instance_method"></a>
|
|
34
|
+
Forget nodes by id: soft delete (restorable), or permanently after
|
|
35
|
+
confirmation
|
|
36
|
+
- **`@param`** `node_ids` [Array<Integer>]
|
|
37
|
+
- **`@return`** [Hash, nil] { node_ids:, permanent: }, nil when cancelled
|
|
38
|
+
|
|
39
|
+
### `forget_matching(text, permanent: nil)` <a id="method-i-forget_matching"></a> <a id="forget_matching-instance_method"></a>
|
|
40
|
+
Forget every node whose content contains `text` (case-insensitive)
|
|
41
|
+
- **`@return`** [Hash, nil] { content:, node_ids:, permanent: }, nil when cancelled
|
|
42
|
+
|
|
43
|
+
### `purge(cutoff)` <a id="method-i-purge"></a> <a id="purge-instance_method"></a>
|
|
44
|
+
Permanently delete the nodes soft-deleted before `cutoff`, after confirmation
|
|
45
|
+
- **`@param`** `cutoff` [Time]
|
|
46
|
+
- **`@return`** [Hash, nil] { older_than:, purged: }, nil when cancelled
|
|
47
|
+
|
|
48
|
+
### `remember(content, tags: [], metadata: {}, supersedes: [], reason: nil, transition: nil, status: 'asserted', confidence: nil, evidence: [], **event_time)` <a id="method-i-remember"></a> <a id="remember-instance_method"></a>
|
|
49
|
+
Store `content` as a memory; its embedding and tags (and propositions, when
|
|
50
|
+
enabled) are generated before this returns
|
|
51
|
+
- **`@param`** `event_time` [Hash] occurred_at:, occurred_until:, valid_from:,
|
|
52
|
+
valid_until: (ISO8601 or natural language; see HTM#remember)
|
|
53
|
+
- **`@param`** `supersedes` [Array<Integer>] nodes this memory replaces (kept in its timeline)
|
|
54
|
+
- **`@param`** `reason` [String, nil] why they are wrong now
|
|
55
|
+
- **`@param`** `transition` [String, nil] removed, restored or changed
|
|
56
|
+
- **`@param`** `status` [String] asserted, extracted, inferred or hypothesis
|
|
57
|
+
- **`@param`** `confidence` [Float, String, nil] 0 to 1
|
|
58
|
+
- **`@param`** `evidence` [Array<Integer>] nodes the memory rests on
|
|
59
|
+
- **`@return`** [Hash] { node_id:, robot_name:, superseded:, epistemic_status:, confidence:, evidence:,
|
|
60
|
+
tags:, occurred_at:, created_at:, content: }
|
|
61
|
+
|
|
62
|
+
### `restore(node_ids)` <a id="method-i-restore"></a> <a id="restore-instance_method"></a>
|
|
63
|
+
Restore soft-deleted nodes
|
|
64
|
+
- **`@raise`** [ArgumentError] when a node is not soft-deleted
|
|
65
|
+
- **`@return`** [Hash] { node_ids: }
|
|
66
|
+
|
|
67
|
+
### `tag(node_id, tags)` <a id="method-i-tag"></a> <a id="tag-instance_method"></a>
|
|
68
|
+
Add hierarchical tags to a node (parents are created too)
|
|
69
|
+
- **`@return`** [Hash] { node_id:, tags: } with every tag the node now has
|
|
70
|
+
|
|
71
|
+
### `untag(node_id, tag)` <a id="method-i-untag"></a> <a id="untag-instance_method"></a>
|
|
72
|
+
Remove one tag from a node (its parent and child tags stay)
|
|
73
|
+
- **`@raise`** [HTM::Admin::Error] when the node does not carry +tag+
|
|
74
|
+
- **`@return`** [Hash] { node_id:, tags: }
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Class HTM::Admin::MemoryCommands::Search <a id="class-HTM-Admin-MemoryCommands-Search"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | [HTM::Admin::MemoryCommands::Base](Base.md) |
|
|
6
|
+
| **Defined in** | lib/htm/admin/memory_commands/search.rb |
|
|
7
|
+
|
|
8
|
+
Commands that read memory: recall (search), show, related, propositions, stats
|
|
9
|
+
and the robots sharing memory
|
|
10
|
+
|
|
11
|
+
**`@example`**
|
|
12
|
+
```ruby
|
|
13
|
+
HTM::Admin::MemoryCommands::Search.new(json: true).recall("pgvector", strategy: "hybrid")
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Constants
|
|
17
|
+
### `ROBOT_ROW` <a id="constant-ROBOT_ROW"></a> <a id="ROBOT_ROW-constant"></a>
|
|
18
|
+
One line of the robots table
|
|
19
|
+
|
|
20
|
+
### `STRATEGIES` <a id="constant-STRATEGIES"></a> <a id="STRATEGIES-constant"></a>
|
|
21
|
+
Not documented.
|
|
22
|
+
|
|
23
|
+
## Public Instance Methods
|
|
24
|
+
### `first_mention(query, strategy: 'fulltext', limit: 50, timeframe: nil)` <a id="method-i-first_mention"></a> <a id="first_mention-instance_method"></a>
|
|
25
|
+
When was `query` first mentioned, and can memory establish it?
|
|
26
|
+
- **`@param`** `query` [String]
|
|
27
|
+
- **`@param`** `strategy` [String] vector, fulltext or hybrid
|
|
28
|
+
- **`@param`** `limit` [Integer] matches to judge
|
|
29
|
+
- **`@param`** `timeframe` [String, nil] as for recall
|
|
30
|
+
- **`@raise`** [ArgumentError] for an unknown strategy
|
|
31
|
+
- **`@return`** [Hash] see HTM#first_mention, times as ISO8601
|
|
32
|
+
|
|
33
|
+
### `propositions(text)` <a id="method-i-propositions"></a> <a id="propositions-instance_method"></a>
|
|
34
|
+
Break `text` into atomic propositions with the configured LLM
|
|
35
|
+
- **`@return`** [Hash] { count:, propositions:, node_ids: [] }
|
|
36
|
+
|
|
37
|
+
### `recall(query, strategy: 'hybrid', limit: 10, **filters)` <a id="method-i-recall"></a> <a id="recall-instance_method"></a>
|
|
38
|
+
Search memory. Found memories join the robot's working memory.
|
|
39
|
+
- **`@param`** `query` [String]
|
|
40
|
+
- **`@param`** `strategy` [String] vector, fulltext or hybrid
|
|
41
|
+
- **`@param`** `filters` [Hash] limit:, timeframe:, metadata:, query_tags:, with_relevance:,
|
|
42
|
+
time_axis: (event or recorded), as_of: (a moment the memories were true at),
|
|
43
|
+
include_history: (follow each result with the states it replaced),
|
|
44
|
+
status: (epistemic statuses to keep), min_confidence:
|
|
45
|
+
- **`@raise`** [ArgumentError] for an unknown strategy or a bad timeframe
|
|
46
|
+
- **`@return`** [Hash] { query:, strategy:, robot_name:, count:, results: }
|
|
47
|
+
|
|
48
|
+
### `related(node_id, limit: 10, min_weight: 0.0)` <a id="method-i-related"></a> <a id="related-instance_method"></a>
|
|
49
|
+
Nodes linked to `node_id` in the relationship graph, strongest first
|
|
50
|
+
- **`@return`** [Hash] { node_id:, count:, related: }
|
|
51
|
+
|
|
52
|
+
### `remember_propositions(text)` <a id="method-i-remember_propositions"></a> <a id="remember_propositions-instance_method"></a>
|
|
53
|
+
Break `text` into atomic propositions and store each one as its own memory
|
|
54
|
+
- **`@return`** [Hash] { count:, propositions:, node_ids: }
|
|
55
|
+
|
|
56
|
+
### `robots(limit: 50)` <a id="method-i-robots"></a> <a id="robots-instance_method"></a>
|
|
57
|
+
The robots sharing memory, most recently active first
|
|
58
|
+
- **`@return`** [Hash] { count:, robots: }
|
|
59
|
+
|
|
60
|
+
### `show(node_id)` <a id="method-i-show"></a> <a id="show-instance_method"></a>
|
|
61
|
+
Print one node in full, soft-deleted or not
|
|
62
|
+
- **`@raise`** [HTM::NotFoundError] when there is no such node
|
|
63
|
+
- **`@return`** [Hash] the node's details (NodeView.node_detail) and source_file
|
|
64
|
+
|
|
65
|
+
### `stats()` <a id="method-i-stats"></a> <a id="stats-instance_method"></a>
|
|
66
|
+
Counts across all of memory (NodeView.memory_statistics)
|
|
67
|
+
- **`@return`** [Hash]
|
|
68
|
+
|
|
69
|
+
### `timeline(subject, strategy: 'fulltext', limit: 5, depth: HTM::Timeline::MAX_DEPTH)` <a id="method-i-timeline"></a> <a id="timeline-instance_method"></a>
|
|
70
|
+
The history of a memory: its states and the changes between them
|
|
71
|
+
- **`@param`** `subject` [String] a node id, or a query whose top matches seed the histories
|
|
72
|
+
- **`@param`** `strategy` [String] vector, fulltext or hybrid (for a query)
|
|
73
|
+
- **`@param`** `limit` [Integer] matches to seed from
|
|
74
|
+
- **`@param`** `depth` [Integer] links to follow at most
|
|
75
|
+
- **`@raise`** [ArgumentError] for an unknown strategy
|
|
76
|
+
- **`@raise`** [HTM::NotFoundError] for an unknown node id
|
|
77
|
+
- **`@return`** [Hash] { subject:, count:, histories: } (see HTM#timeline)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Class HTM::Admin::MemoryCommands::TagSearch <a id="class-HTM-Admin-MemoryCommands-TagSearch"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | [HTM::Admin::MemoryCommands::Base](Base.md) |
|
|
6
|
+
| **Defined in** | lib/htm/admin/memory_commands/tag_search.rb |
|
|
7
|
+
|
|
8
|
+
Commands that search by tag: list and fuzzy-search tags, the most used tags
|
|
9
|
+
and tags used together, and the memories carrying tags
|
|
10
|
+
|
|
11
|
+
**`@example`**
|
|
12
|
+
```ruby
|
|
13
|
+
HTM::Admin::MemoryCommands::TagSearch.new.tagged(%w[database:postgresql], match: "all")
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Constants
|
|
17
|
+
### `MATCHES` <a id="constant-MATCHES"></a> <a id="MATCHES-constant"></a>
|
|
18
|
+
Not documented.
|
|
19
|
+
|
|
20
|
+
## Public Instance Methods
|
|
21
|
+
### `list(prefix = nil)` <a id="method-i-list"></a> <a id="list-instance_method"></a>
|
|
22
|
+
Every tag (or those under `prefix`) with how many memories carry it
|
|
23
|
+
- **`@return`** [Hash] { prefix:, count:, tags: }
|
|
24
|
+
|
|
25
|
+
### `pairs(min_shared_nodes: 2, limit: 50)` <a id="method-i-pairs"></a> <a id="pairs-instance_method"></a>
|
|
26
|
+
Pairs of tags used together on the same memories, most shared first
|
|
27
|
+
- **`@return`** [Hash] { count:, relationships: }
|
|
28
|
+
|
|
29
|
+
### `popular(limit: 20, timeframe: nil)` <a id="method-i-popular"></a> <a id="popular-instance_method"></a>
|
|
30
|
+
The most used tags, optionally counting only memories from `timeframe`
|
|
31
|
+
- **`@return`** [Hash] { timeframe:, count:, tags: }
|
|
32
|
+
|
|
33
|
+
### `search(query, limit: 20, min_similarity: 0.3)` <a id="method-i-search"></a> <a id="search-instance_method"></a>
|
|
34
|
+
Tags whose names resemble `query` (typo-tolerant trigram match)
|
|
35
|
+
- **`@return`** [Hash] { query:, count:, tags: }
|
|
36
|
+
|
|
37
|
+
### `tagged(tags, match: 'any', limit: 20, timeframe: nil)` <a id="method-i-tagged"></a> <a id="tagged-instance_method"></a>
|
|
38
|
+
Memories carrying any (or all) of `tags`, ranked by relevance
|
|
39
|
+
- **`@raise`** [ArgumentError] for an unknown match
|
|
40
|
+
- **`@return`** [Hash] { tags:, match:, count:, results: }
|
|
41
|
+
|
|
42
|
+
### `topic(topic, limit: 20, min_similarity: 0.3, **mode)` <a id="method-i-topic"></a> <a id="topic-instance_method"></a>
|
|
43
|
+
Memories under a topic: tags starting with `topic`, exactly `topic`, or
|
|
44
|
+
(fuzzy) tags resembling it
|
|
45
|
+
- **`@param`** `mode` [Hash] exact: or fuzzy:
|
|
46
|
+
- **`@return`** [Hash] { topic:, count:, results: }
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Class HTM::Admin::MemoryCommands::WorkingMemory <a id="class-HTM-Admin-MemoryCommands-WorkingMemory"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | [HTM::Admin::MemoryCommands::Base](Base.md) |
|
|
6
|
+
| **Defined in** | lib/htm/admin/memory_commands/working_memory.rb |
|
|
7
|
+
|
|
8
|
+
Commands on a robot's working memory: list it, assemble it into an LLM
|
|
9
|
+
context, clear it. The memory is reloaded from the database, so it is the
|
|
10
|
+
context the robot built up in earlier runs.
|
|
11
|
+
|
|
12
|
+
**`@example`**
|
|
13
|
+
```ruby
|
|
14
|
+
HTM::Admin::MemoryCommands::WorkingMemory.new(robot: "coder").context(strategy: "recent")
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Constants
|
|
18
|
+
### `STRATEGIES` <a id="constant-STRATEGIES"></a> <a id="STRATEGIES-constant"></a>
|
|
19
|
+
Not documented.
|
|
20
|
+
|
|
21
|
+
## Public Instance Methods
|
|
22
|
+
### `clear()` <a id="method-i-clear"></a> <a id="clear-instance_method"></a>
|
|
23
|
+
Clear the robot's working memory; the memories stay in long-term memory
|
|
24
|
+
- **`@return`** [Hash] { robot_name:, cleared: }
|
|
25
|
+
|
|
26
|
+
### `context(strategy: 'balanced', max_tokens: nil)` <a id="method-i-context"></a> <a id="context-instance_method"></a>
|
|
27
|
+
The working memory as one context string for an LLM prompt; text output is the
|
|
28
|
+
context alone, ready to pipe
|
|
29
|
+
- **`@param`** `strategy` [String] recent, frequent or balanced
|
|
30
|
+
- **`@param`** `max_tokens` [Integer, nil] token budget (the working memory size when nil)
|
|
31
|
+
- **`@raise`** [ArgumentError] for an unknown strategy
|
|
32
|
+
- **`@return`** [Hash] { robot_name:, strategy:, node_count:, token_count:, context: }
|
|
33
|
+
|
|
34
|
+
### `list()` <a id="method-i-list"></a> <a id="list-instance_method"></a>
|
|
35
|
+
The robot's working memory entries, most recently remembered first
|
|
36
|
+
- **`@return`** [Hash] { robot_name:, count:, working_memory: }
|