Data, storage and retention
Where ProcessGuard keeps its history, what it keeps, and for how long.
Location
SQLite in WAL mode, at the data path of the mode:
| Mode | Database | Socket | PID file |
|---|---|---|---|
| Full (root) | /Library/Application Support/ProcessGuard/daemon.db | /var/run/pguard/daemon.sock | daemon.pid next to the socket |
| Limited (user) | ~/.pguard/daemon.db | ~/.pguard/daemon.sock | daemon.pid next to the socket |
Only one daemon per mode runs at a time: the PID file blocks a second instance. A stale socket file is removed at startup. The two modes keep separate histories.
What is stored
A process row is stored at each 30-second write when its score is above zero, or when a watch covers it. An idle process therefore leaves no rows by default.
Retention
| Data | Raw | Downsampled |
|---|---|---|
| Process snapshots | 24 h | 5-minute buckets for 7 days |
| Battery events | 7 days | — |
| System state (RAM, thermal, load) | 7 days | — |
| Traffic per process and remote host | — | 5-minute buckets for 7 days |
| Action log | The last 10 000 attempts | — |
Cleanup runs every hour with an incremental vacuum, so the database does not grow without bound.
Time windows
| Window | Duration | Bucket size | About points |
|---|---|---|---|
LastHour (1h) | 1 hour | 30 s | 120 |
Last6Hours (6h) | 6 hours | 2 min | 180 |
Last24Hours (24h) | 24 hours | 5 min | 288 |
Last7Days (7d) | 7 days | 30 min | 336 |
A query reads each stretch of the window from the finest tier that still holds it, and each stretch from exactly one tier, so nothing is counted twice. A point reports resolution_secs: older history exists only at 5-minute resolution. History of one run (PID plus start time) reads raw rows only, so it reaches back 24 hours.
Watches
A watch stores its target at every write, whatever its score. Use one before you measure a quiet process, so "stayed idle" is not confused with "was not recorded".
pguard watch add --name cargo --ttl 1800 # every process named cargo, for 30 minutes
pguard watch add --pid 998 --start-time 91998112 # one run
pguard watch list
pguard watch remove 3
- By name: a group, every process with that name, now or later.
- By run: PID plus start time. A PID alone is rejected. When the run exits, nothing more is stored for it.
- TTL from 1 s to 86 400 s (default 3600). Every watch expires.
- At most 16 active watches. Watching an already watched target extends that watch.
- Watches survive a daemon restart.
- A watched row covers one 30-second write. A write the daemon missed leaves no row: compare
last_sample_atwith the clock before you call a process idle.
Failure handling
| Case | Behaviour |
|---|---|
| A process exits during a sample | It is skipped. pids_listed and pids_sampled in GetStatus show the difference. |
| A failed sample or write | The last good state is kept. The failure is reported in GetStatus.collector. |
| The database cannot be opened | The daemon exits with an error. |
| A slow subscriber | Missed events are counted in subscriber_lagged_events. |