htm 0.0.17 → 0.0.18

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 (80) hide show
  1. checksums.yaml +4 -4
  2. data/.architecture/decisions/adrs/001-use-postgresql-timescaledb-storage.md +1 -1
  3. data/.architecture/decisions/adrs/011-database-side-embedding-generation-with-pgai.md +4 -4
  4. data/.architecture/decisions/adrs/012-llm-driven-ontology-topic-extraction.md +1 -1
  5. data/.envrc +12 -25
  6. data/.irbrc +7 -7
  7. data/.tbls.yml +2 -2
  8. data/CHANGELOG.md +71 -0
  9. data/README.md +1 -1
  10. data/Rakefile +8 -3
  11. data/SETUP.md +12 -12
  12. data/bin/htm_mcp +0 -4
  13. data/db/seed_data/README.md +2 -2
  14. data/db/seeds.rb +2 -2
  15. data/docs/api/database.md +37 -37
  16. data/docs/api/htm.md +1 -1
  17. data/docs/api/yard/HTM/ActiveRecordConfig.md +2 -2
  18. data/docs/api/yard/HTM/Configuration.md +26 -15
  19. data/docs/api/yard/HTM/Database.md +7 -8
  20. data/docs/api/yard/HTM/JobAdapter.md +1 -1
  21. data/docs/api/yard/HTM/Railtie.md +2 -2
  22. data/docs/architecture/adrs/001-postgresql-timescaledb.md +1 -1
  23. data/docs/architecture/adrs/011-pgai-integration.md +4 -4
  24. data/docs/database_rake_tasks.md +5 -5
  25. data/docs/development/rake-tasks.md +11 -11
  26. data/docs/development/setup.md +21 -21
  27. data/docs/development/testing.md +1 -1
  28. data/docs/getting-started/installation.md +20 -20
  29. data/docs/getting-started/quick-start.md +12 -12
  30. data/docs/guides/getting-started.md +2 -2
  31. data/docs/guides/long-term-memory.md +1 -1
  32. data/docs/guides/mcp-server.md +17 -17
  33. data/docs/guides/robot-groups.md +8 -8
  34. data/docs/index.md +4 -4
  35. data/docs/multi_framework_support.md +8 -8
  36. data/docs/setup_local_database.md +19 -19
  37. data/docs/using_rake_tasks_in_your_app.md +14 -14
  38. data/examples/README.md +50 -6
  39. data/examples/basic_usage.rb +31 -21
  40. data/examples/cli_app/README.md +8 -8
  41. data/examples/cli_app/htm_cli.rb +5 -5
  42. data/examples/config_file_example/README.md +256 -0
  43. data/examples/config_file_example/config/htm.local.yml +34 -0
  44. data/examples/config_file_example/custom_config.yml +22 -0
  45. data/examples/config_file_example/show_config.rb +125 -0
  46. data/examples/custom_llm_configuration.rb +7 -7
  47. data/examples/example_app/Rakefile +2 -2
  48. data/examples/example_app/app.rb +8 -8
  49. data/examples/file_loader_usage.rb +9 -9
  50. data/examples/mcp_client.rb +5 -5
  51. data/examples/rails_app/Gemfile.lock +48 -56
  52. data/examples/rails_app/README.md +1 -1
  53. data/examples/robot_groups/multi_process.rb +5 -5
  54. data/examples/robot_groups/robot_worker.rb +5 -5
  55. data/examples/robot_groups/same_process.rb +9 -9
  56. data/examples/sinatra_app/app.rb +1 -1
  57. data/examples/timeframe_demo.rb +1 -1
  58. data/lib/htm/active_record_config.rb +12 -25
  59. data/lib/htm/circuit_breaker.rb +0 -2
  60. data/lib/htm/config/defaults.yml +246 -0
  61. data/lib/htm/config.rb +888 -0
  62. data/lib/htm/database.rb +23 -27
  63. data/lib/htm/embedding_service.rb +0 -4
  64. data/lib/htm/integrations/sinatra.rb +3 -7
  65. data/lib/htm/job_adapter.rb +1 -15
  66. data/lib/htm/jobs/generate_embedding_job.rb +1 -7
  67. data/lib/htm/jobs/generate_propositions_job.rb +2 -12
  68. data/lib/htm/jobs/generate_tags_job.rb +1 -8
  69. data/lib/htm/loaders/defaults_loader.rb +143 -0
  70. data/lib/htm/loaders/xdg_config_loader.rb +116 -0
  71. data/lib/htm/mcp/cli.rb +200 -58
  72. data/lib/htm/mcp/server.rb +3 -3
  73. data/lib/htm/proposition_service.rb +2 -12
  74. data/lib/htm/railtie.rb +3 -4
  75. data/lib/htm/tag_service.rb +1 -8
  76. data/lib/htm/version.rb +1 -1
  77. data/lib/htm.rb +124 -5
  78. metadata +24 -4
  79. data/config/database.yml +0 -77
  80. data/lib/htm/configuration.rb +0 -799
@@ -8,10 +8,9 @@ initialization
8
8
 
9
9
  # Class Methods
10
10
  ## default_config() {: #method-c-default_config }
11
- Get default database configuration (respects RAILS_ENV)
11
+ Get default database configuration (respects HTM_ENV)
12
12
 
13
- Uses ActiveRecordConfig which reads from config/database.yml and respects
14
- RAILS_ENV for environment-specific database selection.
13
+ Uses HTM::Config for database settings.
15
14
  **`@return`** [Hash, nil] Connection configuration hash with PG-style keys
16
15
 
17
16
  ## drop(db_url nil) {: #method-c-drop }
@@ -37,7 +36,7 @@ comprehensive database documentation including:
37
36
  * Table schemas with comments
38
37
  * Index information
39
38
  * Relationship diagrams
40
- **`@param`** [String] Database connection URL (uses ENV['HTM_DBURL'] if not provided)
39
+ **`@param`** [String] Database connection URL (uses ENV['HTM_DATABASE__URL'] if not provided)
41
40
 
42
41
  **`@return`** [void]
43
42
 
@@ -57,13 +56,13 @@ Uses psql to load the schema file
57
56
 
58
57
  ## migrate(db_url nil) {: #method-c-migrate }
59
58
  Run pending database migrations
60
- **`@param`** [String] Database connection URL (uses ENV['HTM_DBURL'] if not provided)
59
+ **`@param`** [String] Database connection URL (uses ENV['HTM_DATABASE__URL'] if not provided)
61
60
 
62
61
  **`@return`** [void]
63
62
 
64
63
  ## migration_status(db_url nil) {: #method-c-migration_status }
65
64
  Show migration status
66
- **`@param`** [String] Database connection URL (uses ENV['HTM_DBURL'] if not provided)
65
+ **`@param`** [String] Database connection URL (uses ENV['HTM_DATABASE__URL'] if not provided)
67
66
 
68
67
  **`@return`** [void]
69
68
 
@@ -85,13 +84,13 @@ Seed database with sample data
85
84
  Loads and executes db/seeds.rb file following Rails conventions. All seeding
86
85
  logic is contained in db/seeds.rb and reads data from markdown files in
87
86
  db/seed_data/ directory.
88
- **`@param`** [String] Database connection URL (uses ENV['HTM_DBURL'] if not provided)
87
+ **`@param`** [String] Database connection URL (uses ENV['HTM_DATABASE__URL'] if not provided)
89
88
 
90
89
  **`@return`** [void]
91
90
 
92
91
  ## setup(db_url nil, run_migrations: true, dump_schema: false) {: #method-c-setup }
93
92
  Set up the HTM database schema
94
- **`@param`** [String] Database connection URL (uses ENV['HTM_DBURL'] if not provided)
93
+ **`@param`** [String] Database connection URL (uses ENV['HTM_DATABASE__URL'] if not provided)
95
94
 
96
95
  **`@param`** [Boolean] Whether to run migrations (default: true)
97
96
 
@@ -18,7 +18,7 @@ Supported backends:
18
18
  **`@example`**
19
19
  ```ruby
20
20
  HTM.configure do |config|
21
- config.job_backend = :active_job
21
+ config.job.backend = :active_job
22
22
  end
23
23
  ```
24
24
  **`@example`**
@@ -20,8 +20,8 @@ This railtie automatically configures HTM when Rails boots:
20
20
  ```ruby
21
21
  # config/initializers/htm.rb
22
22
  HTM.configure do |config|
23
- config.embedding_model = 'custom-model'
24
- config.tag_model = 'custom-tag-model'
23
+ config.embedding.model = 'custom-model'
24
+ config.tag.model = 'custom-tag-model'
25
25
  end
26
26
  ```
27
27
 
@@ -145,7 +145,7 @@ CREATE INDEX nodes_type_idx ON nodes (type);
145
145
 
146
146
  ```ruby
147
147
  # Via environment variable (preferred)
148
- ENV['HTM_DBURL'] = "postgresql://user:pass@host:port/dbname?sslmode=require"
148
+ ENV['HTM_DATABASE__URL'] = "postgresql://user:pass@host:port/dbname?sslmode=require"
149
149
 
150
150
  # Parsed into connection hash
151
151
  {
@@ -273,7 +273,7 @@ LIMIT $3;
273
273
  ruby enable_extensions.rb
274
274
 
275
275
  # 2. Run database schema with triggers
276
- psql $HTM_DBURL < sql/schema.sql
276
+ psql $HTM_DATABASE__URL < sql/schema.sql
277
277
 
278
278
  # 3. Use HTM normally - embeddings automatic!
279
279
  ruby -r ./lib/htm -e "HTM.new(robot_name: 'Bot').add_node('test', 'value')"
@@ -283,16 +283,16 @@ ruby -r ./lib/htm -e "HTM.new(robot_name: 'Bot').add_node('test', 'value')"
283
283
 
284
284
  ```bash
285
285
  # 1. Backup database
286
- pg_dump $HTM_DBURL > htm_backup.sql
286
+ pg_dump $HTM_DATABASE__URL > htm_backup.sql
287
287
 
288
288
  # 2. Enable pgai extension
289
289
  ruby enable_extensions.rb
290
290
 
291
291
  # 3. Apply new schema (adds triggers)
292
- psql $HTM_DBURL < sql/schema.sql
292
+ psql $HTM_DATABASE__URL < sql/schema.sql
293
293
 
294
294
  # 4. (Optional) Regenerate embeddings with new model
295
- psql $HTM_DBURL -c "UPDATE nodes SET value = value;"
295
+ psql $HTM_DATABASE__URL -c "UPDATE nodes SET value = value;"
296
296
  # This triggers embedding regeneration for all nodes
297
297
  ```
298
298
 
@@ -143,7 +143,7 @@ Opens an interactive PostgreSQL console (psql).
143
143
 
144
144
  **What it does:**
145
145
  - Launches `psql` connected to your HTM database
146
- - Uses connection parameters from `HTM_DBURL` or `.envrc`
146
+ - Uses connection parameters from `HTM_DATABASE__URL` or `.envrc`
147
147
  - Allows you to run SQL queries directly
148
148
 
149
149
  **Example:**
@@ -237,7 +237,7 @@ rake htm:db:info
237
237
 
238
238
  ### Method 2: Manual Export
239
239
  ```bash
240
- export HTM_DBURL="postgresql://user:password@host:port/dbname?sslmode=require"
240
+ export HTM_DATABASE__URL="postgresql://user:password@host:port/dbname?sslmode=require"
241
241
  rake htm:db:info
242
242
  ```
243
243
 
@@ -293,12 +293,12 @@ rake htm:db:migrate # Run new migrations only
293
293
 
294
294
  ### "Database configuration not found"
295
295
  - Run `direnv allow` in the project directory
296
- - Or manually export `HTM_DBURL`
297
- - Verify: `echo $HTM_DBURL`
296
+ - Or manually export `HTM_DATABASE__URL`
297
+ - Verify: `echo $HTM_DATABASE__URL`
298
298
 
299
299
  ### "Connection refused"
300
300
  - Check database is running
301
- - Verify host/port in `HTM_DBURL`
301
+ - Verify host/port in `HTM_DATABASE__URL`
302
302
  - Test: `rake htm:db:test`
303
303
 
304
304
  ### "Extension not found"
@@ -56,7 +56,7 @@ Running migrations...
56
56
 
57
57
  **What it does:**
58
58
 
59
- - Connects to PostgreSQL using `HTM_DBURL`
59
+ - Connects to PostgreSQL using `HTM_DATABASE__URL`
60
60
  - Verifies required extensions (pgvector, pg_trgm)
61
61
  - Creates all HTM tables (robots, nodes, tags, file_sources, etc.)
62
62
  - Runs all pending ActiveRecord migrations
@@ -906,7 +906,7 @@ Rebuilding tags for 1,542 nodes...
906
906
  bundle install
907
907
 
908
908
  # Set database URL
909
- export HTM_DBURL="postgresql://user@localhost:5432/htm_development"
909
+ export HTM_DATABASE__URL="postgresql://user@localhost:5432/htm_development"
910
910
 
911
911
  # Create and setup database
912
912
  rake htm:db:create
@@ -1012,17 +1012,17 @@ All tasks require database configuration. Set one of these:
1012
1012
 
1013
1013
  | Variable | Description |
1014
1014
  |----------|-------------|
1015
- | `HTM_DBURL` | Full PostgreSQL connection URL (preferred) |
1016
- | `HTM_DBHOST` | Database host |
1017
- | `HTM_DBPORT` | Database port |
1018
- | `HTM_DBNAME` | Database name |
1019
- | `HTM_DBUSER` | Database username |
1020
- | `HTM_DBPASS` | Database password |
1015
+ | `HTM_DATABASE__URL` | Full PostgreSQL connection URL (preferred) |
1016
+ | `HTM_DATABASE__HOST` | Database host |
1017
+ | `HTM_DATABASE__PORT` | Database port |
1018
+ | `HTM_DATABASE__NAME` | Database name |
1019
+ | `HTM_DATABASE__USER` | Database username |
1020
+ | `HTM_DATABASE__PASSWORD` | Database password |
1021
1021
 
1022
1022
  **Example:**
1023
1023
 
1024
1024
  ```bash
1025
- export HTM_DBURL="postgresql://user:password@localhost:5432/htm_development"
1025
+ export HTM_DATABASE__URL="postgresql://user:password@localhost:5432/htm_development"
1026
1026
  ```
1027
1027
 
1028
1028
  ---
@@ -1031,10 +1031,10 @@ export HTM_DBURL="postgresql://user:password@localhost:5432/htm_development"
1031
1031
 
1032
1032
  ### "Database configuration not found"
1033
1033
 
1034
- Set the `HTM_DBURL` environment variable:
1034
+ Set the `HTM_DATABASE__URL` environment variable:
1035
1035
 
1036
1036
  ```bash
1037
- export HTM_DBURL="postgresql://user@localhost:5432/htm_development"
1037
+ export HTM_DATABASE__URL="postgresql://user@localhost:5432/htm_development"
1038
1038
  ```
1039
1039
 
1040
1040
  ### "Extension not found"
@@ -187,11 +187,11 @@ Create or edit `~/.bashrc__tiger`:
187
187
  ```bash
188
188
  # TimescaleDB Connection Configuration
189
189
  export HTM_SERVICE_NAME="db-67977" # Your service name
190
- export HTM_DBNAME="tsdb"
191
- export HTM_DBUSER="tsdbadmin"
192
- export HTM_DBPASS="your_password_here"
193
- export HTM_DBPORT="37807" # Your port number
194
- export HTM_DBURL="postgres://tsdbadmin:your_password@host:port/tsdb?sslmode=require"
190
+ export HTM_DATABASE__NAME="tsdb"
191
+ export HTM_DATABASE__USER="tsdbadmin"
192
+ export HTM_DATABASE__PASSWORD="your_password_here"
193
+ export HTM_DATABASE__PORT="37807" # Your port number
194
+ export HTM_DATABASE__URL="postgres://tsdbadmin:your_password@host:port/tsdb?sslmode=require"
195
195
  ```
196
196
 
197
197
  Replace the placeholders with your actual connection details.
@@ -236,11 +236,11 @@ docker-compose up -d
236
236
  # Configure environment variables
237
237
  cat > ~/.bashrc__tiger <<'EOF'
238
238
  export HTM_SERVICE_NAME="local-dev"
239
- export HTM_DBNAME="tsdb"
240
- export HTM_DBUSER="tsdbadmin"
241
- export HTM_DBPASS="devpassword"
242
- export HTM_DBPORT="5432"
243
- export HTM_DBURL="postgres://tsdbadmin:devpassword@localhost:5432/tsdb?sslmode=disable"
239
+ export HTM_DATABASE__NAME="tsdb"
240
+ export HTM_DATABASE__USER="tsdbadmin"
241
+ export HTM_DATABASE__PASSWORD="devpassword"
242
+ export HTM_DATABASE__PORT="5432"
243
+ export HTM_DATABASE__URL="postgres://tsdbadmin:devpassword@localhost:5432/tsdb?sslmode=disable"
244
244
  EOF
245
245
 
246
246
  source ~/.bashrc__tiger
@@ -364,7 +364,7 @@ You can also run the schema SQL directly:
364
364
 
365
365
  ```bash
366
366
  # Using psql
367
- psql $HTM_DBURL -f sql/schema.sql
367
+ psql $HTM_DATABASE__URL -f sql/schema.sql
368
368
 
369
369
  # Or using Ruby
370
370
  ruby -r ./lib/htm -e "HTM::Database.setup"
@@ -478,11 +478,11 @@ HTM uses environment variables for configuration. Here's a complete reference:
478
478
 
479
479
  | Variable | Description | Example |
480
480
  |----------|-------------|---------|
481
- | `HTM_DBURL` | Full PostgreSQL connection URL (preferred) | `postgres://user:pass@host:port/db?sslmode=require` |
482
- | `HTM_DBNAME` | Database name | `tsdb` |
483
- | `HTM_DBUSER` | Database username | `tsdbadmin` |
484
- | `HTM_DBPASS` | Database password | `your_password` |
485
- | `HTM_DBPORT` | Database port | `37807` |
481
+ | `HTM_DATABASE__URL` | Full PostgreSQL connection URL (preferred) | `postgres://user:pass@host:port/db?sslmode=require` |
482
+ | `HTM_DATABASE__NAME` | Database name | `tsdb` |
483
+ | `HTM_DATABASE__USER` | Database username | `tsdbadmin` |
484
+ | `HTM_DATABASE__PASSWORD` | Database password | `your_password` |
485
+ | `HTM_DATABASE__PORT` | Database port | `37807` |
486
486
  | `HTM_SERVICE_NAME` | Service identifier (informational) | `db-67977` |
487
487
 
488
488
  ### Ollama Variables
@@ -515,10 +515,10 @@ source ~/.bashrc__tiger
515
515
 
516
516
  ```bash
517
517
  # Verify environment variables are set
518
- echo $HTM_DBURL
518
+ echo $HTM_DATABASE__URL
519
519
 
520
520
  # Test connection directly with psql
521
- psql $HTM_DBURL
521
+ psql $HTM_DATABASE__URL
522
522
 
523
523
  # Check if service is running (TimescaleDB Cloud)
524
524
  # Visit your Timescale Cloud dashboard
@@ -559,7 +559,7 @@ ollama pull gpt-oss
559
559
  ruby enable_extensions.rb
560
560
 
561
561
  # Check extension status
562
- psql $HTM_DBURL -c "SELECT extname, extversion FROM pg_extension ORDER BY extname"
562
+ psql $HTM_DATABASE__URL -c "SELECT extname, extversion FROM pg_extension ORDER BY extname"
563
563
 
564
564
  # For TimescaleDB Cloud, extensions should be pre-installed
565
565
  # For local PostgreSQL, ensure you're using timescale/timescaledb-ha image
@@ -615,11 +615,11 @@ If you see SSL certificate errors:
615
615
 
616
616
  ```bash
617
617
  # Ensure sslmode is set in connection URL
618
- echo $HTM_DBURL | grep sslmode
618
+ echo $HTM_DATABASE__URL | grep sslmode
619
619
  # Should show: sslmode=require
620
620
 
621
621
  # For local development without SSL
622
- export HTM_DBURL="postgres://user:pass@localhost:5432/tsdb?sslmode=disable"
622
+ export HTM_DATABASE__URL="postgres://user:pass@localhost:5432/tsdb?sslmode=disable"
623
623
  ```
624
624
 
625
625
  ### Ruby Version Issues
@@ -244,7 +244,7 @@ Testing with real database:
244
244
  ```ruby
245
245
  class DatabaseIntegrationTest < Minitest::Test
246
246
  def setup
247
- skip "Database not configured" unless ENV['HTM_DBURL']
247
+ skip "Database not configured" unless ENV['HTM_DATABASE__URL']
248
248
 
249
249
  @htm = HTM.new(
250
250
  robot_name: "Test Robot",
@@ -103,24 +103,24 @@ CREATE EXTENSION IF NOT EXISTS pg_trgm;
103
103
 
104
104
  ```bash
105
105
  # Add to ~/.bashrc or your preferred config file
106
- export HTM_DBURL="postgres://username:password@localhost:5432/htm_db"
107
- export HTM_DBNAME="htm_db"
108
- export HTM_DBUSER="your_username"
109
- export HTM_DBPASS="your_password"
110
- export HTM_DBPORT="5432"
111
- export HTM_DBHOST="localhost"
106
+ export HTM_DATABASE__URL="postgres://username:password@localhost:5432/htm_db"
107
+ export HTM_DATABASE__NAME="htm_db"
108
+ export HTM_DATABASE__USER="your_username"
109
+ export HTM_DATABASE__PASSWORD="your_password"
110
+ export HTM_DATABASE__PORT="5432"
111
+ export HTM_DATABASE__HOST="localhost"
112
112
 
113
113
  # Load the configuration
114
114
  source ~/.bashrc
115
115
  ```
116
116
 
117
117
  !!! tip "Environment Configuration"
118
- HTM automatically uses the `HTM_DBURL` environment variable if available. You can also pass database configuration directly to `HTM.new()`.
118
+ HTM automatically uses the `HTM_DATABASE__URL` environment variable if available. You can also pass database configuration directly to `HTM.new()`.
119
119
 
120
120
  Set environment variable:
121
121
 
122
122
  ```bash
123
- export HTM_DBURL="postgres://localhost/htm_db"
123
+ export HTM_DATABASE__URL="postgres://localhost/htm_db"
124
124
  ```
125
125
 
126
126
  ## Step 3: Enable PostgreSQL Extensions
@@ -139,7 +139,7 @@ Test your database connection and verify extensions:
139
139
  cd /path/to/your/project
140
140
  ruby -e "
141
141
  require 'pg'
142
- conn = PG.connect(ENV['HTM_DBURL'])
142
+ conn = PG.connect(ENV['HTM_DATABASE__URL'])
143
143
  result = conn.exec('SELECT extname, extversion FROM pg_extension ORDER BY extname')
144
144
  result.each { |row| puts \"✓ #{row['extname']}: Version #{row['extversion']}\" }
145
145
  conn.close
@@ -352,11 +352,11 @@ HTM uses the following environment variables:
352
352
 
353
353
  | Variable | Description | Default | Required |
354
354
  |----------|-------------|---------|----------|
355
- | `HTM_DBURL` | PostgreSQL connection URL | - | Yes |
356
- | `HTM_DBNAME` | Database name | `htm_db` | No |
357
- | `HTM_DBUSER` | Database user | `postgres` | No |
358
- | `HTM_DBPASS` | Database password | - | No |
359
- | `HTM_DBPORT` | Database port | `5432` | No |
355
+ | `HTM_DATABASE__URL` | PostgreSQL connection URL | - | Yes |
356
+ | `HTM_DATABASE__NAME` | Database name | `htm_db` | No |
357
+ | `HTM_DATABASE__USER` | Database user | `postgres` | No |
358
+ | `HTM_DATABASE__PASSWORD` | Database password | - | No |
359
+ | `HTM_DATABASE__PORT` | Database port | `5432` | No |
360
360
  | `OLLAMA_URL` | Ollama API URL | `http://localhost:11434` | No |
361
361
 
362
362
  ### Example Configuration File
@@ -365,7 +365,7 @@ Create a configuration file for easy loading:
365
365
 
366
366
  ```bash
367
367
  # ~/.bashrc__htm
368
- export HTM_DBURL="postgres://user:pass@host:port/db?sslmode=require"
368
+ export HTM_DATABASE__URL="postgres://user:pass@host:port/db?sslmode=require"
369
369
  export OLLAMA_URL="http://localhost:11434"
370
370
  ```
371
371
 
@@ -385,11 +385,11 @@ source ~/.bashrc__htm
385
385
  **Solutions**:
386
386
 
387
387
  ```bash
388
- # 1. Verify HTM_DBURL is set
389
- echo $HTM_DBURL
388
+ # 1. Verify HTM_DATABASE__URL is set
389
+ echo $HTM_DATABASE__URL
390
390
 
391
391
  # 2. Test connection manually
392
- psql $HTM_DBURL
392
+ psql $HTM_DATABASE__URL
393
393
 
394
394
  # 3. Check if PostgreSQL is running (local installs)
395
395
  pg_ctl status
@@ -433,7 +433,7 @@ make
433
433
  sudo make install
434
434
 
435
435
  # Enable in database
436
- psql $HTM_DBURL -c "CREATE EXTENSION IF NOT EXISTS pgvector;"
436
+ psql $HTM_DATABASE__URL -c "CREATE EXTENSION IF NOT EXISTS pgvector;"
437
437
  ```
438
438
 
439
439
  ### Ruby Version Issues
@@ -462,7 +462,7 @@ ruby --version
462
462
 
463
463
  ```bash
464
464
  # Ensure your database user has necessary permissions
465
- psql $HTM_DBURL -c "
465
+ psql $HTM_DATABASE__URL -c "
466
466
  GRANT ALL PRIVILEGES ON DATABASE your_db TO your_user;
467
467
  GRANT ALL ON ALL TABLES IN SCHEMA public TO your_user;
468
468
  "
@@ -125,10 +125,10 @@ Create an HTM instance for your robot:
125
125
  ```ruby
126
126
  # Configure HTM globally (optional - uses Ollama by default)
127
127
  HTM.configure do |config|
128
- config.embedding_provider = :ollama
129
- config.embedding_model = 'nomic-embed-text:latest'
130
- config.tag_provider = :ollama
131
- config.tag_model = 'gemma3:latest'
128
+ config.embedding.provider = :ollama
129
+ config.embedding.model = 'nomic-embed-text:latest'
130
+ config.tag.provider = :ollama
131
+ config.tag.model = 'gemma3:latest'
132
132
  end
133
133
 
134
134
  # Initialize HTM with a robot name
@@ -338,10 +338,10 @@ puts "=" * 60
338
338
 
339
339
  # Step 1: Configure and initialize HTM
340
340
  HTM.configure do |config|
341
- config.embedding_provider = :ollama
342
- config.embedding_model = 'nomic-embed-text:latest'
343
- config.tag_provider = :ollama
344
- config.tag_model = 'gemma3:latest'
341
+ config.embedding.provider = :ollama
342
+ config.embedding.model = 'nomic-embed-text:latest'
343
+ config.tag.provider = :ollama
344
+ config.tag.model = 'gemma3:latest'
345
345
  end
346
346
 
347
347
  htm = HTM.new(
@@ -522,8 +522,8 @@ htm = HTM.new(
522
522
 
523
523
  # Try different embedding models via configure
524
524
  HTM.configure do |config|
525
- config.embedding_provider = :ollama
526
- config.embedding_model = 'llama3:latest' # Use Llama3
525
+ config.embedding.provider = :ollama
526
+ config.embedding.model = 'llama3:latest' # Use Llama3
527
527
  end
528
528
 
529
529
  # Try different recall strategies
@@ -606,10 +606,10 @@ curl http://localhost:11434/api/version
606
606
 
607
607
  ### Issue: "Database connection failed"
608
608
 
609
- **Solution**: Verify your `HTM_DBURL` is set:
609
+ **Solution**: Verify your `HTM_DATABASE__URL` is set:
610
610
 
611
611
  ```bash
612
- echo $HTM_DBURL
612
+ echo $HTM_DATABASE__URL
613
613
  # Should show your connection string
614
614
  ```
615
615
 
@@ -55,10 +55,10 @@ HTM requires a TimescaleDB database. Set your database connection:
55
55
 
56
56
  ```bash
57
57
  # Add to your .bashrc or .zshrc
58
- export HTM_DBURL="postgresql://user:password@host:port/database"
58
+ export HTM_DATABASE__URL="postgresql://user:password@host:port/database"
59
59
 
60
60
  # Or create a config file
61
- echo "export HTM_DBURL='your-connection-string'" > ~/.bashrc__tiger
61
+ echo "export HTM_DATABASE__URL='your-connection-string'" > ~/.bashrc__tiger
62
62
  source ~/.bashrc__tiger
63
63
  ```
64
64
 
@@ -803,7 +803,7 @@ begin
803
803
  conn.close
804
804
  rescue PG::Error => e
805
805
  puts "Connection failed: #{e.message}"
806
- puts "Check HTM_DBURL environment variable"
806
+ puts "Check HTM_DATABASE__URL environment variable"
807
807
  end
808
808
  ```
809
809
 
@@ -26,7 +26,7 @@ Before using the MCP server, ensure you have:
26
26
 
27
27
  2. **PostgreSQL database set up**
28
28
  ```bash
29
- export HTM_DBURL="postgresql://user@localhost:5432/htm_development"
29
+ export HTM_DATABASE__URL="postgresql://user@localhost:5432/htm_development"
30
30
  htm_mcp setup
31
31
  ```
32
32
 
@@ -66,7 +66,7 @@ The `htm_mcp` executable includes management commands for database setup and dia
66
66
 
67
67
  ```bash
68
68
  # Set your database URL
69
- export HTM_DBURL="postgresql://user@localhost:5432/htm_development"
69
+ export HTM_DATABASE__URL="postgresql://user@localhost:5432/htm_development"
70
70
 
71
71
  # Initialize the database
72
72
  htm_mcp setup
@@ -745,7 +745,7 @@ Add to `~/.config/claude/claude_desktop_config.json` (Linux/macOS) or `%APPDATA%
745
745
  "htm-memory": {
746
746
  "command": "htm_mcp",
747
747
  "env": {
748
- "HTM_DBURL": "postgresql://user@localhost:5432/htm_development"
748
+ "HTM_DATABASE__URL": "postgresql://user@localhost:5432/htm_development"
749
749
  }
750
750
  }
751
751
  }
@@ -760,7 +760,7 @@ If `htm_mcp` is not in your PATH, use the absolute path:
760
760
  "htm-memory": {
761
761
  "command": "/path/to/htm_mcp",
762
762
  "env": {
763
- "HTM_DBURL": "postgresql://user@localhost:5432/htm_development"
763
+ "HTM_DATABASE__URL": "postgresql://user@localhost:5432/htm_development"
764
764
  }
765
765
  }
766
766
  }
@@ -782,7 +782,7 @@ Add to `~/.claude/claude_code_config.json`:
782
782
  "htm-memory": {
783
783
  "command": "htm_mcp",
784
784
  "env": {
785
- "HTM_DBURL": "postgresql://user@localhost:5432/htm_development"
785
+ "HTM_DATABASE__URL": "postgresql://user@localhost:5432/htm_development"
786
786
  }
787
787
  }
788
788
  }
@@ -812,7 +812,7 @@ mcp_servers:
812
812
  htm-memory:
813
813
  command: htm_mcp
814
814
  env:
815
- HTM_DBURL: postgresql://user@localhost:5432/htm_development
815
+ HTM_DATABASE__URL: postgresql://user@localhost:5432/htm_development
816
816
  ```
817
817
 
818
818
  For project-specific configuration, add to `.aia/config.yml` in your project root:
@@ -822,7 +822,7 @@ mcp_servers:
822
822
  htm-memory:
823
823
  command: htm_mcp
824
824
  env:
825
- HTM_DBURL: postgresql://user@localhost:5432/my_project_htm
825
+ HTM_DATABASE__URL: postgresql://user@localhost:5432/my_project_htm
826
826
  ```
827
827
 
828
828
  ## Usage Examples
@@ -952,9 +952,9 @@ This will find `database:postgresql` even with the typo.
952
952
  gem install fast-mcp
953
953
  ```
954
954
 
955
- **Error: `HTM_DBURL not set`**
955
+ **Error: `HTM_DATABASE__URL not set`**
956
956
  ```bash
957
- export HTM_DBURL="postgresql://user@localhost:5432/htm_development"
957
+ export HTM_DATABASE__URL="postgresql://user@localhost:5432/htm_development"
958
958
  ```
959
959
 
960
960
  ### Database Connection Issues
@@ -982,7 +982,7 @@ psql htm_development -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
982
982
  **Claude Code doesn't recognize tools:**
983
983
  1. Run `/mcp` to refresh MCP connections
984
984
  2. Verify config is valid JSON
985
- 3. Check that HTM_DBURL is set in the env section
985
+ 3. Check that HTM_DATABASE__URL is set in the env section
986
986
 
987
987
  ### Embedding/Tag Errors
988
988
 
@@ -1011,17 +1011,17 @@ Run `htm_mcp help` for a complete list. Key variables:
1011
1011
 
1012
1012
  | Variable | Description |
1013
1013
  |----------|-------------|
1014
- | `HTM_DBURL` | PostgreSQL connection URL (e.g., `postgresql://user:pass@localhost:5432/htm_development`) |
1014
+ | `HTM_DATABASE__URL` | PostgreSQL connection URL (e.g., `postgresql://user:pass@localhost:5432/htm_development`) |
1015
1015
 
1016
- ### Database (alternative to HTM_DBURL)
1016
+ ### Database (alternative to HTM_DATABASE__URL)
1017
1017
 
1018
1018
  | Variable | Description | Default |
1019
1019
  |----------|-------------|---------|
1020
- | `HTM_DBNAME` | Database name | - |
1021
- | `HTM_DBHOST` | Database host | `localhost` |
1022
- | `HTM_DBPORT` | Database port | `5432` |
1023
- | `HTM_DBUSER` | Database username | - |
1024
- | `HTM_DBPASS` | Database password | - |
1020
+ | `HTM_DATABASE__NAME` | Database name | - |
1021
+ | `HTM_DATABASE__HOST` | Database host | `localhost` |
1022
+ | `HTM_DATABASE__PORT` | Database port | `5432` |
1023
+ | `HTM_DATABASE__USER` | Database username | - |
1024
+ | `HTM_DATABASE__PASSWORD` | Database password | - |
1025
1025
  | `HTM_DBSSLMODE` | SSL mode | `prefer` |
1026
1026
 
1027
1027
  ### LLM Providers
@@ -89,10 +89,10 @@ require 'htm'
89
89
 
90
90
  # Configure HTM
91
91
  HTM.configure do |config|
92
- config.embedding_provider = :ollama
93
- config.embedding_model = 'nomic-embed-text'
94
- config.tag_provider = :ollama
95
- config.tag_model = 'llama3'
92
+ config.embedding.provider = :ollama
93
+ config.embedding.model = 'nomic-embed-text'
94
+ config.tag.provider = :ollama
95
+ config.tag.model = 'llama3'
96
96
  end
97
97
 
98
98
  # Create a robot group with active and passive members
@@ -386,8 +386,8 @@ group_name = 'distributed-service'
386
386
 
387
387
  # Configure HTM
388
388
  HTM.configure do |config|
389
- config.embedding_provider = :ollama
390
- config.embedding_model = 'nomic-embed-text'
389
+ config.embedding.provider = :ollama
390
+ config.embedding.model = 'nomic-embed-text'
391
391
  end
392
392
 
393
393
  # Create HTM instance for this worker
@@ -573,7 +573,7 @@ Single-process demo showing:
573
573
  - Real-time sync via LISTEN/NOTIFY
574
574
 
575
575
  ```bash
576
- HTM_DBURL="postgresql://user@localhost:5432/htm_dev" ruby examples/robot_groups/same_process.rb
576
+ HTM_DATABASE__URL="postgresql://user@localhost:5432/htm_dev" ruby examples/robot_groups/same_process.rb
577
577
  ```
578
578
 
579
579
  ### multi_process.rb
@@ -585,7 +585,7 @@ Multi-process demo showing:
585
585
  - Dynamic scaling by spawning new processes
586
586
 
587
587
  ```bash
588
- HTM_DBURL="postgresql://user@localhost:5432/htm_dev" ruby examples/robot_groups/multi_process.rb
588
+ HTM_DATABASE__URL="postgresql://user@localhost:5432/htm_dev" ruby examples/robot_groups/multi_process.rb
589
589
  ```
590
590
 
591
591
  ### robot_worker.rb
data/docs/index.md CHANGED
@@ -81,10 +81,10 @@ require 'htm'
81
81
 
82
82
  # Configure HTM globally (optional - uses Ollama by default)
83
83
  HTM.configure do |config|
84
- config.embedding_provider = :ollama
85
- config.embedding_model = 'nomic-embed-text:latest'
86
- config.tag_provider = :ollama
87
- config.tag_model = 'gemma3:latest'
84
+ config.embedding.provider = :ollama
85
+ config.embedding.model = 'nomic-embed-text:latest'
86
+ config.tag.provider = :ollama
87
+ config.tag.model = 'gemma3:latest'
88
88
  end
89
89
 
90
90
  # Initialize HTM for your robot