htm 0.0.18 → 0.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +119 -1
  3. data/README.md +12 -0
  4. data/Rakefile +104 -18
  5. data/db/migrate/00001_enable_extensions.rb +9 -5
  6. data/db/migrate/00002_create_robots.rb +18 -6
  7. data/db/migrate/00003_create_file_sources.rb +30 -17
  8. data/db/migrate/00004_create_nodes.rb +60 -48
  9. data/db/migrate/00005_create_tags.rb +24 -12
  10. data/db/migrate/00006_create_node_tags.rb +28 -13
  11. data/db/migrate/00007_create_robot_nodes.rb +40 -26
  12. data/db/schema.sql +17 -1
  13. data/db/seeds.rb +34 -34
  14. data/docs/api/embedding-service.md +140 -110
  15. data/docs/api/yard/HTM/ActiveRecordConfig.md +6 -0
  16. data/docs/api/yard/HTM/Config.md +173 -0
  17. data/docs/api/yard/HTM/ConfigSection.md +28 -0
  18. data/docs/api/yard/HTM/Database.md +1 -1
  19. data/docs/api/yard/HTM/Railtie.md +2 -2
  20. data/docs/api/yard/HTM.md +0 -57
  21. data/docs/api/yard/index.csv +76 -61
  22. data/docs/api/yard-reference.md +2 -1
  23. data/docs/architecture/adrs/003-ollama-embeddings.md +45 -36
  24. data/docs/architecture/adrs/004-hive-mind.md +1 -1
  25. data/docs/architecture/adrs/008-robot-identification.md +1 -1
  26. data/docs/architecture/index.md +11 -9
  27. data/docs/architecture/overview.md +11 -7
  28. data/docs/assets/images/balanced-strategy-decay.svg +41 -0
  29. data/docs/assets/images/class-hierarchy.svg +1 -1
  30. data/docs/assets/images/eviction-priority.svg +43 -0
  31. data/docs/assets/images/exception-hierarchy.svg +2 -2
  32. data/docs/assets/images/hive-mind-shared-memory.svg +52 -0
  33. data/docs/assets/images/htm-architecture-overview.svg +3 -3
  34. data/docs/assets/images/htm-core-components.svg +4 -4
  35. data/docs/assets/images/htm-layered-architecture.svg +1 -1
  36. data/docs/assets/images/htm-memory-addition-flow.svg +2 -2
  37. data/docs/assets/images/htm-memory-recall-flow.svg +2 -2
  38. data/docs/assets/images/memory-topology.svg +53 -0
  39. data/docs/assets/images/two-tier-memory-architecture.svg +55 -0
  40. data/docs/database/naming-convention.md +244 -0
  41. data/docs/database_rake_tasks.md +31 -0
  42. data/docs/development/rake-tasks.md +80 -35
  43. data/docs/development/setup.md +76 -44
  44. data/docs/examples/basic-usage.md +133 -0
  45. data/docs/examples/config-files.md +170 -0
  46. data/docs/examples/file-loading.md +208 -0
  47. data/docs/examples/index.md +116 -0
  48. data/docs/examples/llm-configuration.md +168 -0
  49. data/docs/examples/mcp-client.md +172 -0
  50. data/docs/examples/rails-integration.md +173 -0
  51. data/docs/examples/robot-groups.md +210 -0
  52. data/docs/examples/sinatra-integration.md +218 -0
  53. data/docs/examples/standalone-app.md +216 -0
  54. data/docs/examples/telemetry.md +224 -0
  55. data/docs/examples/timeframes.md +143 -0
  56. data/docs/getting-started/installation.md +97 -40
  57. data/docs/getting-started/quick-start.md +28 -11
  58. data/docs/guides/configuration.md +515 -0
  59. data/docs/guides/file-loading.md +322 -0
  60. data/docs/guides/getting-started.md +40 -9
  61. data/docs/guides/index.md +3 -3
  62. data/docs/guides/mcp-server.md +100 -13
  63. data/docs/guides/propositions.md +264 -0
  64. data/docs/guides/recalling-memories.md +4 -4
  65. data/docs/guides/search-strategies.md +3 -3
  66. data/docs/guides/tags.md +318 -0
  67. data/docs/guides/telemetry.md +229 -0
  68. data/docs/index.md +8 -16
  69. data/docs/{architecture → robots}/hive-mind.md +8 -111
  70. data/docs/robots/index.md +73 -0
  71. data/docs/{guides → robots}/multi-robot.md +3 -3
  72. data/docs/{guides → robots}/robot-groups.md +8 -7
  73. data/docs/{architecture → robots}/two-tier-memory.md +13 -149
  74. data/docs/robots/why-robots.md +85 -0
  75. data/examples/.envrc +6 -0
  76. data/examples/.gitignore +2 -0
  77. data/examples/00_create_examples_db.rb +94 -0
  78. data/examples/{basic_usage.rb → 01_basic_usage.rb} +12 -16
  79. data/examples/{custom_llm_configuration.rb → 03_custom_llm_configuration.rb} +13 -3
  80. data/examples/{file_loader_usage.rb → 04_file_loader_usage.rb} +11 -14
  81. data/examples/{timeframe_demo.rb → 05_timeframe_demo.rb} +10 -3
  82. data/examples/{example_app → 06_example_app}/app.rb +15 -15
  83. data/examples/{cli_app → 07_cli_app}/htm_cli.rb +15 -22
  84. data/examples/08_sinatra_app/Gemfile.lock +241 -0
  85. data/examples/{sinatra_app → 08_sinatra_app}/app.rb +19 -18
  86. data/examples/{mcp_client.rb → 09_mcp_client.rb} +5 -8
  87. data/examples/{telemetry → 10_telemetry}/SETUP_README.md +1 -1
  88. data/examples/{telemetry → 10_telemetry}/demo.rb +14 -10
  89. data/examples/11_robot_groups/README.md +335 -0
  90. data/examples/{robot_groups → 11_robot_groups/lib}/robot_worker.rb +17 -3
  91. data/examples/{robot_groups → 11_robot_groups}/multi_process.rb +9 -9
  92. data/examples/{robot_groups → 11_robot_groups}/same_process.rb +9 -12
  93. data/examples/{rails_app → 12_rails_app}/Gemfile +3 -0
  94. data/examples/{rails_app → 12_rails_app}/Gemfile.lock +87 -58
  95. data/examples/{rails_app → 12_rails_app}/app/controllers/dashboard_controller.rb +10 -6
  96. data/examples/{rails_app → 12_rails_app}/app/controllers/files_controller.rb +5 -5
  97. data/examples/{rails_app → 12_rails_app}/app/controllers/memories_controller.rb +11 -7
  98. data/examples/{rails_app → 12_rails_app}/app/controllers/robots_controller.rb +8 -8
  99. data/examples/12_rails_app/app/controllers/tags_controller.rb +36 -0
  100. data/examples/{rails_app → 12_rails_app}/app/views/dashboard/index.html.erb +2 -2
  101. data/examples/{rails_app → 12_rails_app}/app/views/files/new.html.erb +5 -2
  102. data/examples/{rails_app → 12_rails_app}/app/views/memories/_memory_card.html.erb +3 -3
  103. data/examples/{rails_app → 12_rails_app}/app/views/memories/deleted.html.erb +3 -3
  104. data/examples/{rails_app → 12_rails_app}/app/views/memories/edit.html.erb +3 -3
  105. data/examples/{rails_app → 12_rails_app}/app/views/memories/show.html.erb +4 -4
  106. data/examples/{rails_app → 12_rails_app}/app/views/robots/index.html.erb +2 -2
  107. data/examples/{rails_app → 12_rails_app}/app/views/robots/show.html.erb +4 -4
  108. data/examples/{rails_app → 12_rails_app}/app/views/search/index.html.erb +1 -1
  109. data/examples/{rails_app → 12_rails_app}/app/views/tags/index.html.erb +2 -2
  110. data/examples/{rails_app → 12_rails_app}/app/views/tags/show.html.erb +1 -1
  111. data/examples/12_rails_app/config/initializers/htm.rb +7 -0
  112. data/examples/12_rails_app/config/initializers/rack.rb +5 -0
  113. data/examples/README.md +230 -211
  114. data/examples/examples_helper.rb +138 -0
  115. data/lib/htm/config/builder.rb +167 -0
  116. data/lib/htm/config/database.rb +317 -0
  117. data/lib/htm/config/defaults.yml +41 -13
  118. data/lib/htm/config/section.rb +74 -0
  119. data/lib/htm/config/validator.rb +83 -0
  120. data/lib/htm/config.rb +65 -361
  121. data/lib/htm/database.rb +85 -127
  122. data/lib/htm/errors.rb +14 -0
  123. data/lib/htm/integrations/sinatra.rb +13 -44
  124. data/lib/htm/job_adapter.rb +75 -1
  125. data/lib/htm/jobs/generate_embedding_job.rb +3 -4
  126. data/lib/htm/jobs/generate_propositions_job.rb +4 -5
  127. data/lib/htm/jobs/generate_tags_job.rb +16 -15
  128. data/lib/htm/loaders/defaults_loader.rb +23 -0
  129. data/lib/htm/loaders/markdown_loader.rb +17 -15
  130. data/lib/htm/loaders/xdg_config_loader.rb +9 -9
  131. data/lib/htm/long_term_memory/fulltext_search.rb +14 -14
  132. data/lib/htm/long_term_memory/hybrid_search.rb +396 -229
  133. data/lib/htm/long_term_memory/node_operations.rb +24 -23
  134. data/lib/htm/long_term_memory/relevance_scorer.rb +23 -20
  135. data/lib/htm/long_term_memory/robot_operations.rb +4 -4
  136. data/lib/htm/long_term_memory/tag_operations.rb +91 -77
  137. data/lib/htm/long_term_memory/vector_search.rb +4 -5
  138. data/lib/htm/long_term_memory.rb +13 -13
  139. data/lib/htm/mcp/cli.rb +115 -8
  140. data/lib/htm/mcp/resources.rb +4 -3
  141. data/lib/htm/mcp/server.rb +5 -4
  142. data/lib/htm/mcp/tools.rb +37 -28
  143. data/lib/htm/migration.rb +72 -0
  144. data/lib/htm/models/file_source.rb +52 -31
  145. data/lib/htm/models/node.rb +224 -108
  146. data/lib/htm/models/node_tag.rb +49 -28
  147. data/lib/htm/models/robot.rb +38 -27
  148. data/lib/htm/models/robot_node.rb +63 -35
  149. data/lib/htm/models/tag.rb +126 -123
  150. data/lib/htm/observability.rb +45 -41
  151. data/lib/htm/proposition_service.rb +76 -7
  152. data/lib/htm/railtie.rb +2 -2
  153. data/lib/htm/robot_group.rb +30 -18
  154. data/lib/htm/sequel_config.rb +215 -0
  155. data/lib/htm/sql_builder.rb +14 -16
  156. data/lib/htm/tag_service.rb +78 -0
  157. data/lib/htm/tasks.rb +3 -0
  158. data/lib/htm/version.rb +1 -1
  159. data/lib/htm/workflows/remember_workflow.rb +213 -0
  160. data/lib/htm.rb +27 -22
  161. data/lib/tasks/db.rake +0 -2
  162. data/lib/tasks/doc.rake +2 -2
  163. data/lib/tasks/files.rake +11 -18
  164. data/lib/tasks/htm.rake +190 -62
  165. data/lib/tasks/jobs.rake +179 -54
  166. data/lib/tasks/tags.rake +8 -13
  167. data/mkdocs.yml +33 -8
  168. data/scripts/backfill_parent_tags.rb +376 -0
  169. data/scripts/normalize_plural_tags.rb +335 -0
  170. metadata +168 -86
  171. data/docs/api/yard/HTM/Configuration.md +0 -240
  172. data/docs/telemetry.md +0 -391
  173. data/examples/rails_app/app/controllers/tags_controller.rb +0 -30
  174. data/examples/sinatra_app/Gemfile.lock +0 -166
  175. data/lib/htm/active_record_config.rb +0 -104
  176. /data/examples/{config_file_example → 02_config_file_example}/README.md +0 -0
  177. /data/examples/{config_file_example → 02_config_file_example}/config/htm.local.yml +0 -0
  178. /data/examples/{config_file_example → 02_config_file_example}/custom_config.yml +0 -0
  179. /data/examples/{config_file_example → 02_config_file_example}/show_config.rb +0 -0
  180. /data/examples/{example_app → 06_example_app}/Rakefile +0 -0
  181. /data/examples/{cli_app → 07_cli_app}/README.md +0 -0
  182. /data/examples/{sinatra_app → 08_sinatra_app}/Gemfile +0 -0
  183. /data/examples/{telemetry → 10_telemetry}/README.md +0 -0
  184. /data/examples/{telemetry → 10_telemetry}/grafana/dashboards/htm-metrics.json +0 -0
  185. /data/examples/{rails_app → 12_rails_app}/.gitignore +0 -0
  186. /data/examples/{rails_app → 12_rails_app}/Procfile.dev +0 -0
  187. /data/examples/{rails_app → 12_rails_app}/README.md +0 -0
  188. /data/examples/{rails_app → 12_rails_app}/Rakefile +0 -0
  189. /data/examples/{rails_app → 12_rails_app}/app/assets/stylesheets/application.css +0 -0
  190. /data/examples/{rails_app → 12_rails_app}/app/assets/stylesheets/inter-font.css +0 -0
  191. /data/examples/{rails_app → 12_rails_app}/app/controllers/application_controller.rb +0 -0
  192. /data/examples/{rails_app → 12_rails_app}/app/controllers/search_controller.rb +0 -0
  193. /data/examples/{rails_app → 12_rails_app}/app/javascript/application.js +0 -0
  194. /data/examples/{rails_app → 12_rails_app}/app/javascript/controllers/application.js +0 -0
  195. /data/examples/{rails_app → 12_rails_app}/app/javascript/controllers/index.js +0 -0
  196. /data/examples/{rails_app → 12_rails_app}/app/views/files/index.html.erb +0 -0
  197. /data/examples/{rails_app → 12_rails_app}/app/views/files/show.html.erb +0 -0
  198. /data/examples/{rails_app → 12_rails_app}/app/views/layouts/application.html.erb +0 -0
  199. /data/examples/{rails_app → 12_rails_app}/app/views/memories/index.html.erb +0 -0
  200. /data/examples/{rails_app → 12_rails_app}/app/views/memories/new.html.erb +0 -0
  201. /data/examples/{rails_app → 12_rails_app}/app/views/robots/new.html.erb +0 -0
  202. /data/examples/{rails_app → 12_rails_app}/app/views/shared/_navbar.html.erb +0 -0
  203. /data/examples/{rails_app → 12_rails_app}/app/views/shared/_stat_card.html.erb +0 -0
  204. /data/examples/{rails_app → 12_rails_app}/bin/dev +0 -0
  205. /data/examples/{rails_app → 12_rails_app}/bin/rails +0 -0
  206. /data/examples/{rails_app → 12_rails_app}/bin/rake +0 -0
  207. /data/examples/{rails_app → 12_rails_app}/config/application.rb +0 -0
  208. /data/examples/{rails_app → 12_rails_app}/config/boot.rb +0 -0
  209. /data/examples/{rails_app → 12_rails_app}/config/database.yml +0 -0
  210. /data/examples/{rails_app → 12_rails_app}/config/environment.rb +0 -0
  211. /data/examples/{rails_app → 12_rails_app}/config/importmap.rb +0 -0
  212. /data/examples/{rails_app → 12_rails_app}/config/routes.rb +0 -0
  213. /data/examples/{rails_app → 12_rails_app}/config/tailwind.config.js +0 -0
  214. /data/examples/{rails_app → 12_rails_app}/config.ru +0 -0
  215. /data/examples/{rails_app → 12_rails_app}/log/.keep +0 -0
  216. /data/examples/{rails_app → 12_rails_app}/tmp/local_secret.txt +0 -0
data/docs/api/yard/HTM.md CHANGED
@@ -6,61 +6,4 @@ examples/robot_groups/lib/htm/working_memory_channel.rb frozen_string_literal:
6
6
  true
7
7
 
8
8
 
9
- # Class Methods
10
- ## configure() {: #method-c-configure }
11
- Configure HTM
12
- **`@yield`** [config] Configuration object
13
-
14
- **`@yieldparam`** [HTM::Configuration]
15
-
16
-
17
- **`@example`**
18
- ```ruby
19
- HTM.configure do |config|
20
- config.embedding_generator = ->(text) { MyEmbedder.embed(text) }
21
- config.tag_extractor = ->(text, ontology) { MyTagger.extract(text, ontology) }
22
- end
23
- ```
24
- **`@example`**
25
- ```ruby
26
- HTM.configure # Uses RubyLLM defaults
27
- ```
28
- ## count_tokens(text ) {: #method-c-count_tokens }
29
- Count tokens using configured counter
30
- **`@param`** [String] Text to count tokens for
31
-
32
- **`@return`** [Integer] Token count
33
-
34
- ## embed(text ) {: #method-c-embed }
35
- Generate embedding using EmbeddingService
36
- **`@param`** [String] Text to embed
37
-
38
- **`@return`** [Array<Float>] Embedding vector (original, not padded)
39
-
40
- ## extract_propositions(text ) {: #method-c-extract_propositions }
41
- Extract propositions using PropositionService
42
- **`@param`** [String] Text to analyze
43
-
44
- **`@return`** [Array<String>] Extracted atomic propositions
45
-
46
- ## extract_tags(text , existing_ontology: []) {: #method-c-extract_tags }
47
- Extract tags using TagService
48
- **`@param`** [String] Text to analyze
49
-
50
- **`@param`** [Array<String>] Sample of existing tags for context
51
-
52
- **`@return`** [Array<String>] Extracted and validated tag names
53
-
54
- ## logger() {: #method-c-logger }
55
- Get configured logger
56
- **`@return`** [Logger] Configured logger instance
57
-
58
- ## reset_configuration!() {: #method-c-reset_configuration! }
59
- Reset configuration to defaults
60
- # Attributes
61
- ## configuration[RW] {: #attribute-c-configuration }
62
- Get current configuration
63
-
64
- **`@return`** [HTM::Configuration]
65
-
66
9
 
@@ -28,14 +28,6 @@ HTM::Telemetry.search_latency,Method,HTM/Telemetry.md#method-c-search_latency
28
28
  HTM::Telemetry.setup,Method,HTM/Telemetry.md#method-c-setup
29
29
  HTM::Telemetry.tag_latency,Method,HTM/Telemetry.md#method-c-tag_latency
30
30
  HTM,Class,HTM.md
31
- HTM.configure,Method,HTM.md#method-c-configure
32
- HTM.count_tokens,Method,HTM.md#method-c-count_tokens
33
- HTM.embed,Method,HTM.md#method-c-embed
34
- HTM.extract_propositions,Method,HTM.md#method-c-extract_propositions
35
- HTM.extract_tags,Method,HTM.md#method-c-extract_tags
36
- HTM.logger,Method,HTM.md#method-c-logger
37
- HTM.reset_configuration!,Method,HTM.md#method-c-reset_configuration!
38
- configuration,Attribute,HTM.md#attribute-c-configuration
39
31
  HTM::ActiveRecordConfig,Class,HTM/ActiveRecordConfig.md
40
32
  HTM::ActiveRecordConfig.connected?,Method,HTM/ActiveRecordConfig.md#method-c-connected?
41
33
  HTM::ActiveRecordConfig.connection_stats,Method,HTM/ActiveRecordConfig.md#method-c-connection_stats
@@ -55,59 +47,82 @@ failure_count,Attribute,HTM/CircuitBreaker.md#attribute-i-failure_count
55
47
  last_failure_time,Attribute,HTM/CircuitBreaker.md#attribute-i-last_failure_time
56
48
  name,Attribute,HTM/CircuitBreaker.md#attribute-i-name
57
49
  state,Attribute,HTM/CircuitBreaker.md#attribute-i-state
58
- HTM::Configuration,Class,HTM/Configuration.md
59
- HTM::Configuration.configure_ruby_llm,Method,HTM/Configuration.md#method-i-configure_ruby_llm
60
- HTM::Configuration.initialize,Method,HTM/Configuration.md#method-i-initialize
61
- HTM::Configuration.normalize_ollama_model,Method,HTM/Configuration.md#method-i-normalize_ollama_model
62
- HTM::Configuration.reset_to_defaults,Method,HTM/Configuration.md#method-i-reset_to_defaults
63
- HTM::Configuration.validate!,Method,HTM/Configuration.md#method-i-validate!
64
- anthropic_api_key,Attribute,HTM/Configuration.md#attribute-i-anthropic_api_key
65
- azure_api_key,Attribute,HTM/Configuration.md#attribute-i-azure_api_key
66
- azure_api_version,Attribute,HTM/Configuration.md#attribute-i-azure_api_version
67
- azure_endpoint,Attribute,HTM/Configuration.md#attribute-i-azure_endpoint
68
- bedrock_access_key,Attribute,HTM/Configuration.md#attribute-i-bedrock_access_key
69
- bedrock_region,Attribute,HTM/Configuration.md#attribute-i-bedrock_region
70
- bedrock_secret_key,Attribute,HTM/Configuration.md#attribute-i-bedrock_secret_key
71
- chunk_overlap,Attribute,HTM/Configuration.md#attribute-i-chunk_overlap
72
- chunk_size,Attribute,HTM/Configuration.md#attribute-i-chunk_size
73
- circuit_breaker_failure_threshold,Attribute,HTM/Configuration.md#attribute-i-circuit_breaker_failure_threshold
74
- circuit_breaker_half_open_max_calls,Attribute,HTM/Configuration.md#attribute-i-circuit_breaker_half_open_max_calls
75
- circuit_breaker_reset_timeout,Attribute,HTM/Configuration.md#attribute-i-circuit_breaker_reset_timeout
76
- connection_timeout,Attribute,HTM/Configuration.md#attribute-i-connection_timeout
77
- deepseek_api_key,Attribute,HTM/Configuration.md#attribute-i-deepseek_api_key
78
- embedding_dimensions,Attribute,HTM/Configuration.md#attribute-i-embedding_dimensions
79
- embedding_generator,Attribute,HTM/Configuration.md#attribute-i-embedding_generator
80
- embedding_model,Attribute,HTM/Configuration.md#attribute-i-embedding_model
81
- embedding_provider,Attribute,HTM/Configuration.md#attribute-i-embedding_provider
82
- embedding_timeout,Attribute,HTM/Configuration.md#attribute-i-embedding_timeout
83
- extract_propositions,Attribute,HTM/Configuration.md#attribute-i-extract_propositions
84
- gemini_api_key,Attribute,HTM/Configuration.md#attribute-i-gemini_api_key
85
- huggingface_api_key,Attribute,HTM/Configuration.md#attribute-i-huggingface_api_key
86
- job_backend,Attribute,HTM/Configuration.md#attribute-i-job_backend
87
- logger,Attribute,HTM/Configuration.md#attribute-i-logger
88
- max_embedding_dimension,Attribute,HTM/Configuration.md#attribute-i-max_embedding_dimension
89
- max_tag_depth,Attribute,HTM/Configuration.md#attribute-i-max_tag_depth
90
- ollama_url,Attribute,HTM/Configuration.md#attribute-i-ollama_url
91
- openai_api_key,Attribute,HTM/Configuration.md#attribute-i-openai_api_key
92
- openai_organization,Attribute,HTM/Configuration.md#attribute-i-openai_organization
93
- openai_project,Attribute,HTM/Configuration.md#attribute-i-openai_project
94
- openrouter_api_key,Attribute,HTM/Configuration.md#attribute-i-openrouter_api_key
95
- proposition_extractor,Attribute,HTM/Configuration.md#attribute-i-proposition_extractor
96
- proposition_model,Attribute,HTM/Configuration.md#attribute-i-proposition_model
97
- proposition_provider,Attribute,HTM/Configuration.md#attribute-i-proposition_provider
98
- proposition_timeout,Attribute,HTM/Configuration.md#attribute-i-proposition_timeout
99
- relevance_access_weight,Attribute,HTM/Configuration.md#attribute-i-relevance_access_weight
100
- relevance_recency_half_life_hours,Attribute,HTM/Configuration.md#attribute-i-relevance_recency_half_life_hours
101
- relevance_recency_weight,Attribute,HTM/Configuration.md#attribute-i-relevance_recency_weight
102
- relevance_semantic_weight,Attribute,HTM/Configuration.md#attribute-i-relevance_semantic_weight
103
- relevance_tag_weight,Attribute,HTM/Configuration.md#attribute-i-relevance_tag_weight
104
- tag_extractor,Attribute,HTM/Configuration.md#attribute-i-tag_extractor
105
- tag_model,Attribute,HTM/Configuration.md#attribute-i-tag_model
106
- tag_provider,Attribute,HTM/Configuration.md#attribute-i-tag_provider
107
- tag_timeout,Attribute,HTM/Configuration.md#attribute-i-tag_timeout
108
- telemetry_enabled,Attribute,HTM/Configuration.md#attribute-i-telemetry_enabled
109
- token_counter,Attribute,HTM/Configuration.md#attribute-i-token_counter
110
- week_start,Attribute,HTM/Configuration.md#attribute-i-week_start
50
+ HTM::ConfigSection,Class,HTM/ConfigSection.md
51
+ HTM::ConfigSection.[],Method,HTM/ConfigSection.md#method-i-[]
52
+ HTM::ConfigSection.[]=,Method,HTM/ConfigSection.md#method-i-[]=
53
+ HTM::ConfigSection.each,Method,HTM/ConfigSection.md#method-i-each
54
+ HTM::ConfigSection.initialize,Method,HTM/ConfigSection.md#method-i-initialize
55
+ HTM::ConfigSection.keys,Method,HTM/ConfigSection.md#method-i-keys
56
+ HTM::ConfigSection.merge,Method,HTM/ConfigSection.md#method-i-merge
57
+ HTM::ConfigSection.method_missing,Method,HTM/ConfigSection.md#method-i-method_missing
58
+ HTM::ConfigSection.respond_to_missing?,Method,HTM/ConfigSection.md#method-i-respond_to_missing?
59
+ HTM::ConfigSection.to_h,Method,HTM/ConfigSection.md#method-i-to_h
60
+ HTM::Config,Class,HTM/Config.md
61
+ HTM::Config.anthropic_api_key,Method,HTM/Config.md#method-i-anthropic_api_key
62
+ HTM::Config.azure_api_key,Method,HTM/Config.md#method-i-azure_api_key
63
+ HTM::Config.azure_api_version,Method,HTM/Config.md#method-i-azure_api_version
64
+ HTM::Config.azure_endpoint,Method,HTM/Config.md#method-i-azure_endpoint
65
+ HTM::Config.bedrock_access_key,Method,HTM/Config.md#method-i-bedrock_access_key
66
+ HTM::Config.bedrock_region,Method,HTM/Config.md#method-i-bedrock_region
67
+ HTM::Config.bedrock_secret_key,Method,HTM/Config.md#method-i-bedrock_secret_key
68
+ HTM::Config.chunk_overlap,Method,HTM/Config.md#method-i-chunk_overlap
69
+ HTM::Config.chunk_size,Method,HTM/Config.md#method-i-chunk_size
70
+ HTM::Config.circuit_breaker_failure_threshold,Method,HTM/Config.md#method-i-circuit_breaker_failure_threshold
71
+ HTM::Config.circuit_breaker_half_open_max_calls,Method,HTM/Config.md#method-i-circuit_breaker_half_open_max_calls
72
+ HTM::Config.circuit_breaker_reset_timeout,Method,HTM/Config.md#method-i-circuit_breaker_reset_timeout
73
+ HTM::Config.configure_ruby_llm,Method,HTM/Config.md#method-i-configure_ruby_llm
74
+ HTM::Config.database_config,Method,HTM/Config.md#method-i-database_config
75
+ HTM::Config.database_configured?,Method,HTM/Config.md#method-i-database_configured?
76
+ HTM::Config.database_url,Method,HTM/Config.md#method-i-database_url
77
+ HTM::Config.deepseek_api_key,Method,HTM/Config.md#method-i-deepseek_api_key
78
+ HTM::Config.development?,Method,HTM/Config.md#method-i-development?
79
+ HTM::Config.embedding_dimensions,Method,HTM/Config.md#method-i-embedding_dimensions
80
+ HTM::Config.embedding_model,Method,HTM/Config.md#method-i-embedding_model
81
+ HTM::Config.embedding_provider,Method,HTM/Config.md#method-i-embedding_provider
82
+ HTM::Config.embedding_timeout,Method,HTM/Config.md#method-i-embedding_timeout
83
+ HTM::Config.environment,Method,HTM/Config.md#method-i-environment
84
+ HTM::Config.extract_propositions,Method,HTM/Config.md#method-i-extract_propositions
85
+ HTM::Config.gemini_api_key,Method,HTM/Config.md#method-i-gemini_api_key
86
+ HTM::Config.huggingface_api_key,Method,HTM/Config.md#method-i-huggingface_api_key
87
+ HTM::Config.initialize,Method,HTM/Config.md#method-i-initialize
88
+ HTM::Config.job_backend,Method,HTM/Config.md#method-i-job_backend
89
+ HTM::Config.max_embedding_dimension,Method,HTM/Config.md#method-i-max_embedding_dimension
90
+ HTM::Config.max_tag_depth,Method,HTM/Config.md#method-i-max_tag_depth
91
+ HTM::Config.normalize_ollama_model,Method,HTM/Config.md#method-i-normalize_ollama_model
92
+ HTM::Config.ollama_url,Method,HTM/Config.md#method-i-ollama_url
93
+ HTM::Config.openai_api_key,Method,HTM/Config.md#method-i-openai_api_key
94
+ HTM::Config.openai_organization,Method,HTM/Config.md#method-i-openai_organization
95
+ HTM::Config.openai_project,Method,HTM/Config.md#method-i-openai_project
96
+ HTM::Config.openrouter_api_key,Method,HTM/Config.md#method-i-openrouter_api_key
97
+ HTM::Config.production?,Method,HTM/Config.md#method-i-production?
98
+ HTM::Config.proposition_model,Method,HTM/Config.md#method-i-proposition_model
99
+ HTM::Config.proposition_provider,Method,HTM/Config.md#method-i-proposition_provider
100
+ HTM::Config.proposition_timeout,Method,HTM/Config.md#method-i-proposition_timeout
101
+ HTM::Config.refresh_ollama_models!,Method,HTM/Config.md#method-i-refresh_ollama_models!
102
+ HTM::Config.relevance_access_weight,Method,HTM/Config.md#method-i-relevance_access_weight
103
+ HTM::Config.relevance_recency_half_life_hours,Method,HTM/Config.md#method-i-relevance_recency_half_life_hours
104
+ HTM::Config.relevance_recency_weight,Method,HTM/Config.md#method-i-relevance_recency_weight
105
+ HTM::Config.relevance_semantic_weight,Method,HTM/Config.md#method-i-relevance_semantic_weight
106
+ HTM::Config.relevance_tag_weight,Method,HTM/Config.md#method-i-relevance_tag_weight
107
+ HTM::Config.reset_to_defaults,Method,HTM/Config.md#method-i-reset_to_defaults
108
+ HTM::Config.service_name,Method,HTM/Config.md#method-i-service_name
109
+ HTM::Config.tag_model,Method,HTM/Config.md#method-i-tag_model
110
+ HTM::Config.tag_provider,Method,HTM/Config.md#method-i-tag_provider
111
+ HTM::Config.tag_timeout,Method,HTM/Config.md#method-i-tag_timeout
112
+ HTM::Config.test?,Method,HTM/Config.md#method-i-test?
113
+ HTM::Config.validate!,Method,HTM/Config.md#method-i-validate!
114
+ HTM::Config.validate_settings!,Method,HTM/Config.md#method-i-validate_settings!
115
+ HTM::Config.active_xdg_config_file,Method,HTM/Config.md#method-c-active_xdg_config_file
116
+ HTM::Config.config_section_with_defaults,Method,HTM/Config.md#method-c-config_section_with_defaults
117
+ HTM::Config.deep_merge_hashes,Method,HTM/Config.md#method-c-deep_merge_hashes
118
+ HTM::Config.env,Method,HTM/Config.md#method-c-env
119
+ HTM::Config.xdg_config_file,Method,HTM/Config.md#method-c-xdg_config_file
120
+ HTM::Config.xdg_config_paths,Method,HTM/Config.md#method-c-xdg_config_paths
121
+ embedding_generator,Attribute,HTM/Config.md#attribute-i-embedding_generator
122
+ logger,Attribute,HTM/Config.md#attribute-i-logger
123
+ proposition_extractor,Attribute,HTM/Config.md#attribute-i-proposition_extractor
124
+ tag_extractor,Attribute,HTM/Config.md#attribute-i-tag_extractor
125
+ token_counter,Attribute,HTM/Config.md#attribute-i-token_counter
111
126
  HTM::Database,Class,HTM/Database.md
112
127
  HTM::Database.default_config,Method,HTM/Database.md#method-c-default_config
113
128
  HTM::Database.drop,Method,HTM/Database.md#method-c-drop
@@ -24,7 +24,8 @@ Complete API documentation generated by [YARD](https://yardoc.org/) with [yard-m
24
24
  |--------------|-------------|
25
25
  | [HTM](yard/HTM.md) | Main API class for memory operations |
26
26
  | [HTM::CircuitBreaker](yard/HTM/CircuitBreaker.md) | Fault tolerance for external services |
27
- | [HTM::Configuration](yard/HTM/Configuration.md) | Multi-provider LLM configuration |
27
+ | [HTM::Config](yard/HTM/Config.md) | HTM::Config class |
28
+ | [HTM::ConfigSection](yard/HTM/ConfigSection.md) | HTM::ConfigSection class |
28
29
  | [HTM::Database](yard/HTM/Database.md) | Database schema and connection management |
29
30
  | [HTM::EmbeddingService](yard/HTM/EmbeddingService.md) | Vector embedding generation service |
30
31
  | [HTM::JobAdapter](yard/HTM/JobAdapter.md) | Background job abstraction layer |
@@ -1,23 +1,25 @@
1
- # ADR-003: Ollama as Default Embedding Provider
1
+ # ADR-003: Default Embedding Provider Selection
2
2
 
3
- **Status**: Accepted (Reinstated After ADR-011 Reversal)
3
+ **Status**: Accepted (Updated for Multi-Provider Support)
4
4
 
5
- **Date**: 2025-10-25 (Updated: 2025-10-27)
5
+ **Date**: 2025-10-25 (Updated: 2025-12-21)
6
6
 
7
7
  **Decision Makers**: Dewayne VanHoozer, Claude (Anthropic)
8
8
 
9
9
  ---
10
10
 
11
- !!! success "Architecture Status (October 2025)"
12
- **October 27, 2025**: This ADR is once again the current architecture. Following the reversal of ADR-011, HTM has returned to client-side embedding generation using Ollama as the default provider. Embeddings are generated in Ruby before database insertion.
11
+ !!! success "Architecture Status"
12
+ HTM uses RubyLLM for embedding generation, supporting multiple providers. **Ollama is the default** for local development, but users can configure any supported provider (OpenAI, Anthropic, Gemini, Azure, Bedrock, DeepSeek) based on their requirements.
13
13
 
14
14
  ## Quick Summary
15
15
 
16
- HTM uses **Ollama with the nomic-embed-text model** as the default embedding provider, prioritizing local-first, privacy-preserving operation with zero API costs while supporting pluggable alternatives (OpenAI).
16
+ HTM uses **Ollama with the nomic-embed-text model** as the **default** embedding provider for local development, prioritizing local-first, privacy-preserving operation with zero API costs. However, **HTM fully supports multiple providers** through RubyLLM, allowing users to choose OpenAI, Gemini, Azure, Bedrock, or other providers for production deployments.
17
17
 
18
- **Why**: Local embeddings eliminate API costs, preserve privacy, and enable offline operation while maintaining good semantic search quality.
18
+ **Why Ollama as default**: Local embeddings eliminate API costs, preserve privacy, and enable offline operation—ideal for development and privacy-sensitive applications.
19
19
 
20
- **Impact**: Users must install Ollama locally, trading convenience for privacy and cost savings. Client-side embedding generation provides reliable operation without complex database extension dependencies.
20
+ **Why multi-provider support**: Production deployments may require higher-quality embeddings, managed services, or integration with existing cloud infrastructure.
21
+
22
+ **Impact**: Ollama is recommended for getting started quickly, but users can easily switch providers via configuration for their specific needs.
21
23
 
22
24
  ---
23
25
 
@@ -47,7 +49,16 @@ HTM requires vector embeddings for semantic search functionality. Embeddings con
47
49
 
48
50
  ## Decision
49
51
 
50
- We will use **Ollama with the gpt-oss model** as the default embedding provider for HTM, while supporting pluggable alternatives (OpenAI, Cohere, etc.).
52
+ We will use **Ollama with the nomic-embed-text model** as the **default** embedding provider for HTM, while providing **full support for multiple providers** through RubyLLM:
53
+
54
+ - **Ollama** (default) - Local, privacy-preserving, free
55
+ - **OpenAI** - High-quality, production-ready
56
+ - **Gemini** - Google Cloud integration
57
+ - **Azure** - Enterprise Azure deployments
58
+ - **Bedrock** - AWS integration
59
+ - **DeepSeek** - Cost-effective alternative
60
+
61
+ Users configure their preferred provider via `HTM.configure` or environment variables.
51
62
 
52
63
  ---
53
64
 
@@ -205,38 +216,36 @@ end
205
216
 
206
217
  ### User Configuration
207
218
 
208
- !!! info "pgai Configuration"
209
- With pgai, configuration sets database session variables. Embedding generation happens automatically via triggers.
219
+ Configure your preferred provider globally or per-instance:
210
220
 
211
221
  ```ruby
212
- # Default: Ollama with nomic-embed-text (768 dimensions)
213
- htm = HTM.new(robot_name: "My Robot")
214
-
215
- # Explicit Ollama configuration
216
- htm = HTM.new(
217
- robot_name: "My Robot",
218
- embedding_provider: :ollama,
219
- embedding_model: 'nomic-embed-text'
220
- )
222
+ # Global configuration (recommended)
223
+ HTM.configure do |config|
224
+ # Ollama (default for development)
225
+ config.embedding.provider = :ollama
226
+ config.embedding.model = 'nomic-embed-text'
227
+
228
+ # Or OpenAI (recommended for production)
229
+ # config.embedding.provider = :openai
230
+ # config.embedding.model = 'text-embedding-3-small'
231
+
232
+ # Or Gemini
233
+ # config.embedding.provider = :gemini
234
+ # config.embedding.model = 'text-embedding-004'
235
+ end
221
236
 
222
- # Use different Ollama model
223
- htm = HTM.new(
224
- robot_name: "My Robot",
225
- embedding_provider: :ollama,
226
- embedding_model: 'mxbai-embed-large', # 1024 dimensions
227
- embedding_dimensions: 1024
228
- )
237
+ # Initialize HTM
238
+ htm = HTM.new(robot_name: "My Robot")
229
239
 
230
- # Use OpenAI
231
- htm = HTM.new(
232
- robot_name: "My Robot",
233
- embedding_provider: :openai,
234
- embedding_model: 'text-embedding-3-small' # 1536 dimensions
235
- )
240
+ # Add memory - embedding generated via configured provider
241
+ htm.remember("PostgreSQL is awesome", tags: ["database"])
242
+ ```
236
243
 
237
- # Add node - embedding generated automatically by database trigger!
238
- htm.add_node("fact_001", "PostgreSQL is awesome", type: :fact)
239
- # No embedding parameter needed - pgai handles it in the database
244
+ **Environment variables for cloud providers:**
245
+ ```bash
246
+ export OPENAI_API_KEY="sk-..." # For OpenAI
247
+ export GEMINI_API_KEY="..." # For Gemini
248
+ export ANTHROPIC_API_KEY="sk-..." # For Anthropic
240
249
  ```
241
250
 
242
251
  ---
@@ -420,7 +420,7 @@ htm = HTM.new(
420
420
  - [Multi-Agent Systems](https://en.wikipedia.org/wiki/Multi-agent_system)
421
421
  - [ADR-002: Two-Tier Memory](002-two-tier-memory.md)
422
422
  - [ADR-008: Robot Identification](008-robot-identification.md)
423
- - [Multi-Robot Guide](../../guides/multi-robot.md)
423
+ - [Multi-Robot Guide](../../robots/multi-robot.md)
424
424
 
425
425
  ---
426
426
 
@@ -608,7 +608,7 @@ htm = HTM.new(
608
608
  - [ULID Specification](https://github.com/ulid/spec)
609
609
  - [Robot Registry Pattern](https://martinfowler.com/eaaCatalog/registry.html)
610
610
  - [ADR-004: Hive Mind Architecture](004-hive-mind.md)
611
- - [Multi-Robot Guide](../../guides/multi-robot.md)
611
+ - [Multi-Robot Guide](../../robots/multi-robot.md)
612
612
 
613
613
  ---
614
614
 
@@ -29,7 +29,7 @@ HTM provides intelligent memory management through five core components that wor
29
29
  <!-- Embedding Service -->
30
30
  <rect x="550" y="200" width="200" height="120" fill="rgba(255, 152, 0, 0.2)" stroke="#FF9800" stroke-width="2" rx="5"/>
31
31
  <text x="650" y="235" text-anchor="middle" fill="#E0E0E0" font-size="14" font-weight="bold">Embedding Service</text>
32
- <text x="650" y="255" text-anchor="middle" fill="#B0B0B0" font-size="11">Ollama/OpenAI</text>
32
+ <text x="650" y="255" text-anchor="middle" fill="#B0B0B0" font-size="11">Multi-Provider (RubyLLM)</text>
33
33
  <text x="650" y="275" text-anchor="middle" fill="#B0B0B0" font-size="11">Vector Embeddings</text>
34
34
  <text x="650" y="295" text-anchor="middle" fill="#B0B0B0" font-size="11">Semantic Search</text>
35
35
 
@@ -113,12 +113,14 @@ Durable PostgreSQL storage for permanent knowledge retention. All memories are s
113
113
 
114
114
  Generates vector embeddings for semantic search and manages token counting for memory management.
115
115
 
116
- **Supported Providers:**
116
+ **Supported Providers (via RubyLLM):**
117
117
 
118
- - **Ollama** (default): Local embedding models (gpt-oss, nomic-embed-text, mxbai-embed-large)
118
+ - **Ollama** (default): Local embedding models (nomic-embed-text, mxbai-embed-large)
119
119
  - **OpenAI**: text-embedding-3-small, text-embedding-3-large
120
- - **Cohere**: embed-english-v3.0, embed-multilingual-v3.0
121
- - **Local**: Transformers.js for browser/edge deployment
120
+ - **Gemini**: text-embedding-004
121
+ - **Azure**: Azure OpenAI Service
122
+ - **Bedrock**: Amazon Titan, Cohere models
123
+ - **DeepSeek**: DeepSeek embeddings
122
124
 
123
125
  **Related ADRs:** [ADR-003](adrs/003-ollama-embeddings.md)
124
126
 
@@ -272,8 +274,8 @@ stateDiagram-v2
272
274
  Explore detailed architecture documentation:
273
275
 
274
276
  - **[Detailed Architecture](overview.md)** - Deep dive into system architecture, data flows, and performance characteristics
275
- - **[Two-Tier Memory System](two-tier-memory.md)** - Working memory and long-term memory design, eviction strategies, and context assembly
276
- - **[Hive Mind Architecture](hive-mind.md)** - Multi-robot shared memory, robot identification, and cross-robot knowledge sharing
277
+ - **[Two-Tier Memory System](../robots/two-tier-memory.md)** - Working memory and long-term memory design, eviction strategies, and context assembly
278
+ - **[Hive Mind Architecture](../robots/hive-mind.md)** - Multi-robot shared memory, robot identification, and cross-robot knowledge sharing
277
279
 
278
280
  ## Technology Stack
279
281
 
@@ -284,7 +286,7 @@ Explore detailed architecture documentation:
284
286
  | **Time-Series** | TimescaleDB | Hypertable partitioning, compression |
285
287
  | **Vector Search** | pgvector | Semantic similarity (HNSW) |
286
288
  | **Full-Text** | pg_trgm | Fuzzy text matching |
287
- | **Embeddings** | Ollama/OpenAI | Vector generation |
289
+ | **Embeddings** | RubyLLM (multi-provider) | Vector generation |
288
290
  | **Connection Pool** | connection_pool gem | Database connection management |
289
291
  | **Testing** | Minitest | Test framework |
290
292
 
@@ -318,7 +320,7 @@ Explore detailed architecture documentation:
318
320
 
319
321
  - **Working Memory**: Limited by process RAM (~1-2GB for 128K tokens)
320
322
  - **Database**: PostgreSQL scales to TBs with proper indexing
321
- - **Embeddings**: Local models (Ollama) bounded by GPU/CPU
323
+ - **Embeddings**: Local models (Ollama) bounded by GPU/CPU; cloud providers scale independently
322
324
 
323
325
  ### Horizontal Scaling
324
326
 
@@ -64,7 +64,7 @@ HTM implements a layered architecture with clear separation of concerns between
64
64
  - **Client-Side Generation**: Generate embeddings before database insertion
65
65
  - **Token Counting**: Estimate token counts for strings
66
66
  - **Model Management**: Handle different models per provider
67
- - **Provider Support**: Ollama (default) and OpenAI
67
+ - **Multi-Provider Support**: Ollama (default), OpenAI, Anthropic, Gemini, Azure, Bedrock, DeepSeek via RubyLLM
68
68
 
69
69
  !!! info "Architecture Change (October 2025)"
70
70
  Embeddings are generated client-side in Ruby before database insertion. This provides reliable, cross-platform operation without complex database extension dependencies.
@@ -257,13 +257,17 @@ gem 'tiktoken_ruby', '~> 0.0.6' # Token counting (OpenAI-compatible)
257
257
 
258
258
  ### Embedding Providers
259
259
 
260
- !!! info "Client-Side Generation"
261
- Embeddings are generated client-side in Ruby before database insertion. This provides reliable, cross-platform operation.
260
+ !!! info "Multi-Provider Support via RubyLLM"
261
+ HTM uses RubyLLM for embedding generation, supporting multiple providers. Choose based on your requirements for privacy, cost, and quality.
262
262
 
263
263
  | Provider | Models | Dimensions | Speed | Cost |
264
264
  |----------|--------|------------|-------|------|
265
- | **Ollama** (default) | nomic-embed-text, mxbai-embed-large, all-minilm | 384-1024 | Fast (local HTTP) | Free |
266
- | **OpenAI** | text-embedding-3-small, text-embedding-ada-002 | 1536 | Fast (API) | $0.0001/1K tokens |
265
+ | **Ollama** (default) | nomic-embed-text, mxbai-embed-large | 384-1024 | Fast (local) | Free |
266
+ | **OpenAI** | text-embedding-3-small, text-embedding-3-large | 1536-3072 | Fast (API) | $0.0001/1K tokens |
267
+ | **Gemini** | text-embedding-004 | 768 | Fast (API) | Varies |
268
+ | **Azure** | OpenAI models via Azure | 1536 | Fast (API) | Enterprise pricing |
269
+ | **Bedrock** | Amazon Titan, Cohere | Varies | Fast (API) | AWS pricing |
270
+ | **DeepSeek** | DeepSeek embeddings | Varies | Fast (API) | Competitive |
267
271
 
268
272
  ## Performance Characteristics
269
273
 
@@ -366,7 +370,7 @@ Based on typical production workloads with 10,000 nodes in long-term memory (cli
366
370
  ## Related Documentation
367
371
 
368
372
  - [Architecture Index](index.md) - Architecture overview and component summary
369
- - [Two-Tier Memory System](two-tier-memory.md) - Working memory and long-term memory deep dive
370
- - [Hive Mind Architecture](hive-mind.md) - Multi-robot shared memory design
373
+ - [Two-Tier Memory System](../robots/two-tier-memory.md) - Working memory and long-term memory deep dive
374
+ - [Hive Mind Architecture](../robots/hive-mind.md) - Multi-robot shared memory design
371
375
  - [API Reference](../api/htm.md) - Complete API documentation
372
376
  - [Architecture Decision Records](adrs/index.md) - Decision history
@@ -0,0 +1,41 @@
1
+ <svg viewBox="0 0 800 400" xmlns="http://www.w3.org/2000/svg" style="background: transparent;">
2
+ <!-- Title -->
3
+ <text x="400" y="30" text-anchor="middle" fill="#E0E0E0" font-size="16" font-weight="bold">Balanced Strategy: Importance Decay Over Time</text>
4
+
5
+ <!-- Axes -->
6
+ <line x1="100" y1="350" x2="700" y2="350" stroke="#808080" stroke-width="2"/>
7
+ <line x1="100" y1="350" x2="100" y2="80" stroke="#808080" stroke-width="2"/>
8
+
9
+ <!-- X-axis labels -->
10
+ <text x="100" y="375" text-anchor="middle" fill="#B0B0B0" font-size="11">0h</text>
11
+ <text x="250" y="375" text-anchor="middle" fill="#B0B0B0" font-size="11">1h</text>
12
+ <text x="400" y="375" text-anchor="middle" fill="#B0B0B0" font-size="11">3h</text>
13
+ <text x="550" y="375" text-anchor="middle" fill="#B0B0B0" font-size="11">6h</text>
14
+ <text x="700" y="375" text-anchor="middle" fill="#B0B0B0" font-size="11">24h</text>
15
+ <text x="400" y="395" text-anchor="middle" fill="#E0E0E0" font-size="12" font-weight="bold">Time Since Added (hours)</text>
16
+
17
+ <!-- Y-axis labels -->
18
+ <text x="85" y="355" text-anchor="end" fill="#B0B0B0" font-size="11">0</text>
19
+ <text x="85" y="280" text-anchor="end" fill="#B0B0B0" font-size="11">3</text>
20
+ <text x="85" y="205" text-anchor="end" fill="#B0B0B0" font-size="11">6</text>
21
+ <text x="85" y="130" text-anchor="end" fill="#B0B0B0" font-size="11">9</text>
22
+ <text x="85" y="85" text-anchor="end" fill="#B0B0B0" font-size="11">10</text>
23
+ <text x="40" y="220" text-anchor="middle" fill="#E0E0E0" font-size="12" font-weight="bold" transform="rotate(-90 40 220)">Effective Score</text>
24
+
25
+ <!-- Decay curves for different importance levels -->
26
+ <!-- Importance 10.0 -->
27
+ <path d="M 100 80 Q 250 105 400 155 T 700 320" stroke="#4CAF50" stroke-width="3" fill="none"/>
28
+ <text x="710" y="320" fill="#4CAF50" font-size="11" font-weight="bold">Imp: 10.0</text>
29
+
30
+ <!-- Importance 5.0 -->
31
+ <path d="M 100 205 Q 250 230 400 255 T 700 335" stroke="#2196F3" stroke-width="3" fill="none"/>
32
+ <text x="710" y="335" fill="#2196F3" font-size="11" font-weight="bold">Imp: 5.0</text>
33
+
34
+ <!-- Importance 1.0 -->
35
+ <path d="M 100 330 Q 250 340 400 345 T 700 348" stroke="#FF9800" stroke-width="3" fill="none"/>
36
+ <text x="710" y="348" fill="#FF9800" font-size="11" font-weight="bold">Imp: 1.0</text>
37
+
38
+ <!-- Key insight -->
39
+ <rect x="150" y="50" width="500" height="25" fill="rgba(76, 175, 80, 0.1)" stroke="#4CAF50" stroke-width="1" rx="3"/>
40
+ <text x="400" y="68" text-anchor="middle" fill="#4CAF50" font-size="12">High-importance memories retain value longer, but recency still matters</text>
41
+ </svg>
@@ -43,7 +43,7 @@
43
43
  <text x="70" y="370" fill="#B0B0B0" font-size="10">• <tspan fill="#4CAF50" font-weight="bold">HTM</tspan>: Main API interface coordinating all components</text>
44
44
  <text x="70" y="388" fill="#B0B0B0" font-size="10">• <tspan fill="#2196F3" font-weight="bold">WorkingMemory</tspan>: Fast, token-limited in-memory cache</text>
45
45
  <text x="70" y="406" fill="#B0B0B0" font-size="10">• <tspan fill="#9C27B0" font-weight="bold">LongTermMemory</tspan>: Durable PostgreSQL storage with RAG search</text>
46
- <text x="380" y="388" fill="#B0B0B0" font-size="10">• <tspan fill="#FF9800" font-weight="bold">EmbeddingService</tspan>: Vector generation via Ollama/OpenAI</text>
46
+ <text x="380" y="388" fill="#B0B0B0" font-size="10">• <tspan fill="#FF9800" font-weight="bold">EmbeddingService</tspan>: Vector generation via RubyLLM</text>
47
47
  <text x="380" y="406" fill="#B0B0B0" font-size="10">• <tspan fill="#FFC107" font-weight="bold">Database</tspan>: Schema management and connections</text>
48
48
 
49
49
  <!-- Markers -->
@@ -0,0 +1,43 @@
1
+ <svg viewBox="0 0 800 400" xmlns="http://www.w3.org/2000/svg" style="background: transparent;">
2
+ <!-- Title -->
3
+ <text x="400" y="30" text-anchor="middle" fill="#E0E0E0" font-size="16" font-weight="bold">Eviction Priority (Lower → Higher retention)</text>
4
+
5
+ <!-- Priority bars -->
6
+ <rect x="50" y="80" width="150" height="50" fill="rgba(244, 67, 54, 0.6)" stroke="#F44336" stroke-width="2" rx="3"/>
7
+ <text x="125" y="110" text-anchor="middle" fill="#E0E0E0" font-size="12" font-weight="bold">Tier 1: Evict First</text>
8
+
9
+ <rect x="220" y="80" width="150" height="50" fill="rgba(255, 152, 0, 0.6)" stroke="#FF9800" stroke-width="2" rx="3"/>
10
+ <text x="295" y="110" text-anchor="middle" fill="#E0E0E0" font-size="12" font-weight="bold">Tier 2</text>
11
+
12
+ <rect x="390" y="80" width="150" height="50" fill="rgba(255, 193, 7, 0.6)" stroke="#FFC107" stroke-width="2" rx="3"/>
13
+ <text x="465" y="110" text-anchor="middle" fill="#E0E0E0" font-size="12" font-weight="bold">Tier 3</text>
14
+
15
+ <rect x="560" y="80" width="150" height="50" fill="rgba(76, 175, 80, 0.6)" stroke="#4CAF50" stroke-width="2" rx="3"/>
16
+ <text x="635" y="110" text-anchor="middle" fill="#E0E0E0" font-size="12" font-weight="bold">Tier 4: Keep Longest</text>
17
+
18
+ <!-- Details -->
19
+ <text x="125" y="160" text-anchor="middle" fill="#B0B0B0" font-size="11">Importance: 1.0</text>
20
+ <text x="125" y="180" text-anchor="middle" fill="#B0B0B0" font-size="11">Age: 5 days</text>
21
+ <text x="125" y="200" text-anchor="middle" fill="#F44336" font-size="10" font-weight="bold">Low value, stale</text>
22
+
23
+ <text x="295" y="160" text-anchor="middle" fill="#B0B0B0" font-size="11">Importance: 1.0</text>
24
+ <text x="295" y="180" text-anchor="middle" fill="#B0B0B0" font-size="11">Age: 1 hour</text>
25
+ <text x="295" y="200" text-anchor="middle" fill="#FF9800" font-size="10" font-weight="bold">Low value, recent</text>
26
+
27
+ <text x="465" y="160" text-anchor="middle" fill="#B0B0B0" font-size="11">Importance: 9.0</text>
28
+ <text x="465" y="180" text-anchor="middle" fill="#B0B0B0" font-size="11">Age: 5 days</text>
29
+ <text x="465" y="200" text-anchor="middle" fill="#FFC107" font-size="10" font-weight="bold">High value, older</text>
30
+
31
+ <text x="635" y="160" text-anchor="middle" fill="#B0B0B0" font-size="11">Importance: 9.0</text>
32
+ <text x="635" y="180" text-anchor="middle" fill="#B0B0B0" font-size="11">Age: 1 hour</text>
33
+ <text x="635" y="200" text-anchor="middle" fill="#4CAF50" font-size="10" font-weight="bold">High value, fresh</text>
34
+
35
+ <!-- Example scenario -->
36
+ <text x="50" y="250" fill="#E0E0E0" font-size="13" font-weight="bold">Example Eviction Scenario:</text>
37
+ <text x="50" y="280" fill="#B0B0B0" font-size="11">Working Memory: 127,500 / 128,000 tokens (99% full)</text>
38
+ <text x="50" y="300" fill="#B0B0B0" font-size="11">New memory to add: 5,000 tokens</text>
39
+ <text x="50" y="320" fill="#B0B0B0" font-size="11">Need to free: 4,500 tokens</text>
40
+
41
+ <text x="50" y="350" fill="#4CAF50" font-size="11">Eviction: Remove Tier 1 and Tier 2 nodes until 4,500+ tokens freed</text>
42
+ <text x="50" y="370" fill="#4CAF50" font-size="11">Result: Tier 3 and Tier 4 nodes preserved (high importance)</text>
43
+ </svg>
@@ -13,9 +13,9 @@
13
13
  <path d="M 350 170 L 430 170 L 430 200" stroke="#F44336" stroke-width="2" fill="none" marker-end="url(#arrow1)"/>
14
14
  <path d="M 350 170 L 580 170 L 580 200" stroke="#F44336" stroke-width="2" fill="none" marker-end="url(#arrow1)"/>
15
15
 
16
- <!-- Ollama connection failed -->
16
+ <!-- Provider connection failed -->
17
17
  <rect x="20" y="200" width="200" height="50" fill="rgba(255, 152, 0, 0.3)" stroke="#FF9800" stroke-width="2" rx="6"/>
18
- <text x="120" y="230" text-anchor="middle" fill="#FFFFFF" font-size="12">"Ollama connection failed"</text>
18
+ <text x="120" y="230" text-anchor="middle" fill="#FFFFFF" font-size="12">"Provider connection failed"</text>
19
19
 
20
20
  <!-- OpenAI API error -->
21
21
  <rect x="240" y="200" width="200" height="50" fill="rgba(255, 152, 0, 0.3)" stroke="#FF9800" stroke-width="2" rx="6"/>