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.
- checksums.yaml +4 -4
- data/.architecture/decisions/adrs/001-use-postgresql-timescaledb-storage.md +1 -1
- data/.architecture/decisions/adrs/011-database-side-embedding-generation-with-pgai.md +4 -4
- data/.architecture/decisions/adrs/012-llm-driven-ontology-topic-extraction.md +1 -1
- data/.envrc +12 -25
- data/.irbrc +7 -7
- data/.tbls.yml +2 -2
- data/CHANGELOG.md +71 -0
- data/README.md +1 -1
- data/Rakefile +8 -3
- data/SETUP.md +12 -12
- data/bin/htm_mcp +0 -4
- data/db/seed_data/README.md +2 -2
- data/db/seeds.rb +2 -2
- data/docs/api/database.md +37 -37
- data/docs/api/htm.md +1 -1
- data/docs/api/yard/HTM/ActiveRecordConfig.md +2 -2
- data/docs/api/yard/HTM/Configuration.md +26 -15
- data/docs/api/yard/HTM/Database.md +7 -8
- data/docs/api/yard/HTM/JobAdapter.md +1 -1
- data/docs/api/yard/HTM/Railtie.md +2 -2
- data/docs/architecture/adrs/001-postgresql-timescaledb.md +1 -1
- data/docs/architecture/adrs/011-pgai-integration.md +4 -4
- data/docs/database_rake_tasks.md +5 -5
- data/docs/development/rake-tasks.md +11 -11
- data/docs/development/setup.md +21 -21
- data/docs/development/testing.md +1 -1
- data/docs/getting-started/installation.md +20 -20
- data/docs/getting-started/quick-start.md +12 -12
- data/docs/guides/getting-started.md +2 -2
- data/docs/guides/long-term-memory.md +1 -1
- data/docs/guides/mcp-server.md +17 -17
- data/docs/guides/robot-groups.md +8 -8
- data/docs/index.md +4 -4
- data/docs/multi_framework_support.md +8 -8
- data/docs/setup_local_database.md +19 -19
- data/docs/using_rake_tasks_in_your_app.md +14 -14
- data/examples/README.md +50 -6
- data/examples/basic_usage.rb +31 -21
- data/examples/cli_app/README.md +8 -8
- data/examples/cli_app/htm_cli.rb +5 -5
- data/examples/config_file_example/README.md +256 -0
- data/examples/config_file_example/config/htm.local.yml +34 -0
- data/examples/config_file_example/custom_config.yml +22 -0
- data/examples/config_file_example/show_config.rb +125 -0
- data/examples/custom_llm_configuration.rb +7 -7
- data/examples/example_app/Rakefile +2 -2
- data/examples/example_app/app.rb +8 -8
- data/examples/file_loader_usage.rb +9 -9
- data/examples/mcp_client.rb +5 -5
- data/examples/rails_app/Gemfile.lock +48 -56
- data/examples/rails_app/README.md +1 -1
- data/examples/robot_groups/multi_process.rb +5 -5
- data/examples/robot_groups/robot_worker.rb +5 -5
- data/examples/robot_groups/same_process.rb +9 -9
- data/examples/sinatra_app/app.rb +1 -1
- data/examples/timeframe_demo.rb +1 -1
- data/lib/htm/active_record_config.rb +12 -25
- data/lib/htm/circuit_breaker.rb +0 -2
- data/lib/htm/config/defaults.yml +246 -0
- data/lib/htm/config.rb +888 -0
- data/lib/htm/database.rb +23 -27
- data/lib/htm/embedding_service.rb +0 -4
- data/lib/htm/integrations/sinatra.rb +3 -7
- data/lib/htm/job_adapter.rb +1 -15
- data/lib/htm/jobs/generate_embedding_job.rb +1 -7
- data/lib/htm/jobs/generate_propositions_job.rb +2 -12
- data/lib/htm/jobs/generate_tags_job.rb +1 -8
- data/lib/htm/loaders/defaults_loader.rb +143 -0
- data/lib/htm/loaders/xdg_config_loader.rb +116 -0
- data/lib/htm/mcp/cli.rb +200 -58
- data/lib/htm/mcp/server.rb +3 -3
- data/lib/htm/proposition_service.rb +2 -12
- data/lib/htm/railtie.rb +3 -4
- data/lib/htm/tag_service.rb +1 -8
- data/lib/htm/version.rb +1 -1
- data/lib/htm.rb +124 -5
- metadata +24 -4
- data/config/database.yml +0 -77
- 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
|
|
11
|
+
Get default database configuration (respects HTM_ENV)
|
|
12
12
|
|
|
13
|
-
Uses
|
|
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['
|
|
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['
|
|
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['
|
|
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['
|
|
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['
|
|
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
|
|
|
@@ -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.
|
|
24
|
-
config.
|
|
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['
|
|
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 $
|
|
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 $
|
|
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 $
|
|
292
|
+
psql $HTM_DATABASE__URL < sql/schema.sql
|
|
293
293
|
|
|
294
294
|
# 4. (Optional) Regenerate embeddings with new model
|
|
295
|
-
psql $
|
|
295
|
+
psql $HTM_DATABASE__URL -c "UPDATE nodes SET value = value;"
|
|
296
296
|
# This triggers embedding regeneration for all nodes
|
|
297
297
|
```
|
|
298
298
|
|
data/docs/database_rake_tasks.md
CHANGED
|
@@ -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 `
|
|
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
|
|
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 `
|
|
297
|
-
- Verify: `echo $
|
|
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 `
|
|
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 `
|
|
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
|
|
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
|
-
| `
|
|
1016
|
-
| `
|
|
1017
|
-
| `
|
|
1018
|
-
| `
|
|
1019
|
-
| `
|
|
1020
|
-
| `
|
|
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
|
|
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 `
|
|
1034
|
+
Set the `HTM_DATABASE__URL` environment variable:
|
|
1035
1035
|
|
|
1036
1036
|
```bash
|
|
1037
|
-
export
|
|
1037
|
+
export HTM_DATABASE__URL="postgresql://user@localhost:5432/htm_development"
|
|
1038
1038
|
```
|
|
1039
1039
|
|
|
1040
1040
|
### "Extension not found"
|
data/docs/development/setup.md
CHANGED
|
@@ -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
|
|
191
|
-
export
|
|
192
|
-
export
|
|
193
|
-
export
|
|
194
|
-
export
|
|
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
|
|
240
|
-
export
|
|
241
|
-
export
|
|
242
|
-
export
|
|
243
|
-
export
|
|
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 $
|
|
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
|
-
| `
|
|
482
|
-
| `
|
|
483
|
-
| `
|
|
484
|
-
| `
|
|
485
|
-
| `
|
|
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 $
|
|
518
|
+
echo $HTM_DATABASE__URL
|
|
519
519
|
|
|
520
520
|
# Test connection directly with psql
|
|
521
|
-
psql $
|
|
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 $
|
|
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 $
|
|
618
|
+
echo $HTM_DATABASE__URL | grep sslmode
|
|
619
619
|
# Should show: sslmode=require
|
|
620
620
|
|
|
621
621
|
# For local development without SSL
|
|
622
|
-
export
|
|
622
|
+
export HTM_DATABASE__URL="postgres://user:pass@localhost:5432/tsdb?sslmode=disable"
|
|
623
623
|
```
|
|
624
624
|
|
|
625
625
|
### Ruby Version Issues
|
data/docs/development/testing.md
CHANGED
|
@@ -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['
|
|
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
|
|
107
|
-
export
|
|
108
|
-
export
|
|
109
|
-
export
|
|
110
|
-
export
|
|
111
|
-
export
|
|
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 `
|
|
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
|
|
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['
|
|
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
|
-
| `
|
|
356
|
-
| `
|
|
357
|
-
| `
|
|
358
|
-
| `
|
|
359
|
-
| `
|
|
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
|
|
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
|
|
389
|
-
echo $
|
|
388
|
+
# 1. Verify HTM_DATABASE__URL is set
|
|
389
|
+
echo $HTM_DATABASE__URL
|
|
390
390
|
|
|
391
391
|
# 2. Test connection manually
|
|
392
|
-
psql $
|
|
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 $
|
|
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 $
|
|
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.
|
|
129
|
-
config.
|
|
130
|
-
config.
|
|
131
|
-
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'
|
|
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.
|
|
342
|
-
config.
|
|
343
|
-
config.
|
|
344
|
-
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'
|
|
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.
|
|
526
|
-
config.
|
|
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 `
|
|
609
|
+
**Solution**: Verify your `HTM_DATABASE__URL` is set:
|
|
610
610
|
|
|
611
611
|
```bash
|
|
612
|
-
echo $
|
|
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
|
|
58
|
+
export HTM_DATABASE__URL="postgresql://user:password@host:port/database"
|
|
59
59
|
|
|
60
60
|
# Or create a config file
|
|
61
|
-
echo "export
|
|
61
|
+
echo "export HTM_DATABASE__URL='your-connection-string'" > ~/.bashrc__tiger
|
|
62
62
|
source ~/.bashrc__tiger
|
|
63
63
|
```
|
|
64
64
|
|
data/docs/guides/mcp-server.md
CHANGED
|
@@ -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
|
|
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
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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
|
-
|
|
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
|
-
|
|
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: `
|
|
955
|
+
**Error: `HTM_DATABASE__URL not set`**
|
|
956
956
|
```bash
|
|
957
|
-
export
|
|
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
|
|
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
|
-
| `
|
|
1014
|
+
| `HTM_DATABASE__URL` | PostgreSQL connection URL (e.g., `postgresql://user:pass@localhost:5432/htm_development`) |
|
|
1015
1015
|
|
|
1016
|
-
### Database (alternative to
|
|
1016
|
+
### Database (alternative to HTM_DATABASE__URL)
|
|
1017
1017
|
|
|
1018
1018
|
| Variable | Description | Default |
|
|
1019
1019
|
|----------|-------------|---------|
|
|
1020
|
-
| `
|
|
1021
|
-
| `
|
|
1022
|
-
| `
|
|
1023
|
-
| `
|
|
1024
|
-
| `
|
|
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
|
data/docs/guides/robot-groups.md
CHANGED
|
@@ -89,10 +89,10 @@ require 'htm'
|
|
|
89
89
|
|
|
90
90
|
# Configure HTM
|
|
91
91
|
HTM.configure do |config|
|
|
92
|
-
config.
|
|
93
|
-
config.
|
|
94
|
-
config.
|
|
95
|
-
config.
|
|
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.
|
|
390
|
-
config.
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
85
|
-
config.
|
|
86
|
-
config.
|
|
87
|
-
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'
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
# Initialize HTM for your robot
|