add 800-char memory limit and optimize for focused recall
- Add MAX_MEMORY_CHARS=800 Pydantic validation on MemoryStore.content - Update auto-learn judge prompts: "ONE topic per event", 100-500 chars, include the WHY not just the WHAT - Split 9 mega-memories (800-2400ch) into 70 focused memories (100-500ch) via migration script Before: median 331ch, 11 memories >800ch, recall wastes 84% of returned tokens After: median 213ch, 2 memories >800ch (dense single-topic refs), recall returns only the relevant knowledge Trade-off research: PostgreSQL ts_rank gives the same score regardless of document size, so a 2400-char memory with 12 topics gets recalled for any of its 12 topics but wastes context with the other 11. Focused memories (100-500ch) give higher signal-to-noise per recall.
This commit is contained in:
parent
6aa4d31170
commit
5a73dff622
2 changed files with 11 additions and 5 deletions
|
|
@ -3,8 +3,11 @@ from typing import Any, Optional
|
|||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
MAX_MEMORY_CHARS = 800
|
||||
|
||||
|
||||
class MemoryStore(BaseModel):
|
||||
content: str
|
||||
content: str = Field(..., max_length=MAX_MEMORY_CHARS)
|
||||
category: str = "facts"
|
||||
tags: str = ""
|
||||
expanded_keywords: str = ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue