Filesystem Adapter
The default adapter. Stores memory as versioned JSON files on the local filesystem. No external dependencies required.Installation
Included with the mainamfs package:
Configuration
YAML
Programmatic
Environment Variable
On-Disk Layout
Entries are stored as versioned JSON files organized by namespace, entity, and key:JSON File Contents
Each file contains a completeMemoryEntry:
Write Safety
The filesystem adapter uses two mechanisms for safe concurrent writes:-
Atomic rename — Writes go to a temporary
.tmpfile, thenos.rename()atomically moves it into place. This is safe on POSIX systems even during crashes. -
Advisory file locking —
flock()on a per-key lock file prevents concurrent writes from interleaving.
Watch
The filesystem adapter watches entity directories for changes and calls your callback when new versions appear.When to Use
- Local development
- Single-machine setups
- Quick prototyping
- CI/CD pipelines (ephemeral memory)
