htm 0.0.1 → 0.0.2

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 (109) hide show
  1. checksums.yaml +4 -4
  2. data/.envrc +1 -0
  3. data/.tbls.yml +30 -0
  4. data/CHANGELOG.md +30 -0
  5. data/SETUP.md +132 -101
  6. data/db/migrate/20250125000001_add_content_hash_to_nodes.rb +14 -0
  7. data/db/migrate/20250125000002_create_robot_nodes.rb +35 -0
  8. data/db/migrate/20250125000003_remove_source_and_robot_id_from_nodes.rb +28 -0
  9. data/db/migrate/20250126000001_create_working_memories.rb +19 -0
  10. data/db/migrate/20250126000002_remove_unused_columns.rb +12 -0
  11. data/db/schema.sql +226 -43
  12. data/docs/api/database.md +20 -232
  13. data/docs/api/embedding-service.md +1 -7
  14. data/docs/api/htm.md +195 -449
  15. data/docs/api/index.md +1 -7
  16. data/docs/api/long-term-memory.md +342 -590
  17. data/docs/architecture/adrs/001-postgresql-timescaledb.md +1 -1
  18. data/docs/architecture/adrs/003-ollama-embeddings.md +1 -1
  19. data/docs/architecture/adrs/010-redis-working-memory-rejected.md +2 -27
  20. data/docs/architecture/adrs/index.md +2 -13
  21. data/docs/architecture/hive-mind.md +165 -166
  22. data/docs/architecture/index.md +2 -2
  23. data/docs/architecture/overview.md +5 -171
  24. data/docs/architecture/two-tier-memory.md +1 -35
  25. data/docs/assets/images/adr-010-current-architecture.svg +37 -0
  26. data/docs/assets/images/adr-010-proposed-architecture.svg +48 -0
  27. data/docs/assets/images/adr-dependency-tree.svg +93 -0
  28. data/docs/assets/images/class-hierarchy.svg +55 -0
  29. data/docs/assets/images/exception-hierarchy.svg +45 -0
  30. data/docs/assets/images/htm-architecture-overview.svg +83 -0
  31. data/docs/assets/images/htm-complete-memory-flow.svg +160 -0
  32. data/docs/assets/images/htm-context-assembly-flow.svg +148 -0
  33. data/docs/assets/images/htm-eviction-process.svg +141 -0
  34. data/docs/assets/images/htm-memory-addition-flow.svg +138 -0
  35. data/docs/assets/images/htm-memory-recall-flow.svg +152 -0
  36. data/docs/assets/images/htm-node-states.svg +123 -0
  37. data/docs/assets/images/project-structure.svg +78 -0
  38. data/docs/assets/images/test-directory-structure.svg +38 -0
  39. data/{dbdoc → docs/database}/README.md +5 -3
  40. data/{dbdoc → docs/database}/public.node_tags.md +4 -5
  41. data/docs/database/public.node_tags.svg +106 -0
  42. data/{dbdoc → docs/database}/public.nodes.md +3 -8
  43. data/docs/database/public.nodes.svg +152 -0
  44. data/docs/database/public.robot_nodes.md +44 -0
  45. data/docs/database/public.robot_nodes.svg +121 -0
  46. data/{dbdoc → docs/database}/public.robots.md +1 -2
  47. data/docs/database/public.robots.svg +106 -0
  48. data/docs/database/public.working_memories.md +40 -0
  49. data/docs/database/public.working_memories.svg +112 -0
  50. data/{dbdoc → docs/database}/schema.json +342 -110
  51. data/docs/database/schema.svg +223 -0
  52. data/docs/development/index.md +1 -29
  53. data/docs/development/schema.md +84 -324
  54. data/docs/development/testing.md +1 -9
  55. data/docs/getting-started/index.md +47 -0
  56. data/docs/{installation.md → getting-started/installation.md} +2 -2
  57. data/docs/{quick-start.md → getting-started/quick-start.md} +5 -5
  58. data/docs/guides/adding-memories.md +221 -655
  59. data/docs/guides/search-strategies.md +85 -51
  60. data/docs/images/htm-er-diagram.svg +156 -0
  61. data/docs/index.md +16 -31
  62. data/docs/multi_framework_support.md +4 -4
  63. data/examples/basic_usage.rb +18 -16
  64. data/examples/cli_app/htm_cli.rb +86 -8
  65. data/examples/custom_llm_configuration.rb +1 -2
  66. data/examples/example_app/app.rb +11 -14
  67. data/examples/sinatra_app/Gemfile +1 -0
  68. data/examples/sinatra_app/Gemfile.lock +166 -0
  69. data/examples/sinatra_app/app.rb +219 -24
  70. data/lib/htm/active_record_config.rb +10 -3
  71. data/lib/htm/configuration.rb +265 -78
  72. data/lib/htm/{sinatra.rb → integrations/sinatra.rb} +87 -12
  73. data/lib/htm/job_adapter.rb +10 -3
  74. data/lib/htm/long_term_memory.rb +220 -57
  75. data/lib/htm/models/node.rb +36 -7
  76. data/lib/htm/models/robot.rb +30 -4
  77. data/lib/htm/models/robot_node.rb +50 -0
  78. data/lib/htm/models/tag.rb +52 -0
  79. data/lib/htm/models/working_memory_entry.rb +88 -0
  80. data/lib/htm/tasks.rb +4 -0
  81. data/lib/htm/version.rb +1 -1
  82. data/lib/htm.rb +34 -13
  83. data/lib/tasks/htm.rake +32 -1
  84. data/lib/tasks/jobs.rake +7 -3
  85. data/lib/tasks/tags.rake +34 -0
  86. data/mkdocs.yml +56 -9
  87. metadata +61 -31
  88. data/dbdoc/public.node_tags.svg +0 -112
  89. data/dbdoc/public.nodes.svg +0 -118
  90. data/dbdoc/public.robots.svg +0 -90
  91. data/dbdoc/schema.svg +0 -154
  92. /data/{dbdoc → docs/database}/public.node_stats.md +0 -0
  93. /data/{dbdoc → docs/database}/public.node_stats.svg +0 -0
  94. /data/{dbdoc → docs/database}/public.nodes_tags.md +0 -0
  95. /data/{dbdoc → docs/database}/public.nodes_tags.svg +0 -0
  96. /data/{dbdoc → docs/database}/public.ontology_structure.md +0 -0
  97. /data/{dbdoc → docs/database}/public.ontology_structure.svg +0 -0
  98. /data/{dbdoc → docs/database}/public.operations_log.md +0 -0
  99. /data/{dbdoc → docs/database}/public.operations_log.svg +0 -0
  100. /data/{dbdoc → docs/database}/public.relationships.md +0 -0
  101. /data/{dbdoc → docs/database}/public.relationships.svg +0 -0
  102. /data/{dbdoc → docs/database}/public.robot_activity.md +0 -0
  103. /data/{dbdoc → docs/database}/public.robot_activity.svg +0 -0
  104. /data/{dbdoc → docs/database}/public.schema_migrations.md +0 -0
  105. /data/{dbdoc → docs/database}/public.schema_migrations.svg +0 -0
  106. /data/{dbdoc → docs/database}/public.tags.md +0 -0
  107. /data/{dbdoc → docs/database}/public.tags.svg +0 -0
  108. /data/{dbdoc → docs/database}/public.topic_relationships.md +0 -0
  109. /data/{dbdoc → docs/database}/public.topic_relationships.svg +0 -0
@@ -0,0 +1,152 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
3
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <!-- Generated by graphviz version 12.1.2 (20240928.0832)
5
+ -->
6
+ <!-- Title: public.nodes Pages: 1 -->
7
+ <svg width="1205pt" height="848pt"
8
+ viewBox="0.00 0.00 1204.77 848.40" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
9
+ <g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 844.4)">
10
+ <title>public.nodes</title>
11
+ <polygon fill="white" stroke="none" points="-4,4 -4,-844.4 1200.77,-844.4 1200.77,4 -4,4"/>
12
+ <!-- public.nodes -->
13
+ <g id="node1" class="node">
14
+ <title>public.nodes</title>
15
+ <polygon fill="#efefef" stroke="none" points="454.42,-354.2 454.42,-389.8 726.75,-389.8 726.75,-354.2 454.42,-354.2"/>
16
+ <polygon fill="none" stroke="black" points="454.42,-354.2 454.42,-389.8 726.75,-389.8 726.75,-354.2 454.42,-354.2"/>
17
+ <text text-anchor="start" x="482.6" y="-367.6" font-family="Arial Bold" font-size="18.00">public.nodes</text>
18
+ <text text-anchor="start" x="574.09" y="-367.6" font-family="Arial" font-size="14.00">    </text>
19
+ <text text-anchor="start" x="605.2" y="-367.6" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
20
+ <polygon fill="none" stroke="black" points="454.42,-323.4 454.42,-354.2 726.75,-354.2 726.75,-323.4 454.42,-323.4"/>
21
+ <text text-anchor="start" x="461.42" y="-335.6" font-family="Arial" font-size="14.00">id </text>
22
+ <text text-anchor="start" x="476.21" y="-335.6" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
23
+ <polygon fill="none" stroke="black" points="454.42,-292.6 454.42,-323.4 726.75,-323.4 726.75,-292.6 454.42,-292.6"/>
24
+ <text text-anchor="start" x="461.42" y="-304.8" font-family="Arial" font-size="14.00">content </text>
25
+ <text text-anchor="start" x="511.24" y="-304.8" font-family="Arial" font-size="14.00" fill="#666666">[text]</text>
26
+ <polygon fill="none" stroke="black" points="454.42,-261.8 454.42,-292.6 726.75,-292.6 726.75,-261.8 454.42,-261.8"/>
27
+ <text text-anchor="start" x="461.42" y="-274" font-family="Arial" font-size="14.00">access_count </text>
28
+ <text text-anchor="start" x="550.92" y="-274" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
29
+ <polygon fill="none" stroke="black" points="454.42,-231 454.42,-261.8 726.75,-261.8 726.75,-231 454.42,-231"/>
30
+ <text text-anchor="start" x="461.42" y="-243.2" font-family="Arial" font-size="14.00">created_at </text>
31
+ <text text-anchor="start" x="531.47" y="-243.2" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
32
+ <polygon fill="none" stroke="black" points="454.42,-200.2 454.42,-231 726.75,-231 726.75,-200.2 454.42,-200.2"/>
33
+ <text text-anchor="start" x="461.42" y="-212.4" font-family="Arial" font-size="14.00">updated_at </text>
34
+ <text text-anchor="start" x="535.38" y="-212.4" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
35
+ <polygon fill="none" stroke="black" points="454.42,-169.4 454.42,-200.2 726.75,-200.2 726.75,-169.4 454.42,-169.4"/>
36
+ <text text-anchor="start" x="461.42" y="-181.6" font-family="Arial" font-size="14.00">last_accessed </text>
37
+ <text text-anchor="start" x="554.03" y="-181.6" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
38
+ <polygon fill="none" stroke="black" points="454.42,-138.6 454.42,-169.4 726.75,-169.4 726.75,-138.6 454.42,-138.6"/>
39
+ <text text-anchor="start" x="461.42" y="-150.8" font-family="Arial" font-size="14.00">token_count </text>
40
+ <text text-anchor="start" x="541.6" y="-150.8" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
41
+ <polygon fill="none" stroke="black" points="454.42,-107.8 454.42,-138.6 726.75,-138.6 726.75,-107.8 454.42,-107.8"/>
42
+ <text text-anchor="start" x="461.42" y="-120" font-family="Arial" font-size="14.00">embedding </text>
43
+ <text text-anchor="start" x="534.59" y="-120" font-family="Arial" font-size="14.00" fill="#666666">[vector(2000)]</text>
44
+ <polygon fill="none" stroke="black" points="454.42,-77 454.42,-107.8 726.75,-107.8 726.75,-77 454.42,-77"/>
45
+ <text text-anchor="start" x="461.42" y="-89.2" font-family="Arial" font-size="14.00">embedding_dimension </text>
46
+ <text text-anchor="start" x="606.19" y="-89.2" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
47
+ <polygon fill="none" stroke="black" points="454.42,-46.2 454.42,-77 726.75,-77 726.75,-46.2 454.42,-46.2"/>
48
+ <text text-anchor="start" x="461.42" y="-58.4" font-family="Arial" font-size="14.00">content_hash </text>
49
+ <text text-anchor="start" x="549.38" y="-58.4" font-family="Arial" font-size="14.00" fill="#666666">[varchar(64)]</text>
50
+ <polygon fill="none" stroke="black" stroke-width="3" points="452.92,-44.7 452.92,-391.3 728.25,-391.3 728.25,-44.7 452.92,-44.7"/>
51
+ </g>
52
+ <!-- public.robot_nodes -->
53
+ <g id="node2" class="node">
54
+ <title>public.robot_nodes</title>
55
+ <polygon fill="#efefef" stroke="none" points="43.2,-761.6 43.2,-797.2 355.98,-797.2 355.98,-761.6 43.2,-761.6"/>
56
+ <polygon fill="none" stroke="black" points="43.2,-761.6 43.2,-797.2 355.98,-797.2 355.98,-761.6 43.2,-761.6"/>
57
+ <text text-anchor="start" x="68.1" y="-775" font-family="Arial Bold" font-size="18.00">public.robot_nodes</text>
58
+ <text text-anchor="start" x="206.58" y="-775" font-family="Arial" font-size="14.00">    </text>
59
+ <text text-anchor="start" x="237.7" y="-775" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
60
+ <polygon fill="none" stroke="black" points="43.2,-730.8 43.2,-761.6 355.98,-761.6 355.98,-730.8 43.2,-730.8"/>
61
+ <text text-anchor="start" x="50.2" y="-743" font-family="Arial" font-size="14.00">id </text>
62
+ <text text-anchor="start" x="64.99" y="-743" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
63
+ <polygon fill="none" stroke="black" points="43.2,-700 43.2,-730.8 355.98,-730.8 355.98,-700 43.2,-700"/>
64
+ <text text-anchor="start" x="50.2" y="-712.2" font-family="Arial" font-size="14.00">robot_id </text>
65
+ <text text-anchor="start" x="104.68" y="-712.2" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
66
+ <polygon fill="none" stroke="black" points="43.2,-669.2 43.2,-700 355.98,-700 355.98,-669.2 43.2,-669.2"/>
67
+ <text text-anchor="start" x="50.2" y="-681.4" font-family="Arial" font-size="14.00">node_id </text>
68
+ <text text-anchor="start" x="103.92" y="-681.4" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
69
+ <polygon fill="none" stroke="black" points="43.2,-638.4 43.2,-669.2 355.98,-669.2 355.98,-638.4 43.2,-638.4"/>
70
+ <text text-anchor="start" x="50.2" y="-650.6" font-family="Arial" font-size="14.00">first_remembered_at </text>
71
+ <text text-anchor="start" x="183.25" y="-650.6" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
72
+ <polygon fill="none" stroke="black" points="43.2,-607.6 43.2,-638.4 355.98,-638.4 355.98,-607.6 43.2,-607.6"/>
73
+ <text text-anchor="start" x="50.2" y="-619.8" font-family="Arial" font-size="14.00">last_remembered_at </text>
74
+ <text text-anchor="start" x="182.49" y="-619.8" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
75
+ <polygon fill="none" stroke="black" points="43.2,-576.8 43.2,-607.6 355.98,-607.6 355.98,-576.8 43.2,-576.8"/>
76
+ <text text-anchor="start" x="50.2" y="-589" font-family="Arial" font-size="14.00">remember_count </text>
77
+ <text text-anchor="start" x="159.92" y="-589" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
78
+ <polygon fill="none" stroke="black" points="43.2,-546 43.2,-576.8 355.98,-576.8 355.98,-546 43.2,-546"/>
79
+ <text text-anchor="start" x="50.2" y="-558.2" font-family="Arial" font-size="14.00">created_at </text>
80
+ <text text-anchor="start" x="120.25" y="-558.2" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
81
+ <polygon fill="none" stroke="black" points="43.2,-515.2 43.2,-546 355.98,-546 355.98,-515.2 43.2,-515.2"/>
82
+ <text text-anchor="start" x="50.2" y="-527.4" font-family="Arial" font-size="14.00">updated_at </text>
83
+ <text text-anchor="start" x="124.16" y="-527.4" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
84
+ </g>
85
+ <!-- public.robot_nodes&#45;&gt;public.nodes -->
86
+ <g id="edge1" class="edge">
87
+ <title>public.robot_nodes:node_id&#45;&gt;public.nodes:id</title>
88
+ <path fill="none" stroke="black" d="M366.89,-682.57C431.37,-654.23 377.23,-338.8 453.42,-338.8"/>
89
+ <polygon fill="black" stroke="black" points="367.1,-682.53 356.4,-680.12 361.88,-683.6 357.63,-684.47 357.63,-684.47 357.63,-684.47 361.88,-683.6 358.21,-688.94 367.1,-682.53"/>
90
+ <text text-anchor="start" x="363.98" y="-694.6" font-family="Arial" font-size="10.00">FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE</text>
91
+ </g>
92
+ <!-- public.node_tags -->
93
+ <g id="node3" class="node">
94
+ <title>public.node_tags</title>
95
+ <polygon fill="#efefef" stroke="none" points="460.11,-700 460.11,-735.6 721.07,-735.6 721.07,-700 460.11,-700"/>
96
+ <polygon fill="none" stroke="black" points="460.11,-700 460.11,-735.6 721.07,-735.6 721.07,-700 460.11,-700"/>
97
+ <text text-anchor="start" x="467.11" y="-713.4" font-family="Arial Bold" font-size="18.00">public.node_tags</text>
98
+ <text text-anchor="start" x="589.58" y="-713.4" font-family="Arial" font-size="14.00">    </text>
99
+ <text text-anchor="start" x="620.7" y="-713.4" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
100
+ <polygon fill="none" stroke="black" points="460.11,-669.2 460.11,-700 721.07,-700 721.07,-669.2 460.11,-669.2"/>
101
+ <text text-anchor="start" x="467.11" y="-681.4" font-family="Arial" font-size="14.00">id </text>
102
+ <text text-anchor="start" x="481.89" y="-681.4" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
103
+ <polygon fill="none" stroke="black" points="460.11,-638.4 460.11,-669.2 721.07,-669.2 721.07,-638.4 460.11,-638.4"/>
104
+ <text text-anchor="start" x="467.11" y="-650.6" font-family="Arial" font-size="14.00">node_id </text>
105
+ <text text-anchor="start" x="520.82" y="-650.6" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
106
+ <polygon fill="none" stroke="black" points="460.11,-607.6 460.11,-638.4 721.07,-638.4 721.07,-607.6 460.11,-607.6"/>
107
+ <text text-anchor="start" x="467.11" y="-619.8" font-family="Arial" font-size="14.00">tag_id </text>
108
+ <text text-anchor="start" x="509.14" y="-619.8" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
109
+ <polygon fill="none" stroke="black" points="460.11,-576.8 460.11,-607.6 721.07,-607.6 721.07,-576.8 460.11,-576.8"/>
110
+ <text text-anchor="start" x="467.11" y="-589" font-family="Arial" font-size="14.00">created_at </text>
111
+ <text text-anchor="start" x="537.15" y="-589" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
112
+ </g>
113
+ <!-- public.node_tags&#45;&gt;public.nodes -->
114
+ <g id="edge2" class="edge">
115
+ <title>public.node_tags:node_id&#45;&gt;public.nodes:id</title>
116
+ <path fill="none" stroke="black" d="M730.26,-647.51C757.74,-603.11 759.82,-338.8 727.75,-338.8"/>
117
+ <polygon fill="black" stroke="black" points="730.27,-647.51 719.6,-650.03 726.04,-650.75 722.6,-653.39 722.6,-653.39 722.6,-653.39 726.04,-650.75 725.08,-657.17 730.27,-647.51"/>
118
+ <text text-anchor="start" x="375.53" y="-663.8" font-family="Arial" font-size="10.00">FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE</text>
119
+ </g>
120
+ <!-- public.working_memories -->
121
+ <g id="node4" class="node">
122
+ <title>public.working_memories</title>
123
+ <polygon fill="#efefef" stroke="none" points="825.61,-715.4 825.61,-751 1153.57,-751 1153.57,-715.4 825.61,-715.4"/>
124
+ <polygon fill="none" stroke="black" points="825.61,-715.4 825.61,-751 1153.57,-751 1153.57,-715.4 825.61,-715.4"/>
125
+ <text text-anchor="start" x="832.61" y="-728.8" font-family="Arial Bold" font-size="18.00">public.working_memories</text>
126
+ <text text-anchor="start" x="1022.08" y="-728.8" font-family="Arial" font-size="14.00">    </text>
127
+ <text text-anchor="start" x="1053.19" y="-728.8" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
128
+ <polygon fill="none" stroke="black" points="825.61,-684.6 825.61,-715.4 1153.57,-715.4 1153.57,-684.6 825.61,-684.6"/>
129
+ <text text-anchor="start" x="832.61" y="-696.8" font-family="Arial" font-size="14.00">id </text>
130
+ <text text-anchor="start" x="847.4" y="-696.8" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
131
+ <polygon fill="none" stroke="black" points="825.61,-653.8 825.61,-684.6 1153.57,-684.6 1153.57,-653.8 825.61,-653.8"/>
132
+ <text text-anchor="start" x="832.61" y="-666" font-family="Arial" font-size="14.00">robot_id </text>
133
+ <text text-anchor="start" x="887.09" y="-666" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
134
+ <polygon fill="none" stroke="black" points="825.61,-623 825.61,-653.8 1153.57,-653.8 1153.57,-623 825.61,-623"/>
135
+ <text text-anchor="start" x="832.61" y="-635.2" font-family="Arial" font-size="14.00">node_id </text>
136
+ <text text-anchor="start" x="886.33" y="-635.2" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
137
+ <polygon fill="none" stroke="black" points="825.61,-592.2 825.61,-623 1153.57,-623 1153.57,-592.2 825.61,-592.2"/>
138
+ <text text-anchor="start" x="832.61" y="-604.4" font-family="Arial" font-size="14.00">added_at </text>
139
+ <text text-anchor="start" x="894.89" y="-604.4" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
140
+ <polygon fill="none" stroke="black" points="825.61,-561.4 825.61,-592.2 1153.57,-592.2 1153.57,-561.4 825.61,-561.4"/>
141
+ <text text-anchor="start" x="832.61" y="-573.6" font-family="Arial" font-size="14.00">token_count </text>
142
+ <text text-anchor="start" x="912.78" y="-573.6" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
143
+ </g>
144
+ <!-- public.working_memories&#45;&gt;public.nodes -->
145
+ <g id="edge3" class="edge">
146
+ <title>public.working_memories:node_id&#45;&gt;public.nodes:id</title>
147
+ <path fill="none" stroke="black" d="M814.8,-636.16C758.73,-608.74 794.17,-338.8 727.75,-338.8"/>
148
+ <polygon fill="black" stroke="black" points="814.54,-636.1 823.28,-642.71 819.74,-637.29 823.96,-638.25 823.96,-638.25 823.96,-638.25 819.74,-637.29 825.29,-633.94 814.54,-636.1"/>
149
+ <text text-anchor="start" x="566.45" y="-622.4" font-family="Arial" font-size="10.00">FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE</text>
150
+ </g>
151
+ </g>
152
+ </svg>
@@ -0,0 +1,44 @@
1
+ # public.robot_nodes
2
+
3
+ ## Description
4
+
5
+ Join table connecting robots to nodes (many-to-many)
6
+
7
+ ## Columns
8
+
9
+ | Name | Type | Default | Nullable | Children | Parents | Comment |
10
+ | ---- | ---- | ------- | -------- | -------- | ------- | ------- |
11
+ | id | bigint | nextval('robot_nodes_id_seq'::regclass) | false | | | |
12
+ | robot_id | bigint | | false | | [public.robots](public.robots.md) | ID of the robot that remembered this node |
13
+ | node_id | bigint | | false | | [public.nodes](public.nodes.md) | ID of the node being remembered |
14
+ | first_remembered_at | timestamp with time zone | CURRENT_TIMESTAMP | true | | | When this robot first remembered this content |
15
+ | last_remembered_at | timestamp with time zone | CURRENT_TIMESTAMP | true | | | When this robot last tried to remember this content |
16
+ | remember_count | integer | 1 | false | | | Number of times this robot has tried to remember this content |
17
+ | created_at | timestamp with time zone | CURRENT_TIMESTAMP | true | | | |
18
+ | updated_at | timestamp with time zone | CURRENT_TIMESTAMP | true | | | |
19
+
20
+ ## Constraints
21
+
22
+ | Name | Type | Definition |
23
+ | ---- | ---- | ---------- |
24
+ | robot_nodes_pkey | PRIMARY KEY | PRIMARY KEY (id) |
25
+ | fk_rails_9b003078a8 | FOREIGN KEY | FOREIGN KEY (robot_id) REFERENCES robots(id) ON DELETE CASCADE |
26
+ | fk_rails_f2fc98d49e | FOREIGN KEY | FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE |
27
+
28
+ ## Indexes
29
+
30
+ | Name | Definition |
31
+ | ---- | ---------- |
32
+ | robot_nodes_pkey | CREATE UNIQUE INDEX robot_nodes_pkey ON public.robot_nodes USING btree (id) |
33
+ | idx_robot_nodes_unique | CREATE UNIQUE INDEX idx_robot_nodes_unique ON public.robot_nodes USING btree (robot_id, node_id) |
34
+ | idx_robot_nodes_robot_id | CREATE INDEX idx_robot_nodes_robot_id ON public.robot_nodes USING btree (robot_id) |
35
+ | idx_robot_nodes_node_id | CREATE INDEX idx_robot_nodes_node_id ON public.robot_nodes USING btree (node_id) |
36
+ | idx_robot_nodes_last_remembered_at | CREATE INDEX idx_robot_nodes_last_remembered_at ON public.robot_nodes USING btree (last_remembered_at) |
37
+
38
+ ## Relations
39
+
40
+ ![er](public.robot_nodes.svg)
41
+
42
+ ---
43
+
44
+ > Generated by [tbls](https://github.com/k1LoW/tbls)
@@ -0,0 +1,121 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
3
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <!-- Generated by graphviz version 12.1.2 (20240928.0832)
5
+ -->
6
+ <!-- Title: public.robot_nodes Pages: 1 -->
7
+ <svg width="1031pt" height="848pt"
8
+ viewBox="0.00 0.00 1030.96 848.40" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
9
+ <g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 844.4)">
10
+ <title>public.robot_nodes</title>
11
+ <polygon fill="white" stroke="none" points="-4,4 -4,-844.4 1026.96,-844.4 1026.96,4 -4,4"/>
12
+ <!-- public.robot_nodes -->
13
+ <g id="node1" class="node">
14
+ <title>public.robot_nodes</title>
15
+ <polygon fill="#efefef" stroke="none" points="355.64,-758.6 355.64,-794.2 668.42,-794.2 668.42,-758.6 355.64,-758.6"/>
16
+ <polygon fill="none" stroke="black" points="355.64,-758.6 355.64,-794.2 668.42,-794.2 668.42,-758.6 355.64,-758.6"/>
17
+ <text text-anchor="start" x="380.54" y="-772" font-family="Arial Bold" font-size="18.00">public.robot_nodes</text>
18
+ <text text-anchor="start" x="519.02" y="-772" font-family="Arial" font-size="14.00">    </text>
19
+ <text text-anchor="start" x="550.14" y="-772" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
20
+ <polygon fill="none" stroke="black" points="355.64,-727.8 355.64,-758.6 668.42,-758.6 668.42,-727.8 355.64,-727.8"/>
21
+ <text text-anchor="start" x="362.64" y="-740" font-family="Arial" font-size="14.00">id </text>
22
+ <text text-anchor="start" x="377.43" y="-740" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
23
+ <polygon fill="none" stroke="black" points="355.64,-697 355.64,-727.8 668.42,-727.8 668.42,-697 355.64,-697"/>
24
+ <text text-anchor="start" x="362.64" y="-709.2" font-family="Arial" font-size="14.00">robot_id </text>
25
+ <text text-anchor="start" x="417.12" y="-709.2" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
26
+ <polygon fill="none" stroke="black" points="355.64,-666.2 355.64,-697 668.42,-697 668.42,-666.2 355.64,-666.2"/>
27
+ <text text-anchor="start" x="362.64" y="-678.4" font-family="Arial" font-size="14.00">node_id </text>
28
+ <text text-anchor="start" x="416.36" y="-678.4" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
29
+ <polygon fill="none" stroke="black" points="355.64,-635.4 355.64,-666.2 668.42,-666.2 668.42,-635.4 355.64,-635.4"/>
30
+ <text text-anchor="start" x="362.64" y="-647.6" font-family="Arial" font-size="14.00">first_remembered_at </text>
31
+ <text text-anchor="start" x="495.69" y="-647.6" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
32
+ <polygon fill="none" stroke="black" points="355.64,-604.6 355.64,-635.4 668.42,-635.4 668.42,-604.6 355.64,-604.6"/>
33
+ <text text-anchor="start" x="362.64" y="-616.8" font-family="Arial" font-size="14.00">last_remembered_at </text>
34
+ <text text-anchor="start" x="494.93" y="-616.8" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
35
+ <polygon fill="none" stroke="black" points="355.64,-573.8 355.64,-604.6 668.42,-604.6 668.42,-573.8 355.64,-573.8"/>
36
+ <text text-anchor="start" x="362.64" y="-586" font-family="Arial" font-size="14.00">remember_count </text>
37
+ <text text-anchor="start" x="472.36" y="-586" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
38
+ <polygon fill="none" stroke="black" points="355.64,-543 355.64,-573.8 668.42,-573.8 668.42,-543 355.64,-543"/>
39
+ <text text-anchor="start" x="362.64" y="-555.2" font-family="Arial" font-size="14.00">created_at </text>
40
+ <text text-anchor="start" x="432.69" y="-555.2" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
41
+ <polygon fill="none" stroke="black" points="355.64,-512.2 355.64,-543 668.42,-543 668.42,-512.2 355.64,-512.2"/>
42
+ <text text-anchor="start" x="362.64" y="-524.4" font-family="Arial" font-size="14.00">updated_at </text>
43
+ <text text-anchor="start" x="436.6" y="-524.4" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
44
+ <polygon fill="none" stroke="black" stroke-width="3" points="354.14,-510.7 354.14,-795.7 669.92,-795.7 669.92,-510.7 354.14,-510.7"/>
45
+ </g>
46
+ <!-- public.robots -->
47
+ <g id="node2" class="node">
48
+ <title>public.robots</title>
49
+ <polygon fill="#efefef" stroke="none" points="205.14,-258.8 205.14,-294.4 454.91,-294.4 454.91,-258.8 205.14,-258.8"/>
50
+ <polygon fill="none" stroke="black" points="205.14,-258.8 205.14,-294.4 454.91,-294.4 454.91,-258.8 205.14,-258.8"/>
51
+ <text text-anchor="start" x="220.54" y="-272.2" font-family="Arial Bold" font-size="18.00">public.robots</text>
52
+ <text text-anchor="start" x="315.03" y="-272.2" font-family="Arial" font-size="14.00">    </text>
53
+ <text text-anchor="start" x="346.15" y="-272.2" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
54
+ <polygon fill="none" stroke="black" points="205.14,-228 205.14,-258.8 454.91,-258.8 454.91,-228 205.14,-228"/>
55
+ <text text-anchor="start" x="212.14" y="-240.2" font-family="Arial" font-size="14.00">id </text>
56
+ <text text-anchor="start" x="226.93" y="-240.2" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
57
+ <polygon fill="none" stroke="black" points="205.14,-197.2 205.14,-228 454.91,-228 454.91,-197.2 205.14,-197.2"/>
58
+ <text text-anchor="start" x="212.14" y="-209.4" font-family="Arial" font-size="14.00">name </text>
59
+ <text text-anchor="start" x="251.05" y="-209.4" font-family="Arial" font-size="14.00" fill="#666666">[text]</text>
60
+ <polygon fill="none" stroke="black" points="205.14,-166.4 205.14,-197.2 454.91,-197.2 454.91,-166.4 205.14,-166.4"/>
61
+ <text text-anchor="start" x="212.14" y="-178.6" font-family="Arial" font-size="14.00">created_at </text>
62
+ <text text-anchor="start" x="282.19" y="-178.6" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
63
+ <polygon fill="none" stroke="black" points="205.14,-135.6 205.14,-166.4 454.91,-166.4 454.91,-135.6 205.14,-135.6"/>
64
+ <text text-anchor="start" x="212.14" y="-147.8" font-family="Arial" font-size="14.00">last_active </text>
65
+ <text text-anchor="start" x="282.18" y="-147.8" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
66
+ </g>
67
+ <!-- public.robot_nodes&#45;&gt;public.robots -->
68
+ <g id="edge1" class="edge">
69
+ <title>public.robot_nodes:robot_id&#45;&gt;public.robots:id</title>
70
+ <path fill="none" stroke="black" d="M344.23,-712.25C59.79,-703.81 452.83,-343.61 454.91,-337.6 468.66,-298.05 497.78,-243.4 455.91,-243.4"/>
71
+ <polygon fill="black" stroke="black" points="344.31,-712.25 354.24,-716.89 349.64,-712.33 353.97,-712.39 353.97,-712.39 353.97,-712.39 349.64,-712.33 354.37,-707.9 344.31,-712.25"/>
72
+ <text text-anchor="start" x="7" y="-722.4" font-family="Arial" font-size="10.00">FOREIGN KEY (robot_id) REFERENCES robots(id) ON DELETE CASCADE</text>
73
+ </g>
74
+ <!-- public.nodes -->
75
+ <g id="node3" class="node">
76
+ <title>public.nodes</title>
77
+ <polygon fill="#efefef" stroke="none" points="558.86,-351.2 558.86,-386.8 831.19,-386.8 831.19,-351.2 558.86,-351.2"/>
78
+ <polygon fill="none" stroke="black" points="558.86,-351.2 558.86,-386.8 831.19,-386.8 831.19,-351.2 558.86,-351.2"/>
79
+ <text text-anchor="start" x="587.04" y="-364.6" font-family="Arial Bold" font-size="18.00">public.nodes</text>
80
+ <text text-anchor="start" x="678.53" y="-364.6" font-family="Arial" font-size="14.00">    </text>
81
+ <text text-anchor="start" x="709.64" y="-364.6" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
82
+ <polygon fill="none" stroke="black" points="558.86,-320.4 558.86,-351.2 831.19,-351.2 831.19,-320.4 558.86,-320.4"/>
83
+ <text text-anchor="start" x="565.86" y="-332.6" font-family="Arial" font-size="14.00">id </text>
84
+ <text text-anchor="start" x="580.65" y="-332.6" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
85
+ <polygon fill="none" stroke="black" points="558.86,-289.6 558.86,-320.4 831.19,-320.4 831.19,-289.6 558.86,-289.6"/>
86
+ <text text-anchor="start" x="565.86" y="-301.8" font-family="Arial" font-size="14.00">content </text>
87
+ <text text-anchor="start" x="615.68" y="-301.8" font-family="Arial" font-size="14.00" fill="#666666">[text]</text>
88
+ <polygon fill="none" stroke="black" points="558.86,-258.8 558.86,-289.6 831.19,-289.6 831.19,-258.8 558.86,-258.8"/>
89
+ <text text-anchor="start" x="565.86" y="-271" font-family="Arial" font-size="14.00">access_count </text>
90
+ <text text-anchor="start" x="655.36" y="-271" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
91
+ <polygon fill="none" stroke="black" points="558.86,-228 558.86,-258.8 831.19,-258.8 831.19,-228 558.86,-228"/>
92
+ <text text-anchor="start" x="565.86" y="-240.2" font-family="Arial" font-size="14.00">created_at </text>
93
+ <text text-anchor="start" x="635.91" y="-240.2" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
94
+ <polygon fill="none" stroke="black" points="558.86,-197.2 558.86,-228 831.19,-228 831.19,-197.2 558.86,-197.2"/>
95
+ <text text-anchor="start" x="565.86" y="-209.4" font-family="Arial" font-size="14.00">updated_at </text>
96
+ <text text-anchor="start" x="639.82" y="-209.4" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
97
+ <polygon fill="none" stroke="black" points="558.86,-166.4 558.86,-197.2 831.19,-197.2 831.19,-166.4 558.86,-166.4"/>
98
+ <text text-anchor="start" x="565.86" y="-178.6" font-family="Arial" font-size="14.00">last_accessed </text>
99
+ <text text-anchor="start" x="658.47" y="-178.6" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
100
+ <polygon fill="none" stroke="black" points="558.86,-135.6 558.86,-166.4 831.19,-166.4 831.19,-135.6 558.86,-135.6"/>
101
+ <text text-anchor="start" x="565.86" y="-147.8" font-family="Arial" font-size="14.00">token_count </text>
102
+ <text text-anchor="start" x="646.04" y="-147.8" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
103
+ <polygon fill="none" stroke="black" points="558.86,-104.8 558.86,-135.6 831.19,-135.6 831.19,-104.8 558.86,-104.8"/>
104
+ <text text-anchor="start" x="565.86" y="-117" font-family="Arial" font-size="14.00">embedding </text>
105
+ <text text-anchor="start" x="639.03" y="-117" font-family="Arial" font-size="14.00" fill="#666666">[vector(2000)]</text>
106
+ <polygon fill="none" stroke="black" points="558.86,-74 558.86,-104.8 831.19,-104.8 831.19,-74 558.86,-74"/>
107
+ <text text-anchor="start" x="565.86" y="-86.2" font-family="Arial" font-size="14.00">embedding_dimension </text>
108
+ <text text-anchor="start" x="710.63" y="-86.2" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
109
+ <polygon fill="none" stroke="black" points="558.86,-43.2 558.86,-74 831.19,-74 831.19,-43.2 558.86,-43.2"/>
110
+ <text text-anchor="start" x="565.86" y="-55.4" font-family="Arial" font-size="14.00">content_hash </text>
111
+ <text text-anchor="start" x="653.82" y="-55.4" font-family="Arial" font-size="14.00" fill="#666666">[varchar(64)]</text>
112
+ </g>
113
+ <!-- public.robot_nodes&#45;&gt;public.nodes -->
114
+ <g id="edge2" class="edge">
115
+ <title>public.robot_nodes:node_id&#45;&gt;public.nodes:id</title>
116
+ <path fill="none" stroke="black" d="M679.78,-681.01C762.14,-671.17 722.65,-540.53 668.42,-466 638.27,-424.56 589.14,-471.35 558.86,-430 534.13,-396.22 515.99,-335.8 557.86,-335.8"/>
117
+ <polygon fill="black" stroke="black" points="679.74,-681.01 669.5,-677.09 674.41,-681.32 670.09,-681.56 670.09,-681.56 670.09,-681.56 674.41,-681.32 670.01,-686.07 679.74,-681.01"/>
118
+ <text text-anchor="start" x="676.42" y="-691.6" font-family="Arial" font-size="10.00">FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE</text>
119
+ </g>
120
+ </g>
121
+ </svg>
@@ -8,11 +8,10 @@ Registry of all LLM robots using the HTM system
8
8
 
9
9
  | Name | Type | Default | Nullable | Children | Parents | Comment |
10
10
  | ---- | ---- | ------- | -------- | -------- | ------- | ------- |
11
- | id | bigint | nextval('robots_id_seq'::regclass) | false | [public.nodes](public.nodes.md) | | |
11
+ | id | bigint | nextval('robots_id_seq'::regclass) | false | [public.robot_nodes](public.robot_nodes.md) [public.working_memories](public.working_memories.md) | | |
12
12
  | name | text | | true | | | Human-readable name for the robot |
13
13
  | created_at | timestamp with time zone | CURRENT_TIMESTAMP | true | | | When the robot was first registered |
14
14
  | last_active | timestamp with time zone | CURRENT_TIMESTAMP | true | | | Last time the robot accessed the system |
15
- | metadata | jsonb | | true | | | Robot-specific configuration and metadata |
16
15
 
17
16
  ## Constraints
18
17
 
@@ -0,0 +1,106 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
3
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <!-- Generated by graphviz version 12.1.2 (20240928.0832)
5
+ -->
6
+ <!-- Title: public.robots Pages: 1 -->
7
+ <svg width="840pt" height="664pt"
8
+ viewBox="0.00 0.00 839.77 663.60" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
9
+ <g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 659.6)">
10
+ <title>public.robots</title>
11
+ <polygon fill="white" stroke="none" points="-4,4 -4,-659.6 835.77,-659.6 835.77,4 -4,4"/>
12
+ <!-- public.robots -->
13
+ <g id="node1" class="node">
14
+ <title>public.robots</title>
15
+ <polygon fill="#efefef" stroke="none" points="286.7,-169.4 286.7,-205 536.47,-205 536.47,-169.4 286.7,-169.4"/>
16
+ <polygon fill="none" stroke="black" points="286.7,-169.4 286.7,-205 536.47,-205 536.47,-169.4 286.7,-169.4"/>
17
+ <text text-anchor="start" x="302.1" y="-182.8" font-family="Arial Bold" font-size="18.00">public.robots</text>
18
+ <text text-anchor="start" x="396.59" y="-182.8" font-family="Arial" font-size="14.00">    </text>
19
+ <text text-anchor="start" x="427.71" y="-182.8" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
20
+ <polygon fill="none" stroke="black" points="286.7,-138.6 286.7,-169.4 536.47,-169.4 536.47,-138.6 286.7,-138.6"/>
21
+ <text text-anchor="start" x="293.7" y="-150.8" font-family="Arial" font-size="14.00">id </text>
22
+ <text text-anchor="start" x="308.49" y="-150.8" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
23
+ <polygon fill="none" stroke="black" points="286.7,-107.8 286.7,-138.6 536.47,-138.6 536.47,-107.8 286.7,-107.8"/>
24
+ <text text-anchor="start" x="293.7" y="-120" font-family="Arial" font-size="14.00">name </text>
25
+ <text text-anchor="start" x="332.61" y="-120" font-family="Arial" font-size="14.00" fill="#666666">[text]</text>
26
+ <polygon fill="none" stroke="black" points="286.7,-77 286.7,-107.8 536.47,-107.8 536.47,-77 286.7,-77"/>
27
+ <text text-anchor="start" x="293.7" y="-89.2" font-family="Arial" font-size="14.00">created_at </text>
28
+ <text text-anchor="start" x="363.75" y="-89.2" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
29
+ <polygon fill="none" stroke="black" points="286.7,-46.2 286.7,-77 536.47,-77 536.47,-46.2 286.7,-46.2"/>
30
+ <text text-anchor="start" x="293.7" y="-58.4" font-family="Arial" font-size="14.00">last_active </text>
31
+ <text text-anchor="start" x="363.74" y="-58.4" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
32
+ <polygon fill="none" stroke="black" stroke-width="3" points="285.2,-44.7 285.2,-206.5 537.97,-206.5 537.97,-44.7 285.2,-44.7"/>
33
+ </g>
34
+ <!-- public.robot_nodes -->
35
+ <g id="node2" class="node">
36
+ <title>public.robot_nodes</title>
37
+ <polygon fill="#efefef" stroke="none" points="43.2,-576.8 43.2,-612.4 355.98,-612.4 355.98,-576.8 43.2,-576.8"/>
38
+ <polygon fill="none" stroke="black" points="43.2,-576.8 43.2,-612.4 355.98,-612.4 355.98,-576.8 43.2,-576.8"/>
39
+ <text text-anchor="start" x="68.1" y="-590.2" font-family="Arial Bold" font-size="18.00">public.robot_nodes</text>
40
+ <text text-anchor="start" x="206.58" y="-590.2" font-family="Arial" font-size="14.00">    </text>
41
+ <text text-anchor="start" x="237.7" y="-590.2" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
42
+ <polygon fill="none" stroke="black" points="43.2,-546 43.2,-576.8 355.98,-576.8 355.98,-546 43.2,-546"/>
43
+ <text text-anchor="start" x="50.2" y="-558.2" font-family="Arial" font-size="14.00">id </text>
44
+ <text text-anchor="start" x="64.99" y="-558.2" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
45
+ <polygon fill="none" stroke="black" points="43.2,-515.2 43.2,-546 355.98,-546 355.98,-515.2 43.2,-515.2"/>
46
+ <text text-anchor="start" x="50.2" y="-527.4" font-family="Arial" font-size="14.00">robot_id </text>
47
+ <text text-anchor="start" x="104.68" y="-527.4" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
48
+ <polygon fill="none" stroke="black" points="43.2,-484.4 43.2,-515.2 355.98,-515.2 355.98,-484.4 43.2,-484.4"/>
49
+ <text text-anchor="start" x="50.2" y="-496.6" font-family="Arial" font-size="14.00">node_id </text>
50
+ <text text-anchor="start" x="103.92" y="-496.6" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
51
+ <polygon fill="none" stroke="black" points="43.2,-453.6 43.2,-484.4 355.98,-484.4 355.98,-453.6 43.2,-453.6"/>
52
+ <text text-anchor="start" x="50.2" y="-465.8" font-family="Arial" font-size="14.00">first_remembered_at </text>
53
+ <text text-anchor="start" x="183.25" y="-465.8" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
54
+ <polygon fill="none" stroke="black" points="43.2,-422.8 43.2,-453.6 355.98,-453.6 355.98,-422.8 43.2,-422.8"/>
55
+ <text text-anchor="start" x="50.2" y="-435" font-family="Arial" font-size="14.00">last_remembered_at </text>
56
+ <text text-anchor="start" x="182.49" y="-435" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
57
+ <polygon fill="none" stroke="black" points="43.2,-392 43.2,-422.8 355.98,-422.8 355.98,-392 43.2,-392"/>
58
+ <text text-anchor="start" x="50.2" y="-404.2" font-family="Arial" font-size="14.00">remember_count </text>
59
+ <text text-anchor="start" x="159.92" y="-404.2" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
60
+ <polygon fill="none" stroke="black" points="43.2,-361.2 43.2,-392 355.98,-392 355.98,-361.2 43.2,-361.2"/>
61
+ <text text-anchor="start" x="50.2" y="-373.4" font-family="Arial" font-size="14.00">created_at </text>
62
+ <text text-anchor="start" x="120.25" y="-373.4" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
63
+ <polygon fill="none" stroke="black" points="43.2,-330.4 43.2,-361.2 355.98,-361.2 355.98,-330.4 43.2,-330.4"/>
64
+ <text text-anchor="start" x="50.2" y="-342.6" font-family="Arial" font-size="14.00">updated_at </text>
65
+ <text text-anchor="start" x="124.16" y="-342.6" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
66
+ </g>
67
+ <!-- public.robot_nodes&#45;&gt;public.robots -->
68
+ <g id="edge1" class="edge">
69
+ <title>public.robot_nodes:robot_id&#45;&gt;public.robots:id</title>
70
+ <path fill="none" stroke="black" d="M366.96,-527.95C407.38,-504.34 382.22,-330.22 355.98,-287.2 337.91,-257.58 304.87,-280.76 286.7,-251.2 264.09,-214.39 242.5,-154 285.7,-154"/>
71
+ <polygon fill="black" stroke="black" points="366.97,-527.94 356.15,-526.17 361.81,-529.32 357.62,-530.43 357.62,-530.43 357.62,-530.43 361.81,-529.32 358.46,-534.86 366.97,-527.94"/>
72
+ <text text-anchor="start" x="363.98" y="-540.6" font-family="Arial" font-size="10.00">FOREIGN KEY (robot_id) REFERENCES robots(id) ON DELETE CASCADE</text>
73
+ </g>
74
+ <!-- public.working_memories -->
75
+ <g id="node3" class="node">
76
+ <title>public.working_memories</title>
77
+ <polygon fill="#efefef" stroke="none" points="460.61,-530.6 460.61,-566.2 788.57,-566.2 788.57,-530.6 460.61,-530.6"/>
78
+ <polygon fill="none" stroke="black" points="460.61,-530.6 460.61,-566.2 788.57,-566.2 788.57,-530.6 460.61,-530.6"/>
79
+ <text text-anchor="start" x="467.61" y="-544" font-family="Arial Bold" font-size="18.00">public.working_memories</text>
80
+ <text text-anchor="start" x="657.08" y="-544" font-family="Arial" font-size="14.00">    </text>
81
+ <text text-anchor="start" x="688.19" y="-544" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
82
+ <polygon fill="none" stroke="black" points="460.61,-499.8 460.61,-530.6 788.57,-530.6 788.57,-499.8 460.61,-499.8"/>
83
+ <text text-anchor="start" x="467.61" y="-512" font-family="Arial" font-size="14.00">id </text>
84
+ <text text-anchor="start" x="482.4" y="-512" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
85
+ <polygon fill="none" stroke="black" points="460.61,-469 460.61,-499.8 788.57,-499.8 788.57,-469 460.61,-469"/>
86
+ <text text-anchor="start" x="467.61" y="-481.2" font-family="Arial" font-size="14.00">robot_id </text>
87
+ <text text-anchor="start" x="522.09" y="-481.2" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
88
+ <polygon fill="none" stroke="black" points="460.61,-438.2 460.61,-469 788.57,-469 788.57,-438.2 460.61,-438.2"/>
89
+ <text text-anchor="start" x="467.61" y="-450.4" font-family="Arial" font-size="14.00">node_id </text>
90
+ <text text-anchor="start" x="521.33" y="-450.4" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
91
+ <polygon fill="none" stroke="black" points="460.61,-407.4 460.61,-438.2 788.57,-438.2 788.57,-407.4 460.61,-407.4"/>
92
+ <text text-anchor="start" x="467.61" y="-419.6" font-family="Arial" font-size="14.00">added_at </text>
93
+ <text text-anchor="start" x="529.89" y="-419.6" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
94
+ <polygon fill="none" stroke="black" points="460.61,-376.6 460.61,-407.4 788.57,-407.4 788.57,-376.6 460.61,-376.6"/>
95
+ <text text-anchor="start" x="467.61" y="-388.8" font-family="Arial" font-size="14.00">token_count </text>
96
+ <text text-anchor="start" x="547.78" y="-388.8" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
97
+ </g>
98
+ <!-- public.working_memories&#45;&gt;public.robots -->
99
+ <g id="edge2" class="edge">
100
+ <title>public.working_memories:robot_id&#45;&gt;public.robots:id</title>
101
+ <path fill="none" stroke="black" d="M449.25,-483.57C397.36,-474.45 437.36,-392.29 460.61,-333.4 478.87,-287.16 518.14,-297.41 536.47,-251.2 552.41,-211.04 580.68,-154 537.47,-154"/>
102
+ <polygon fill="black" stroke="black" points="449.31,-483.57 458.92,-488.86 454.63,-484 458.94,-484.35 458.94,-484.35 458.94,-484.35 454.63,-484 459.64,-479.89 449.31,-483.57"/>
103
+ <text text-anchor="start" x="466.61" y="-494.4" font-family="Arial" font-size="10.00">FOREIGN KEY (robot_id) REFERENCES robots(id) ON DELETE CASCADE</text>
104
+ </g>
105
+ </g>
106
+ </svg>
@@ -0,0 +1,40 @@
1
+ # public.working_memories
2
+
3
+ ## Description
4
+
5
+ Per-robot working memory state (optional persistence)
6
+
7
+ ## Columns
8
+
9
+ | Name | Type | Default | Nullable | Children | Parents | Comment |
10
+ | ---- | ---- | ------- | -------- | -------- | ------- | ------- |
11
+ | id | bigint | nextval('working_memories_id_seq'::regclass) | false | | | |
12
+ | robot_id | bigint | | false | | [public.robots](public.robots.md) | Robot whose working memory this belongs to |
13
+ | node_id | bigint | | false | | [public.nodes](public.nodes.md) | Node currently in working memory |
14
+ | added_at | timestamp with time zone | CURRENT_TIMESTAMP | true | | | When node was added to working memory |
15
+ | token_count | integer | | true | | | Cached token count for budget tracking |
16
+
17
+ ## Constraints
18
+
19
+ | Name | Type | Definition |
20
+ | ---- | ---- | ---------- |
21
+ | fk_rails_4b7c3eb07b | FOREIGN KEY | FOREIGN KEY (robot_id) REFERENCES robots(id) ON DELETE CASCADE |
22
+ | fk_rails_2c1d8b383c | FOREIGN KEY | FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE |
23
+ | working_memories_pkey | PRIMARY KEY | PRIMARY KEY (id) |
24
+
25
+ ## Indexes
26
+
27
+ | Name | Definition |
28
+ | ---- | ---------- |
29
+ | working_memories_pkey | CREATE UNIQUE INDEX working_memories_pkey ON public.working_memories USING btree (id) |
30
+ | idx_working_memories_robot_id | CREATE INDEX idx_working_memories_robot_id ON public.working_memories USING btree (robot_id) |
31
+ | idx_working_memories_node_id | CREATE INDEX idx_working_memories_node_id ON public.working_memories USING btree (node_id) |
32
+ | idx_working_memories_unique | CREATE UNIQUE INDEX idx_working_memories_unique ON public.working_memories USING btree (robot_id, node_id) |
33
+
34
+ ## Relations
35
+
36
+ ![er](public.working_memories.svg)
37
+
38
+ ---
39
+
40
+ > Generated by [tbls](https://github.com/k1LoW/tbls)