FSMemory
Filesystem-based memory backend. Stores memory artifacts as JSON files in a directory structure. Uses simple text matching for recall operations.
Constructor
FSMemory(self, memory_dir: str = '.memory')
Methods
clear
Remove all artifact files.
clear(self) -> None
forget
Remove artifact file.
forget(self, artifact_id: uuid.UUID) -> bool
inspect
Dev tooling - inspect memory state.
inspect(self) -> Dict[str, Any]
memorize
Store content as JSON file.
memorize(
self,
content: str,
memory_type: cogency.memory.base.MemoryType
= <MemoryType.FACT: 'fact'>,
tags: Optional[List[str]] = None,
metadata: Optional[Dict[str, Any]] = None,
timeout_seconds: float = 10.0
) -> cogency.memory.base.MemoryArtifact
recall
Search artifacts with enhanced relevance scoring and async optimization.
recall(
self,
query: str,
limit: Optional[int] = None,
tags: Optional[List[str]] = None,
memory_type: Optional[cogency.memory.base.MemoryType] = None,
since: Optional[str] = None,
**kwargs
) -> List[cogency.memory.base.MemoryArtifact]
should_store
Smart auto-storage heuristics - NO BULLSHIT.
should_store(self, text: str) -> Tuple[bool, str]