htm 0.0.17 → 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.
Files changed (130) 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 +130 -1
  9. data/README.md +13 -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 +3 -3
  15. data/docs/api/database.md +37 -37
  16. data/docs/api/embedding-service.md +140 -110
  17. data/docs/api/htm.md +1 -1
  18. data/docs/api/yard/HTM/ActiveRecordConfig.md +8 -2
  19. data/docs/api/yard/HTM/Config.md +173 -0
  20. data/docs/api/yard/HTM/ConfigSection.md +28 -0
  21. data/docs/api/yard/HTM/Database.md +7 -8
  22. data/docs/api/yard/HTM/JobAdapter.md +1 -1
  23. data/docs/api/yard/HTM.md +0 -57
  24. data/docs/api/yard/index.csv +76 -61
  25. data/docs/api/yard-reference.md +2 -1
  26. data/docs/architecture/adrs/001-postgresql-timescaledb.md +1 -1
  27. data/docs/architecture/adrs/003-ollama-embeddings.md +45 -36
  28. data/docs/architecture/adrs/004-hive-mind.md +1 -1
  29. data/docs/architecture/adrs/008-robot-identification.md +1 -1
  30. data/docs/architecture/adrs/011-pgai-integration.md +4 -4
  31. data/docs/architecture/index.md +11 -9
  32. data/docs/architecture/overview.md +11 -7
  33. data/docs/assets/images/balanced-strategy-decay.svg +41 -0
  34. data/docs/assets/images/class-hierarchy.svg +1 -1
  35. data/docs/assets/images/eviction-priority.svg +43 -0
  36. data/docs/assets/images/exception-hierarchy.svg +2 -2
  37. data/docs/assets/images/hive-mind-shared-memory.svg +52 -0
  38. data/docs/assets/images/htm-architecture-overview.svg +3 -3
  39. data/docs/assets/images/htm-core-components.svg +4 -4
  40. data/docs/assets/images/htm-layered-architecture.svg +1 -1
  41. data/docs/assets/images/htm-memory-addition-flow.svg +2 -2
  42. data/docs/assets/images/htm-memory-recall-flow.svg +2 -2
  43. data/docs/assets/images/memory-topology.svg +53 -0
  44. data/docs/assets/images/two-tier-memory-architecture.svg +55 -0
  45. data/docs/database_rake_tasks.md +5 -5
  46. data/docs/development/rake-tasks.md +11 -11
  47. data/docs/development/setup.md +97 -65
  48. data/docs/development/testing.md +1 -1
  49. data/docs/examples/basic-usage.md +133 -0
  50. data/docs/examples/config-files.md +170 -0
  51. data/docs/examples/file-loading.md +208 -0
  52. data/docs/examples/index.md +116 -0
  53. data/docs/examples/llm-configuration.md +168 -0
  54. data/docs/examples/mcp-client.md +172 -0
  55. data/docs/examples/rails-integration.md +173 -0
  56. data/docs/examples/robot-groups.md +210 -0
  57. data/docs/examples/sinatra-integration.md +218 -0
  58. data/docs/examples/standalone-app.md +216 -0
  59. data/docs/examples/telemetry.md +224 -0
  60. data/docs/examples/timeframes.md +143 -0
  61. data/docs/getting-started/installation.md +117 -60
  62. data/docs/getting-started/quick-start.md +35 -18
  63. data/docs/guides/configuration.md +515 -0
  64. data/docs/guides/file-loading.md +322 -0
  65. data/docs/guides/getting-started.md +42 -11
  66. data/docs/guides/index.md +3 -3
  67. data/docs/guides/long-term-memory.md +1 -1
  68. data/docs/guides/mcp-server.md +47 -29
  69. data/docs/guides/propositions.md +264 -0
  70. data/docs/guides/recalling-memories.md +4 -4
  71. data/docs/guides/search-strategies.md +3 -3
  72. data/docs/guides/tags.md +318 -0
  73. data/docs/guides/telemetry.md +229 -0
  74. data/docs/index.md +10 -18
  75. data/docs/multi_framework_support.md +8 -8
  76. data/docs/{architecture → robots}/hive-mind.md +8 -111
  77. data/docs/robots/index.md +73 -0
  78. data/docs/{guides → robots}/multi-robot.md +3 -3
  79. data/docs/{guides → robots}/robot-groups.md +14 -13
  80. data/docs/{architecture → robots}/two-tier-memory.md +13 -149
  81. data/docs/robots/why-robots.md +85 -0
  82. data/docs/setup_local_database.md +19 -19
  83. data/docs/using_rake_tasks_in_your_app.md +14 -14
  84. data/examples/README.md +50 -6
  85. data/examples/basic_usage.rb +31 -21
  86. data/examples/cli_app/README.md +8 -8
  87. data/examples/cli_app/htm_cli.rb +5 -5
  88. data/examples/config_file_example/README.md +256 -0
  89. data/examples/config_file_example/config/htm.local.yml +34 -0
  90. data/examples/config_file_example/custom_config.yml +22 -0
  91. data/examples/config_file_example/show_config.rb +125 -0
  92. data/examples/custom_llm_configuration.rb +7 -7
  93. data/examples/example_app/Rakefile +2 -2
  94. data/examples/example_app/app.rb +8 -8
  95. data/examples/file_loader_usage.rb +9 -9
  96. data/examples/mcp_client.rb +5 -5
  97. data/examples/rails_app/Gemfile.lock +48 -56
  98. data/examples/rails_app/README.md +1 -1
  99. data/examples/robot_groups/multi_process.rb +5 -5
  100. data/examples/robot_groups/robot_worker.rb +5 -5
  101. data/examples/robot_groups/same_process.rb +9 -9
  102. data/examples/sinatra_app/app.rb +1 -1
  103. data/examples/timeframe_demo.rb +1 -1
  104. data/lib/htm/active_record_config.rb +12 -25
  105. data/lib/htm/circuit_breaker.rb +0 -2
  106. data/lib/htm/config/defaults.yml +246 -0
  107. data/lib/htm/config.rb +888 -0
  108. data/lib/htm/database.rb +23 -27
  109. data/lib/htm/embedding_service.rb +0 -4
  110. data/lib/htm/integrations/sinatra.rb +3 -7
  111. data/lib/htm/job_adapter.rb +76 -16
  112. data/lib/htm/jobs/generate_embedding_job.rb +1 -7
  113. data/lib/htm/jobs/generate_propositions_job.rb +2 -12
  114. data/lib/htm/jobs/generate_tags_job.rb +1 -8
  115. data/lib/htm/loaders/defaults_loader.rb +143 -0
  116. data/lib/htm/loaders/xdg_config_loader.rb +116 -0
  117. data/lib/htm/mcp/cli.rb +200 -58
  118. data/lib/htm/mcp/server.rb +3 -3
  119. data/lib/htm/proposition_service.rb +2 -12
  120. data/lib/htm/railtie.rb +3 -4
  121. data/lib/htm/tag_service.rb +1 -8
  122. data/lib/htm/version.rb +1 -1
  123. data/lib/htm/workflows/remember_workflow.rb +212 -0
  124. data/lib/htm.rb +125 -5
  125. data/mkdocs.yml +33 -8
  126. metadata +83 -10
  127. data/config/database.yml +0 -77
  128. data/docs/api/yard/HTM/Configuration.md +0 -229
  129. data/docs/telemetry.md +0 -391
  130. data/lib/htm/configuration.rb +0 -799
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 964868a160989db5a7f8baa524e89d82552166f5d065f30685a17597ddec627b
4
- data.tar.gz: 963b4d21d30ee51d08c34af26a1d2d1284b17d03ac39734ad81be0d0b3cd1a45
3
+ metadata.gz: 73eb1c7c8727363608ac47f7c1afd26ebb47021a173c105e5bba364598bf143f
4
+ data.tar.gz: e9c6954e8bb6da65e26ea55878da3e817e59f28e3383d74f9b48a0501ebd882b
5
5
  SHA512:
6
- metadata.gz: 2c061077debb17b3bcee1c70e1136cdf8d1248ca100815adb75eb522aa39c40ac1a8863c07684d89da36a7c8df37f6b22b3c98669939cfaf177ea37d51716435
7
- data.tar.gz: 49b6ec15849051d17c85261d7529374d7d5f95be381b96415c10e0e883b08c3f52c5b3303c04ae850376dd23682dd4f387218eed1c6a5b1fab28c2f8eac2c183
6
+ metadata.gz: cb76637105f6033ba58d35f5fe3d73b41b990bd327069c7c526c196c787c62d2287e0fdac58261a2ee7b6d739af9f11bd58843c77b7ad6b486da95e02468665e
7
+ data.tar.gz: 9e4da2a308bfb5efe31a050406caee29e7a653e401a9665a271b3c094d540d50115663966f11f26b7b58a51f7a9354047ee6117ce69250e7dc5ffabb30469a48
@@ -115,7 +115,7 @@ We will use **PostgreSQL with TimescaleDB** as the primary storage backend for H
115
115
  ### Connection Configuration
116
116
  ```ruby
117
117
  # Via environment variable (preferred)
118
- ENV['HTM_DBURL'] = "postgresql://user:pass@host:port/dbname?sslmode=require"
118
+ ENV['HTM_DATABASE__URL'] = "postgresql://user:pass@host:port/dbname?sslmode=require"
119
119
 
120
120
  # Parsed into connection hash
121
121
  {
@@ -284,7 +284,7 @@ LIMIT $3;
284
284
  ruby enable_extensions.rb
285
285
 
286
286
  # 2. Run database schema with triggers
287
- psql $HTM_DBURL < sql/schema.sql
287
+ psql $HTM_DATABASE__URL < sql/schema.sql
288
288
 
289
289
  # 3. Use HTM normally - embeddings automatic!
290
290
  ruby -r ./lib/htm -e "HTM.new(robot_name: 'Bot').add_node('test', 'value')"
@@ -294,16 +294,16 @@ ruby -r ./lib/htm -e "HTM.new(robot_name: 'Bot').add_node('test', 'value')"
294
294
 
295
295
  ```bash
296
296
  # 1. Backup database
297
- pg_dump $HTM_DBURL > htm_backup.sql
297
+ pg_dump $HTM_DATABASE__URL > htm_backup.sql
298
298
 
299
299
  # 2. Enable pgai extension
300
300
  ruby enable_extensions.rb
301
301
 
302
302
  # 3. Apply new schema (adds triggers)
303
- psql $HTM_DBURL < sql/schema.sql
303
+ psql $HTM_DATABASE__URL < sql/schema.sql
304
304
 
305
305
  # 4. (Optional) Regenerate embeddings with new model
306
- psql $HTM_DBURL -c "UPDATE nodes SET value = value;"
306
+ psql $HTM_DATABASE__URL -c "UPDATE nodes SET value = value;"
307
307
  # This triggers embedding regeneration for all nodes
308
308
  ```
309
309
 
@@ -333,7 +333,7 @@ htm.add_node('memory_001', 'PostgreSQL with TimescaleDB handles time-series data
333
333
  HTM::Database.migrate
334
334
 
335
335
  # 2. (Optional) Re-extract topics for existing nodes
336
- psql $HTM_DBURL -c "UPDATE nodes SET value = value;"
336
+ psql $HTM_DATABASE__URL -c "UPDATE nodes SET value = value;"
337
337
  # Triggers topic extraction for all existing nodes
338
338
  ```
339
339
 
data/.envrc CHANGED
@@ -2,35 +2,22 @@
2
2
 
3
3
  export RR=`pwd`
4
4
 
5
- export RAILS_ENV=development
5
+ export HTM_ENV=development
6
6
  export HTM_EXTRACT_PROPOSITIONS=true
7
7
 
8
8
  # Database connection - Localhost PostgreSQL
9
- export HTM_DBHOST=localhost
10
- export HTM_DBPORT=5432
11
- export HTM_DBNAME=htm_development
12
- export HTM_DBUSER=${USER}
13
- export HTM_DBPASS=
14
- export HTM_DBURL="postgresql://${HTM_DBUSER}@${HTM_DBHOST}:${HTM_DBPORT}/${HTM_DBNAME}?sslmode=disable"
15
- # export HTM_DBURL="postgresql://dewayne@localhost:5432/htm_development"
16
-
17
- # Uncomment if using TimescaleDB Cloud instead:
18
- # export HTM_SERVICE_NAME=$TIGER_SERVICE_NAME
19
- # export HTM_DBURL=$TIGER_DBURL
20
- # export HTM_DBNAME=$TIGER_DBNAME
21
- # export HTM_DBUSER=$TIGER_DBUSER
22
- # export HTM_DBPASS=$TIGER_DBPASS
23
- # export HTM_DBHOST=$TIGER_DBHOST
24
- # export HTM_DBPORT=$TIGER_DBPORT
9
+ export HTM_DATABASE__HOST=localhost
10
+ export HTM_DATABASE__PORT=5432
11
+ export HTM_DATABASE__NAME=htm_development
12
+ export HTM_DATABASE__USER=${USER}
13
+ export HTM_DATABASE__PASSWORD=
14
+ export HTM_DATABASE__URL="postgresql://${HTM_DATABASE__USER}@${HTM_DATABASE__HOST}:${HTM_DATABASE__PORT}/${HTM_DATABASE__NAME}?sslmode=disable"
25
15
 
26
16
  # Client-side embedding generation
27
- # HTM generates embeddings before inserting into database
28
- export HTM_EMBEDDINGS_PROVIDER=ollama
29
- export HTM_EMBEDDINGS_MODEL=embeddinggemma
30
- export HTM_EMBEDDINGS_BASE_URL=http://localhost:11434
31
- export HTM_EMBEDDINGS_DIMENSION=768
17
+ export HTM_EMBEDDING__PROVIDER=ollama
18
+ export HTM_EMBEDDING__MODEL=embeddinggemma
19
+ export HTM_EMBEDDING__DIMENSIONS=768
32
20
 
33
21
  # Topic extraction (client-side)
34
- export HTM_TOPIC_PROVIDER=ollama
35
- export HTM_TOPIC_MODEL=phi4
36
- export HTM_TOPIC_BASE_URL=http://localhost:11434
22
+ export HTM_TAG__PROVIDER=ollama
23
+ export HTM_TAG__MODEL=phi4
data/.irbrc CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # HTM Interactive Development Console
4
- # Usage: HTM_DBURL="postgresql://user@localhost:5432/htm_development" irb
4
+ # Usage: HTM_DATABASE__URL="postgresql://user@localhost:5432/htm_development" irb
5
5
 
6
6
  require_relative 'lib/htm'
7
7
  require 'debug_me'
@@ -21,12 +21,12 @@ end
21
21
 
22
22
  # Configure HTM with sensible defaults for interactive use
23
23
  HTM.configure do |config|
24
- config.job_backend = :inline
25
- config.embedding_provider = :ollama
26
- config.embedding_model = 'nomic-embed-text:latest'
27
- config.embedding_dimensions = 768
28
- config.tag_provider = :ollama
29
- config.tag_model = 'gemma3:latest'
24
+ config.job.backend = :inline
25
+ config.embedding.provider = :ollama
26
+ config.embedding.model = 'nomic-embed-text:latest'
27
+ config.embedding.dimensions = 768
28
+ config.tag.provider = :ollama
29
+ config.tag.model = 'gemma3:latest'
30
30
  config.reset_to_defaults
31
31
  end
32
32
  puts "✓ HTM configured (inline jobs, Ollama provider)"
data/.tbls.yml CHANGED
@@ -1,9 +1,9 @@
1
1
  # tbls configuration for HTM database documentation
2
2
  # https://github.com/k1LoW/tbls
3
3
 
4
- # Database connection - uses HTM_DBURL environment variable
4
+ # Database connection - uses HTM_DATABASE__URL environment variable
5
5
  # tbls expands environment variables with $VAR or ${VAR} syntax
6
- dsn: $HTM_DBURL
6
+ dsn: $HTM_DATABASE__URL
7
7
 
8
8
  # Output documentation to docs/database directory
9
9
  docPath: docs/database
data/CHANGELOG.md CHANGED
@@ -7,6 +7,128 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.0.20] - 2025-12-22
11
+ ### Added
12
+ - **Fiber-based job backend** - New `:fiber` backend for I/O-bound background jobs
13
+ - Uses `async` gem for cooperative concurrency
14
+ - Non-blocking execution ideal for LLM API calls
15
+ - `JobAdapter.enqueue_parallel(jobs)` for concurrent job execution
16
+ - Fiber backend runs jobs with `Async::Barrier` for parallel coordination
17
+ - **RememberWorkflow using simple_flow** - Parallel processing pipeline for node enrichment
18
+ - Orchestrates save_node → (embedding, tags, propositions in parallel) → finalize
19
+ - Uses `SimpleFlow::Pipeline` with dependency-based step execution
20
+ - Configurable concurrency model (`:auto`, `:threads`, `:async`)
21
+ - Visualization support: `to_mermaid` and `execution_plan` methods
22
+
23
+ ### Changed
24
+ - **async gem is now a required dependency** - Previously optional, now always available
25
+ - Enables fiber-based concurrency for all HTM installations
26
+ - `:fiber` is now the default job backend (was `:thread`)
27
+ - **Default job backend changed from `:thread` to `:fiber`** - Better performance for I/O-bound LLM operations
28
+
29
+ ### Removed
30
+ - **`JobAdapter.async_available?` method** - No longer needed since async is always available
31
+
32
+ ### Fixed
33
+ - **`connection_timeout` default inconsistency** - Unified default to 60 seconds across all files
34
+ - `test/configuration_test.rb`, `docs/guides/configuration.md`, and `db/seeds.rb` now match `defaults.yml`
35
+
36
+ ### Dependencies
37
+ - Added `async` (~> 2.0) as required runtime dependency
38
+ - Added `simple_flow` for workflow orchestration
39
+
40
+ ## [0.0.19] - 2025-12-21
41
+
42
+ ### Changed
43
+ - **Reorganized "Robots!" documentation** - Consolidated 5 robot-related docs into `docs/robots/` subdirectory
44
+ - Created `docs/robots/index.md` as section overview with navigation table and architecture diagram
45
+ - Moved `docs/robots.md` → `docs/robots/why-robots.md`
46
+ - Moved `docs/guides/multi-robot.md` → `docs/robots/multi-robot.md`
47
+ - Moved `docs/guides/robot-groups.md` → `docs/robots/robot-groups.md`
48
+ - Moved `docs/architecture/two-tier-memory.md` → `docs/robots/two-tier-memory.md`
49
+ - Moved `docs/architecture/hive-mind.md` → `docs/robots/hive-mind.md`
50
+ - Updated `mkdocs.yml` navigation with logical information flow
51
+ - Fixed 30+ broken relative links across documentation files
52
+ - **Extracted inline SVG graphics to standalone files** - Improved documentation maintainability
53
+ - From `hive-mind.md`: `hive-mind-shared-memory.svg`, `memory-topology.svg`
54
+ - From `two-tier-memory.md`: `two-tier-memory-architecture.svg`, `eviction-priority.svg`, `balanced-strategy-decay.svg`
55
+ - All SVGs now in `docs/assets/images/` and referenced via markdown image syntax
56
+
57
+ ### Fixed
58
+ - **ConfigSection.md unrecognized link warning** - Wrapped method signatures in backticks to prevent MkDocs interpreting bracket parameters as links
59
+
60
+ ## [0.0.18] - 2025-12-20
61
+ ### Added
62
+ - **Anyway::Config-based configuration system** - Replaced custom Configuration class with robust multi-source config management
63
+ - **Multi-layer configuration loading** with priority (lowest to highest):
64
+ 1. Bundled defaults (`lib/htm/config/defaults.yml`)
65
+ 2. XDG user config (`~/.config/htm/htm.yml`)
66
+ 3. Project config (`./config/htm.yml`)
67
+ 4. Local overrides (`./config/htm.local.yml`) - gitignored for secrets
68
+ 5. Environment variables (`HTM_*`)
69
+ 6. Programmatic (`HTM.configure` block)
70
+ - **Nested configuration access**: `HTM.config.database.host`, `HTM.config.embedding.model`, etc.
71
+ - **Environment-specific overrides**: Different defaults for development, test, and production environments
72
+ - **Configuration source tracing**: Debug where each configuration value originated
73
+ - **YAML-based prompt templates** - Tag and proposition extraction prompts now configurable via YAML
74
+ - Prompts use `%{placeholder}` syntax for runtime interpolation
75
+ - System and user prompts for tag extraction: `tag.system_prompt`, `tag.user_prompt_template`
76
+ - System and user prompts for proposition extraction: `proposition.system_prompt`, `proposition.user_prompt_template`
77
+ - Taxonomy context templates: `tag.taxonomy_context_existing`, `tag.taxonomy_context_empty`
78
+ - **New loaders for configuration sources**:
79
+ - `HTM::Loaders::DefaultsLoader` - Loads bundled gem defaults from YAML
80
+ - `HTM::Loaders::XDGConfigLoader` - Loads XDG-compliant user configuration
81
+ - **Configuration management example** - New `examples/config_file_example/` directory
82
+ - `show_config.rb` - Demonstrates configuration source tracing
83
+ - Sample configuration files showing override mechanisms
84
+ - Comprehensive README with configuration patterns
85
+
86
+ ### Changed
87
+ - **BREAKING: Database environment variables renamed** - Migrate from `HTM_DBURL`/`HTM_DB*` to namespaced format
88
+ - `HTM_DBURL` → `HTM_DATABASE__URL`
89
+ - `HTM_DATABASE` → `HTM_DATABASE__NAME`
90
+ - `HTM_DB_USER` → `HTM_DATABASE__USER`
91
+ - `HTM_DB_PASSWORD` → `HTM_DATABASE__PASSWORD`
92
+ - `HTM_DB_HOST` → `HTM_DATABASE__HOST`
93
+ - `HTM_DB_PORT` → `HTM_DATABASE__PORT`
94
+ - Uses double underscore (`__`) for nested config (Anyway::Config convention)
95
+ - **Configuration access patterns updated** - Direct attributes → nested configuration
96
+ - `config.embedding_provider` → `config.embedding.provider`
97
+ - `config.embedding_model` → `config.embedding.model`
98
+ - `config.tag_provider` → `config.tag.provider`
99
+ - `config.tag_model` → `config.tag.model`
100
+ - `config.chunk_size` → `config.chunking.size`
101
+ - `config.chunk_overlap` → `config.chunking.overlap`
102
+ - **Removed `config/database.yml`** - Replaced by flexible YAML configuration files
103
+ - **Prompt generation refactored** - Hardcoded prompt strings moved to `defaults.yml` templates
104
+ - **MCP CLI enhanced** - Improved command handling and configuration output display
105
+
106
+ ### Removed
107
+ - **`HTM::Configuration` class** - Replaced by `HTM::Config` using Anyway::Config
108
+ - **Legacy database environment variable support** - Must use new `HTM_DATABASE__*` format
109
+
110
+ ### Dependencies
111
+ - Added `anyway_config` gem for configuration management
112
+
113
+ ### Migration Guide
114
+ Update your environment variables:
115
+ ```bash
116
+ # Old format
117
+ export HTM_DBURL="postgresql://user@localhost:5432/htm_development"
118
+
119
+ # New format
120
+ export HTM_DATABASE__URL="postgresql://user@localhost:5432/htm_development"
121
+ ```
122
+
123
+ Update configuration access:
124
+ ```ruby
125
+ # Old pattern
126
+ HTM.configuration.embedding_model
127
+
128
+ # New pattern
129
+ HTM.config.embedding.model
130
+ ```
131
+
10
132
  ## [0.0.17] - 2025-12-18
11
133
 
12
134
  ### Added
@@ -618,7 +740,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
618
740
  - Working memory size is user-configurable
619
741
  - See ADRs for detailed architectural decisions and rationale
620
742
 
621
- [Unreleased]: https://github.com/madbomber/htm/compare/v0.0.12...HEAD
743
+ [Unreleased]: https://github.com/madbomber/htm/compare/v0.0.19...HEAD
744
+ [0.0.19]: https://github.com/madbomber/htm/compare/v0.0.18...v0.0.19
745
+ [0.0.18]: https://github.com/madbomber/htm/compare/v0.0.17...v0.0.18
746
+ [0.0.17]: https://github.com/madbomber/htm/compare/v0.0.15...v0.0.17
747
+ [0.0.15]: https://github.com/madbomber/htm/compare/v0.0.14...v0.0.15
748
+ [0.0.14]: https://github.com/madbomber/htm/compare/v0.0.13...v0.0.14
749
+ [0.0.13]: https://github.com/madbomber/htm/compare/v0.0.11...v0.0.13
750
+ [0.0.11]: https://github.com/madbomber/htm/compare/v0.0.10...v0.0.11
622
751
  [0.0.12]: https://github.com/madbomber/htm/compare/v0.0.10...v0.0.12
623
752
  [0.0.10]: https://github.com/madbomber/htm/compare/v0.0.9...v0.0.10
624
753
  [0.0.9]: https://github.com/madbomber/htm/compare/v0.0.8...v0.0.9
data/README.md CHANGED
@@ -1,4 +1,16 @@
1
+
1
2
  <div align="center">
3
+ <div style="background: linear-gradient(135deg, #90EE90 0%, #32CD32 100%); border: 4px solid #228B22; border-radius: 12px; padding: 20px; margin: 20px auto; max-width: 800px; box-shadow: 0 8px 16px rgba(34, 139, 34, 0.3);">
4
+ <p style="color: #000000; font-size: 42px; font-weight: bold; margin: 0;">
5
+ 🚀 v0.0.20 🚀
6
+ </p>
7
+ <p style="color: #000; font-size: 27px; font-weight: bold; margin: 10px 0 0 0; line-height: 1.6;">
8
+ <strong>Fiber-based concurrency</strong> is now the default.<br/>
9
+ Parallel embedding, tagging, and proposition extraction via simple_flow.
10
+ </p>
11
+ </div>
12
+
13
+
2
14
  <h1>HTM</h1>
3
15
  <img src="docs/assets/images/htm_demo.gif" alt="Tree of Knowledge is Growing" width="400">
4
16
 
@@ -39,7 +51,7 @@ HTM includes a Model Context Protocol server with 23 tools for memory management
39
51
  "mcpServers": {
40
52
  "htm": {
41
53
  "command": "htm_mcp",
42
- "env": { "HTM_DBURL": "postgresql://localhost/htm" }
54
+ "env": { "HTM_DATABASE__URL": "postgresql://localhost/htm" }
43
55
  }
44
56
  }
45
57
  }
data/Rakefile CHANGED
@@ -10,16 +10,21 @@ Rake::TestTask.new(:test) do |t|
10
10
  t.verbose = true
11
11
  end
12
12
 
13
- # Ensure test task runs with RAILS_ENV=test
13
+ # Ensure test task runs with HTM_ENV=test (takes priority over RAILS_ENV/RACK_ENV)
14
14
  task :test do
15
- ENV['RAILS_ENV'] = 'test'
15
+ ENV['HTM_ENV'] = 'test'
16
16
  end
17
17
 
18
18
  # Prepend environment setup before test runs
19
19
  Rake::Task[:test].enhance [:set_test_env]
20
20
 
21
21
  task :set_test_env do
22
- ENV['RAILS_ENV'] = 'test'
22
+ ENV['HTM_ENV'] = 'test'
23
+ # Set database URL if not already configured
24
+ # Uses current system user for local PostgreSQL connection
25
+ unless ENV['HTM_DATABASE__URL']
26
+ ENV['HTM_DATABASE__URL'] = "postgresql://#{ENV['USER']}@localhost:5432/htm_test"
27
+ end
23
28
  end
24
29
 
25
30
  task default: :test
data/SETUP.md CHANGED
@@ -60,10 +60,10 @@ psql htm_development -c "SELECT extname, extversion FROM pg_extension;"
60
60
 
61
61
  ```bash
62
62
  # Add to your ~/.bashrc or ~/.zshrc
63
- export HTM_DBURL="postgresql://postgres@localhost:5432/htm_development"
63
+ export HTM_DATABASE__URL="postgresql://postgres@localhost:5432/htm_development"
64
64
 
65
65
  # Or for a specific user with password
66
- export HTM_DBURL="postgresql://username:password@localhost:5432/htm_development"
66
+ export HTM_DATABASE__URL="postgresql://username:password@localhost:5432/htm_development"
67
67
  ```
68
68
 
69
69
  ### 5. Verify Connection
@@ -136,12 +136,12 @@ export OLLAMA_URL="http://custom-host:11434"
136
136
 
137
137
  | Variable | Description | Example Value |
138
138
  |----------|-------------|---------------|
139
- | `HTM_DBURL` | Full PostgreSQL connection URL (preferred) | `postgresql://postgres@localhost:5432/htm_development` |
140
- | `HTM_DBNAME` | Database name (fallback) | `htm_development` |
141
- | `HTM_DBUSER` | Database user (fallback) | `postgres` |
142
- | `HTM_DBPASS` | Database password (fallback) | `` |
143
- | `HTM_DBHOST` | Database host (fallback) | `localhost` |
144
- | `HTM_DBPORT` | Database port (fallback) | `5432` |
139
+ | `HTM_DATABASE__URL` | Full PostgreSQL connection URL (preferred) | `postgresql://postgres@localhost:5432/htm_development` |
140
+ | `HTM_DATABASE__NAME` | Database name (fallback) | `htm_development` |
141
+ | `HTM_DATABASE__USER` | Database user (fallback) | `postgres` |
142
+ | `HTM_DATABASE__PASSWORD` | Database password (fallback) | `` |
143
+ | `HTM_DATABASE__HOST` | Database host (fallback) | `localhost` |
144
+ | `HTM_DATABASE__PORT` | Database port (fallback) | `5432` |
145
145
  | `OLLAMA_URL` | Ollama server URL | `http://localhost:11434` |
146
146
 
147
147
  ## Development Workflow
@@ -150,7 +150,7 @@ export OLLAMA_URL="http://custom-host:11434"
150
150
 
151
151
  ```bash
152
152
  # 1. Set database URL (if not in shell config)
153
- export HTM_DBURL="postgresql://postgres@localhost:5432/htm_development"
153
+ export HTM_DATABASE__URL="postgresql://postgres@localhost:5432/htm_development"
154
154
 
155
155
  # 2. Install dependencies
156
156
  bundle install
@@ -196,7 +196,7 @@ HTM/
196
196
  │ │ ├── configuration.rb # Multi-provider LLM config
197
197
  │ │ └── version.rb # Version constant
198
198
  ├── config/
199
- │ └── database.yml # Database configuration
199
+ │ └── defaults.yml # Default configuration values
200
200
  ├── db/
201
201
  │ └── schema.sql # Database schema
202
202
  ├── test/
@@ -248,10 +248,10 @@ If you get connection errors:
248
248
 
249
249
  ```bash
250
250
  # Verify environment variable is set
251
- echo $HTM_DBURL
251
+ echo $HTM_DATABASE__URL
252
252
 
253
253
  # Test connection manually
254
- psql $HTM_DBURL -c "SELECT 1"
254
+ psql $HTM_DATABASE__URL -c "SELECT 1"
255
255
 
256
256
  # Check PostgreSQL is running
257
257
  brew services list | grep postgresql # macOS
data/bin/htm_mcp CHANGED
@@ -13,10 +13,6 @@
13
13
  # htm_mcp version # Show HTM version
14
14
  # htm_mcp help # Show help and environment variables
15
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
16
  require_relative '../lib/htm'
21
17
  require_relative '../lib/htm/mcp/cli'
22
18
 
@@ -23,8 +23,8 @@ The seeding process uses environment variables for configuration. All settings h
23
23
 
24
24
  ### Database Settings
25
25
 
26
- - `HTM_DBURL` - Full PostgreSQL connection URL (required)
27
- - Or individual settings: `HTM_DBHOST`, `HTM_DBPORT`, `HTM_DBNAME`, `HTM_DBUSER`, `HTM_DBPASS`
26
+ - `HTM_DATABASE__URL` - Full PostgreSQL connection URL (required)
27
+ - Or individual settings: `HTM_DATABASE__HOST`, `HTM_DATABASE__PORT`, `HTM_DATABASE__NAME`, `HTM_DATABASE__USER`, `HTM_DATABASE__PASSWORD`
28
28
 
29
29
  ### Other Settings
30
30
 
data/db/seeds.rb CHANGED
@@ -15,7 +15,7 @@
15
15
  # HTM_EMBEDDING_TIMEOUT - Embedding generation timeout in seconds (default: 120)
16
16
  # HTM_TAG_TIMEOUT - Tag generation timeout in seconds (default: 180)
17
17
  # HTM_CONNECTION_TIMEOUT - LLM connection timeout in seconds (default: 30)
18
- # HTM_DBURL - Database connection URL
18
+ # HTM_DATABASE__URL - Database connection URL
19
19
  #
20
20
  # Usage:
21
21
  # rake htm:db:seed
@@ -37,7 +37,7 @@ tag_provider = (ENV['HTM_TAG_PROVIDER'] || 'ollama').to_sym
37
37
  tag_model = ENV['HTM_TAG_MODEL'] || 'gemma3'
38
38
  embedding_timeout = (ENV['HTM_EMBEDDING_TIMEOUT'] || '120').to_i
39
39
  tag_timeout = (ENV['HTM_TAG_TIMEOUT'] || '180').to_i
40
- connection_timeout = (ENV['HTM_CONNECTION_TIMEOUT'] || '30').to_i
40
+ connection_timeout = (ENV['HTM_CONNECTION_TIMEOUT'] || '60').to_i
41
41
 
42
42
  puts "Configuration:"
43
43
  puts " Embedding Provider: #{embedding_provider}"
@@ -64,7 +64,7 @@ end
64
64
  puts "✓ HTM configured"
65
65
  puts
66
66
 
67
- # Create HTM instance (uses default database config from ENV['HTM_DBURL'])
67
+ # Create HTM instance (uses default database config from ENV['HTM_DATABASE__URL'])
68
68
  htm = HTM.new(robot_name: ENV['HTM_ROBOT_NAME'] || "Seed Robot")
69
69
 
70
70
  # Add sample conversation messages
data/docs/api/database.md CHANGED
@@ -38,7 +38,7 @@ HTM::Database.setup(db_url = nil)
38
38
 
39
39
  | Parameter | Type | Default | Description |
40
40
  |-----------|------|---------|-------------|
41
- | `db_url` | String, nil | `ENV['HTM_DBURL']` | Database connection URL |
41
+ | `db_url` | String, nil | `ENV['HTM_DATABASE__URL']` | Database connection URL |
42
42
 
43
43
  #### Returns
44
44
 
@@ -170,25 +170,25 @@ HTM::Database.parse_connection_params()
170
170
  #### Returns
171
171
 
172
172
  - `Hash` - Connection configuration
173
- - `nil` - If `ENV['HTM_DBNAME']` not set
173
+ - `nil` - If `ENV['HTM_DATABASE__NAME']` not set
174
174
 
175
175
  #### Environment Variables
176
176
 
177
177
  | Variable | Description | Default |
178
178
  |----------|-------------|---------|
179
- | `HTM_DBHOST` | Database hostname | `'cw7rxj91bm.srbbwwxn56.tsdb.cloud.timescale.com'` |
180
- | `HTM_DBPORT` | Database port | `37807` |
181
- | `HTM_DBNAME` | Database name | *required* |
182
- | `HTM_DBUSER` | Database user | *required* |
183
- | `HTM_DBPASS` | Database password | *required* |
179
+ | `HTM_DATABASE__HOST` | Database hostname | `'cw7rxj91bm.srbbwwxn56.tsdb.cloud.timescale.com'` |
180
+ | `HTM_DATABASE__PORT` | Database port | `37807` |
181
+ | `HTM_DATABASE__NAME` | Database name | *required* |
182
+ | `HTM_DATABASE__USER` | Database user | *required* |
183
+ | `HTM_DATABASE__PASSWORD` | Database password | *required* |
184
184
 
185
185
  #### Examples
186
186
 
187
187
  ```ruby
188
188
  # Set environment variables
189
- ENV['HTM_DBNAME'] = 'tsdb'
190
- ENV['HTM_DBUSER'] = 'tsdbadmin'
191
- ENV['HTM_DBPASS'] = 'secret'
189
+ ENV['HTM_DATABASE__NAME'] = 'tsdb'
190
+ ENV['HTM_DATABASE__USER'] = 'tsdbadmin'
191
+ ENV['HTM_DATABASE__PASSWORD'] = 'secret'
192
192
 
193
193
  config = HTM::Database.parse_connection_params()
194
194
  # => {
@@ -201,14 +201,14 @@ config = HTM::Database.parse_connection_params()
201
201
  # }
202
202
 
203
203
  # Custom host and port
204
- ENV['HTM_DBHOST'] = 'localhost'
205
- ENV['HTM_DBPORT'] = '5432'
204
+ ENV['HTM_DATABASE__HOST'] = 'localhost'
205
+ ENV['HTM_DATABASE__PORT'] = '5432'
206
206
 
207
207
  config = HTM::Database.parse_connection_params()
208
208
  # => { host: "localhost", port: 5432, ... }
209
209
 
210
- # Without HTM_DBNAME
211
- ENV.delete('HTM_DBNAME')
210
+ # Without HTM_DATABASE__NAME
211
+ ENV.delete('HTM_DATABASE__NAME')
212
212
  config = HTM::Database.parse_connection_params()
213
213
  # => nil
214
214
  ```
@@ -230,29 +230,29 @@ HTM::Database.default_config()
230
230
 
231
231
  #### Priority Order
232
232
 
233
- 1. `ENV['HTM_DBURL']` - Parse connection URL
234
- 2. `ENV['HTM_DBNAME']` - Parse individual params
233
+ 1. `ENV['HTM_DATABASE__URL']` - Parse connection URL
234
+ 2. `ENV['HTM_DATABASE__NAME']` - Parse individual params
235
235
  3. `nil` - No configuration available
236
236
 
237
237
  #### Examples
238
238
 
239
239
  ```ruby
240
- # Using HTM_DBURL
241
- ENV['HTM_DBURL'] = 'postgresql://user:pass@host/db'
240
+ # Using HTM_DATABASE__URL
241
+ ENV['HTM_DATABASE__URL'] = 'postgresql://user:pass@host/db'
242
242
  config = HTM::Database.default_config
243
243
  # => Parsed from URL
244
244
 
245
- # Using HTM_DBNAME
246
- ENV.delete('HTM_DBURL')
247
- ENV['HTM_DBNAME'] = 'mydb'
248
- ENV['HTM_DBUSER'] = 'user'
249
- ENV['HTM_DBPASS'] = 'pass'
245
+ # Using HTM_DATABASE__NAME
246
+ ENV.delete('HTM_DATABASE__URL')
247
+ ENV['HTM_DATABASE__NAME'] = 'mydb'
248
+ ENV['HTM_DATABASE__USER'] = 'user'
249
+ ENV['HTM_DATABASE__PASSWORD'] = 'pass'
250
250
  config = HTM::Database.default_config
251
251
  # => Parsed from params
252
252
 
253
253
  # No configuration
254
- ENV.delete('HTM_DBURL')
255
- ENV.delete('HTM_DBNAME')
254
+ ENV.delete('HTM_DATABASE__URL')
255
+ ENV.delete('HTM_DATABASE__NAME')
256
256
  config = HTM::Database.default_config
257
257
  # => nil
258
258
 
@@ -341,33 +341,33 @@ Using URL (recommended):
341
341
 
342
342
  ```bash
343
343
  # In ~/.bashrc__tiger
344
- export HTM_DBURL='postgresql://tsdbadmin:PASSWORD@SERVICE.tsdb.cloud.timescale.com:37807/tsdb?sslmode=require'
344
+ export HTM_DATABASE__URL='postgresql://tsdbadmin:PASSWORD@SERVICE.tsdb.cloud.timescale.com:37807/tsdb?sslmode=require'
345
345
  ```
346
346
 
347
347
  Using individual variables:
348
348
 
349
349
  ```bash
350
350
  # In ~/.bashrc__tiger
351
- export HTM_DBHOST='xxx.tsdb.cloud.timescale.com'
352
- export HTM_DBPORT=37807
353
- export HTM_DBNAME='tsdb'
354
- export HTM_DBUSER='tsdbadmin'
355
- export HTM_DBPASS='your_password'
351
+ export HTM_DATABASE__HOST='xxx.tsdb.cloud.timescale.com'
352
+ export HTM_DATABASE__PORT=37807
353
+ export HTM_DATABASE__NAME='tsdb'
354
+ export HTM_DATABASE__USER='tsdbadmin'
355
+ export HTM_DATABASE__PASSWORD='your_password'
356
356
  ```
357
357
 
358
358
  ### Local PostgreSQL
359
359
 
360
360
  ```bash
361
- export HTM_DBURL='postgresql://localhost/htm_dev'
361
+ export HTM_DATABASE__URL='postgresql://localhost/htm_dev'
362
362
 
363
363
  # Or with auth
364
- export HTM_DBURL='postgresql://user:pass@localhost:5432/htm_dev'
364
+ export HTM_DATABASE__URL='postgresql://user:pass@localhost:5432/htm_dev'
365
365
  ```
366
366
 
367
367
  ### Docker PostgreSQL
368
368
 
369
369
  ```bash
370
- export HTM_DBURL='postgresql://postgres:postgres@localhost:5432/htm'
370
+ export HTM_DATABASE__URL='postgresql://postgres:postgres@localhost:5432/htm'
371
371
  ```
372
372
 
373
373
  ---
@@ -402,7 +402,7 @@ if config
402
402
  puts "Port: #{config[:port]}"
403
403
  else
404
404
  puts "No database configuration found"
405
- puts "Please set HTM_DBURL or HTM_DBNAME environment variables"
405
+ puts "Please set HTM_DATABASE__URL or HTM_DATABASE__NAME environment variables"
406
406
  end
407
407
 
408
408
  # Test connection
@@ -493,7 +493,7 @@ pg_isready -h localhost -p 5432
493
493
  psql -h localhost -U user -d dbname
494
494
 
495
495
  # Verify environment
496
- echo $HTM_DBURL
496
+ echo $HTM_DATABASE__URL
497
497
  ```
498
498
 
499
499
  ### Permission Denied
@@ -576,7 +576,7 @@ end
576
576
  config = HTM::Database.default_config
577
577
 
578
578
  unless config
579
- raise "Database not configured. Please set HTM_DBURL environment variable. " \
579
+ raise "Database not configured. Please set HTM_DATABASE__URL environment variable. " \
580
580
  "See README.md for configuration instructions."
581
581
  end
582
582
  ```