htm 0.0.2 → 0.0.10

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 (127) 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 +92 -0
  5. data/.irbrc +283 -80
  6. data/.tbls.yml +2 -1
  7. data/CHANGELOG.md +294 -26
  8. data/CLAUDE.md +603 -0
  9. data/README.md +76 -5
  10. data/Rakefile +5 -0
  11. data/db/migrate/{20250101000001_enable_extensions.rb → 00001_enable_extensions.rb} +0 -1
  12. data/db/migrate/00002_create_robots.rb +11 -0
  13. data/db/migrate/00003_create_file_sources.rb +20 -0
  14. data/db/migrate/00004_create_nodes.rb +65 -0
  15. data/db/migrate/00005_create_tags.rb +13 -0
  16. data/db/migrate/00006_create_node_tags.rb +18 -0
  17. data/db/migrate/00007_create_robot_nodes.rb +26 -0
  18. data/db/migrate/00009_add_working_memory_to_robot_nodes.rb +12 -0
  19. data/db/schema.sql +172 -1
  20. data/docs/api/database.md +1 -2
  21. data/docs/api/htm.md +197 -2
  22. data/docs/api/yard/HTM/ActiveRecordConfig.md +23 -0
  23. data/docs/api/yard/HTM/AuthorizationError.md +11 -0
  24. data/docs/api/yard/HTM/CircuitBreaker.md +92 -0
  25. data/docs/api/yard/HTM/CircuitBreakerOpenError.md +34 -0
  26. data/docs/api/yard/HTM/Configuration.md +175 -0
  27. data/docs/api/yard/HTM/Database.md +99 -0
  28. data/docs/api/yard/HTM/DatabaseError.md +14 -0
  29. data/docs/api/yard/HTM/EmbeddingError.md +18 -0
  30. data/docs/api/yard/HTM/EmbeddingService.md +58 -0
  31. data/docs/api/yard/HTM/Error.md +11 -0
  32. data/docs/api/yard/HTM/JobAdapter.md +39 -0
  33. data/docs/api/yard/HTM/LongTermMemory.md +342 -0
  34. data/docs/api/yard/HTM/NotFoundError.md +17 -0
  35. data/docs/api/yard/HTM/Observability.md +107 -0
  36. data/docs/api/yard/HTM/QueryTimeoutError.md +19 -0
  37. data/docs/api/yard/HTM/Railtie.md +27 -0
  38. data/docs/api/yard/HTM/ResourceExhaustedError.md +13 -0
  39. data/docs/api/yard/HTM/TagError.md +18 -0
  40. data/docs/api/yard/HTM/TagService.md +67 -0
  41. data/docs/api/yard/HTM/Timeframe/Result.md +24 -0
  42. data/docs/api/yard/HTM/Timeframe.md +40 -0
  43. data/docs/api/yard/HTM/TimeframeExtractor/Result.md +24 -0
  44. data/docs/api/yard/HTM/TimeframeExtractor.md +45 -0
  45. data/docs/api/yard/HTM/ValidationError.md +20 -0
  46. data/docs/api/yard/HTM/WorkingMemory.md +131 -0
  47. data/docs/api/yard/HTM.md +80 -0
  48. data/docs/api/yard/index.csv +179 -0
  49. data/docs/api/yard-reference.md +51 -0
  50. data/docs/database/README.md +128 -128
  51. data/docs/database/public.file_sources.md +42 -0
  52. data/docs/database/public.file_sources.svg +211 -0
  53. data/docs/database/public.node_tags.md +4 -4
  54. data/docs/database/public.node_tags.svg +212 -79
  55. data/docs/database/public.nodes.md +22 -12
  56. data/docs/database/public.nodes.svg +246 -127
  57. data/docs/database/public.robot_nodes.md +11 -9
  58. data/docs/database/public.robot_nodes.svg +220 -98
  59. data/docs/database/public.robots.md +2 -2
  60. data/docs/database/public.robots.svg +136 -81
  61. data/docs/database/public.tags.md +3 -3
  62. data/docs/database/public.tags.svg +118 -39
  63. data/docs/database/schema.json +850 -771
  64. data/docs/database/schema.svg +256 -197
  65. data/docs/development/schema.md +67 -2
  66. data/docs/guides/adding-memories.md +93 -7
  67. data/docs/guides/recalling-memories.md +36 -1
  68. data/examples/README.md +280 -0
  69. data/examples/cli_app/htm_cli.rb +65 -5
  70. data/examples/cli_app/temp.log +93 -0
  71. data/examples/file_loader_usage.rb +177 -0
  72. data/examples/robot_groups/lib/robot_group.rb +419 -0
  73. data/examples/robot_groups/lib/working_memory_channel.rb +140 -0
  74. data/examples/robot_groups/multi_process.rb +286 -0
  75. data/examples/robot_groups/robot_worker.rb +136 -0
  76. data/examples/robot_groups/same_process.rb +229 -0
  77. data/examples/timeframe_demo.rb +276 -0
  78. data/lib/htm/active_record_config.rb +1 -1
  79. data/lib/htm/circuit_breaker.rb +202 -0
  80. data/lib/htm/configuration.rb +59 -13
  81. data/lib/htm/database.rb +67 -36
  82. data/lib/htm/embedding_service.rb +39 -2
  83. data/lib/htm/errors.rb +131 -11
  84. data/lib/htm/jobs/generate_embedding_job.rb +5 -4
  85. data/lib/htm/jobs/generate_tags_job.rb +4 -0
  86. data/lib/htm/loaders/markdown_loader.rb +263 -0
  87. data/lib/htm/loaders/paragraph_chunker.rb +112 -0
  88. data/lib/htm/long_term_memory.rb +460 -343
  89. data/lib/htm/models/file_source.rb +99 -0
  90. data/lib/htm/models/node.rb +80 -5
  91. data/lib/htm/models/robot.rb +24 -1
  92. data/lib/htm/models/robot_node.rb +1 -0
  93. data/lib/htm/models/tag.rb +254 -4
  94. data/lib/htm/observability.rb +395 -0
  95. data/lib/htm/tag_service.rb +60 -3
  96. data/lib/htm/tasks.rb +26 -1
  97. data/lib/htm/timeframe.rb +194 -0
  98. data/lib/htm/timeframe_extractor.rb +307 -0
  99. data/lib/htm/version.rb +1 -1
  100. data/lib/htm/working_memory.rb +165 -70
  101. data/lib/htm.rb +328 -130
  102. data/lib/tasks/doc.rake +300 -0
  103. data/lib/tasks/files.rake +299 -0
  104. data/lib/tasks/htm.rake +158 -3
  105. data/lib/tasks/jobs.rake +3 -9
  106. data/lib/tasks/tags.rake +166 -6
  107. data/mkdocs.yml +36 -1
  108. data/notes/ARCHITECTURE_REVIEW.md +1167 -0
  109. data/notes/IMPLEMENTATION_SUMMARY.md +606 -0
  110. data/notes/MULTI_FRAMEWORK_IMPLEMENTATION.md +451 -0
  111. data/notes/next_steps.md +100 -0
  112. data/notes/plan.md +627 -0
  113. data/notes/tag_ontology_enhancement_ideas.md +222 -0
  114. data/notes/timescaledb_removal_summary.md +200 -0
  115. metadata +125 -15
  116. data/db/migrate/20250101000002_create_robots.rb +0 -14
  117. data/db/migrate/20250101000003_create_nodes.rb +0 -42
  118. data/db/migrate/20250101000005_create_tags.rb +0 -38
  119. data/db/migrate/20250101000007_add_node_vector_indexes.rb +0 -30
  120. data/db/migrate/20250125000001_add_content_hash_to_nodes.rb +0 -14
  121. data/db/migrate/20250125000002_create_robot_nodes.rb +0 -35
  122. data/db/migrate/20250125000003_remove_source_and_robot_id_from_nodes.rb +0 -28
  123. data/db/migrate/20250126000001_create_working_memories.rb +0 -19
  124. data/db/migrate/20250126000002_remove_unused_columns.rb +0 -12
  125. data/docs/database/public.working_memories.md +0 -40
  126. data/docs/database/public.working_memories.svg +0 -112
  127. data/lib/htm/models/working_memory_entry.rb +0 -88
@@ -4,103 +4,236 @@
4
4
  <!-- Generated by graphviz version 12.1.2 (20240928.0832)
5
5
  -->
6
6
  <!-- Title: public.node_tags Pages: 1 -->
7
- <svg width="961pt" height="725pt"
8
- viewBox="0.00 0.00 961.37 725.20" 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 721.2)">
7
+ <svg width="1460pt" height="1463pt"
8
+ viewBox="0.00 0.00 1459.73 1462.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 1458.8)">
10
10
  <title>public.node_tags</title>
11
- <polygon fill="white" stroke="none" points="-4,4 -4,-721.2 957.37,-721.2 957.37,4 -4,4"/>
11
+ <polygon fill="white" stroke="none" points="-4,4 -4,-1458.8 1455.73,-1458.8 1455.73,4 -4,4"/>
12
12
  <!-- public.node_tags -->
13
13
  <g id="node1" class="node">
14
14
  <title>public.node_tags</title>
15
- <polygon fill="#efefef" stroke="none" points="354.55,-635.4 354.55,-671 615.51,-671 615.51,-635.4 354.55,-635.4"/>
16
- <polygon fill="none" stroke="black" points="354.55,-635.4 354.55,-671 615.51,-671 615.51,-635.4 354.55,-635.4"/>
17
- <text text-anchor="start" x="361.55" y="-648.8" font-family="Arial Bold" font-size="18.00">public.node_tags</text>
18
- <text text-anchor="start" x="484.02" y="-648.8" font-family="Arial" font-size="14.00">    </text>
19
- <text text-anchor="start" x="515.14" y="-648.8" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
20
- <polygon fill="none" stroke="black" points="354.55,-604.6 354.55,-635.4 615.51,-635.4 615.51,-604.6 354.55,-604.6"/>
21
- <text text-anchor="start" x="361.55" y="-616.8" font-family="Arial" font-size="14.00">id </text>
22
- <text text-anchor="start" x="376.33" y="-616.8" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
23
- <polygon fill="none" stroke="black" points="354.55,-573.8 354.55,-604.6 615.51,-604.6 615.51,-573.8 354.55,-573.8"/>
24
- <text text-anchor="start" x="361.55" y="-586" font-family="Arial" font-size="14.00">node_id </text>
25
- <text text-anchor="start" x="415.26" y="-586" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
26
- <polygon fill="none" stroke="black" points="354.55,-543 354.55,-573.8 615.51,-573.8 615.51,-543 354.55,-543"/>
27
- <text text-anchor="start" x="361.55" y="-555.2" font-family="Arial" font-size="14.00">tag_id </text>
28
- <text text-anchor="start" x="403.58" y="-555.2" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
29
- <polygon fill="none" stroke="black" points="354.55,-512.2 354.55,-543 615.51,-543 615.51,-512.2 354.55,-512.2"/>
30
- <text text-anchor="start" x="361.55" y="-524.4" font-family="Arial" font-size="14.00">created_at </text>
31
- <text text-anchor="start" x="431.59" y="-524.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="353.05,-510.7 353.05,-672.5 617.01,-672.5 617.01,-510.7 353.05,-510.7"/>
15
+ <polygon fill="#efefef" stroke="none" points="832.61,-1288.6 832.61,-1334.6 1301.83,-1334.6 1301.83,-1288.6 832.61,-1288.6"/>
16
+ <polygon fill="none" stroke="black" points="832.61,-1288.6 832.61,-1334.6 1301.83,-1334.6 1301.83,-1288.6 832.61,-1288.6"/>
17
+ <text text-anchor="start" x="943.74" y="-1312.4" font-family="Arial Bold" font-size="18.00">public.node_tags</text>
18
+ <text text-anchor="start" x="1066.21" y="-1312.4" font-family="Arial" font-size="14.00">    </text>
19
+ <text text-anchor="start" x="1097.33" y="-1312.4" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
20
+ <text text-anchor="start" x="906.13" y="-1298" font-family="Arial" font-size="14.00" fill="#333333">Join table connecting nodes to tags (many&#45;to&#45;many)</text>
21
+ <polygon fill="none" stroke="black" points="832.61,-1257.8 832.61,-1288.6 1301.83,-1288.6 1301.83,-1257.8 832.61,-1257.8"/>
22
+ <text text-anchor="start" x="839.61" y="-1270" font-family="Arial" font-size="14.00">created_at </text>
23
+ <text text-anchor="start" x="909.66" y="-1270" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
24
+ <text text-anchor="start" x="1075.38" y="-1270" font-family="Arial" font-size="14.00"> When this association was created</text>
25
+ <polygon fill="none" stroke="black" points="832.61,-1227 832.61,-1257.8 1301.83,-1257.8 1301.83,-1227 832.61,-1227"/>
26
+ <text text-anchor="start" x="839.61" y="-1239.2" font-family="Arial" font-size="14.00">id </text>
27
+ <text text-anchor="start" x="854.4" y="-1239.2" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
28
+ <polygon fill="none" stroke="black" points="832.61,-1196.2 832.61,-1227 1301.83,-1227 1301.83,-1196.2 832.61,-1196.2"/>
29
+ <text text-anchor="start" x="839.61" y="-1208.4" font-family="Arial" font-size="14.00">node_id </text>
30
+ <text text-anchor="start" x="893.33" y="-1208.4" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
31
+ <text text-anchor="start" x="934.58" y="-1208.4" font-family="Arial" font-size="14.00"> ID of the node being tagged</text>
32
+ <polygon fill="none" stroke="black" points="832.61,-1165.4 832.61,-1196.2 1301.83,-1196.2 1301.83,-1165.4 832.61,-1165.4"/>
33
+ <text text-anchor="start" x="839.61" y="-1177.6" font-family="Arial" font-size="14.00">tag_id </text>
34
+ <text text-anchor="start" x="881.65" y="-1177.6" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
35
+ <text text-anchor="start" x="922.9" y="-1177.6" font-family="Arial" font-size="14.00"> ID of the tag being applied</text>
36
+ <polygon fill="none" stroke="black" stroke-width="3" points="831.11,-1163.9 831.11,-1336.1 1303.33,-1336.1 1303.33,-1163.9 831.11,-1163.9"/>
33
37
  </g>
34
38
  <!-- public.nodes -->
35
39
  <g id="node2" class="node">
36
40
  <title>public.nodes</title>
37
- <polygon fill="#efefef" stroke="none" points="166.86,-351.2 166.86,-386.8 439.19,-386.8 439.19,-351.2 166.86,-351.2"/>
38
- <polygon fill="none" stroke="black" points="166.86,-351.2 166.86,-386.8 439.19,-386.8 439.19,-351.2 166.86,-351.2"/>
39
- <text text-anchor="start" x="195.04" y="-364.6" font-family="Arial Bold" font-size="18.00">public.nodes</text>
40
- <text text-anchor="start" x="286.53" y="-364.6" font-family="Arial" font-size="14.00">    </text>
41
- <text text-anchor="start" x="317.64" y="-364.6" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
42
- <polygon fill="none" stroke="black" points="166.86,-320.4 166.86,-351.2 439.19,-351.2 439.19,-320.4 166.86,-320.4"/>
43
- <text text-anchor="start" x="173.86" y="-332.6" font-family="Arial" font-size="14.00">id </text>
44
- <text text-anchor="start" x="188.65" y="-332.6" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
45
- <polygon fill="none" stroke="black" points="166.86,-289.6 166.86,-320.4 439.19,-320.4 439.19,-289.6 166.86,-289.6"/>
46
- <text text-anchor="start" x="173.86" y="-301.8" font-family="Arial" font-size="14.00">content </text>
47
- <text text-anchor="start" x="223.68" y="-301.8" font-family="Arial" font-size="14.00" fill="#666666">[text]</text>
48
- <polygon fill="none" stroke="black" points="166.86,-258.8 166.86,-289.6 439.19,-289.6 439.19,-258.8 166.86,-258.8"/>
49
- <text text-anchor="start" x="173.86" y="-271" font-family="Arial" font-size="14.00">access_count </text>
50
- <text text-anchor="start" x="263.36" y="-271" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
51
- <polygon fill="none" stroke="black" points="166.86,-228 166.86,-258.8 439.19,-258.8 439.19,-228 166.86,-228"/>
52
- <text text-anchor="start" x="173.86" y="-240.2" font-family="Arial" font-size="14.00">created_at </text>
53
- <text text-anchor="start" x="243.91" y="-240.2" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
54
- <polygon fill="none" stroke="black" points="166.86,-197.2 166.86,-228 439.19,-228 439.19,-197.2 166.86,-197.2"/>
55
- <text text-anchor="start" x="173.86" y="-209.4" font-family="Arial" font-size="14.00">updated_at </text>
56
- <text text-anchor="start" x="247.82" y="-209.4" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
57
- <polygon fill="none" stroke="black" points="166.86,-166.4 166.86,-197.2 439.19,-197.2 439.19,-166.4 166.86,-166.4"/>
58
- <text text-anchor="start" x="173.86" y="-178.6" font-family="Arial" font-size="14.00">last_accessed </text>
59
- <text text-anchor="start" x="266.47" y="-178.6" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
60
- <polygon fill="none" stroke="black" points="166.86,-135.6 166.86,-166.4 439.19,-166.4 439.19,-135.6 166.86,-135.6"/>
61
- <text text-anchor="start" x="173.86" y="-147.8" font-family="Arial" font-size="14.00">token_count </text>
62
- <text text-anchor="start" x="254.04" y="-147.8" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
63
- <polygon fill="none" stroke="black" points="166.86,-104.8 166.86,-135.6 439.19,-135.6 439.19,-104.8 166.86,-104.8"/>
64
- <text text-anchor="start" x="173.86" y="-117" font-family="Arial" font-size="14.00">embedding </text>
65
- <text text-anchor="start" x="247.03" y="-117" font-family="Arial" font-size="14.00" fill="#666666">[vector(2000)]</text>
66
- <polygon fill="none" stroke="black" points="166.86,-74 166.86,-104.8 439.19,-104.8 439.19,-74 166.86,-74"/>
67
- <text text-anchor="start" x="173.86" y="-86.2" font-family="Arial" font-size="14.00">embedding_dimension </text>
68
- <text text-anchor="start" x="318.63" y="-86.2" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
69
- <polygon fill="none" stroke="black" points="166.86,-43.2 166.86,-74 439.19,-74 439.19,-43.2 166.86,-43.2"/>
70
- <text text-anchor="start" x="173.86" y="-55.4" font-family="Arial" font-size="14.00">content_hash </text>
71
- <text text-anchor="start" x="261.82" y="-55.4" font-family="Arial" font-size="14.00" fill="#666666">[varchar(64)]</text>
41
+ <polygon fill="#efefef" stroke="none" points="43.2,-920 43.2,-966 699.24,-966 699.24,-920 43.2,-920"/>
42
+ <polygon fill="none" stroke="black" points="43.2,-920 43.2,-966 699.24,-966 699.24,-920 43.2,-920"/>
43
+ <text text-anchor="start" x="263.23" y="-943.8" font-family="Arial Bold" font-size="18.00">public.nodes</text>
44
+ <text text-anchor="start" x="354.72" y="-943.8" font-family="Arial" font-size="14.00">    </text>
45
+ <text text-anchor="start" x="385.83" y="-943.8" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
46
+ <text text-anchor="start" x="179.8" y="-929.4" font-family="Arial" font-size="14.00" fill="#333333">Core memory storage for conversation messages and context</text>
47
+ <polygon fill="none" stroke="black" points="43.2,-889.2 43.2,-920 699.24,-920 699.24,-889.2 43.2,-889.2"/>
48
+ <text text-anchor="start" x="50.2" y="-901.4" font-family="Arial" font-size="14.00">access_count </text>
49
+ <text text-anchor="start" x="139.7" y="-901.4" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
50
+ <text text-anchor="start" x="190.28" y="-901.4" font-family="Arial" font-size="14.00"> Number of times this node has been accessed/retrieved</text>
51
+ <polygon fill="none" stroke="black" points="43.2,-858.4 43.2,-889.2 699.24,-889.2 699.24,-858.4 43.2,-858.4"/>
52
+ <text text-anchor="start" x="50.2" y="-870.6" font-family="Arial" font-size="14.00">chunk_position </text>
53
+ <text text-anchor="start" x="147.49" y="-870.6" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
54
+ <text text-anchor="start" x="198.07" y="-870.6" font-family="Arial" font-size="14.00"> Position within source file (0&#45;indexed)</text>
55
+ <polygon fill="none" stroke="black" points="43.2,-827.6 43.2,-858.4 699.24,-858.4 699.24,-827.6 43.2,-827.6"/>
56
+ <text text-anchor="start" x="50.2" y="-839.8" font-family="Arial" font-size="14.00">content </text>
57
+ <text text-anchor="start" x="100.01" y="-839.8" font-family="Arial" font-size="14.00" fill="#666666">[text]</text>
58
+ <text text-anchor="start" x="130.36" y="-839.8" font-family="Arial" font-size="14.00"> The conversation message/utterance content</text>
59
+ <polygon fill="none" stroke="black" points="43.2,-796.8 43.2,-827.6 699.24,-827.6 699.24,-796.8 43.2,-796.8"/>
60
+ <text text-anchor="start" x="50.2" y="-809" font-family="Arial" font-size="14.00">content_hash </text>
61
+ <text text-anchor="start" x="138.16" y="-809" font-family="Arial" font-size="14.00" fill="#666666">[varchar(64)]</text>
62
+ <text text-anchor="start" x="217.52" y="-809" font-family="Arial" font-size="14.00"> SHA&#45;256 hash of content for deduplication</text>
63
+ <polygon fill="none" stroke="black" points="43.2,-766 43.2,-796.8 699.24,-796.8 699.24,-766 43.2,-766"/>
64
+ <text text-anchor="start" x="50.2" y="-778.2" font-family="Arial" font-size="14.00">created_at </text>
65
+ <text text-anchor="start" x="120.25" y="-778.2" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
66
+ <text text-anchor="start" x="285.97" y="-778.2" font-family="Arial" font-size="14.00"> When this memory was created</text>
67
+ <polygon fill="none" stroke="black" points="43.2,-735.2 43.2,-766 699.24,-766 699.24,-735.2 43.2,-735.2"/>
68
+ <text text-anchor="start" x="50.2" y="-747.4" font-family="Arial" font-size="14.00">deleted_at </text>
69
+ <text text-anchor="start" x="119.48" y="-747.4" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
70
+ <text text-anchor="start" x="285.21" y="-747.4" font-family="Arial" font-size="14.00"> Soft delete timestamp &#45; node is considered deleted when set</text>
71
+ <polygon fill="none" stroke="black" points="43.2,-704.4 43.2,-735.2 699.24,-735.2 699.24,-704.4 43.2,-704.4"/>
72
+ <text text-anchor="start" x="50.2" y="-716.6" font-family="Arial" font-size="14.00">embedding </text>
73
+ <text text-anchor="start" x="123.37" y="-716.6" font-family="Arial" font-size="14.00" fill="#666666">[vector(2000)]</text>
74
+ <text text-anchor="start" x="209.74" y="-716.6" font-family="Arial" font-size="14.00"> Vector embedding (max 2000 dimensions) for semantic search</text>
75
+ <polygon fill="none" stroke="black" points="43.2,-673.6 43.2,-704.4 699.24,-704.4 699.24,-673.6 43.2,-673.6"/>
76
+ <text text-anchor="start" x="50.2" y="-685.8" font-family="Arial" font-size="14.00">embedding_dimension </text>
77
+ <text text-anchor="start" x="194.96" y="-685.8" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
78
+ <text text-anchor="start" x="245.55" y="-685.8" font-family="Arial" font-size="14.00"> Actual number of dimensions used in the embedding vector (max 2000)</text>
79
+ <polygon fill="none" stroke="black" points="43.2,-642.8 43.2,-673.6 699.24,-673.6 699.24,-642.8 43.2,-642.8"/>
80
+ <text text-anchor="start" x="50.2" y="-655" font-family="Arial" font-size="14.00">id </text>
81
+ <text text-anchor="start" x="64.99" y="-655" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
82
+ <polygon fill="none" stroke="black" points="43.2,-612 43.2,-642.8 699.24,-642.8 699.24,-612 43.2,-612"/>
83
+ <text text-anchor="start" x="50.2" y="-624.2" font-family="Arial" font-size="14.00">last_accessed </text>
84
+ <text text-anchor="start" x="142.81" y="-624.2" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
85
+ <text text-anchor="start" x="308.53" y="-624.2" font-family="Arial" font-size="14.00"> When this memory was last accessed</text>
86
+ <polygon fill="none" stroke="black" points="43.2,-581.2 43.2,-612 699.24,-612 699.24,-581.2 43.2,-581.2"/>
87
+ <text text-anchor="start" x="50.2" y="-593.4" font-family="Arial" font-size="14.00">metadata </text>
88
+ <text text-anchor="start" x="112.46" y="-593.4" font-family="Arial" font-size="14.00" fill="#666666">[jsonb]</text>
89
+ <text text-anchor="start" x="153.71" y="-593.4" font-family="Arial" font-size="14.00"> Flexible metadata storage (memory_type, importance, source, etc.)</text>
90
+ <polygon fill="none" stroke="black" points="43.2,-550.4 43.2,-581.2 699.24,-581.2 699.24,-550.4 43.2,-550.4"/>
91
+ <text text-anchor="start" x="50.2" y="-562.6" font-family="Arial" font-size="14.00">source_id </text>
92
+ <text text-anchor="start" x="114.79" y="-562.6" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
93
+ <text text-anchor="start" x="156.04" y="-562.6" font-family="Arial" font-size="14.00"> Reference to source file (for file&#45;loaded nodes)</text>
94
+ <polygon fill="none" stroke="black" points="43.2,-519.6 43.2,-550.4 699.24,-550.4 699.24,-519.6 43.2,-519.6"/>
95
+ <text text-anchor="start" x="50.2" y="-531.8" font-family="Arial" font-size="14.00">token_count </text>
96
+ <text text-anchor="start" x="130.37" y="-531.8" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
97
+ <text text-anchor="start" x="180.96" y="-531.8" font-family="Arial" font-size="14.00"> Number of tokens in the content (for context budget management)</text>
98
+ <polygon fill="none" stroke="black" points="43.2,-488.8 43.2,-519.6 699.24,-519.6 699.24,-488.8 43.2,-488.8"/>
99
+ <text text-anchor="start" x="50.2" y="-501" font-family="Arial" font-size="14.00">updated_at </text>
100
+ <text text-anchor="start" x="124.16" y="-501" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
101
+ <text text-anchor="start" x="289.88" y="-501" font-family="Arial" font-size="14.00"> When this memory was last modified</text>
72
102
  </g>
73
103
  <!-- public.node_tags&#45;&gt;public.nodes -->
74
104
  <g id="edge1" class="edge">
75
105
  <title>public.node_tags:node_id&#45;&gt;public.nodes:id</title>
76
- <path fill="none" stroke="black" d="M343.42,-588.15C302.28,-578.73 326.23,-508.44 354.55,-466 377.24,-431.99 416.46,-463.98 439.19,-430 462.48,-395.2 482.06,-335.8 440.19,-335.8"/>
77
- <polygon fill="black" stroke="black" points="343.27,-588.13 352.75,-593.64 348.57,-588.68 352.88,-589.13 352.88,-589.13 352.88,-589.13 348.57,-588.68 353.68,-584.69 343.27,-588.13"/>
78
- <text text-anchor="start" x="7" y="-599.2" font-family="Arial" font-size="10.00">FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE</text>
106
+ <path fill="none" stroke="black" d="M821.4,-1211.16C737.8,-1203.54 775.28,-1099.24 751.22,-1009.2 730.87,-933.05 779.06,-658.2 700.24,-658.2"/>
107
+ <polygon fill="black" stroke="black" points="821.29,-1211.15 831.08,-1216.08 826.62,-1211.38 830.94,-1211.57 830.94,-1211.57 830.94,-1211.57 826.62,-1211.38 831.47,-1207.09 821.29,-1211.15"/>
108
+ <text text-anchor="start" x="573.45" y="-1195.6" font-family="Arial" font-size="10.00">FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE</text>
79
109
  </g>
80
110
  <!-- public.tags -->
81
- <g id="node3" class="node">
111
+ <g id="node5" class="node">
82
112
  <title>public.tags</title>
83
- <polygon fill="#efefef" stroke="none" points="543.14,-243.4 543.14,-279 792.91,-279 792.91,-243.4 543.14,-243.4"/>
84
- <polygon fill="none" stroke="black" points="543.14,-243.4 543.14,-279 792.91,-279 792.91,-243.4 543.14,-243.4"/>
85
- <text text-anchor="start" x="566.54" y="-256.8" font-family="Arial Bold" font-size="18.00">public.tags</text>
86
- <text text-anchor="start" x="645.03" y="-256.8" font-family="Arial" font-size="14.00">    </text>
87
- <text text-anchor="start" x="676.14" y="-256.8" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
88
- <polygon fill="none" stroke="black" points="543.14,-212.6 543.14,-243.4 792.91,-243.4 792.91,-212.6 543.14,-212.6"/>
89
- <text text-anchor="start" x="550.14" y="-224.8" font-family="Arial" font-size="14.00">id </text>
90
- <text text-anchor="start" x="564.93" y="-224.8" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
91
- <polygon fill="none" stroke="black" points="543.14,-181.8 543.14,-212.6 792.91,-212.6 792.91,-181.8 543.14,-181.8"/>
92
- <text text-anchor="start" x="550.14" y="-194" font-family="Arial" font-size="14.00">name </text>
93
- <text text-anchor="start" x="589.05" y="-194" font-family="Arial" font-size="14.00" fill="#666666">[text]</text>
94
- <polygon fill="none" stroke="black" points="543.14,-151 543.14,-181.8 792.91,-181.8 792.91,-151 543.14,-151"/>
95
- <text text-anchor="start" x="550.14" y="-163.2" font-family="Arial" font-size="14.00">created_at </text>
96
- <text text-anchor="start" x="620.19" y="-163.2" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
113
+ <polygon fill="#efefef" stroke="none" points="803.91,-750.6 803.91,-796.6 1408.53,-796.6 1408.53,-750.6 803.91,-750.6"/>
114
+ <polygon fill="none" stroke="black" points="803.91,-750.6 803.91,-796.6 1408.53,-796.6 1408.53,-750.6 803.91,-750.6"/>
115
+ <text text-anchor="start" x="1004.73" y="-774.4" font-family="Arial Bold" font-size="18.00">public.tags</text>
116
+ <text text-anchor="start" x="1083.22" y="-774.4" font-family="Arial" font-size="14.00">    </text>
117
+ <text text-anchor="start" x="1114.33" y="-774.4" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
118
+ <text text-anchor="start" x="993.76" y="-760" font-family="Arial" font-size="14.00" fill="#333333">Unique tag names for categorization</text>
119
+ <polygon fill="none" stroke="black" points="803.91,-719.8 803.91,-750.6 1408.53,-750.6 1408.53,-719.8 803.91,-719.8"/>
120
+ <text text-anchor="start" x="810.91" y="-732" font-family="Arial" font-size="14.00">created_at </text>
121
+ <text text-anchor="start" x="880.95" y="-732" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
122
+ <text text-anchor="start" x="1046.68" y="-732" font-family="Arial" font-size="14.00"> When this tag was created</text>
123
+ <polygon fill="none" stroke="black" points="803.91,-689 803.91,-719.8 1408.53,-719.8 1408.53,-689 803.91,-689"/>
124
+ <text text-anchor="start" x="810.91" y="-701.2" font-family="Arial" font-size="14.00">id </text>
125
+ <text text-anchor="start" x="825.69" y="-701.2" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
126
+ <polygon fill="none" stroke="black" points="803.91,-658.2 803.91,-689 1408.53,-689 1408.53,-658.2 803.91,-658.2"/>
127
+ <text text-anchor="start" x="810.91" y="-670.4" font-family="Arial" font-size="14.00">name </text>
128
+ <text text-anchor="start" x="849.82" y="-670.4" font-family="Arial" font-size="14.00" fill="#666666">[text]</text>
129
+ <text text-anchor="start" x="880.16" y="-670.4" font-family="Arial" font-size="14.00"> Hierarchical tag in format: root:level1:level2 (e.g., database:postgresql:timescaledb)</text>
97
130
  </g>
98
131
  <!-- public.node_tags&#45;&gt;public.tags -->
99
- <g id="edge2" class="edge">
132
+ <g id="edge4" class="edge">
100
133
  <title>public.node_tags:tag_id&#45;&gt;public.tags:id</title>
101
- <path fill="none" stroke="black" d="M626.61,-557.82C749.01,-542.46 395.3,-228 542.14,-228"/>
102
- <polygon fill="black" stroke="black" points="626.83,-557.81 616.59,-553.89 621.5,-558.11 617.18,-558.36 617.18,-558.36 617.18,-558.36 621.5,-558.11 617.1,-562.87 626.83,-557.81"/>
103
- <text text-anchor="start" x="623.51" y="-568.4" font-family="Arial" font-size="10.00">FOREIGN KEY (tag_id) REFERENCES tags(id) ON DELETE CASCADE</text>
134
+ <path fill="none" stroke="black" d="M1067,-1154.03C1059.63,-979.93 865.44,-1011.32 803.91,-839.8 783.58,-783.16 742.73,-704.4 802.91,-704.4"/>
135
+ <polygon fill="black" stroke="black" points="1067,-1154.07 1062.71,-1164.16 1067.11,-1159.4 1067.21,-1163.73 1067.21,-1163.73 1067.21,-1163.73 1067.11,-1159.4 1071.71,-1163.97 1067,-1154.07"/>
136
+ <text text-anchor="start" x="1074.22" y="-1174.4" font-family="Arial" font-size="10.00">FOREIGN KEY (tag_id) REFERENCES tags(id) ON DELETE CASCADE</text>
137
+ </g>
138
+ <!-- public.file_sources -->
139
+ <g id="node4" class="node">
140
+ <title>public.file_sources</title>
141
+ <polygon fill="#efefef" stroke="none" points="125.35,-320.4 125.35,-366.4 617.09,-366.4 617.09,-320.4 125.35,-320.4"/>
142
+ <polygon fill="none" stroke="black" points="125.35,-320.4 125.35,-366.4 617.09,-366.4 617.09,-320.4 125.35,-320.4"/>
143
+ <text text-anchor="start" x="240.74" y="-344.2" font-family="Arial Bold" font-size="18.00">public.file_sources</text>
144
+ <text text-anchor="start" x="377.2" y="-344.2" font-family="Arial" font-size="14.00">    </text>
145
+ <text text-anchor="start" x="408.32" y="-344.2" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
146
+ <text text-anchor="start" x="237.75" y="-329.8" font-family="Arial" font-size="14.00" fill="#333333">Source file metadata for loaded documents</text>
147
+ <polygon fill="none" stroke="black" points="125.35,-289.6 125.35,-320.4 617.09,-320.4 617.09,-289.6 125.35,-289.6"/>
148
+ <text text-anchor="start" x="132.35" y="-301.8" font-family="Arial" font-size="14.00">created_at </text>
149
+ <text text-anchor="start" x="202.4" y="-301.8" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
150
+ <polygon fill="none" stroke="black" points="125.35,-258.8 125.35,-289.6 617.09,-289.6 617.09,-258.8 125.35,-258.8"/>
151
+ <text text-anchor="start" x="132.35" y="-271" font-family="Arial" font-size="14.00">file_hash </text>
152
+ <text text-anchor="start" x="192.28" y="-271" font-family="Arial" font-size="14.00" fill="#666666">[varchar(64)]</text>
153
+ <text text-anchor="start" x="271.64" y="-271" font-family="Arial" font-size="14.00"> SHA&#45;256 hash of file content</text>
154
+ <polygon fill="none" stroke="black" points="125.35,-228 125.35,-258.8 617.09,-258.8 617.09,-228 125.35,-228"/>
155
+ <text text-anchor="start" x="132.35" y="-240.2" font-family="Arial" font-size="14.00">file_path </text>
156
+ <text text-anchor="start" x="189.17" y="-240.2" font-family="Arial" font-size="14.00" fill="#666666">[text]</text>
157
+ <text text-anchor="start" x="219.51" y="-240.2" font-family="Arial" font-size="14.00"> Absolute path to source file</text>
158
+ <polygon fill="none" stroke="black" points="125.35,-197.2 125.35,-228 617.09,-228 617.09,-197.2 125.35,-197.2"/>
159
+ <text text-anchor="start" x="132.35" y="-209.4" font-family="Arial" font-size="14.00">file_size </text>
160
+ <text text-anchor="start" x="186.82" y="-209.4" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
161
+ <text text-anchor="start" x="237.4" y="-209.4" font-family="Arial" font-size="14.00"> File size in bytes</text>
162
+ <polygon fill="none" stroke="black" points="125.35,-166.4 125.35,-197.2 617.09,-197.2 617.09,-166.4 125.35,-166.4"/>
163
+ <text text-anchor="start" x="132.35" y="-178.6" font-family="Arial" font-size="14.00">frontmatter </text>
164
+ <text text-anchor="start" x="203.93" y="-178.6" font-family="Arial" font-size="14.00" fill="#666666">[jsonb]</text>
165
+ <text text-anchor="start" x="245.17" y="-178.6" font-family="Arial" font-size="14.00"> Parsed YAML frontmatter</text>
166
+ <polygon fill="none" stroke="black" points="125.35,-135.6 125.35,-166.4 617.09,-166.4 617.09,-135.6 125.35,-135.6"/>
167
+ <text text-anchor="start" x="132.35" y="-147.8" font-family="Arial" font-size="14.00">id </text>
168
+ <text text-anchor="start" x="147.13" y="-147.8" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
169
+ <polygon fill="none" stroke="black" points="125.35,-104.8 125.35,-135.6 617.09,-135.6 617.09,-104.8 125.35,-104.8"/>
170
+ <text text-anchor="start" x="132.35" y="-117" font-family="Arial" font-size="14.00">last_synced_at </text>
171
+ <text text-anchor="start" x="229.63" y="-117" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
172
+ <text text-anchor="start" x="395.35" y="-117" font-family="Arial" font-size="14.00"> When file was last synced to HTM</text>
173
+ <polygon fill="none" stroke="black" points="125.35,-74 125.35,-104.8 617.09,-104.8 617.09,-74 125.35,-74"/>
174
+ <text text-anchor="start" x="132.35" y="-86.2" font-family="Arial" font-size="14.00">mtime </text>
175
+ <text text-anchor="start" x="174.35" y="-86.2" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
176
+ <text text-anchor="start" x="340.07" y="-86.2" font-family="Arial" font-size="14.00"> File modification time</text>
177
+ <polygon fill="none" stroke="black" points="125.35,-43.2 125.35,-74 617.09,-74 617.09,-43.2 125.35,-43.2"/>
178
+ <text text-anchor="start" x="132.35" y="-55.4" font-family="Arial" font-size="14.00">updated_at </text>
179
+ <text text-anchor="start" x="206.31" y="-55.4" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
180
+ </g>
181
+ <!-- public.nodes&#45;&gt;public.file_sources -->
182
+ <g id="edge3" class="edge">
183
+ <title>public.nodes:source_id&#45;&gt;public.file_sources:id</title>
184
+ <path fill="none" stroke="black" d="M710.45,-563.95C787.77,-534.03 708.39,-151 618.09,-151"/>
185
+ <polygon fill="black" stroke="black" points="710.41,-563.96 699.77,-561.31 705.16,-564.91 700.9,-565.68 700.9,-565.68 700.9,-565.68 705.16,-564.91 701.37,-570.17 710.41,-563.96"/>
186
+ <text text-anchor="start" x="707.24" y="-575.8" font-family="Arial" font-size="10.00">FOREIGN KEY (source_id) REFERENCES file_sources(id) ON DELETE SET NULL</text>
187
+ </g>
188
+ <!-- public.robot_nodes -->
189
+ <g id="node3" class="node">
190
+ <title>public.robot_nodes</title>
191
+ <polygon fill="#efefef" stroke="none" points="56.48,-1365.6 56.48,-1411.6 685.96,-1411.6 685.96,-1365.6 56.48,-1365.6"/>
192
+ <polygon fill="none" stroke="black" points="56.48,-1365.6 56.48,-1411.6 685.96,-1411.6 685.96,-1365.6 56.48,-1365.6"/>
193
+ <text text-anchor="start" x="239.73" y="-1389.4" font-family="Arial Bold" font-size="18.00">public.robot_nodes</text>
194
+ <text text-anchor="start" x="378.21" y="-1389.4" font-family="Arial" font-size="14.00">    </text>
195
+ <text text-anchor="start" x="409.33" y="-1389.4" font-family="Arial" font-size="14.00" fill="#666666">[BASE TABLE]</text>
196
+ <text text-anchor="start" x="203.91" y="-1375" font-family="Arial" font-size="14.00" fill="#333333">Join table connecting robots to nodes (many&#45;to&#45;many)</text>
197
+ <polygon fill="none" stroke="black" points="56.48,-1334.8 56.48,-1365.6 685.96,-1365.6 685.96,-1334.8 56.48,-1334.8"/>
198
+ <text text-anchor="start" x="63.48" y="-1347" font-family="Arial" font-size="14.00">created_at </text>
199
+ <text text-anchor="start" x="133.52" y="-1347" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
200
+ <polygon fill="none" stroke="black" points="56.48,-1304 56.48,-1334.8 685.96,-1334.8 685.96,-1304 56.48,-1304"/>
201
+ <text text-anchor="start" x="63.48" y="-1316.2" font-family="Arial" font-size="14.00">first_remembered_at </text>
202
+ <text text-anchor="start" x="196.53" y="-1316.2" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
203
+ <text text-anchor="start" x="362.25" y="-1316.2" font-family="Arial" font-size="14.00"> When this robot first remembered this content</text>
204
+ <polygon fill="none" stroke="black" points="56.48,-1273.2 56.48,-1304 685.96,-1304 685.96,-1273.2 56.48,-1273.2"/>
205
+ <text text-anchor="start" x="63.48" y="-1285.4" font-family="Arial" font-size="14.00">id </text>
206
+ <text text-anchor="start" x="78.26" y="-1285.4" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
207
+ <polygon fill="none" stroke="black" points="56.48,-1242.4 56.48,-1273.2 685.96,-1273.2 685.96,-1242.4 56.48,-1242.4"/>
208
+ <text text-anchor="start" x="63.48" y="-1254.6" font-family="Arial" font-size="14.00">last_remembered_at </text>
209
+ <text text-anchor="start" x="195.76" y="-1254.6" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
210
+ <text text-anchor="start" x="361.49" y="-1254.6" font-family="Arial" font-size="14.00"> When this robot last tried to remember this content</text>
211
+ <polygon fill="none" stroke="black" points="56.48,-1211.6 56.48,-1242.4 685.96,-1242.4 685.96,-1211.6 56.48,-1211.6"/>
212
+ <text text-anchor="start" x="63.48" y="-1223.8" font-family="Arial" font-size="14.00">node_id </text>
213
+ <text text-anchor="start" x="117.19" y="-1223.8" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
214
+ <text text-anchor="start" x="158.44" y="-1223.8" font-family="Arial" font-size="14.00"> ID of the node being remembered</text>
215
+ <polygon fill="none" stroke="black" points="56.48,-1180.8 56.48,-1211.6 685.96,-1211.6 685.96,-1180.8 56.48,-1180.8"/>
216
+ <text text-anchor="start" x="63.48" y="-1193" font-family="Arial" font-size="14.00">remember_count </text>
217
+ <text text-anchor="start" x="173.19" y="-1193" font-family="Arial" font-size="14.00" fill="#666666">[integer]</text>
218
+ <text text-anchor="start" x="223.78" y="-1193" font-family="Arial" font-size="14.00"> Number of times this robot has tried to remember this content</text>
219
+ <polygon fill="none" stroke="black" points="56.48,-1150 56.48,-1180.8 685.96,-1180.8 685.96,-1150 56.48,-1150"/>
220
+ <text text-anchor="start" x="63.48" y="-1162.2" font-family="Arial" font-size="14.00">robot_id </text>
221
+ <text text-anchor="start" x="117.96" y="-1162.2" font-family="Arial" font-size="14.00" fill="#666666">[bigint]</text>
222
+ <text text-anchor="start" x="159.21" y="-1162.2" font-family="Arial" font-size="14.00"> ID of the robot that remembered this node</text>
223
+ <polygon fill="none" stroke="black" points="56.48,-1119.2 56.48,-1150 685.96,-1150 685.96,-1119.2 56.48,-1119.2"/>
224
+ <text text-anchor="start" x="63.48" y="-1131.4" font-family="Arial" font-size="14.00">updated_at </text>
225
+ <text text-anchor="start" x="137.43" y="-1131.4" font-family="Arial" font-size="14.00" fill="#666666">[timestamp with time zone]</text>
226
+ <polygon fill="none" stroke="black" points="56.48,-1088.4 56.48,-1119.2 685.96,-1119.2 685.96,-1088.4 56.48,-1088.4"/>
227
+ <text text-anchor="start" x="63.48" y="-1100.6" font-family="Arial" font-size="14.00">working_memory </text>
228
+ <text text-anchor="start" x="173.95" y="-1100.6" font-family="Arial" font-size="14.00" fill="#666666">[boolean]</text>
229
+ <text text-anchor="start" x="231.56" y="-1100.6" font-family="Arial" font-size="14.00"> True if this node is currently in the robot working memory</text>
230
+ </g>
231
+ <!-- public.robot_nodes&#45;&gt;public.nodes -->
232
+ <g id="edge2" class="edge">
233
+ <title>public.robot_nodes:node_id&#45;&gt;public.nodes:id</title>
234
+ <path fill="none" stroke="black" d="M696.2,-1222.75C751.33,-1170.7 760.25,-658.2 700.24,-658.2"/>
235
+ <polygon fill="black" stroke="black" points="696.35,-1222.68 685.39,-1222.77 691.51,-1224.91 687.57,-1226.72 687.57,-1226.72 687.57,-1226.72 691.51,-1224.91 689.15,-1230.95 696.35,-1222.68"/>
236
+ <text text-anchor="start" x="340.42" y="-1237" font-family="Arial" font-size="10.00">FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE</text>
104
237
  </g>
105
238
  </g>
106
239
  </svg>
@@ -8,37 +8,47 @@ Core memory storage for conversation messages and context
8
8
 
9
9
  | Name | Type | Default | Nullable | Children | Parents | Comment |
10
10
  | ---- | ---- | ------- | -------- | -------- | ------- | ------- |
11
- | id | bigint | nextval('nodes_id_seq'::regclass) | false | [public.robot_nodes](public.robot_nodes.md) [public.node_tags](public.node_tags.md) [public.working_memories](public.working_memories.md) | | |
12
- | content | text | | false | | | The conversation message/utterance content |
13
11
  | access_count | integer | 0 | false | | | Number of times this node has been accessed/retrieved |
12
+ | chunk_position | integer | | true | | | Position within source file (0-indexed) |
13
+ | content | text | | false | | | The conversation message/utterance content |
14
+ | content_hash | varchar(64) | | true | | | SHA-256 hash of content for deduplication |
14
15
  | created_at | timestamp with time zone | CURRENT_TIMESTAMP | true | | | When this memory was created |
15
- | updated_at | timestamp with time zone | CURRENT_TIMESTAMP | true | | | When this memory was last modified |
16
- | last_accessed | timestamp with time zone | CURRENT_TIMESTAMP | true | | | When this memory was last accessed |
17
- | token_count | integer | | true | | | Number of tokens in the content (for context budget management) |
16
+ | deleted_at | timestamp with time zone | | true | | | Soft delete timestamp - node is considered deleted when set |
18
17
  | embedding | vector(2000) | | true | | | Vector embedding (max 2000 dimensions) for semantic search |
19
18
  | embedding_dimension | integer | | true | | | Actual number of dimensions used in the embedding vector (max 2000) |
20
- | content_hash | varchar(64) | | true | | | SHA-256 hash of content for deduplication |
19
+ | id | bigint | nextval('nodes_id_seq'::regclass) | false | [public.node_tags](public.node_tags.md) [public.robot_nodes](public.robot_nodes.md) | | |
20
+ | last_accessed | timestamp with time zone | CURRENT_TIMESTAMP | true | | | When this memory was last accessed |
21
+ | metadata | jsonb | '{}'::jsonb | false | | | Flexible metadata storage (memory_type, importance, source, etc.) |
22
+ | source_id | bigint | | true | | [public.file_sources](public.file_sources.md) | Reference to source file (for file-loaded nodes) |
23
+ | token_count | integer | | true | | | Number of tokens in the content (for context budget management) |
24
+ | updated_at | timestamp with time zone | CURRENT_TIMESTAMP | true | | | When this memory was last modified |
21
25
 
22
26
  ## Constraints
23
27
 
24
28
  | Name | Type | Definition |
25
29
  | ---- | ---- | ---------- |
26
30
  | check_embedding_dimension | CHECK | CHECK (((embedding_dimension IS NULL) OR ((embedding_dimension > 0) AND (embedding_dimension <= 2000)))) |
31
+ | fk_rails_920ad16d08 | FOREIGN KEY | FOREIGN KEY (source_id) REFERENCES file_sources(id) ON DELETE SET NULL |
27
32
  | nodes_pkey | PRIMARY KEY | PRIMARY KEY (id) |
28
33
 
29
34
  ## Indexes
30
35
 
31
36
  | Name | Definition |
32
37
  | ---- | ---------- |
33
- | nodes_pkey | CREATE UNIQUE INDEX nodes_pkey ON public.nodes USING btree (id) |
34
- | idx_nodes_created_at | CREATE INDEX idx_nodes_created_at ON public.nodes USING btree (created_at) |
35
- | idx_nodes_updated_at | CREATE INDEX idx_nodes_updated_at ON public.nodes USING btree (updated_at) |
36
- | idx_nodes_last_accessed | CREATE INDEX idx_nodes_last_accessed ON public.nodes USING btree (last_accessed) |
37
38
  | idx_nodes_access_count | CREATE INDEX idx_nodes_access_count ON public.nodes USING btree (access_count) |
38
- | idx_nodes_embedding | CREATE INDEX idx_nodes_embedding ON public.nodes USING hnsw (embedding vector_cosine_ops) WITH (m='16', ef_construction='64') |
39
39
  | idx_nodes_content_gin | CREATE INDEX idx_nodes_content_gin ON public.nodes USING gin (to_tsvector('english'::regconfig, content)) |
40
- | idx_nodes_content_trgm | CREATE INDEX idx_nodes_content_trgm ON public.nodes USING gin (content gin_trgm_ops) |
41
40
  | idx_nodes_content_hash_unique | CREATE UNIQUE INDEX idx_nodes_content_hash_unique ON public.nodes USING btree (content_hash) |
41
+ | idx_nodes_content_trgm | CREATE INDEX idx_nodes_content_trgm ON public.nodes USING gin (content gin_trgm_ops) |
42
+ | idx_nodes_created_at | CREATE INDEX idx_nodes_created_at ON public.nodes USING btree (created_at) |
43
+ | idx_nodes_deleted_at | CREATE INDEX idx_nodes_deleted_at ON public.nodes USING btree (deleted_at) |
44
+ | idx_nodes_embedding | CREATE INDEX idx_nodes_embedding ON public.nodes USING hnsw (embedding vector_cosine_ops) WITH (m='16', ef_construction='64') |
45
+ | idx_nodes_last_accessed | CREATE INDEX idx_nodes_last_accessed ON public.nodes USING btree (last_accessed) |
46
+ | idx_nodes_metadata | CREATE INDEX idx_nodes_metadata ON public.nodes USING gin (metadata) |
47
+ | idx_nodes_not_deleted_created_at | CREATE INDEX idx_nodes_not_deleted_created_at ON public.nodes USING btree (created_at) WHERE (deleted_at IS NULL) |
48
+ | idx_nodes_source_chunk_position | CREATE INDEX idx_nodes_source_chunk_position ON public.nodes USING btree (source_id, chunk_position) |
49
+ | idx_nodes_source_id | CREATE INDEX idx_nodes_source_id ON public.nodes USING btree (source_id) |
50
+ | idx_nodes_updated_at | CREATE INDEX idx_nodes_updated_at ON public.nodes USING btree (updated_at) |
51
+ | nodes_pkey | CREATE UNIQUE INDEX nodes_pkey ON public.nodes USING btree (id) |
42
52
 
43
53
  ## Relations
44
54