htm 0.0.1 → 0.0.10

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 (184) hide show
  1. checksums.yaml +4 -4
  2. data/.aigcm_msg +1 -0
  3. data/.architecture/reviews/comprehensive-codebase-review.md +577 -0
  4. data/.claude/settings.local.json +92 -0
  5. data/.envrc +1 -0
  6. data/.irbrc +283 -80
  7. data/.tbls.yml +31 -0
  8. data/CHANGELOG.md +314 -16
  9. data/CLAUDE.md +603 -0
  10. data/README.md +76 -5
  11. data/Rakefile +5 -0
  12. data/SETUP.md +132 -101
  13. data/db/migrate/{20250101000001_enable_extensions.rb → 00001_enable_extensions.rb} +0 -1
  14. data/db/migrate/00002_create_robots.rb +11 -0
  15. data/db/migrate/00003_create_file_sources.rb +20 -0
  16. data/db/migrate/00004_create_nodes.rb +65 -0
  17. data/db/migrate/00005_create_tags.rb +13 -0
  18. data/db/migrate/00006_create_node_tags.rb +18 -0
  19. data/db/migrate/00007_create_robot_nodes.rb +26 -0
  20. data/db/migrate/00009_add_working_memory_to_robot_nodes.rb +12 -0
  21. data/db/schema.sql +390 -36
  22. data/docs/api/database.md +19 -232
  23. data/docs/api/embedding-service.md +1 -7
  24. data/docs/api/htm.md +305 -364
  25. data/docs/api/index.md +1 -7
  26. data/docs/api/long-term-memory.md +342 -590
  27. data/docs/api/yard/HTM/ActiveRecordConfig.md +23 -0
  28. data/docs/api/yard/HTM/AuthorizationError.md +11 -0
  29. data/docs/api/yard/HTM/CircuitBreaker.md +92 -0
  30. data/docs/api/yard/HTM/CircuitBreakerOpenError.md +34 -0
  31. data/docs/api/yard/HTM/Configuration.md +175 -0
  32. data/docs/api/yard/HTM/Database.md +99 -0
  33. data/docs/api/yard/HTM/DatabaseError.md +14 -0
  34. data/docs/api/yard/HTM/EmbeddingError.md +18 -0
  35. data/docs/api/yard/HTM/EmbeddingService.md +58 -0
  36. data/docs/api/yard/HTM/Error.md +11 -0
  37. data/docs/api/yard/HTM/JobAdapter.md +39 -0
  38. data/docs/api/yard/HTM/LongTermMemory.md +342 -0
  39. data/docs/api/yard/HTM/NotFoundError.md +17 -0
  40. data/docs/api/yard/HTM/Observability.md +107 -0
  41. data/docs/api/yard/HTM/QueryTimeoutError.md +19 -0
  42. data/docs/api/yard/HTM/Railtie.md +27 -0
  43. data/docs/api/yard/HTM/ResourceExhaustedError.md +13 -0
  44. data/docs/api/yard/HTM/TagError.md +18 -0
  45. data/docs/api/yard/HTM/TagService.md +67 -0
  46. data/docs/api/yard/HTM/Timeframe/Result.md +24 -0
  47. data/docs/api/yard/HTM/Timeframe.md +40 -0
  48. data/docs/api/yard/HTM/TimeframeExtractor/Result.md +24 -0
  49. data/docs/api/yard/HTM/TimeframeExtractor.md +45 -0
  50. data/docs/api/yard/HTM/ValidationError.md +20 -0
  51. data/docs/api/yard/HTM/WorkingMemory.md +131 -0
  52. data/docs/api/yard/HTM.md +80 -0
  53. data/docs/api/yard/index.csv +179 -0
  54. data/docs/api/yard-reference.md +51 -0
  55. data/docs/architecture/adrs/001-postgresql-timescaledb.md +1 -1
  56. data/docs/architecture/adrs/003-ollama-embeddings.md +1 -1
  57. data/docs/architecture/adrs/010-redis-working-memory-rejected.md +2 -27
  58. data/docs/architecture/adrs/index.md +2 -13
  59. data/docs/architecture/hive-mind.md +165 -166
  60. data/docs/architecture/index.md +2 -2
  61. data/docs/architecture/overview.md +5 -171
  62. data/docs/architecture/two-tier-memory.md +1 -35
  63. data/docs/assets/images/adr-010-current-architecture.svg +37 -0
  64. data/docs/assets/images/adr-010-proposed-architecture.svg +48 -0
  65. data/docs/assets/images/adr-dependency-tree.svg +93 -0
  66. data/docs/assets/images/class-hierarchy.svg +55 -0
  67. data/docs/assets/images/exception-hierarchy.svg +45 -0
  68. data/docs/assets/images/htm-architecture-overview.svg +83 -0
  69. data/docs/assets/images/htm-complete-memory-flow.svg +160 -0
  70. data/docs/assets/images/htm-context-assembly-flow.svg +148 -0
  71. data/docs/assets/images/htm-eviction-process.svg +141 -0
  72. data/docs/assets/images/htm-memory-addition-flow.svg +138 -0
  73. data/docs/assets/images/htm-memory-recall-flow.svg +152 -0
  74. data/docs/assets/images/htm-node-states.svg +123 -0
  75. data/docs/assets/images/project-structure.svg +78 -0
  76. data/docs/assets/images/test-directory-structure.svg +38 -0
  77. data/{dbdoc → docs/database}/README.md +127 -125
  78. data/docs/database/public.file_sources.md +42 -0
  79. data/docs/database/public.file_sources.svg +211 -0
  80. data/{dbdoc → docs/database}/public.node_tags.md +7 -8
  81. data/docs/database/public.node_tags.svg +239 -0
  82. data/{dbdoc → docs/database}/public.nodes.md +22 -17
  83. data/docs/database/public.nodes.svg +271 -0
  84. data/docs/database/public.robot_nodes.md +46 -0
  85. data/docs/database/public.robot_nodes.svg +243 -0
  86. data/{dbdoc → docs/database}/public.robots.md +2 -3
  87. data/docs/database/public.robots.svg +161 -0
  88. data/docs/database/public.tags.svg +139 -0
  89. data/{dbdoc → docs/database}/schema.json +941 -630
  90. data/docs/database/schema.svg +282 -0
  91. data/docs/development/index.md +1 -29
  92. data/docs/development/schema.md +134 -309
  93. data/docs/development/testing.md +1 -9
  94. data/docs/getting-started/index.md +47 -0
  95. data/docs/{installation.md → getting-started/installation.md} +2 -2
  96. data/docs/{quick-start.md → getting-started/quick-start.md} +5 -5
  97. data/docs/guides/adding-memories.md +295 -643
  98. data/docs/guides/recalling-memories.md +36 -1
  99. data/docs/guides/search-strategies.md +85 -51
  100. data/docs/images/htm-er-diagram.svg +156 -0
  101. data/docs/index.md +16 -31
  102. data/docs/multi_framework_support.md +4 -4
  103. data/examples/README.md +280 -0
  104. data/examples/basic_usage.rb +18 -16
  105. data/examples/cli_app/htm_cli.rb +146 -8
  106. data/examples/cli_app/temp.log +93 -0
  107. data/examples/custom_llm_configuration.rb +1 -2
  108. data/examples/example_app/app.rb +11 -14
  109. data/examples/file_loader_usage.rb +177 -0
  110. data/examples/robot_groups/lib/robot_group.rb +419 -0
  111. data/examples/robot_groups/lib/working_memory_channel.rb +140 -0
  112. data/examples/robot_groups/multi_process.rb +286 -0
  113. data/examples/robot_groups/robot_worker.rb +136 -0
  114. data/examples/robot_groups/same_process.rb +229 -0
  115. data/examples/sinatra_app/Gemfile +1 -0
  116. data/examples/sinatra_app/Gemfile.lock +166 -0
  117. data/examples/sinatra_app/app.rb +219 -24
  118. data/examples/timeframe_demo.rb +276 -0
  119. data/lib/htm/active_record_config.rb +10 -3
  120. data/lib/htm/circuit_breaker.rb +202 -0
  121. data/lib/htm/configuration.rb +313 -80
  122. data/lib/htm/database.rb +67 -36
  123. data/lib/htm/embedding_service.rb +39 -2
  124. data/lib/htm/errors.rb +131 -11
  125. data/lib/htm/{sinatra.rb → integrations/sinatra.rb} +87 -12
  126. data/lib/htm/job_adapter.rb +10 -3
  127. data/lib/htm/jobs/generate_embedding_job.rb +5 -4
  128. data/lib/htm/jobs/generate_tags_job.rb +4 -0
  129. data/lib/htm/loaders/markdown_loader.rb +263 -0
  130. data/lib/htm/loaders/paragraph_chunker.rb +112 -0
  131. data/lib/htm/long_term_memory.rb +601 -321
  132. data/lib/htm/models/file_source.rb +99 -0
  133. data/lib/htm/models/node.rb +116 -12
  134. data/lib/htm/models/robot.rb +53 -4
  135. data/lib/htm/models/robot_node.rb +51 -0
  136. data/lib/htm/models/tag.rb +302 -0
  137. data/lib/htm/observability.rb +395 -0
  138. data/lib/htm/tag_service.rb +60 -3
  139. data/lib/htm/tasks.rb +29 -0
  140. data/lib/htm/timeframe.rb +194 -0
  141. data/lib/htm/timeframe_extractor.rb +307 -0
  142. data/lib/htm/version.rb +1 -1
  143. data/lib/htm/working_memory.rb +165 -70
  144. data/lib/htm.rb +352 -133
  145. data/lib/tasks/doc.rake +300 -0
  146. data/lib/tasks/files.rake +299 -0
  147. data/lib/tasks/htm.rake +188 -2
  148. data/lib/tasks/jobs.rake +10 -12
  149. data/lib/tasks/tags.rake +194 -0
  150. data/mkdocs.yml +91 -9
  151. data/notes/ARCHITECTURE_REVIEW.md +1167 -0
  152. data/notes/IMPLEMENTATION_SUMMARY.md +606 -0
  153. data/notes/MULTI_FRAMEWORK_IMPLEMENTATION.md +451 -0
  154. data/notes/next_steps.md +100 -0
  155. data/notes/plan.md +627 -0
  156. data/notes/tag_ontology_enhancement_ideas.md +222 -0
  157. data/notes/timescaledb_removal_summary.md +200 -0
  158. metadata +177 -37
  159. data/db/migrate/20250101000002_create_robots.rb +0 -14
  160. data/db/migrate/20250101000003_create_nodes.rb +0 -42
  161. data/db/migrate/20250101000005_create_tags.rb +0 -38
  162. data/db/migrate/20250101000007_add_node_vector_indexes.rb +0 -30
  163. data/dbdoc/public.node_tags.svg +0 -112
  164. data/dbdoc/public.nodes.svg +0 -118
  165. data/dbdoc/public.robots.svg +0 -90
  166. data/dbdoc/public.tags.svg +0 -60
  167. data/dbdoc/schema.svg +0 -154
  168. data/{dbdoc → docs/database}/public.node_stats.md +0 -0
  169. data/{dbdoc → docs/database}/public.node_stats.svg +0 -0
  170. data/{dbdoc → docs/database}/public.nodes_tags.md +0 -0
  171. data/{dbdoc → docs/database}/public.nodes_tags.svg +0 -0
  172. data/{dbdoc → docs/database}/public.ontology_structure.md +0 -0
  173. data/{dbdoc → docs/database}/public.ontology_structure.svg +0 -0
  174. data/{dbdoc → docs/database}/public.operations_log.md +0 -0
  175. data/{dbdoc → docs/database}/public.operations_log.svg +0 -0
  176. data/{dbdoc → docs/database}/public.relationships.md +0 -0
  177. data/{dbdoc → docs/database}/public.relationships.svg +0 -0
  178. data/{dbdoc → docs/database}/public.robot_activity.md +0 -0
  179. data/{dbdoc → docs/database}/public.robot_activity.svg +0 -0
  180. data/{dbdoc → docs/database}/public.schema_migrations.md +0 -0
  181. data/{dbdoc → docs/database}/public.schema_migrations.svg +0 -0
  182. data/{dbdoc → docs/database}/public.tags.md +3 -3
  183. /data/{dbdoc → docs/database}/public.topic_relationships.md +0 -0
  184. /data/{dbdoc → docs/database}/public.topic_relationships.svg +0 -0
@@ -0,0 +1,222 @@
1
+ # Tag Ontology Enhancement Ideas
2
+
3
+ ## Problem Statement
4
+
5
+ HTM builds a dynamic hierarchical tag ontology but doesn't fully leverage it for retrieval. The tag extraction is sophisticated (LLM-based, ontology-consistent, hierarchical), but the retrieval capabilities are limited.
6
+
7
+ ## Current State Analysis
8
+
9
+ ### What's Working Well
10
+ - Sophisticated LLM-based tag extraction with ontology consistency
11
+ - Hierarchical format (`database:postgresql:indexes`)
12
+ - Beautiful visualization (tree, Mermaid, SVG)
13
+ - Tag relationship analysis (co-occurrence)
14
+ - Async generation via `GenerateTagsJob`
15
+
16
+ ### What's Missing
17
+ 1. **`search_by_tags()` and `nodes_by_topic()` exist in LongTermMemory but aren't exposed in the public HTM API**
18
+ 2. `recall()` accepts `query_tags:` parameter but **ignores it** except for relevance scoring
19
+ 3. No hierarchical traversal (parent/child/ancestor queries)
20
+ 4. No tag-only retrieval (without text query)
21
+ 5. No query expansion using tag relationships
22
+ 6. No faceted navigation
23
+ 7. No tag-based result grouping
24
+
25
+ ---
26
+
27
+ ## Proposed Enhancements
28
+
29
+ ### 1. Expose Tag-Based Retrieval in HTM API
30
+
31
+ **Priority: High** - These methods already exist, just need to be exposed.
32
+
33
+ ```ruby
34
+ # Browse by topic path (hierarchical navigation)
35
+ htm.browse("database:postgresql") # All nodes under this branch
36
+
37
+ # Filter recall with tags
38
+ htm.recall("query", tags: ["database:postgresql"], match_all: false)
39
+
40
+ # Tag-only retrieval (no text query required)
41
+ htm.by_tags(["database:postgresql", "ai:embeddings"])
42
+ ```
43
+
44
+ **Implementation:**
45
+ - Add `browse(topic_path, exact: false, limit: 20)` to HTM class
46
+ - Add `by_tags(tags, match_all: false, limit: 20)` to HTM class
47
+ - Wire `query_tags:` parameter through to actual filtering in `recall()`
48
+
49
+ ---
50
+
51
+ ### 2. Hierarchical Query Expansion
52
+
53
+ **Priority: High** - Leverages the hierarchical structure.
54
+
55
+ ```ruby
56
+ # Searching "database:postgresql" should optionally include children:
57
+ # database:postgresql:indexes
58
+ # database:postgresql:extensions
59
+ # database:postgresql:partitioning
60
+
61
+ htm.recall("indexes", tags: ["database:postgresql"], expand_children: true)
62
+
63
+ # Or expand upward to include parent context
64
+ htm.recall("specific query", tags: ["database:postgresql:indexes"], expand_ancestors: true)
65
+ ```
66
+
67
+ **Implementation:**
68
+ - Add `expand_children:` and `expand_ancestors:` options
69
+ - Query `tags.name LIKE 'database:postgresql:%'` for children
70
+ - Parse tag path and query ancestors for upward expansion
71
+
72
+ ---
73
+
74
+ ### 3. Faceted Search / Tag Aggregation
75
+
76
+ **Priority: Medium** - Enables discovery and navigation.
77
+
78
+ ```ruby
79
+ # "What topics are represented in my search results?"
80
+ results = htm.recall("machine learning")
81
+ facets = results.facet_by_tags
82
+ # => { "ai:ml" => 15, "ai:llm" => 8, "database:vector" => 5 }
83
+
84
+ # Or as a standalone method
85
+ htm.tag_facets(query: "machine learning", limit: 10)
86
+ ```
87
+
88
+ **Implementation:**
89
+ - Return tag counts grouped by topic
90
+ - Weight by specificity (deeper tags = more specific)
91
+ - Consider returning hierarchical facet structure
92
+
93
+ ---
94
+
95
+ ### 4. Semantic Tag Matching in Recall
96
+
97
+ **Priority: Medium** - Auto-extract tags from query.
98
+
99
+ ```ruby
100
+ # Auto-extract tags from query and use them to boost results
101
+ htm.recall("PostgreSQL vector search", auto_tag: true)
102
+ # Internally: extracts ["database:postgresql", "database:vector-search"]
103
+ # and uses these to boost relevant results
104
+ ```
105
+
106
+ **Implementation:**
107
+ - Use `find_query_matching_tags()` (already exists in LongTermMemory)
108
+ - Boost results that match extracted tags
109
+ - Make this opt-in or opt-out via configuration
110
+
111
+ ---
112
+
113
+ ### 5. Tag-Based Context Assembly
114
+
115
+ **Priority: Medium** - Topic-focused context building.
116
+
117
+ ```ruby
118
+ # Assemble context prioritizing specific topic branches
119
+ htm.assemble_context(
120
+ token_budget: 4000,
121
+ focus_topics: ["database:postgresql", "ai:embeddings"],
122
+ strategy: :topic_balanced # New strategy
123
+ )
124
+ ```
125
+
126
+ **Implementation:**
127
+ - Add `:topic_balanced` strategy to WorkingMemory
128
+ - Weight nodes by tag overlap with focus topics
129
+ - Ensure diverse topic coverage within budget
130
+
131
+ ---
132
+
133
+ ### 6. Ontology-Aware Related Memories
134
+
135
+ **Priority: Low** - Nice-to-have for exploration.
136
+
137
+ ```ruby
138
+ # Find related memories via shared tags (not just vector similarity)
139
+ htm.related_by_topic(node_id)
140
+ # Returns nodes sharing the most tags, weighted by specificity
141
+
142
+ # Compare to existing vector-based similarity
143
+ htm.similar(node_id) # Vector similarity
144
+ htm.related_by_topic(node_id) # Tag-based similarity
145
+ ```
146
+
147
+ **Implementation:**
148
+ - Count shared tags between nodes
149
+ - Weight by tag depth (more specific = higher weight)
150
+ - Combine with vector similarity for hybrid relatedness
151
+
152
+ ---
153
+
154
+ ### 7. Tag Model Enhancements
155
+
156
+ **Priority: Medium** - Better hierarchy navigation.
157
+
158
+ ```ruby
159
+ # Add to HTM::Models::Tag
160
+ tag.parent # Parent tag (e.g., "database:postgresql" -> "database")
161
+ tag.children # Child tags (e.g., "database" -> ["database:postgresql", "database:mysql"])
162
+ tag.siblings # Same-level tags under same parent
163
+ tag.ancestors # All ancestors up to root
164
+ tag.descendants # All descendants (recursive)
165
+
166
+ # Class methods
167
+ Tag.roots # All root-level tags
168
+ Tag.at_depth(2) # All tags at specific depth
169
+ Tag.under("database") # All tags in this branch
170
+ ```
171
+
172
+ **Implementation:**
173
+ - Parse colon-separated paths
174
+ - Use SQL LIKE queries for efficient hierarchy traversal
175
+ - Consider materialized path or nested set for performance at scale
176
+
177
+ ---
178
+
179
+ ### 8. Tag-Based Grouping in Results
180
+
181
+ **Priority: Low** - Organizational feature.
182
+
183
+ ```ruby
184
+ # Group results by their primary tag
185
+ results = htm.recall("query", group_by_tag: true)
186
+ # => {
187
+ # "database:postgresql" => [node1, node2],
188
+ # "ai:embeddings" => [node3, node4],
189
+ # "uncategorized" => [node5]
190
+ # }
191
+ ```
192
+
193
+ ---
194
+
195
+ ## Implementation Priority
196
+
197
+ ### Phase 1 (High Value, Low Effort)
198
+ 1. Expose existing `search_by_tags()` and `nodes_by_topic()` in HTM API
199
+ 2. Wire `query_tags:` parameter through `recall()` for actual filtering
200
+
201
+ ### Phase 2 (High Value, Medium Effort)
202
+ 3. Add hierarchical query expansion (`expand_children:`, `expand_ancestors:`)
203
+ 4. Add Tag model hierarchy methods (parent, children, ancestors, descendants)
204
+
205
+ ### Phase 3 (Medium Value, Medium Effort)
206
+ 5. Faceted search / tag aggregation
207
+ 6. Semantic tag matching in recall (auto-extract from query)
208
+ 7. Tag-based context assembly strategy
209
+
210
+ ### Phase 4 (Nice to Have)
211
+ 8. Ontology-aware related memories
212
+ 9. Tag-based result grouping
213
+
214
+ ---
215
+
216
+ ## Notes
217
+
218
+ - All enhancements should maintain backward compatibility
219
+ - Consider adding configuration options for default behaviors
220
+ - Tag operations should be efficient (indexed queries)
221
+ - Consider caching popular tag queries
222
+ - Document new methods with YARD comments
@@ -0,0 +1,200 @@
1
+ # TimescaleDB Removal Summary
2
+
3
+ **Date:** 2025-10-28
4
+ **Decision:** Remove TimescaleDB extension from HTM gem as it does not add sufficient value
5
+
6
+ ## Overview
7
+
8
+ TimescaleDB was originally included in the HTM gem for time-series optimization capabilities. However, analysis revealed that:
9
+
10
+ 1. **No hypertables were actually created** - The `setup_hypertables` method in `lib/htm/database.rb` was essentially a no-op with a comment stating "All tables use simple PRIMARY KEY (id), no hypertable conversions"
11
+ 2. **Time-range queries use standard indexed columns** - The `created_at` column on `nodes` and `timestamp` column on `operations_log` are indexed using standard PostgreSQL B-tree indexes
12
+ 3. **No compression policies were used** - Despite documentation mentioning compression, no actual compression was implemented
13
+ 4. **Additional dependency overhead** - Required users to have TimescaleDB available even though it provided no actual benefit
14
+
15
+ ## Code Files Modified
16
+
17
+ The following code files were modified to remove TimescaleDB:
18
+
19
+ ### 1. `lib/htm/active_record_config.rb`
20
+ **Lines modified:** 71-74
21
+
22
+ **Changes:**
23
+ - Removed `'timescaledb' => 'TimescaleDB extension'` from the `required_extensions` hash in `verify_extensions!` method
24
+
25
+ **Before:**
26
+ ```ruby
27
+ required_extensions = {
28
+ 'timescaledb' => 'TimescaleDB extension',
29
+ 'vector' => 'pgvector extension',
30
+ 'pg_trgm' => 'PostgreSQL trigram extension'
31
+ }
32
+ ```
33
+
34
+ **After:**
35
+ ```ruby
36
+ required_extensions = {
37
+ 'vector' => 'pgvector extension',
38
+ 'pg_trgm' => 'PostgreSQL trigram extension'
39
+ }
40
+ ```
41
+
42
+ ### 2. `lib/htm/database.rb`
43
+ **Multiple sections modified**
44
+
45
+ **Changes:**
46
+ - **Line 9:** Updated class documentation comment from "Handles schema creation and TimescaleDB hypertable setup" to "Handles schema creation and database initialization"
47
+ - **Lines 31-39:** Removed entire hypertable conversion block that called `setup_hypertables(conn)`
48
+ - **Lines 342-347:** Removed TimescaleDB version check from `verify_extensions` method
49
+ - **Lines 432-437:** Removed entire `setup_hypertables` method definition
50
+
51
+ **Impact:** The Database class now only handles standard PostgreSQL schema setup without any TimescaleDB-specific code.
52
+
53
+ ### 3. `db/README.md`
54
+ **Lines modified:** 29, 127
55
+
56
+ **Changes:**
57
+ - **Line 29:** Changed "Vector similarity search (pgvector on TimescaleDB Cloud)" to "Vector similarity search (pgvector)"
58
+ - **Line 127:** Removed "**TimescaleDB** extension (optional, for hypertables)" from Database Requirements section
59
+
60
+ ### 4. `lib/tasks/htm.rake`
61
+ **Lines modified:** 67-73
62
+
63
+ **Changes:**
64
+ - Removed TimescaleDB version check from the `htm:db:test` rake task
65
+
66
+ **Before:**
67
+ ```ruby
68
+ # Check TimescaleDB
69
+ timescale = conn.exec("SELECT extversion FROM pg_extension WHERE extname='timescaledb'").first
70
+ if timescale
71
+ puts " ✓ TimescaleDB version: #{timescale['extversion']}"
72
+ else
73
+ puts " ⚠ Warning: TimescaleDB extension not found"
74
+ end
75
+
76
+ # Check pgvector
77
+ ```
78
+
79
+ **After:**
80
+ ```ruby
81
+ # Check pgvector
82
+ ```
83
+
84
+ ## Other Potentially Impacted Files
85
+
86
+ A codebase-wide search revealed **114 total files** containing references to "TimescaleDB", "timescaledb", or "hypertable". These fall into the following categories:
87
+
88
+ ### Documentation Files
89
+ - `README.md` - Main project documentation
90
+ - `CLAUDE.md` - AI assistant context documentation
91
+ - `.architecture/` directory - Architecture Decision Records (ADRs) and reviews
92
+ - `dbdoc/` directory - Auto-generated database documentation (120+ files)
93
+
94
+ ### Test Files
95
+ - `test/` directory - Unit and integration tests may reference TimescaleDB in comments or mock data
96
+
97
+ ### Example Files
98
+ - `examples/` directory - Example code may mention TimescaleDB in documentation
99
+
100
+ ### Migration Files
101
+ - `db/migrate/` directory - Migration files may have comments referencing TimescaleDB optimization
102
+
103
+ ## Recommended Follow-up Actions
104
+
105
+ ### High Priority
106
+ 1. **Update README.md** - Remove TimescaleDB from installation instructions and feature descriptions
107
+ 2. **Update CLAUDE.md** - Remove TimescaleDB references from project overview and architecture descriptions
108
+ 3. **Review ADRs** - Update or create new ADR documenting the decision to remove TimescaleDB
109
+
110
+ ### Medium Priority
111
+ 4. **Update test files** - Remove TimescaleDB references from test comments and documentation
112
+ 5. **Update example code** - Remove TimescaleDB mentions from example documentation
113
+ 6. **Regenerate dbdoc/** - Run `tbls` again to regenerate database documentation without TimescaleDB references
114
+
115
+ ### Low Priority
116
+ 7. **Update migration comments** - Clean up any comments in migration files that reference TimescaleDB optimization
117
+ 8. **Review dependencies** - Verify that `Gemfile` or gemspec doesn't list TimescaleDB as a requirement (not found in initial search)
118
+
119
+ ## Benefits of Removal
120
+
121
+ 1. **Simplified deployment** - Users no longer need TimescaleDB-enabled PostgreSQL instances
122
+ 2. **Reduced complexity** - One less extension to manage and verify
123
+ 3. **Broader compatibility** - Works with any PostgreSQL 12+ installation (not just TimescaleDB Cloud or self-hosted TimescaleDB)
124
+ 4. **Clearer documentation** - Removes confusion about TimescaleDB's role (since it wasn't actually used)
125
+ 5. **Honest architecture** - Codebase now accurately reflects what it actually uses
126
+
127
+ ## No Loss of Functionality
128
+
129
+ Removing TimescaleDB results in **zero loss of functionality** because:
130
+
131
+ - No hypertables were created
132
+ - No compression policies were used
133
+ - Time-range queries already use standard B-tree indexes
134
+ - All existing queries continue to work identically
135
+ - Performance characteristics remain unchanged
136
+
137
+ ## Database Requirements After Removal
138
+
139
+ The HTM gem now requires:
140
+
141
+ - **PostgreSQL** 12+
142
+ - **vector** extension (pgvector) - for embedding similarity search
143
+ - **pg_trgm** extension - for fuzzy text matching
144
+
145
+ No TimescaleDB required.
146
+
147
+ ## Testing Verification
148
+
149
+ After these changes, verify:
150
+
151
+ 1. **Database setup works:**
152
+ ```bash
153
+ rake htm:db:setup
154
+ ```
155
+
156
+ 2. **Database connection test works:**
157
+ ```bash
158
+ rake htm:db:test
159
+ ```
160
+
161
+ 3. **All tests pass:**
162
+ ```bash
163
+ rake test
164
+ ```
165
+
166
+ 4. **Example code runs:**
167
+ ```bash
168
+ rake example
169
+ ```
170
+
171
+ ## Git Commit Message Suggestion
172
+
173
+ ```
174
+ refactor!: remove TimescaleDB extension dependency
175
+
176
+ BREAKING CHANGE: TimescaleDB is no longer required or checked for.
177
+
178
+ TimescaleDB was originally included for time-series optimization
179
+ but was never actually used (no hypertables were created, no
180
+ compression policies configured). Time-range queries use standard
181
+ PostgreSQL B-tree indexes on timestamp columns.
182
+
183
+ This change:
184
+ - Removes TimescaleDB from required extensions check
185
+ - Removes verify_extensions and setup_hypertables methods
186
+ - Updates documentation to reflect PostgreSQL-only requirements
187
+ - Simplifies deployment by removing unnecessary dependency
188
+
189
+ No functionality is lost as TimescaleDB features were not being used.
190
+
191
+ Modified files:
192
+ - lib/htm/active_record_config.rb
193
+ - lib/htm/database.rb
194
+ - db/README.md
195
+ - lib/tasks/htm.rake
196
+ ```
197
+
198
+ ## Conclusion
199
+
200
+ The removal of TimescaleDB from the HTM gem is a **low-risk refactoring** that simplifies the architecture and deployment requirements without any loss of functionality. All code changes have been completed in the core library files, with follow-up documentation updates recommended.