Expand description
Memory directory: persistent file-based memory system.
Scans .md files with YAML frontmatter, sorts by recency, caps at 200 files.
Structs§
- Memory
File - A memory file with its full content.
- Memory
File Meta - Metadata for a memory file (without loading full content).
- Memory
Index - Result of loading MEMORY.md with truncation info.
Enums§
- Memory
Type - Memory types for categorized memory entries.
Functions§
- auto_
memory_ path - Resolve the memory directory for a project.
Default:
~/.claude/projects/<sanitized-root>/memory/ - build_
memory_ prompt_ content - Build the complete memory prompt content for the system prompt.
- ensure_
memory_ dir_ exists - Create the memory directory if it doesn’t exist.
- load_
memory_ file - Load a memory file with its full content, stripping frontmatter.
- load_
memory_ index - Load the MEMORY.md index file with truncation. Returns None if the file doesn’t exist or is empty.
- memory_
age_ days - How many days ago a memory was modified.
- memory_
age_ text - Human-readable age string.
- memory_
freshness_ text - Freshness warning for stale memories (>1 day old).
- sanitize_
path_ component - Sanitize a path component for use as a directory name.
Keeps alphanumeric,
-,_,.. Replaces everything else with_. - scan_
memory_ dir - Scan a memory directory for .md files. Returns metadata sorted newest-first, capped at 200 files. Excludes MEMORY.md (the index file).