htm 0.0.14 → 0.0.17

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 (140) hide show
  1. checksums.yaml +4 -4
  2. data/.envrc +1 -0
  3. data/CHANGELOG.md +100 -0
  4. data/README.md +107 -1412
  5. data/bin/htm_mcp +31 -0
  6. data/config/database.yml +7 -4
  7. data/db/migrate/00003_create_file_sources.rb +5 -0
  8. data/db/migrate/00004_create_nodes.rb +17 -0
  9. data/db/migrate/00005_create_tags.rb +7 -0
  10. data/db/migrate/00006_create_node_tags.rb +2 -0
  11. data/db/migrate/00007_create_robot_nodes.rb +7 -0
  12. data/db/schema.sql +41 -29
  13. data/docs/api/yard/HTM/Configuration.md +54 -0
  14. data/docs/api/yard/HTM/Database.md +13 -10
  15. data/docs/api/yard/HTM/EmbeddingService.md +5 -1
  16. data/docs/api/yard/HTM/LongTermMemory.md +18 -277
  17. data/docs/api/yard/HTM/PropositionError.md +18 -0
  18. data/docs/api/yard/HTM/PropositionService.md +66 -0
  19. data/docs/api/yard/HTM/QueryCache.md +88 -0
  20. data/docs/api/yard/HTM/RobotGroup.md +481 -0
  21. data/docs/api/yard/HTM/SqlBuilder.md +108 -0
  22. data/docs/api/yard/HTM/TagService.md +4 -0
  23. data/docs/api/yard/HTM/Telemetry/NullInstrument.md +13 -0
  24. data/docs/api/yard/HTM/Telemetry/NullMeter.md +15 -0
  25. data/docs/api/yard/HTM/Telemetry.md +109 -0
  26. data/docs/api/yard/HTM/WorkingMemoryChannel.md +176 -0
  27. data/docs/api/yard/HTM.md +11 -23
  28. data/docs/api/yard/index.csv +102 -25
  29. data/docs/api/yard-reference.md +8 -0
  30. data/docs/assets/images/multi-provider-failover.svg +51 -0
  31. data/docs/assets/images/robot-group-architecture.svg +65 -0
  32. data/docs/database/README.md +3 -3
  33. data/docs/database/public.file_sources.svg +29 -21
  34. data/docs/database/public.node_tags.md +2 -0
  35. data/docs/database/public.node_tags.svg +53 -41
  36. data/docs/database/public.nodes.md +2 -0
  37. data/docs/database/public.nodes.svg +52 -40
  38. data/docs/database/public.robot_nodes.md +2 -0
  39. data/docs/database/public.robot_nodes.svg +30 -22
  40. data/docs/database/public.robots.svg +16 -12
  41. data/docs/database/public.tags.md +3 -0
  42. data/docs/database/public.tags.svg +41 -33
  43. data/docs/database/schema.json +66 -0
  44. data/docs/database/schema.svg +60 -48
  45. data/docs/development/index.md +13 -0
  46. data/docs/development/rake-tasks.md +1068 -0
  47. data/docs/getting-started/installation.md +31 -11
  48. data/docs/getting-started/quick-start.md +144 -155
  49. data/docs/guides/adding-memories.md +2 -3
  50. data/docs/guides/context-assembly.md +185 -184
  51. data/docs/guides/getting-started.md +154 -148
  52. data/docs/guides/index.md +7 -0
  53. data/docs/guides/long-term-memory.md +60 -92
  54. data/docs/guides/mcp-server.md +1052 -0
  55. data/docs/guides/multi-robot.md +249 -345
  56. data/docs/guides/recalling-memories.md +153 -163
  57. data/docs/guides/robot-groups.md +604 -0
  58. data/docs/guides/search-strategies.md +61 -58
  59. data/docs/guides/working-memory.md +103 -136
  60. data/docs/index.md +30 -26
  61. data/docs/multi_framework_support.md +2 -2
  62. data/examples/mcp_client.rb +2 -2
  63. data/examples/rails_app/.gitignore +2 -0
  64. data/examples/rails_app/Gemfile +22 -0
  65. data/examples/rails_app/Gemfile.lock +438 -0
  66. data/examples/rails_app/Procfile.dev +1 -0
  67. data/examples/rails_app/README.md +98 -0
  68. data/examples/rails_app/Rakefile +5 -0
  69. data/examples/rails_app/app/assets/stylesheets/application.css +83 -0
  70. data/examples/rails_app/app/assets/stylesheets/inter-font.css +6 -0
  71. data/examples/rails_app/app/controllers/application_controller.rb +19 -0
  72. data/examples/rails_app/app/controllers/dashboard_controller.rb +27 -0
  73. data/examples/rails_app/app/controllers/files_controller.rb +205 -0
  74. data/examples/rails_app/app/controllers/memories_controller.rb +102 -0
  75. data/examples/rails_app/app/controllers/robots_controller.rb +44 -0
  76. data/examples/rails_app/app/controllers/search_controller.rb +46 -0
  77. data/examples/rails_app/app/controllers/tags_controller.rb +30 -0
  78. data/examples/rails_app/app/javascript/application.js +4 -0
  79. data/examples/rails_app/app/javascript/controllers/application.js +9 -0
  80. data/examples/rails_app/app/javascript/controllers/index.js +6 -0
  81. data/examples/rails_app/app/views/dashboard/index.html.erb +123 -0
  82. data/examples/rails_app/app/views/files/index.html.erb +108 -0
  83. data/examples/rails_app/app/views/files/new.html.erb +321 -0
  84. data/examples/rails_app/app/views/files/show.html.erb +130 -0
  85. data/examples/rails_app/app/views/layouts/application.html.erb +124 -0
  86. data/examples/rails_app/app/views/memories/_memory_card.html.erb +51 -0
  87. data/examples/rails_app/app/views/memories/deleted.html.erb +62 -0
  88. data/examples/rails_app/app/views/memories/edit.html.erb +35 -0
  89. data/examples/rails_app/app/views/memories/index.html.erb +81 -0
  90. data/examples/rails_app/app/views/memories/new.html.erb +71 -0
  91. data/examples/rails_app/app/views/memories/show.html.erb +126 -0
  92. data/examples/rails_app/app/views/robots/index.html.erb +106 -0
  93. data/examples/rails_app/app/views/robots/new.html.erb +36 -0
  94. data/examples/rails_app/app/views/robots/show.html.erb +79 -0
  95. data/examples/rails_app/app/views/search/index.html.erb +184 -0
  96. data/examples/rails_app/app/views/shared/_navbar.html.erb +52 -0
  97. data/examples/rails_app/app/views/shared/_stat_card.html.erb +52 -0
  98. data/examples/rails_app/app/views/tags/index.html.erb +131 -0
  99. data/examples/rails_app/app/views/tags/show.html.erb +67 -0
  100. data/examples/rails_app/bin/dev +8 -0
  101. data/examples/rails_app/bin/rails +4 -0
  102. data/examples/rails_app/bin/rake +4 -0
  103. data/examples/rails_app/config/application.rb +33 -0
  104. data/examples/rails_app/config/boot.rb +5 -0
  105. data/examples/rails_app/config/database.yml +15 -0
  106. data/examples/rails_app/config/environment.rb +5 -0
  107. data/examples/rails_app/config/importmap.rb +7 -0
  108. data/examples/rails_app/config/routes.rb +38 -0
  109. data/examples/rails_app/config/tailwind.config.js +35 -0
  110. data/examples/rails_app/config.ru +5 -0
  111. data/examples/rails_app/log/.keep +0 -0
  112. data/examples/rails_app/tmp/local_secret.txt +1 -0
  113. data/examples/robot_groups/robot_worker.rb +1 -2
  114. data/examples/robot_groups/same_process.rb +1 -4
  115. data/lib/htm/active_record_config.rb +2 -5
  116. data/lib/htm/configuration.rb +35 -2
  117. data/lib/htm/database.rb +3 -6
  118. data/lib/htm/mcp/cli.rb +333 -0
  119. data/lib/htm/mcp/group_tools.rb +476 -0
  120. data/lib/htm/mcp/resources.rb +89 -0
  121. data/lib/htm/mcp/server.rb +98 -0
  122. data/lib/htm/mcp/tools.rb +488 -0
  123. data/lib/htm/models/file_source.rb +5 -3
  124. data/lib/htm/railtie.rb +0 -4
  125. data/lib/htm/robot_group.rb +721 -0
  126. data/lib/htm/tasks.rb +7 -4
  127. data/lib/htm/version.rb +1 -1
  128. data/lib/htm/working_memory_channel.rb +250 -0
  129. data/lib/htm.rb +2 -0
  130. data/lib/tasks/htm.rake +6 -9
  131. data/mkdocs.yml +2 -0
  132. metadata +75 -11
  133. data/bin/htm_mcp.rb +0 -621
  134. data/db/migrate/00009_add_working_memory_to_robot_nodes.rb +0 -12
  135. data/db/migrate/00010_add_soft_delete_to_associations.rb +0 -29
  136. data/db/migrate/00011_add_performance_indexes.rb +0 -21
  137. data/db/migrate/00012_add_tags_trigram_index.rb +0 -18
  138. data/db/migrate/00013_enable_lz4_compression.rb +0 -43
  139. data/examples/robot_groups/lib/robot_group.rb +0 -419
  140. data/examples/robot_groups/lib/working_memory_channel.rb +0 -140
data/bin/htm_mcp ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # HTM MCP Server with CLI management commands
5
+ #
6
+ # Usage:
7
+ # htm_mcp # Start MCP server (default)
8
+ # htm_mcp server # Start MCP server (explicit)
9
+ # htm_mcp setup # Initialize database
10
+ # htm_mcp init # Initialize database (alias for setup)
11
+ # htm_mcp verify # Verify database connection
12
+ # htm_mcp stats # Show memory statistics
13
+ # htm_mcp version # Show HTM version
14
+ # htm_mcp help # Show help and environment variables
15
+
16
+ # Setup bundler to load gems from Gemfile
17
+ # This allows running the script directly without `bundle exec`
18
+ require 'bundler/setup'
19
+
20
+ require_relative '../lib/htm'
21
+ require_relative '../lib/htm/mcp/cli'
22
+
23
+ # Handle CLI commands (exits if command handled)
24
+ # Returns false if server should start
25
+ unless HTM::MCP::CLI.run(ARGV) == false
26
+ exit 0
27
+ end
28
+
29
+ # Start MCP server
30
+ require_relative '../lib/htm/mcp/server'
31
+ HTM::MCP::Server.start
data/config/database.yml CHANGED
@@ -9,15 +9,18 @@
9
9
  # Example HTM_DBURL format:
10
10
  # postgresql://user:password@host:port/database?sslmode=require
11
11
  #
12
+ # Environment detection priority:
13
+ # HTM_ENV > RAILS_ENV > RACK_ENV > 'development'
14
+ #
12
15
  # Test database:
13
- # Tests always use htm_test database (Rails convention).
14
- # Set RAILS_ENV=test or RACK_ENV=test to use the test configuration.
16
+ # Tests always use htm_test database.
17
+ # Set HTM_ENV=test (or RAILS_ENV=test) to use the test configuration.
15
18
 
16
19
  <%
17
20
  require 'uri'
18
21
 
19
- # Determine current environment
20
- current_env = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
22
+ # Determine current environment (HTM_ENV takes priority for non-Rails users)
23
+ current_env = ENV['HTM_ENV'] || ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
21
24
 
22
25
  # Parse connection from HTM_DBURL or use individual variables
23
26
  if ENV['HTM_DBURL']
@@ -16,5 +16,10 @@ class CreateFileSources < ActiveRecord::Migration[7.1]
16
16
  add_index :file_sources, :file_path, unique: true, name: 'idx_file_sources_path_unique'
17
17
  add_index :file_sources, :file_hash, name: 'idx_file_sources_hash'
18
18
  add_index :file_sources, :last_synced_at, name: 'idx_file_sources_last_synced'
19
+
20
+ # LZ4 compression for better read performance on JSONB column
21
+ execute <<~SQL
22
+ ALTER TABLE file_sources ALTER COLUMN frontmatter SET COMPRESSION lz4;
23
+ SQL
19
24
  end
20
25
  end
@@ -59,6 +59,23 @@ class CreateNodes < ActiveRecord::Migration[7.1]
59
59
  CHECK (embedding_dimension IS NULL OR (embedding_dimension > 0 AND embedding_dimension <= 2000))
60
60
  SQL
61
61
 
62
+ # Partial index for active (non-deleted) node queries
63
+ add_index :nodes, :id,
64
+ name: 'idx_nodes_active',
65
+ where: 'deleted_at IS NULL'
66
+
67
+ # Composite index for embedding-based searches on active nodes
68
+ execute <<-SQL
69
+ CREATE INDEX idx_nodes_active_with_embedding ON nodes (id)
70
+ WHERE deleted_at IS NULL AND embedding IS NOT NULL
71
+ SQL
72
+
73
+ # LZ4 compression for better read performance
74
+ execute <<-SQL
75
+ ALTER TABLE nodes ALTER COLUMN metadata SET COMPRESSION lz4;
76
+ ALTER TABLE nodes ALTER COLUMN content SET COMPRESSION lz4;
77
+ SQL
78
+
62
79
  # Foreign key to file_sources table
63
80
  add_foreign_key :nodes, :file_sources, column: :source_id, on_delete: :nullify
64
81
  end
@@ -5,9 +5,16 @@ class CreateTags < ActiveRecord::Migration[7.1]
5
5
  create_table :tags, comment: 'Unique tag names for categorization' do |t|
6
6
  t.text :name, null: false, comment: 'Hierarchical tag in format: root:level1:level2 (e.g., database:postgresql:timescaledb)'
7
7
  t.timestamptz :created_at, default: -> { 'CURRENT_TIMESTAMP' }, comment: 'When this tag was created'
8
+ t.timestamptz :deleted_at, comment: 'Soft delete timestamp'
8
9
  end
9
10
 
10
11
  add_index :tags, :name, unique: true, name: 'idx_tags_name_unique'
11
12
  add_index :tags, :name, using: :btree, opclass: :text_pattern_ops, name: 'idx_tags_name_pattern'
13
+ add_index :tags, :deleted_at, name: 'idx_tags_deleted_at'
14
+
15
+ # GIN trigram index for fuzzy search (typo-tolerant queries)
16
+ execute <<~SQL
17
+ CREATE INDEX idx_tags_name_trgm ON tags USING gin(name gin_trgm_ops);
18
+ SQL
12
19
  end
13
20
  end
@@ -6,11 +6,13 @@ class CreateNodeTags < ActiveRecord::Migration[7.1]
6
6
  t.bigint :node_id, null: false, comment: 'ID of the node being tagged'
7
7
  t.bigint :tag_id, null: false, comment: 'ID of the tag being applied'
8
8
  t.timestamptz :created_at, default: -> { 'CURRENT_TIMESTAMP' }, comment: 'When this association was created'
9
+ t.timestamptz :deleted_at, comment: 'Soft delete timestamp'
9
10
  end
10
11
 
11
12
  add_index :node_tags, [:node_id, :tag_id], unique: true, name: 'idx_node_tags_unique'
12
13
  add_index :node_tags, :node_id, name: 'idx_node_tags_node_id'
13
14
  add_index :node_tags, :tag_id, name: 'idx_node_tags_tag_id'
15
+ add_index :node_tags, :deleted_at, name: 'idx_node_tags_deleted_at'
14
16
 
15
17
  add_foreign_key :node_tags, :nodes, column: :node_id, on_delete: :cascade
16
18
  add_foreign_key :node_tags, :tags, column: :tag_id, on_delete: :cascade
@@ -11,14 +11,21 @@ class CreateRobotNodes < ActiveRecord::Migration[7.1]
11
11
  comment: 'When this robot last tried to remember this content'
12
12
  t.integer :remember_count, default: 1, null: false,
13
13
  comment: 'Number of times this robot has tried to remember this content'
14
+ t.boolean :working_memory, default: false, null: false,
15
+ comment: 'True if this node is currently in the robot working memory'
14
16
  t.timestamptz :created_at, default: -> { 'CURRENT_TIMESTAMP' }
15
17
  t.timestamptz :updated_at, default: -> { 'CURRENT_TIMESTAMP' }
18
+ t.timestamptz :deleted_at, comment: 'Soft delete timestamp'
16
19
  end
17
20
 
18
21
  add_index :robot_nodes, [:robot_id, :node_id], unique: true, name: 'idx_robot_nodes_unique'
19
22
  add_index :robot_nodes, :robot_id, name: 'idx_robot_nodes_robot_id'
20
23
  add_index :robot_nodes, :node_id, name: 'idx_robot_nodes_node_id'
21
24
  add_index :robot_nodes, :last_remembered_at, name: 'idx_robot_nodes_last_remembered_at'
25
+ add_index :robot_nodes, :deleted_at, name: 'idx_robot_nodes_deleted_at'
26
+ add_index :robot_nodes, [:robot_id, :working_memory],
27
+ where: 'working_memory = true',
28
+ name: 'idx_robot_nodes_working_memory'
22
29
 
23
30
  add_foreign_key :robot_nodes, :robots, column: :robot_id, on_delete: :cascade
24
31
  add_foreign_key :robot_nodes, :nodes, column: :node_id, on_delete: :cascade
data/db/schema.sql CHANGED
@@ -108,7 +108,7 @@ CREATE TABLE public.node_tags (
108
108
  node_id bigint NOT NULL,
109
109
  tag_id bigint NOT NULL,
110
110
  created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
111
- deleted_at timestamp(6) without time zone
111
+ deleted_at timestamp with time zone
112
112
  );
113
113
 
114
114
  --
@@ -135,6 +135,12 @@ COMMENT ON COLUMN public.node_tags.tag_id IS 'ID of the tag being applied';
135
135
 
136
136
  COMMENT ON COLUMN public.node_tags.created_at IS 'When this association was created';
137
137
 
138
+ --
139
+ -- Name: COLUMN node_tags.deleted_at; Type: COMMENT; Schema: public; Owner: -
140
+ --
141
+
142
+ COMMENT ON COLUMN public.node_tags.deleted_at IS 'Soft delete timestamp';
143
+
138
144
  --
139
145
  -- Name: node_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
140
146
  --
@@ -288,10 +294,10 @@ CREATE TABLE public.robot_nodes (
288
294
  first_remembered_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
289
295
  last_remembered_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
290
296
  remember_count integer DEFAULT 1 NOT NULL,
297
+ working_memory boolean DEFAULT false NOT NULL,
291
298
  created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
292
299
  updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
293
- working_memory boolean DEFAULT false NOT NULL,
294
- deleted_at timestamp(6) without time zone
300
+ deleted_at timestamp with time zone
295
301
  );
296
302
 
297
303
  --
@@ -336,6 +342,12 @@ COMMENT ON COLUMN public.robot_nodes.remember_count IS 'Number of times this rob
336
342
 
337
343
  COMMENT ON COLUMN public.robot_nodes.working_memory IS 'True if this node is currently in the robot working memory';
338
344
 
345
+ --
346
+ -- Name: COLUMN robot_nodes.deleted_at; Type: COMMENT; Schema: public; Owner: -
347
+ --
348
+
349
+ COMMENT ON COLUMN public.robot_nodes.deleted_at IS 'Soft delete timestamp';
350
+
339
351
  --
340
352
  -- Name: robot_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
341
353
  --
@@ -421,7 +433,7 @@ CREATE TABLE public.tags (
421
433
  id bigint NOT NULL,
422
434
  name text NOT NULL,
423
435
  created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
424
- deleted_at timestamp(6) without time zone
436
+ deleted_at timestamp with time zone
425
437
  );
426
438
 
427
439
  --
@@ -442,6 +454,12 @@ COMMENT ON COLUMN public.tags.name IS 'Hierarchical tag in format: root:level1:l
442
454
 
443
455
  COMMENT ON COLUMN public.tags.created_at IS 'When this tag was created';
444
456
 
457
+ --
458
+ -- Name: COLUMN tags.deleted_at; Type: COMMENT; Schema: public; Owner: -
459
+ --
460
+
461
+ COMMENT ON COLUMN public.tags.deleted_at IS 'Soft delete timestamp';
462
+
445
463
  --
446
464
  -- Name: tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
447
465
  --
@@ -562,6 +580,12 @@ CREATE INDEX idx_file_sources_last_synced ON public.file_sources USING btree (la
562
580
 
563
581
  CREATE UNIQUE INDEX idx_file_sources_path_unique ON public.file_sources USING btree (file_path);
564
582
 
583
+ --
584
+ -- Name: idx_node_tags_deleted_at; Type: INDEX; Schema: public; Owner: -
585
+ --
586
+
587
+ CREATE INDEX idx_node_tags_deleted_at ON public.node_tags USING btree (deleted_at);
588
+
565
589
  --
566
590
  -- Name: idx_node_tags_node_id; Type: INDEX; Schema: public; Owner: -
567
591
  --
@@ -592,12 +616,6 @@ CREATE INDEX idx_nodes_access_count ON public.nodes USING btree (access_count);
592
616
 
593
617
  CREATE INDEX idx_nodes_active ON public.nodes USING btree (id) WHERE (deleted_at IS NULL);
594
618
 
595
- --
596
- -- Name: INDEX idx_nodes_active; Type: COMMENT; Schema: public; Owner: -
597
- --
598
-
599
- COMMENT ON INDEX public.idx_nodes_active IS 'Partial index for active (non-deleted) node queries';
600
-
601
619
  --
602
620
  -- Name: idx_nodes_active_with_embedding; Type: INDEX; Schema: public; Owner: -
603
621
  --
@@ -676,6 +694,12 @@ CREATE INDEX idx_nodes_source_id ON public.nodes USING btree (source_id);
676
694
 
677
695
  CREATE INDEX idx_nodes_updated_at ON public.nodes USING btree (updated_at);
678
696
 
697
+ --
698
+ -- Name: idx_robot_nodes_deleted_at; Type: INDEX; Schema: public; Owner: -
699
+ --
700
+
701
+ CREATE INDEX idx_robot_nodes_deleted_at ON public.robot_nodes USING btree (deleted_at);
702
+
679
703
  --
680
704
  -- Name: idx_robot_nodes_last_remembered_at; Type: INDEX; Schema: public; Owner: -
681
705
  --
@@ -706,6 +730,12 @@ CREATE UNIQUE INDEX idx_robot_nodes_unique ON public.robot_nodes USING btree (ro
706
730
 
707
731
  CREATE INDEX idx_robot_nodes_working_memory ON public.robot_nodes USING btree (robot_id, working_memory) WHERE (working_memory = true);
708
732
 
733
+ --
734
+ -- Name: idx_tags_deleted_at; Type: INDEX; Schema: public; Owner: -
735
+ --
736
+
737
+ CREATE INDEX idx_tags_deleted_at ON public.tags USING btree (deleted_at);
738
+
709
739
  --
710
740
  -- Name: idx_tags_name_pattern; Type: INDEX; Schema: public; Owner: -
711
741
  --
@@ -724,24 +754,6 @@ CREATE INDEX idx_tags_name_trgm ON public.tags USING gin (name public.gin_trgm_o
724
754
 
725
755
  CREATE UNIQUE INDEX idx_tags_name_unique ON public.tags USING btree (name);
726
756
 
727
- --
728
- -- Name: index_node_tags_on_deleted_at; Type: INDEX; Schema: public; Owner: -
729
- --
730
-
731
- CREATE INDEX index_node_tags_on_deleted_at ON public.node_tags USING btree (deleted_at);
732
-
733
- --
734
- -- Name: index_robot_nodes_on_deleted_at; Type: INDEX; Schema: public; Owner: -
735
- --
736
-
737
- CREATE INDEX index_robot_nodes_on_deleted_at ON public.robot_nodes USING btree (deleted_at);
738
-
739
- --
740
- -- Name: index_tags_on_deleted_at; Type: INDEX; Schema: public; Owner: -
741
- --
742
-
743
- CREATE INDEX index_tags_on_deleted_at ON public.tags USING btree (deleted_at);
744
-
745
757
  --
746
758
  -- Name: nodes fk_rails_920ad16d08; Type: FK CONSTRAINT; Schema: public; Owner: -
747
759
  --
@@ -781,4 +793,4 @@ ALTER TABLE ONLY public.robot_nodes
781
793
  -- PostgreSQL database dump complete
782
794
  --
783
795
 
784
- \unrestrict bjkKIo8iBhvKUCAsIDDWdDnwALL0oxUsmZVbvgEad6ZmhcLmalGL4Ih7bfe9nlh
796
+ \unrestrict 4WlUqnJzNHaNhcr67XLIIhAvRPidZODUPGkM34l27SvmC0zu6dIsQdJ8dtu589Z
@@ -81,6 +81,21 @@ Returns the value of attribute bedrock_region.
81
81
  ## bedrock_secret_key[RW] {: #attribute-i-bedrock_secret_key }
82
82
  Returns the value of attribute bedrock_secret_key.
83
83
 
84
+ ## chunk_overlap[RW] {: #attribute-i-chunk_overlap }
85
+ Character overlap between chunks (default: 64)
86
+
87
+ ## chunk_size[RW] {: #attribute-i-chunk_size }
88
+ Chunking configuration (for file loading)
89
+
90
+ ## circuit_breaker_failure_threshold[RW] {: #attribute-i-circuit_breaker_failure_threshold }
91
+ Circuit breaker configuration
92
+
93
+ ## circuit_breaker_half_open_max_calls[RW] {: #attribute-i-circuit_breaker_half_open_max_calls }
94
+ Successes to close (default: 3)
95
+
96
+ ## circuit_breaker_reset_timeout[RW] {: #attribute-i-circuit_breaker_reset_timeout }
97
+ Seconds before half-open (default: 60)
98
+
84
99
  ## connection_timeout[RW] {: #attribute-i-connection_timeout }
85
100
  Returns the value of attribute connection_timeout.
86
101
 
@@ -102,6 +117,9 @@ Returns the value of attribute embedding_provider.
102
117
  ## embedding_timeout[RW] {: #attribute-i-embedding_timeout }
103
118
  Returns the value of attribute embedding_timeout.
104
119
 
120
+ ## extract_propositions[RW] {: #attribute-i-extract_propositions }
121
+ Returns the value of attribute extract_propositions.
122
+
105
123
  ## gemini_api_key[RW] {: #attribute-i-gemini_api_key }
106
124
  Returns the value of attribute gemini_api_key.
107
125
 
@@ -114,6 +132,12 @@ Returns the value of attribute job_backend.
114
132
  ## logger[RW] {: #attribute-i-logger }
115
133
  Returns the value of attribute logger.
116
134
 
135
+ ## max_embedding_dimension[RW] {: #attribute-i-max_embedding_dimension }
136
+ Limit configuration
137
+
138
+ ## max_tag_depth[RW] {: #attribute-i-max_tag_depth }
139
+ Max tag hierarchy depth (default: 4)
140
+
117
141
  ## ollama_url[RW] {: #attribute-i-ollama_url }
118
142
  Returns the value of attribute ollama_url.
119
143
 
@@ -129,6 +153,33 @@ Provider-specific API keys and endpoints
129
153
  ## openrouter_api_key[RW] {: #attribute-i-openrouter_api_key }
130
154
  Returns the value of attribute openrouter_api_key.
131
155
 
156
+ ## proposition_extractor[RW] {: #attribute-i-proposition_extractor }
157
+ Returns the value of attribute proposition_extractor.
158
+
159
+ ## proposition_model[RW] {: #attribute-i-proposition_model }
160
+ Returns the value of attribute proposition_model.
161
+
162
+ ## proposition_provider[RW] {: #attribute-i-proposition_provider }
163
+ Returns the value of attribute proposition_provider.
164
+
165
+ ## proposition_timeout[RW] {: #attribute-i-proposition_timeout }
166
+ Returns the value of attribute proposition_timeout.
167
+
168
+ ## relevance_access_weight[RW] {: #attribute-i-relevance_access_weight }
169
+ Access frequency weight (default: 0.1)
170
+
171
+ ## relevance_recency_half_life_hours[RW] {: #attribute-i-relevance_recency_half_life_hours }
172
+ Decay half-life in hours (default: 168 = 1 week)
173
+
174
+ ## relevance_recency_weight[RW] {: #attribute-i-relevance_recency_weight }
175
+ Temporal freshness weight (default: 0.1)
176
+
177
+ ## relevance_semantic_weight[RW] {: #attribute-i-relevance_semantic_weight }
178
+ Relevance scoring weights (must sum to 1.0)
179
+
180
+ ## relevance_tag_weight[RW] {: #attribute-i-relevance_tag_weight }
181
+ Tag overlap weight (default: 0.3)
182
+
132
183
  ## tag_extractor[RW] {: #attribute-i-tag_extractor }
133
184
  Returns the value of attribute tag_extractor.
134
185
 
@@ -141,6 +192,9 @@ Returns the value of attribute tag_provider.
141
192
  ## tag_timeout[RW] {: #attribute-i-tag_timeout }
142
193
  Returns the value of attribute tag_timeout.
143
194
 
195
+ ## telemetry_enabled[RW] {: #attribute-i-telemetry_enabled }
196
+ Enable OpenTelemetry metrics (default: false)
197
+
144
198
  ## token_counter[RW] {: #attribute-i-token_counter }
145
199
  Returns the value of attribute token_counter.
146
200
 
@@ -8,20 +8,23 @@ initialization
8
8
 
9
9
  # Class Methods
10
10
  ## default_config() {: #method-c-default_config }
11
- Get default database configuration
12
- **`@return`** [Hash, nil] Connection configuration hash
11
+ Get default database configuration (respects RAILS_ENV)
12
+
13
+ Uses ActiveRecordConfig which reads from config/database.yml and respects
14
+ RAILS_ENV for environment-specific database selection.
15
+ **`@return`** [Hash, nil] Connection configuration hash with PG-style keys
13
16
 
14
17
  ## drop(db_url nil) {: #method-c-drop }
15
- Drop all HTM tables
16
- **`@param`** [String] Database connection URL (uses ENV['HTM_DBURL'] if not provided)
18
+ Drop all HTM tables (respects RAILS_ENV)
19
+ **`@param`** [String] Database connection URL (uses default_config if not provided)
17
20
 
18
21
  **`@return`** [void]
19
22
 
20
23
  ## dump_schema(db_url nil) {: #method-c-dump_schema }
21
- Dump current database schema to db/schema.sql
24
+ Dump current database schema to db/schema.sql (respects RAILS_ENV)
22
25
 
23
26
  Uses pg_dump to create a clean SQL schema file without data
24
- **`@param`** [String] Database connection URL (uses ENV['HTM_DBURL'] if not provided)
27
+ **`@param`** [String] Database connection URL (uses default_config if not provided)
25
28
 
26
29
  **`@return`** [void]
27
30
 
@@ -39,16 +42,16 @@ comprehensive database documentation including:
39
42
  **`@return`** [void]
40
43
 
41
44
  ## info(db_url nil) {: #method-c-info }
42
- Show database info
43
- **`@param`** [String] Database connection URL (uses ENV['HTM_DBURL'] if not provided)
45
+ Show database info (respects RAILS_ENV)
46
+ **`@param`** [String] Database connection URL (uses default_config if not provided)
44
47
 
45
48
  **`@return`** [void]
46
49
 
47
50
  ## load_schema(db_url nil) {: #method-c-load_schema }
48
- Load schema from db/schema.sql
51
+ Load schema from db/schema.sql (respects RAILS_ENV)
49
52
 
50
53
  Uses psql to load the schema file
51
- **`@param`** [String] Database connection URL (uses ENV['HTM_DBURL'] if not provided)
54
+ **`@param`** [String] Database connection URL (uses default_config if not provided)
52
55
 
53
56
  **`@return`** [void]
54
57
 
@@ -39,8 +39,12 @@ Generate embedding with validation and processing
39
39
  storage_dimension: Integer # Padded dimension (2000)
40
40
  }
41
41
 
42
+ ## max_dimension() {: #method-c-max_dimension }
43
+ Maximum embedding dimension (configurable, default 2000)
44
+ **`@return`** [Integer] Max dimensions for pgvector HNSW index
45
+
42
46
  ## pad_embedding(embedding ) {: #method-c-pad_embedding }
43
- Pad embedding to MAX_DIMENSION with zeros
47
+ Pad embedding to max_dimension with zeros
44
48
  **`@param`** [Array<Float>] Original embedding
45
49
 
46
50
  **`@return`** [Array<Float>] Padded embedding