htm 0.0.11 → 0.0.14
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/.dictate.toml +46 -0
- data/.envrc +2 -0
- data/CHANGELOG.md +52 -2
- data/README.md +79 -0
- data/Rakefile +14 -2
- data/bin/htm_mcp.rb +94 -0
- data/config/database.yml +20 -13
- data/db/migrate/00010_add_soft_delete_to_associations.rb +29 -0
- data/db/migrate/00011_add_performance_indexes.rb +21 -0
- data/db/migrate/00012_add_tags_trigram_index.rb +18 -0
- data/db/migrate/00013_enable_lz4_compression.rb +43 -0
- data/db/schema.sql +49 -92
- data/docs/api/index.md +1 -1
- data/docs/api/yard/HTM.md +2 -4
- data/docs/architecture/index.md +1 -1
- data/docs/development/index.md +1 -1
- data/docs/getting-started/index.md +1 -1
- data/docs/guides/index.md +1 -1
- data/docs/images/telemetry-architecture.svg +153 -0
- data/docs/telemetry.md +391 -0
- data/examples/README.md +46 -1
- data/examples/cli_app/README.md +1 -1
- data/examples/cli_app/htm_cli.rb +1 -1
- data/examples/sinatra_app/app.rb +1 -1
- data/examples/telemetry/README.md +147 -0
- data/examples/telemetry/SETUP_README.md +169 -0
- data/examples/telemetry/demo.rb +498 -0
- data/examples/telemetry/grafana/dashboards/htm-metrics.json +457 -0
- data/lib/htm/configuration.rb +261 -70
- data/lib/htm/database.rb +46 -22
- data/lib/htm/embedding_service.rb +24 -14
- data/lib/htm/errors.rb +15 -1
- data/lib/htm/jobs/generate_embedding_job.rb +19 -0
- data/lib/htm/jobs/generate_propositions_job.rb +103 -0
- data/lib/htm/jobs/generate_tags_job.rb +24 -0
- data/lib/htm/loaders/markdown_chunker.rb +79 -0
- data/lib/htm/loaders/markdown_loader.rb +41 -15
- data/lib/htm/long_term_memory/fulltext_search.rb +138 -0
- data/lib/htm/long_term_memory/hybrid_search.rb +324 -0
- data/lib/htm/long_term_memory/node_operations.rb +209 -0
- data/lib/htm/long_term_memory/relevance_scorer.rb +355 -0
- data/lib/htm/long_term_memory/robot_operations.rb +34 -0
- data/lib/htm/long_term_memory/tag_operations.rb +428 -0
- data/lib/htm/long_term_memory/vector_search.rb +109 -0
- data/lib/htm/long_term_memory.rb +51 -1153
- data/lib/htm/models/node.rb +35 -2
- data/lib/htm/models/node_tag.rb +31 -0
- data/lib/htm/models/robot_node.rb +31 -0
- data/lib/htm/models/tag.rb +44 -0
- data/lib/htm/proposition_service.rb +169 -0
- data/lib/htm/query_cache.rb +214 -0
- data/lib/htm/sql_builder.rb +178 -0
- data/lib/htm/tag_service.rb +16 -6
- data/lib/htm/tasks.rb +8 -2
- data/lib/htm/telemetry.rb +224 -0
- data/lib/htm/version.rb +1 -1
- data/lib/htm.rb +64 -3
- data/lib/tasks/doc.rake +1 -1
- data/lib/tasks/htm.rake +259 -13
- data/mkdocs.yml +96 -96
- metadata +42 -16
- data/.aigcm_msg +0 -1
- data/.claude/settings.local.json +0 -95
- data/CLAUDE.md +0 -603
- data/examples/cli_app/temp.log +0 -93
- data/lib/htm/loaders/paragraph_chunker.rb +0 -112
- data/notes/ARCHITECTURE_REVIEW.md +0 -1167
- data/notes/IMPLEMENTATION_SUMMARY.md +0 -606
- data/notes/MULTI_FRAMEWORK_IMPLEMENTATION.md +0 -451
- data/notes/next_steps.md +0 -100
- data/notes/plan.md +0 -627
- data/notes/tag_ontology_enhancement_ideas.md +0 -222
- data/notes/timescaledb_removal_summary.md +0 -200
data/lib/tasks/htm.rake
CHANGED
|
@@ -68,21 +68,28 @@ namespace :htm do
|
|
|
68
68
|
end
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
-
desc "
|
|
72
|
-
task :
|
|
71
|
+
desc "Verify database connection (respects RAILS_ENV)"
|
|
72
|
+
task :verify do
|
|
73
73
|
require 'htm'
|
|
74
|
-
config = HTM::Database.default_config
|
|
75
|
-
raise "Database not configured. Set HTM_DBURL environment variable." unless config
|
|
76
74
|
|
|
77
|
-
|
|
75
|
+
env = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
|
|
76
|
+
config = HTM::ActiveRecordConfig.load_database_config
|
|
77
|
+
|
|
78
|
+
puts "Verifying HTM database connection (#{env})..."
|
|
78
79
|
puts " Host: #{config[:host]}"
|
|
79
80
|
puts " Port: #{config[:port]}"
|
|
80
|
-
puts " Database: #{config[:
|
|
81
|
-
puts " User: #{config[:
|
|
81
|
+
puts " Database: #{config[:database]}"
|
|
82
|
+
puts " User: #{config[:username]}"
|
|
82
83
|
|
|
83
84
|
begin
|
|
84
85
|
require 'pg'
|
|
85
|
-
conn = PG.connect(
|
|
86
|
+
conn = PG.connect(
|
|
87
|
+
host: config[:host],
|
|
88
|
+
port: config[:port],
|
|
89
|
+
dbname: config[:database],
|
|
90
|
+
user: config[:username],
|
|
91
|
+
password: config[:password]
|
|
92
|
+
)
|
|
86
93
|
|
|
87
94
|
# Check pgvector
|
|
88
95
|
pgvector = conn.exec("SELECT extversion FROM pg_extension WHERE extname='vector'").first
|
|
@@ -100,16 +107,18 @@ namespace :htm do
|
|
|
100
107
|
end
|
|
101
108
|
end
|
|
102
109
|
|
|
103
|
-
desc "Open PostgreSQL console"
|
|
110
|
+
desc "Open PostgreSQL console (respects RAILS_ENV)"
|
|
104
111
|
task :console do
|
|
105
112
|
require 'htm'
|
|
106
|
-
config = HTM::Database.default_config
|
|
107
|
-
raise "Database not configured. Set HTM_DBURL environment variable." unless config
|
|
108
113
|
|
|
114
|
+
env = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
|
|
115
|
+
config = HTM::ActiveRecordConfig.load_database_config
|
|
116
|
+
|
|
117
|
+
puts "Connecting to #{config[:database]} (#{env})..."
|
|
109
118
|
exec "psql", "-h", config[:host],
|
|
110
119
|
"-p", config[:port].to_s,
|
|
111
|
-
"-U", config[:
|
|
112
|
-
"-d", config[:
|
|
120
|
+
"-U", config[:username],
|
|
121
|
+
"-d", config[:database]
|
|
113
122
|
end
|
|
114
123
|
|
|
115
124
|
desc "Seed database with sample data"
|
|
@@ -277,6 +286,120 @@ namespace :htm do
|
|
|
277
286
|
puts " Errors: #{errors}"
|
|
278
287
|
puts " Nodes with embeddings: #{final_with_embeddings}"
|
|
279
288
|
end
|
|
289
|
+
|
|
290
|
+
desc "Rebuild propositions for all non-proposition nodes. Extracts atomic facts and creates new nodes."
|
|
291
|
+
task :propositions do
|
|
292
|
+
require 'htm'
|
|
293
|
+
require 'ruby-progressbar'
|
|
294
|
+
|
|
295
|
+
# Ensure database connection
|
|
296
|
+
HTM::ActiveRecordConfig.establish_connection!
|
|
297
|
+
|
|
298
|
+
# Find all non-proposition nodes (nodes that haven't been extracted from)
|
|
299
|
+
source_nodes = HTM::Models::Node.non_propositions
|
|
300
|
+
source_count = source_nodes.count
|
|
301
|
+
|
|
302
|
+
# Count existing proposition nodes
|
|
303
|
+
existing_propositions = HTM::Models::Node.propositions.count
|
|
304
|
+
|
|
305
|
+
puts "\nHTM Propositions Rebuild"
|
|
306
|
+
puts "=" * 50
|
|
307
|
+
puts "Current state:"
|
|
308
|
+
puts " Source nodes (non-propositions): #{source_count}"
|
|
309
|
+
puts " Existing proposition nodes: #{existing_propositions}"
|
|
310
|
+
puts "\nThis will extract propositions from ALL #{source_count} source nodes."
|
|
311
|
+
puts "Existing proposition nodes will be deleted and regenerated."
|
|
312
|
+
puts "This operation may take a long time depending on your LLM provider."
|
|
313
|
+
print "\nType 'yes' to confirm: "
|
|
314
|
+
|
|
315
|
+
confirmation = $stdin.gets&.strip
|
|
316
|
+
unless confirmation == 'yes'
|
|
317
|
+
puts "Aborted."
|
|
318
|
+
next
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
# Delete existing proposition nodes
|
|
322
|
+
if existing_propositions > 0
|
|
323
|
+
puts "\nDeleting #{existing_propositions} existing proposition nodes..."
|
|
324
|
+
deleted = HTM::Models::Node.propositions.delete_all
|
|
325
|
+
puts " Deleted #{deleted} proposition nodes"
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
puts "\nExtracting propositions from #{source_count} nodes..."
|
|
329
|
+
puts "(This may take a while depending on your LLM provider)\n"
|
|
330
|
+
|
|
331
|
+
# Get a robot ID for linking proposition nodes
|
|
332
|
+
# Use the first robot or create a system robot
|
|
333
|
+
robot = HTM::Models::Robot.first || HTM::Models::Robot.create!(name: 'proposition_rebuilder')
|
|
334
|
+
|
|
335
|
+
# Create progress bar with ETA
|
|
336
|
+
progressbar = ProgressBar.create(
|
|
337
|
+
total: source_count,
|
|
338
|
+
format: '%t: |%B| %c/%C (%p%%) %e',
|
|
339
|
+
title: 'Extracting',
|
|
340
|
+
output: $stdout,
|
|
341
|
+
smoothing: 0.5
|
|
342
|
+
)
|
|
343
|
+
|
|
344
|
+
# Track stats
|
|
345
|
+
errors = 0
|
|
346
|
+
nodes_processed = 0
|
|
347
|
+
propositions_created = 0
|
|
348
|
+
|
|
349
|
+
source_nodes.find_each do |node|
|
|
350
|
+
begin
|
|
351
|
+
# Extract propositions
|
|
352
|
+
propositions = HTM::PropositionService.extract(node.content)
|
|
353
|
+
|
|
354
|
+
if propositions.any?
|
|
355
|
+
propositions.each do |proposition_text|
|
|
356
|
+
token_count = HTM.count_tokens(proposition_text)
|
|
357
|
+
|
|
358
|
+
# Create proposition node
|
|
359
|
+
prop_node = HTM::Models::Node.create!(
|
|
360
|
+
content: proposition_text,
|
|
361
|
+
token_count: token_count,
|
|
362
|
+
metadata: { is_proposition: true, source_node_id: node.id }
|
|
363
|
+
)
|
|
364
|
+
|
|
365
|
+
# Link to robot
|
|
366
|
+
HTM::Models::RobotNode.find_or_create_by!(
|
|
367
|
+
robot_id: robot.id,
|
|
368
|
+
node_id: prop_node.id
|
|
369
|
+
)
|
|
370
|
+
|
|
371
|
+
# Generate embedding for proposition node
|
|
372
|
+
begin
|
|
373
|
+
result = HTM::EmbeddingService.generate(proposition_text)
|
|
374
|
+
prop_node.update!(embedding: result[:storage_embedding])
|
|
375
|
+
rescue StandardError => e
|
|
376
|
+
progressbar.log " Warning: Embedding failed for proposition: #{e.message}"
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
propositions_created += 1
|
|
380
|
+
end
|
|
381
|
+
end
|
|
382
|
+
|
|
383
|
+
nodes_processed += 1
|
|
384
|
+
rescue StandardError => e
|
|
385
|
+
errors += 1
|
|
386
|
+
progressbar.log " Error on node #{node.id}: #{e.message}"
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
progressbar.increment
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
progressbar.finish
|
|
393
|
+
|
|
394
|
+
# Final stats
|
|
395
|
+
final_proposition_count = HTM::Models::Node.propositions.count
|
|
396
|
+
|
|
397
|
+
puts "\nRebuild complete!"
|
|
398
|
+
puts " Source nodes processed: #{nodes_processed}"
|
|
399
|
+
puts " Propositions created: #{propositions_created}"
|
|
400
|
+
puts " Errors: #{errors}"
|
|
401
|
+
puts " Total proposition nodes: #{final_proposition_count}"
|
|
402
|
+
end
|
|
280
403
|
end
|
|
281
404
|
|
|
282
405
|
namespace :schema do
|
|
@@ -293,6 +416,129 @@ namespace :htm do
|
|
|
293
416
|
end
|
|
294
417
|
end
|
|
295
418
|
|
|
419
|
+
desc "Create database if it doesn't exist (respects RAILS_ENV)"
|
|
420
|
+
task :create do
|
|
421
|
+
require 'htm'
|
|
422
|
+
|
|
423
|
+
env = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
|
|
424
|
+
config = HTM::ActiveRecordConfig.load_database_config
|
|
425
|
+
db_name = config[:database]
|
|
426
|
+
|
|
427
|
+
puts "Creating database: #{db_name} (#{env})"
|
|
428
|
+
|
|
429
|
+
admin_config = config.dup
|
|
430
|
+
admin_config[:database] = 'postgres'
|
|
431
|
+
|
|
432
|
+
begin
|
|
433
|
+
require 'pg'
|
|
434
|
+
admin_conn = PG.connect(
|
|
435
|
+
host: admin_config[:host],
|
|
436
|
+
port: admin_config[:port],
|
|
437
|
+
dbname: admin_config[:database],
|
|
438
|
+
user: admin_config[:username],
|
|
439
|
+
password: admin_config[:password]
|
|
440
|
+
)
|
|
441
|
+
|
|
442
|
+
result = admin_conn.exec_params(
|
|
443
|
+
"SELECT 1 FROM pg_database WHERE datname = $1",
|
|
444
|
+
[db_name]
|
|
445
|
+
)
|
|
446
|
+
|
|
447
|
+
if result.ntuples == 0
|
|
448
|
+
admin_conn.exec("CREATE DATABASE #{PG::Connection.quote_ident(db_name)}")
|
|
449
|
+
puts "✓ Database created: #{db_name}"
|
|
450
|
+
|
|
451
|
+
# Connect to new database and enable extensions
|
|
452
|
+
db_conn = PG.connect(
|
|
453
|
+
host: config[:host],
|
|
454
|
+
port: config[:port],
|
|
455
|
+
dbname: db_name,
|
|
456
|
+
user: config[:username],
|
|
457
|
+
password: config[:password]
|
|
458
|
+
)
|
|
459
|
+
%w[vector pg_trgm].each do |ext|
|
|
460
|
+
db_conn.exec("CREATE EXTENSION IF NOT EXISTS #{ext}")
|
|
461
|
+
end
|
|
462
|
+
db_conn.close
|
|
463
|
+
puts "✓ Extensions enabled (pgvector, pg_trgm)"
|
|
464
|
+
else
|
|
465
|
+
puts "✓ Database already exists: #{db_name}"
|
|
466
|
+
end
|
|
467
|
+
|
|
468
|
+
admin_conn.close
|
|
469
|
+
rescue PG::Error => e
|
|
470
|
+
puts "✗ Error: #{e.message}"
|
|
471
|
+
exit 1
|
|
472
|
+
end
|
|
473
|
+
end
|
|
474
|
+
|
|
475
|
+
namespace :tags do
|
|
476
|
+
desc "Soft delete orphaned tags and stale node_tags entries"
|
|
477
|
+
task :cleanup do
|
|
478
|
+
require 'htm'
|
|
479
|
+
|
|
480
|
+
# Ensure database connection
|
|
481
|
+
HTM::ActiveRecordConfig.establish_connection!
|
|
482
|
+
|
|
483
|
+
puts "\nHTM Tag Cleanup"
|
|
484
|
+
puts "=" * 50
|
|
485
|
+
|
|
486
|
+
# Step 1: Find active node_tags pointing to soft-deleted or missing nodes
|
|
487
|
+
stale_node_tags = HTM::Models::NodeTag
|
|
488
|
+
.joins("LEFT JOIN nodes ON nodes.id = node_tags.node_id")
|
|
489
|
+
.where("nodes.id IS NULL OR nodes.deleted_at IS NOT NULL")
|
|
490
|
+
|
|
491
|
+
stale_count = stale_node_tags.count
|
|
492
|
+
|
|
493
|
+
# Step 2: Find orphaned tags using the Tag.orphaned scope
|
|
494
|
+
orphaned_tags = HTM::Models::Tag.orphaned
|
|
495
|
+
orphan_count = orphaned_tags.count
|
|
496
|
+
|
|
497
|
+
if stale_count == 0 && orphan_count == 0
|
|
498
|
+
puts "No cleanup needed."
|
|
499
|
+
puts " Stale node_tags entries: 0"
|
|
500
|
+
puts " Orphaned tags: 0"
|
|
501
|
+
next
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
puts "Found:"
|
|
505
|
+
puts " Stale node_tags entries: #{stale_count} (pointing to deleted/missing nodes)"
|
|
506
|
+
puts " Orphaned tags: #{orphan_count} (no active nodes)"
|
|
507
|
+
|
|
508
|
+
if orphan_count > 0
|
|
509
|
+
puts "\nOrphaned tags:"
|
|
510
|
+
orphaned_tags.limit(20).pluck(:name).each do |name|
|
|
511
|
+
puts " - #{name}"
|
|
512
|
+
end
|
|
513
|
+
puts " ... and #{orphan_count - 20} more" if orphan_count > 20
|
|
514
|
+
end
|
|
515
|
+
|
|
516
|
+
print "\nSoft delete these entries? (yes/no): "
|
|
517
|
+
confirmation = $stdin.gets&.strip
|
|
518
|
+
|
|
519
|
+
unless confirmation == 'yes'
|
|
520
|
+
puts "Cancelled."
|
|
521
|
+
next
|
|
522
|
+
end
|
|
523
|
+
|
|
524
|
+
now = Time.current
|
|
525
|
+
|
|
526
|
+
# Soft delete stale node_tags first
|
|
527
|
+
if stale_count > 0
|
|
528
|
+
soft_deleted_node_tags = stale_node_tags.update_all(deleted_at: now)
|
|
529
|
+
puts "\nSoft deleted #{soft_deleted_node_tags} stale node_tags entries."
|
|
530
|
+
end
|
|
531
|
+
|
|
532
|
+
# Then soft delete orphaned tags
|
|
533
|
+
if orphan_count > 0
|
|
534
|
+
soft_deleted_tags = orphaned_tags.update_all(deleted_at: now)
|
|
535
|
+
puts "Soft deleted #{soft_deleted_tags} orphaned tags."
|
|
536
|
+
end
|
|
537
|
+
|
|
538
|
+
puts "\nCleanup complete (soft delete)."
|
|
539
|
+
end
|
|
540
|
+
end
|
|
541
|
+
|
|
296
542
|
end
|
|
297
543
|
|
|
298
544
|
namespace :doc do
|
data/mkdocs.yml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# MkDocs Configuration for HTM Documentation
|
|
2
|
-
site_name: HTM - Hierarchical
|
|
2
|
+
site_name: HTM - Hierarchical Temporal Memory
|
|
3
3
|
site_description: Intelligent memory management for LLM robots with two-tier architecture and RAG-based retrieval
|
|
4
4
|
site_author: Dewayne VanHoozer
|
|
5
5
|
site_url: https://madbomber.github.io/htm
|
|
@@ -172,101 +172,101 @@ nav:
|
|
|
172
172
|
- Installation: getting-started/installation.md
|
|
173
173
|
- Quick Start: getting-started/quick-start.md
|
|
174
174
|
- Architecture:
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
175
|
+
- architecture/index.md
|
|
176
|
+
- Overview: architecture/overview.md
|
|
177
|
+
- Two-Tier Memory: architecture/two-tier-memory.md
|
|
178
|
+
- Hive Mind: architecture/hive-mind.md
|
|
179
|
+
- ADRs:
|
|
180
|
+
- architecture/adrs/index.md
|
|
181
|
+
- ADR-001 PostgreSQL & TimescaleDB: architecture/adrs/001-postgresql-timescaledb.md
|
|
182
|
+
- ADR-002 Two-Tier Memory: architecture/adrs/002-two-tier-memory.md
|
|
183
|
+
- ADR-003 Ollama Embeddings: architecture/adrs/003-ollama-embeddings.md
|
|
184
|
+
- ADR-004 Hive Mind: architecture/adrs/004-hive-mind.md
|
|
185
|
+
- ADR-005 RAG Retrieval: architecture/adrs/005-rag-retrieval.md
|
|
186
|
+
- ADR-006 Context Assembly: architecture/adrs/006-context-assembly.md
|
|
187
|
+
- ADR-007 Eviction Strategy: architecture/adrs/007-eviction-strategy.md
|
|
188
|
+
- ADR-008 Robot Identification: architecture/adrs/008-robot-identification.md
|
|
189
|
+
- ADR-009 Never-Forget Philosophy: architecture/adrs/009-never-forget.md
|
|
190
|
+
- ADR-010 Redis Working Memory (Rejected): architecture/adrs/010-redis-working-memory-rejected.md
|
|
191
|
+
- ADR-011 pgai Integration: architecture/adrs/011-pgai-integration.md
|
|
192
192
|
- Guides:
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
193
|
+
- guides/index.md
|
|
194
|
+
- Getting Started: guides/getting-started.md
|
|
195
|
+
- Adding Memories: guides/adding-memories.md
|
|
196
|
+
- Recalling Memories: guides/recalling-memories.md
|
|
197
|
+
- Working Memory: guides/working-memory.md
|
|
198
|
+
- Long-Term Memory: guides/long-term-memory.md
|
|
199
|
+
- Multi-Robot Usage: guides/multi-robot.md
|
|
200
|
+
- Search Strategies: guides/search-strategies.md
|
|
201
|
+
- Context Assembly: guides/context-assembly.md
|
|
202
202
|
- API Reference:
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
203
|
+
- api/index.md
|
|
204
|
+
- HTM Class: api/htm.md
|
|
205
|
+
- Working Memory: api/working-memory.md
|
|
206
|
+
- Long-Term Memory: api/long-term-memory.md
|
|
207
|
+
- Embedding Service: api/embedding-service.md
|
|
208
|
+
- Database: api/database.md
|
|
209
|
+
- YARD Reference:
|
|
210
|
+
- api/yard-reference.md
|
|
211
|
+
- HTM Module: api/yard/HTM.md
|
|
212
|
+
- Core Classes:
|
|
213
|
+
- Configuration: api/yard/HTM/Configuration.md
|
|
214
|
+
- Database: api/yard/HTM/Database.md
|
|
215
|
+
- LongTermMemory: api/yard/HTM/LongTermMemory.md
|
|
216
|
+
- WorkingMemory: api/yard/HTM/WorkingMemory.md
|
|
217
|
+
- Services:
|
|
218
|
+
- EmbeddingService: api/yard/HTM/EmbeddingService.md
|
|
219
|
+
- TagService: api/yard/HTM/TagService.md
|
|
220
|
+
- JobAdapter: api/yard/HTM/JobAdapter.md
|
|
221
|
+
- Utilities:
|
|
222
|
+
- CircuitBreaker: api/yard/HTM/CircuitBreaker.md
|
|
223
|
+
- Observability: api/yard/HTM/Observability.md
|
|
224
|
+
- Timeframe: api/yard/HTM/Timeframe.md
|
|
225
|
+
- TimeframeExtractor: api/yard/HTM/TimeframeExtractor.md
|
|
226
|
+
- Internal:
|
|
227
|
+
- ActiveRecordConfig: api/yard/HTM/ActiveRecordConfig.md
|
|
228
|
+
- Railtie: api/yard/HTM/Railtie.md
|
|
229
|
+
- Errors:
|
|
230
|
+
- Error: api/yard/HTM/Error.md
|
|
231
|
+
- AuthorizationError: api/yard/HTM/AuthorizationError.md
|
|
232
|
+
- CircuitBreakerOpenError: api/yard/HTM/CircuitBreakerOpenError.md
|
|
233
|
+
- DatabaseError: api/yard/HTM/DatabaseError.md
|
|
234
|
+
- EmbeddingError: api/yard/HTM/EmbeddingError.md
|
|
235
|
+
- NotFoundError: api/yard/HTM/NotFoundError.md
|
|
236
|
+
- QueryTimeoutError: api/yard/HTM/QueryTimeoutError.md
|
|
237
|
+
- ResourceExhaustedError: api/yard/HTM/ResourceExhaustedError.md
|
|
238
|
+
- TagError: api/yard/HTM/TagError.md
|
|
239
|
+
- ValidationError: api/yard/HTM/ValidationError.md
|
|
240
|
+
- Result Types:
|
|
241
|
+
- Timeframe Result: api/yard/HTM/Timeframe/Result.md
|
|
242
|
+
- TimeframeExtractor Result: api/yard/HTM/TimeframeExtractor/Result.md
|
|
243
243
|
- Development:
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
244
|
+
- development/index.md
|
|
245
|
+
- Setup: development/setup.md
|
|
246
|
+
- Testing: development/testing.md
|
|
247
|
+
- Contributing: development/contributing.md
|
|
248
|
+
- Database Schema: development/schema.md
|
|
249
|
+
- Database Tables:
|
|
250
|
+
- database/README.md
|
|
251
|
+
- Core Tables:
|
|
252
|
+
- Robots: database/public.robots.md
|
|
253
|
+
- Nodes: database/public.nodes.md
|
|
254
|
+
- Tags: database/public.tags.md
|
|
255
|
+
- File Sources: database/public.file_sources.md
|
|
256
|
+
- Join Tables:
|
|
257
|
+
- Node Tags: database/public.node_tags.md
|
|
258
|
+
- Nodes Tags (Legacy): database/public.nodes_tags.md
|
|
259
|
+
- Robot Nodes: database/public.robot_nodes.md
|
|
260
|
+
- Views & Stats:
|
|
261
|
+
- Node Stats: database/public.node_stats.md
|
|
262
|
+
- Robot Activity: database/public.robot_activity.md
|
|
263
|
+
- Topic Relationships: database/public.topic_relationships.md
|
|
264
|
+
- Ontology Structure: database/public.ontology_structure.md
|
|
265
|
+
- Relationships: database/public.relationships.md
|
|
266
|
+
- System:
|
|
267
|
+
- Operations Log: database/public.operations_log.md
|
|
268
|
+
- Schema Migrations: database/public.schema_migrations.md
|
|
269
|
+
- Multi-Framework Support: multi_framework_support.md
|
|
270
|
+
- Database Rake Tasks: database_rake_tasks.md
|
|
271
|
+
- Using Rake Tasks: using_rake_tasks_in_your_app.md
|
|
272
|
+
- Setup Local Database: setup_local_database.md
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: htm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.14
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dewayne VanHoozer
|
|
@@ -135,6 +135,20 @@ dependencies:
|
|
|
135
135
|
- - ">="
|
|
136
136
|
- !ruby/object:Gem::Version
|
|
137
137
|
version: '0'
|
|
138
|
+
- !ruby/object:Gem::Dependency
|
|
139
|
+
name: baran
|
|
140
|
+
requirement: !ruby/object:Gem::Requirement
|
|
141
|
+
requirements:
|
|
142
|
+
- - ">="
|
|
143
|
+
- !ruby/object:Gem::Version
|
|
144
|
+
version: '0'
|
|
145
|
+
type: :runtime
|
|
146
|
+
prerelease: false
|
|
147
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
148
|
+
requirements:
|
|
149
|
+
- - ">="
|
|
150
|
+
- !ruby/object:Gem::Version
|
|
151
|
+
version: '0'
|
|
138
152
|
- !ruby/object:Gem::Dependency
|
|
139
153
|
name: rake
|
|
140
154
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -234,9 +248,9 @@ dependencies:
|
|
|
234
248
|
- !ruby/object:Gem::Version
|
|
235
249
|
version: '0'
|
|
236
250
|
description: |
|
|
237
|
-
HTM (Hierarchical
|
|
251
|
+
HTM (Hierarchical Temporal Memory) provides intelligent memory/context management for
|
|
238
252
|
LLM-based applications. It implements a two-tier memory system with
|
|
239
|
-
durable long-term storage (PostgreSQL
|
|
253
|
+
durable long-term storage (PostgreSQL) and token-limited working
|
|
240
254
|
memory, enabling applications to recall context from past conversations using RAG
|
|
241
255
|
(Retrieval-Augmented Generation) techniques.
|
|
242
256
|
email:
|
|
@@ -246,7 +260,6 @@ executables:
|
|
|
246
260
|
extensions: []
|
|
247
261
|
extra_rdoc_files: []
|
|
248
262
|
files:
|
|
249
|
-
- ".aigcm_msg"
|
|
250
263
|
- ".architecture/decisions/adrs/001-use-postgresql-timescaledb-storage.md"
|
|
251
264
|
- ".architecture/decisions/adrs/002-two-tier-memory-architecture.md"
|
|
252
265
|
- ".architecture/decisions/adrs/003-ollama-default-embedding-provider.md"
|
|
@@ -267,12 +280,11 @@ files:
|
|
|
267
280
|
- ".architecture/reviews/2025-10-29-llm-configuration-and-async-processing-review.md"
|
|
268
281
|
- ".architecture/reviews/comprehensive-codebase-review.md"
|
|
269
282
|
- ".architecture/reviews/initial-system-analysis.md"
|
|
270
|
-
- ".
|
|
283
|
+
- ".dictate.toml"
|
|
271
284
|
- ".envrc"
|
|
272
285
|
- ".irbrc"
|
|
273
286
|
- ".tbls.yml"
|
|
274
287
|
- CHANGELOG.md
|
|
275
|
-
- CLAUDE.md
|
|
276
288
|
- COMMITS.md
|
|
277
289
|
- LICENSE
|
|
278
290
|
- README.md
|
|
@@ -288,6 +300,10 @@ files:
|
|
|
288
300
|
- db/migrate/00006_create_node_tags.rb
|
|
289
301
|
- db/migrate/00007_create_robot_nodes.rb
|
|
290
302
|
- db/migrate/00009_add_working_memory_to_robot_nodes.rb
|
|
303
|
+
- db/migrate/00010_add_soft_delete_to_associations.rb
|
|
304
|
+
- db/migrate/00011_add_performance_indexes.rb
|
|
305
|
+
- db/migrate/00012_add_tags_trigram_index.rb
|
|
306
|
+
- db/migrate/00013_enable_lz4_compression.rb
|
|
291
307
|
- db/schema.sql
|
|
292
308
|
- db/seed_data/README.md
|
|
293
309
|
- db/seed_data/presidents.md
|
|
@@ -419,15 +435,16 @@ files:
|
|
|
419
435
|
- docs/guides/search-strategies.md
|
|
420
436
|
- docs/guides/working-memory.md
|
|
421
437
|
- docs/images/htm-er-diagram.svg
|
|
438
|
+
- docs/images/telemetry-architecture.svg
|
|
422
439
|
- docs/index.md
|
|
423
440
|
- docs/multi_framework_support.md
|
|
424
441
|
- docs/setup_local_database.md
|
|
442
|
+
- docs/telemetry.md
|
|
425
443
|
- docs/using_rake_tasks_in_your_app.md
|
|
426
444
|
- examples/README.md
|
|
427
445
|
- examples/basic_usage.rb
|
|
428
446
|
- examples/cli_app/README.md
|
|
429
447
|
- examples/cli_app/htm_cli.rb
|
|
430
|
-
- examples/cli_app/temp.log
|
|
431
448
|
- examples/custom_llm_configuration.rb
|
|
432
449
|
- examples/example_app/Rakefile
|
|
433
450
|
- examples/example_app/app.rb
|
|
@@ -441,6 +458,10 @@ files:
|
|
|
441
458
|
- examples/sinatra_app/Gemfile
|
|
442
459
|
- examples/sinatra_app/Gemfile.lock
|
|
443
460
|
- examples/sinatra_app/app.rb
|
|
461
|
+
- examples/telemetry/README.md
|
|
462
|
+
- examples/telemetry/SETUP_README.md
|
|
463
|
+
- examples/telemetry/demo.rb
|
|
464
|
+
- examples/telemetry/grafana/dashboards/htm-metrics.json
|
|
444
465
|
- examples/timeframe_demo.rb
|
|
445
466
|
- lib/htm.rb
|
|
446
467
|
- lib/htm/active_record_config.rb
|
|
@@ -452,10 +473,18 @@ files:
|
|
|
452
473
|
- lib/htm/integrations/sinatra.rb
|
|
453
474
|
- lib/htm/job_adapter.rb
|
|
454
475
|
- lib/htm/jobs/generate_embedding_job.rb
|
|
476
|
+
- lib/htm/jobs/generate_propositions_job.rb
|
|
455
477
|
- lib/htm/jobs/generate_tags_job.rb
|
|
478
|
+
- lib/htm/loaders/markdown_chunker.rb
|
|
456
479
|
- lib/htm/loaders/markdown_loader.rb
|
|
457
|
-
- lib/htm/loaders/paragraph_chunker.rb
|
|
458
480
|
- lib/htm/long_term_memory.rb
|
|
481
|
+
- lib/htm/long_term_memory/fulltext_search.rb
|
|
482
|
+
- lib/htm/long_term_memory/hybrid_search.rb
|
|
483
|
+
- lib/htm/long_term_memory/node_operations.rb
|
|
484
|
+
- lib/htm/long_term_memory/relevance_scorer.rb
|
|
485
|
+
- lib/htm/long_term_memory/robot_operations.rb
|
|
486
|
+
- lib/htm/long_term_memory/tag_operations.rb
|
|
487
|
+
- lib/htm/long_term_memory/vector_search.rb
|
|
459
488
|
- lib/htm/models/file_source.rb
|
|
460
489
|
- lib/htm/models/node.rb
|
|
461
490
|
- lib/htm/models/node_tag.rb
|
|
@@ -463,9 +492,13 @@ files:
|
|
|
463
492
|
- lib/htm/models/robot_node.rb
|
|
464
493
|
- lib/htm/models/tag.rb
|
|
465
494
|
- lib/htm/observability.rb
|
|
495
|
+
- lib/htm/proposition_service.rb
|
|
496
|
+
- lib/htm/query_cache.rb
|
|
466
497
|
- lib/htm/railtie.rb
|
|
498
|
+
- lib/htm/sql_builder.rb
|
|
467
499
|
- lib/htm/tag_service.rb
|
|
468
500
|
- lib/htm/tasks.rb
|
|
501
|
+
- lib/htm/telemetry.rb
|
|
469
502
|
- lib/htm/timeframe.rb
|
|
470
503
|
- lib/htm/timeframe_extractor.rb
|
|
471
504
|
- lib/htm/version.rb
|
|
@@ -477,13 +510,6 @@ files:
|
|
|
477
510
|
- lib/tasks/jobs.rake
|
|
478
511
|
- lib/tasks/tags.rake
|
|
479
512
|
- mkdocs.yml
|
|
480
|
-
- notes/ARCHITECTURE_REVIEW.md
|
|
481
|
-
- notes/IMPLEMENTATION_SUMMARY.md
|
|
482
|
-
- notes/MULTI_FRAMEWORK_IMPLEMENTATION.md
|
|
483
|
-
- notes/next_steps.md
|
|
484
|
-
- notes/plan.md
|
|
485
|
-
- notes/tag_ontology_enhancement_ideas.md
|
|
486
|
-
- notes/timescaledb_removal_summary.md
|
|
487
513
|
- scripts/install_local_database.sh
|
|
488
514
|
homepage: https://github.com/madbomber/htm
|
|
489
515
|
licenses:
|
|
@@ -508,5 +534,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
508
534
|
requirements: []
|
|
509
535
|
rubygems_version: 4.0.0.dev
|
|
510
536
|
specification_version: 4
|
|
511
|
-
summary: Hierarchical
|
|
537
|
+
summary: Hierarchical Temporal Memory for LLM robots
|
|
512
538
|
test_files: []
|
data/.aigcm_msg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Error generating commit message: status=404 Not Found body=404 page not found
|