htm 0.0.32 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.architecture/decisions/adrs/005-rag-based-retrieval-with-hybrid-search.md +4 -0
- data/.architecture/decisions/adrs/017-bitemporal-event-time.md +78 -0
- data/.architecture/decisions/adrs/018-memory-timelines-and-node-links.md +64 -0
- data/.architecture/decisions/adrs/019-epistemic-status.md +66 -0
- data/.claude.json +11 -0
- data/.envrc +9 -7
- data/.irbrc +14 -14
- data/.reek.yml +104 -0
- data/.rubocop.yml +0 -11
- data/.ruby-version +1 -0
- data/CHANGELOG.md +160 -98
- data/README.md +22 -17
- data/SETUP.md +49 -46
- data/_typos.toml +17 -0
- data/bin/htm +18 -0
- data/db/migrate/00010_convert_embedding_to_sparsevec.rb +47 -0
- data/db/migrate/00011_strip_frontmatter_from_chunks.rb +66 -0
- data/db/migrate/00012_add_event_time_to_nodes.rb +110 -0
- data/db/migrate/00013_create_node_links.rb +158 -0
- data/db/migrate/00014_add_epistemic_status.rb +110 -0
- data/db/schema.sql +238 -7
- data/db/seed_data/README.md +11 -11
- data/db/seeds.rb +11 -11
- data/docs/api/database.md +8 -8
- data/docs/api/embedding-service.md +138 -262
- data/docs/api/htm.md +128 -12
- data/docs/api/index.md +8 -8
- data/docs/api/long-term-memory.md +8 -19
- data/docs/api/working-memory.md +34 -46
- data/docs/api/yard/HTM/Admin/Console.md +53 -0
- data/docs/api/yard/HTM/Admin/DatabaseCommands/Console.md +38 -0
- data/docs/api/yard/HTM/Admin/DatabaseCommands.md +127 -0
- data/docs/api/yard/HTM/Admin/EnrichCommands.md +85 -0
- data/docs/api/yard/HTM/Admin/Error.md +9 -0
- data/docs/api/yard/HTM/Admin/FileCommands/Console.md +50 -0
- data/docs/api/yard/HTM/Admin/FileCommands.md +83 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands/Base.md +17 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands/Edit.md +74 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands/Search.md +77 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands/TagSearch.md +46 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands/WorkingMemory.md +36 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands.md +67 -0
- data/docs/api/yard/HTM/Admin/TagCommands/Console.md +48 -0
- data/docs/api/yard/HTM/Admin/TagCommands.md +105 -0
- data/docs/api/yard/HTM/Admin/TagGraph.md +149 -0
- data/docs/api/yard/HTM/Admin/YardDocs.md +60 -0
- data/docs/api/yard/HTM/Admin.md +102 -0
- data/docs/api/yard/HTM/AuthorizationError.md +6 -6
- data/docs/api/yard/HTM/CLI/ConfigFile.md +40 -0
- data/docs/api/yard/HTM/CLI/Db.md +63 -0
- data/docs/api/yard/HTM/CLI/Enrich.md +39 -0
- data/docs/api/yard/HTM/CLI/ErrorSuggestion.md +56 -0
- data/docs/api/yard/HTM/CLI/Files.md +36 -0
- data/docs/api/yard/HTM/CLI/Group/ClassMethods.md +11 -0
- data/docs/api/yard/HTM/CLI/Group.md +13 -0
- data/docs/api/yard/HTM/CLI/MemoryCommand/ClassMethods.md +20 -0
- data/docs/api/yard/HTM/CLI/MemoryCommand.md +9 -0
- data/docs/api/yard/HTM/CLI/Robots.md +31 -0
- data/docs/api/yard/HTM/CLI/Support.md +9 -0
- data/docs/api/yard/HTM/CLI/Tags.md +57 -0
- data/docs/api/yard/HTM/CLI/WorkingMemory.md +24 -0
- data/docs/api/yard/HTM/CLI.md +84 -0
- data/docs/api/yard/HTM/CircuitBreaker/Guarded.md +29 -0
- data/docs/api/yard/HTM/CircuitBreaker/Settings.md +21 -0
- data/docs/api/yard/HTM/CircuitBreaker/Status.md +42 -0
- data/docs/api/yard/HTM/CircuitBreaker.md +54 -49
- data/docs/api/yard/HTM/CircuitBreakerOpenError.md +9 -9
- data/docs/api/yard/HTM/Config/Builder.md +87 -0
- data/docs/api/yard/HTM/Config/Coercion.md +59 -0
- data/docs/api/yard/HTM/Config/Database.md +102 -0
- data/docs/api/yard/HTM/Config/Readers.md +30 -0
- data/docs/api/yard/HTM/Config/RubyLlmSettings.md +32 -0
- data/docs/api/yard/HTM/Config/Validator.md +59 -0
- data/docs/api/yard/HTM/Config.md +224 -105
- data/docs/api/yard/HTM/ConfigurationError.md +20 -0
- data/docs/api/yard/HTM/Confirmation.md +22 -0
- data/docs/api/yard/HTM/Database/Connection.md +26 -0
- data/docs/api/yard/HTM/Database/Migrations.md +32 -0
- data/docs/api/yard/HTM/Database/Report.md +26 -0
- data/docs/api/yard/HTM/Database/SchemaFile.md +52 -0
- data/docs/api/yard/HTM/Database/Teardown.md +15 -0
- data/docs/api/yard/HTM/Database.md +58 -70
- data/docs/api/yard/HTM/DatabaseDocs.md +67 -0
- data/docs/api/yard/HTM/DatabaseError.md +6 -6
- data/docs/api/yard/HTM/Deletion.md +32 -0
- data/docs/api/yard/HTM/EmbeddingError.md +6 -6
- data/docs/api/yard/HTM/EmbeddingService.md +37 -38
- data/docs/api/yard/HTM/Epistemics.md +135 -0
- data/docs/api/yard/HTM/Error.md +6 -6
- data/docs/api/yard/HTM/EventTime.md +110 -0
- data/docs/api/yard/HTM/FileMemory.md +76 -0
- data/docs/api/yard/HTM/InputValidator.md +82 -0
- data/docs/api/yard/HTM/JobAdapter/Job.md +26 -0
- data/docs/api/yard/HTM/JobAdapter.md +35 -16
- data/docs/api/yard/HTM/Jobs/FailureLogging.md +14 -0
- data/docs/api/yard/HTM/Jobs/GenerateEmbeddingJob.md +16 -0
- data/docs/api/yard/HTM/Jobs/GeneratePropositionsJob.md +17 -0
- data/docs/api/yard/HTM/Jobs/GenerateRelationshipsJob.md +26 -0
- data/docs/api/yard/HTM/Jobs/GenerateTagsJob.md +17 -0
- data/docs/api/yard/HTM/Jobs/LlmCallTimer.md +58 -0
- data/docs/api/yard/HTM/Jobs/NodeLookup.md +14 -0
- data/docs/api/yard/HTM/Jobs.md +13 -0
- data/docs/api/yard/HTM/Loaders/ChunkSync/Chunk.md +22 -0
- data/docs/api/yard/HTM/Loaders/ChunkSync.md +50 -0
- data/docs/api/yard/HTM/Loaders/MarkdownChunker/Coalescer.md +24 -0
- data/docs/api/yard/HTM/Loaders/MarkdownChunker/Packer.md +20 -0
- data/docs/api/yard/HTM/Loaders/MarkdownChunker/Splitter.md +18 -0
- data/docs/api/yard/HTM/Loaders/MarkdownChunker.md +83 -0
- data/docs/api/yard/HTM/Loaders/MarkdownLoader/Document.md +43 -0
- data/docs/api/yard/HTM/Loaders/MarkdownLoader.md +62 -0
- data/docs/api/yard/HTM/Loaders.md +5 -0
- data/docs/api/yard/HTM/LongTermMemory/FulltextSearch.md +36 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfMerger.md +25 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfRows.md +30 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfSql/Query.md +79 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfSql/Source.md +45 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfSql.md +11 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/TagDepth.md +52 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch.md +52 -0
- data/docs/api/yard/HTM/LongTermMemory/NodeOperations.md +95 -0
- data/docs/api/yard/HTM/LongTermMemory/RelevanceScorer/HierarchicalJaccard.md +58 -0
- data/docs/api/yard/HTM/LongTermMemory/RelevanceScorer/TagSearch.md +27 -0
- data/docs/api/yard/HTM/LongTermMemory/RelevanceScorer.md +81 -0
- data/docs/api/yard/HTM/LongTermMemory/RobotOperations.md +22 -0
- data/docs/api/yard/HTM/LongTermMemory/TagOperations/ExpiringValue.md +24 -0
- data/docs/api/yard/HTM/LongTermMemory/TagOperations/TagMatchSql.md +40 -0
- data/docs/api/yard/HTM/LongTermMemory/TagOperations.md +129 -0
- data/docs/api/yard/HTM/LongTermMemory/VectorSearch.md +30 -0
- data/docs/api/yard/HTM/LongTermMemory.md +279 -31
- data/docs/api/yard/HTM/MCP/AssembleContextTool.md +16 -0
- data/docs/api/yard/HTM/MCP/ClearGroupWorkingMemoryTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ClearWorkingMemoryTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ConfigResource.md +12 -0
- data/docs/api/yard/HTM/MCP/ConfirmTool.md +12 -0
- data/docs/api/yard/HTM/MCP/CreateGroupTool.md +12 -0
- data/docs/api/yard/HTM/MCP/EnrichPendingTool.md +16 -0
- data/docs/api/yard/HTM/MCP/ExtractPropositionsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/FailoverTool.md +12 -0
- data/docs/api/yard/HTM/MCP/FileInfoTool.md +13 -0
- data/docs/api/yard/HTM/MCP/FileSourcesResource.md +12 -0
- data/docs/api/yard/HTM/MCP/FileSupport.md +7 -0
- data/docs/api/yard/HTM/MCP/FindByTopicTool.md +12 -0
- data/docs/api/yard/HTM/MCP/FirstMentionTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ForgetContentTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ForgetTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GetGroupStatusTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GetGroupWorkingMemoryTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GetNodeTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GetRobotTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GetWorkingMemoryTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GroupRecallTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GroupRememberTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GroupSession.md +23 -0
- data/docs/api/yard/HTM/MCP/JoinGroupTool.md +12 -0
- data/docs/api/yard/HTM/MCP/LeaveGroupTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ListDeletedTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ListFilesTool.md +13 -0
- data/docs/api/yard/HTM/MCP/ListGroupsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ListRobotsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ListTagsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/LoadDirectoryTool.md +13 -0
- data/docs/api/yard/HTM/MCP/LoadFileTool.md +13 -0
- data/docs/api/yard/HTM/MCP/MemoryStatsResource.md +13 -0
- data/docs/api/yard/HTM/MCP/PopularTagsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/PromoteRobotTool.md +12 -0
- data/docs/api/yard/HTM/MCP/PurgeDeletedTool.md +12 -0
- data/docs/api/yard/HTM/MCP/RecallTool.md +16 -0
- data/docs/api/yard/HTM/MCP/RecentMemoriesResource.md +13 -0
- data/docs/api/yard/HTM/MCP/RelatedNodesTool.md +12 -0
- data/docs/api/yard/HTM/MCP/RememberTool.md +12 -0
- data/docs/api/yard/HTM/MCP/RestoreTool.md +12 -0
- data/docs/api/yard/HTM/MCP/RobotGroupsResource.md +13 -0
- data/docs/api/yard/HTM/MCP/RobotTeamsStatusTool.md +13 -0
- data/docs/api/yard/HTM/MCP/RunRobotTeamsTool.md +13 -0
- data/docs/api/yard/HTM/MCP/SearchByTagsTool.md +16 -0
- data/docs/api/yard/HTM/MCP/SearchTagsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/Server.md +37 -0
- data/docs/api/yard/HTM/MCP/Session.md +32 -0
- data/docs/api/yard/HTM/MCP/SetRobotTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ShutdownGroupTool.md +12 -0
- data/docs/api/yard/HTM/MCP/StartupPromptResource.md +16 -0
- data/docs/api/yard/HTM/MCP/StatsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/SyncFilesTool.md +13 -0
- data/docs/api/yard/HTM/MCP/SyncGroupTool.md +12 -0
- data/docs/api/yard/HTM/MCP/TagHierarchyResource.md +16 -0
- data/docs/api/yard/HTM/MCP/TagNodeTool.md +12 -0
- data/docs/api/yard/HTM/MCP/TagTreeTool.md +22 -0
- data/docs/api/yard/HTM/MCP/TeamNames.md +7 -0
- data/docs/api/yard/HTM/MCP/TimelineTool.md +12 -0
- data/docs/api/yard/HTM/MCP/Tool.md +24 -0
- data/docs/api/yard/HTM/MCP/ToolSupport.md +17 -0
- data/docs/api/yard/HTM/MCP/TopicRelationshipsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/TransferWorkingMemoryTool.md +12 -0
- data/docs/api/yard/HTM/MCP/UnloadFileTool.md +13 -0
- data/docs/api/yard/HTM/MCP/UntagNodeTool.md +12 -0
- data/docs/api/yard/HTM/MCP.md +30 -0
- data/docs/api/yard/HTM/Migration.md +44 -0
- data/docs/api/yard/HTM/Models/FileSource.md +66 -0
- data/docs/api/yard/HTM/Models/Node/Scopes.md +74 -0
- data/docs/api/yard/HTM/Models/Node/SoftDeletion.md +22 -0
- data/docs/api/yard/HTM/Models/Node/VectorSimilarity.md +28 -0
- data/docs/api/yard/HTM/Models/Node.md +113 -0
- data/docs/api/yard/HTM/Models/NodeLink.md +65 -0
- data/docs/api/yard/HTM/Models/NodeRelationship.md +31 -0
- data/docs/api/yard/HTM/Models/NodeTag.md +38 -0
- data/docs/api/yard/HTM/Models/Robot.md +50 -0
- data/docs/api/yard/HTM/Models/RobotNode.md +35 -0
- data/docs/api/yard/HTM/Models/Tag/Scopes.md +32 -0
- data/docs/api/yard/HTM/Models/Tag.md +112 -0
- data/docs/api/yard/HTM/Models.md +5 -0
- data/docs/api/yard/HTM/NodeEnrichment.md +36 -0
- data/docs/api/yard/HTM/NodeView.md +113 -0
- data/docs/api/yard/HTM/NotFoundError.md +6 -5
- data/docs/api/yard/HTM/Observability.md +58 -40
- data/docs/api/yard/HTM/PropositionError.md +6 -6
- data/docs/api/yard/HTM/PropositionService.md +63 -29
- data/docs/api/yard/HTM/QueryCache/KeyNormalizer.md +25 -0
- data/docs/api/yard/HTM/QueryCache/NullStore.md +19 -0
- data/docs/api/yard/HTM/QueryCache/Store.md +43 -0
- data/docs/api/yard/HTM/QueryCache.md +41 -46
- data/docs/api/yard/HTM/QueryTimeoutError.md +9 -8
- data/docs/api/yard/HTM/Railtie.md +11 -7
- data/docs/api/yard/HTM/RecallQuery.md +111 -0
- data/docs/api/yard/HTM/ResourceExhaustedError.md +6 -6
- data/docs/api/yard/HTM/RobotGroup/CacheSync.md +35 -0
- data/docs/api/yard/HTM/RobotGroup/Membership.md +96 -0
- data/docs/api/yard/HTM/RobotGroup/TransferOptions.md +14 -0
- data/docs/api/yard/HTM/RobotGroup/WorkingMemoryLedger.md +65 -0
- data/docs/api/yard/HTM/RobotGroup.md +116 -360
- data/docs/api/yard/HTM/Robots/Actions/TagMove.md +31 -0
- data/docs/api/yard/HTM/Robots/Actions.md +153 -0
- data/docs/api/yard/HTM/Robots/Neighbors.md +20 -0
- data/docs/api/yard/HTM/Robots/Supervisor/Idler.md +26 -0
- data/docs/api/yard/HTM/Robots/Supervisor/Roster.md +26 -0
- data/docs/api/yard/HTM/Robots/Supervisor.md +42 -0
- data/docs/api/yard/HTM/Robots/Team.md +60 -0
- data/docs/api/yard/HTM/Robots/Teams/Archivist.md +43 -0
- data/docs/api/yard/HTM/Robots/Teams/Consolidator.md +29 -0
- data/docs/api/yard/HTM/Robots/Teams/ContradictionDetector.md +33 -0
- data/docs/api/yard/HTM/Robots/Teams/TagCurator.md +37 -0
- data/docs/api/yard/HTM/Robots/Teams.md +5 -0
- data/docs/api/yard/HTM/Robots/Tools/ArchiveNodes.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools/Base.md +16 -0
- data/docs/api/yard/HTM/Robots/Tools/MergeNodes.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools/MergeTags.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools/Pass.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools/RecordConflict.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools/SupersedeNode.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools.md +14 -0
- data/docs/api/yard/HTM/Robots.md +72 -0
- data/docs/api/yard/HTM/SearchFilters.md +82 -0
- data/docs/api/yard/HTM/SequelConfig.md +97 -0
- data/docs/api/yard/HTM/Settings.md +39 -0
- data/docs/api/yard/HTM/Sinatra/Helpers.md +37 -0
- data/docs/api/yard/HTM/Sinatra/Middleware.md +29 -0
- data/docs/api/yard/HTM/Sinatra.md +44 -0
- data/docs/api/yard/HTM/SqlBuilder/Sparsevec.md +69 -0
- data/docs/api/yard/HTM/SqlBuilder.md +62 -75
- data/docs/api/yard/HTM/StartupPrompt.md +45 -0
- data/docs/api/yard/HTM/TagError.md +6 -6
- data/docs/api/yard/HTM/TagService.md +100 -37
- data/docs/api/yard/HTM/TagTree/Branch.md +43 -0
- data/docs/api/yard/HTM/TagTree/SvgRenderer/Layout.md +51 -0
- data/docs/api/yard/HTM/TagTree/SvgRenderer.md +25 -0
- data/docs/api/yard/HTM/TagTree.md +65 -0
- data/docs/api/yard/HTM/Telemetry/NullInstrument.md +12 -9
- data/docs/api/yard/HTM/Telemetry/NullMeter.md +17 -9
- data/docs/api/yard/HTM/Telemetry.md +53 -50
- data/docs/api/yard/HTM/Timeframe/Result.md +13 -16
- data/docs/api/yard/HTM/Timeframe.md +17 -20
- data/docs/api/yard/HTM/TimeframeExtractor/Patterns.md +18 -0
- data/docs/api/yard/HTM/TimeframeExtractor/Result.md +13 -16
- data/docs/api/yard/HTM/TimeframeExtractor.md +27 -16
- data/docs/api/yard/HTM/Timeline.md +113 -0
- data/docs/api/yard/HTM/ValidationError.md +6 -5
- data/docs/api/yard/HTM/Workflows/RememberWorkflow/NodeState.md +73 -0
- data/docs/api/yard/HTM/Workflows/RememberWorkflow.md +80 -0
- data/docs/api/yard/HTM/Workflows.md +5 -0
- data/docs/api/yard/HTM/WorkingMemory/Entry.md +67 -0
- data/docs/api/yard/HTM/WorkingMemory/Store.md +54 -0
- data/docs/api/yard/HTM/WorkingMemory.md +113 -87
- data/docs/api/yard/HTM/WorkingMemoryChannel/Subscribers.md +28 -0
- data/docs/api/yard/HTM/WorkingMemoryChannel.md +108 -102
- data/docs/api/yard/HTM.md +483 -5
- data/docs/api/yard/README.md +211 -0
- data/docs/api/yard/Sinatra/Base.md +30 -0
- data/docs/api/yard/Sinatra.md +7 -0
- data/docs/api/yard/index.csv +1834 -181
- data/docs/api/yard-reference.md +228 -9
- data/docs/architecture/adrs/005-rag-retrieval.md +3 -0
- data/docs/architecture/adrs/index.md +1 -1
- data/docs/architecture/index.md +2 -2
- data/docs/architecture/overview.md +3 -3
- data/docs/assets/images/project-structure.svg +2 -2
- data/docs/database/INDEX.md +113 -0
- data/docs/database/README.md +60 -176
- data/docs/database/file_sources.md +51 -0
- data/docs/database/file_sources.svg +120 -0
- data/docs/database/naming-convention.md +12 -12
- data/docs/database/node_links.md +65 -0
- data/docs/database/node_links.svg +171 -0
- data/docs/database/node_relationships.md +62 -0
- data/docs/database/node_relationships.svg +124 -0
- data/docs/database/node_tags.md +50 -0
- data/docs/database/node_tags.svg +125 -0
- data/docs/database/nodes.md +120 -0
- data/docs/database/nodes.svg +394 -0
- data/docs/database/robot_nodes.md +57 -0
- data/docs/database/robot_nodes.svg +155 -0
- data/docs/database/robots.md +40 -0
- data/docs/database/robots.svg +131 -0
- data/docs/database/schema.svg +384 -275
- data/docs/database/schema_migrations.md +19 -0
- data/docs/database/schema_migrations.svg +31 -0
- data/docs/database/tags.md +47 -0
- data/docs/database/tags.svg +90 -0
- data/docs/development/asgard-tasks.md +114 -0
- data/docs/development/contributing.md +6 -6
- data/docs/development/index.md +15 -17
- data/docs/development/schema.md +43 -14
- data/docs/development/setup.md +60 -70
- data/docs/development/testing.md +57 -65
- data/docs/examples/basic-usage.md +9 -9
- data/docs/examples/config-files.md +8 -8
- data/docs/examples/file-loading.md +12 -12
- data/docs/examples/index.md +15 -8
- data/docs/examples/llm-configuration.md +13 -9
- data/docs/examples/mcp-client.md +61 -59
- data/docs/examples/rails-integration.md +5 -4
- data/docs/examples/sinatra-integration.md +5 -4
- data/docs/examples/standalone-app.md +17 -16
- data/docs/getting-started/index.md +3 -3
- data/docs/getting-started/installation.md +76 -83
- data/docs/getting-started/quick-start.md +24 -22
- data/docs/guides/adding-memories.md +14 -3
- data/docs/guides/cli.md +458 -0
- data/docs/guides/configuration.md +72 -37
- data/docs/guides/epistemic-status.md +138 -0
- data/docs/guides/event-time.md +106 -0
- data/docs/guides/file-loading.md +26 -22
- data/docs/guides/getting-started.md +21 -17
- data/docs/guides/long-term-memory.md +1 -1
- data/docs/guides/mcp-server.md +416 -173
- data/docs/guides/propositions.md +18 -29
- data/docs/guides/recalling-memories.md +22 -7
- data/docs/guides/robot-teams.md +96 -0
- data/docs/guides/search-strategies.md +10 -7
- data/docs/guides/tags.md +19 -19
- data/docs/guides/timeline.md +106 -0
- data/docs/index.md +7 -7
- data/docs/llms.txt +35 -0
- data/docs/multi_framework_support.md +13 -13
- data/docs/robots/robot-groups.md +9 -9
- data/docs/robots/two-tier-memory.md +13 -26
- data/docs/setup_local_database.md +33 -31
- data/examples/00_create_examples_db.rb +20 -7
- data/examples/01_basic_usage.rb +20 -18
- data/examples/02_config_file_example/README.md +13 -12
- data/examples/02_config_file_example/config/htm.local.yml +8 -8
- data/examples/02_config_file_example/show_config.rb +3 -4
- data/examples/03_custom_llm_configuration.rb +12 -12
- data/examples/04_file_loader_usage.rb +15 -21
- data/examples/05_timeframe_demo.rb +282 -234
- data/examples/06_example_app/.loki +36 -0
- data/examples/06_example_app/app.rb +21 -33
- data/examples/07_cli_app/README.md +18 -18
- data/examples/07_cli_app/htm_cli.rb +25 -19
- data/examples/08_sinatra_app/Gemfile +1 -0
- data/examples/08_sinatra_app/Gemfile.lock +101 -67
- data/examples/08_sinatra_app/app.rb +64 -62
- data/examples/09_mcp_client.rb +92 -119
- data/examples/10_telemetry/README.md +3 -3
- data/examples/10_telemetry/SETUP_README.md +2 -2
- data/examples/10_telemetry/demo.rb +5 -5
- data/examples/11_robot_groups/README.md +5 -4
- data/examples/11_robot_groups/lib/robot_worker.rb +0 -5
- data/examples/11_robot_groups/multi_process.rb +5 -4
- data/examples/11_robot_groups/same_process.rb +18 -17
- data/examples/12_rails_app/Gemfile +1 -1
- data/examples/12_rails_app/Gemfile.lock +146 -97
- data/examples/12_rails_app/README.md +21 -17
- data/examples/12_rails_app/app/controllers/chats_controller.rb +33 -63
- data/examples/12_rails_app/app/controllers/memories_controller.rb +7 -1
- data/examples/12_rails_app/app/controllers/messages_controller.rb +21 -58
- data/examples/12_rails_app/app/controllers/search_controller.rb +7 -2
- data/examples/12_rails_app/app/models/chat.rb +0 -33
- data/examples/12_rails_app/app/models/message.rb +0 -2
- data/examples/12_rails_app/app/views/chats/show.html.erb +2 -2
- data/examples/12_rails_app/app/views/files/new.html.erb +1 -1
- data/examples/12_rails_app/app/views/memories/_memory_card.html.erb +1 -1
- data/examples/12_rails_app/app/views/memories/new.html.erb +12 -0
- data/examples/12_rails_app/app/views/memories/show.html.erb +13 -0
- data/examples/12_rails_app/app/views/search/index.html.erb +18 -2
- data/examples/12_rails_app/config/initializers/ruby_llm.rb +11 -15
- data/examples/12_rails_app/db/migrate/20261205061932_create_ruby_llm_records.rb +160 -0
- data/examples/12_rails_app/db/migrate/20261205061933_create_chats.rb +13 -0
- data/examples/12_rails_app/db/migrate/20261205061934_create_messages.rb +23 -0
- data/examples/12_rails_app/db/schema.rb +163 -20
- data/examples/README.md +53 -44
- data/examples/examples_helper.rb +29 -5
- data/htm.gemspec +68 -0
- data/lib/htm/admin/database_commands.rb +454 -0
- data/lib/htm/admin/enrich_commands.rb +209 -0
- data/lib/htm/admin/file_commands.rb +323 -0
- data/lib/htm/admin/memory_commands/edit.rb +157 -0
- data/lib/htm/admin/memory_commands/search.rb +178 -0
- data/lib/htm/admin/memory_commands/tag_search.rb +98 -0
- data/lib/htm/admin/memory_commands/text.rb +164 -0
- data/lib/htm/admin/memory_commands/working_memory.rb +71 -0
- data/lib/htm/admin/memory_commands.rb +179 -0
- data/lib/htm/admin/tag_commands.rb +352 -0
- data/lib/htm/admin/tag_graph.rb +290 -0
- data/lib/htm/admin/templates/tag_graph.html +295 -0
- data/lib/htm/admin/yard_docs.rb +206 -0
- data/lib/htm/admin.rb +253 -0
- data/lib/htm/circuit_breaker.rb +142 -68
- data/lib/htm/class_methods.rb +136 -0
- data/lib/htm/cli/config_file.rb +86 -0
- data/lib/htm/cli/db.rb +77 -0
- data/lib/htm/cli/enrich.rb +44 -0
- data/lib/htm/cli/environment.rb +74 -0
- data/lib/htm/cli/error_suggestion.rb +97 -0
- data/lib/htm/cli/files.rb +41 -0
- data/lib/htm/cli/group.rb +32 -0
- data/lib/htm/cli/memory.rb +320 -0
- data/lib/htm/cli/memory_command.rb +71 -0
- data/lib/htm/cli/robots.rb +71 -0
- data/lib/htm/cli/support.rb +46 -0
- data/lib/htm/cli/tags.rb +103 -0
- data/lib/htm/cli/working_memory.rb +41 -0
- data/lib/htm/cli.rb +75 -0
- data/lib/htm/config/builder.rb +99 -68
- data/lib/htm/config/coercion.rb +91 -0
- data/lib/htm/config/database.rb +81 -52
- data/lib/htm/config/defaults.yml +52 -16
- data/lib/htm/config/readers.rb +85 -0
- data/lib/htm/config/ruby_llm_settings.rb +58 -0
- data/lib/htm/config/validator.rb +45 -26
- data/lib/htm/config.rb +112 -297
- data/lib/htm/database.rb +305 -396
- data/lib/htm/database_docs.rb +149 -0
- data/lib/htm/embedding_service.rb +26 -66
- data/lib/htm/epistemics.rb +254 -0
- data/lib/htm/errors.rb +4 -4
- data/lib/htm/event_time.rb +201 -0
- data/lib/htm/file_memory.rb +106 -0
- data/lib/htm/input_validator.rb +158 -0
- data/lib/htm/integrations/sinatra.rb +43 -31
- data/lib/htm/job_adapter.rb +78 -83
- data/lib/htm/jobs/failure_logging.rb +49 -0
- data/lib/htm/jobs/generate_embedding_job.rb +21 -28
- data/lib/htm/jobs/generate_propositions_job.rb +56 -28
- data/lib/htm/jobs/generate_relationships_job.rb +28 -24
- data/lib/htm/jobs/generate_tags_job.rb +32 -37
- data/lib/htm/jobs/llm_call_timer.rb +53 -0
- data/lib/htm/jobs/node_lookup.rb +27 -0
- data/lib/htm/knowledge_memory.rb +153 -0
- data/lib/htm/loaders/chunk_sync.rb +168 -0
- data/lib/htm/loaders/markdown_chunker.rb +207 -36
- data/lib/htm/loaders/markdown_loader.rb +76 -120
- data/lib/htm/long_term_memory/fulltext_search.rb +15 -36
- data/lib/htm/long_term_memory/hybrid_search.rb +471 -544
- data/lib/htm/long_term_memory/node_operations.rb +110 -81
- data/lib/htm/long_term_memory/relevance_scorer.rb +232 -237
- data/lib/htm/long_term_memory/tag_operations.rb +201 -130
- data/lib/htm/long_term_memory/vector_search.rb +33 -61
- data/lib/htm/long_term_memory.rb +5 -17
- data/lib/htm/mcp/file_tools.rb +190 -0
- data/lib/htm/mcp/group_tools.rb +223 -233
- data/lib/htm/mcp/node_tools.rb +350 -0
- data/lib/htm/mcp/resources.rb +102 -28
- data/lib/htm/mcp/robot_team_tools.rb +119 -0
- data/lib/htm/mcp/server.rb +26 -14
- data/lib/htm/mcp/tag_tools.rb +130 -0
- data/lib/htm/mcp/tool.rb +40 -0
- data/lib/htm/mcp/tool_support.rb +88 -0
- data/lib/htm/mcp/tools.rb +232 -283
- data/lib/htm/models/file_source.rb +35 -20
- data/lib/htm/models/node.rb +287 -193
- data/lib/htm/models/node_link.rb +97 -0
- data/lib/htm/models/node_relationship.rb +3 -2
- data/lib/htm/models/node_tag.rb +22 -2
- data/lib/htm/models/robot.rb +4 -8
- data/lib/htm/models/robot_node.rb +5 -2
- data/lib/htm/models/tag.rb +53 -207
- data/lib/htm/node_enrichment.rb +75 -0
- data/lib/htm/node_view.rb +295 -0
- data/lib/htm/observability.rb +114 -98
- data/lib/htm/proposition_service.rb +38 -74
- data/lib/htm/query_cache.rb +145 -91
- data/lib/htm/railtie.rb +3 -7
- data/lib/htm/request_options.rb +149 -0
- data/lib/htm/robot_group/cache_sync.rb +69 -0
- data/lib/htm/robot_group/membership.rb +147 -0
- data/lib/htm/robot_group/working_memory_ledger.rb +111 -0
- data/lib/htm/robot_group.rb +128 -521
- data/lib/htm/robots/actions.rb +371 -0
- data/lib/htm/robots/neighbors.rb +63 -0
- data/lib/htm/robots/node_brief.rb +49 -0
- data/lib/htm/robots/supervisor.rb +140 -0
- data/lib/htm/robots/team.rb +124 -0
- data/lib/htm/robots/teams/archivist.rb +88 -0
- data/lib/htm/robots/teams/consolidator.rb +52 -0
- data/lib/htm/robots/teams/contradiction_detector.rb +67 -0
- data/lib/htm/robots/teams/tag_curator.rb +75 -0
- data/lib/htm/robots/tools.rb +127 -0
- data/lib/htm/robots.rb +125 -0
- data/lib/htm/search_filters.rb +116 -0
- data/lib/htm/sequel_config.rb +95 -59
- data/lib/htm/sql_builder.rb +162 -53
- data/lib/htm/startup_prompt.rb +73 -0
- data/lib/htm/tag_service.rb +104 -109
- data/lib/htm/tag_tree.rb +206 -0
- data/lib/htm/telemetry.rb +15 -16
- data/lib/htm/timeframe.rb +27 -9
- data/lib/htm/timeframe_extractor.rb +77 -55
- data/lib/htm/timeline.rb +230 -0
- data/lib/htm/version.rb +1 -1
- data/lib/htm/workflows/remember_workflow.rb +145 -136
- data/lib/htm/working_memory/entry.rb +53 -0
- data/lib/htm/working_memory/store.rb +97 -0
- data/lib/htm/working_memory.rb +137 -139
- data/lib/htm/working_memory_channel.rb +90 -40
- data/lib/htm.rb +177 -501
- data/mkdocs.yml +100 -23
- data/scripts/install_local_database.sh +7 -6
- metadata +1032 -594
- data/.tbls.yml +0 -31
- data/Rakefile +0 -240
- data/bin/htm_mcp +0 -27
- data/docs/api/yard/HTM/ActiveRecordConfig.md +0 -29
- data/docs/api/yard/HTM/ConfigSection.md +0 -28
- data/docs/database/public.file_sources.md +0 -42
- data/docs/database/public.file_sources.svg +0 -219
- data/docs/database/public.node_stats.md +0 -48
- data/docs/database/public.node_stats.svg +0 -41
- data/docs/database/public.node_tags.md +0 -41
- data/docs/database/public.node_tags.svg +0 -251
- data/docs/database/public.nodes.md +0 -61
- data/docs/database/public.nodes.svg +0 -283
- data/docs/database/public.nodes_tags.md +0 -39
- data/docs/database/public.nodes_tags.svg +0 -112
- data/docs/database/public.ontology_structure.md +0 -48
- data/docs/database/public.ontology_structure.svg +0 -38
- data/docs/database/public.operations_log.md +0 -42
- data/docs/database/public.operations_log.svg +0 -130
- data/docs/database/public.relationships.md +0 -39
- data/docs/database/public.relationships.svg +0 -41
- data/docs/database/public.robot_activity.md +0 -46
- data/docs/database/public.robot_activity.svg +0 -35
- data/docs/database/public.robot_nodes.md +0 -48
- data/docs/database/public.robot_nodes.svg +0 -251
- data/docs/database/public.robots.md +0 -34
- data/docs/database/public.robots.svg +0 -165
- data/docs/database/public.schema_migrations.md +0 -29
- data/docs/database/public.schema_migrations.svg +0 -26
- data/docs/database/public.tags.md +0 -38
- data/docs/database/public.tags.svg +0 -147
- data/docs/database/public.topic_relationships.md +0 -45
- data/docs/database/public.topic_relationships.svg +0 -32
- data/docs/database/schema.json +0 -1814
- data/docs/database_rake_tasks.md +0 -345
- data/docs/development/rake-tasks.md +0 -1113
- data/docs/using_rake_tasks_in_your_app.md +0 -383
- data/examples/06_example_app/Rakefile +0 -71
- data/examples/12_rails_app/app/models/model.rb +0 -5
- data/examples/12_rails_app/app/models/tool_call.rb +0 -5
- data/examples/12_rails_app/db/migrate/20250124000001_create_ruby_llm_tables.rb +0 -34
- data/examples/12_rails_app/db/migrate/20250124000002_create_models_table.rb +0 -28
- data/lib/htm/mcp/cli.rb +0 -583
- data/lib/htm/tasks.rb +0 -79
- data/lib/tasks/db.rake +0 -15
- data/lib/tasks/doc.rake +0 -301
- data/lib/tasks/files.rake +0 -285
- data/lib/tasks/htm.rake +0 -703
- data/lib/tasks/jobs.rake +0 -429
- data/lib/tasks/tags.rake +0 -184
- data/scripts/backfill_parent_tags.rb +0 -376
- data/scripts/normalize_plural_tags.rb +0 -335
data/lib/tasks/doc.rake
DELETED
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'English'
|
|
4
|
-
namespace :htm do
|
|
5
|
-
namespace :doc do
|
|
6
|
-
desc "Build YARD API documentation (markdown format for MkDocs)"
|
|
7
|
-
task :yard do
|
|
8
|
-
require "fileutils"
|
|
9
|
-
|
|
10
|
-
output_dir = "docs/api/yard"
|
|
11
|
-
|
|
12
|
-
puts "Building YARD documentation (markdown format)..."
|
|
13
|
-
puts "Output directory: #{output_dir}"
|
|
14
|
-
puts
|
|
15
|
-
|
|
16
|
-
# Clean previous output
|
|
17
|
-
FileUtils.rm_rf(output_dir)
|
|
18
|
-
FileUtils.mkdir_p(output_dir)
|
|
19
|
-
|
|
20
|
-
# Build YARD documentation in markdown format
|
|
21
|
-
# Requires yard-markdown plugin to be installed
|
|
22
|
-
options = [
|
|
23
|
-
"--plugin markdown",
|
|
24
|
-
"--output-dir #{output_dir}",
|
|
25
|
-
"--format markdown",
|
|
26
|
-
"--title 'HTM - Hierarchical Temporal Memory API'",
|
|
27
|
-
"--markup markdown",
|
|
28
|
-
"--charset utf-8",
|
|
29
|
-
"--protected",
|
|
30
|
-
"--no-private",
|
|
31
|
-
"lib/**/*.rb",
|
|
32
|
-
"-",
|
|
33
|
-
"README.md",
|
|
34
|
-
"CHANGELOG.md"
|
|
35
|
-
]
|
|
36
|
-
|
|
37
|
-
system("yard doc #{options.join(' ')}")
|
|
38
|
-
|
|
39
|
-
if $CHILD_STATUS.success?
|
|
40
|
-
# Post-process markdown files for MkDocs compatibility
|
|
41
|
-
fix_yard_anchors_for_mkdocs(output_dir)
|
|
42
|
-
|
|
43
|
-
# Create MkDocs index page for the YARD docs
|
|
44
|
-
create_yard_index_page(output_dir)
|
|
45
|
-
|
|
46
|
-
puts
|
|
47
|
-
puts "Documentation built successfully!"
|
|
48
|
-
puts "YARD docs: #{output_dir}/"
|
|
49
|
-
puts "MkDocs index: docs/api/yard-reference.md"
|
|
50
|
-
else
|
|
51
|
-
puts
|
|
52
|
-
puts "Failed to build documentation. Make sure YARD and yard-markdown are installed:"
|
|
53
|
-
puts " gem install yard yard-markdown"
|
|
54
|
-
exit 1
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
# Convert YARD anchor format to MkDocs-compatible format
|
|
59
|
-
# YARD generates: ## method_name() [](#method-i-method_name)
|
|
60
|
-
# MkDocs needs: ## method_name() {: #method-i-method_name }
|
|
61
|
-
#
|
|
62
|
-
# Also escapes YARD annotations (@param, @return, etc.) to prevent
|
|
63
|
-
# pymdownx.magiclink from treating them as GitHub @mentions
|
|
64
|
-
def fix_yard_anchors_for_mkdocs(output_dir)
|
|
65
|
-
files_fixed = 0
|
|
66
|
-
anchors_fixed = 0
|
|
67
|
-
mentions_escaped = 0
|
|
68
|
-
|
|
69
|
-
Dir.glob(File.join(output_dir, "**/*.md")).each do |file|
|
|
70
|
-
content = File.read(file)
|
|
71
|
-
original = content.dup
|
|
72
|
-
|
|
73
|
-
# Pattern 0: Fix malformed YARD output where code fence is joined with heading
|
|
74
|
-
# "```## method_name() [](#anchor)" -> "```\n## method_name() {: #anchor }"
|
|
75
|
-
content.gsub!(/^(```)(\#{1,6}\s+.+?)\s*\[\]\(\#([^)]+)\)\s*$/) do
|
|
76
|
-
fence = Regexp.last_match(1)
|
|
77
|
-
heading = Regexp.last_match(2)
|
|
78
|
-
anchor_id = Regexp.last_match(3)
|
|
79
|
-
anchors_fixed += 1
|
|
80
|
-
"#{fence}\n#{heading} {: ##{anchor_id} }"
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
# Pattern 1: Heading with trailing anchor link
|
|
84
|
-
# "## method_name() [](#anchor-id)" -> "## method_name() {: #anchor-id }"
|
|
85
|
-
# Use %r{} to avoid # interpolation issues in regex
|
|
86
|
-
content.gsub!(/^(\#{1,6}\s+.+?)\s*\[\]\(\#([^)]+)\)\s*$/) do
|
|
87
|
-
heading = Regexp.last_match(1)
|
|
88
|
-
anchor_id = Regexp.last_match(2)
|
|
89
|
-
anchors_fixed += 1
|
|
90
|
-
"#{heading} {: ##{anchor_id} }"
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
# Pattern 2: Attribute headings with [RW]/[R]/[W] markers
|
|
94
|
-
# "## attr_name[RW] [](#attribute-i-attr_name)" -> "## attr_name [RW] {: #attribute-i-attr_name }"
|
|
95
|
-
content.gsub!(/^(\#{1,6}\s+\w+)\[([RW]+)\]\s*\[\]\(\#([^)]+)\)\s*$/) do
|
|
96
|
-
heading = Regexp.last_match(1)
|
|
97
|
-
rw_marker = Regexp.last_match(2)
|
|
98
|
-
anchor_id = Regexp.last_match(3)
|
|
99
|
-
anchors_fixed += 1
|
|
100
|
-
"#{heading} [#{rw_marker}] {: ##{anchor_id} }"
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
# Pattern 3: Escape YARD annotations to prevent GitHub @mention linking
|
|
104
|
-
# "**@param**" -> "**`@param`**" (inline code prevents magiclink processing)
|
|
105
|
-
# Common YARD tags: @param, @return, @raise, @yield, @yieldparam, @yieldreturn,
|
|
106
|
-
# @option, @overload, @example, @see, @note, @todo, @deprecated
|
|
107
|
-
yard_tags = %w[param return raise yield yieldparam yieldreturn option overload example see note todo deprecated abstract api author
|
|
108
|
-
since version private]
|
|
109
|
-
yard_tags.each do |tag|
|
|
110
|
-
# Match **@tag** and replace with **`@tag`**
|
|
111
|
-
if content.gsub!(/\*\*@#{tag}\*\*/i, "**`@#{tag}`**")
|
|
112
|
-
mentions_escaped += 1
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
if content != original
|
|
117
|
-
File.write(file, content)
|
|
118
|
-
files_fixed += 1
|
|
119
|
-
end
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
return unless files_fixed.positive?
|
|
123
|
-
puts "Fixed #{anchors_fixed} anchors in #{files_fixed} files for MkDocs compatibility"
|
|
124
|
-
puts "Escaped #{mentions_escaped} YARD annotations to prevent @mention linking" if mentions_escaped.positive?
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
def create_yard_index_page(yard_output_dir)
|
|
128
|
-
# Generate list of documented classes/modules from YARD output
|
|
129
|
-
class_list = extract_yard_classes(yard_output_dir)
|
|
130
|
-
|
|
131
|
-
content = <<~MARKDOWN
|
|
132
|
-
# YARD API Reference
|
|
133
|
-
|
|
134
|
-
Complete API documentation generated by [YARD](https://yardoc.org/) with [yard-markdown](https://github.com/skatkov/yard-markdown).
|
|
135
|
-
|
|
136
|
-
<div class="grid cards" markdown>
|
|
137
|
-
|
|
138
|
-
- :material-book-open-variant:{ .lg .middle } **API Documentation**
|
|
139
|
-
|
|
140
|
-
---
|
|
141
|
-
|
|
142
|
-
Browse the complete API reference with method signatures, parameters, and examples.
|
|
143
|
-
|
|
144
|
-
- :material-chart-bar:{ .lg .middle } **Documentation Coverage**
|
|
145
|
-
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
Run `rake htm:doc:stats` to see documentation coverage statistics.
|
|
149
|
-
|
|
150
|
-
</div>
|
|
151
|
-
|
|
152
|
-
## Classes & Modules
|
|
153
|
-
|
|
154
|
-
| Class/Module | Description |
|
|
155
|
-
|--------------|-------------|
|
|
156
|
-
#{class_list}
|
|
157
|
-
|
|
158
|
-
## Generating Documentation
|
|
159
|
-
|
|
160
|
-
```bash
|
|
161
|
-
# Build YARD documentation
|
|
162
|
-
rake htm:doc:yard
|
|
163
|
-
|
|
164
|
-
# Start live-reload server (HTML mode)
|
|
165
|
-
rake htm:doc:server
|
|
166
|
-
|
|
167
|
-
# Show coverage statistics
|
|
168
|
-
rake htm:doc:stats
|
|
169
|
-
```
|
|
170
|
-
MARKDOWN
|
|
171
|
-
|
|
172
|
-
File.write("docs/api/yard-reference.md", content)
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
def extract_yard_classes(yard_output_dir)
|
|
176
|
-
# Class descriptions for known classes
|
|
177
|
-
descriptions = {
|
|
178
|
-
"HTM" => "Main API class for memory operations",
|
|
179
|
-
"Configuration" => "Multi-provider LLM configuration",
|
|
180
|
-
"Database" => "Database schema and connection management",
|
|
181
|
-
"EmbeddingService" => "Vector embedding generation service",
|
|
182
|
-
"LongTermMemory" => "PostgreSQL-backed permanent storage",
|
|
183
|
-
"WorkingMemory" => "Token-limited in-memory cache",
|
|
184
|
-
"TagService" => "Hierarchical tag extraction service",
|
|
185
|
-
"Observability" => "Metrics and logging instrumentation",
|
|
186
|
-
"CircuitBreaker" => "Fault tolerance for external services",
|
|
187
|
-
"Timeframe" => "Time-based query filtering",
|
|
188
|
-
"TimeframeExtractor" => "Natural language time parsing",
|
|
189
|
-
"JobAdapter" => "Background job abstraction layer"
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
# Dynamically discover classes from YARD markdown output
|
|
193
|
-
classes = []
|
|
194
|
-
|
|
195
|
-
# Check for markdown files in output directory
|
|
196
|
-
Dir.glob(File.join(yard_output_dir, "**/*.md")).each do |file|
|
|
197
|
-
relative_path = file.sub("#{yard_output_dir}/", "")
|
|
198
|
-
basename = File.basename(file, ".md")
|
|
199
|
-
|
|
200
|
-
# Skip index files and non-class files
|
|
201
|
-
next if %w[index _index].include?(basename)
|
|
202
|
-
next if basename.start_with?("_")
|
|
203
|
-
|
|
204
|
-
# Determine class name from path
|
|
205
|
-
class_name = relative_path.sub(".md", "").gsub("/", "::")
|
|
206
|
-
|
|
207
|
-
# Skip error classes and internal classes
|
|
208
|
-
next if class_name.end_with?("Error")
|
|
209
|
-
next if class_name.include?("Railtie")
|
|
210
|
-
next if class_name.include?("SequelConfig")
|
|
211
|
-
|
|
212
|
-
# Get description
|
|
213
|
-
simple_name = basename
|
|
214
|
-
desc = descriptions[simple_name] || "#{class_name} class"
|
|
215
|
-
|
|
216
|
-
classes << [class_name, desc, "yard/#{relative_path}"]
|
|
217
|
-
end
|
|
218
|
-
|
|
219
|
-
# If no markdown files found, fall back to checking for HTML (in case yard-markdown not installed)
|
|
220
|
-
if classes.empty?
|
|
221
|
-
htm_file = File.join(yard_output_dir, "HTM.html")
|
|
222
|
-
if File.exist?(htm_file)
|
|
223
|
-
classes << ["HTM", descriptions["HTM"] || "Main module", "yard/HTM.html"]
|
|
224
|
-
end
|
|
225
|
-
|
|
226
|
-
htm_dir = File.join(yard_output_dir, "HTM")
|
|
227
|
-
if Dir.exist?(htm_dir)
|
|
228
|
-
Dir.glob(File.join(htm_dir, "*.html")).each do |file|
|
|
229
|
-
basename = File.basename(file, ".html")
|
|
230
|
-
next if basename.end_with?("Error")
|
|
231
|
-
next if basename == "Railtie"
|
|
232
|
-
next if basename == "SequelConfig"
|
|
233
|
-
|
|
234
|
-
desc = descriptions[basename] || "#{basename} class"
|
|
235
|
-
classes << ["HTM::#{basename}", desc, "yard/HTM/#{basename}.html"]
|
|
236
|
-
end
|
|
237
|
-
end
|
|
238
|
-
end
|
|
239
|
-
|
|
240
|
-
classes.map do |name, desc, path|
|
|
241
|
-
"| [#{name}](#{path}) | #{desc} |"
|
|
242
|
-
end.join("\n")
|
|
243
|
-
end
|
|
244
|
-
|
|
245
|
-
desc "Start YARD documentation server (live reload)"
|
|
246
|
-
task :server, [:port] do |_t, args|
|
|
247
|
-
port = args[:port] || 8808
|
|
248
|
-
|
|
249
|
-
puts "Starting YARD documentation server on http://localhost:#{port}"
|
|
250
|
-
puts "Press Ctrl+C to stop"
|
|
251
|
-
puts
|
|
252
|
-
|
|
253
|
-
exec("yard server --reload --port #{port}")
|
|
254
|
-
end
|
|
255
|
-
|
|
256
|
-
desc "Show documentation coverage statistics"
|
|
257
|
-
task :stats do
|
|
258
|
-
puts "YARD Documentation Coverage:"
|
|
259
|
-
puts
|
|
260
|
-
system("yard stats --list-undoc lib/**/*.rb")
|
|
261
|
-
end
|
|
262
|
-
|
|
263
|
-
desc "Fix YARD anchor links for MkDocs compatibility"
|
|
264
|
-
task :fix_anchors do
|
|
265
|
-
output_dir = "docs/api/yard"
|
|
266
|
-
|
|
267
|
-
unless Dir.exist?(output_dir)
|
|
268
|
-
puts "YARD output directory not found: #{output_dir}"
|
|
269
|
-
puts "Run 'rake htm:doc:yard' first to generate documentation"
|
|
270
|
-
exit 1
|
|
271
|
-
end
|
|
272
|
-
|
|
273
|
-
fix_yard_anchors_for_mkdocs(output_dir)
|
|
274
|
-
puts "Done! Run 'mkdocs build' to verify no anchor warnings."
|
|
275
|
-
end
|
|
276
|
-
|
|
277
|
-
desc "Clean generated documentation"
|
|
278
|
-
task :clean do
|
|
279
|
-
require "fileutils"
|
|
280
|
-
|
|
281
|
-
dirs_to_clean = ["docs/api/yard", ".yardoc"]
|
|
282
|
-
files_to_clean = ["docs/api/yard-reference.md"]
|
|
283
|
-
|
|
284
|
-
dirs_to_clean.each do |dir|
|
|
285
|
-
if Dir.exist?(dir)
|
|
286
|
-
FileUtils.rm_rf(dir)
|
|
287
|
-
puts "Removed: #{dir}"
|
|
288
|
-
end
|
|
289
|
-
end
|
|
290
|
-
|
|
291
|
-
files_to_clean.each do |file|
|
|
292
|
-
if File.exist?(file)
|
|
293
|
-
FileUtils.rm(file)
|
|
294
|
-
puts "Removed: #{file}"
|
|
295
|
-
end
|
|
296
|
-
end
|
|
297
|
-
|
|
298
|
-
puts "Documentation cleaned."
|
|
299
|
-
end
|
|
300
|
-
end
|
|
301
|
-
end
|
data/lib/tasks/files.rake
DELETED
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# HTM File Loading Tasks
|
|
4
|
-
#
|
|
5
|
-
# These tasks are available to any application using the HTM gem.
|
|
6
|
-
# Add to your application's Rakefile:
|
|
7
|
-
#
|
|
8
|
-
# require 'htm/tasks'
|
|
9
|
-
#
|
|
10
|
-
|
|
11
|
-
namespace :htm do
|
|
12
|
-
namespace :files do
|
|
13
|
-
desc "Load a markdown file into long-term memory. Usage: rake htm:files:load[path/to/file.md]"
|
|
14
|
-
task :load, [:path] do |_t, args|
|
|
15
|
-
path = args[:path]
|
|
16
|
-
unless path
|
|
17
|
-
puts "Error: File path required."
|
|
18
|
-
puts "Usage: rake 'htm:files:load[path/to/file.md]'"
|
|
19
|
-
exit 1
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
unless File.exist?(path)
|
|
23
|
-
puts "Error: File not found: #{path}"
|
|
24
|
-
exit 1
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
# Ensure database connection
|
|
28
|
-
HTM::SequelConfig.establish_connection!
|
|
29
|
-
|
|
30
|
-
htm = HTM.new(robot_name: "FileLoader")
|
|
31
|
-
force = ENV['FORCE'] == 'true'
|
|
32
|
-
|
|
33
|
-
puts "Loading file: #{path}#{' (force)' if force}"
|
|
34
|
-
result = htm.load_file(path, force: force)
|
|
35
|
-
|
|
36
|
-
if result[:skipped]
|
|
37
|
-
puts "Skipped: File unchanged since last sync."
|
|
38
|
-
puts "Use FORCE=true to reload anyway."
|
|
39
|
-
else
|
|
40
|
-
puts "Loaded successfully:"
|
|
41
|
-
puts " File source ID: #{result[:file_source_id]}"
|
|
42
|
-
puts " Chunks created: #{result[:chunks_created]}"
|
|
43
|
-
puts " Chunks updated: #{result[:chunks_updated]}"
|
|
44
|
-
puts " Chunks deleted: #{result[:chunks_deleted]}"
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
desc "Load all markdown files from a directory. Usage: rake htm:files:load_dir[path/to/dir]"
|
|
49
|
-
task :load_dir, [:path, :pattern] do |_t, args|
|
|
50
|
-
path = args[:path]
|
|
51
|
-
unless path
|
|
52
|
-
puts "Error: Directory path required."
|
|
53
|
-
puts "Usage: rake 'htm:files:load_dir[path/to/dir]'"
|
|
54
|
-
puts " rake 'htm:files:load_dir[path/to/dir,**/*.md]'"
|
|
55
|
-
exit 1
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
unless File.directory?(path)
|
|
59
|
-
puts "Error: Directory not found: #{path}"
|
|
60
|
-
exit 1
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
# Ensure database connection
|
|
64
|
-
HTM::SequelConfig.establish_connection!
|
|
65
|
-
|
|
66
|
-
htm = HTM.new(robot_name: "FileLoader")
|
|
67
|
-
pattern = args[:pattern] || '**/*.md'
|
|
68
|
-
force = ENV['FORCE'] == 'true'
|
|
69
|
-
|
|
70
|
-
puts "Loading files from: #{path}"
|
|
71
|
-
puts "Pattern: #{pattern}#{' (force)' if force}"
|
|
72
|
-
puts
|
|
73
|
-
|
|
74
|
-
results = htm.load_directory(path, pattern: pattern, force: force)
|
|
75
|
-
|
|
76
|
-
total_created = 0
|
|
77
|
-
total_updated = 0
|
|
78
|
-
total_deleted = 0
|
|
79
|
-
skipped = 0
|
|
80
|
-
|
|
81
|
-
results.each do |result|
|
|
82
|
-
if result[:skipped]
|
|
83
|
-
skipped += 1
|
|
84
|
-
else
|
|
85
|
-
total_created += result[:chunks_created]
|
|
86
|
-
total_updated += result[:chunks_updated]
|
|
87
|
-
total_deleted += result[:chunks_deleted]
|
|
88
|
-
puts " #{result[:file_path]}: #{result[:chunks_created]} created, #{result[:chunks_updated]} updated, #{result[:chunks_deleted]} deleted"
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
puts
|
|
93
|
-
puts "Summary:"
|
|
94
|
-
puts " Files processed: #{results.size}"
|
|
95
|
-
puts " Files skipped (unchanged): #{skipped}"
|
|
96
|
-
puts " Total chunks created: #{total_created}"
|
|
97
|
-
puts " Total chunks updated: #{total_updated}"
|
|
98
|
-
puts " Total chunks deleted: #{total_deleted}"
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
desc "List all loaded file sources"
|
|
102
|
-
task :list do
|
|
103
|
-
# Ensure database connection
|
|
104
|
-
HTM::SequelConfig.establish_connection!
|
|
105
|
-
|
|
106
|
-
sources = HTM::Models::FileSource.order(:file_path)
|
|
107
|
-
count = sources.count
|
|
108
|
-
|
|
109
|
-
if count.zero?
|
|
110
|
-
puts "No files loaded."
|
|
111
|
-
next
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
puts "Loaded files (#{count}):"
|
|
115
|
-
puts "-" * 80
|
|
116
|
-
|
|
117
|
-
sources.each do |source|
|
|
118
|
-
chunks = source.chunks.count
|
|
119
|
-
sync_status = ""
|
|
120
|
-
if File.exist?(source.file_path)
|
|
121
|
-
current_mtime = File.mtime(source.file_path)
|
|
122
|
-
sync_status = source.needs_sync?(current_mtime) ? " [needs sync]" : ""
|
|
123
|
-
else
|
|
124
|
-
sync_status = " [missing]"
|
|
125
|
-
end
|
|
126
|
-
puts " #{source.file_path}"
|
|
127
|
-
puts " ID: #{source.id} | Chunks: #{chunks} | Last synced: #{source.last_synced_at&.strftime('%Y-%m-%d %H:%M')}#{sync_status}"
|
|
128
|
-
end
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
desc "Show details for a loaded file. Usage: rake htm:files:info[path/to/file.md]"
|
|
132
|
-
task :info, [:path] do |_t, args|
|
|
133
|
-
path = args[:path]
|
|
134
|
-
unless path
|
|
135
|
-
puts "Error: File path required."
|
|
136
|
-
puts "Usage: rake 'htm:files:info[path/to/file.md]'"
|
|
137
|
-
exit 1
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
# Ensure database connection
|
|
141
|
-
HTM::SequelConfig.establish_connection!
|
|
142
|
-
|
|
143
|
-
# Try to find by exact path or expanded path
|
|
144
|
-
source = HTM::Models::FileSource.first(file_path: path) ||
|
|
145
|
-
HTM::Models::FileSource.first(file_path: File.expand_path(path))
|
|
146
|
-
|
|
147
|
-
unless source
|
|
148
|
-
puts "Error: File not loaded: #{path}"
|
|
149
|
-
exit 1
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
puts "File: #{source.file_path}"
|
|
153
|
-
puts "-" * 60
|
|
154
|
-
puts " ID: #{source.id}"
|
|
155
|
-
puts " File size: #{source.file_size} bytes"
|
|
156
|
-
puts " Last synced: #{source.last_synced_at}"
|
|
157
|
-
|
|
158
|
-
if File.exist?(source.file_path)
|
|
159
|
-
current_mtime = File.mtime(source.file_path)
|
|
160
|
-
puts " Needs sync: #{source.needs_sync?(current_mtime) ? 'Yes' : 'No'}"
|
|
161
|
-
else
|
|
162
|
-
puts " Needs sync: File missing!"
|
|
163
|
-
end
|
|
164
|
-
|
|
165
|
-
puts " Created: #{source.created_at}"
|
|
166
|
-
puts
|
|
167
|
-
|
|
168
|
-
if source.frontmatter.any?
|
|
169
|
-
puts "Frontmatter:"
|
|
170
|
-
source.frontmatter.each do |key, value|
|
|
171
|
-
puts " #{key}: #{value}"
|
|
172
|
-
end
|
|
173
|
-
puts
|
|
174
|
-
end
|
|
175
|
-
|
|
176
|
-
chunks = source.chunks
|
|
177
|
-
puts "Chunks (#{chunks.count}):"
|
|
178
|
-
chunks.each_with_index do |chunk, idx|
|
|
179
|
-
preview = chunk.content[0..60].gsub("\n", " ")
|
|
180
|
-
preview += "..." if chunk.content.length > 60
|
|
181
|
-
puts " [#{idx}] #{preview}"
|
|
182
|
-
end
|
|
183
|
-
end
|
|
184
|
-
|
|
185
|
-
desc "Unload a file from memory. Usage: rake htm:files:unload[path/to/file.md]"
|
|
186
|
-
task :unload, [:path] do |_t, args|
|
|
187
|
-
path = args[:path]
|
|
188
|
-
unless path
|
|
189
|
-
puts "Error: File path required."
|
|
190
|
-
puts "Usage: rake 'htm:files:unload[path/to/file.md]'"
|
|
191
|
-
exit 1
|
|
192
|
-
end
|
|
193
|
-
|
|
194
|
-
# Ensure database connection
|
|
195
|
-
HTM::SequelConfig.establish_connection!
|
|
196
|
-
|
|
197
|
-
htm = HTM.new(robot_name: "FileLoader")
|
|
198
|
-
result = htm.unload_file(path)
|
|
199
|
-
|
|
200
|
-
if result
|
|
201
|
-
puts "Unloaded: #{path}"
|
|
202
|
-
else
|
|
203
|
-
puts "File not found: #{path}"
|
|
204
|
-
end
|
|
205
|
-
end
|
|
206
|
-
|
|
207
|
-
desc "Sync all loaded files (reload changed files)"
|
|
208
|
-
task :sync do
|
|
209
|
-
# Ensure database connection
|
|
210
|
-
HTM::SequelConfig.establish_connection!
|
|
211
|
-
|
|
212
|
-
htm = HTM.new(robot_name: "FileLoader")
|
|
213
|
-
sources = HTM::Models::FileSource.all
|
|
214
|
-
|
|
215
|
-
if sources.none?
|
|
216
|
-
puts "No files loaded."
|
|
217
|
-
next
|
|
218
|
-
end
|
|
219
|
-
|
|
220
|
-
puts "Syncing #{sources.count} files..."
|
|
221
|
-
puts
|
|
222
|
-
|
|
223
|
-
synced = 0
|
|
224
|
-
skipped = 0
|
|
225
|
-
missing = 0
|
|
226
|
-
|
|
227
|
-
sources.each do |source|
|
|
228
|
-
unless File.exist?(source.file_path)
|
|
229
|
-
puts " [missing] #{source.file_path}"
|
|
230
|
-
missing += 1
|
|
231
|
-
next
|
|
232
|
-
end
|
|
233
|
-
|
|
234
|
-
current_mtime = File.mtime(source.file_path)
|
|
235
|
-
unless source.needs_sync?(current_mtime)
|
|
236
|
-
skipped += 1
|
|
237
|
-
next
|
|
238
|
-
end
|
|
239
|
-
|
|
240
|
-
result = htm.load_file(source.file_path)
|
|
241
|
-
puts " [synced] #{source.file_path}: #{result[:chunks_created]} created, #{result[:chunks_updated]} updated, #{result[:chunks_deleted]} deleted"
|
|
242
|
-
synced += 1
|
|
243
|
-
end
|
|
244
|
-
|
|
245
|
-
puts
|
|
246
|
-
puts "Summary:"
|
|
247
|
-
puts " Synced: #{synced}"
|
|
248
|
-
puts " Skipped (unchanged): #{skipped}"
|
|
249
|
-
puts " Missing files: #{missing}"
|
|
250
|
-
end
|
|
251
|
-
|
|
252
|
-
desc "Show file loading statistics"
|
|
253
|
-
task :stats do
|
|
254
|
-
# Ensure database connection
|
|
255
|
-
HTM::SequelConfig.establish_connection!
|
|
256
|
-
|
|
257
|
-
total_sources = HTM::Models::FileSource.count
|
|
258
|
-
total_chunks = HTM::Models::Node.exclude(source_id: nil).count
|
|
259
|
-
|
|
260
|
-
# Count files needing sync (checking actual file mtime)
|
|
261
|
-
needs_sync = 0
|
|
262
|
-
missing = 0
|
|
263
|
-
HTM::Models::FileSource.paged_each do |source|
|
|
264
|
-
if File.exist?(source.file_path)
|
|
265
|
-
current_mtime = File.mtime(source.file_path)
|
|
266
|
-
needs_sync += 1 if source.needs_sync?(current_mtime)
|
|
267
|
-
else
|
|
268
|
-
missing += 1
|
|
269
|
-
end
|
|
270
|
-
end
|
|
271
|
-
|
|
272
|
-
puts "File Loading Statistics"
|
|
273
|
-
puts "=" * 40
|
|
274
|
-
puts " Total files loaded: #{total_sources}"
|
|
275
|
-
puts " Total chunks: #{total_chunks}"
|
|
276
|
-
puts " Files needing sync: #{needs_sync}"
|
|
277
|
-
puts " Missing files: #{missing}" if missing.positive?
|
|
278
|
-
|
|
279
|
-
if total_sources.positive?
|
|
280
|
-
avg_chunks = (total_chunks.to_f / total_sources).round(1)
|
|
281
|
-
puts " Average chunks per file: #{avg_chunks}"
|
|
282
|
-
end
|
|
283
|
-
end
|
|
284
|
-
end
|
|
285
|
-
end
|