# ADR 0002 — PostgreSQL + TimescaleDB as the only datastore

Status: accepted (2026-07-07) · Plan: rev 3

## Context
The OS needs a graph (entities/relationships), operational tables
(signals/executions/approvals), a learning corpus, time-series metrics,
audit and event logs. Alternatives: dedicated graph DB (Neo4j), dedicated
TSDB (Prometheus/VictoriaMetrics), or one Postgres.

## Decision
One PostgreSQL 16 instance with the TimescaleDB extension
(timescale/timescaledb:2-pg16). Graph traversal via recursive CTEs
(cycle-safe blast_radius); time-series via hypertables + continuous
aggregates + retention policies; events via table + LISTEN/NOTIFY.

## Consequences
- One backup/restore/DR story, one connection pool, transactional
  consistency between graph and operational writes (e.g. event emission in
  the same transaction as state change).
- Postgres is the accepted SPOF — mitigated by daily pg_dump + WAL PITR +
  off-host copies + monthly restore drills; streaming replication is the
  future path if needed.
- Homelab graph scale (hundreds of nodes) is far below where a dedicated
  graph DB pays for itself.
