htm 0.0.2 → 0.0.11

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 (129) hide show
  1. checksums.yaml +4 -4
  2. data/.aigcm_msg +1 -0
  3. data/.architecture/reviews/comprehensive-codebase-review.md +577 -0
  4. data/.claude/settings.local.json +95 -0
  5. data/.irbrc +283 -80
  6. data/.tbls.yml +2 -1
  7. data/CHANGELOG.md +327 -26
  8. data/CLAUDE.md +603 -0
  9. data/README.md +83 -12
  10. data/Rakefile +5 -0
  11. data/bin/htm_mcp.rb +527 -0
  12. data/db/migrate/{20250101000001_enable_extensions.rb → 00001_enable_extensions.rb} +0 -1
  13. data/db/migrate/00002_create_robots.rb +11 -0
  14. data/db/migrate/00003_create_file_sources.rb +20 -0
  15. data/db/migrate/00004_create_nodes.rb +65 -0
  16. data/db/migrate/00005_create_tags.rb +13 -0
  17. data/db/migrate/00006_create_node_tags.rb +18 -0
  18. data/db/migrate/00007_create_robot_nodes.rb +26 -0
  19. data/db/migrate/00009_add_working_memory_to_robot_nodes.rb +12 -0
  20. data/db/schema.sql +172 -1
  21. data/docs/api/database.md +1 -2
  22. data/docs/api/htm.md +197 -2
  23. data/docs/api/yard/HTM/ActiveRecordConfig.md +23 -0
  24. data/docs/api/yard/HTM/AuthorizationError.md +11 -0
  25. data/docs/api/yard/HTM/CircuitBreaker.md +92 -0
  26. data/docs/api/yard/HTM/CircuitBreakerOpenError.md +34 -0
  27. data/docs/api/yard/HTM/Configuration.md +175 -0
  28. data/docs/api/yard/HTM/Database.md +99 -0
  29. data/docs/api/yard/HTM/DatabaseError.md +14 -0
  30. data/docs/api/yard/HTM/EmbeddingError.md +18 -0
  31. data/docs/api/yard/HTM/EmbeddingService.md +58 -0
  32. data/docs/api/yard/HTM/Error.md +11 -0
  33. data/docs/api/yard/HTM/JobAdapter.md +39 -0
  34. data/docs/api/yard/HTM/LongTermMemory.md +342 -0
  35. data/docs/api/yard/HTM/NotFoundError.md +17 -0
  36. data/docs/api/yard/HTM/Observability.md +107 -0
  37. data/docs/api/yard/HTM/QueryTimeoutError.md +19 -0
  38. data/docs/api/yard/HTM/Railtie.md +27 -0
  39. data/docs/api/yard/HTM/ResourceExhaustedError.md +13 -0
  40. data/docs/api/yard/HTM/TagError.md +18 -0
  41. data/docs/api/yard/HTM/TagService.md +67 -0
  42. data/docs/api/yard/HTM/Timeframe/Result.md +24 -0
  43. data/docs/api/yard/HTM/Timeframe.md +40 -0
  44. data/docs/api/yard/HTM/TimeframeExtractor/Result.md +24 -0
  45. data/docs/api/yard/HTM/TimeframeExtractor.md +45 -0
  46. data/docs/api/yard/HTM/ValidationError.md +20 -0
  47. data/docs/api/yard/HTM/WorkingMemory.md +131 -0
  48. data/docs/api/yard/HTM.md +80 -0
  49. data/docs/api/yard/index.csv +179 -0
  50. data/docs/api/yard-reference.md +51 -0
  51. data/docs/database/README.md +128 -128
  52. data/docs/database/public.file_sources.md +42 -0
  53. data/docs/database/public.file_sources.svg +211 -0
  54. data/docs/database/public.node_tags.md +4 -4
  55. data/docs/database/public.node_tags.svg +212 -79
  56. data/docs/database/public.nodes.md +22 -12
  57. data/docs/database/public.nodes.svg +246 -127
  58. data/docs/database/public.robot_nodes.md +11 -9
  59. data/docs/database/public.robot_nodes.svg +220 -98
  60. data/docs/database/public.robots.md +2 -2
  61. data/docs/database/public.robots.svg +136 -81
  62. data/docs/database/public.tags.md +3 -3
  63. data/docs/database/public.tags.svg +118 -39
  64. data/docs/database/schema.json +850 -771
  65. data/docs/database/schema.svg +256 -197
  66. data/docs/development/schema.md +67 -2
  67. data/docs/guides/adding-memories.md +93 -7
  68. data/docs/guides/recalling-memories.md +36 -1
  69. data/examples/README.md +405 -0
  70. data/examples/cli_app/htm_cli.rb +65 -5
  71. data/examples/cli_app/temp.log +93 -0
  72. data/examples/file_loader_usage.rb +177 -0
  73. data/examples/mcp_client.rb +529 -0
  74. data/examples/robot_groups/lib/robot_group.rb +419 -0
  75. data/examples/robot_groups/lib/working_memory_channel.rb +140 -0
  76. data/examples/robot_groups/multi_process.rb +286 -0
  77. data/examples/robot_groups/robot_worker.rb +136 -0
  78. data/examples/robot_groups/same_process.rb +229 -0
  79. data/examples/timeframe_demo.rb +276 -0
  80. data/lib/htm/active_record_config.rb +1 -1
  81. data/lib/htm/circuit_breaker.rb +202 -0
  82. data/lib/htm/configuration.rb +59 -13
  83. data/lib/htm/database.rb +67 -36
  84. data/lib/htm/embedding_service.rb +39 -2
  85. data/lib/htm/errors.rb +131 -11
  86. data/lib/htm/jobs/generate_embedding_job.rb +5 -4
  87. data/lib/htm/jobs/generate_tags_job.rb +4 -0
  88. data/lib/htm/loaders/markdown_loader.rb +263 -0
  89. data/lib/htm/loaders/paragraph_chunker.rb +112 -0
  90. data/lib/htm/long_term_memory.rb +460 -343
  91. data/lib/htm/models/file_source.rb +99 -0
  92. data/lib/htm/models/node.rb +80 -5
  93. data/lib/htm/models/robot.rb +24 -1
  94. data/lib/htm/models/robot_node.rb +1 -0
  95. data/lib/htm/models/tag.rb +254 -4
  96. data/lib/htm/observability.rb +395 -0
  97. data/lib/htm/tag_service.rb +60 -3
  98. data/lib/htm/tasks.rb +26 -1
  99. data/lib/htm/timeframe.rb +194 -0
  100. data/lib/htm/timeframe_extractor.rb +307 -0
  101. data/lib/htm/version.rb +1 -1
  102. data/lib/htm/working_memory.rb +165 -70
  103. data/lib/htm.rb +328 -130
  104. data/lib/tasks/doc.rake +300 -0
  105. data/lib/tasks/files.rake +299 -0
  106. data/lib/tasks/htm.rake +158 -3
  107. data/lib/tasks/jobs.rake +3 -9
  108. data/lib/tasks/tags.rake +166 -6
  109. data/mkdocs.yml +36 -1
  110. data/notes/ARCHITECTURE_REVIEW.md +1167 -0
  111. data/notes/IMPLEMENTATION_SUMMARY.md +606 -0
  112. data/notes/MULTI_FRAMEWORK_IMPLEMENTATION.md +451 -0
  113. data/notes/next_steps.md +100 -0
  114. data/notes/plan.md +627 -0
  115. data/notes/tag_ontology_enhancement_ideas.md +222 -0
  116. data/notes/timescaledb_removal_summary.md +200 -0
  117. metadata +158 -17
  118. data/db/migrate/20250101000002_create_robots.rb +0 -14
  119. data/db/migrate/20250101000003_create_nodes.rb +0 -42
  120. data/db/migrate/20250101000005_create_tags.rb +0 -38
  121. data/db/migrate/20250101000007_add_node_vector_indexes.rb +0 -30
  122. data/db/migrate/20250125000001_add_content_hash_to_nodes.rb +0 -14
  123. data/db/migrate/20250125000002_create_robot_nodes.rb +0 -35
  124. data/db/migrate/20250125000003_remove_source_and_robot_id_from_nodes.rb +0 -28
  125. data/db/migrate/20250126000001_create_working_memories.rb +0 -19
  126. data/db/migrate/20250126000002_remove_unused_columns.rb +0 -12
  127. data/docs/database/public.working_memories.md +0 -40
  128. data/docs/database/public.working_memories.svg +0 -112
  129. data/lib/htm/models/working_memory_entry.rb +0 -88
@@ -4,167 +4,167 @@
4
4
 
5
5
  | Name | Columns | Comment | Type |
6
6
  | ---- | ------- | ------- | ---- |
7
- | [public.robot_nodes](public.robot_nodes.md) | 8 | Join table connecting robots to nodes (many-to-many) | BASE TABLE |
8
- | [public.schema_migrations](public.schema_migrations.md) | 1 | | BASE TABLE |
7
+ | [public.file_sources](public.file_sources.md) | 9 | Source file metadata for loaded documents | BASE TABLE |
8
+ | [public.node_tags](public.node_tags.md) | 4 | Join table connecting nodes to tags (many-to-many) | BASE TABLE |
9
+ | [public.nodes](public.nodes.md) | 14 | Core memory storage for conversation messages and context | BASE TABLE |
10
+ | [public.robot_nodes](public.robot_nodes.md) | 9 | Join table connecting robots to nodes (many-to-many) | BASE TABLE |
9
11
  | [public.robots](public.robots.md) | 4 | Registry of all LLM robots using the HTM system | BASE TABLE |
10
- | [public.nodes](public.nodes.md) | 10 | Core memory storage for conversation messages and context | BASE TABLE |
12
+ | [public.schema_migrations](public.schema_migrations.md) | 1 | | BASE TABLE |
11
13
  | [public.tags](public.tags.md) | 3 | Unique tag names for categorization | BASE TABLE |
12
- | [public.node_tags](public.node_tags.md) | 4 | Join table connecting nodes to tags (many-to-many) | BASE TABLE |
13
- | [public.working_memories](public.working_memories.md) | 5 | Per-robot working memory state (optional persistence) | BASE TABLE |
14
14
 
15
15
  ## Stored procedures and functions
16
16
 
17
17
  | Name | ReturnType | Arguments | Type |
18
18
  | ---- | ------- | ------- | ---- |
19
- | public.vector_in | vector | cstring, oid, integer | FUNCTION |
20
- | public.vector_out | cstring | vector | FUNCTION |
21
- | public.vector_typmod_in | int4 | cstring[] | FUNCTION |
22
- | public.vector_recv | vector | internal, oid, integer | FUNCTION |
23
- | public.vector_send | bytea | vector | FUNCTION |
24
- | public.l2_distance | float8 | vector, vector | FUNCTION |
25
- | public.inner_product | float8 | vector, vector | FUNCTION |
26
- | public.cosine_distance | float8 | vector, vector | FUNCTION |
27
- | public.l1_distance | float8 | vector, vector | FUNCTION |
28
- | public.vector_dims | int4 | vector | FUNCTION |
29
- | public.vector_norm | float8 | vector | FUNCTION |
30
- | public.l2_normalize | vector | vector | FUNCTION |
31
- | public.binary_quantize | bit | vector | FUNCTION |
32
- | public.subvector | vector | vector, integer, integer | FUNCTION |
33
- | public.vector_add | vector | vector, vector | FUNCTION |
34
- | public.vector_sub | vector | vector, vector | FUNCTION |
35
- | public.vector_mul | vector | vector, vector | FUNCTION |
36
- | public.vector_concat | vector | vector, vector | FUNCTION |
37
- | public.vector_lt | bool | vector, vector | FUNCTION |
38
- | public.vector_le | bool | vector, vector | FUNCTION |
39
- | public.vector_eq | bool | vector, vector | FUNCTION |
40
- | public.vector_ne | bool | vector, vector | FUNCTION |
41
- | public.vector_ge | bool | vector, vector | FUNCTION |
42
- | public.vector_gt | bool | vector, vector | FUNCTION |
43
- | public.vector_cmp | int4 | vector, vector | FUNCTION |
44
- | public.vector_l2_squared_distance | float8 | vector, vector | FUNCTION |
45
- | public.vector_negative_inner_product | float8 | vector, vector | FUNCTION |
46
- | public.vector_spherical_distance | float8 | vector, vector | FUNCTION |
47
- | public.vector_accum | _float8 | double precision[], vector | FUNCTION |
48
- | public.vector_avg | vector | double precision[] | FUNCTION |
49
- | public.vector_combine | _float8 | double precision[], double precision[] | FUNCTION |
50
- | public.avg | vector | vector | a |
51
- | public.sum | vector | vector | a |
52
- | public.vector | vector | vector, integer, boolean | FUNCTION |
53
- | public.array_to_vector | vector | integer[], integer, boolean | FUNCTION |
54
- | public.array_to_vector | vector | real[], integer, boolean | FUNCTION |
19
+ | public.array_to_halfvec | halfvec | double precision[], integer, boolean | FUNCTION |
20
+ | public.array_to_halfvec | halfvec | integer[], integer, boolean | FUNCTION |
21
+ | public.array_to_halfvec | halfvec | numeric[], integer, boolean | FUNCTION |
22
+ | public.array_to_halfvec | halfvec | real[], integer, boolean | FUNCTION |
23
+ | public.array_to_sparsevec | sparsevec | double precision[], integer, boolean | FUNCTION |
24
+ | public.array_to_sparsevec | sparsevec | integer[], integer, boolean | FUNCTION |
25
+ | public.array_to_sparsevec | sparsevec | numeric[], integer, boolean | FUNCTION |
26
+ | public.array_to_sparsevec | sparsevec | real[], integer, boolean | FUNCTION |
55
27
  | public.array_to_vector | vector | double precision[], integer, boolean | FUNCTION |
28
+ | public.array_to_vector | vector | integer[], integer, boolean | FUNCTION |
56
29
  | public.array_to_vector | vector | numeric[], integer, boolean | FUNCTION |
57
- | public.vector_to_float4 | _float4 | vector, integer, boolean | FUNCTION |
58
- | public.ivfflathandler | index_am_handler | internal | FUNCTION |
59
- | public.hnswhandler | index_am_handler | internal | FUNCTION |
60
- | public.ivfflat_halfvec_support | internal | internal | FUNCTION |
61
- | public.ivfflat_bit_support | internal | internal | FUNCTION |
62
- | public.hnsw_halfvec_support | internal | internal | FUNCTION |
63
- | public.hnsw_bit_support | internal | internal | FUNCTION |
64
- | public.hnsw_sparsevec_support | internal | internal | FUNCTION |
65
- | public.halfvec_in | halfvec | cstring, oid, integer | FUNCTION |
66
- | public.halfvec_out | cstring | halfvec | FUNCTION |
67
- | public.halfvec_typmod_in | int4 | cstring[] | FUNCTION |
68
- | public.halfvec_recv | halfvec | internal, oid, integer | FUNCTION |
69
- | public.halfvec_send | bytea | halfvec | FUNCTION |
70
- | public.l2_distance | float8 | halfvec, halfvec | FUNCTION |
71
- | public.inner_product | float8 | halfvec, halfvec | FUNCTION |
72
- | public.cosine_distance | float8 | halfvec, halfvec | FUNCTION |
73
- | public.l1_distance | float8 | halfvec, halfvec | FUNCTION |
74
- | public.vector_dims | int4 | halfvec | FUNCTION |
75
- | public.l2_norm | float8 | halfvec | FUNCTION |
76
- | public.l2_normalize | halfvec | halfvec | FUNCTION |
30
+ | public.array_to_vector | vector | real[], integer, boolean | FUNCTION |
31
+ | public.avg | halfvec | halfvec | a |
32
+ | public.avg | vector | vector | a |
77
33
  | public.binary_quantize | bit | halfvec | FUNCTION |
78
- | public.subvector | halfvec | halfvec, integer, integer | FUNCTION |
34
+ | public.binary_quantize | bit | vector | FUNCTION |
35
+ | public.cosine_distance | float8 | halfvec, halfvec | FUNCTION |
36
+ | public.cosine_distance | float8 | sparsevec, sparsevec | FUNCTION |
37
+ | public.cosine_distance | float8 | vector, vector | FUNCTION |
38
+ | public.gin_extract_query_trgm | internal | text, internal, smallint, internal, internal, internal, internal | FUNCTION |
39
+ | public.gin_extract_value_trgm | internal | text, internal | FUNCTION |
40
+ | public.gin_trgm_consistent | bool | internal, smallint, text, integer, internal, internal, internal, internal | FUNCTION |
41
+ | public.gin_trgm_triconsistent | char | internal, smallint, text, integer, internal, internal, internal | FUNCTION |
42
+ | public.gtrgm_compress | internal | internal | FUNCTION |
43
+ | public.gtrgm_consistent | bool | internal, text, smallint, oid, internal | FUNCTION |
44
+ | public.gtrgm_decompress | internal | internal | FUNCTION |
45
+ | public.gtrgm_distance | float8 | internal, text, smallint, oid, internal | FUNCTION |
46
+ | public.gtrgm_in | gtrgm | cstring | FUNCTION |
47
+ | public.gtrgm_options | void | internal | FUNCTION |
48
+ | public.gtrgm_out | cstring | gtrgm | FUNCTION |
49
+ | public.gtrgm_penalty | internal | internal, internal, internal | FUNCTION |
50
+ | public.gtrgm_picksplit | internal | internal, internal | FUNCTION |
51
+ | public.gtrgm_same | internal | gtrgm, gtrgm, internal | FUNCTION |
52
+ | public.gtrgm_union | gtrgm | internal, internal | FUNCTION |
53
+ | public.halfvec | halfvec | halfvec, integer, boolean | FUNCTION |
54
+ | public.halfvec_accum | _float8 | double precision[], halfvec | FUNCTION |
79
55
  | public.halfvec_add | halfvec | halfvec, halfvec | FUNCTION |
80
- | public.halfvec_sub | halfvec | halfvec, halfvec | FUNCTION |
81
- | public.halfvec_mul | halfvec | halfvec, halfvec | FUNCTION |
56
+ | public.halfvec_avg | halfvec | double precision[] | FUNCTION |
57
+ | public.halfvec_cmp | int4 | halfvec, halfvec | FUNCTION |
58
+ | public.halfvec_combine | _float8 | double precision[], double precision[] | FUNCTION |
82
59
  | public.halfvec_concat | halfvec | halfvec, halfvec | FUNCTION |
83
- | public.halfvec_lt | bool | halfvec, halfvec | FUNCTION |
84
- | public.halfvec_le | bool | halfvec, halfvec | FUNCTION |
85
60
  | public.halfvec_eq | bool | halfvec, halfvec | FUNCTION |
86
- | public.halfvec_ne | bool | halfvec, halfvec | FUNCTION |
87
61
  | public.halfvec_ge | bool | halfvec, halfvec | FUNCTION |
88
62
  | public.halfvec_gt | bool | halfvec, halfvec | FUNCTION |
89
- | public.halfvec_cmp | int4 | halfvec, halfvec | FUNCTION |
63
+ | public.halfvec_in | halfvec | cstring, oid, integer | FUNCTION |
90
64
  | public.halfvec_l2_squared_distance | float8 | halfvec, halfvec | FUNCTION |
65
+ | public.halfvec_le | bool | halfvec, halfvec | FUNCTION |
66
+ | public.halfvec_lt | bool | halfvec, halfvec | FUNCTION |
67
+ | public.halfvec_mul | halfvec | halfvec, halfvec | FUNCTION |
68
+ | public.halfvec_ne | bool | halfvec, halfvec | FUNCTION |
91
69
  | public.halfvec_negative_inner_product | float8 | halfvec, halfvec | FUNCTION |
70
+ | public.halfvec_out | cstring | halfvec | FUNCTION |
71
+ | public.halfvec_recv | halfvec | internal, oid, integer | FUNCTION |
72
+ | public.halfvec_send | bytea | halfvec | FUNCTION |
92
73
  | public.halfvec_spherical_distance | float8 | halfvec, halfvec | FUNCTION |
93
- | public.halfvec_accum | _float8 | double precision[], halfvec | FUNCTION |
94
- | public.halfvec_avg | halfvec | double precision[] | FUNCTION |
95
- | public.halfvec_combine | _float8 | double precision[], double precision[] | FUNCTION |
96
- | public.avg | halfvec | halfvec | a |
97
- | public.sum | halfvec | halfvec | a |
98
- | public.halfvec | halfvec | halfvec, integer, boolean | FUNCTION |
99
- | public.halfvec_to_vector | vector | halfvec, integer, boolean | FUNCTION |
100
- | public.vector_to_halfvec | halfvec | vector, integer, boolean | FUNCTION |
101
- | public.array_to_halfvec | halfvec | integer[], integer, boolean | FUNCTION |
102
- | public.array_to_halfvec | halfvec | real[], integer, boolean | FUNCTION |
103
- | public.array_to_halfvec | halfvec | double precision[], integer, boolean | FUNCTION |
104
- | public.array_to_halfvec | halfvec | numeric[], integer, boolean | FUNCTION |
74
+ | public.halfvec_sub | halfvec | halfvec, halfvec | FUNCTION |
105
75
  | public.halfvec_to_float4 | _float4 | halfvec, integer, boolean | FUNCTION |
76
+ | public.halfvec_to_sparsevec | sparsevec | halfvec, integer, boolean | FUNCTION |
77
+ | public.halfvec_to_vector | vector | halfvec, integer, boolean | FUNCTION |
78
+ | public.halfvec_typmod_in | int4 | cstring[] | FUNCTION |
106
79
  | public.hamming_distance | float8 | bit, bit | FUNCTION |
107
- | public.jaccard_distance | float8 | bit, bit | FUNCTION |
108
- | public.sparsevec_in | sparsevec | cstring, oid, integer | FUNCTION |
109
- | public.sparsevec_out | cstring | sparsevec | FUNCTION |
110
- | public.sparsevec_typmod_in | int4 | cstring[] | FUNCTION |
111
- | public.sparsevec_recv | sparsevec | internal, oid, integer | FUNCTION |
112
- | public.sparsevec_send | bytea | sparsevec | FUNCTION |
113
- | public.l2_distance | float8 | sparsevec, sparsevec | FUNCTION |
80
+ | public.hnsw_bit_support | internal | internal | FUNCTION |
81
+ | public.hnsw_halfvec_support | internal | internal | FUNCTION |
82
+ | public.hnsw_sparsevec_support | internal | internal | FUNCTION |
83
+ | public.hnswhandler | index_am_handler | internal | FUNCTION |
84
+ | public.inner_product | float8 | halfvec, halfvec | FUNCTION |
114
85
  | public.inner_product | float8 | sparsevec, sparsevec | FUNCTION |
115
- | public.cosine_distance | float8 | sparsevec, sparsevec | FUNCTION |
86
+ | public.inner_product | float8 | vector, vector | FUNCTION |
87
+ | public.ivfflat_bit_support | internal | internal | FUNCTION |
88
+ | public.ivfflat_halfvec_support | internal | internal | FUNCTION |
89
+ | public.ivfflathandler | index_am_handler | internal | FUNCTION |
90
+ | public.jaccard_distance | float8 | bit, bit | FUNCTION |
91
+ | public.l1_distance | float8 | halfvec, halfvec | FUNCTION |
116
92
  | public.l1_distance | float8 | sparsevec, sparsevec | FUNCTION |
93
+ | public.l1_distance | float8 | vector, vector | FUNCTION |
94
+ | public.l2_distance | float8 | halfvec, halfvec | FUNCTION |
95
+ | public.l2_distance | float8 | sparsevec, sparsevec | FUNCTION |
96
+ | public.l2_distance | float8 | vector, vector | FUNCTION |
97
+ | public.l2_norm | float8 | halfvec | FUNCTION |
117
98
  | public.l2_norm | float8 | sparsevec | FUNCTION |
99
+ | public.l2_normalize | halfvec | halfvec | FUNCTION |
118
100
  | public.l2_normalize | sparsevec | sparsevec | FUNCTION |
119
- | public.sparsevec_lt | bool | sparsevec, sparsevec | FUNCTION |
120
- | public.sparsevec_le | bool | sparsevec, sparsevec | FUNCTION |
101
+ | public.l2_normalize | vector | vector | FUNCTION |
102
+ | public.set_limit | float4 | real | FUNCTION |
103
+ | public.show_limit | float4 | | FUNCTION |
104
+ | public.show_trgm | _text | text | FUNCTION |
105
+ | public.similarity | float4 | text, text | FUNCTION |
106
+ | public.similarity_dist | float4 | text, text | FUNCTION |
107
+ | public.similarity_op | bool | text, text | FUNCTION |
108
+ | public.sparsevec | sparsevec | sparsevec, integer, boolean | FUNCTION |
109
+ | public.sparsevec_cmp | int4 | sparsevec, sparsevec | FUNCTION |
121
110
  | public.sparsevec_eq | bool | sparsevec, sparsevec | FUNCTION |
122
- | public.sparsevec_ne | bool | sparsevec, sparsevec | FUNCTION |
123
111
  | public.sparsevec_ge | bool | sparsevec, sparsevec | FUNCTION |
124
112
  | public.sparsevec_gt | bool | sparsevec, sparsevec | FUNCTION |
125
- | public.sparsevec_cmp | int4 | sparsevec, sparsevec | FUNCTION |
113
+ | public.sparsevec_in | sparsevec | cstring, oid, integer | FUNCTION |
126
114
  | public.sparsevec_l2_squared_distance | float8 | sparsevec, sparsevec | FUNCTION |
115
+ | public.sparsevec_le | bool | sparsevec, sparsevec | FUNCTION |
116
+ | public.sparsevec_lt | bool | sparsevec, sparsevec | FUNCTION |
117
+ | public.sparsevec_ne | bool | sparsevec, sparsevec | FUNCTION |
127
118
  | public.sparsevec_negative_inner_product | float8 | sparsevec, sparsevec | FUNCTION |
128
- | public.sparsevec | sparsevec | sparsevec, integer, boolean | FUNCTION |
129
- | public.vector_to_sparsevec | sparsevec | vector, integer, boolean | FUNCTION |
130
- | public.sparsevec_to_vector | vector | sparsevec, integer, boolean | FUNCTION |
131
- | public.halfvec_to_sparsevec | sparsevec | halfvec, integer, boolean | FUNCTION |
119
+ | public.sparsevec_out | cstring | sparsevec | FUNCTION |
120
+ | public.sparsevec_recv | sparsevec | internal, oid, integer | FUNCTION |
121
+ | public.sparsevec_send | bytea | sparsevec | FUNCTION |
132
122
  | public.sparsevec_to_halfvec | halfvec | sparsevec, integer, boolean | FUNCTION |
133
- | public.array_to_sparsevec | sparsevec | integer[], integer, boolean | FUNCTION |
134
- | public.array_to_sparsevec | sparsevec | real[], integer, boolean | FUNCTION |
135
- | public.array_to_sparsevec | sparsevec | double precision[], integer, boolean | FUNCTION |
136
- | public.array_to_sparsevec | sparsevec | numeric[], integer, boolean | FUNCTION |
137
- | public.set_limit | float4 | real | FUNCTION |
138
- | public.show_limit | float4 | | FUNCTION |
139
- | public.show_trgm | _text | text | FUNCTION |
140
- | public.similarity | float4 | text, text | FUNCTION |
141
- | public.similarity_op | bool | text, text | FUNCTION |
142
- | public.word_similarity | float4 | text, text | FUNCTION |
143
- | public.word_similarity_op | bool | text, text | FUNCTION |
144
- | public.word_similarity_commutator_op | bool | text, text | FUNCTION |
145
- | public.similarity_dist | float4 | text, text | FUNCTION |
146
- | public.word_similarity_dist_op | float4 | text, text | FUNCTION |
147
- | public.word_similarity_dist_commutator_op | float4 | text, text | FUNCTION |
148
- | public.gtrgm_in | gtrgm | cstring | FUNCTION |
149
- | public.gtrgm_out | cstring | gtrgm | FUNCTION |
150
- | public.gtrgm_consistent | bool | internal, text, smallint, oid, internal | FUNCTION |
151
- | public.gtrgm_distance | float8 | internal, text, smallint, oid, internal | FUNCTION |
152
- | public.gtrgm_compress | internal | internal | FUNCTION |
153
- | public.gtrgm_decompress | internal | internal | FUNCTION |
154
- | public.gtrgm_penalty | internal | internal, internal, internal | FUNCTION |
155
- | public.gtrgm_picksplit | internal | internal, internal | FUNCTION |
156
- | public.gtrgm_union | gtrgm | internal, internal | FUNCTION |
157
- | public.gtrgm_same | internal | gtrgm, gtrgm, internal | FUNCTION |
158
- | public.gin_extract_value_trgm | internal | text, internal | FUNCTION |
159
- | public.gin_extract_query_trgm | internal | text, internal, smallint, internal, internal, internal, internal | FUNCTION |
160
- | public.gin_trgm_consistent | bool | internal, smallint, text, integer, internal, internal, internal, internal | FUNCTION |
161
- | public.gin_trgm_triconsistent | char | internal, smallint, text, integer, internal, internal, internal | FUNCTION |
123
+ | public.sparsevec_to_vector | vector | sparsevec, integer, boolean | FUNCTION |
124
+ | public.sparsevec_typmod_in | int4 | cstring[] | FUNCTION |
162
125
  | public.strict_word_similarity | float4 | text, text | FUNCTION |
163
- | public.strict_word_similarity_op | bool | text, text | FUNCTION |
164
126
  | public.strict_word_similarity_commutator_op | bool | text, text | FUNCTION |
165
- | public.strict_word_similarity_dist_op | float4 | text, text | FUNCTION |
166
127
  | public.strict_word_similarity_dist_commutator_op | float4 | text, text | FUNCTION |
167
- | public.gtrgm_options | void | internal | FUNCTION |
128
+ | public.strict_word_similarity_dist_op | float4 | text, text | FUNCTION |
129
+ | public.strict_word_similarity_op | bool | text, text | FUNCTION |
130
+ | public.subvector | halfvec | halfvec, integer, integer | FUNCTION |
131
+ | public.subvector | vector | vector, integer, integer | FUNCTION |
132
+ | public.sum | halfvec | halfvec | a |
133
+ | public.sum | vector | vector | a |
134
+ | public.vector | vector | vector, integer, boolean | FUNCTION |
135
+ | public.vector_accum | _float8 | double precision[], vector | FUNCTION |
136
+ | public.vector_add | vector | vector, vector | FUNCTION |
137
+ | public.vector_avg | vector | double precision[] | FUNCTION |
138
+ | public.vector_cmp | int4 | vector, vector | FUNCTION |
139
+ | public.vector_combine | _float8 | double precision[], double precision[] | FUNCTION |
140
+ | public.vector_concat | vector | vector, vector | FUNCTION |
141
+ | public.vector_dims | int4 | halfvec | FUNCTION |
142
+ | public.vector_dims | int4 | vector | FUNCTION |
143
+ | public.vector_eq | bool | vector, vector | FUNCTION |
144
+ | public.vector_ge | bool | vector, vector | FUNCTION |
145
+ | public.vector_gt | bool | vector, vector | FUNCTION |
146
+ | public.vector_in | vector | cstring, oid, integer | FUNCTION |
147
+ | public.vector_l2_squared_distance | float8 | vector, vector | FUNCTION |
148
+ | public.vector_le | bool | vector, vector | FUNCTION |
149
+ | public.vector_lt | bool | vector, vector | FUNCTION |
150
+ | public.vector_mul | vector | vector, vector | FUNCTION |
151
+ | public.vector_ne | bool | vector, vector | FUNCTION |
152
+ | public.vector_negative_inner_product | float8 | vector, vector | FUNCTION |
153
+ | public.vector_norm | float8 | vector | FUNCTION |
154
+ | public.vector_out | cstring | vector | FUNCTION |
155
+ | public.vector_recv | vector | internal, oid, integer | FUNCTION |
156
+ | public.vector_send | bytea | vector | FUNCTION |
157
+ | public.vector_spherical_distance | float8 | vector, vector | FUNCTION |
158
+ | public.vector_sub | vector | vector, vector | FUNCTION |
159
+ | public.vector_to_float4 | _float4 | vector, integer, boolean | FUNCTION |
160
+ | public.vector_to_halfvec | halfvec | vector, integer, boolean | FUNCTION |
161
+ | public.vector_to_sparsevec | sparsevec | vector, integer, boolean | FUNCTION |
162
+ | public.vector_typmod_in | int4 | cstring[] | FUNCTION |
163
+ | public.word_similarity | float4 | text, text | FUNCTION |
164
+ | public.word_similarity_commutator_op | bool | text, text | FUNCTION |
165
+ | public.word_similarity_dist_commutator_op | float4 | text, text | FUNCTION |
166
+ | public.word_similarity_dist_op | float4 | text, text | FUNCTION |
167
+ | public.word_similarity_op | bool | text, text | FUNCTION |
168
168
 
169
169
  ## Relations
170
170
 
@@ -0,0 +1,42 @@
1
+ # public.file_sources
2
+
3
+ ## Description
4
+
5
+ Source file metadata for loaded documents
6
+
7
+ ## Columns
8
+
9
+ | Name | Type | Default | Nullable | Children | Parents | Comment |
10
+ | ---- | ---- | ------- | -------- | -------- | ------- | ------- |
11
+ | created_at | timestamp with time zone | CURRENT_TIMESTAMP | true | | | |
12
+ | file_hash | varchar(64) | | true | | | SHA-256 hash of file content |
13
+ | file_path | text | | false | | | Absolute path to source file |
14
+ | file_size | integer | | true | | | File size in bytes |
15
+ | frontmatter | jsonb | '{}'::jsonb | true | | | Parsed YAML frontmatter |
16
+ | id | bigint | nextval('file_sources_id_seq'::regclass) | false | [public.nodes](public.nodes.md) | | |
17
+ | last_synced_at | timestamp with time zone | | true | | | When file was last synced to HTM |
18
+ | mtime | timestamp with time zone | | true | | | File modification time |
19
+ | updated_at | timestamp with time zone | CURRENT_TIMESTAMP | true | | | |
20
+
21
+ ## Constraints
22
+
23
+ | Name | Type | Definition |
24
+ | ---- | ---- | ---------- |
25
+ | file_sources_pkey | PRIMARY KEY | PRIMARY KEY (id) |
26
+
27
+ ## Indexes
28
+
29
+ | Name | Definition |
30
+ | ---- | ---------- |
31
+ | file_sources_pkey | CREATE UNIQUE INDEX file_sources_pkey ON public.file_sources USING btree (id) |
32
+ | idx_file_sources_hash | CREATE INDEX idx_file_sources_hash ON public.file_sources USING btree (file_hash) |
33
+ | idx_file_sources_last_synced | CREATE INDEX idx_file_sources_last_synced ON public.file_sources USING btree (last_synced_at) |
34
+ | idx_file_sources_path_unique | CREATE UNIQUE INDEX idx_file_sources_path_unique ON public.file_sources USING btree (file_path) |
35
+
36
+ ## Relations
37
+
38
+ ![er](public.file_sources.svg)
39
+
40
+ ---
41
+
42
+ > Generated by [tbls](https://github.com/k1LoW/tbls)
@@ -0,0 +1,211 @@
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.file_sources Pages: 1 -->
7
+ <svg width="1329pt" height="1469pt"
8
+ viewBox="0.00 0.00 1328.70 1468.80" 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 1464.8)">
10
+ <title>public.file_sources</title>
11
+ <polygon fill="white" stroke="none" points="-4,4 -4,-1464.8 1324.7,-1464.8 1324.7,4 -4,4"/>
12
+ <!-- public.file_sources -->
13
+ <g id="node1" class="node">
14
+ <title>public.file_sources</title>
15
+ <polygon fill="#efefef" stroke="none" points="358.93,-323.4 358.93,-369.4 850.68,-369.4 850.68,-323.4 358.93,-323.4"/>
16
+ <polygon fill="none" stroke="black" points="358.93,-323.4 358.93,-369.4 850.68,-369.4 850.68,-323.4 358.93,-323.4"/>
17
+ <text text-anchor="start" x="474.33" y="-347.2" font-family="Arial Bold" font-size="18.00">public.file_sources</text>
18
+ <text text-anchor="start" x="610.79" y="-347.2" font-family="Arial" font-size="14.00">    </text>
19
+ <text text-anchor="start" x="641.91" y="-347.2" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
20
+ <text text-anchor="start" x="471.34" y="-332.8" font-family="Arial" font-size="14.00" fill="#333333">Source file metadata for loaded documents</text>
21
+ <polygon fill="none" stroke="black" points="358.93,-292.6 358.93,-323.4 850.68,-323.4 850.68,-292.6 358.93,-292.6"/>
22
+ <text text-anchor="start" x="365.93" y="-304.8" font-family="Arial" font-size="14.00">created_at </text>
23
+ <text text-anchor="start" x="435.98" y="-304.8" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
24
+ <polygon fill="none" stroke="black" points="358.93,-261.8 358.93,-292.6 850.68,-292.6 850.68,-261.8 358.93,-261.8"/>
25
+ <text text-anchor="start" x="365.93" y="-274" font-family="Arial" font-size="14.00">file_hash </text>
26
+ <text text-anchor="start" x="425.87" y="-274" font-family="Arial" font-size="14.00" fill="#666666">[varchar(64)]</text>
27
+ <text text-anchor="start" x="505.22" y="-274" font-family="Arial" font-size="14.00"> SHA&#45;256 hash of file content</text>
28
+ <polygon fill="none" stroke="black" points="358.93,-231 358.93,-261.8 850.68,-261.8 850.68,-231 358.93,-231"/>
29
+ <text text-anchor="start" x="365.93" y="-243.2" font-family="Arial" font-size="14.00">file_path </text>
30
+ <text text-anchor="start" x="422.75" y="-243.2" font-family="Arial" font-size="14.00" fill="#666666">[text]</text>
31
+ <text text-anchor="start" x="453.1" y="-243.2" font-family="Arial" font-size="14.00"> Absolute path to source file</text>
32
+ <polygon fill="none" stroke="black" points="358.93,-200.2 358.93,-231 850.68,-231 850.68,-200.2 358.93,-200.2"/>
33
+ <text text-anchor="start" x="365.93" y="-212.4" font-family="Arial" font-size="14.00">file_size </text>
34
+ <text text-anchor="start" x="420.4" y="-212.4" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
35
+ <text text-anchor="start" x="470.99" y="-212.4" font-family="Arial" font-size="14.00"> File size in bytes</text>
36
+ <polygon fill="none" stroke="black" points="358.93,-169.4 358.93,-200.2 850.68,-200.2 850.68,-169.4 358.93,-169.4"/>
37
+ <text text-anchor="start" x="365.93" y="-181.6" font-family="Arial" font-size="14.00">frontmatter </text>
38
+ <text text-anchor="start" x="437.51" y="-181.6" font-family="Arial" font-size="14.00" fill="#666666">[jsonb]</text>
39
+ <text text-anchor="start" x="478.76" y="-181.6" font-family="Arial" font-size="14.00"> Parsed YAML frontmatter</text>
40
+ <polygon fill="none" stroke="black" points="358.93,-138.6 358.93,-169.4 850.68,-169.4 850.68,-138.6 358.93,-138.6"/>
41
+ <text text-anchor="start" x="365.93" y="-150.8" font-family="Arial" font-size="14.00">id </text>
42
+ <text text-anchor="start" x="380.72" y="-150.8" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
43
+ <polygon fill="none" stroke="black" points="358.93,-107.8 358.93,-138.6 850.68,-138.6 850.68,-107.8 358.93,-107.8"/>
44
+ <text text-anchor="start" x="365.93" y="-120" font-family="Arial" font-size="14.00">last_synced_at </text>
45
+ <text text-anchor="start" x="463.22" y="-120" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
46
+ <text text-anchor="start" x="628.94" y="-120" font-family="Arial" font-size="14.00"> When file was last synced to HTM</text>
47
+ <polygon fill="none" stroke="black" points="358.93,-77 358.93,-107.8 850.68,-107.8 850.68,-77 358.93,-77"/>
48
+ <text text-anchor="start" x="365.93" y="-89.2" font-family="Arial" font-size="14.00">mtime </text>
49
+ <text text-anchor="start" x="407.93" y="-89.2" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
50
+ <text text-anchor="start" x="573.66" y="-89.2" font-family="Arial" font-size="14.00"> File modification time</text>
51
+ <polygon fill="none" stroke="black" points="358.93,-46.2 358.93,-77 850.68,-77 850.68,-46.2 358.93,-46.2"/>
52
+ <text text-anchor="start" x="365.93" y="-58.4" font-family="Arial" font-size="14.00">updated_at </text>
53
+ <text text-anchor="start" x="439.89" y="-58.4" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
54
+ <polygon fill="none" stroke="black" stroke-width="3" points="357.43,-44.7 357.43,-370.9 852.18,-370.9 852.18,-44.7 357.43,-44.7"/>
55
+ </g>
56
+ <!-- public.nodes -->
57
+ <g id="node2" class="node">
58
+ <title>public.nodes</title>
59
+ <polygon fill="#efefef" stroke="none" points="276.79,-926 276.79,-972 932.83,-972 932.83,-926 276.79,-926"/>
60
+ <polygon fill="none" stroke="black" points="276.79,-926 276.79,-972 932.83,-972 932.83,-926 276.79,-926"/>
61
+ <text text-anchor="start" x="496.82" y="-949.8" font-family="Arial Bold" font-size="18.00">public.nodes</text>
62
+ <text text-anchor="start" x="588.3" y="-949.8" font-family="Arial" font-size="14.00">    </text>
63
+ <text text-anchor="start" x="619.42" y="-949.8" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
64
+ <text text-anchor="start" x="413.38" y="-935.4" font-family="Arial" font-size="14.00" fill="#333333">Core memory storage for conversation messages and context</text>
65
+ <polygon fill="none" stroke="black" points="276.79,-895.2 276.79,-926 932.83,-926 932.83,-895.2 276.79,-895.2"/>
66
+ <text text-anchor="start" x="283.79" y="-907.4" font-family="Arial" font-size="14.00">access_count </text>
67
+ <text text-anchor="start" x="373.28" y="-907.4" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
68
+ <text text-anchor="start" x="423.87" y="-907.4" font-family="Arial" font-size="14.00"> Number of times this node has been accessed/retrieved</text>
69
+ <polygon fill="none" stroke="black" points="276.79,-864.4 276.79,-895.2 932.83,-895.2 932.83,-864.4 276.79,-864.4"/>
70
+ <text text-anchor="start" x="283.79" y="-876.6" font-family="Arial" font-size="14.00">chunk_position </text>
71
+ <text text-anchor="start" x="381.08" y="-876.6" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
72
+ <text text-anchor="start" x="431.66" y="-876.6" font-family="Arial" font-size="14.00"> Position within source file (0&#45;indexed)</text>
73
+ <polygon fill="none" stroke="black" points="276.79,-833.6 276.79,-864.4 932.83,-864.4 932.83,-833.6 276.79,-833.6"/>
74
+ <text text-anchor="start" x="283.79" y="-845.8" font-family="Arial" font-size="14.00">content </text>
75
+ <text text-anchor="start" x="333.6" y="-845.8" font-family="Arial" font-size="14.00" fill="#666666">[text]</text>
76
+ <text text-anchor="start" x="363.95" y="-845.8" font-family="Arial" font-size="14.00"> The conversation message/utterance content</text>
77
+ <polygon fill="none" stroke="black" points="276.79,-802.8 276.79,-833.6 932.83,-833.6 932.83,-802.8 276.79,-802.8"/>
78
+ <text text-anchor="start" x="283.79" y="-815" font-family="Arial" font-size="14.00">content_hash </text>
79
+ <text text-anchor="start" x="371.74" y="-815" font-family="Arial" font-size="14.00" fill="#666666">[varchar(64)]</text>
80
+ <text text-anchor="start" x="451.1" y="-815" font-family="Arial" font-size="14.00"> SHA&#45;256 hash of content for deduplication</text>
81
+ <polygon fill="none" stroke="black" points="276.79,-772 276.79,-802.8 932.83,-802.8 932.83,-772 276.79,-772"/>
82
+ <text text-anchor="start" x="283.79" y="-784.2" font-family="Arial" font-size="14.00">created_at </text>
83
+ <text text-anchor="start" x="353.83" y="-784.2" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
84
+ <text text-anchor="start" x="519.56" y="-784.2" font-family="Arial" font-size="14.00"> When this memory was created</text>
85
+ <polygon fill="none" stroke="black" points="276.79,-741.2 276.79,-772 932.83,-772 932.83,-741.2 276.79,-741.2"/>
86
+ <text text-anchor="start" x="283.79" y="-753.4" font-family="Arial" font-size="14.00">deleted_at </text>
87
+ <text text-anchor="start" x="353.07" y="-753.4" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
88
+ <text text-anchor="start" x="518.79" y="-753.4" font-family="Arial" font-size="14.00"> Soft delete timestamp &#45; node is considered deleted when set</text>
89
+ <polygon fill="none" stroke="black" points="276.79,-710.4 276.79,-741.2 932.83,-741.2 932.83,-710.4 276.79,-710.4"/>
90
+ <text text-anchor="start" x="283.79" y="-722.6" font-family="Arial" font-size="14.00">embedding </text>
91
+ <text text-anchor="start" x="356.95" y="-722.6" font-family="Arial" font-size="14.00" fill="#666666">[vector(2000)]</text>
92
+ <text text-anchor="start" x="443.32" y="-722.6" font-family="Arial" font-size="14.00"> Vector embedding (max 2000 dimensions) for semantic search</text>
93
+ <polygon fill="none" stroke="black" points="276.79,-679.6 276.79,-710.4 932.83,-710.4 932.83,-679.6 276.79,-679.6"/>
94
+ <text text-anchor="start" x="283.79" y="-691.8" font-family="Arial" font-size="14.00">embedding_dimension </text>
95
+ <text text-anchor="start" x="428.55" y="-691.8" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
96
+ <text text-anchor="start" x="479.14" y="-691.8" font-family="Arial" font-size="14.00"> Actual number of dimensions used in the embedding vector (max 2000)</text>
97
+ <polygon fill="none" stroke="black" points="276.79,-648.8 276.79,-679.6 932.83,-679.6 932.83,-648.8 276.79,-648.8"/>
98
+ <text text-anchor="start" x="283.79" y="-661" font-family="Arial" font-size="14.00">id </text>
99
+ <text text-anchor="start" x="298.57" y="-661" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
100
+ <polygon fill="none" stroke="black" points="276.79,-618 276.79,-648.8 932.83,-648.8 932.83,-618 276.79,-618"/>
101
+ <text text-anchor="start" x="283.79" y="-630.2" font-family="Arial" font-size="14.00">last_accessed </text>
102
+ <text text-anchor="start" x="376.39" y="-630.2" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
103
+ <text text-anchor="start" x="542.12" y="-630.2" font-family="Arial" font-size="14.00"> When this memory was last accessed</text>
104
+ <polygon fill="none" stroke="black" points="276.79,-587.2 276.79,-618 932.83,-618 932.83,-587.2 276.79,-587.2"/>
105
+ <text text-anchor="start" x="283.79" y="-599.4" font-family="Arial" font-size="14.00">metadata </text>
106
+ <text text-anchor="start" x="346.05" y="-599.4" font-family="Arial" font-size="14.00" fill="#666666">[jsonb]</text>
107
+ <text text-anchor="start" x="387.3" y="-599.4" font-family="Arial" font-size="14.00"> Flexible metadata storage (memory_type, importance, source, etc.)</text>
108
+ <polygon fill="none" stroke="black" points="276.79,-556.4 276.79,-587.2 932.83,-587.2 932.83,-556.4 276.79,-556.4"/>
109
+ <text text-anchor="start" x="283.79" y="-568.6" font-family="Arial" font-size="14.00">source_id </text>
110
+ <text text-anchor="start" x="348.38" y="-568.6" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
111
+ <text text-anchor="start" x="389.63" y="-568.6" font-family="Arial" font-size="14.00"> Reference to source file (for file&#45;loaded nodes)</text>
112
+ <polygon fill="none" stroke="black" points="276.79,-525.6 276.79,-556.4 932.83,-556.4 932.83,-525.6 276.79,-525.6"/>
113
+ <text text-anchor="start" x="283.79" y="-537.8" font-family="Arial" font-size="14.00">token_count </text>
114
+ <text text-anchor="start" x="363.96" y="-537.8" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
115
+ <text text-anchor="start" x="414.54" y="-537.8" font-family="Arial" font-size="14.00"> Number of tokens in the content (for context budget management)</text>
116
+ <polygon fill="none" stroke="black" points="276.79,-494.8 276.79,-525.6 932.83,-525.6 932.83,-494.8 276.79,-494.8"/>
117
+ <text text-anchor="start" x="283.79" y="-507" font-family="Arial" font-size="14.00">updated_at </text>
118
+ <text text-anchor="start" x="357.74" y="-507" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
119
+ <text text-anchor="start" x="523.47" y="-507" font-family="Arial" font-size="14.00"> When this memory was last modified</text>
120
+ </g>
121
+ <!-- public.nodes&#45;&gt;public.file_sources -->
122
+ <g id="edge1" class="edge">
123
+ <title>public.nodes:source_id&#45;&gt;public.file_sources:id</title>
124
+ <path fill="none" stroke="black" d="M944.08,-571.37C1119.98,-556.44 1037.41,-154 851.68,-154"/>
125
+ <polygon fill="black" stroke="black" points="944.15,-571.37 933.97,-567.29 938.82,-571.59 934.49,-571.77 934.49,-571.77 934.49,-571.77 938.82,-571.59 934.35,-576.28 944.15,-571.37"/>
126
+ <text text-anchor="start" x="940.83" y="-581.8" font-family="Arial" font-size="10.00">FOREIGN KEY (source_id) REFERENCES file_sources(id) ON DELETE SET NULL</text>
127
+ </g>
128
+ <!-- public.node_tags -->
129
+ <g id="node3" class="node">
130
+ <title>public.node_tags</title>
131
+ <polygon fill="#efefef" stroke="none" points="43.2,-1294.6 43.2,-1340.6 512.41,-1340.6 512.41,-1294.6 43.2,-1294.6"/>
132
+ <polygon fill="none" stroke="black" points="43.2,-1294.6 43.2,-1340.6 512.41,-1340.6 512.41,-1294.6 43.2,-1294.6"/>
133
+ <text text-anchor="start" x="154.32" y="-1318.4" font-family="Arial Bold" font-size="18.00">public.node_tags</text>
134
+ <text text-anchor="start" x="276.8" y="-1318.4" font-family="Arial" font-size="14.00">    </text>
135
+ <text text-anchor="start" x="307.92" y="-1318.4" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
136
+ <text text-anchor="start" x="116.72" y="-1304" font-family="Arial" font-size="14.00" fill="#333333">Join table connecting nodes to tags (many&#45;to&#45;many)</text>
137
+ <polygon fill="none" stroke="black" points="43.2,-1263.8 43.2,-1294.6 512.41,-1294.6 512.41,-1263.8 43.2,-1263.8"/>
138
+ <text text-anchor="start" x="50.2" y="-1276" font-family="Arial" font-size="14.00">created_at </text>
139
+ <text text-anchor="start" x="120.25" y="-1276" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
140
+ <text text-anchor="start" x="285.97" y="-1276" font-family="Arial" font-size="14.00"> When this association was created</text>
141
+ <polygon fill="none" stroke="black" points="43.2,-1233 43.2,-1263.8 512.41,-1263.8 512.41,-1233 43.2,-1233"/>
142
+ <text text-anchor="start" x="50.2" y="-1245.2" font-family="Arial" font-size="14.00">id </text>
143
+ <text text-anchor="start" x="64.99" y="-1245.2" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
144
+ <polygon fill="none" stroke="black" points="43.2,-1202.2 43.2,-1233 512.41,-1233 512.41,-1202.2 43.2,-1202.2"/>
145
+ <text text-anchor="start" x="50.2" y="-1214.4" font-family="Arial" font-size="14.00">node_id </text>
146
+ <text text-anchor="start" x="103.92" y="-1214.4" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
147
+ <text text-anchor="start" x="145.16" y="-1214.4" font-family="Arial" font-size="14.00"> ID of the node being tagged</text>
148
+ <polygon fill="none" stroke="black" points="43.2,-1171.4 43.2,-1202.2 512.41,-1202.2 512.41,-1171.4 43.2,-1171.4"/>
149
+ <text text-anchor="start" x="50.2" y="-1183.6" font-family="Arial" font-size="14.00">tag_id </text>
150
+ <text text-anchor="start" x="92.23" y="-1183.6" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
151
+ <text text-anchor="start" x="133.48" y="-1183.6" font-family="Arial" font-size="14.00"> ID of the tag being applied</text>
152
+ </g>
153
+ <!-- public.node_tags&#45;&gt;public.nodes -->
154
+ <g id="edge2" class="edge">
155
+ <title>public.node_tags:node_id&#45;&gt;public.nodes:id</title>
156
+ <path fill="none" stroke="black" d="M523.42,-1216.07C549.34,-1206.9 531.68,-1158.44 512.41,-1128.2 449.99,-1030.26 338.8,-1113.4 276.79,-1015.2 193.49,-883.3 119.79,-664.2 275.79,-664.2"/>
157
+ <polygon fill="black" stroke="black" points="523.63,-1216.04 513.06,-1213.1 518.35,-1216.85 514.07,-1217.5 514.07,-1217.5 514.07,-1217.5 518.35,-1216.85 514.42,-1222 523.63,-1216.04"/>
158
+ <text text-anchor="start" x="520.41" y="-1227.6" font-family="Arial" font-size="10.00">FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE</text>
159
+ </g>
160
+ <!-- public.robot_nodes -->
161
+ <g id="node4" class="node">
162
+ <title>public.robot_nodes</title>
163
+ <polygon fill="#efefef" stroke="none" points="617.06,-1371.6 617.06,-1417.6 1246.55,-1417.6 1246.55,-1371.6 617.06,-1371.6"/>
164
+ <polygon fill="none" stroke="black" points="617.06,-1371.6 617.06,-1417.6 1246.55,-1417.6 1246.55,-1371.6 617.06,-1371.6"/>
165
+ <text text-anchor="start" x="800.32" y="-1395.4" font-family="Arial Bold" font-size="18.00">public.robot_nodes</text>
166
+ <text text-anchor="start" x="938.8" y="-1395.4" font-family="Arial" font-size="14.00">    </text>
167
+ <text text-anchor="start" x="969.92" y="-1395.4" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
168
+ <text text-anchor="start" x="764.5" y="-1381" font-family="Arial" font-size="14.00" fill="#333333">Join table connecting robots to nodes (many&#45;to&#45;many)</text>
169
+ <polygon fill="none" stroke="black" points="617.06,-1340.8 617.06,-1371.6 1246.55,-1371.6 1246.55,-1340.8 617.06,-1340.8"/>
170
+ <text text-anchor="start" x="624.06" y="-1353" font-family="Arial" font-size="14.00">created_at </text>
171
+ <text text-anchor="start" x="694.11" y="-1353" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
172
+ <polygon fill="none" stroke="black" points="617.06,-1310 617.06,-1340.8 1246.55,-1340.8 1246.55,-1310 617.06,-1310"/>
173
+ <text text-anchor="start" x="624.06" y="-1322.2" font-family="Arial" font-size="14.00">first_remembered_at </text>
174
+ <text text-anchor="start" x="757.12" y="-1322.2" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
175
+ <text text-anchor="start" x="922.84" y="-1322.2" font-family="Arial" font-size="14.00"> When this robot first remembered this content</text>
176
+ <polygon fill="none" stroke="black" points="617.06,-1279.2 617.06,-1310 1246.55,-1310 1246.55,-1279.2 617.06,-1279.2"/>
177
+ <text text-anchor="start" x="624.06" y="-1291.4" font-family="Arial" font-size="14.00">id </text>
178
+ <text text-anchor="start" x="638.85" y="-1291.4" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
179
+ <polygon fill="none" stroke="black" points="617.06,-1248.4 617.06,-1279.2 1246.55,-1279.2 1246.55,-1248.4 617.06,-1248.4"/>
180
+ <text text-anchor="start" x="624.06" y="-1260.6" font-family="Arial" font-size="14.00">last_remembered_at </text>
181
+ <text text-anchor="start" x="756.35" y="-1260.6" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
182
+ <text text-anchor="start" x="922.08" y="-1260.6" font-family="Arial" font-size="14.00"> When this robot last tried to remember this content</text>
183
+ <polygon fill="none" stroke="black" points="617.06,-1217.6 617.06,-1248.4 1246.55,-1248.4 1246.55,-1217.6 617.06,-1217.6"/>
184
+ <text text-anchor="start" x="624.06" y="-1229.8" font-family="Arial" font-size="14.00">node_id </text>
185
+ <text text-anchor="start" x="677.78" y="-1229.8" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
186
+ <text text-anchor="start" x="719.03" y="-1229.8" font-family="Arial" font-size="14.00"> ID of the node being remembered</text>
187
+ <polygon fill="none" stroke="black" points="617.06,-1186.8 617.06,-1217.6 1246.55,-1217.6 1246.55,-1186.8 617.06,-1186.8"/>
188
+ <text text-anchor="start" x="624.06" y="-1199" font-family="Arial" font-size="14.00">remember_count </text>
189
+ <text text-anchor="start" x="733.78" y="-1199" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
190
+ <text text-anchor="start" x="784.37" y="-1199" font-family="Arial" font-size="14.00"> Number of times this robot has tried to remember this content</text>
191
+ <polygon fill="none" stroke="black" points="617.06,-1156 617.06,-1186.8 1246.55,-1186.8 1246.55,-1156 617.06,-1156"/>
192
+ <text text-anchor="start" x="624.06" y="-1168.2" font-family="Arial" font-size="14.00">robot_id </text>
193
+ <text text-anchor="start" x="678.54" y="-1168.2" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
194
+ <text text-anchor="start" x="719.79" y="-1168.2" font-family="Arial" font-size="14.00"> ID of the robot that remembered this node</text>
195
+ <polygon fill="none" stroke="black" points="617.06,-1125.2 617.06,-1156 1246.55,-1156 1246.55,-1125.2 617.06,-1125.2"/>
196
+ <text text-anchor="start" x="624.06" y="-1137.4" font-family="Arial" font-size="14.00">updated_at </text>
197
+ <text text-anchor="start" x="698.02" y="-1137.4" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
198
+ <polygon fill="none" stroke="black" points="617.06,-1094.4 617.06,-1125.2 1246.55,-1125.2 1246.55,-1094.4 617.06,-1094.4"/>
199
+ <text text-anchor="start" x="624.06" y="-1106.6" font-family="Arial" font-size="14.00">working_memory </text>
200
+ <text text-anchor="start" x="734.54" y="-1106.6" font-family="Arial" font-size="14.00" fill="#666666">[boolean]</text>
201
+ <text text-anchor="start" x="792.14" y="-1106.6" font-family="Arial" font-size="14.00"> True if this node is currently in the robot working memory</text>
202
+ </g>
203
+ <!-- public.robot_nodes&#45;&gt;public.nodes -->
204
+ <g id="edge3" class="edge">
205
+ <title>public.robot_nodes:node_id&#45;&gt;public.nodes:id</title>
206
+ <path fill="none" stroke="black" d="M605.82,-1232.28C537.81,-1222.19 565.52,-1108.63 617.06,-1051.2 711.4,-946.08 838.62,-1120.45 932.83,-1015.2 1036.86,-898.96 1089.83,-664.2 933.83,-664.2"/>
207
+ <polygon fill="black" stroke="black" points="605.75,-1232.28 615.41,-1237.47 611.07,-1232.65 615.39,-1232.95 615.39,-1232.95 615.39,-1232.95 611.07,-1232.65 616.04,-1228.49 605.75,-1232.28"/>
208
+ <text text-anchor="start" x="623.06" y="-1243" font-family="Arial" font-size="10.00">FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE</text>
209
+ </g>
210
+ </g>
211
+ </svg>
@@ -8,27 +8,27 @@ Join table connecting nodes to tags (many-to-many)
8
8
 
9
9
  | Name | Type | Default | Nullable | Children | Parents | Comment |
10
10
  | ---- | ---- | ------- | -------- | -------- | ------- | ------- |
11
+ | created_at | timestamp with time zone | CURRENT_TIMESTAMP | true | | | When this association was created |
11
12
  | id | bigint | nextval('node_tags_id_seq'::regclass) | false | | | |
12
13
  | node_id | bigint | | false | | [public.nodes](public.nodes.md) | ID of the node being tagged |
13
14
  | tag_id | bigint | | false | | [public.tags](public.tags.md) | ID of the tag being applied |
14
- | created_at | timestamp with time zone | CURRENT_TIMESTAMP | true | | | When this association was created |
15
15
 
16
16
  ## Constraints
17
17
 
18
18
  | Name | Type | Definition |
19
19
  | ---- | ---- | ---------- |
20
- | fk_rails_ebc9aafd9f | FOREIGN KEY | FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE |
21
20
  | fk_rails_b51cdcc57f | FOREIGN KEY | FOREIGN KEY (tag_id) REFERENCES tags(id) ON DELETE CASCADE |
21
+ | fk_rails_ebc9aafd9f | FOREIGN KEY | FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE |
22
22
  | node_tags_pkey | PRIMARY KEY | PRIMARY KEY (id) |
23
23
 
24
24
  ## Indexes
25
25
 
26
26
  | Name | Definition |
27
27
  | ---- | ---------- |
28
- | node_tags_pkey | CREATE UNIQUE INDEX node_tags_pkey ON public.node_tags USING btree (id) |
29
- | idx_node_tags_unique | CREATE UNIQUE INDEX idx_node_tags_unique ON public.node_tags USING btree (node_id, tag_id) |
30
28
  | idx_node_tags_node_id | CREATE INDEX idx_node_tags_node_id ON public.node_tags USING btree (node_id) |
31
29
  | idx_node_tags_tag_id | CREATE INDEX idx_node_tags_tag_id ON public.node_tags USING btree (tag_id) |
30
+ | idx_node_tags_unique | CREATE UNIQUE INDEX idx_node_tags_unique ON public.node_tags USING btree (node_id, tag_id) |
31
+ | node_tags_pkey | CREATE UNIQUE INDEX node_tags_pkey ON public.node_tags USING btree (id) |
32
32
 
33
33
  ## Relations
34
34