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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +119 -1
- data/README.md +12 -0
- data/Rakefile +104 -18
- data/db/migrate/00001_enable_extensions.rb +9 -5
- data/db/migrate/00002_create_robots.rb +18 -6
- data/db/migrate/00003_create_file_sources.rb +30 -17
- data/db/migrate/00004_create_nodes.rb +60 -48
- data/db/migrate/00005_create_tags.rb +24 -12
- data/db/migrate/00006_create_node_tags.rb +28 -13
- data/db/migrate/00007_create_robot_nodes.rb +40 -26
- data/db/schema.sql +17 -1
- data/db/seeds.rb +34 -34
- data/docs/api/embedding-service.md +140 -110
- data/docs/api/yard/HTM/ActiveRecordConfig.md +6 -0
- data/docs/api/yard/HTM/Config.md +173 -0
- data/docs/api/yard/HTM/ConfigSection.md +28 -0
- data/docs/api/yard/HTM/Database.md +1 -1
- data/docs/api/yard/HTM/Railtie.md +2 -2
- data/docs/api/yard/HTM.md +0 -57
- data/docs/api/yard/index.csv +76 -61
- data/docs/api/yard-reference.md +2 -1
- data/docs/architecture/adrs/003-ollama-embeddings.md +45 -36
- data/docs/architecture/adrs/004-hive-mind.md +1 -1
- data/docs/architecture/adrs/008-robot-identification.md +1 -1
- data/docs/architecture/index.md +11 -9
- data/docs/architecture/overview.md +11 -7
- data/docs/assets/images/balanced-strategy-decay.svg +41 -0
- data/docs/assets/images/class-hierarchy.svg +1 -1
- data/docs/assets/images/eviction-priority.svg +43 -0
- data/docs/assets/images/exception-hierarchy.svg +2 -2
- data/docs/assets/images/hive-mind-shared-memory.svg +52 -0
- data/docs/assets/images/htm-architecture-overview.svg +3 -3
- data/docs/assets/images/htm-core-components.svg +4 -4
- data/docs/assets/images/htm-layered-architecture.svg +1 -1
- data/docs/assets/images/htm-memory-addition-flow.svg +2 -2
- data/docs/assets/images/htm-memory-recall-flow.svg +2 -2
- data/docs/assets/images/memory-topology.svg +53 -0
- data/docs/assets/images/two-tier-memory-architecture.svg +55 -0
- data/docs/database/naming-convention.md +244 -0
- data/docs/database_rake_tasks.md +31 -0
- data/docs/development/rake-tasks.md +80 -35
- data/docs/development/setup.md +76 -44
- data/docs/examples/basic-usage.md +133 -0
- data/docs/examples/config-files.md +170 -0
- data/docs/examples/file-loading.md +208 -0
- data/docs/examples/index.md +116 -0
- data/docs/examples/llm-configuration.md +168 -0
- data/docs/examples/mcp-client.md +172 -0
- data/docs/examples/rails-integration.md +173 -0
- data/docs/examples/robot-groups.md +210 -0
- data/docs/examples/sinatra-integration.md +218 -0
- data/docs/examples/standalone-app.md +216 -0
- data/docs/examples/telemetry.md +224 -0
- data/docs/examples/timeframes.md +143 -0
- data/docs/getting-started/installation.md +97 -40
- data/docs/getting-started/quick-start.md +28 -11
- data/docs/guides/configuration.md +515 -0
- data/docs/guides/file-loading.md +322 -0
- data/docs/guides/getting-started.md +40 -9
- data/docs/guides/index.md +3 -3
- data/docs/guides/mcp-server.md +100 -13
- data/docs/guides/propositions.md +264 -0
- data/docs/guides/recalling-memories.md +4 -4
- data/docs/guides/search-strategies.md +3 -3
- data/docs/guides/tags.md +318 -0
- data/docs/guides/telemetry.md +229 -0
- data/docs/index.md +8 -16
- data/docs/{architecture → robots}/hive-mind.md +8 -111
- data/docs/robots/index.md +73 -0
- data/docs/{guides → robots}/multi-robot.md +3 -3
- data/docs/{guides → robots}/robot-groups.md +8 -7
- data/docs/{architecture → robots}/two-tier-memory.md +13 -149
- data/docs/robots/why-robots.md +85 -0
- data/examples/.envrc +6 -0
- data/examples/.gitignore +2 -0
- data/examples/00_create_examples_db.rb +94 -0
- data/examples/{basic_usage.rb → 01_basic_usage.rb} +12 -16
- data/examples/{custom_llm_configuration.rb → 03_custom_llm_configuration.rb} +13 -3
- data/examples/{file_loader_usage.rb → 04_file_loader_usage.rb} +11 -14
- data/examples/{timeframe_demo.rb → 05_timeframe_demo.rb} +10 -3
- data/examples/{example_app → 06_example_app}/app.rb +15 -15
- data/examples/{cli_app → 07_cli_app}/htm_cli.rb +15 -22
- data/examples/08_sinatra_app/Gemfile.lock +241 -0
- data/examples/{sinatra_app → 08_sinatra_app}/app.rb +19 -18
- data/examples/{mcp_client.rb → 09_mcp_client.rb} +5 -8
- data/examples/{telemetry → 10_telemetry}/SETUP_README.md +1 -1
- data/examples/{telemetry → 10_telemetry}/demo.rb +14 -10
- data/examples/11_robot_groups/README.md +335 -0
- data/examples/{robot_groups → 11_robot_groups/lib}/robot_worker.rb +17 -3
- data/examples/{robot_groups → 11_robot_groups}/multi_process.rb +9 -9
- data/examples/{robot_groups → 11_robot_groups}/same_process.rb +9 -12
- data/examples/{rails_app → 12_rails_app}/Gemfile +3 -0
- data/examples/{rails_app → 12_rails_app}/Gemfile.lock +87 -58
- data/examples/{rails_app → 12_rails_app}/app/controllers/dashboard_controller.rb +10 -6
- data/examples/{rails_app → 12_rails_app}/app/controllers/files_controller.rb +5 -5
- data/examples/{rails_app → 12_rails_app}/app/controllers/memories_controller.rb +11 -7
- data/examples/{rails_app → 12_rails_app}/app/controllers/robots_controller.rb +8 -8
- data/examples/12_rails_app/app/controllers/tags_controller.rb +36 -0
- data/examples/{rails_app → 12_rails_app}/app/views/dashboard/index.html.erb +2 -2
- data/examples/{rails_app → 12_rails_app}/app/views/files/new.html.erb +5 -2
- data/examples/{rails_app → 12_rails_app}/app/views/memories/_memory_card.html.erb +3 -3
- data/examples/{rails_app → 12_rails_app}/app/views/memories/deleted.html.erb +3 -3
- data/examples/{rails_app → 12_rails_app}/app/views/memories/edit.html.erb +3 -3
- data/examples/{rails_app → 12_rails_app}/app/views/memories/show.html.erb +4 -4
- data/examples/{rails_app → 12_rails_app}/app/views/robots/index.html.erb +2 -2
- data/examples/{rails_app → 12_rails_app}/app/views/robots/show.html.erb +4 -4
- data/examples/{rails_app → 12_rails_app}/app/views/search/index.html.erb +1 -1
- data/examples/{rails_app → 12_rails_app}/app/views/tags/index.html.erb +2 -2
- data/examples/{rails_app → 12_rails_app}/app/views/tags/show.html.erb +1 -1
- data/examples/12_rails_app/config/initializers/htm.rb +7 -0
- data/examples/12_rails_app/config/initializers/rack.rb +5 -0
- data/examples/README.md +230 -211
- data/examples/examples_helper.rb +138 -0
- data/lib/htm/config/builder.rb +167 -0
- data/lib/htm/config/database.rb +317 -0
- data/lib/htm/config/defaults.yml +41 -13
- data/lib/htm/config/section.rb +74 -0
- data/lib/htm/config/validator.rb +83 -0
- data/lib/htm/config.rb +65 -361
- data/lib/htm/database.rb +85 -127
- data/lib/htm/errors.rb +14 -0
- data/lib/htm/integrations/sinatra.rb +13 -44
- data/lib/htm/job_adapter.rb +75 -1
- data/lib/htm/jobs/generate_embedding_job.rb +3 -4
- data/lib/htm/jobs/generate_propositions_job.rb +4 -5
- data/lib/htm/jobs/generate_tags_job.rb +16 -15
- data/lib/htm/loaders/defaults_loader.rb +23 -0
- data/lib/htm/loaders/markdown_loader.rb +17 -15
- data/lib/htm/loaders/xdg_config_loader.rb +9 -9
- data/lib/htm/long_term_memory/fulltext_search.rb +14 -14
- data/lib/htm/long_term_memory/hybrid_search.rb +396 -229
- data/lib/htm/long_term_memory/node_operations.rb +24 -23
- data/lib/htm/long_term_memory/relevance_scorer.rb +23 -20
- data/lib/htm/long_term_memory/robot_operations.rb +4 -4
- data/lib/htm/long_term_memory/tag_operations.rb +91 -77
- data/lib/htm/long_term_memory/vector_search.rb +4 -5
- data/lib/htm/long_term_memory.rb +13 -13
- data/lib/htm/mcp/cli.rb +115 -8
- data/lib/htm/mcp/resources.rb +4 -3
- data/lib/htm/mcp/server.rb +5 -4
- data/lib/htm/mcp/tools.rb +37 -28
- data/lib/htm/migration.rb +72 -0
- data/lib/htm/models/file_source.rb +52 -31
- data/lib/htm/models/node.rb +224 -108
- data/lib/htm/models/node_tag.rb +49 -28
- data/lib/htm/models/robot.rb +38 -27
- data/lib/htm/models/robot_node.rb +63 -35
- data/lib/htm/models/tag.rb +126 -123
- data/lib/htm/observability.rb +45 -41
- data/lib/htm/proposition_service.rb +76 -7
- data/lib/htm/railtie.rb +2 -2
- data/lib/htm/robot_group.rb +30 -18
- data/lib/htm/sequel_config.rb +215 -0
- data/lib/htm/sql_builder.rb +14 -16
- data/lib/htm/tag_service.rb +78 -0
- data/lib/htm/tasks.rb +3 -0
- data/lib/htm/version.rb +1 -1
- data/lib/htm/workflows/remember_workflow.rb +213 -0
- data/lib/htm.rb +27 -22
- data/lib/tasks/db.rake +0 -2
- data/lib/tasks/doc.rake +2 -2
- data/lib/tasks/files.rake +11 -18
- data/lib/tasks/htm.rake +190 -62
- data/lib/tasks/jobs.rake +179 -54
- data/lib/tasks/tags.rake +8 -13
- data/mkdocs.yml +33 -8
- data/scripts/backfill_parent_tags.rb +376 -0
- data/scripts/normalize_plural_tags.rb +335 -0
- metadata +168 -86
- data/docs/api/yard/HTM/Configuration.md +0 -240
- data/docs/telemetry.md +0 -391
- data/examples/rails_app/app/controllers/tags_controller.rb +0 -30
- data/examples/sinatra_app/Gemfile.lock +0 -166
- data/lib/htm/active_record_config.rb +0 -104
- /data/examples/{config_file_example → 02_config_file_example}/README.md +0 -0
- /data/examples/{config_file_example → 02_config_file_example}/config/htm.local.yml +0 -0
- /data/examples/{config_file_example → 02_config_file_example}/custom_config.yml +0 -0
- /data/examples/{config_file_example → 02_config_file_example}/show_config.rb +0 -0
- /data/examples/{example_app → 06_example_app}/Rakefile +0 -0
- /data/examples/{cli_app → 07_cli_app}/README.md +0 -0
- /data/examples/{sinatra_app → 08_sinatra_app}/Gemfile +0 -0
- /data/examples/{telemetry → 10_telemetry}/README.md +0 -0
- /data/examples/{telemetry → 10_telemetry}/grafana/dashboards/htm-metrics.json +0 -0
- /data/examples/{rails_app → 12_rails_app}/.gitignore +0 -0
- /data/examples/{rails_app → 12_rails_app}/Procfile.dev +0 -0
- /data/examples/{rails_app → 12_rails_app}/README.md +0 -0
- /data/examples/{rails_app → 12_rails_app}/Rakefile +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/assets/stylesheets/application.css +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/assets/stylesheets/inter-font.css +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/controllers/application_controller.rb +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/controllers/search_controller.rb +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/javascript/application.js +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/javascript/controllers/application.js +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/javascript/controllers/index.js +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/views/files/index.html.erb +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/views/files/show.html.erb +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/views/layouts/application.html.erb +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/views/memories/index.html.erb +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/views/memories/new.html.erb +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/views/robots/new.html.erb +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/views/shared/_navbar.html.erb +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/views/shared/_stat_card.html.erb +0 -0
- /data/examples/{rails_app → 12_rails_app}/bin/dev +0 -0
- /data/examples/{rails_app → 12_rails_app}/bin/rails +0 -0
- /data/examples/{rails_app → 12_rails_app}/bin/rake +0 -0
- /data/examples/{rails_app → 12_rails_app}/config/application.rb +0 -0
- /data/examples/{rails_app → 12_rails_app}/config/boot.rb +0 -0
- /data/examples/{rails_app → 12_rails_app}/config/database.yml +0 -0
- /data/examples/{rails_app → 12_rails_app}/config/environment.rb +0 -0
- /data/examples/{rails_app → 12_rails_app}/config/importmap.rb +0 -0
- /data/examples/{rails_app → 12_rails_app}/config/routes.rb +0 -0
- /data/examples/{rails_app → 12_rails_app}/config/tailwind.config.js +0 -0
- /data/examples/{rails_app → 12_rails_app}/config.ru +0 -0
- /data/examples/{rails_app → 12_rails_app}/log/.keep +0 -0
- /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
|
|
data/docs/api/yard/index.csv
CHANGED
|
@@ -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::
|
|
59
|
-
HTM::
|
|
60
|
-
HTM::
|
|
61
|
-
HTM::
|
|
62
|
-
HTM::
|
|
63
|
-
HTM::
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
data/docs/api/yard-reference.md
CHANGED
|
@@ -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::
|
|
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:
|
|
1
|
+
# ADR-003: Default Embedding Provider Selection
|
|
2
2
|
|
|
3
|
-
**Status**: Accepted (
|
|
3
|
+
**Status**: Accepted (Updated for Multi-Provider Support)
|
|
4
4
|
|
|
5
|
-
**Date**: 2025-10-25 (Updated: 2025-
|
|
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
|
|
12
|
-
|
|
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
|
|
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
|
|
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
|
-
**
|
|
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
|
|
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
|
-
|
|
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
|
-
#
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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
|
-
#
|
|
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
|
-
#
|
|
231
|
-
htm
|
|
232
|
-
|
|
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
|
-
|
|
238
|
-
|
|
239
|
-
#
|
|
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](../../
|
|
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](../../
|
|
611
|
+
- [Multi-Robot Guide](../../robots/multi-robot.md)
|
|
612
612
|
|
|
613
613
|
---
|
|
614
614
|
|
data/docs/architecture/index.md
CHANGED
|
@@ -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">
|
|
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 (
|
|
118
|
+
- **Ollama** (default): Local embedding models (nomic-embed-text, mxbai-embed-large)
|
|
119
119
|
- **OpenAI**: text-embedding-3-small, text-embedding-3-large
|
|
120
|
-
- **
|
|
121
|
-
- **
|
|
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** |
|
|
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)
|
|
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 "
|
|
261
|
-
|
|
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
|
|
266
|
-
| **OpenAI** | text-embedding-3-small, text-embedding-
|
|
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
|
|
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
|
-
<!--
|
|
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">"
|
|
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"/>
|