How It Works
Quick Start
How It Works
Usage telemetry is observed automatically — everysearch() and list_all() call increments use_count and updates last_used on returned entries. No extra configuration needed.
| What triggers pruning | When |
|---|---|
| On write | Every time an entry is added when max_entries > 0 and the cap is exceeded |
On prune() call | Manually, for one-off cleanup of a long-running agent |
| Time-based | Entries older than retention_days with no recent use are eligible |
use_count ascending, then created_at ascending. The least-used, oldest entries are evicted first — the most valuable, recently accessed learnings always survive.
Archival: evicted entries are appended to a per-store .archive.json sidecar (e.g., persona.archive.json) in the same directory as the active store file. The archive is append-only JSON — nothing is permanently hard-deleted.
Configuration Options
Full reference onmax_entries and retention_days is in the LearnConfig reference.
Both fields default to
0 (unbounded). Existing agents are completely unaffected unless you opt in by setting a non-zero value.Best Practices
Most users: leave the defaults
Most users: leave the defaults
If your agent runs for short sessions or handles a limited number of users, the defaults (
max_entries=0, retention_days=0) are fine. Stores only grow with real interactions and stay small naturally.Long-running gateway agents: cap the stores
Long-running gateway agents: cap the stores
Agents that run 24/7 and talk to many users can accumulate thousands of entries over time. Set
max_entries=1000 to keep store files small and keep search fast. Pruning runs automatically on every write — no cron job needed.Compliance requirements: use retention_days
Compliance requirements: use retention_days
For data minimization requirements (GDPR, SOC 2, etc.), set
retention_days to make stale entries eligible for pruning. Pair with max_entries so pruning triggers automatically on write rather than requiring a manual call.Restoring from the archive sidecar
Restoring from the archive sidecar
Evicted entries are never permanently deleted. The
.archive.json sidecar (same directory as the store file) is an append-only JSON array. Open it to audit or restore evicted entries.Archive file location example:Related
LearnConfig reference
Full configuration options for continuous learning
Checkpoints
Save and restore agent state across runs

