feat: auto-split large memories at store time (>500 chars)

When content exceeds 500 chars, it's automatically split into multiple
memories on paragraph boundaries. Each chunk gets the same category,
tags (with part-N-of-M suffix), keywords, and importance. Removes the
old 800 char hard limit from the Pydantic model.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Viktor Barzin 2026-04-08 18:19:52 +00:00
parent c88dd03cce
commit 73aefda82e
3 changed files with 56 additions and 27 deletions

View file

@ -3,11 +3,8 @@ from typing import Any, Literal, Optional
from pydantic import BaseModel, Field
MAX_MEMORY_CHARS = 800
class MemoryStore(BaseModel):
content: str = Field(..., max_length=MAX_MEMORY_CHARS)
content: str
category: str = "facts"
tags: str = Field(default="", max_length=500)
expanded_keywords: str = Field(default="", max_length=500)
@ -57,7 +54,7 @@ class UnshareTag(BaseModel):
class MemoryUpdate(BaseModel):
content: Optional[str] = Field(None, max_length=MAX_MEMORY_CHARS)
content: Optional[str] = None
tags: Optional[str] = None
importance: Optional[float] = Field(None, ge=0.0, le=1.0)
expanded_keywords: Optional[str] = None