Commit 467e062
fix: Improve memory storage to prevent incorrect facts and redundancies
This commit addresses several issues with memory extraction and storage:
1. **Distinguish user facts from assistant statements**: Updated the extraction
prompt to only extract facts explicitly stated by the user, not speculative
statements or assumptions made by the assistant. This prevents the system
from storing assistant guesses as if they were user-provided facts.
2. **Enhanced graph cleanup for redundancy removal**: Improved the cleanup
prompt with detailed instructions for identifying and removing:
- Redundant/duplicate nodes
- Speculative or incorrect information
- Outdated information
- Contradictions (keeping most recent/specific information)
3. **Atlas-based contradiction detection**: Modified the cleanup process to
use the User Atlas as the source of truth. When user corrections are made
(reflected in the atlas), the nightly cleanup now detects and removes
contradicting graph nodes.
4. **Fixed missing import**: Added missing `env` import in routes/dream.ts
These changes ensure that:
- Only user-stated facts are extracted and stored
- The nightly cleanup actively removes redundant and incorrect information
- User corrections (via atlas updates) propagate to the graph during cleanup
- The memory system maintains higher accuracy and data quality over time1 parent 9fbd221 commit 467e062
3 files changed
Lines changed: 82 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
125 | 136 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
136 | 147 | | |
137 | 148 | | |
138 | 149 | | |
| |||
142 | 153 | | |
143 | 154 | | |
144 | 155 | | |
| 156 | + | |
145 | 157 | | |
146 | 158 | | |
147 | 159 | | |
| |||
153 | 165 | | |
154 | 166 | | |
155 | 167 | | |
156 | | - | |
| 168 | + | |
157 | 169 | | |
158 | 170 | | |
159 | 171 | | |
160 | | - | |
| 172 | + | |
161 | 173 | | |
162 | 174 | | |
163 | 175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
372 | 378 | | |
373 | 379 | | |
374 | 380 | | |
| |||
381 | 387 | | |
382 | 388 | | |
383 | 389 | | |
384 | | - | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
385 | 440 | | |
386 | 441 | | |
| 442 | + | |
387 | 443 | | |
388 | 444 | | |
389 | 445 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
0 commit comments