htm 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.envrc +1 -0
- data/.tbls.yml +30 -0
- data/CHANGELOG.md +30 -0
- data/SETUP.md +132 -101
- data/db/migrate/20250125000001_add_content_hash_to_nodes.rb +14 -0
- data/db/migrate/20250125000002_create_robot_nodes.rb +35 -0
- data/db/migrate/20250125000003_remove_source_and_robot_id_from_nodes.rb +28 -0
- data/db/migrate/20250126000001_create_working_memories.rb +19 -0
- data/db/migrate/20250126000002_remove_unused_columns.rb +12 -0
- data/db/schema.sql +226 -43
- data/docs/api/database.md +20 -232
- data/docs/api/embedding-service.md +1 -7
- data/docs/api/htm.md +195 -449
- data/docs/api/index.md +1 -7
- data/docs/api/long-term-memory.md +342 -590
- data/docs/architecture/adrs/001-postgresql-timescaledb.md +1 -1
- data/docs/architecture/adrs/003-ollama-embeddings.md +1 -1
- data/docs/architecture/adrs/010-redis-working-memory-rejected.md +2 -27
- data/docs/architecture/adrs/index.md +2 -13
- data/docs/architecture/hive-mind.md +165 -166
- data/docs/architecture/index.md +2 -2
- data/docs/architecture/overview.md +5 -171
- data/docs/architecture/two-tier-memory.md +1 -35
- data/docs/assets/images/adr-010-current-architecture.svg +37 -0
- data/docs/assets/images/adr-010-proposed-architecture.svg +48 -0
- data/docs/assets/images/adr-dependency-tree.svg +93 -0
- data/docs/assets/images/class-hierarchy.svg +55 -0
- data/docs/assets/images/exception-hierarchy.svg +45 -0
- data/docs/assets/images/htm-architecture-overview.svg +83 -0
- data/docs/assets/images/htm-complete-memory-flow.svg +160 -0
- data/docs/assets/images/htm-context-assembly-flow.svg +148 -0
- data/docs/assets/images/htm-eviction-process.svg +141 -0
- data/docs/assets/images/htm-memory-addition-flow.svg +138 -0
- data/docs/assets/images/htm-memory-recall-flow.svg +152 -0
- data/docs/assets/images/htm-node-states.svg +123 -0
- data/docs/assets/images/project-structure.svg +78 -0
- data/docs/assets/images/test-directory-structure.svg +38 -0
- data/{dbdoc → docs/database}/README.md +5 -3
- data/{dbdoc → docs/database}/public.node_tags.md +4 -5
- data/docs/database/public.node_tags.svg +106 -0
- data/{dbdoc → docs/database}/public.nodes.md +3 -8
- data/docs/database/public.nodes.svg +152 -0
- data/docs/database/public.robot_nodes.md +44 -0
- data/docs/database/public.robot_nodes.svg +121 -0
- data/{dbdoc → docs/database}/public.robots.md +1 -2
- data/docs/database/public.robots.svg +106 -0
- data/docs/database/public.working_memories.md +40 -0
- data/docs/database/public.working_memories.svg +112 -0
- data/{dbdoc → docs/database}/schema.json +342 -110
- data/docs/database/schema.svg +223 -0
- data/docs/development/index.md +1 -29
- data/docs/development/schema.md +84 -324
- data/docs/development/testing.md +1 -9
- data/docs/getting-started/index.md +47 -0
- data/docs/{installation.md → getting-started/installation.md} +2 -2
- data/docs/{quick-start.md → getting-started/quick-start.md} +5 -5
- data/docs/guides/adding-memories.md +221 -655
- data/docs/guides/search-strategies.md +85 -51
- data/docs/images/htm-er-diagram.svg +156 -0
- data/docs/index.md +16 -31
- data/docs/multi_framework_support.md +4 -4
- data/examples/basic_usage.rb +18 -16
- data/examples/cli_app/htm_cli.rb +86 -8
- data/examples/custom_llm_configuration.rb +1 -2
- data/examples/example_app/app.rb +11 -14
- data/examples/sinatra_app/Gemfile +1 -0
- data/examples/sinatra_app/Gemfile.lock +166 -0
- data/examples/sinatra_app/app.rb +219 -24
- data/lib/htm/active_record_config.rb +10 -3
- data/lib/htm/configuration.rb +265 -78
- data/lib/htm/{sinatra.rb → integrations/sinatra.rb} +87 -12
- data/lib/htm/job_adapter.rb +10 -3
- data/lib/htm/long_term_memory.rb +220 -57
- data/lib/htm/models/node.rb +36 -7
- data/lib/htm/models/robot.rb +30 -4
- data/lib/htm/models/robot_node.rb +50 -0
- data/lib/htm/models/tag.rb +52 -0
- data/lib/htm/models/working_memory_entry.rb +88 -0
- data/lib/htm/tasks.rb +4 -0
- data/lib/htm/version.rb +1 -1
- data/lib/htm.rb +34 -13
- data/lib/tasks/htm.rake +32 -1
- data/lib/tasks/jobs.rake +7 -3
- data/lib/tasks/tags.rake +34 -0
- data/mkdocs.yml +56 -9
- metadata +61 -31
- data/dbdoc/public.node_tags.svg +0 -112
- data/dbdoc/public.nodes.svg +0 -118
- data/dbdoc/public.robots.svg +0 -90
- data/dbdoc/schema.svg +0 -154
- /data/{dbdoc → docs/database}/public.node_stats.md +0 -0
- /data/{dbdoc → docs/database}/public.node_stats.svg +0 -0
- /data/{dbdoc → docs/database}/public.nodes_tags.md +0 -0
- /data/{dbdoc → docs/database}/public.nodes_tags.svg +0 -0
- /data/{dbdoc → docs/database}/public.ontology_structure.md +0 -0
- /data/{dbdoc → docs/database}/public.ontology_structure.svg +0 -0
- /data/{dbdoc → docs/database}/public.operations_log.md +0 -0
- /data/{dbdoc → docs/database}/public.operations_log.svg +0 -0
- /data/{dbdoc → docs/database}/public.relationships.md +0 -0
- /data/{dbdoc → docs/database}/public.relationships.svg +0 -0
- /data/{dbdoc → docs/database}/public.robot_activity.md +0 -0
- /data/{dbdoc → docs/database}/public.robot_activity.svg +0 -0
- /data/{dbdoc → docs/database}/public.schema_migrations.md +0 -0
- /data/{dbdoc → docs/database}/public.schema_migrations.svg +0 -0
- /data/{dbdoc → docs/database}/public.tags.md +0 -0
- /data/{dbdoc → docs/database}/public.tags.svg +0 -0
- /data/{dbdoc → docs/database}/public.topic_relationships.md +0 -0
- /data/{dbdoc → docs/database}/public.topic_relationships.svg +0 -0
|
@@ -98,41 +98,7 @@ This diagram shows the complete flow of adding a new memory node to HTM with **c
|
|
|
98
98
|
!!! info "Architecture Note"
|
|
99
99
|
With client-side generation (October 2025), embeddings are generated in Ruby before database insertion. This provides reliable, cross-platform operation.
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
graph TD
|
|
103
|
-
A[User: add_message] -->|1. Request| B[HTM]
|
|
104
|
-
B -->|2. Count tokens| C[EmbeddingService]
|
|
105
|
-
C -->|3. Return count| B
|
|
106
|
-
|
|
107
|
-
B -->|4. Generate embedding| C
|
|
108
|
-
C -->|5. HTTP call| D[Ollama/OpenAI]
|
|
109
|
-
D -->|6. Return vector| C
|
|
110
|
-
C -->|7. Return embedding| B
|
|
111
|
-
|
|
112
|
-
B -->|8. Persist with embedding| E[LongTermMemory]
|
|
113
|
-
E -->|9. INSERT nodes with embedding| F[PostgreSQL]
|
|
114
|
-
F -->|10. Return node_id| E
|
|
115
|
-
E -->|11. Return node_id| B
|
|
116
|
-
|
|
117
|
-
B -->|12. Check space| G[WorkingMemory]
|
|
118
|
-
G -->|13. Space available?| H{Has Space?}
|
|
119
|
-
H -->|No| I[Evict nodes]
|
|
120
|
-
I -->|14. Mark evicted| E
|
|
121
|
-
H -->|Yes| J[Add to WM]
|
|
122
|
-
I --> J
|
|
123
|
-
|
|
124
|
-
J -->|15. Success| B
|
|
125
|
-
B -->|16. Log operation| E
|
|
126
|
-
B -->|17. Return node_id| A
|
|
127
|
-
|
|
128
|
-
style A fill:rgba(76,175,80,0.3)
|
|
129
|
-
style B fill:rgba(33,150,243,0.3)
|
|
130
|
-
style C fill:rgba(255,152,0,0.3)
|
|
131
|
-
style D fill:rgba(255,193,7,0.3)
|
|
132
|
-
style E fill:rgba(156,39,176,0.3)
|
|
133
|
-
style F fill:rgba(156,39,176,0.3)
|
|
134
|
-
style G fill:rgba(33,150,243,0.3)
|
|
135
|
-
```
|
|
101
|
+

|
|
136
102
|
|
|
137
103
|
### Memory Recall Flow
|
|
138
104
|
|
|
@@ -141,79 +107,13 @@ This diagram illustrates the RAG-based retrieval process with **client-side quer
|
|
|
141
107
|
!!! info "Architecture Note"
|
|
142
108
|
With client-side generation, query embeddings are generated in Ruby before being passed to SQL for vector similarity search.
|
|
143
109
|
|
|
144
|
-
|
|
145
|
-
graph TD
|
|
146
|
-
A[User: recall] -->|1. Request| B[HTM]
|
|
147
|
-
B -->|2. Parse timeframe| C[Parse Natural Language]
|
|
148
|
-
C -->|3. Return range| B
|
|
149
|
-
|
|
150
|
-
B -->|4. Generate query embedding| D[EmbeddingService]
|
|
151
|
-
D -->|5. HTTP call| E[Ollama/OpenAI]
|
|
152
|
-
E -->|6. Return vector| D
|
|
153
|
-
D -->|7. Return embedding| B
|
|
154
|
-
|
|
155
|
-
B -->|8. Search with embedding| F[LongTermMemory]
|
|
156
|
-
F -->|9. Vector similarity| G{Search Strategy}
|
|
157
|
-
G -->|:vector| H[Vector Search]
|
|
158
|
-
G -->|:fulltext| I[Full-Text Search]
|
|
159
|
-
G -->|:hybrid| J[Hybrid Search]
|
|
160
|
-
|
|
161
|
-
H -->|10. pgvector HNSW| K[Return results]
|
|
162
|
-
I -->|10. ts_rank GIN| K
|
|
163
|
-
J -->|10. Hybrid + RRF| K
|
|
164
|
-
|
|
165
|
-
K -->|11. Results| F
|
|
166
|
-
F -->|12. Results| B
|
|
167
|
-
|
|
168
|
-
B -->|13. For each result| L[WorkingMemory]
|
|
169
|
-
L -->|14. Add to WM| M{Has Space?}
|
|
170
|
-
M -->|No| N[Evict old nodes]
|
|
171
|
-
P -->|Yes| R[Add node]
|
|
172
|
-
Q --> R
|
|
173
|
-
|
|
174
|
-
R -->|12. Log operation| E
|
|
175
|
-
B -->|13. Return memories| A
|
|
176
|
-
|
|
177
|
-
style A fill:rgba(76,175,80,0.3)
|
|
178
|
-
style B fill:rgba(33,150,243,0.3)
|
|
179
|
-
style E fill:rgba(156,39,176,0.3)
|
|
180
|
-
style J fill:rgba(255,193,7,0.3)
|
|
181
|
-
style O fill:rgba(33,150,243,0.3)
|
|
182
|
-
```
|
|
110
|
+

|
|
183
111
|
|
|
184
112
|
### Context Assembly Flow
|
|
185
113
|
|
|
186
114
|
This diagram shows how working memory assembles context for LLM consumption using different strategies.
|
|
187
115
|
|
|
188
|
-
|
|
189
|
-
graph TD
|
|
190
|
-
A[User: create_context] -->|1. Request with strategy| B[HTM]
|
|
191
|
-
B -->|2. Assemble| C[WorkingMemory]
|
|
192
|
-
|
|
193
|
-
C -->|3. Strategy?| D{Strategy Type}
|
|
194
|
-
D -->|:recent| E[Sort by access order]
|
|
195
|
-
D -->|:important| F[Sort by importance]
|
|
196
|
-
D -->|:balanced| G[Hybrid score]
|
|
197
|
-
|
|
198
|
-
E --> H[Sorted nodes]
|
|
199
|
-
F --> H
|
|
200
|
-
G --> H
|
|
201
|
-
|
|
202
|
-
H -->|4. Build context| I[Token budget loop]
|
|
203
|
-
I -->|5. Check tokens| J{Tokens < max?}
|
|
204
|
-
J -->|Yes| K[Add node to context]
|
|
205
|
-
J -->|No| L[Stop, return context]
|
|
206
|
-
K --> I
|
|
207
|
-
|
|
208
|
-
L -->|6. Join nodes| M[Assembled context string]
|
|
209
|
-
M -->|7. Return| C
|
|
210
|
-
C -->|8. Return| B
|
|
211
|
-
B -->|9. Return| A
|
|
212
|
-
|
|
213
|
-
style A fill:rgba(76,175,80,0.3)
|
|
214
|
-
style C fill:rgba(33,150,243,0.3)
|
|
215
|
-
style G fill:rgba(255,193,7,0.3)
|
|
216
|
-
```
|
|
116
|
+

|
|
217
117
|
|
|
218
118
|
## Memory Lifecycle
|
|
219
119
|
|
|
@@ -221,79 +121,13 @@ graph TD
|
|
|
221
121
|
|
|
222
122
|
A memory node transitions through several states during its lifetime in HTM:
|
|
223
123
|
|
|
224
|
-
|
|
225
|
-
stateDiagram-v2
|
|
226
|
-
[*] --> Created: add_node()
|
|
227
|
-
|
|
228
|
-
Created --> InBothMemories: Initial state
|
|
229
|
-
InBothMemories --> WorkingMemoryOnly: Evicted from WM
|
|
230
|
-
InBothMemories --> LongTermMemoryOnly: WM cleared
|
|
231
|
-
|
|
232
|
-
WorkingMemoryOnly --> InBothMemories: Recalled
|
|
233
|
-
LongTermMemoryOnly --> InBothMemories: Recalled
|
|
234
|
-
|
|
235
|
-
InBothMemories --> Forgotten: forget(confirm: :confirmed)
|
|
236
|
-
WorkingMemoryOnly --> Forgotten: forget(confirm: :confirmed)
|
|
237
|
-
LongTermMemoryOnly --> Forgotten: forget(confirm: :confirmed)
|
|
238
|
-
|
|
239
|
-
Forgotten --> [*]
|
|
240
|
-
|
|
241
|
-
note right of InBothMemories
|
|
242
|
-
Node exists in:
|
|
243
|
-
- Working Memory (fast access)
|
|
244
|
-
- Long-Term Memory (persistent)
|
|
245
|
-
in_working_memory = TRUE
|
|
246
|
-
end note
|
|
247
|
-
|
|
248
|
-
note right of WorkingMemoryOnly
|
|
249
|
-
Node exists only in:
|
|
250
|
-
- Long-Term Memory
|
|
251
|
-
in_working_memory = FALSE
|
|
252
|
-
(Evicted due to token limit)
|
|
253
|
-
end note
|
|
254
|
-
|
|
255
|
-
note right of Forgotten
|
|
256
|
-
Node permanently deleted
|
|
257
|
-
from both memories
|
|
258
|
-
(Explicit user action)
|
|
259
|
-
end note
|
|
260
|
-
```
|
|
124
|
+

|
|
261
125
|
|
|
262
126
|
### Eviction Process
|
|
263
127
|
|
|
264
128
|
When working memory reaches its token limit, the eviction process runs to free up space:
|
|
265
129
|
|
|
266
|
-
|
|
267
|
-
sequenceDiagram
|
|
268
|
-
participant User
|
|
269
|
-
participant HTM
|
|
270
|
-
participant WM as WorkingMemory
|
|
271
|
-
participant LTM as LongTermMemory
|
|
272
|
-
participant DB as Database
|
|
273
|
-
|
|
274
|
-
User->>HTM: add_node(large_memory)
|
|
275
|
-
HTM->>WM: add(key, value, token_count)
|
|
276
|
-
WM->>WM: Check: token_count + current > max?
|
|
277
|
-
|
|
278
|
-
alt Space Available
|
|
279
|
-
WM->>WM: Add node directly
|
|
280
|
-
WM-->>HTM: Success
|
|
281
|
-
else No Space
|
|
282
|
-
WM->>WM: Sort by [importance, -recency]
|
|
283
|
-
WM->>WM: Evict low-importance old nodes
|
|
284
|
-
Note over WM: Free enough tokens
|
|
285
|
-
|
|
286
|
-
WM->>HTM: Return evicted nodes
|
|
287
|
-
HTM->>LTM: mark_evicted(keys)
|
|
288
|
-
LTM->>DB: UPDATE in_working_memory = FALSE
|
|
289
|
-
DB-->>LTM: Updated
|
|
290
|
-
|
|
291
|
-
WM->>WM: Add new node
|
|
292
|
-
WM-->>HTM: Success
|
|
293
|
-
end
|
|
294
|
-
|
|
295
|
-
HTM-->>User: node_id
|
|
296
|
-
```
|
|
130
|
+

|
|
297
131
|
|
|
298
132
|
## Database Schema
|
|
299
133
|
|
|
@@ -645,41 +645,7 @@ With TimescaleDB compression (after 30 days):
|
|
|
645
645
|
|
|
646
646
|
### Complete Flow Diagram
|
|
647
647
|
|
|
648
|
-
|
|
649
|
-
graph TB
|
|
650
|
-
subgraph "1. Add Memory"
|
|
651
|
-
A[User: add_node] --> B[Generate embedding]
|
|
652
|
-
B --> C[Store in LTM]
|
|
653
|
-
C --> D{WM has space?}
|
|
654
|
-
D -->|Yes| E[Add to WM]
|
|
655
|
-
D -->|No| F[Evict from WM]
|
|
656
|
-
F --> G[Mark evicted in LTM]
|
|
657
|
-
G --> E
|
|
658
|
-
end
|
|
659
|
-
|
|
660
|
-
subgraph "2. Memory States"
|
|
661
|
-
E --> H[In Both Memories]
|
|
662
|
-
G --> I[In LTM Only]
|
|
663
|
-
end
|
|
664
|
-
|
|
665
|
-
subgraph "3. Recall Memory"
|
|
666
|
-
J[User: recall] --> K[RAG Search in LTM]
|
|
667
|
-
K --> L[Results found]
|
|
668
|
-
L --> M{WM has space?}
|
|
669
|
-
M -->|Yes| N[Add to WM]
|
|
670
|
-
M -->|No| O[Evict from WM]
|
|
671
|
-
O --> N
|
|
672
|
-
N --> H
|
|
673
|
-
end
|
|
674
|
-
|
|
675
|
-
I -.recall.-> J
|
|
676
|
-
H -.already loaded.-> P[Return from WM]
|
|
677
|
-
|
|
678
|
-
style A fill:rgba(76,175,80,0.3)
|
|
679
|
-
style J fill:rgba(33,150,243,0.3)
|
|
680
|
-
style H fill:rgba(255,193,7,0.3)
|
|
681
|
-
style I fill:rgba(156,39,176,0.3)
|
|
682
|
-
```
|
|
648
|
+

|
|
683
649
|
|
|
684
650
|
### Example: Adding 5000-Token Memory to Full Working Memory
|
|
685
651
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<svg viewBox="0 0 700 400" xmlns="http://www.w3.org/2000/svg" style="background: transparent;">
|
|
2
|
+
<!-- Title -->
|
|
3
|
+
<text x="350" y="30" text-anchor="middle" fill="#FFFFFF" font-size="18" font-weight="bold">Current Two-Tier Architecture</text>
|
|
4
|
+
|
|
5
|
+
<!-- HTM Instance outer box -->
|
|
6
|
+
<rect x="50" y="70" width="300" height="280" fill="rgba(33, 150, 243, 0.2)" stroke="#2196F3" stroke-width="3" rx="8"/>
|
|
7
|
+
<text x="200" y="100" text-anchor="middle" fill="#FFFFFF" font-size="15" font-weight="bold">HTM Instance</text>
|
|
8
|
+
|
|
9
|
+
<!-- Working Memory -->
|
|
10
|
+
<rect x="90" y="140" width="180" height="100" fill="rgba(76, 175, 80, 0.3)" stroke="#4CAF50" stroke-width="3" rx="8"/>
|
|
11
|
+
<text x="180" y="170" text-anchor="middle" fill="#FFFFFF" font-size="14" font-weight="bold">Working Memory</text>
|
|
12
|
+
<text x="180" y="195" text-anchor="middle" fill="#B0B0B0" font-size="12">(Hash)</text>
|
|
13
|
+
<text x="180" y="220" text-anchor="middle" fill="#FFC107" font-size="11" font-style="italic">volatile</text>
|
|
14
|
+
|
|
15
|
+
<!-- PostgreSQL -->
|
|
16
|
+
<rect x="450" y="140" width="200" height="100" fill="rgba(156, 39, 176, 0.3)" stroke="#9C27B0" stroke-width="3" rx="8"/>
|
|
17
|
+
<text x="550" y="170" text-anchor="middle" fill="#FFFFFF" font-size="14" font-weight="bold">PostgreSQL</text>
|
|
18
|
+
<text x="550" y="195" text-anchor="middle" fill="#B0B0B0" font-size="12">(Long-Term)</text>
|
|
19
|
+
<text x="550" y="220" text-anchor="middle" fill="#4CAF50" font-size="11" font-style="italic">persistent</text>
|
|
20
|
+
|
|
21
|
+
<!-- Arrow from Working Memory to PostgreSQL -->
|
|
22
|
+
<path d="M 270 190 L 450 190" stroke="#2196F3" stroke-width="3" fill="none" marker-end="url(#arrow1)"/>
|
|
23
|
+
<text x="360" y="180" text-anchor="middle" fill="#2196F3" font-size="11">syncs to</text>
|
|
24
|
+
|
|
25
|
+
<!-- Notes -->
|
|
26
|
+
<rect x="50" y="280" width="300" height="60" fill="rgba(255, 193, 7, 0.1)" stroke="#FFC107" stroke-width="2" rx="5" stroke-dasharray="5,5"/>
|
|
27
|
+
<text x="60" y="300" fill="#B0B0B0" font-size="11">• <tspan fill="#4CAF50" font-weight="bold">Working Memory</tspan>: Fast, in-memory hash</text>
|
|
28
|
+
<text x="60" y="318" fill="#B0B0B0" font-size="11">• <tspan fill="#9C27B0" font-weight="bold">Long-Term Memory</tspan>: Durable PostgreSQL</text>
|
|
29
|
+
<text x="60" y="336" fill="#B0B0B0" font-size="11">• Simple, proven architecture</text>
|
|
30
|
+
|
|
31
|
+
<!-- Markers -->
|
|
32
|
+
<defs>
|
|
33
|
+
<marker id="arrow1" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
|
|
34
|
+
<polygon points="0 0, 10 3, 0 6" fill="#2196F3"/>
|
|
35
|
+
</marker>
|
|
36
|
+
</defs>
|
|
37
|
+
</svg>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<svg viewBox="0 0 700 400" xmlns="http://www.w3.org/2000/svg" style="background: transparent;">
|
|
2
|
+
<!-- Title -->
|
|
3
|
+
<text x="350" y="30" text-anchor="middle" fill="#FFFFFF" font-size="18" font-weight="bold">Proposed Three-Tier Architecture (Rejected)</text>
|
|
4
|
+
|
|
5
|
+
<!-- HTM Instance outer box -->
|
|
6
|
+
<rect x="50" y="70" width="300" height="280" fill="rgba(33, 150, 243, 0.2)" stroke="#2196F3" stroke-width="3" rx="8"/>
|
|
7
|
+
<text x="200" y="100" text-anchor="middle" fill="#FFFFFF" font-size="15" font-weight="bold">HTM Instance</text>
|
|
8
|
+
|
|
9
|
+
<!-- Double arrow down -->
|
|
10
|
+
<path d="M 180 120 L 180 160" stroke="#FFC107" stroke-width="3" fill="none" marker-end="url(#arrow2)"/>
|
|
11
|
+
<path d="M 220 120 L 220 160" stroke="#FFC107" stroke-width="3" fill="none" marker-end="url(#arrow2)"/>
|
|
12
|
+
|
|
13
|
+
<!-- Redis (Working) -->
|
|
14
|
+
<rect x="90" y="160" width="180" height="100" fill="rgba(244, 67, 54, 0.3)" stroke="#F44336" stroke-width="3" rx="8" stroke-dasharray="5,5"/>
|
|
15
|
+
<text x="180" y="190" text-anchor="middle" fill="#FFFFFF" font-size="14" font-weight="bold">Redis</text>
|
|
16
|
+
<text x="180" y="215" text-anchor="middle" fill="#B0B0B0" font-size="12">(Working)</text>
|
|
17
|
+
<text x="180" y="240" text-anchor="middle" fill="#4CAF50" font-size="11" font-style="italic">persistent</text>
|
|
18
|
+
|
|
19
|
+
<!-- PostgreSQL -->
|
|
20
|
+
<rect x="450" y="160" width="200" height="100" fill="rgba(156, 39, 176, 0.3)" stroke="#9C27B0" stroke-width="3" rx="8"/>
|
|
21
|
+
<text x="550" y="190" text-anchor="middle" fill="#FFFFFF" font-size="14" font-weight="bold">PostgreSQL</text>
|
|
22
|
+
<text x="550" y="215" text-anchor="middle" fill="#B0B0B0" font-size="12">(Long-Term)</text>
|
|
23
|
+
<text x="550" y="240" text-anchor="middle" fill="#4CAF50" font-size="11" font-style="italic">persistent</text>
|
|
24
|
+
|
|
25
|
+
<!-- Arrow from Redis to PostgreSQL -->
|
|
26
|
+
<path d="M 270 210 L 450 210" stroke="#2196F3" stroke-width="3" fill="none" marker-end="url(#arrow1)"/>
|
|
27
|
+
<text x="360" y="200" text-anchor="middle" fill="#2196F3" font-size="11">syncs to</text>
|
|
28
|
+
|
|
29
|
+
<!-- Rejection stamp -->
|
|
30
|
+
<rect x="220" y="60" width="160" height="40" fill="rgba(244, 67, 54, 0.2)" stroke="#F44336" stroke-width="3" rx="5" transform="rotate(-15 300 80)"/>
|
|
31
|
+
<text x="300" y="85" text-anchor="middle" fill="#F44336" font-size="18" font-weight="bold" transform="rotate(-15 300 85)">REJECTED</text>
|
|
32
|
+
|
|
33
|
+
<!-- Notes -->
|
|
34
|
+
<rect x="50" y="280" width="300" height="60" fill="rgba(244, 67, 54, 0.1)" stroke="#F44336" stroke-width="2" rx="5" stroke-dasharray="5,5"/>
|
|
35
|
+
<text x="60" y="300" fill="#B0B0B0" font-size="11">• <tspan fill="#F44336" font-weight="bold">Redis layer</tspan>: Adds complexity</text>
|
|
36
|
+
<text x="60" y="318" fill="#B0B0B0" font-size="11">• Requires infrastructure management</text>
|
|
37
|
+
<text x="60" y="336" fill="#B0B0B0" font-size="11">• In-memory hash sufficient for working memory</text>
|
|
38
|
+
|
|
39
|
+
<!-- Markers -->
|
|
40
|
+
<defs>
|
|
41
|
+
<marker id="arrow1" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
|
|
42
|
+
<polygon points="0 0, 10 3, 0 6" fill="#2196F3"/>
|
|
43
|
+
</marker>
|
|
44
|
+
<marker id="arrow2" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
|
|
45
|
+
<polygon points="0 0, 10 3, 0 6" fill="#FFC107"/>
|
|
46
|
+
</marker>
|
|
47
|
+
</defs>
|
|
48
|
+
</svg>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<svg viewBox="0 0 800 600" xmlns="http://www.w3.org/2000/svg" style="background: transparent;">
|
|
2
|
+
<!-- Title -->
|
|
3
|
+
<text x="400" y="30" text-anchor="middle" fill="#FFFFFF" font-size="18" font-weight="bold">ADR Dependency Tree</text>
|
|
4
|
+
|
|
5
|
+
<!-- ADR-001 (Root) -->
|
|
6
|
+
<rect x="300" y="70" width="200" height="50" fill="rgba(76, 175, 80, 0.3)" stroke="#4CAF50" stroke-width="3" rx="8"/>
|
|
7
|
+
<text x="400" y="100" text-anchor="middle" fill="#FFFFFF" font-size="14" font-weight="bold">ADR-001 (Storage)</text>
|
|
8
|
+
|
|
9
|
+
<!-- Branch lines from ADR-001 -->
|
|
10
|
+
<path d="M 400 120 L 400 150" stroke="#4CAF50" stroke-width="2" fill="none"/>
|
|
11
|
+
<path d="M 400 150 L 150 150 L 150 180" stroke="#4CAF50" stroke-width="2" fill="none" marker-end="url(#arrow1)"/>
|
|
12
|
+
<path d="M 400 150 L 400 180" stroke="#4CAF50" stroke-width="2" fill="none" marker-end="url(#arrow1)"/>
|
|
13
|
+
<path d="M 400 150 L 650 150 L 650 180" stroke="#4CAF50" stroke-width="2" fill="none" marker-end="url(#arrow1)"/>
|
|
14
|
+
|
|
15
|
+
<!-- ADR-002 (Two-Tier Memory) -->
|
|
16
|
+
<rect x="50" y="180" width="200" height="50" fill="rgba(33, 150, 243, 0.3)" stroke="#2196F3" stroke-width="3" rx="8"/>
|
|
17
|
+
<text x="150" y="210" text-anchor="middle" fill="#FFFFFF" font-size="13" font-weight="bold">ADR-002 (Two-Tier Memory)</text>
|
|
18
|
+
|
|
19
|
+
<!-- ADR-003 (Embeddings) -->
|
|
20
|
+
<rect x="300" y="180" width="200" height="50" fill="rgba(255, 152, 0, 0.3)" stroke="#FF9800" stroke-width="3" rx="8"/>
|
|
21
|
+
<text x="400" y="210" text-anchor="middle" fill="#FFFFFF" font-size="13" font-weight="bold">ADR-003 (Embeddings)</text>
|
|
22
|
+
|
|
23
|
+
<!-- ADR-004 (Hive Mind) -->
|
|
24
|
+
<rect x="550" y="180" width="200" height="50" fill="rgba(156, 39, 176, 0.3)" stroke="#9C27B0" stroke-width="3" rx="8"/>
|
|
25
|
+
<text x="650" y="210" text-anchor="middle" fill="#FFFFFF" font-size="13" font-weight="bold">ADR-004 (Hive Mind)</text>
|
|
26
|
+
|
|
27
|
+
<!-- Branch lines from ADR-002 -->
|
|
28
|
+
<path d="M 150 230 L 150 270" stroke="#2196F3" stroke-width="2" fill="none"/>
|
|
29
|
+
<path d="M 150 270 L 40 270 L 40 300" stroke="#2196F3" stroke-width="2" fill="none" marker-end="url(#arrow2)"/>
|
|
30
|
+
<path d="M 150 270 L 150 300" stroke="#2196F3" stroke-width="2" fill="none" marker-end="url(#arrow2)"/>
|
|
31
|
+
<path d="M 150 270 L 260 270 L 260 300" stroke="#2196F3" stroke-width="2" fill="none" marker-end="url(#arrow2)"/>
|
|
32
|
+
|
|
33
|
+
<!-- ADR-007 (Eviction Strategy) -->
|
|
34
|
+
<rect x="10" y="300" width="180" height="50" fill="rgba(33, 150, 243, 0.3)" stroke="#2196F3" stroke-width="2" rx="6"/>
|
|
35
|
+
<text x="100" y="328" text-anchor="middle" fill="#FFFFFF" font-size="12">ADR-007 (Eviction Strategy)</text>
|
|
36
|
+
|
|
37
|
+
<!-- ADR-009 (Never-Forget) -->
|
|
38
|
+
<rect x="70" y="370" width="160" height="50" fill="rgba(33, 150, 243, 0.3)" stroke="#2196F3" stroke-width="2" rx="6"/>
|
|
39
|
+
<text x="150" y="398" text-anchor="middle" fill="#FFFFFF" font-size="12">ADR-009 (Never-Forget)</text>
|
|
40
|
+
|
|
41
|
+
<!-- ADR-010 (Redis WM - Rejected) -->
|
|
42
|
+
<rect x="210" y="300" width="200" height="50" fill="rgba(244, 67, 54, 0.3)" stroke="#F44336" stroke-width="2" rx="6" stroke-dasharray="5,5"/>
|
|
43
|
+
<text x="310" y="320" text-anchor="middle" fill="#FFFFFF" font-size="11">ADR-010 (Redis WM)</text>
|
|
44
|
+
<text x="310" y="338" text-anchor="middle" fill="#F44336" font-size="10" font-weight="bold">Rejected Alternative</text>
|
|
45
|
+
|
|
46
|
+
<!-- Branch line from ADR-003 -->
|
|
47
|
+
<path d="M 400 230 L 400 290" stroke="#FF9800" stroke-width="2" fill="none" marker-end="url(#arrow3)"/>
|
|
48
|
+
|
|
49
|
+
<!-- ADR-005 (RAG Retrieval) -->
|
|
50
|
+
<rect x="310" y="290" width="180" height="50" fill="rgba(255, 152, 0, 0.3)" stroke="#FF9800" stroke-width="2" rx="6"/>
|
|
51
|
+
<text x="400" y="318" text-anchor="middle" fill="#FFFFFF" font-size="12">ADR-005 (RAG Retrieval)</text>
|
|
52
|
+
|
|
53
|
+
<!-- Branch line from ADR-004 -->
|
|
54
|
+
<path d="M 650 230 L 650 290" stroke="#9C27B0" stroke-width="2" fill="none" marker-end="url(#arrow4)"/>
|
|
55
|
+
|
|
56
|
+
<!-- ADR-008 (Robot ID) -->
|
|
57
|
+
<rect x="560" y="290" width="180" height="50" fill="rgba(156, 39, 176, 0.3)" stroke="#9C27B0" stroke-width="2" rx="6"/>
|
|
58
|
+
<text x="650" y="318" text-anchor="middle" fill="#FFFFFF" font-size="12">ADR-008 (Robot ID)</text>
|
|
59
|
+
|
|
60
|
+
<!-- ADR-006 (Context Assembly) -->
|
|
61
|
+
<rect x="310" y="480" width="180" height="50" fill="rgba(255, 193, 7, 0.3)" stroke="#FFC107" stroke-width="3" rx="8"/>
|
|
62
|
+
<text x="400" y="508" text-anchor="middle" fill="#FFFFFF" font-size="13" font-weight="bold">ADR-006 (Context Assembly)</text>
|
|
63
|
+
|
|
64
|
+
<!-- Branch line from ADR-001 to ADR-006 -->
|
|
65
|
+
<path d="M 400 120 L 480 120 L 480 470 L 400 470 L 400 480" stroke="#FFC107" stroke-width="2" fill="none" marker-end="url(#arrow5)"/>
|
|
66
|
+
|
|
67
|
+
<!-- Legend -->
|
|
68
|
+
<rect x="30" y="480" width="220" height="100" fill="rgba(33, 150, 243, 0.1)" stroke="#2196F3" stroke-width="2" rx="5" stroke-dasharray="5,5"/>
|
|
69
|
+
<text x="140" y="500" text-anchor="middle" fill="#2196F3" font-size="12" font-weight="bold">Legend</text>
|
|
70
|
+
<text x="40" y="520" fill="#B0B0B0" font-size="10">• <tspan fill="#4CAF50" font-weight="bold">Green</tspan>: Foundation</text>
|
|
71
|
+
<text x="40" y="538" fill="#B0B0B0" font-size="10">• <tspan fill="#2196F3" font-weight="bold">Blue</tspan>: Memory architecture</text>
|
|
72
|
+
<text x="40" y="556" fill="#B0B0B0" font-size="10">• <tspan fill="#FF9800" font-weight="bold">Orange</tspan>: Search/retrieval</text>
|
|
73
|
+
<text x="40" y="574" fill="#B0B0B0" font-size="10">• <tspan fill="#9C27B0" font-weight="bold">Purple</tspan>: Multi-robot features</text>
|
|
74
|
+
|
|
75
|
+
<!-- Markers -->
|
|
76
|
+
<defs>
|
|
77
|
+
<marker id="arrow1" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
|
|
78
|
+
<polygon points="0 0, 10 3, 0 6" fill="#4CAF50"/>
|
|
79
|
+
</marker>
|
|
80
|
+
<marker id="arrow2" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
|
|
81
|
+
<polygon points="0 0, 10 3, 0 6" fill="#2196F3"/>
|
|
82
|
+
</marker>
|
|
83
|
+
<marker id="arrow3" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
|
|
84
|
+
<polygon points="0 0, 10 3, 0 6" fill="#FF9800"/>
|
|
85
|
+
</marker>
|
|
86
|
+
<marker id="arrow4" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
|
|
87
|
+
<polygon points="0 0, 10 3, 0 6" fill="#9C27B0"/>
|
|
88
|
+
</marker>
|
|
89
|
+
<marker id="arrow5" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
|
|
90
|
+
<polygon points="0 0, 10 3, 0 6" fill="#FFC107"/>
|
|
91
|
+
</marker>
|
|
92
|
+
</defs>
|
|
93
|
+
</svg>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<svg viewBox="0 0 700 450" xmlns="http://www.w3.org/2000/svg" style="background: transparent;">
|
|
2
|
+
<!-- Title -->
|
|
3
|
+
<text x="350" y="30" text-anchor="middle" fill="#FFFFFF" font-size="18" font-weight="bold">HTM Class Hierarchy</text>
|
|
4
|
+
|
|
5
|
+
<!-- HTM main class -->
|
|
6
|
+
<rect x="220" y="70" width="260" height="60" fill="rgba(76, 175, 80, 0.3)" stroke="#4CAF50" stroke-width="3" rx="8"/>
|
|
7
|
+
<text x="350" y="105" text-anchor="middle" fill="#FFFFFF" font-size="16" font-weight="bold">HTM (main class)</text>
|
|
8
|
+
|
|
9
|
+
<!-- Branch lines -->
|
|
10
|
+
<path d="M 350 130 L 350 170" stroke="#4CAF50" stroke-width="2" fill="none"/>
|
|
11
|
+
<path d="M 350 170 L 100 170 L 100 200" stroke="#4CAF50" stroke-width="2" fill="none" marker-end="url(#arrow1)"/>
|
|
12
|
+
<path d="M 350 170 L 250 170 L 250 200" stroke="#4CAF50" stroke-width="2" fill="none" marker-end="url(#arrow1)"/>
|
|
13
|
+
<path d="M 350 170 L 450 170 L 450 200" stroke="#4CAF50" stroke-width="2" fill="none" marker-end="url(#arrow1)"/>
|
|
14
|
+
<path d="M 350 170 L 600 170 L 600 200" stroke="#4CAF50" stroke-width="2" fill="none" marker-end="url(#arrow1)"/>
|
|
15
|
+
|
|
16
|
+
<!-- HTM::WorkingMemory -->
|
|
17
|
+
<rect x="10" y="200" width="180" height="80" fill="rgba(33, 150, 243, 0.3)" stroke="#2196F3" stroke-width="2" rx="6"/>
|
|
18
|
+
<text x="100" y="225" text-anchor="middle" fill="#FFFFFF" font-size="13" font-weight="bold">HTM::WorkingMemory</text>
|
|
19
|
+
<text x="100" y="245" text-anchor="middle" fill="#B0B0B0" font-size="10">Token-limited</text>
|
|
20
|
+
<text x="100" y="263" text-anchor="middle" fill="#B0B0B0" font-size="10">active context</text>
|
|
21
|
+
|
|
22
|
+
<!-- HTM::LongTermMemory -->
|
|
23
|
+
<rect x="210" y="200" width="190" height="80" fill="rgba(156, 39, 176, 0.3)" stroke="#9C27B0" stroke-width="2" rx="6"/>
|
|
24
|
+
<text x="305" y="225" text-anchor="middle" fill="#FFFFFF" font-size="13" font-weight="bold">HTM::LongTermMemory</text>
|
|
25
|
+
<text x="305" y="245" text-anchor="middle" fill="#B0B0B0" font-size="10">PostgreSQL</text>
|
|
26
|
+
<text x="305" y="263" text-anchor="middle" fill="#B0B0B0" font-size="10">backend</text>
|
|
27
|
+
|
|
28
|
+
<!-- HTM::EmbeddingService -->
|
|
29
|
+
<rect x="420" y="200" width="190" height="80" fill="rgba(255, 152, 0, 0.3)" stroke="#FF9800" stroke-width="2" rx="6"/>
|
|
30
|
+
<text x="515" y="225" text-anchor="middle" fill="#FFFFFF" font-size="13" font-weight="bold">HTM::EmbeddingService</text>
|
|
31
|
+
<text x="515" y="245" text-anchor="middle" fill="#B0B0B0" font-size="10">Vector</text>
|
|
32
|
+
<text x="515" y="263" text-anchor="middle" fill="#B0B0B0" font-size="10">embeddings</text>
|
|
33
|
+
|
|
34
|
+
<!-- HTM::Database -->
|
|
35
|
+
<rect x="510" y="200" width="180" height="80" fill="rgba(255, 193, 7, 0.3)" stroke="#FFC107" stroke-width="2" rx="6"/>
|
|
36
|
+
<text x="600" y="225" text-anchor="middle" fill="#FFFFFF" font-size="13" font-weight="bold">HTM::Database</text>
|
|
37
|
+
<text x="600" y="245" text-anchor="middle" fill="#B0B0B0" font-size="10">Schema setup</text>
|
|
38
|
+
<text x="600" y="263" text-anchor="middle" fill="#B0B0B0" font-size="10">& configuration</text>
|
|
39
|
+
|
|
40
|
+
<!-- Legend -->
|
|
41
|
+
<rect x="50" y="320" width="600" height="100" fill="rgba(33, 150, 243, 0.1)" stroke="#2196F3" stroke-width="2" rx="5" stroke-dasharray="5,5"/>
|
|
42
|
+
<text x="350" y="345" text-anchor="middle" fill="#2196F3" font-size="13" font-weight="bold">Component Roles</text>
|
|
43
|
+
<text x="70" y="370" fill="#B0B0B0" font-size="10">• <tspan fill="#4CAF50" font-weight="bold">HTM</tspan>: Main API interface coordinating all components</text>
|
|
44
|
+
<text x="70" y="388" fill="#B0B0B0" font-size="10">• <tspan fill="#2196F3" font-weight="bold">WorkingMemory</tspan>: Fast, token-limited in-memory cache</text>
|
|
45
|
+
<text x="70" y="406" fill="#B0B0B0" font-size="10">• <tspan fill="#9C27B0" font-weight="bold">LongTermMemory</tspan>: Durable PostgreSQL storage with RAG search</text>
|
|
46
|
+
<text x="380" y="388" fill="#B0B0B0" font-size="10">• <tspan fill="#FF9800" font-weight="bold">EmbeddingService</tspan>: Vector generation via Ollama/OpenAI</text>
|
|
47
|
+
<text x="380" y="406" fill="#B0B0B0" font-size="10">• <tspan fill="#FFC107" font-weight="bold">Database</tspan>: Schema management and connections</text>
|
|
48
|
+
|
|
49
|
+
<!-- Markers -->
|
|
50
|
+
<defs>
|
|
51
|
+
<marker id="arrow1" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
|
|
52
|
+
<polygon points="0 0, 10 3, 0 6" fill="#4CAF50"/>
|
|
53
|
+
</marker>
|
|
54
|
+
</defs>
|
|
55
|
+
</svg>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<svg viewBox="0 0 700 400" xmlns="http://www.w3.org/2000/svg" style="background: transparent;">
|
|
2
|
+
<!-- Title -->
|
|
3
|
+
<text x="350" y="30" text-anchor="middle" fill="#FFFFFF" font-size="18" font-weight="bold">HTM Exception Hierarchy</text>
|
|
4
|
+
|
|
5
|
+
<!-- HTM::EmbeddingError (root) -->
|
|
6
|
+
<rect x="200" y="70" width="300" height="60" fill="rgba(244, 67, 54, 0.3)" stroke="#F44336" stroke-width="3" rx="8"/>
|
|
7
|
+
<text x="350" y="105" text-anchor="middle" fill="#FFFFFF" font-size="16" font-weight="bold">HTM::EmbeddingError</text>
|
|
8
|
+
|
|
9
|
+
<!-- Branch lines -->
|
|
10
|
+
<path d="M 350 130 L 350 170" stroke="#F44336" stroke-width="2" fill="none"/>
|
|
11
|
+
<path d="M 350 170 L 120 170 L 120 200" stroke="#F44336" stroke-width="2" fill="none" marker-end="url(#arrow1)"/>
|
|
12
|
+
<path d="M 350 170 L 270 170 L 270 200" stroke="#F44336" stroke-width="2" fill="none" marker-end="url(#arrow1)"/>
|
|
13
|
+
<path d="M 350 170 L 430 170 L 430 200" stroke="#F44336" stroke-width="2" fill="none" marker-end="url(#arrow1)"/>
|
|
14
|
+
<path d="M 350 170 L 580 170 L 580 200" stroke="#F44336" stroke-width="2" fill="none" marker-end="url(#arrow1)"/>
|
|
15
|
+
|
|
16
|
+
<!-- Ollama connection failed -->
|
|
17
|
+
<rect x="20" y="200" width="200" height="50" fill="rgba(255, 152, 0, 0.3)" stroke="#FF9800" stroke-width="2" rx="6"/>
|
|
18
|
+
<text x="120" y="230" text-anchor="middle" fill="#FFFFFF" font-size="12">"Ollama connection failed"</text>
|
|
19
|
+
|
|
20
|
+
<!-- OpenAI API error -->
|
|
21
|
+
<rect x="240" y="200" width="200" height="50" fill="rgba(255, 152, 0, 0.3)" stroke="#FF9800" stroke-width="2" rx="6"/>
|
|
22
|
+
<text x="340" y="230" text-anchor="middle" fill="#FFFFFF" font-size="12">"OpenAI API error: ..."</text>
|
|
23
|
+
|
|
24
|
+
<!-- Invalid model -->
|
|
25
|
+
<rect x="460" y="200" width="160" height="50" fill="rgba(255, 152, 0, 0.3)" stroke="#FF9800" stroke-width="2" rx="6"/>
|
|
26
|
+
<text x="540" y="230" text-anchor="middle" fill="#FFFFFF" font-size="12">"Invalid model: ..."</text>
|
|
27
|
+
|
|
28
|
+
<!-- Empty text provided -->
|
|
29
|
+
<rect x="460" y="200" width="190" height="50" fill="rgba(255, 152, 0, 0.3)" stroke="#FF9800" stroke-width="2" rx="6"/>
|
|
30
|
+
<text x="555" y="230" text-anchor="middle" fill="#FFFFFF" font-size="12">"Empty text provided"</text>
|
|
31
|
+
|
|
32
|
+
<!-- Legend -->
|
|
33
|
+
<rect x="50" y="290" width="600" height="90" fill="rgba(244, 67, 54, 0.1)" stroke="#F44336" stroke-width="2" rx="5" stroke-dasharray="5,5"/>
|
|
34
|
+
<text x="350" y="315" text-anchor="middle" fill="#F44336" font-size="13" font-weight="bold">Exception Types</text>
|
|
35
|
+
<text x="70" y="340" fill="#B0B0B0" font-size="10">• <tspan fill="#F44336" font-weight="bold">HTM::EmbeddingError</tspan>: Base class for all embedding-related errors</text>
|
|
36
|
+
<text x="70" y="360" fill="#B0B0B0" font-size="10">• All errors include descriptive messages indicating the specific failure</text>
|
|
37
|
+
<text x="70" y="378" fill="#B0B0B0" font-size="10">• Errors can occur from: Connection failures, API errors, invalid input, or configuration issues</text>
|
|
38
|
+
|
|
39
|
+
<!-- Markers -->
|
|
40
|
+
<defs>
|
|
41
|
+
<marker id="arrow1" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
|
|
42
|
+
<polygon points="0 0, 10 3, 0 6" fill="#F44336"/>
|
|
43
|
+
</marker>
|
|
44
|
+
</defs>
|
|
45
|
+
</svg>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<svg viewBox="0 0 900 700" xmlns="http://www.w3.org/2000/svg" style="background: transparent;">
|
|
2
|
+
<!-- Title -->
|
|
3
|
+
<text x="450" y="30" text-anchor="middle" fill="#FFFFFF" font-size="20" font-weight="bold">HTM Architecture Overview</text>
|
|
4
|
+
|
|
5
|
+
<!-- Your LLM -->
|
|
6
|
+
<rect x="250" y="70" width="400" height="80" fill="rgba(76, 175, 80, 0.3)" stroke="#4CAF50" stroke-width="3" rx="8"/>
|
|
7
|
+
<text x="450" y="105" text-anchor="middle" fill="#FFFFFF" font-size="16" font-weight="bold">Your LLM</text>
|
|
8
|
+
<text x="450" y="130" text-anchor="middle" fill="#B0B0B0" font-size="13">(Claude, GPT, etc.)</text>
|
|
9
|
+
|
|
10
|
+
<!-- Arrow down -->
|
|
11
|
+
<path d="M 450 150 L 450 190" stroke="#2196F3" stroke-width="3" fill="none" marker-end="url(#arrow1)"/>
|
|
12
|
+
|
|
13
|
+
<!-- HTM API -->
|
|
14
|
+
<rect x="200" y="190" width="500" height="80" fill="rgba(33, 150, 243, 0.3)" stroke="#2196F3" stroke-width="3" rx="8"/>
|
|
15
|
+
<text x="450" y="225" text-anchor="middle" fill="#FFFFFF" font-size="16" font-weight="bold">HTM API</text>
|
|
16
|
+
<text x="450" y="250" text-anchor="middle" fill="#B0B0B0" font-size="13">add_node(), recall(), create_context(), etc.</text>
|
|
17
|
+
|
|
18
|
+
<!-- Arrows down to both memories -->
|
|
19
|
+
<path d="M 320 270 L 320 330" stroke="#2196F3" stroke-width="3" fill="none" marker-end="url(#arrow1)"/>
|
|
20
|
+
<path d="M 580 270 L 580 330" stroke="#9C27B0" stroke-width="3" fill="none" marker-end="url(#arrow2)"/>
|
|
21
|
+
|
|
22
|
+
<!-- Working Memory -->
|
|
23
|
+
<rect x="120" y="330" width="280" height="120" fill="rgba(33, 150, 243, 0.3)" stroke="#2196F3" stroke-width="3" rx="8"/>
|
|
24
|
+
<text x="260" y="370" text-anchor="middle" fill="#FFFFFF" font-size="16" font-weight="bold">Working Memory</text>
|
|
25
|
+
<text x="260" y="395" text-anchor="middle" fill="#B0B0B0" font-size="13">(In-Memory)</text>
|
|
26
|
+
<text x="260" y="418" text-anchor="middle" fill="#B0B0B0" font-size="13">128k tokens</text>
|
|
27
|
+
<text x="260" y="438" text-anchor="middle" fill="#B0B0B0" font-size="13">Fast access</text>
|
|
28
|
+
|
|
29
|
+
<!-- Long-term Memory -->
|
|
30
|
+
<rect x="500" y="330" width="280" height="120" fill="rgba(156, 39, 176, 0.3)" stroke="#9C27B0" stroke-width="3" rx="8"/>
|
|
31
|
+
<text x="640" y="370" text-anchor="middle" fill="#FFFFFF" font-size="16" font-weight="bold">Long-term Memory</text>
|
|
32
|
+
<text x="640" y="395" text-anchor="middle" fill="#B0B0B0" font-size="13">(PostgreSQL)</text>
|
|
33
|
+
<text x="640" y="418" text-anchor="middle" fill="#B0B0B0" font-size="13">∞ storage</text>
|
|
34
|
+
<text x="640" y="438" text-anchor="middle" fill="#B0B0B0" font-size="13">Persistent</text>
|
|
35
|
+
|
|
36
|
+
<!-- Bidirectional arrow between Working and Long-term Memory -->
|
|
37
|
+
<path d="M 400 380 L 500 380" stroke="#FFC107" stroke-width="3" fill="none" marker-end="url(#arrow3)" marker-start="url(#arrow3-start)"/>
|
|
38
|
+
<text x="450" y="370" text-anchor="middle" fill="#FFC107" font-size="12" font-weight="bold">Eviction</text>
|
|
39
|
+
|
|
40
|
+
<path d="M 500 400 L 400 400" stroke="#4CAF50" stroke-width="3" fill="none" marker-end="url(#arrow4)" marker-start="url(#arrow4-start)"/>
|
|
41
|
+
<text x="450" y="418" text-anchor="middle" fill="#4CAF50" font-size="12" font-weight="bold">Recall</text>
|
|
42
|
+
|
|
43
|
+
<!-- Arrow down from Long-term Memory -->
|
|
44
|
+
<path d="M 640 450 L 640 520" stroke="#9C27B0" stroke-width="3" fill="none" marker-end="url(#arrow2)"/>
|
|
45
|
+
|
|
46
|
+
<!-- Embedding Service -->
|
|
47
|
+
<rect x="500" y="520" width="280" height="100" fill="rgba(255, 152, 0, 0.3)" stroke="#FF9800" stroke-width="3" rx="8"/>
|
|
48
|
+
<text x="640" y="555" text-anchor="middle" fill="#FFFFFF" font-size="16" font-weight="bold">Embedding Service</text>
|
|
49
|
+
<text x="640" y="580" text-anchor="middle" fill="#B0B0B0" font-size="13">(Ollama/RubyLLM)</text>
|
|
50
|
+
<text x="640" y="603" text-anchor="middle" fill="#B0B0B0" font-size="13">gpt-oss model</text>
|
|
51
|
+
|
|
52
|
+
<!-- Notes -->
|
|
53
|
+
<rect x="30" y="500" width="360" height="160" fill="rgba(33, 150, 243, 0.1)" stroke="#2196F3" stroke-width="2" rx="5" stroke-dasharray="5,5"/>
|
|
54
|
+
<text x="210" y="525" text-anchor="middle" fill="#2196F3" font-size="14" font-weight="bold">Key Components</text>
|
|
55
|
+
<text x="40" y="550" fill="#B0B0B0" font-size="11">• <tspan fill="#4CAF50" font-weight="bold">Your LLM</tspan>: Chat interface (Claude, GPT, etc.)</text>
|
|
56
|
+
<text x="40" y="570" fill="#B0B0B0" font-size="11">• <tspan fill="#2196F3" font-weight="bold">HTM API</tspan>: Main interface for memory operations</text>
|
|
57
|
+
<text x="40" y="590" fill="#B0B0B0" font-size="11">• <tspan fill="#2196F3" font-weight="bold">Working Memory</tspan>: Fast, token-limited cache</text>
|
|
58
|
+
<text x="40" y="610" fill="#B0B0B0" font-size="11">• <tspan fill="#9C27B0" font-weight="bold">Long-term Memory</tspan>: Durable PostgreSQL storage</text>
|
|
59
|
+
<text x="40" y="630" fill="#B0B0B0" font-size="11">• <tspan fill="#FF9800" font-weight="bold">Embedding Service</tspan>: Vector generation via Ollama</text>
|
|
60
|
+
<text x="40" y="650" fill="#B0B0B0" font-size="11">• <tspan fill="#FFC107" font-weight="bold">Eviction/Recall</tspan>: Automatic memory management</text>
|
|
61
|
+
|
|
62
|
+
<!-- Markers -->
|
|
63
|
+
<defs>
|
|
64
|
+
<marker id="arrow1" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
|
|
65
|
+
<polygon points="0 0, 10 3, 0 6" fill="#2196F3"/>
|
|
66
|
+
</marker>
|
|
67
|
+
<marker id="arrow2" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
|
|
68
|
+
<polygon points="0 0, 10 3, 0 6" fill="#9C27B0"/>
|
|
69
|
+
</marker>
|
|
70
|
+
<marker id="arrow3" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
|
|
71
|
+
<polygon points="0 0, 10 3, 0 6" fill="#FFC107"/>
|
|
72
|
+
</marker>
|
|
73
|
+
<marker id="arrow3-start" markerWidth="10" markerHeight="10" refX="1" refY="3" orient="auto">
|
|
74
|
+
<polygon points="10 0, 0 3, 10 6" fill="#FFC107"/>
|
|
75
|
+
</marker>
|
|
76
|
+
<marker id="arrow4" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
|
|
77
|
+
<polygon points="0 0, 10 3, 0 6" fill="#4CAF50"/>
|
|
78
|
+
</marker>
|
|
79
|
+
<marker id="arrow4-start" markerWidth="10" markerHeight="10" refX="1" refY="3" orient="auto">
|
|
80
|
+
<polygon points="10 0, 0 3, 10 6" fill="#4CAF50"/>
|
|
81
|
+
</marker>
|
|
82
|
+
</defs>
|
|
83
|
+
</svg>
|