htm 0.0.15 → 0.0.17

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 (75) hide show
  1. checksums.yaml +4 -4
  2. data/.envrc +1 -0
  3. data/CHANGELOG.md +67 -0
  4. data/README.md +97 -1592
  5. data/bin/htm_mcp +31 -0
  6. data/config/database.yml +7 -4
  7. data/docs/getting-started/installation.md +31 -11
  8. data/docs/guides/mcp-server.md +456 -21
  9. data/docs/multi_framework_support.md +2 -2
  10. data/examples/mcp_client.rb +2 -2
  11. data/examples/rails_app/.gitignore +2 -0
  12. data/examples/rails_app/Gemfile +22 -0
  13. data/examples/rails_app/Gemfile.lock +438 -0
  14. data/examples/rails_app/Procfile.dev +1 -0
  15. data/examples/rails_app/README.md +98 -0
  16. data/examples/rails_app/Rakefile +5 -0
  17. data/examples/rails_app/app/assets/stylesheets/application.css +83 -0
  18. data/examples/rails_app/app/assets/stylesheets/inter-font.css +6 -0
  19. data/examples/rails_app/app/controllers/application_controller.rb +19 -0
  20. data/examples/rails_app/app/controllers/dashboard_controller.rb +27 -0
  21. data/examples/rails_app/app/controllers/files_controller.rb +205 -0
  22. data/examples/rails_app/app/controllers/memories_controller.rb +102 -0
  23. data/examples/rails_app/app/controllers/robots_controller.rb +44 -0
  24. data/examples/rails_app/app/controllers/search_controller.rb +46 -0
  25. data/examples/rails_app/app/controllers/tags_controller.rb +30 -0
  26. data/examples/rails_app/app/javascript/application.js +4 -0
  27. data/examples/rails_app/app/javascript/controllers/application.js +9 -0
  28. data/examples/rails_app/app/javascript/controllers/index.js +6 -0
  29. data/examples/rails_app/app/views/dashboard/index.html.erb +123 -0
  30. data/examples/rails_app/app/views/files/index.html.erb +108 -0
  31. data/examples/rails_app/app/views/files/new.html.erb +321 -0
  32. data/examples/rails_app/app/views/files/show.html.erb +130 -0
  33. data/examples/rails_app/app/views/layouts/application.html.erb +124 -0
  34. data/examples/rails_app/app/views/memories/_memory_card.html.erb +51 -0
  35. data/examples/rails_app/app/views/memories/deleted.html.erb +62 -0
  36. data/examples/rails_app/app/views/memories/edit.html.erb +35 -0
  37. data/examples/rails_app/app/views/memories/index.html.erb +81 -0
  38. data/examples/rails_app/app/views/memories/new.html.erb +71 -0
  39. data/examples/rails_app/app/views/memories/show.html.erb +126 -0
  40. data/examples/rails_app/app/views/robots/index.html.erb +106 -0
  41. data/examples/rails_app/app/views/robots/new.html.erb +36 -0
  42. data/examples/rails_app/app/views/robots/show.html.erb +79 -0
  43. data/examples/rails_app/app/views/search/index.html.erb +184 -0
  44. data/examples/rails_app/app/views/shared/_navbar.html.erb +52 -0
  45. data/examples/rails_app/app/views/shared/_stat_card.html.erb +52 -0
  46. data/examples/rails_app/app/views/tags/index.html.erb +131 -0
  47. data/examples/rails_app/app/views/tags/show.html.erb +67 -0
  48. data/examples/rails_app/bin/dev +8 -0
  49. data/examples/rails_app/bin/rails +4 -0
  50. data/examples/rails_app/bin/rake +4 -0
  51. data/examples/rails_app/config/application.rb +33 -0
  52. data/examples/rails_app/config/boot.rb +5 -0
  53. data/examples/rails_app/config/database.yml +15 -0
  54. data/examples/rails_app/config/environment.rb +5 -0
  55. data/examples/rails_app/config/importmap.rb +7 -0
  56. data/examples/rails_app/config/routes.rb +38 -0
  57. data/examples/rails_app/config/tailwind.config.js +35 -0
  58. data/examples/rails_app/config.ru +5 -0
  59. data/examples/rails_app/log/.keep +0 -0
  60. data/examples/rails_app/tmp/local_secret.txt +1 -0
  61. data/lib/htm/active_record_config.rb +2 -5
  62. data/lib/htm/configuration.rb +35 -2
  63. data/lib/htm/database.rb +3 -6
  64. data/lib/htm/mcp/cli.rb +333 -0
  65. data/lib/htm/mcp/group_tools.rb +476 -0
  66. data/lib/htm/mcp/resources.rb +89 -0
  67. data/lib/htm/mcp/server.rb +98 -0
  68. data/lib/htm/mcp/tools.rb +488 -0
  69. data/lib/htm/models/file_source.rb +5 -3
  70. data/lib/htm/railtie.rb +0 -4
  71. data/lib/htm/tasks.rb +7 -4
  72. data/lib/htm/version.rb +1 -1
  73. data/lib/tasks/htm.rake +6 -9
  74. metadata +59 -4
  75. data/bin/htm_mcp.rb +0 -621
data/bin/htm_mcp ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # HTM MCP Server with CLI management commands
5
+ #
6
+ # Usage:
7
+ # htm_mcp # Start MCP server (default)
8
+ # htm_mcp server # Start MCP server (explicit)
9
+ # htm_mcp setup # Initialize database
10
+ # htm_mcp init # Initialize database (alias for setup)
11
+ # htm_mcp verify # Verify database connection
12
+ # htm_mcp stats # Show memory statistics
13
+ # htm_mcp version # Show HTM version
14
+ # htm_mcp help # Show help and environment variables
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
+ require_relative '../lib/htm'
21
+ require_relative '../lib/htm/mcp/cli'
22
+
23
+ # Handle CLI commands (exits if command handled)
24
+ # Returns false if server should start
25
+ unless HTM::MCP::CLI.run(ARGV) == false
26
+ exit 0
27
+ end
28
+
29
+ # Start MCP server
30
+ require_relative '../lib/htm/mcp/server'
31
+ HTM::MCP::Server.start
data/config/database.yml CHANGED
@@ -9,15 +9,18 @@
9
9
  # Example HTM_DBURL format:
10
10
  # postgresql://user:password@host:port/database?sslmode=require
11
11
  #
12
+ # Environment detection priority:
13
+ # HTM_ENV > RAILS_ENV > RACK_ENV > 'development'
14
+ #
12
15
  # Test database:
13
- # Tests always use htm_test database (Rails convention).
14
- # Set RAILS_ENV=test or RACK_ENV=test to use the test configuration.
16
+ # Tests always use htm_test database.
17
+ # Set HTM_ENV=test (or RAILS_ENV=test) to use the test configuration.
15
18
 
16
19
  <%
17
20
  require 'uri'
18
21
 
19
- # Determine current environment
20
- current_env = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
22
+ # Determine current environment (HTM_ENV takes priority for non-Rails users)
23
+ current_env = ENV['HTM_ENV'] || ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
21
24
 
22
25
  # Parse connection from HTM_DBURL or use individual variables
23
26
  if ENV['HTM_DBURL']
@@ -232,7 +232,17 @@ export OLLAMA_URL="http://custom-host:11434"
232
232
 
233
233
  Run the database setup to create HTM's tables and schema:
234
234
 
235
- ### Option A: Using Ruby
235
+ ### Option A: Using htm_mcp CLI (Recommended)
236
+
237
+ ```bash
238
+ # Initialize the database schema
239
+ htm_mcp setup
240
+
241
+ # Verify the setup
242
+ htm_mcp verify
243
+ ```
244
+
245
+ ### Option B: Using Ruby
236
246
 
237
247
  ```ruby
238
248
  require 'htm'
@@ -241,29 +251,39 @@ require 'htm'
241
251
  HTM::Database.setup
242
252
  ```
243
253
 
244
- ### Option B: Using Command Line
245
-
246
- ```bash
247
- ruby -r ./lib/htm -e "HTM::Database.setup"
248
- ```
249
-
250
254
  ### Option C: Using Rake Task (if available)
251
255
 
252
256
  ```bash
253
- rake db:setup
257
+ rake htm:db:setup
254
258
  ```
255
259
 
256
260
  This creates the following tables:
257
261
 
258
262
  - **`nodes`**: Main memory storage with vector embeddings
259
- - **`relationships`**: Knowledge graph connections
260
- - **`tags`**: Flexible categorization
263
+ - **`tags`**: Hierarchical categorization
261
264
  - **`robots`**: Robot registry
262
- - **`operations_log`**: Audit trail
265
+ - **`file_sources`**: Source file metadata for loaded documents
263
266
 
264
267
  !!! success "Schema Created"
265
268
  You'll see confirmation messages as each table and index is created.
266
269
 
270
+ ### htm_mcp CLI Commands
271
+
272
+ The `htm_mcp` executable provides commands for database management:
273
+
274
+ | Command | Description |
275
+ |---------|-------------|
276
+ | `htm_mcp setup` | Initialize database schema |
277
+ | `htm_mcp verify` | Verify connection, extensions, and migrations |
278
+ | `htm_mcp stats` | Show memory statistics |
279
+ | `htm_mcp help` | Show all commands and environment variables |
280
+ | `htm_mcp` | Start the MCP server |
281
+
282
+ ```bash
283
+ # Check statistics after setup
284
+ htm_mcp stats
285
+ ```
286
+
267
287
  ## Step 6: Verify Installation
268
288
 
269
289
  Create a test script to verify everything works:
@@ -4,7 +4,7 @@ HTM includes a Model Context Protocol (MCP) server that exposes memory capabilit
4
4
 
5
5
  ## Overview
6
6
 
7
- The MCP server (`bin/htm_mcp.rb`) uses [FastMCP](https://github.com/yjacket/fast-mcp) to expose HTM's memory operations as MCP tools and resources. Any MCP-compatible client can connect to the server and use HTM's memory capabilities.
7
+ The MCP server (`bin/htm_mcp`) uses [FastMCP](https://github.com/yjacket/fast-mcp) to expose HTM's memory operations as MCP tools and resources. Any MCP-compatible client can connect to the server and use HTM's memory capabilities.
8
8
 
9
9
  ### Key Features
10
10
 
@@ -13,6 +13,7 @@ The MCP server (`bin/htm_mcp.rb`) uses [FastMCP](https://github.com/yjacket/fast
13
13
  - **Session restore**: Restore previous session context from working memory
14
14
  - **Fuzzy search**: Typo-tolerant tag and topic search
15
15
  - **Resource access**: Query statistics, tag hierarchy, and recent memories
16
+ - **Robot Groups (High-Availability)**: Coordinate multiple robots with shared working memory, failover, and real-time sync
16
17
 
17
18
  ## Prerequisites
18
19
 
@@ -26,7 +27,7 @@ Before using the MCP server, ensure you have:
26
27
  2. **PostgreSQL database set up**
27
28
  ```bash
28
29
  export HTM_DBURL="postgresql://user@localhost:5432/htm_development"
29
- rake htm:db:setup
30
+ htm_mcp setup
30
31
  ```
31
32
 
32
33
  3. **Ollama running** (for embeddings and tag extraction)
@@ -38,14 +39,60 @@ Before using the MCP server, ensure you have:
38
39
 
39
40
  ## Starting the Server
40
41
 
41
- The MCP server uses STDIO transport which is compatible with most MCP clients. When you do a `gem install htm` the htm_mcp.rb executable is placed on your $PATH.
42
+ The MCP server uses STDIO transport which is compatible with most MCP clients. When you do a `gem install htm`, the `htm_mcp` executable is placed on your $PATH.
42
43
 
43
44
  ```bash
44
- htm_mcp.rb
45
+ htm_mcp
45
46
  ```
46
47
 
47
48
  The server logs to STDERR to avoid corrupting the JSON-RPC protocol on STDOUT.
48
49
 
50
+ ## CLI Commands
51
+
52
+ The `htm_mcp` executable includes management commands for database setup and diagnostics:
53
+
54
+ | Command | Description |
55
+ |---------|-------------|
56
+ | `htm_mcp` | Start the MCP server (default) |
57
+ | `htm_mcp server` | Start the MCP server (explicit) |
58
+ | `htm_mcp setup` | Initialize database schema and run migrations |
59
+ | `htm_mcp init` | Alias for setup |
60
+ | `htm_mcp verify` | Verify database connection, extensions, and migration status |
61
+ | `htm_mcp stats` | Show memory statistics (nodes, tags, robots, database size) |
62
+ | `htm_mcp version` | Show HTM version |
63
+ | `htm_mcp help` | Show help with all environment variables |
64
+
65
+ ### First-Time Setup
66
+
67
+ ```bash
68
+ # Set your database URL
69
+ export HTM_DBURL="postgresql://user@localhost:5432/htm_development"
70
+
71
+ # Initialize the database
72
+ htm_mcp setup
73
+
74
+ # Verify everything is working
75
+ htm_mcp verify
76
+
77
+ # Check memory statistics
78
+ htm_mcp stats
79
+ ```
80
+
81
+ ### Migration Status
82
+
83
+ The `verify` command shows migration status with `+` (applied) and `-` (pending) indicators:
84
+
85
+ ```
86
+ Migration Status
87
+ --------------------------------------------------------------------------------
88
+ + 20250101000001_create_schema_migrations
89
+ + 20250101000002_create_robots
90
+ + 20250101000003_create_nodes
91
+ - 20250612000001_add_new_feature
92
+ --------------------------------------------------------------------------------
93
+ 3 applied, 1 pending
94
+ ```
95
+
49
96
  ## Tools Reference
50
97
 
51
98
  ### SetRobotTool
@@ -335,6 +382,291 @@ Get statistics about HTM memory usage.
335
382
  }
336
383
  ```
337
384
 
385
+ ## Robot Group Tools
386
+
387
+ Robot Groups enable high-availability configurations with multiple robots sharing working memory. Groups support active/passive roles, automatic failover, and real-time synchronization via PostgreSQL LISTEN/NOTIFY.
388
+
389
+ ### CreateGroupTool
390
+
391
+ Create a new robot group with shared working memory.
392
+
393
+ **Parameters:**
394
+ - `name` (String, required): Unique name for the group
395
+ - `sync_interval` (Integer, optional): Sync interval in seconds (default: 30)
396
+ - `max_members` (Integer, optional): Maximum group members (default: 10)
397
+ - `token_budget` (Integer, optional): Shared working memory token limit (default: 4000)
398
+
399
+ **Returns:**
400
+ ```json
401
+ {
402
+ "success": true,
403
+ "group_name": "research-team",
404
+ "sync_interval": 30,
405
+ "max_members": 10,
406
+ "token_budget": 4000,
407
+ "message": "Robot group 'research-team' created successfully"
408
+ }
409
+ ```
410
+
411
+ ---
412
+
413
+ ### ListGroupsTool
414
+
415
+ List all active robot groups in the current MCP session.
416
+
417
+ **Parameters:** None
418
+
419
+ **Returns:**
420
+ ```json
421
+ {
422
+ "success": true,
423
+ "count": 2,
424
+ "groups": [
425
+ {
426
+ "name": "research-team",
427
+ "member_count": 3,
428
+ "active_robot": "researcher-1"
429
+ },
430
+ {
431
+ "name": "support-team",
432
+ "member_count": 2,
433
+ "active_robot": "support-bot"
434
+ }
435
+ ]
436
+ }
437
+ ```
438
+
439
+ ---
440
+
441
+ ### GetGroupStatusTool
442
+
443
+ Get detailed status of a robot group.
444
+
445
+ **Parameters:**
446
+ - `name` (String, required): The group name
447
+
448
+ **Returns:**
449
+ ```json
450
+ {
451
+ "success": true,
452
+ "group_name": "research-team",
453
+ "status": {
454
+ "active_robot": "researcher-1",
455
+ "member_count": 3,
456
+ "members": [
457
+ { "name": "researcher-1", "role": "active", "last_seen": "2024-01-15T10:30:00Z" },
458
+ { "name": "researcher-2", "role": "passive", "last_seen": "2024-01-15T10:29:55Z" },
459
+ { "name": "researcher-3", "role": "passive", "last_seen": "2024-01-15T10:29:50Z" }
460
+ ],
461
+ "working_memory_tokens": 2500,
462
+ "token_budget": 4000,
463
+ "sync_interval": 30
464
+ }
465
+ }
466
+ ```
467
+
468
+ ---
469
+
470
+ ### JoinGroupTool
471
+
472
+ Add a robot to an existing group.
473
+
474
+ **Parameters:**
475
+ - `group_name` (String, required): The group to join
476
+ - `robot_name` (String, required): The robot name to add
477
+ - `role` (String, optional): `"active"` or `"passive"` (default: `"passive"`)
478
+
479
+ **Returns:**
480
+ ```json
481
+ {
482
+ "success": true,
483
+ "group_name": "research-team",
484
+ "robot_name": "researcher-4",
485
+ "role": "passive",
486
+ "message": "Robot 'researcher-4' joined group 'research-team' as passive"
487
+ }
488
+ ```
489
+
490
+ ---
491
+
492
+ ### LeaveGroupTool
493
+
494
+ Remove a robot from a group.
495
+
496
+ **Parameters:**
497
+ - `group_name` (String, required): The group to leave
498
+ - `robot_name` (String, required): The robot to remove
499
+
500
+ **Returns:**
501
+ ```json
502
+ {
503
+ "success": true,
504
+ "group_name": "research-team",
505
+ "robot_name": "researcher-4",
506
+ "message": "Robot 'researcher-4' left group 'research-team'"
507
+ }
508
+ ```
509
+
510
+ ---
511
+
512
+ ### GroupRememberTool
513
+
514
+ Store memory shared across all group members. Only the active robot can write to group memory.
515
+
516
+ **Parameters:**
517
+ - `group_name` (String, required): The target group
518
+ - `content` (String, required): The content to remember
519
+ - `tags` (Array<String>, optional): Tags for categorization
520
+ - `metadata` (Hash, optional): Key-value metadata
521
+
522
+ **Returns:**
523
+ ```json
524
+ {
525
+ "success": true,
526
+ "group_name": "research-team",
527
+ "node_id": 789,
528
+ "content": "Found relevant paper on embeddings",
529
+ "tags": ["research:papers", "ai:embeddings"],
530
+ "message": "Memory stored in group working memory"
531
+ }
532
+ ```
533
+
534
+ ---
535
+
536
+ ### GroupRecallTool
537
+
538
+ Recall memories from a group's shared context.
539
+
540
+ **Parameters:**
541
+ - `group_name` (String, required): The target group
542
+ - `query` (String, required): Search query
543
+ - `limit` (Integer, optional): Maximum results (default: 10)
544
+ - `strategy` (String, optional): `"vector"`, `"fulltext"`, or `"hybrid"` (default: `"hybrid"`)
545
+
546
+ **Returns:**
547
+ ```json
548
+ {
549
+ "success": true,
550
+ "group_name": "research-team",
551
+ "query": "embeddings",
552
+ "count": 3,
553
+ "results": [
554
+ {
555
+ "id": 789,
556
+ "content": "Found relevant paper on embeddings",
557
+ "tags": ["research:papers", "ai:embeddings"],
558
+ "score": 0.92
559
+ }
560
+ ]
561
+ }
562
+ ```
563
+
564
+ ---
565
+
566
+ ### GetGroupWorkingMemoryTool
567
+
568
+ Get a group's working memory contents.
569
+
570
+ **Parameters:**
571
+ - `group_name` (String, required): The target group
572
+
573
+ **Returns:**
574
+ ```json
575
+ {
576
+ "success": true,
577
+ "group_name": "research-team",
578
+ "token_usage": 2500,
579
+ "token_budget": 4000,
580
+ "count": 15,
581
+ "working_memory": [
582
+ {
583
+ "id": 789,
584
+ "content": "Found relevant paper on embeddings",
585
+ "tags": ["research:papers"],
586
+ "added_at": "2024-01-15T10:30:00Z"
587
+ }
588
+ ]
589
+ }
590
+ ```
591
+
592
+ ---
593
+
594
+ ### PromoteRobotTool
595
+
596
+ Promote a passive robot to active role. The current active robot becomes passive.
597
+
598
+ **Parameters:**
599
+ - `group_name` (String, required): The target group
600
+ - `robot_name` (String, required): The robot to promote
601
+
602
+ **Returns:**
603
+ ```json
604
+ {
605
+ "success": true,
606
+ "group_name": "research-team",
607
+ "promoted_robot": "researcher-2",
608
+ "previous_active": "researcher-1",
609
+ "message": "Robot 'researcher-2' is now active. 'researcher-1' is now passive."
610
+ }
611
+ ```
612
+
613
+ ---
614
+
615
+ ### FailoverTool
616
+
617
+ Trigger failover to the next available robot in the group.
618
+
619
+ **Parameters:**
620
+ - `group_name` (String, required): The target group
621
+
622
+ **Returns:**
623
+ ```json
624
+ {
625
+ "success": true,
626
+ "group_name": "research-team",
627
+ "new_active": "researcher-2",
628
+ "previous_active": "researcher-1",
629
+ "message": "Failover complete. 'researcher-2' is now active."
630
+ }
631
+ ```
632
+
633
+ ---
634
+
635
+ ### SyncGroupTool
636
+
637
+ Manually synchronize group state across all members.
638
+
639
+ **Parameters:**
640
+ - `group_name` (String, required): The target group
641
+
642
+ **Returns:**
643
+ ```json
644
+ {
645
+ "success": true,
646
+ "group_name": "research-team",
647
+ "synced_members": 3,
648
+ "message": "Group state synchronized across 3 members"
649
+ }
650
+ ```
651
+
652
+ ---
653
+
654
+ ### ShutdownGroupTool
655
+
656
+ Gracefully shutdown a robot group, removing all members.
657
+
658
+ **Parameters:**
659
+ - `group_name` (String, required): The group to shutdown
660
+
661
+ **Returns:**
662
+ ```json
663
+ {
664
+ "success": true,
665
+ "group_name": "research-team",
666
+ "message": "Robot group 'research-team' has been shut down"
667
+ }
668
+ ```
669
+
338
670
  ## Resources Reference
339
671
 
340
672
  ### htm://statistics
@@ -375,6 +707,32 @@ ai
375
707
 
376
708
  Last 20 memories as JSON array.
377
709
 
710
+ ### htm://groups
711
+
712
+ Active robot groups and their status:
713
+
714
+ ```json
715
+ {
716
+ "count": 2,
717
+ "groups": [
718
+ {
719
+ "name": "research-team",
720
+ "member_count": 3,
721
+ "active_robot": "researcher-1",
722
+ "token_usage": 2500,
723
+ "token_budget": 4000
724
+ },
725
+ {
726
+ "name": "support-team",
727
+ "member_count": 2,
728
+ "active_robot": "support-bot",
729
+ "token_usage": 1200,
730
+ "token_budget": 4000
731
+ }
732
+ ]
733
+ }
734
+ ```
735
+
378
736
  ## Client Configuration
379
737
 
380
738
  ### Claude Desktop
@@ -385,8 +743,22 @@ Add to `~/.config/claude/claude_desktop_config.json` (Linux/macOS) or `%APPDATA%
385
743
  {
386
744
  "mcpServers": {
387
745
  "htm-memory": {
388
- "command": "ruby",
389
- "args": ["/absolute/path/to/htm/bin/htm_mcp.rb"],
746
+ "command": "htm_mcp",
747
+ "env": {
748
+ "HTM_DBURL": "postgresql://user@localhost:5432/htm_development"
749
+ }
750
+ }
751
+ }
752
+ }
753
+ ```
754
+
755
+ If `htm_mcp` is not in your PATH, use the absolute path:
756
+
757
+ ```json
758
+ {
759
+ "mcpServers": {
760
+ "htm-memory": {
761
+ "command": "/path/to/htm_mcp",
390
762
  "env": {
391
763
  "HTM_DBURL": "postgresql://user@localhost:5432/htm_development"
392
764
  }
@@ -408,8 +780,7 @@ Add to `~/.claude/claude_code_config.json`:
408
780
  {
409
781
  "mcpServers": {
410
782
  "htm-memory": {
411
- "command": "ruby",
412
- "args": ["/absolute/path/to/htm/bin/htm_mcp.rb"],
783
+ "command": "htm_mcp",
413
784
  "env": {
414
785
  "HTM_DBURL": "postgresql://user@localhost:5432/htm_development"
415
786
  }
@@ -439,9 +810,7 @@ Add to `~/.config/aia/config.yml`:
439
810
  ```yaml
440
811
  mcp_servers:
441
812
  htm-memory:
442
- command: ruby
443
- args:
444
- - /absolute/path/to/htm/bin/htm_mcp.rb
813
+ command: htm_mcp
445
814
  env:
446
815
  HTM_DBURL: postgresql://user@localhost:5432/htm_development
447
816
  ```
@@ -451,9 +820,7 @@ For project-specific configuration, add to `.aia/config.yml` in your project roo
451
820
  ```yaml
452
821
  mcp_servers:
453
822
  htm-memory:
454
- command: ruby
455
- args:
456
- - /absolute/path/to/htm/bin/htm_mcp.rb
823
+ command: htm_mcp
457
824
  env:
458
825
  HTM_DBURL: postgresql://user@localhost:5432/my_project_htm
459
826
  ```
@@ -515,6 +882,41 @@ Remember that project B uses Vue with JavaScript
515
882
 
516
883
  Each robot has its own working memory but shares the global long-term memory (hive mind).
517
884
 
885
+ ### Using Robot Groups
886
+
887
+ Robot Groups enable high-availability configurations where multiple robots share working memory:
888
+
889
+ 1. **Create a group**:
890
+ ```
891
+ Create a robot group called "research-team" with 3 max members
892
+ ```
893
+
894
+ 2. **Join robots to the group**:
895
+ ```
896
+ Join robot "researcher-1" to group "research-team" as active
897
+ Join robot "researcher-2" to group "research-team" as passive
898
+ ```
899
+
900
+ 3. **Store shared memories**:
901
+ ```
902
+ Remember in group "research-team" that we found a relevant paper on embeddings
903
+ ```
904
+
905
+ 4. **Recall from group context**:
906
+ ```
907
+ Recall from group "research-team" what we know about embeddings
908
+ ```
909
+
910
+ 5. **Handle failover**:
911
+ ```
912
+ Trigger failover for group "research-team"
913
+ ```
914
+
915
+ 6. **Check group status**:
916
+ ```
917
+ Show status of group "research-team"
918
+ ```
919
+
518
920
  ### Searching with Typo Tolerance
519
921
 
520
922
  Use fuzzy search when you're not sure of exact tag names:
@@ -573,7 +975,7 @@ psql htm_development -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
573
975
 
574
976
  **Claude Desktop doesn't show HTM tools:**
575
977
  1. Verify the config file path is correct for your OS
576
- 2. Check that the path to `htm_mcp.rb` is absolute
978
+ 2. Check that `htm_mcp` is in your PATH or use an absolute path
577
979
  3. Restart Claude Desktop completely
578
980
  4. Check Claude Desktop logs for errors
579
981
 
@@ -596,18 +998,51 @@ psql htm_development -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
596
998
 
597
999
  Enable verbose logging by checking STDERR output:
598
1000
  ```bash
599
- ruby bin/htm_mcp.rb 2>&1 | tee mcp_debug.log
1001
+ htm_mcp 2>&1 | tee mcp_debug.log
600
1002
  ```
601
1003
 
602
1004
  The server logs all tool calls and errors to STDERR.
603
1005
 
604
1006
  ## Environment Variables
605
1007
 
606
- | Variable | Description | Required |
607
- |----------|-------------|----------|
608
- | `HTM_DBURL` | PostgreSQL connection URL | Yes |
609
- | `OLLAMA_URL` | Ollama server URL (default: `http://localhost:11434`) | No |
610
- | `HTM_ROBOT_NAME` | Default robot name for clients | No |
1008
+ Run `htm_mcp help` for a complete list. Key variables:
1009
+
1010
+ ### Database (required)
1011
+
1012
+ | Variable | Description |
1013
+ |----------|-------------|
1014
+ | `HTM_DBURL` | PostgreSQL connection URL (e.g., `postgresql://user:pass@localhost:5432/htm_development`) |
1015
+
1016
+ ### Database (alternative to HTM_DBURL)
1017
+
1018
+ | Variable | Description | Default |
1019
+ |----------|-------------|---------|
1020
+ | `HTM_DBNAME` | Database name | - |
1021
+ | `HTM_DBHOST` | Database host | `localhost` |
1022
+ | `HTM_DBPORT` | Database port | `5432` |
1023
+ | `HTM_DBUSER` | Database username | - |
1024
+ | `HTM_DBPASS` | Database password | - |
1025
+ | `HTM_DBSSLMODE` | SSL mode | `prefer` |
1026
+
1027
+ ### LLM Providers
1028
+
1029
+ | Variable | Description | Default |
1030
+ |----------|-------------|---------|
1031
+ | `HTM_EMBEDDING_PROVIDER` | Embedding provider | `ollama` |
1032
+ | `HTM_EMBEDDING_MODEL` | Embedding model | `nomic-embed-text:latest` |
1033
+ | `HTM_TAG_PROVIDER` | Tag extraction provider | `ollama` |
1034
+ | `HTM_TAG_MODEL` | Tag model | `gemma3:latest` |
1035
+ | `HTM_OLLAMA_URL` | Ollama server URL | `http://localhost:11434` |
1036
+
1037
+ ### Other Providers (set API keys as needed)
1038
+
1039
+ | Variable | Description |
1040
+ |----------|-------------|
1041
+ | `HTM_OPENAI_API_KEY` | OpenAI API key |
1042
+ | `HTM_ANTHROPIC_API_KEY` | Anthropic API key |
1043
+ | `HTM_GEMINI_API_KEY` | Google Gemini API key |
1044
+ | `HTM_AZURE_API_KEY` | Azure OpenAI API key |
1045
+ | `HTM_AZURE_ENDPOINT` | Azure OpenAI endpoint |
611
1046
 
612
1047
  ## Next Steps
613
1048
 
@@ -131,8 +131,8 @@ node_id = htm.remember("text") # ~15ms
131
131
  HTM automatically detects the appropriate backend:
132
132
 
133
133
  ```ruby
134
- # Test environment → :inline
135
- ENV['RAILS_ENV'] = 'test'
134
+ # Test environment → :inline (uses HTM.env which checks HTM_ENV > RAILS_ENV > RACK_ENV)
135
+ ENV['HTM_ENV'] = 'test'
136
136
  HTM.configuration.job_backend # => :inline
137
137
 
138
138
  # Rails app → :active_job