""" Memory system types — mirrors OpenClaw's src/memory/types.ts. """ from dataclasses import dataclass, field from enum import Enum class MemorySource(str, Enum): """Source of a memory entry — either workspace markdown or session logs.""" MEMORY = "memory" SESSIONS = "sessions" @dataclass class MemorySearchResult: """ A single search result from the memory system. Mirrors OpenClaw's MemorySearchResult type. """ path: str start_line: int end_line: int score: float snippet: str source: MemorySource citation: str | None = None @dataclass class MemoryChunk: """ A chunk of text extracted from a markdown file. Mirrors OpenClaw's MemoryChunk from internal.ts. """ start_line: int end_line: int text: str hash: str @dataclass class MemoryFileEntry: """ Metadata about an indexed markdown file. Mirrors OpenClaw's MemoryFileEntry from internal.ts. """ path: str # relative path within workspace abs_path: str # absolute filesystem path mtime_ms: float # modification time (ms since epoch) size: int # file size in bytes hash: str # SHA-256 of file content @dataclass class SessionFileEntry: """ Metadata about an indexed session transcript file. Mirrors OpenClaw's SessionFileEntry from session-files.ts. """ path: str # relative path (sessions/) abs_path: str # absolute filesystem path mtime_ms: float size: int hash: str content: str # extracted text content line_map: list[int] = field(default_factory=list) @dataclass class MemoryConfig: """ Configuration for the memory system. """ # Workspace directory containing SOUL.md, USER.md, MEMORY.md, etc. workspace_dir: str = "~/.aetheel/workspace" # SQLite database path (created automatically) db_path: str = "~/.aetheel/memory.db" # Chunking chunk_tokens: int = 512 chunk_overlap: int = 50 # Search max_results: int = 10 min_score: float = 0.1 vector_weight: float = 0.7 text_weight: float = 0.3 # Embedding embedding_model: str = "BAAI/bge-small-en-v1.5" embedding_dims: int = 384 # Sync watch: bool = True watch_debounce_ms: int = 2000 sync_on_search: bool = True # Session logs sessions_dir: str | None = None # defaults to workspace_dir/daily/ # Sources to index sources: list[str] = field(default_factory=lambda: ["memory", "sessions"])