htm 0.0.31 → 0.0.32
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/.irbrc +2 -3
- data/.rubocop.yml +184 -0
- data/CHANGELOG.md +46 -0
- data/README.md +2 -0
- data/Rakefile +93 -12
- data/db/migrate/00008_create_node_relationships.rb +54 -0
- data/db/migrate/00009_fix_node_relationships_column_types.rb +17 -0
- data/db/schema.sql +124 -1
- data/docs/api/database.md +35 -57
- data/docs/api/embedding-service.md +1 -1
- data/docs/api/index.md +26 -15
- data/docs/api/working-memory.md +8 -8
- data/docs/architecture/index.md +5 -7
- data/docs/architecture/overview.md +5 -8
- data/docs/assets/images/htm-architecture-overview.svg +1 -1
- data/docs/assets/images/htm-context-assembly-flow.svg +2 -2
- data/docs/assets/images/htm-layered-architecture.svg +3 -3
- data/docs/assets/images/two-tier-memory-architecture.svg +1 -1
- data/docs/database/README.md +1 -0
- data/docs/database_rake_tasks.md +20 -28
- data/docs/development/contributing.md +5 -5
- data/docs/development/index.md +4 -7
- data/docs/development/schema.md +71 -1
- data/docs/development/setup.md +40 -82
- data/docs/development/testing.md +1 -1
- data/docs/examples/file-loading.md +4 -4
- data/docs/examples/mcp-client.md +1 -1
- data/docs/getting-started/quick-start.md +4 -4
- data/docs/guides/adding-memories.md +14 -1
- data/docs/guides/configuration.md +5 -5
- data/docs/guides/context-assembly.md +4 -4
- data/docs/guides/file-loading.md +12 -12
- data/docs/guides/getting-started.md +2 -2
- data/docs/guides/long-term-memory.md +7 -27
- data/docs/guides/propositions.md +20 -19
- data/docs/guides/recalling-memories.md +5 -5
- data/docs/guides/tags.md +18 -13
- data/docs/multi_framework_support.md +1 -1
- data/docs/robots/hive-mind.md +1 -1
- data/docs/robots/multi-robot.md +2 -2
- data/docs/robots/robot-groups.md +1 -1
- data/docs/robots/two-tier-memory.md +72 -94
- data/docs/setup_local_database.md +8 -54
- data/docs/using_rake_tasks_in_your_app.md +6 -6
- data/examples/01_basic_usage.rb +1 -0
- data/examples/03_custom_llm_configuration.rb +1 -0
- data/examples/04_file_loader_usage.rb +1 -0
- data/examples/05_timeframe_demo.rb +1 -0
- data/examples/06_example_app/app.rb +1 -0
- data/examples/07_cli_app/htm_cli.rb +1 -0
- data/examples/09_mcp_client.rb +1 -0
- data/examples/10_telemetry/demo.rb +1 -0
- data/examples/11_robot_groups/multi_process.rb +1 -0
- data/examples/11_robot_groups/same_process.rb +1 -0
- data/examples/12_rails_app/.envrc +12 -0
- data/examples/12_rails_app/Gemfile +8 -3
- data/examples/12_rails_app/Gemfile.lock +94 -89
- data/examples/12_rails_app/README.md +70 -19
- data/examples/12_rails_app/app/controllers/application_controller.rb +6 -0
- data/examples/12_rails_app/app/controllers/chats_controller.rb +305 -0
- data/examples/12_rails_app/app/controllers/dashboard_controller.rb +3 -0
- data/examples/12_rails_app/app/controllers/files_controller.rb +17 -2
- data/examples/12_rails_app/app/controllers/home_controller.rb +8 -0
- data/examples/12_rails_app/app/controllers/memories_controller.rb +9 -4
- data/examples/12_rails_app/app/controllers/messages_controller.rb +214 -0
- data/examples/12_rails_app/app/controllers/robots_controller.rb +11 -1
- data/examples/12_rails_app/app/controllers/tags_controller.rb +14 -1
- data/examples/12_rails_app/app/javascript/application.js +1 -1
- data/examples/12_rails_app/app/models/application_record.rb +5 -0
- data/examples/12_rails_app/app/models/chat.rb +36 -0
- data/examples/12_rails_app/app/models/message.rb +5 -0
- data/examples/12_rails_app/app/models/model.rb +5 -0
- data/examples/12_rails_app/app/models/tool_call.rb +5 -0
- data/examples/12_rails_app/app/views/chats/index.html.erb +61 -0
- data/examples/12_rails_app/app/views/chats/show.html.erb +213 -0
- data/examples/12_rails_app/app/views/dashboard/index.html.erb +3 -0
- data/examples/12_rails_app/app/views/files/index.html.erb +10 -5
- data/examples/12_rails_app/app/views/files/new.html.erb +4 -2
- data/examples/12_rails_app/app/views/files/show.html.erb +19 -3
- data/examples/12_rails_app/app/views/home/index.html.erb +45 -0
- data/examples/12_rails_app/app/views/layouts/application.html.erb +20 -18
- data/examples/12_rails_app/app/views/memories/_memory_card.html.erb +1 -1
- data/examples/12_rails_app/app/views/memories/deleted.html.erb +3 -1
- data/examples/12_rails_app/app/views/memories/edit.html.erb +2 -0
- data/examples/12_rails_app/app/views/memories/index.html.erb +2 -0
- data/examples/12_rails_app/app/views/memories/new.html.erb +2 -0
- data/examples/12_rails_app/app/views/memories/show.html.erb +4 -2
- data/examples/12_rails_app/app/views/messages/_message.html.erb +20 -0
- data/examples/12_rails_app/app/views/robots/index.html.erb +2 -0
- data/examples/12_rails_app/app/views/robots/new.html.erb +2 -0
- data/examples/12_rails_app/app/views/robots/show.html.erb +2 -0
- data/examples/12_rails_app/app/views/search/index.html.erb +59 -8
- data/examples/12_rails_app/app/views/shared/_navbar.html.erb +75 -29
- data/examples/12_rails_app/app/views/tags/index.html.erb +2 -0
- data/examples/12_rails_app/app/views/tags/show.html.erb +3 -1
- data/examples/12_rails_app/config/application.rb +1 -1
- data/examples/12_rails_app/config/database.yml +9 -5
- data/examples/12_rails_app/config/importmap.rb +1 -1
- data/examples/12_rails_app/config/initializers/htm.rb +9 -2
- data/examples/12_rails_app/config/initializers/ruby_llm.rb +33 -0
- data/examples/12_rails_app/config/routes.rb +39 -23
- data/examples/12_rails_app/db/migrate/20250124000001_create_ruby_llm_tables.rb +34 -0
- data/examples/12_rails_app/db/migrate/20250124000002_create_models_table.rb +28 -0
- data/examples/12_rails_app/db/schema.rb +67 -0
- data/examples/examples_helper.rb +25 -0
- data/lib/htm/circuit_breaker.rb +5 -6
- data/lib/htm/config/builder.rb +12 -12
- data/lib/htm/config/database.rb +21 -27
- data/lib/htm/config/validator.rb +12 -18
- data/lib/htm/config.rb +76 -65
- data/lib/htm/database.rb +193 -199
- data/lib/htm/embedding_service.rb +4 -9
- data/lib/htm/integrations/sinatra.rb +7 -7
- data/lib/htm/job_adapter.rb +14 -21
- data/lib/htm/jobs/generate_embedding_job.rb +28 -44
- data/lib/htm/jobs/generate_propositions_job.rb +29 -55
- data/lib/htm/jobs/generate_relationships_job.rb +137 -0
- data/lib/htm/jobs/generate_tags_job.rb +45 -67
- data/lib/htm/loaders/markdown_loader.rb +65 -112
- data/lib/htm/long_term_memory/fulltext_search.rb +1 -1
- data/lib/htm/long_term_memory/hybrid_search.rb +300 -128
- data/lib/htm/long_term_memory/node_operations.rb +2 -2
- data/lib/htm/long_term_memory/relevance_scorer.rb +100 -68
- data/lib/htm/long_term_memory/tag_operations.rb +87 -120
- data/lib/htm/long_term_memory/vector_search.rb +1 -1
- data/lib/htm/long_term_memory.rb +2 -1
- data/lib/htm/mcp/cli.rb +59 -58
- data/lib/htm/mcp/server.rb +5 -6
- data/lib/htm/mcp/tools.rb +30 -36
- data/lib/htm/migration.rb +10 -10
- data/lib/htm/models/node.rb +2 -3
- data/lib/htm/models/node_relationship.rb +72 -0
- data/lib/htm/models/node_tag.rb +2 -2
- data/lib/htm/models/robot_node.rb +2 -2
- data/lib/htm/models/tag.rb +41 -28
- data/lib/htm/observability.rb +45 -51
- data/lib/htm/proposition_service.rb +3 -7
- data/lib/htm/query_cache.rb +13 -15
- data/lib/htm/railtie.rb +1 -2
- data/lib/htm/robot_group.rb +9 -9
- data/lib/htm/sequel_config.rb +1 -0
- data/lib/htm/sql_builder.rb +1 -1
- data/lib/htm/tag_service.rb +2 -6
- data/lib/htm/timeframe.rb +4 -5
- data/lib/htm/timeframe_extractor.rb +42 -83
- data/lib/htm/version.rb +1 -1
- data/lib/htm/workflows/remember_workflow.rb +112 -115
- data/lib/htm/working_memory.rb +21 -26
- data/lib/htm.rb +103 -116
- data/lib/tasks/db.rake +0 -2
- data/lib/tasks/doc.rake +14 -13
- data/lib/tasks/files.rake +5 -12
- data/lib/tasks/htm.rake +70 -71
- data/lib/tasks/jobs.rake +41 -47
- data/lib/tasks/tags.rake +3 -8
- metadata +25 -100
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ../..
|
|
3
3
|
specs:
|
|
4
|
-
htm (0.0.
|
|
4
|
+
htm (0.0.31)
|
|
5
5
|
activesupport
|
|
6
|
-
anyway_config (>= 2.6)
|
|
7
6
|
async (~> 2.0)
|
|
8
7
|
baran
|
|
9
8
|
chronic
|
|
10
9
|
fast-mcp
|
|
11
10
|
lru_redux
|
|
11
|
+
myway_config (>= 0.1.2)
|
|
12
12
|
pg (>= 1.5.0)
|
|
13
13
|
ruby-progressbar
|
|
14
14
|
ruby_llm
|
|
@@ -20,82 +20,83 @@ PATH
|
|
|
20
20
|
GEM
|
|
21
21
|
remote: https://rubygems.org/
|
|
22
22
|
specs:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
action_text-trix (2.1.16)
|
|
24
|
+
railties
|
|
25
|
+
actioncable (8.1.2)
|
|
26
|
+
actionpack (= 8.1.2)
|
|
27
|
+
activesupport (= 8.1.2)
|
|
26
28
|
nio4r (~> 2.0)
|
|
27
29
|
websocket-driver (>= 0.6.1)
|
|
28
30
|
zeitwerk (~> 2.6)
|
|
29
|
-
actionmailbox (
|
|
30
|
-
actionpack (=
|
|
31
|
-
activejob (=
|
|
32
|
-
activerecord (=
|
|
33
|
-
activestorage (=
|
|
34
|
-
activesupport (=
|
|
31
|
+
actionmailbox (8.1.2)
|
|
32
|
+
actionpack (= 8.1.2)
|
|
33
|
+
activejob (= 8.1.2)
|
|
34
|
+
activerecord (= 8.1.2)
|
|
35
|
+
activestorage (= 8.1.2)
|
|
36
|
+
activesupport (= 8.1.2)
|
|
35
37
|
mail (>= 2.8.0)
|
|
36
|
-
actionmailer (
|
|
37
|
-
actionpack (=
|
|
38
|
-
actionview (=
|
|
39
|
-
activejob (=
|
|
40
|
-
activesupport (=
|
|
38
|
+
actionmailer (8.1.2)
|
|
39
|
+
actionpack (= 8.1.2)
|
|
40
|
+
actionview (= 8.1.2)
|
|
41
|
+
activejob (= 8.1.2)
|
|
42
|
+
activesupport (= 8.1.2)
|
|
41
43
|
mail (>= 2.8.0)
|
|
42
44
|
rails-dom-testing (~> 2.2)
|
|
43
|
-
actionpack (
|
|
44
|
-
actionview (=
|
|
45
|
-
activesupport (=
|
|
46
|
-
cgi
|
|
45
|
+
actionpack (8.1.2)
|
|
46
|
+
actionview (= 8.1.2)
|
|
47
|
+
activesupport (= 8.1.2)
|
|
47
48
|
nokogiri (>= 1.8.5)
|
|
48
|
-
|
|
49
|
-
rack (>= 2.2.4, < 3.3)
|
|
49
|
+
rack (>= 2.2.4)
|
|
50
50
|
rack-session (>= 1.0.1)
|
|
51
51
|
rack-test (>= 0.6.3)
|
|
52
52
|
rails-dom-testing (~> 2.2)
|
|
53
53
|
rails-html-sanitizer (~> 1.6)
|
|
54
54
|
useragent (~> 0.16)
|
|
55
|
-
actiontext (
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
actiontext (8.1.2)
|
|
56
|
+
action_text-trix (~> 2.1.15)
|
|
57
|
+
actionpack (= 8.1.2)
|
|
58
|
+
activerecord (= 8.1.2)
|
|
59
|
+
activestorage (= 8.1.2)
|
|
60
|
+
activesupport (= 8.1.2)
|
|
60
61
|
globalid (>= 0.6.0)
|
|
61
62
|
nokogiri (>= 1.8.5)
|
|
62
|
-
actionview (
|
|
63
|
-
activesupport (=
|
|
63
|
+
actionview (8.1.2)
|
|
64
|
+
activesupport (= 8.1.2)
|
|
64
65
|
builder (~> 3.1)
|
|
65
|
-
cgi
|
|
66
66
|
erubi (~> 1.11)
|
|
67
67
|
rails-dom-testing (~> 2.2)
|
|
68
68
|
rails-html-sanitizer (~> 1.6)
|
|
69
|
-
activejob (
|
|
70
|
-
activesupport (=
|
|
69
|
+
activejob (8.1.2)
|
|
70
|
+
activesupport (= 8.1.2)
|
|
71
71
|
globalid (>= 0.3.6)
|
|
72
|
-
activemodel (
|
|
73
|
-
activesupport (=
|
|
74
|
-
activerecord (
|
|
75
|
-
activemodel (=
|
|
76
|
-
activesupport (=
|
|
72
|
+
activemodel (8.1.2)
|
|
73
|
+
activesupport (= 8.1.2)
|
|
74
|
+
activerecord (8.1.2)
|
|
75
|
+
activemodel (= 8.1.2)
|
|
76
|
+
activesupport (= 8.1.2)
|
|
77
77
|
timeout (>= 0.4.0)
|
|
78
|
-
activestorage (
|
|
79
|
-
actionpack (=
|
|
80
|
-
activejob (=
|
|
81
|
-
activerecord (=
|
|
82
|
-
activesupport (=
|
|
78
|
+
activestorage (8.1.2)
|
|
79
|
+
actionpack (= 8.1.2)
|
|
80
|
+
activejob (= 8.1.2)
|
|
81
|
+
activerecord (= 8.1.2)
|
|
82
|
+
activesupport (= 8.1.2)
|
|
83
83
|
marcel (~> 1.0)
|
|
84
|
-
activesupport (
|
|
84
|
+
activesupport (8.1.2)
|
|
85
85
|
base64
|
|
86
|
-
benchmark (>= 0.3)
|
|
87
86
|
bigdecimal
|
|
88
87
|
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
89
88
|
connection_pool (>= 2.2.5)
|
|
90
89
|
drb
|
|
91
90
|
i18n (>= 1.6, < 2)
|
|
91
|
+
json
|
|
92
92
|
logger (>= 1.4.2)
|
|
93
93
|
minitest (>= 5.1)
|
|
94
94
|
securerandom (>= 0.3)
|
|
95
95
|
tzinfo (~> 2.0, >= 2.0.5)
|
|
96
|
+
uri (>= 0.13.1)
|
|
96
97
|
addressable (2.8.8)
|
|
97
98
|
public_suffix (>= 2.0.2, < 8.0)
|
|
98
|
-
anyway_config (2.
|
|
99
|
+
anyway_config (2.8.0)
|
|
99
100
|
ruby-next-core (~> 1.0)
|
|
100
101
|
async (2.36.0)
|
|
101
102
|
console (~> 1.29)
|
|
@@ -109,7 +110,6 @@ GEM
|
|
|
109
110
|
bigdecimal (4.0.1)
|
|
110
111
|
bindex (0.8.1)
|
|
111
112
|
builder (3.3.0)
|
|
112
|
-
cgi (0.5.1)
|
|
113
113
|
chronic (0.10.2)
|
|
114
114
|
concurrent-ruby (1.3.6)
|
|
115
115
|
connection_pool (3.0.2)
|
|
@@ -184,7 +184,7 @@ GEM
|
|
|
184
184
|
pp (>= 0.6.0)
|
|
185
185
|
rdoc (>= 4.0.0)
|
|
186
186
|
reline (>= 0.4.2)
|
|
187
|
-
json (2.18.
|
|
187
|
+
json (2.18.1)
|
|
188
188
|
logger (1.7.0)
|
|
189
189
|
loofah (2.25.0)
|
|
190
190
|
crass (~> 1.0.2)
|
|
@@ -201,11 +201,13 @@ GEM
|
|
|
201
201
|
mime-types (3.7.0)
|
|
202
202
|
logger
|
|
203
203
|
mime-types-data (~> 3.2025, >= 3.2025.0507)
|
|
204
|
-
mime-types-data (3.2026.
|
|
204
|
+
mime-types-data (3.2026.0203)
|
|
205
205
|
mini_mime (1.1.5)
|
|
206
206
|
minitest (6.0.1)
|
|
207
207
|
prism (~> 1.5)
|
|
208
208
|
multipart-post (2.4.1)
|
|
209
|
+
myway_config (0.1.2)
|
|
210
|
+
anyway_config (>= 2.0)
|
|
209
211
|
net-http (0.9.1)
|
|
210
212
|
uri (>= 0.11.1)
|
|
211
213
|
net-imap (0.6.2)
|
|
@@ -226,7 +228,7 @@ GEM
|
|
|
226
228
|
pp (0.6.3)
|
|
227
229
|
prettyprint
|
|
228
230
|
prettyprint (0.2.0)
|
|
229
|
-
prism (1.
|
|
231
|
+
prism (1.9.0)
|
|
230
232
|
propshaft (1.3.1)
|
|
231
233
|
actionpack (>= 7.0.0)
|
|
232
234
|
activesupport (>= 7.0.0)
|
|
@@ -246,20 +248,20 @@ GEM
|
|
|
246
248
|
rack (>= 1.3)
|
|
247
249
|
rackup (2.3.1)
|
|
248
250
|
rack (>= 3)
|
|
249
|
-
rails (
|
|
250
|
-
actioncable (=
|
|
251
|
-
actionmailbox (=
|
|
252
|
-
actionmailer (=
|
|
253
|
-
actionpack (=
|
|
254
|
-
actiontext (=
|
|
255
|
-
actionview (=
|
|
256
|
-
activejob (=
|
|
257
|
-
activemodel (=
|
|
258
|
-
activerecord (=
|
|
259
|
-
activestorage (=
|
|
260
|
-
activesupport (=
|
|
251
|
+
rails (8.1.2)
|
|
252
|
+
actioncable (= 8.1.2)
|
|
253
|
+
actionmailbox (= 8.1.2)
|
|
254
|
+
actionmailer (= 8.1.2)
|
|
255
|
+
actionpack (= 8.1.2)
|
|
256
|
+
actiontext (= 8.1.2)
|
|
257
|
+
actionview (= 8.1.2)
|
|
258
|
+
activejob (= 8.1.2)
|
|
259
|
+
activemodel (= 8.1.2)
|
|
260
|
+
activerecord (= 8.1.2)
|
|
261
|
+
activestorage (= 8.1.2)
|
|
262
|
+
activesupport (= 8.1.2)
|
|
261
263
|
bundler (>= 1.15.0)
|
|
262
|
-
railties (=
|
|
264
|
+
railties (= 8.1.2)
|
|
263
265
|
rails-dom-testing (2.3.0)
|
|
264
266
|
activesupport (>= 5.0.0)
|
|
265
267
|
minitest
|
|
@@ -267,10 +269,9 @@ GEM
|
|
|
267
269
|
rails-html-sanitizer (1.6.2)
|
|
268
270
|
loofah (~> 2.21)
|
|
269
271
|
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
|
270
|
-
railties (
|
|
271
|
-
actionpack (=
|
|
272
|
-
activesupport (=
|
|
273
|
-
cgi
|
|
272
|
+
railties (8.1.2)
|
|
273
|
+
actionpack (= 8.1.2)
|
|
274
|
+
activesupport (= 8.1.2)
|
|
274
275
|
irb (~> 1.13)
|
|
275
276
|
rackup (>= 1.0.0)
|
|
276
277
|
rake (>= 12.2)
|
|
@@ -298,7 +299,7 @@ GEM
|
|
|
298
299
|
zeitwerk (~> 2)
|
|
299
300
|
ruby_llm-schema (0.2.5)
|
|
300
301
|
securerandom (0.4.1)
|
|
301
|
-
sequel (5.
|
|
302
|
+
sequel (5.101.0)
|
|
302
303
|
bigdecimal
|
|
303
304
|
sequel_pg (1.18.2)
|
|
304
305
|
pg (>= 0.18.0, != 1.2.0)
|
|
@@ -329,29 +330,33 @@ PLATFORMS
|
|
|
329
330
|
arm64-darwin-25
|
|
330
331
|
|
|
331
332
|
DEPENDENCIES
|
|
333
|
+
benchmark
|
|
332
334
|
debug_me
|
|
333
335
|
htm!
|
|
336
|
+
logger
|
|
334
337
|
ostruct
|
|
335
338
|
pg (~> 1.5)
|
|
336
339
|
propshaft
|
|
337
340
|
puma (~> 6.0)
|
|
338
|
-
rails (~>
|
|
341
|
+
rails (~> 8.1)
|
|
342
|
+
ruby_llm (>= 1.0)
|
|
339
343
|
web-console
|
|
340
344
|
|
|
341
345
|
CHECKSUMS
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
346
|
+
action_text-trix (2.1.16) sha256=f645a2c21821b8449fd1d6770708f4031c91a2eedf9ef476e9be93c64e703a8a
|
|
347
|
+
actioncable (8.1.2) sha256=dc31efc34cca9cdefc5c691ddb8b4b214c0ea5cd1372108cbc1377767fb91969
|
|
348
|
+
actionmailbox (8.1.2) sha256=058b2fb1980e5d5a894f675475fcfa45c62631103d5a2596d9610ec81581889b
|
|
349
|
+
actionmailer (8.1.2) sha256=f4c1d2060f653bfe908aa7fdc5a61c0e5279670de992146582f2e36f8b9175e9
|
|
350
|
+
actionpack (8.1.2) sha256=ced74147a1f0daafaa4bab7f677513fd4d3add574c7839958f7b4f1de44f8423
|
|
351
|
+
actiontext (8.1.2) sha256=0bf57da22a9c19d970779c3ce24a56be31b51c7640f2763ec64aa72e358d2d2d
|
|
352
|
+
actionview (8.1.2) sha256=80455b2588911c9b72cec22d240edacb7c150e800ef2234821269b2b2c3e2e5b
|
|
353
|
+
activejob (8.1.2) sha256=908dab3713b101859536375819f4156b07bdf4c232cc645e7538adb9e302f825
|
|
354
|
+
activemodel (8.1.2) sha256=e21358c11ce68aed3f9838b7e464977bc007b4446c6e4059781e1d5c03bcf33e
|
|
355
|
+
activerecord (8.1.2) sha256=acfbe0cadfcc50fa208011fe6f4eb01cae682ebae0ef57145ba45380c74bcc44
|
|
356
|
+
activestorage (8.1.2) sha256=8a63a48c3999caeee26a59441f813f94681fc35cc41aba7ce1f836add04fba76
|
|
357
|
+
activesupport (8.1.2) sha256=88842578ccd0d40f658289b0e8c842acfe9af751afee2e0744a7873f50b6fdae
|
|
353
358
|
addressable (2.8.8) sha256=7c13b8f9536cf6364c03b9d417c19986019e28f7c00ac8132da4eb0fe393b057
|
|
354
|
-
anyway_config (2.
|
|
359
|
+
anyway_config (2.8.0) sha256=f6797a7231f81202dcd3d0c07284e836e45713e761d320180348b13a5c7c9306
|
|
355
360
|
async (2.36.0) sha256=090623f4c65706664355c9efa6c7bfb86771a513e65cd681c51cb27747530550
|
|
356
361
|
baran (0.2.1) sha256=6c19e835c6f73c70e7073fb3d3cb48d2c85606e0b1484914b4c01a3cecdd7892
|
|
357
362
|
base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
|
|
@@ -359,7 +364,6 @@ CHECKSUMS
|
|
|
359
364
|
bigdecimal (4.0.1) sha256=8b07d3d065a9f921c80ceaea7c9d4ae596697295b584c296fe599dd0ad01c4a7
|
|
360
365
|
bindex (0.8.1) sha256=7b1ecc9dc539ed8bccfc8cb4d2732046227b09d6f37582ff12e50a5047ceb17e
|
|
361
366
|
builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f
|
|
362
|
-
cgi (0.5.1) sha256=e93fcafc69b8a934fe1e6146121fa35430efa8b4a4047c4893764067036f18e9
|
|
363
367
|
chronic (0.10.2) sha256=766f2fcce6ac3cc152249ed0f2b827770d3e517e2e87c5fba7ed74f4889d2dc3
|
|
364
368
|
concurrent-ruby (1.3.6) sha256=6b56837e1e7e5292f9864f34b69c5a2cbc75c0cf5338f1ce9903d10fa762d5ab
|
|
365
369
|
connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
|
|
@@ -387,12 +391,12 @@ CHECKSUMS
|
|
|
387
391
|
fiber-local (1.1.0) sha256=c885f94f210fb9b05737de65d511136ea602e00c5105953748aa0f8793489f06
|
|
388
392
|
fiber-storage (1.0.1) sha256=f48e5b6d8b0be96dac486332b55cee82240057065dc761c1ea692b2e719240e1
|
|
389
393
|
globalid (1.3.0) sha256=05c639ad6eb4594522a0b07983022f04aa7254626ab69445a0e493aa3786ff11
|
|
390
|
-
htm (0.0.
|
|
394
|
+
htm (0.0.31)
|
|
391
395
|
i18n (1.14.8) sha256=285778639134865c5e0f6269e0b818256017e8cde89993fdfcbfb64d088824a5
|
|
392
396
|
io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc
|
|
393
397
|
io-event (1.14.2) sha256=b0a069190eafe86005c22f7464f744971b5bd82f153740d34e6ab49548d4f613
|
|
394
398
|
irb (1.16.0) sha256=2abe56c9ac947cdcb2f150572904ba798c1e93c890c256f8429981a7675b0806
|
|
395
|
-
json (2.18.
|
|
399
|
+
json (2.18.1) sha256=fe112755501b8d0466b5ada6cf50c8c3f41e897fa128ac5d263ec09eedc9f986
|
|
396
400
|
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
|
|
397
401
|
loofah (2.25.0) sha256=df5ed7ac3bac6a4ec802df3877ee5cc86d027299f8952e6243b3dac446b060e6
|
|
398
402
|
lru_redux (1.1.0) sha256=ee71d0ccab164c51de146c27b480a68b3631d5b4297b8ffe8eda1c72de87affb
|
|
@@ -400,10 +404,11 @@ CHECKSUMS
|
|
|
400
404
|
marcel (1.1.0) sha256=fdcfcfa33cc52e93c4308d40e4090a5d4ea279e160a7f6af988260fa970e0bee
|
|
401
405
|
metrics (0.15.0) sha256=61ded5bac95118e995b1bc9ed4a5f19bc9814928a312a85b200abbdac9039072
|
|
402
406
|
mime-types (3.7.0) sha256=dcebf61c246f08e15a4de34e386ebe8233791e868564a470c3fe77c00eed5e56
|
|
403
|
-
mime-types-data (3.2026.
|
|
407
|
+
mime-types-data (3.2026.0203) sha256=54353d693af028847391c28361c07d4b8b689cad78c3e1cc272fb1205c6d2a2f
|
|
404
408
|
mini_mime (1.1.5) sha256=8681b7e2e4215f2a159f9400b5816d85e9d8c6c6b491e96a12797e798f8bccef
|
|
405
409
|
minitest (6.0.1) sha256=7854c74f48e2e975969062833adc4013f249a4b212f5e7b9d5c040bf838d54bb
|
|
406
410
|
multipart-post (2.4.1) sha256=9872d03a8e552020ca096adadbf5e3cb1cd1cdd6acd3c161136b8a5737cdb4a8
|
|
411
|
+
myway_config (0.1.2) sha256=c91741ded05babc443fcf5d012741ded8a1a1998c40a689cb32af27940b66be3
|
|
407
412
|
net-http (0.9.1) sha256=25ba0b67c63e89df626ed8fac771d0ad24ad151a858af2cc8e6a716ca4336996
|
|
408
413
|
net-imap (0.6.2) sha256=08caacad486853c61676cca0c0c47df93db02abc4a8239a8b67eb0981428acc6
|
|
409
414
|
net-pop (0.1.2) sha256=848b4e982013c15b2f0382792268763b748cce91c9e91e36b0f27ed26420dff3
|
|
@@ -416,7 +421,7 @@ CHECKSUMS
|
|
|
416
421
|
pg (1.6.3-arm64-darwin) sha256=7240330b572e6355d7c75a7de535edb5dfcbd6295d9c7777df4d9dddfb8c0e5f
|
|
417
422
|
pp (0.6.3) sha256=2951d514450b93ccfeb1df7d021cae0da16e0a7f95ee1e2273719669d0ab9df6
|
|
418
423
|
prettyprint (0.2.0) sha256=2bc9e15581a94742064a3cc8b0fb9d45aae3d03a1baa6ef80922627a0766f193
|
|
419
|
-
prism (1.
|
|
424
|
+
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
|
|
420
425
|
propshaft (1.3.1) sha256=9acc664ef67e819ffa3d95bd7ad4c3623ea799110c5f4dee67fa7e583e74c392
|
|
421
426
|
psych (5.3.1) sha256=eb7a57cef10c9d70173ff74e739d843ac3b2c019a003de48447b2963d81b1974
|
|
422
427
|
public_suffix (7.0.2) sha256=9114090c8e4e7135c1fd0e7acfea33afaab38101884320c65aaa0ffb8e26a857
|
|
@@ -426,10 +431,10 @@ CHECKSUMS
|
|
|
426
431
|
rack-session (2.1.1) sha256=0b6dc07dea7e4b583f58a48e8b806d4c9f1c6c9214ebc202ec94562cbea2e4e9
|
|
427
432
|
rack-test (2.2.0) sha256=005a36692c306ac0b4a9350355ee080fd09ddef1148a5f8b2ac636c720f5c463
|
|
428
433
|
rackup (2.3.1) sha256=6c79c26753778e90983761d677a48937ee3192b3ffef6bc963c0950f94688868
|
|
429
|
-
rails (
|
|
434
|
+
rails (8.1.2) sha256=5069061b23dfa8706b9f0159ae8b9d35727359103178a26962b868a680ba7d95
|
|
430
435
|
rails-dom-testing (2.3.0) sha256=8acc7953a7b911ca44588bf08737bc16719f431a1cc3091a292bca7317925c1d
|
|
431
436
|
rails-html-sanitizer (1.6.2) sha256=35fce2ca8242da8775c83b6ba9c1bcaad6751d9eb73c1abaa8403475ab89a560
|
|
432
|
-
railties (
|
|
437
|
+
railties (8.1.2) sha256=1289ece76b4f7668fc46d07e55cc992b5b8751f2ad85548b7da351b8c59f8055
|
|
433
438
|
rake (13.3.1) sha256=8c9e89d09f66a26a01264e7e3480ec0607f0c497a861ef16063604b1b08eb19c
|
|
434
439
|
rdoc (7.1.0) sha256=494899df0706c178596ca6e1d50f1b7eb285a9b2aae715be5abd742734f17363
|
|
435
440
|
reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
|
|
@@ -438,7 +443,7 @@ CHECKSUMS
|
|
|
438
443
|
ruby_llm (1.11.0) sha256=c1bc17bb02a7e805d8f62ea6ada2ecfe7782fc955e9440b53a2fdbd00e5ec9cc
|
|
439
444
|
ruby_llm-schema (0.2.5) sha256=b08cd42e8de7100325e2e868672a56f1915eb23692bb808f51f214e41392104f
|
|
440
445
|
securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
|
|
441
|
-
sequel (5.
|
|
446
|
+
sequel (5.101.0) sha256=d2ae3fd997a7c4572e8357918e777869faf90dc19310fcd6332747122aed2b29
|
|
442
447
|
sequel_pg (1.18.2) sha256=6bdf0f5f13e062ef0e4b1fd2ddafbe6a13d1aab579473c9627ef4e88da431953
|
|
443
448
|
simple_flow (0.3.0) sha256=f365506159d25625836db44d19484f7a337fdcd75aa06eae6d4d24c333ad618c
|
|
444
449
|
stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1
|
|
@@ -456,4 +461,4 @@ CHECKSUMS
|
|
|
456
461
|
zeitwerk (2.7.4) sha256=2bef90f356bdafe9a6c2bd32bcd804f83a4f9b8bc27f3600fff051eb3edcec8b
|
|
457
462
|
|
|
458
463
|
BUNDLED WITH
|
|
459
|
-
4.0.
|
|
464
|
+
4.0.5
|
|
@@ -13,33 +13,76 @@ A full-stack Rails application demonstrating HTM integration with a compelling U
|
|
|
13
13
|
|
|
14
14
|
## Tech Stack
|
|
15
15
|
|
|
16
|
-
- Rails
|
|
17
|
-
- Tailwind CSS
|
|
16
|
+
- Rails 8.1
|
|
17
|
+
- Tailwind CSS via CDN (no build step required)
|
|
18
18
|
- PostgreSQL with pgvector
|
|
19
19
|
- HTM gem for semantic memory management
|
|
20
|
+
- Propshaft for asset pipeline
|
|
21
|
+
- Auto-refresh via vanilla JavaScript (no Turbo/Hotwire)
|
|
22
|
+
|
|
23
|
+
## Prerequisites
|
|
24
|
+
|
|
25
|
+
- Ruby 3.2+ (required by Rails 8.x)
|
|
26
|
+
- PostgreSQL 17+ with pgvector and pg_trgm extensions
|
|
27
|
+
- Ollama running locally (for embeddings and tag extraction)
|
|
28
|
+
- direnv (for automatic environment setup)
|
|
20
29
|
|
|
21
30
|
## Setup
|
|
22
31
|
|
|
32
|
+
### Environment Variables (via direnv)
|
|
33
|
+
|
|
34
|
+
This project uses [direnv](https://direnv.net/) to automatically configure environment variables. When you `cd` into this directory, direnv loads settings from `examples/.envrc` (which inherits from the root `.envrc`).
|
|
35
|
+
|
|
36
|
+
**Key environment variables set automatically:**
|
|
37
|
+
|
|
38
|
+
| Variable | Value | Purpose |
|
|
39
|
+
|----------|-------|---------|
|
|
40
|
+
| `HTM_ENV` | `examples` | HTM environment name |
|
|
41
|
+
| `HTM_DATABASE__URL` | `postgresql://...htm_examples` | HTM database connection |
|
|
42
|
+
| `HTM_EMBEDDING__PROVIDER` | `ollama` | Embedding provider |
|
|
43
|
+
| `HTM_EMBEDDING__MODEL` | `embeddinggemma` | Embedding model |
|
|
44
|
+
| `HTM_TAG__PROVIDER` | `ollama` | Tag extraction provider |
|
|
45
|
+
| `HTM_TAG__MODEL` | `phi4` | Tag extraction model |
|
|
46
|
+
| `HTM_EXTRACT_PROPOSITIONS` | `true` | Enable proposition extraction |
|
|
47
|
+
|
|
48
|
+
To verify your environment is configured:
|
|
49
|
+
```bash
|
|
50
|
+
# Should show HTM_ENV=examples and HTM_DATABASE__URL pointing to htm_examples
|
|
51
|
+
env | grep HTM
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Installation
|
|
55
|
+
|
|
23
56
|
```bash
|
|
24
|
-
#
|
|
57
|
+
# Allow direnv (if prompted)
|
|
58
|
+
direnv allow
|
|
59
|
+
|
|
60
|
+
# Install Ruby dependencies
|
|
25
61
|
bundle install
|
|
26
62
|
|
|
27
|
-
#
|
|
28
|
-
|
|
63
|
+
# Create the Rails app database (required for Rails to boot)
|
|
64
|
+
createdb htm_rails_example_dev
|
|
65
|
+
|
|
66
|
+
# Create and setup the HTM examples database
|
|
67
|
+
createdb htm_examples
|
|
68
|
+
psql htm_examples -c "CREATE EXTENSION IF NOT EXISTS vector; CREATE EXTENSION IF NOT EXISTS pg_trgm;"
|
|
29
69
|
|
|
30
|
-
#
|
|
31
|
-
|
|
70
|
+
# Initialize HTM schema
|
|
71
|
+
bundle exec rake htm:db:setup
|
|
32
72
|
|
|
33
|
-
#
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
rails stimulus:install
|
|
73
|
+
# Ensure Ollama models are available
|
|
74
|
+
ollama pull embeddinggemma
|
|
75
|
+
ollama pull phi4
|
|
37
76
|
```
|
|
38
77
|
|
|
78
|
+
**Note:** This app uses two databases:
|
|
79
|
+
- `htm_rails_example_dev` - Rails application database (minimal, required for Rails)
|
|
80
|
+
- `htm_examples` - HTM memory database (configured via direnv)
|
|
81
|
+
|
|
39
82
|
## Running
|
|
40
83
|
|
|
41
84
|
```bash
|
|
42
|
-
# Start the Rails server
|
|
85
|
+
# Start the Rails server
|
|
43
86
|
./bin/dev
|
|
44
87
|
|
|
45
88
|
# Or start manually
|
|
@@ -71,7 +114,7 @@ The app features a dark theme with:
|
|
|
71
114
|
- `htm.recall()` - Search memories (Search page)
|
|
72
115
|
- `htm.forget()` / `htm.restore()` - Soft delete/restore
|
|
73
116
|
- `htm.load_file()` - Load markdown files (Files page)
|
|
74
|
-
- Tag hierarchy visualization via `HTM::Models::Tag.
|
|
117
|
+
- Tag hierarchy visualization via `HTM::Models::Tag.tree_svg`
|
|
75
118
|
|
|
76
119
|
## Pages
|
|
77
120
|
|
|
@@ -89,10 +132,18 @@ The app features a dark theme with:
|
|
|
89
132
|
## Development
|
|
90
133
|
|
|
91
134
|
The app uses:
|
|
92
|
-
- `propshaft` for asset pipeline
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
|
|
135
|
+
- `propshaft` for asset pipeline (CSS/images only)
|
|
136
|
+
- Tailwind CSS via CDN (no build step)
|
|
137
|
+
- Vanilla JavaScript for auto-refresh (no Turbo/Hotwire)
|
|
138
|
+
- Manual offset/limit pagination (no Kaminari)
|
|
139
|
+
|
|
140
|
+
No JavaScript build step required. Frontend dependencies loaded via CDN.
|
|
97
141
|
|
|
98
|
-
|
|
142
|
+
## Maintenance
|
|
143
|
+
|
|
144
|
+
**Uploaded Files:** Files uploaded via the web UI are stored in `tmp/uploads/`. These files are kept to support the "Sync" feature which re-reads files from disk. To clean up old uploads:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Remove all uploaded files (will break sync for uploaded files)
|
|
148
|
+
rm -rf tmp/uploads/*
|
|
149
|
+
```
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
class ApplicationController < ActionController::Base
|
|
4
4
|
# HTM instance for the current request
|
|
5
5
|
def htm
|
|
6
|
+
# Ensure HTM uses the examples database with memories (until server restart)
|
|
7
|
+
unless HTM.configuration.database_url&.include?('htm_examples')
|
|
8
|
+
HTM.configure do |config|
|
|
9
|
+
config.database_url = 'postgresql://localhost:5432/htm_examples'
|
|
10
|
+
end
|
|
11
|
+
end
|
|
6
12
|
@htm ||= HTM.new(robot_name: current_robot_name)
|
|
7
13
|
end
|
|
8
14
|
helper_method :htm
|