htm 0.0.18 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +59 -1
- data/README.md +12 -0
- data/db/seeds.rb +1 -1
- data/docs/api/embedding-service.md +140 -110
- data/docs/api/yard/HTM/ActiveRecordConfig.md +6 -0
- data/docs/api/yard/HTM/Config.md +173 -0
- data/docs/api/yard/HTM/ConfigSection.md +28 -0
- data/docs/api/yard/HTM/Database.md +1 -1
- data/docs/api/yard/HTM/Railtie.md +2 -2
- data/docs/api/yard/HTM.md +0 -57
- data/docs/api/yard/index.csv +76 -61
- data/docs/api/yard-reference.md +2 -1
- data/docs/architecture/adrs/003-ollama-embeddings.md +45 -36
- data/docs/architecture/adrs/004-hive-mind.md +1 -1
- data/docs/architecture/adrs/008-robot-identification.md +1 -1
- data/docs/architecture/index.md +11 -9
- data/docs/architecture/overview.md +11 -7
- data/docs/assets/images/balanced-strategy-decay.svg +41 -0
- data/docs/assets/images/class-hierarchy.svg +1 -1
- data/docs/assets/images/eviction-priority.svg +43 -0
- data/docs/assets/images/exception-hierarchy.svg +2 -2
- data/docs/assets/images/hive-mind-shared-memory.svg +52 -0
- data/docs/assets/images/htm-architecture-overview.svg +3 -3
- data/docs/assets/images/htm-core-components.svg +4 -4
- data/docs/assets/images/htm-layered-architecture.svg +1 -1
- data/docs/assets/images/htm-memory-addition-flow.svg +2 -2
- data/docs/assets/images/htm-memory-recall-flow.svg +2 -2
- data/docs/assets/images/memory-topology.svg +53 -0
- data/docs/assets/images/two-tier-memory-architecture.svg +55 -0
- data/docs/development/setup.md +76 -44
- data/docs/examples/basic-usage.md +133 -0
- data/docs/examples/config-files.md +170 -0
- data/docs/examples/file-loading.md +208 -0
- data/docs/examples/index.md +116 -0
- data/docs/examples/llm-configuration.md +168 -0
- data/docs/examples/mcp-client.md +172 -0
- data/docs/examples/rails-integration.md +173 -0
- data/docs/examples/robot-groups.md +210 -0
- data/docs/examples/sinatra-integration.md +218 -0
- data/docs/examples/standalone-app.md +216 -0
- data/docs/examples/telemetry.md +224 -0
- data/docs/examples/timeframes.md +143 -0
- data/docs/getting-started/installation.md +97 -40
- data/docs/getting-started/quick-start.md +28 -11
- data/docs/guides/configuration.md +515 -0
- data/docs/guides/file-loading.md +322 -0
- data/docs/guides/getting-started.md +40 -9
- data/docs/guides/index.md +3 -3
- data/docs/guides/mcp-server.md +30 -12
- data/docs/guides/propositions.md +264 -0
- data/docs/guides/recalling-memories.md +4 -4
- data/docs/guides/search-strategies.md +3 -3
- data/docs/guides/tags.md +318 -0
- data/docs/guides/telemetry.md +229 -0
- data/docs/index.md +8 -16
- data/docs/{architecture → robots}/hive-mind.md +8 -111
- data/docs/robots/index.md +73 -0
- data/docs/{guides → robots}/multi-robot.md +3 -3
- data/docs/{guides → robots}/robot-groups.md +8 -7
- data/docs/{architecture → robots}/two-tier-memory.md +13 -149
- data/docs/robots/why-robots.md +85 -0
- data/lib/htm/config/defaults.yml +4 -4
- data/lib/htm/config.rb +2 -2
- data/lib/htm/job_adapter.rb +75 -1
- data/lib/htm/version.rb +1 -1
- data/lib/htm/workflows/remember_workflow.rb +212 -0
- data/lib/htm.rb +1 -0
- data/mkdocs.yml +33 -8
- metadata +60 -7
- data/docs/api/yard/HTM/Configuration.md +0 -240
- data/docs/telemetry.md +0 -391
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
# Configuration
|
|
2
|
+
|
|
3
|
+
HTM uses the [anyway_config](https://github.com/palkan/anyway_config) gem for flexible, layered configuration. The source of truth for the configuration schema and defaults is [`lib/htm/config/defaults.yml`](https://github.com/madbomber/htm/blob/main/lib/htm/config/defaults.yml).
|
|
4
|
+
|
|
5
|
+
## Configuration Hierarchy
|
|
6
|
+
|
|
7
|
+
HTM loads configuration from multiple sources, with later sources overriding earlier ones:
|
|
8
|
+
|
|
9
|
+
1. **Bundled defaults** (`lib/htm/config/defaults.yml`) - Gem defaults
|
|
10
|
+
2. **XDG user config** (`~/.config/htm/htm.yml`) - User-wide settings
|
|
11
|
+
3. **Project config** (`./config/htm.yml`) - Project-specific settings
|
|
12
|
+
4. **Local overrides** (`./config/htm.local.yml`) - Gitignored local settings
|
|
13
|
+
5. **Environment variables** (`HTM_*`) - Runtime overrides
|
|
14
|
+
6. **Programmatic** (`HTM.configure` block) - Code-level configuration
|
|
15
|
+
|
|
16
|
+
## Important Environment Variables
|
|
17
|
+
|
|
18
|
+
### Configuration Control
|
|
19
|
+
|
|
20
|
+
| Variable | Description |
|
|
21
|
+
|----------|-------------|
|
|
22
|
+
| `HTM_ENV` | Environment name (`development`, `test`, `production`). Falls back to `RAILS_ENV`, then `RACK_ENV`, then `development`. |
|
|
23
|
+
| `HTM_CONF` | Path to a custom YAML config file to load instead of default locations. |
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Use test environment settings
|
|
27
|
+
export HTM_ENV=test
|
|
28
|
+
|
|
29
|
+
# Load config from a specific file
|
|
30
|
+
export HTM_CONF=/path/to/my/htm.yml
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Getting Started with Config Files
|
|
34
|
+
|
|
35
|
+
### Dump Default Configuration
|
|
36
|
+
|
|
37
|
+
Use the `htm_mcp config` command to output the default configuration schema:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Print defaults to stdout
|
|
41
|
+
htm_mcp config
|
|
42
|
+
|
|
43
|
+
# Save to a config file
|
|
44
|
+
htm_mcp config > config/htm.yml
|
|
45
|
+
|
|
46
|
+
# Save to XDG location
|
|
47
|
+
htm_mcp config > ~/.config/htm/htm.yml
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Minimal Config File
|
|
51
|
+
|
|
52
|
+
```yaml
|
|
53
|
+
# config/htm.yml
|
|
54
|
+
database:
|
|
55
|
+
url: postgresql://user@localhost:5432/htm_development
|
|
56
|
+
|
|
57
|
+
embedding:
|
|
58
|
+
provider: ollama
|
|
59
|
+
model: nomic-embed-text:latest
|
|
60
|
+
|
|
61
|
+
tag:
|
|
62
|
+
provider: ollama
|
|
63
|
+
model: gemma3:latest
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Environment-Specific Overrides
|
|
67
|
+
|
|
68
|
+
The config file supports environment sections:
|
|
69
|
+
|
|
70
|
+
```yaml
|
|
71
|
+
# Shared defaults
|
|
72
|
+
defaults:
|
|
73
|
+
embedding:
|
|
74
|
+
provider: ollama
|
|
75
|
+
model: nomic-embed-text:latest
|
|
76
|
+
|
|
77
|
+
# Development overrides
|
|
78
|
+
development:
|
|
79
|
+
database:
|
|
80
|
+
name: htm_development
|
|
81
|
+
log_level: debug
|
|
82
|
+
|
|
83
|
+
# Test overrides
|
|
84
|
+
test:
|
|
85
|
+
database:
|
|
86
|
+
name: htm_test
|
|
87
|
+
job:
|
|
88
|
+
backend: inline
|
|
89
|
+
|
|
90
|
+
# Production overrides
|
|
91
|
+
production:
|
|
92
|
+
database:
|
|
93
|
+
pool_size: 25
|
|
94
|
+
sslmode: require
|
|
95
|
+
telemetry_enabled: true
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Configuration Sections
|
|
99
|
+
|
|
100
|
+
### Database Configuration
|
|
101
|
+
|
|
102
|
+
Access: `HTM.config.database.host`, `HTM.config.database.port`, etc.
|
|
103
|
+
|
|
104
|
+
```yaml
|
|
105
|
+
database:
|
|
106
|
+
url: ~ # Full connection URL (overrides individual settings)
|
|
107
|
+
host: localhost
|
|
108
|
+
port: 5432
|
|
109
|
+
name: ~
|
|
110
|
+
user: ~
|
|
111
|
+
password: ~
|
|
112
|
+
pool_size: 10
|
|
113
|
+
timeout: 5000
|
|
114
|
+
sslmode: prefer
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Environment variables:**
|
|
118
|
+
```bash
|
|
119
|
+
HTM_DATABASE__URL=postgresql://user:pass@localhost:5432/htm_dev
|
|
120
|
+
HTM_DATABASE__HOST=localhost
|
|
121
|
+
HTM_DATABASE__PORT=5432
|
|
122
|
+
HTM_DATABASE__NAME=htm_development
|
|
123
|
+
HTM_DATABASE__USER=postgres
|
|
124
|
+
HTM_DATABASE__PASSWORD=secret
|
|
125
|
+
HTM_DATABASE__POOL_SIZE=10
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Embedding Configuration
|
|
129
|
+
|
|
130
|
+
Access: `HTM.config.embedding.provider`, `HTM.config.embedding.model`, etc.
|
|
131
|
+
|
|
132
|
+
```yaml
|
|
133
|
+
embedding:
|
|
134
|
+
provider: ollama # LLM provider for embeddings
|
|
135
|
+
model: nomic-embed-text:latest
|
|
136
|
+
dimensions: 768 # Vector dimensions
|
|
137
|
+
timeout: 120 # Request timeout (seconds)
|
|
138
|
+
max_dimension: 2000 # Maximum supported dimensions
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Environment variables:**
|
|
142
|
+
```bash
|
|
143
|
+
HTM_EMBEDDING__PROVIDER=openai
|
|
144
|
+
HTM_EMBEDDING__MODEL=text-embedding-3-small
|
|
145
|
+
HTM_EMBEDDING__DIMENSIONS=1536
|
|
146
|
+
HTM_EMBEDDING__TIMEOUT=120
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Tag Extraction Configuration
|
|
150
|
+
|
|
151
|
+
Access: `HTM.config.tag.provider`, `HTM.config.tag.model`, etc.
|
|
152
|
+
|
|
153
|
+
```yaml
|
|
154
|
+
tag:
|
|
155
|
+
provider: ollama
|
|
156
|
+
model: gemma3:latest
|
|
157
|
+
timeout: 180
|
|
158
|
+
max_depth: 4 # Maximum tag hierarchy depth
|
|
159
|
+
|
|
160
|
+
# Prompt templates (use %{placeholder} for interpolation)
|
|
161
|
+
system_prompt: |
|
|
162
|
+
You are a taxonomy classifier...
|
|
163
|
+
|
|
164
|
+
user_prompt_template: |
|
|
165
|
+
Extract classification tags for this text...
|
|
166
|
+
TEXT: %{text}
|
|
167
|
+
...
|
|
168
|
+
|
|
169
|
+
taxonomy_context_existing: "Existing taxonomy paths: %{sample_tags}..."
|
|
170
|
+
taxonomy_context_empty: "This is a new taxonomy..."
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Environment variables:**
|
|
174
|
+
```bash
|
|
175
|
+
HTM_TAG__PROVIDER=openai
|
|
176
|
+
HTM_TAG__MODEL=gpt-4o-mini
|
|
177
|
+
HTM_TAG__TIMEOUT=180
|
|
178
|
+
HTM_TAG__MAX_DEPTH=4
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Proposition Extraction Configuration
|
|
182
|
+
|
|
183
|
+
Access: `HTM.config.proposition.provider`, `HTM.config.proposition.enabled`, etc.
|
|
184
|
+
|
|
185
|
+
```yaml
|
|
186
|
+
proposition:
|
|
187
|
+
provider: ollama
|
|
188
|
+
model: gemma3:latest
|
|
189
|
+
timeout: 180
|
|
190
|
+
enabled: false # Enable atomic fact extraction
|
|
191
|
+
|
|
192
|
+
system_prompt: |
|
|
193
|
+
You are an atomic fact extraction system...
|
|
194
|
+
|
|
195
|
+
user_prompt_template: |
|
|
196
|
+
Extract all ATOMIC factual propositions...
|
|
197
|
+
TEXT: %{text}
|
|
198
|
+
...
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Environment variables:**
|
|
202
|
+
```bash
|
|
203
|
+
HTM_PROPOSITION__ENABLED=true
|
|
204
|
+
HTM_PROPOSITION__PROVIDER=openai
|
|
205
|
+
HTM_PROPOSITION__MODEL=gpt-4o-mini
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Chunking Configuration
|
|
209
|
+
|
|
210
|
+
Access: `HTM.config.chunking.size`, `HTM.config.chunking.overlap`
|
|
211
|
+
|
|
212
|
+
```yaml
|
|
213
|
+
chunking:
|
|
214
|
+
size: 1024 # Characters per chunk
|
|
215
|
+
overlap: 64 # Overlap between chunks
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**Environment variables:**
|
|
219
|
+
```bash
|
|
220
|
+
HTM_CHUNKING__SIZE=512
|
|
221
|
+
HTM_CHUNKING__OVERLAP=50
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Job Backend Configuration
|
|
225
|
+
|
|
226
|
+
Access: `HTM.config.job.backend`
|
|
227
|
+
|
|
228
|
+
```yaml
|
|
229
|
+
job:
|
|
230
|
+
backend: ~ # nil = auto-detect, or: inline, thread, sidekiq, active_job
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**Environment variables:**
|
|
234
|
+
```bash
|
|
235
|
+
HTM_JOB__BACKEND=sidekiq
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
| Backend | Behavior | Use Case |
|
|
239
|
+
|---------|----------|----------|
|
|
240
|
+
| `~` (nil) | Auto-detect | Default |
|
|
241
|
+
| `inline` | Synchronous | Testing |
|
|
242
|
+
| `thread` | Background threads | Development |
|
|
243
|
+
| `sidekiq` | Sidekiq workers | Production |
|
|
244
|
+
| `active_job` | Rails ActiveJob | Rails apps |
|
|
245
|
+
|
|
246
|
+
### Circuit Breaker Configuration
|
|
247
|
+
|
|
248
|
+
Access: `HTM.config.circuit_breaker.failure_threshold`, etc.
|
|
249
|
+
|
|
250
|
+
```yaml
|
|
251
|
+
circuit_breaker:
|
|
252
|
+
failure_threshold: 5 # Failures before circuit opens
|
|
253
|
+
reset_timeout: 60 # Seconds before half-open state
|
|
254
|
+
half_open_max_calls: 3 # Successes needed to close
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### Relevance Scoring Configuration
|
|
258
|
+
|
|
259
|
+
Access: `HTM.config.relevance.semantic_weight`, etc.
|
|
260
|
+
|
|
261
|
+
```yaml
|
|
262
|
+
relevance:
|
|
263
|
+
semantic_weight: 0.5 # Vector similarity weight
|
|
264
|
+
tag_weight: 0.3 # Tag overlap weight
|
|
265
|
+
recency_weight: 0.1 # Temporal freshness weight
|
|
266
|
+
access_weight: 0.1 # Access frequency weight
|
|
267
|
+
recency_half_life_hours: 168.0 # Decay half-life (1 week)
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Provider Credentials
|
|
271
|
+
|
|
272
|
+
Access: `HTM.config.providers.openai.api_key`, etc.
|
|
273
|
+
|
|
274
|
+
```yaml
|
|
275
|
+
providers:
|
|
276
|
+
openai:
|
|
277
|
+
api_key: ~
|
|
278
|
+
organization: ~
|
|
279
|
+
project: ~
|
|
280
|
+
|
|
281
|
+
anthropic:
|
|
282
|
+
api_key: ~
|
|
283
|
+
|
|
284
|
+
gemini:
|
|
285
|
+
api_key: ~
|
|
286
|
+
|
|
287
|
+
azure:
|
|
288
|
+
api_key: ~
|
|
289
|
+
endpoint: ~
|
|
290
|
+
api_version: '2024-02-01'
|
|
291
|
+
|
|
292
|
+
ollama:
|
|
293
|
+
url: http://localhost:11434
|
|
294
|
+
|
|
295
|
+
huggingface:
|
|
296
|
+
api_key: ~
|
|
297
|
+
|
|
298
|
+
openrouter:
|
|
299
|
+
api_key: ~
|
|
300
|
+
|
|
301
|
+
bedrock:
|
|
302
|
+
access_key: ~
|
|
303
|
+
secret_key: ~
|
|
304
|
+
region: us-east-1
|
|
305
|
+
|
|
306
|
+
deepseek:
|
|
307
|
+
api_key: ~
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### General Settings
|
|
311
|
+
|
|
312
|
+
```yaml
|
|
313
|
+
week_start: sunday # For "last weekend" calculations
|
|
314
|
+
connection_timeout: 60 # General connection timeout
|
|
315
|
+
telemetry_enabled: false # Enable OpenTelemetry metrics
|
|
316
|
+
log_level: info # Logging level
|
|
317
|
+
|
|
318
|
+
service:
|
|
319
|
+
name: htm # Service identifier
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
## Complete Environment Variables Reference
|
|
323
|
+
|
|
324
|
+
### Configuration Control
|
|
325
|
+
|
|
326
|
+
| Variable | Description | Default |
|
|
327
|
+
|----------|-------------|---------|
|
|
328
|
+
| `HTM_ENV` | Environment name | `development` |
|
|
329
|
+
| `HTM_CONF` | Custom config file path | - |
|
|
330
|
+
|
|
331
|
+
### Database
|
|
332
|
+
|
|
333
|
+
| Variable | Description | Default |
|
|
334
|
+
|----------|-------------|---------|
|
|
335
|
+
| `HTM_DATABASE__URL` | Full PostgreSQL connection URL | - |
|
|
336
|
+
| `HTM_DATABASE__HOST` | Database host | `localhost` |
|
|
337
|
+
| `HTM_DATABASE__PORT` | Database port | `5432` |
|
|
338
|
+
| `HTM_DATABASE__NAME` | Database name | - |
|
|
339
|
+
| `HTM_DATABASE__USER` | Database user | - |
|
|
340
|
+
| `HTM_DATABASE__PASSWORD` | Database password | - |
|
|
341
|
+
| `HTM_DATABASE__POOL_SIZE` | Connection pool size | `10` |
|
|
342
|
+
| `HTM_DATABASE__TIMEOUT` | Query timeout (ms) | `5000` |
|
|
343
|
+
| `HTM_DATABASE__SSLMODE` | SSL mode | `prefer` |
|
|
344
|
+
|
|
345
|
+
### Embedding
|
|
346
|
+
|
|
347
|
+
| Variable | Description | Default |
|
|
348
|
+
|----------|-------------|---------|
|
|
349
|
+
| `HTM_EMBEDDING__PROVIDER` | LLM provider | `ollama` |
|
|
350
|
+
| `HTM_EMBEDDING__MODEL` | Model name | `nomic-embed-text:latest` |
|
|
351
|
+
| `HTM_EMBEDDING__DIMENSIONS` | Vector dimensions | `768` |
|
|
352
|
+
| `HTM_EMBEDDING__TIMEOUT` | Timeout (seconds) | `120` |
|
|
353
|
+
| `HTM_EMBEDDING__MAX_DIMENSION` | Max dimensions | `2000` |
|
|
354
|
+
|
|
355
|
+
### Tag Extraction
|
|
356
|
+
|
|
357
|
+
| Variable | Description | Default |
|
|
358
|
+
|----------|-------------|---------|
|
|
359
|
+
| `HTM_TAG__PROVIDER` | LLM provider | `ollama` |
|
|
360
|
+
| `HTM_TAG__MODEL` | Model name | `gemma3:latest` |
|
|
361
|
+
| `HTM_TAG__TIMEOUT` | Timeout (seconds) | `180` |
|
|
362
|
+
| `HTM_TAG__MAX_DEPTH` | Max hierarchy depth | `4` |
|
|
363
|
+
|
|
364
|
+
### Proposition Extraction
|
|
365
|
+
|
|
366
|
+
| Variable | Description | Default |
|
|
367
|
+
|----------|-------------|---------|
|
|
368
|
+
| `HTM_PROPOSITION__ENABLED` | Enable extraction | `false` |
|
|
369
|
+
| `HTM_PROPOSITION__PROVIDER` | LLM provider | `ollama` |
|
|
370
|
+
| `HTM_PROPOSITION__MODEL` | Model name | `gemma3:latest` |
|
|
371
|
+
| `HTM_PROPOSITION__TIMEOUT` | Timeout (seconds) | `180` |
|
|
372
|
+
|
|
373
|
+
### Chunking
|
|
374
|
+
|
|
375
|
+
| Variable | Description | Default |
|
|
376
|
+
|----------|-------------|---------|
|
|
377
|
+
| `HTM_CHUNKING__SIZE` | Characters per chunk | `1024` |
|
|
378
|
+
| `HTM_CHUNKING__OVERLAP` | Overlap characters | `64` |
|
|
379
|
+
|
|
380
|
+
### Job Processing
|
|
381
|
+
|
|
382
|
+
| Variable | Description | Default |
|
|
383
|
+
|----------|-------------|---------|
|
|
384
|
+
| `HTM_JOB__BACKEND` | Job backend | - (auto) |
|
|
385
|
+
|
|
386
|
+
### Circuit Breaker
|
|
387
|
+
|
|
388
|
+
| Variable | Description | Default |
|
|
389
|
+
|----------|-------------|---------|
|
|
390
|
+
| `HTM_CIRCUIT_BREAKER__FAILURE_THRESHOLD` | Failures before open | `5` |
|
|
391
|
+
| `HTM_CIRCUIT_BREAKER__RESET_TIMEOUT` | Seconds to half-open | `60` |
|
|
392
|
+
| `HTM_CIRCUIT_BREAKER__HALF_OPEN_MAX_CALLS` | Successes to close | `3` |
|
|
393
|
+
|
|
394
|
+
### Relevance Scoring
|
|
395
|
+
|
|
396
|
+
| Variable | Description | Default |
|
|
397
|
+
|----------|-------------|---------|
|
|
398
|
+
| `HTM_RELEVANCE__SEMANTIC_WEIGHT` | Vector similarity weight | `0.5` |
|
|
399
|
+
| `HTM_RELEVANCE__TAG_WEIGHT` | Tag overlap weight | `0.3` |
|
|
400
|
+
| `HTM_RELEVANCE__RECENCY_WEIGHT` | Freshness weight | `0.1` |
|
|
401
|
+
| `HTM_RELEVANCE__ACCESS_WEIGHT` | Access frequency weight | `0.1` |
|
|
402
|
+
| `HTM_RELEVANCE__RECENCY_HALF_LIFE_HOURS` | Decay half-life | `168.0` |
|
|
403
|
+
|
|
404
|
+
### General
|
|
405
|
+
|
|
406
|
+
| Variable | Description | Default |
|
|
407
|
+
|----------|-------------|---------|
|
|
408
|
+
| `HTM_WEEK_START` | Week start day | `sunday` |
|
|
409
|
+
| `HTM_CONNECTION_TIMEOUT` | Connection timeout | `30` |
|
|
410
|
+
| `HTM_TELEMETRY_ENABLED` | Enable telemetry | `false` |
|
|
411
|
+
| `HTM_LOG_LEVEL` | Log level | `info` |
|
|
412
|
+
| `HTM_SERVICE__NAME` | Service name | `htm` |
|
|
413
|
+
|
|
414
|
+
### Provider API Keys
|
|
415
|
+
|
|
416
|
+
| Variable | Description |
|
|
417
|
+
|----------|-------------|
|
|
418
|
+
| `HTM_PROVIDERS__OPENAI__API_KEY` | OpenAI API key |
|
|
419
|
+
| `HTM_PROVIDERS__OPENAI__ORGANIZATION` | OpenAI organization |
|
|
420
|
+
| `HTM_PROVIDERS__ANTHROPIC__API_KEY` | Anthropic API key |
|
|
421
|
+
| `HTM_PROVIDERS__GEMINI__API_KEY` | Google Gemini API key |
|
|
422
|
+
| `HTM_PROVIDERS__AZURE__API_KEY` | Azure OpenAI API key |
|
|
423
|
+
| `HTM_PROVIDERS__AZURE__ENDPOINT` | Azure endpoint URL |
|
|
424
|
+
| `HTM_PROVIDERS__OLLAMA__URL` | Ollama server URL |
|
|
425
|
+
| `HTM_PROVIDERS__HUGGINGFACE__API_KEY` | HuggingFace API key |
|
|
426
|
+
| `HTM_PROVIDERS__OPENROUTER__API_KEY` | OpenRouter API key |
|
|
427
|
+
| `HTM_PROVIDERS__BEDROCK__ACCESS_KEY` | AWS access key |
|
|
428
|
+
| `HTM_PROVIDERS__BEDROCK__SECRET_KEY` | AWS secret key |
|
|
429
|
+
| `HTM_PROVIDERS__BEDROCK__REGION` | AWS region |
|
|
430
|
+
| `HTM_PROVIDERS__DEEPSEEK__API_KEY` | DeepSeek API key |
|
|
431
|
+
|
|
432
|
+
**Note:** Standard provider environment variables are also supported:
|
|
433
|
+
|
|
434
|
+
| Variable | Maps To |
|
|
435
|
+
|----------|---------|
|
|
436
|
+
| `OPENAI_API_KEY` | `HTM_PROVIDERS__OPENAI__API_KEY` |
|
|
437
|
+
| `ANTHROPIC_API_KEY` | `HTM_PROVIDERS__ANTHROPIC__API_KEY` |
|
|
438
|
+
| `GEMINI_API_KEY` | `HTM_PROVIDERS__GEMINI__API_KEY` |
|
|
439
|
+
| `OLLAMA_URL` | `HTM_PROVIDERS__OLLAMA__URL` |
|
|
440
|
+
| `AWS_ACCESS_KEY_ID` | `HTM_PROVIDERS__BEDROCK__ACCESS_KEY` |
|
|
441
|
+
| `AWS_SECRET_ACCESS_KEY` | `HTM_PROVIDERS__BEDROCK__SECRET_KEY` |
|
|
442
|
+
| `AWS_REGION` | `HTM_PROVIDERS__BEDROCK__REGION` |
|
|
443
|
+
|
|
444
|
+
## Programmatic Configuration
|
|
445
|
+
|
|
446
|
+
Override any setting in code:
|
|
447
|
+
|
|
448
|
+
```ruby
|
|
449
|
+
HTM.configure do |config|
|
|
450
|
+
config.embedding.provider = :openai
|
|
451
|
+
config.embedding.model = 'text-embedding-3-small'
|
|
452
|
+
config.tag.provider = :openai
|
|
453
|
+
config.tag.model = 'gpt-4o-mini'
|
|
454
|
+
config.providers.openai.api_key = ENV['OPENAI_API_KEY']
|
|
455
|
+
end
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### Custom LLM Functions
|
|
459
|
+
|
|
460
|
+
Provide your own embedding and tag extraction:
|
|
461
|
+
|
|
462
|
+
```ruby
|
|
463
|
+
HTM.configure do |config|
|
|
464
|
+
config.embedding_generator = lambda do |text|
|
|
465
|
+
MyService.embed(text) # Must return Array<Float>
|
|
466
|
+
end
|
|
467
|
+
|
|
468
|
+
config.tag_extractor = lambda do |text, existing_ontology|
|
|
469
|
+
MyService.extract_tags(text) # Must return Array<String>
|
|
470
|
+
end
|
|
471
|
+
end
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
## Accessing Configuration
|
|
475
|
+
|
|
476
|
+
```ruby
|
|
477
|
+
# Full config object
|
|
478
|
+
config = HTM.config
|
|
479
|
+
|
|
480
|
+
# Nested access
|
|
481
|
+
config.database.url
|
|
482
|
+
config.embedding.provider
|
|
483
|
+
config.providers.openai.api_key
|
|
484
|
+
|
|
485
|
+
# Check if database is configured
|
|
486
|
+
config.database_configured?
|
|
487
|
+
|
|
488
|
+
# Get current environment
|
|
489
|
+
HTM.env # => "development"
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
## Config File Locations
|
|
493
|
+
|
|
494
|
+
HTM searches for config files in this order:
|
|
495
|
+
|
|
496
|
+
1. **Custom path** - `HTM_CONF` environment variable
|
|
497
|
+
2. **XDG config** - `~/.config/htm/htm.yml`
|
|
498
|
+
3. **Project config** - `./config/htm.yml`
|
|
499
|
+
4. **Local override** - `./config/htm.local.yml` (gitignored)
|
|
500
|
+
|
|
501
|
+
Create a local override for sensitive credentials:
|
|
502
|
+
|
|
503
|
+
```yaml
|
|
504
|
+
# config/htm.local.yml (add to .gitignore)
|
|
505
|
+
providers:
|
|
506
|
+
openai:
|
|
507
|
+
api_key: sk-your-actual-key
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
## See Also
|
|
511
|
+
|
|
512
|
+
- [defaults.yml Source](https://github.com/madbomber/htm/blob/main/lib/htm/config/defaults.yml) - Configuration schema and defaults
|
|
513
|
+
- [LLM Configuration Example](../examples/llm-configuration.md)
|
|
514
|
+
- [Configuration API Reference](../api/yard/HTM/Config.md)
|
|
515
|
+
- [anyway_config Documentation](https://github.com/palkan/anyway_config)
|