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.
- checksums.yaml +4 -4
- data/.envrc +1 -0
- data/.tbls.yml +30 -0
- data/CHANGELOG.md +30 -0
- data/SETUP.md +132 -101
- data/db/migrate/20250125000001_add_content_hash_to_nodes.rb +14 -0
- data/db/migrate/20250125000002_create_robot_nodes.rb +35 -0
- data/db/migrate/20250125000003_remove_source_and_robot_id_from_nodes.rb +28 -0
- data/db/migrate/20250126000001_create_working_memories.rb +19 -0
- data/db/migrate/20250126000002_remove_unused_columns.rb +12 -0
- data/db/schema.sql +226 -43
- data/docs/api/database.md +20 -232
- data/docs/api/embedding-service.md +1 -7
- data/docs/api/htm.md +195 -449
- data/docs/api/index.md +1 -7
- data/docs/api/long-term-memory.md +342 -590
- data/docs/architecture/adrs/001-postgresql-timescaledb.md +1 -1
- data/docs/architecture/adrs/003-ollama-embeddings.md +1 -1
- data/docs/architecture/adrs/010-redis-working-memory-rejected.md +2 -27
- data/docs/architecture/adrs/index.md +2 -13
- data/docs/architecture/hive-mind.md +165 -166
- data/docs/architecture/index.md +2 -2
- data/docs/architecture/overview.md +5 -171
- data/docs/architecture/two-tier-memory.md +1 -35
- data/docs/assets/images/adr-010-current-architecture.svg +37 -0
- data/docs/assets/images/adr-010-proposed-architecture.svg +48 -0
- data/docs/assets/images/adr-dependency-tree.svg +93 -0
- data/docs/assets/images/class-hierarchy.svg +55 -0
- data/docs/assets/images/exception-hierarchy.svg +45 -0
- data/docs/assets/images/htm-architecture-overview.svg +83 -0
- data/docs/assets/images/htm-complete-memory-flow.svg +160 -0
- data/docs/assets/images/htm-context-assembly-flow.svg +148 -0
- data/docs/assets/images/htm-eviction-process.svg +141 -0
- data/docs/assets/images/htm-memory-addition-flow.svg +138 -0
- data/docs/assets/images/htm-memory-recall-flow.svg +152 -0
- data/docs/assets/images/htm-node-states.svg +123 -0
- data/docs/assets/images/project-structure.svg +78 -0
- data/docs/assets/images/test-directory-structure.svg +38 -0
- data/{dbdoc → docs/database}/README.md +5 -3
- data/{dbdoc → docs/database}/public.node_tags.md +4 -5
- data/docs/database/public.node_tags.svg +106 -0
- data/{dbdoc → docs/database}/public.nodes.md +3 -8
- data/docs/database/public.nodes.svg +152 -0
- data/docs/database/public.robot_nodes.md +44 -0
- data/docs/database/public.robot_nodes.svg +121 -0
- data/{dbdoc → docs/database}/public.robots.md +1 -2
- data/docs/database/public.robots.svg +106 -0
- data/docs/database/public.working_memories.md +40 -0
- data/docs/database/public.working_memories.svg +112 -0
- data/{dbdoc → docs/database}/schema.json +342 -110
- data/docs/database/schema.svg +223 -0
- data/docs/development/index.md +1 -29
- data/docs/development/schema.md +84 -324
- data/docs/development/testing.md +1 -9
- data/docs/getting-started/index.md +47 -0
- data/docs/{installation.md → getting-started/installation.md} +2 -2
- data/docs/{quick-start.md → getting-started/quick-start.md} +5 -5
- data/docs/guides/adding-memories.md +221 -655
- data/docs/guides/search-strategies.md +85 -51
- data/docs/images/htm-er-diagram.svg +156 -0
- data/docs/index.md +16 -31
- data/docs/multi_framework_support.md +4 -4
- data/examples/basic_usage.rb +18 -16
- data/examples/cli_app/htm_cli.rb +86 -8
- data/examples/custom_llm_configuration.rb +1 -2
- data/examples/example_app/app.rb +11 -14
- data/examples/sinatra_app/Gemfile +1 -0
- data/examples/sinatra_app/Gemfile.lock +166 -0
- data/examples/sinatra_app/app.rb +219 -24
- data/lib/htm/active_record_config.rb +10 -3
- data/lib/htm/configuration.rb +265 -78
- data/lib/htm/{sinatra.rb → integrations/sinatra.rb} +87 -12
- data/lib/htm/job_adapter.rb +10 -3
- data/lib/htm/long_term_memory.rb +220 -57
- data/lib/htm/models/node.rb +36 -7
- data/lib/htm/models/robot.rb +30 -4
- data/lib/htm/models/robot_node.rb +50 -0
- data/lib/htm/models/tag.rb +52 -0
- data/lib/htm/models/working_memory_entry.rb +88 -0
- data/lib/htm/tasks.rb +4 -0
- data/lib/htm/version.rb +1 -1
- data/lib/htm.rb +34 -13
- data/lib/tasks/htm.rake +32 -1
- data/lib/tasks/jobs.rake +7 -3
- data/lib/tasks/tags.rake +34 -0
- data/mkdocs.yml +56 -9
- metadata +61 -31
- data/dbdoc/public.node_tags.svg +0 -112
- data/dbdoc/public.nodes.svg +0 -118
- data/dbdoc/public.robots.svg +0 -90
- data/dbdoc/schema.svg +0 -154
- /data/{dbdoc → docs/database}/public.node_stats.md +0 -0
- /data/{dbdoc → docs/database}/public.node_stats.svg +0 -0
- /data/{dbdoc → docs/database}/public.nodes_tags.md +0 -0
- /data/{dbdoc → docs/database}/public.nodes_tags.svg +0 -0
- /data/{dbdoc → docs/database}/public.ontology_structure.md +0 -0
- /data/{dbdoc → docs/database}/public.ontology_structure.svg +0 -0
- /data/{dbdoc → docs/database}/public.operations_log.md +0 -0
- /data/{dbdoc → docs/database}/public.operations_log.svg +0 -0
- /data/{dbdoc → docs/database}/public.relationships.md +0 -0
- /data/{dbdoc → docs/database}/public.relationships.svg +0 -0
- /data/{dbdoc → docs/database}/public.robot_activity.md +0 -0
- /data/{dbdoc → docs/database}/public.robot_activity.svg +0 -0
- /data/{dbdoc → docs/database}/public.schema_migrations.md +0 -0
- /data/{dbdoc → docs/database}/public.schema_migrations.svg +0 -0
- /data/{dbdoc → docs/database}/public.tags.md +0 -0
- /data/{dbdoc → docs/database}/public.tags.svg +0 -0
- /data/{dbdoc → docs/database}/public.topic_relationships.md +0 -0
- /data/{dbdoc → docs/database}/public.topic_relationships.svg +0 -0
|
@@ -2,111 +2,137 @@
|
|
|
2
2
|
"name": "htm_development",
|
|
3
3
|
"tables": [
|
|
4
4
|
{
|
|
5
|
-
"name": "public.
|
|
5
|
+
"name": "public.robot_nodes",
|
|
6
6
|
"type": "BASE TABLE",
|
|
7
|
-
"comment": "Join table connecting
|
|
7
|
+
"comment": "Join table connecting robots to nodes (many-to-many)",
|
|
8
8
|
"columns": [
|
|
9
9
|
{
|
|
10
10
|
"name": "id",
|
|
11
11
|
"type": "bigint",
|
|
12
12
|
"nullable": false,
|
|
13
|
-
"default": "nextval('
|
|
13
|
+
"default": "nextval('robot_nodes_id_seq'::regclass)"
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
|
-
"name": "
|
|
16
|
+
"name": "robot_id",
|
|
17
17
|
"type": "bigint",
|
|
18
|
-
"nullable": false
|
|
18
|
+
"nullable": false,
|
|
19
|
+
"comment": "ID of the robot that remembered this node"
|
|
19
20
|
},
|
|
20
21
|
{
|
|
21
|
-
"name": "
|
|
22
|
+
"name": "node_id",
|
|
22
23
|
"type": "bigint",
|
|
23
|
-
"nullable": false
|
|
24
|
+
"nullable": false,
|
|
25
|
+
"comment": "ID of the node being remembered"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "first_remembered_at",
|
|
29
|
+
"type": "timestamp with time zone",
|
|
30
|
+
"nullable": true,
|
|
31
|
+
"default": "CURRENT_TIMESTAMP",
|
|
32
|
+
"comment": "When this robot first remembered this content"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "last_remembered_at",
|
|
36
|
+
"type": "timestamp with time zone",
|
|
37
|
+
"nullable": true,
|
|
38
|
+
"default": "CURRENT_TIMESTAMP",
|
|
39
|
+
"comment": "When this robot last tried to remember this content"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "remember_count",
|
|
43
|
+
"type": "integer",
|
|
44
|
+
"nullable": false,
|
|
45
|
+
"default": "1",
|
|
46
|
+
"comment": "Number of times this robot has tried to remember this content"
|
|
24
47
|
},
|
|
25
48
|
{
|
|
26
49
|
"name": "created_at",
|
|
27
50
|
"type": "timestamp with time zone",
|
|
28
51
|
"nullable": true,
|
|
29
52
|
"default": "CURRENT_TIMESTAMP"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "updated_at",
|
|
56
|
+
"type": "timestamp with time zone",
|
|
57
|
+
"nullable": true,
|
|
58
|
+
"default": "CURRENT_TIMESTAMP"
|
|
30
59
|
}
|
|
31
60
|
],
|
|
32
61
|
"indexes": [
|
|
33
62
|
{
|
|
34
|
-
"name": "
|
|
35
|
-
"def": "CREATE UNIQUE INDEX
|
|
36
|
-
"table": "public.
|
|
63
|
+
"name": "robot_nodes_pkey",
|
|
64
|
+
"def": "CREATE UNIQUE INDEX robot_nodes_pkey ON public.robot_nodes USING btree (id)",
|
|
65
|
+
"table": "public.robot_nodes",
|
|
37
66
|
"columns": [
|
|
38
67
|
"id"
|
|
39
68
|
]
|
|
40
69
|
},
|
|
41
70
|
{
|
|
42
|
-
"name": "
|
|
43
|
-
"def": "CREATE UNIQUE INDEX
|
|
44
|
-
"table": "public.
|
|
71
|
+
"name": "idx_robot_nodes_unique",
|
|
72
|
+
"def": "CREATE UNIQUE INDEX idx_robot_nodes_unique ON public.robot_nodes USING btree (robot_id, node_id)",
|
|
73
|
+
"table": "public.robot_nodes",
|
|
45
74
|
"columns": [
|
|
46
|
-
"
|
|
47
|
-
"
|
|
75
|
+
"robot_id",
|
|
76
|
+
"node_id"
|
|
48
77
|
]
|
|
49
78
|
},
|
|
50
79
|
{
|
|
51
|
-
"name": "
|
|
52
|
-
"def": "CREATE INDEX
|
|
53
|
-
"table": "public.
|
|
80
|
+
"name": "idx_robot_nodes_robot_id",
|
|
81
|
+
"def": "CREATE INDEX idx_robot_nodes_robot_id ON public.robot_nodes USING btree (robot_id)",
|
|
82
|
+
"table": "public.robot_nodes",
|
|
83
|
+
"columns": [
|
|
84
|
+
"robot_id"
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"name": "idx_robot_nodes_node_id",
|
|
89
|
+
"def": "CREATE INDEX idx_robot_nodes_node_id ON public.robot_nodes USING btree (node_id)",
|
|
90
|
+
"table": "public.robot_nodes",
|
|
54
91
|
"columns": [
|
|
55
92
|
"node_id"
|
|
56
93
|
]
|
|
57
94
|
},
|
|
58
95
|
{
|
|
59
|
-
"name": "
|
|
60
|
-
"def": "CREATE INDEX
|
|
61
|
-
"table": "public.
|
|
96
|
+
"name": "idx_robot_nodes_last_remembered_at",
|
|
97
|
+
"def": "CREATE INDEX idx_robot_nodes_last_remembered_at ON public.robot_nodes USING btree (last_remembered_at)",
|
|
98
|
+
"table": "public.robot_nodes",
|
|
62
99
|
"columns": [
|
|
63
|
-
"
|
|
100
|
+
"last_remembered_at"
|
|
64
101
|
]
|
|
65
102
|
}
|
|
66
103
|
],
|
|
67
104
|
"constraints": [
|
|
68
105
|
{
|
|
69
|
-
"name": "
|
|
106
|
+
"name": "robot_nodes_pkey",
|
|
70
107
|
"type": "PRIMARY KEY",
|
|
71
108
|
"def": "PRIMARY KEY (id)",
|
|
72
|
-
"table": "public.
|
|
109
|
+
"table": "public.robot_nodes",
|
|
73
110
|
"referenced_table": "",
|
|
74
111
|
"columns": [
|
|
75
112
|
"id"
|
|
76
113
|
]
|
|
77
114
|
},
|
|
78
115
|
{
|
|
79
|
-
"name": "
|
|
80
|
-
"type": "UNIQUE",
|
|
81
|
-
"def": "UNIQUE (node_id, tag_id)",
|
|
82
|
-
"table": "public.node_tags",
|
|
83
|
-
"referenced_table": "",
|
|
84
|
-
"columns": [
|
|
85
|
-
"node_id",
|
|
86
|
-
"tag_id"
|
|
87
|
-
]
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
"name": "fk_rails_ebc9aafd9f",
|
|
116
|
+
"name": "fk_rails_9b003078a8",
|
|
91
117
|
"type": "FOREIGN KEY",
|
|
92
|
-
"def": "FOREIGN KEY (
|
|
93
|
-
"table": "public.
|
|
94
|
-
"referenced_table": "
|
|
118
|
+
"def": "FOREIGN KEY (robot_id) REFERENCES robots(id) ON DELETE CASCADE",
|
|
119
|
+
"table": "public.robot_nodes",
|
|
120
|
+
"referenced_table": "robots",
|
|
95
121
|
"columns": [
|
|
96
|
-
"
|
|
122
|
+
"robot_id"
|
|
97
123
|
],
|
|
98
124
|
"referenced_columns": [
|
|
99
125
|
"id"
|
|
100
126
|
]
|
|
101
127
|
},
|
|
102
128
|
{
|
|
103
|
-
"name": "
|
|
129
|
+
"name": "fk_rails_f2fc98d49e",
|
|
104
130
|
"type": "FOREIGN KEY",
|
|
105
|
-
"def": "FOREIGN KEY (
|
|
106
|
-
"table": "public.
|
|
107
|
-
"referenced_table": "
|
|
131
|
+
"def": "FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE",
|
|
132
|
+
"table": "public.robot_nodes",
|
|
133
|
+
"referenced_table": "nodes",
|
|
108
134
|
"columns": [
|
|
109
|
-
"
|
|
135
|
+
"node_id"
|
|
110
136
|
],
|
|
111
137
|
"referenced_columns": [
|
|
112
138
|
"id"
|
|
@@ -177,12 +203,6 @@
|
|
|
177
203
|
"nullable": true,
|
|
178
204
|
"default": "CURRENT_TIMESTAMP",
|
|
179
205
|
"comment": "Last time the robot accessed the system"
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
"name": "metadata",
|
|
183
|
-
"type": "jsonb",
|
|
184
|
-
"nullable": true,
|
|
185
|
-
"comment": "Robot-specific configuration and metadata"
|
|
186
206
|
}
|
|
187
207
|
],
|
|
188
208
|
"indexes": [
|
|
@@ -225,13 +245,6 @@
|
|
|
225
245
|
"nullable": false,
|
|
226
246
|
"comment": "The conversation message/utterance content"
|
|
227
247
|
},
|
|
228
|
-
{
|
|
229
|
-
"name": "source",
|
|
230
|
-
"type": "text",
|
|
231
|
-
"nullable": true,
|
|
232
|
-
"default": "''::text",
|
|
233
|
-
"comment": "From where the content came (empty string if unknown)"
|
|
234
|
-
},
|
|
235
248
|
{
|
|
236
249
|
"name": "access_count",
|
|
237
250
|
"type": "integer",
|
|
@@ -266,19 +279,6 @@
|
|
|
266
279
|
"nullable": true,
|
|
267
280
|
"comment": "Number of tokens in the content (for context budget management)"
|
|
268
281
|
},
|
|
269
|
-
{
|
|
270
|
-
"name": "in_working_memory",
|
|
271
|
-
"type": "boolean",
|
|
272
|
-
"nullable": true,
|
|
273
|
-
"default": "false",
|
|
274
|
-
"comment": "Whether this memory is currently in working memory"
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
"name": "robot_id",
|
|
278
|
-
"type": "bigint",
|
|
279
|
-
"nullable": false,
|
|
280
|
-
"comment": "ID of the robot that owns this memory"
|
|
281
|
-
},
|
|
282
282
|
{
|
|
283
283
|
"name": "embedding",
|
|
284
284
|
"type": "vector(2000)",
|
|
@@ -290,6 +290,12 @@
|
|
|
290
290
|
"type": "integer",
|
|
291
291
|
"nullable": true,
|
|
292
292
|
"comment": "Actual number of dimensions used in the embedding vector (max 2000)"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"name": "content_hash",
|
|
296
|
+
"type": "varchar(64)",
|
|
297
|
+
"nullable": true,
|
|
298
|
+
"comment": "SHA-256 hash of content for deduplication"
|
|
293
299
|
}
|
|
294
300
|
],
|
|
295
301
|
"indexes": [
|
|
@@ -333,30 +339,6 @@
|
|
|
333
339
|
"access_count"
|
|
334
340
|
]
|
|
335
341
|
},
|
|
336
|
-
{
|
|
337
|
-
"name": "idx_nodes_robot_id",
|
|
338
|
-
"def": "CREATE INDEX idx_nodes_robot_id ON public.nodes USING btree (robot_id)",
|
|
339
|
-
"table": "public.nodes",
|
|
340
|
-
"columns": [
|
|
341
|
-
"robot_id"
|
|
342
|
-
]
|
|
343
|
-
},
|
|
344
|
-
{
|
|
345
|
-
"name": "idx_nodes_source",
|
|
346
|
-
"def": "CREATE INDEX idx_nodes_source ON public.nodes USING btree (source)",
|
|
347
|
-
"table": "public.nodes",
|
|
348
|
-
"columns": [
|
|
349
|
-
"source"
|
|
350
|
-
]
|
|
351
|
-
},
|
|
352
|
-
{
|
|
353
|
-
"name": "idx_nodes_in_working_memory",
|
|
354
|
-
"def": "CREATE INDEX idx_nodes_in_working_memory ON public.nodes USING btree (in_working_memory)",
|
|
355
|
-
"table": "public.nodes",
|
|
356
|
-
"columns": [
|
|
357
|
-
"in_working_memory"
|
|
358
|
-
]
|
|
359
|
-
},
|
|
360
342
|
{
|
|
361
343
|
"name": "idx_nodes_embedding",
|
|
362
344
|
"def": "CREATE INDEX idx_nodes_embedding ON public.nodes USING hnsw (embedding vector_cosine_ops) WITH (m='16', ef_construction='64')",
|
|
@@ -380,6 +362,14 @@
|
|
|
380
362
|
"columns": [
|
|
381
363
|
"content"
|
|
382
364
|
]
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
"name": "idx_nodes_content_hash_unique",
|
|
368
|
+
"def": "CREATE UNIQUE INDEX idx_nodes_content_hash_unique ON public.nodes USING btree (content_hash)",
|
|
369
|
+
"table": "public.nodes",
|
|
370
|
+
"columns": [
|
|
371
|
+
"content_hash"
|
|
372
|
+
]
|
|
383
373
|
}
|
|
384
374
|
],
|
|
385
375
|
"constraints": [
|
|
@@ -393,19 +383,6 @@
|
|
|
393
383
|
"embedding_dimension"
|
|
394
384
|
]
|
|
395
385
|
},
|
|
396
|
-
{
|
|
397
|
-
"name": "fk_rails_60162e9d3a",
|
|
398
|
-
"type": "FOREIGN KEY",
|
|
399
|
-
"def": "FOREIGN KEY (robot_id) REFERENCES robots(id) ON DELETE CASCADE",
|
|
400
|
-
"table": "public.nodes",
|
|
401
|
-
"referenced_table": "robots",
|
|
402
|
-
"columns": [
|
|
403
|
-
"robot_id"
|
|
404
|
-
],
|
|
405
|
-
"referenced_columns": [
|
|
406
|
-
"id"
|
|
407
|
-
]
|
|
408
|
-
},
|
|
409
386
|
{
|
|
410
387
|
"name": "nodes_pkey",
|
|
411
388
|
"type": "PRIMARY KEY",
|
|
@@ -481,9 +458,251 @@
|
|
|
481
458
|
]
|
|
482
459
|
}
|
|
483
460
|
]
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
"name": "public.node_tags",
|
|
464
|
+
"type": "BASE TABLE",
|
|
465
|
+
"comment": "Join table connecting nodes to tags (many-to-many)",
|
|
466
|
+
"columns": [
|
|
467
|
+
{
|
|
468
|
+
"name": "id",
|
|
469
|
+
"type": "bigint",
|
|
470
|
+
"nullable": false,
|
|
471
|
+
"default": "nextval('node_tags_id_seq'::regclass)"
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
"name": "node_id",
|
|
475
|
+
"type": "bigint",
|
|
476
|
+
"nullable": false,
|
|
477
|
+
"comment": "ID of the node being tagged"
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
"name": "tag_id",
|
|
481
|
+
"type": "bigint",
|
|
482
|
+
"nullable": false,
|
|
483
|
+
"comment": "ID of the tag being applied"
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
"name": "created_at",
|
|
487
|
+
"type": "timestamp with time zone",
|
|
488
|
+
"nullable": true,
|
|
489
|
+
"default": "CURRENT_TIMESTAMP",
|
|
490
|
+
"comment": "When this association was created"
|
|
491
|
+
}
|
|
492
|
+
],
|
|
493
|
+
"indexes": [
|
|
494
|
+
{
|
|
495
|
+
"name": "node_tags_pkey",
|
|
496
|
+
"def": "CREATE UNIQUE INDEX node_tags_pkey ON public.node_tags USING btree (id)",
|
|
497
|
+
"table": "public.node_tags",
|
|
498
|
+
"columns": [
|
|
499
|
+
"id"
|
|
500
|
+
]
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
"name": "idx_node_tags_unique",
|
|
504
|
+
"def": "CREATE UNIQUE INDEX idx_node_tags_unique ON public.node_tags USING btree (node_id, tag_id)",
|
|
505
|
+
"table": "public.node_tags",
|
|
506
|
+
"columns": [
|
|
507
|
+
"node_id",
|
|
508
|
+
"tag_id"
|
|
509
|
+
]
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
"name": "idx_node_tags_node_id",
|
|
513
|
+
"def": "CREATE INDEX idx_node_tags_node_id ON public.node_tags USING btree (node_id)",
|
|
514
|
+
"table": "public.node_tags",
|
|
515
|
+
"columns": [
|
|
516
|
+
"node_id"
|
|
517
|
+
]
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
"name": "idx_node_tags_tag_id",
|
|
521
|
+
"def": "CREATE INDEX idx_node_tags_tag_id ON public.node_tags USING btree (tag_id)",
|
|
522
|
+
"table": "public.node_tags",
|
|
523
|
+
"columns": [
|
|
524
|
+
"tag_id"
|
|
525
|
+
]
|
|
526
|
+
}
|
|
527
|
+
],
|
|
528
|
+
"constraints": [
|
|
529
|
+
{
|
|
530
|
+
"name": "fk_rails_ebc9aafd9f",
|
|
531
|
+
"type": "FOREIGN KEY",
|
|
532
|
+
"def": "FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE",
|
|
533
|
+
"table": "public.node_tags",
|
|
534
|
+
"referenced_table": "nodes",
|
|
535
|
+
"columns": [
|
|
536
|
+
"node_id"
|
|
537
|
+
],
|
|
538
|
+
"referenced_columns": [
|
|
539
|
+
"id"
|
|
540
|
+
]
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
"name": "fk_rails_b51cdcc57f",
|
|
544
|
+
"type": "FOREIGN KEY",
|
|
545
|
+
"def": "FOREIGN KEY (tag_id) REFERENCES tags(id) ON DELETE CASCADE",
|
|
546
|
+
"table": "public.node_tags",
|
|
547
|
+
"referenced_table": "tags",
|
|
548
|
+
"columns": [
|
|
549
|
+
"tag_id"
|
|
550
|
+
],
|
|
551
|
+
"referenced_columns": [
|
|
552
|
+
"id"
|
|
553
|
+
]
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
"name": "node_tags_pkey",
|
|
557
|
+
"type": "PRIMARY KEY",
|
|
558
|
+
"def": "PRIMARY KEY (id)",
|
|
559
|
+
"table": "public.node_tags",
|
|
560
|
+
"referenced_table": "",
|
|
561
|
+
"columns": [
|
|
562
|
+
"id"
|
|
563
|
+
]
|
|
564
|
+
}
|
|
565
|
+
]
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
"name": "public.working_memories",
|
|
569
|
+
"type": "BASE TABLE",
|
|
570
|
+
"comment": "Per-robot working memory state (optional persistence)",
|
|
571
|
+
"columns": [
|
|
572
|
+
{
|
|
573
|
+
"name": "id",
|
|
574
|
+
"type": "bigint",
|
|
575
|
+
"nullable": false,
|
|
576
|
+
"default": "nextval('working_memories_id_seq'::regclass)"
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
"name": "robot_id",
|
|
580
|
+
"type": "bigint",
|
|
581
|
+
"nullable": false,
|
|
582
|
+
"comment": "Robot whose working memory this belongs to"
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
"name": "node_id",
|
|
586
|
+
"type": "bigint",
|
|
587
|
+
"nullable": false,
|
|
588
|
+
"comment": "Node currently in working memory"
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
"name": "added_at",
|
|
592
|
+
"type": "timestamp with time zone",
|
|
593
|
+
"nullable": true,
|
|
594
|
+
"default": "CURRENT_TIMESTAMP",
|
|
595
|
+
"comment": "When node was added to working memory"
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
"name": "token_count",
|
|
599
|
+
"type": "integer",
|
|
600
|
+
"nullable": true,
|
|
601
|
+
"comment": "Cached token count for budget tracking"
|
|
602
|
+
}
|
|
603
|
+
],
|
|
604
|
+
"indexes": [
|
|
605
|
+
{
|
|
606
|
+
"name": "working_memories_pkey",
|
|
607
|
+
"def": "CREATE UNIQUE INDEX working_memories_pkey ON public.working_memories USING btree (id)",
|
|
608
|
+
"table": "public.working_memories",
|
|
609
|
+
"columns": [
|
|
610
|
+
"id"
|
|
611
|
+
]
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
"name": "idx_working_memories_robot_id",
|
|
615
|
+
"def": "CREATE INDEX idx_working_memories_robot_id ON public.working_memories USING btree (robot_id)",
|
|
616
|
+
"table": "public.working_memories",
|
|
617
|
+
"columns": [
|
|
618
|
+
"robot_id"
|
|
619
|
+
]
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
"name": "idx_working_memories_node_id",
|
|
623
|
+
"def": "CREATE INDEX idx_working_memories_node_id ON public.working_memories USING btree (node_id)",
|
|
624
|
+
"table": "public.working_memories",
|
|
625
|
+
"columns": [
|
|
626
|
+
"node_id"
|
|
627
|
+
]
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
"name": "idx_working_memories_unique",
|
|
631
|
+
"def": "CREATE UNIQUE INDEX idx_working_memories_unique ON public.working_memories USING btree (robot_id, node_id)",
|
|
632
|
+
"table": "public.working_memories",
|
|
633
|
+
"columns": [
|
|
634
|
+
"robot_id",
|
|
635
|
+
"node_id"
|
|
636
|
+
]
|
|
637
|
+
}
|
|
638
|
+
],
|
|
639
|
+
"constraints": [
|
|
640
|
+
{
|
|
641
|
+
"name": "fk_rails_4b7c3eb07b",
|
|
642
|
+
"type": "FOREIGN KEY",
|
|
643
|
+
"def": "FOREIGN KEY (robot_id) REFERENCES robots(id) ON DELETE CASCADE",
|
|
644
|
+
"table": "public.working_memories",
|
|
645
|
+
"referenced_table": "robots",
|
|
646
|
+
"columns": [
|
|
647
|
+
"robot_id"
|
|
648
|
+
],
|
|
649
|
+
"referenced_columns": [
|
|
650
|
+
"id"
|
|
651
|
+
]
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
"name": "fk_rails_2c1d8b383c",
|
|
655
|
+
"type": "FOREIGN KEY",
|
|
656
|
+
"def": "FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE",
|
|
657
|
+
"table": "public.working_memories",
|
|
658
|
+
"referenced_table": "nodes",
|
|
659
|
+
"columns": [
|
|
660
|
+
"node_id"
|
|
661
|
+
],
|
|
662
|
+
"referenced_columns": [
|
|
663
|
+
"id"
|
|
664
|
+
]
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
"name": "working_memories_pkey",
|
|
668
|
+
"type": "PRIMARY KEY",
|
|
669
|
+
"def": "PRIMARY KEY (id)",
|
|
670
|
+
"table": "public.working_memories",
|
|
671
|
+
"referenced_table": "",
|
|
672
|
+
"columns": [
|
|
673
|
+
"id"
|
|
674
|
+
]
|
|
675
|
+
}
|
|
676
|
+
]
|
|
484
677
|
}
|
|
485
678
|
],
|
|
486
679
|
"relations": [
|
|
680
|
+
{
|
|
681
|
+
"table": "public.robot_nodes",
|
|
682
|
+
"columns": [
|
|
683
|
+
"robot_id"
|
|
684
|
+
],
|
|
685
|
+
"cardinality": "zero_or_more",
|
|
686
|
+
"parent_table": "public.robots",
|
|
687
|
+
"parent_columns": [
|
|
688
|
+
"id"
|
|
689
|
+
],
|
|
690
|
+
"parent_cardinality": "exactly_one",
|
|
691
|
+
"def": "FOREIGN KEY (robot_id) REFERENCES robots(id) ON DELETE CASCADE"
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
"table": "public.robot_nodes",
|
|
695
|
+
"columns": [
|
|
696
|
+
"node_id"
|
|
697
|
+
],
|
|
698
|
+
"cardinality": "zero_or_more",
|
|
699
|
+
"parent_table": "public.nodes",
|
|
700
|
+
"parent_columns": [
|
|
701
|
+
"id"
|
|
702
|
+
],
|
|
703
|
+
"parent_cardinality": "exactly_one",
|
|
704
|
+
"def": "FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE"
|
|
705
|
+
},
|
|
487
706
|
{
|
|
488
707
|
"table": "public.node_tags",
|
|
489
708
|
"columns": [
|
|
@@ -511,7 +730,7 @@
|
|
|
511
730
|
"def": "FOREIGN KEY (tag_id) REFERENCES tags(id) ON DELETE CASCADE"
|
|
512
731
|
},
|
|
513
732
|
{
|
|
514
|
-
"table": "public.
|
|
733
|
+
"table": "public.working_memories",
|
|
515
734
|
"columns": [
|
|
516
735
|
"robot_id"
|
|
517
736
|
],
|
|
@@ -522,6 +741,19 @@
|
|
|
522
741
|
],
|
|
523
742
|
"parent_cardinality": "exactly_one",
|
|
524
743
|
"def": "FOREIGN KEY (robot_id) REFERENCES robots(id) ON DELETE CASCADE"
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
"table": "public.working_memories",
|
|
747
|
+
"columns": [
|
|
748
|
+
"node_id"
|
|
749
|
+
],
|
|
750
|
+
"cardinality": "zero_or_more",
|
|
751
|
+
"parent_table": "public.nodes",
|
|
752
|
+
"parent_columns": [
|
|
753
|
+
"id"
|
|
754
|
+
],
|
|
755
|
+
"parent_cardinality": "exactly_one",
|
|
756
|
+
"def": "FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE"
|
|
525
757
|
}
|
|
526
758
|
],
|
|
527
759
|
"functions": [
|
|
@@ -1422,7 +1654,7 @@
|
|
|
1422
1654
|
],
|
|
1423
1655
|
"driver": {
|
|
1424
1656
|
"name": "postgres",
|
|
1425
|
-
"database_version": "PostgreSQL 17.
|
|
1657
|
+
"database_version": "PostgreSQL 17.7 (Homebrew) on aarch64-apple-darwin25.1.0, compiled by Apple clang version 17.0.0 (clang-1700.4.4.1), 64-bit",
|
|
1426
1658
|
"meta": {
|
|
1427
1659
|
"current_schema": "public",
|
|
1428
1660
|
"search_paths": [
|