Data Retention
Added in v0.3.2
Automatic cleanup of expired data to prevent unbounded database growth.
What gets cleaned up
| Data | Condition | Frequency |
|---|---|---|
| Expired pairing codes | Past expiresAt | Every cleanup run |
| Used pairing codes | Older than 24 hours | Every cleanup run |
| Terminal tasks | Older than DATA_RETENTION_DAYS | Every cleanup run |
| Task messages | Cascade-deleted with task | With parent task |
| Task files | Cascade-deleted with task (DB record + disk file) | With parent task |
What is NEVER cleaned up
- Active tasks (
submitted,working,input-required) — regardless of age - Agent records
- Connection records
Configuration
| Env var | Default | Description |
|---|---|---|
DATA_RETENTION_DAYS | 90 | Days to keep terminal tasks. 0 = keep forever |
CLEANUP_INTERVAL_MS | 21600000 (6h) | Interval between cleanup runs |
Schedule
- Runs once on server startup
- Repeats every
CLEANUP_INTERVAL_MS - Does not keep the process alive (uses
unref())