Database Commands
The genie db command group manages the embedded PostgreSQL instance (pgserve) that backs Genie’s task store, agent registry, schedules, and more.
genie db status
Show pgserve health, port, data directory, and table counts.
Outputs connection info, running state, and a summary of how many rows exist in each core table.
genie db migrate
Run pending database migrations.
Applies any unapplied migrations in order. Safe to run multiple times — already-applied migrations are skipped.
genie db query
Execute arbitrary SQL and print results.
# Count tasks by stage
genie db query "SELECT stage, count(*) FROM tasks GROUP BY stage"
# Check recent schedule runs
genie db query "SELECT * FROM schedule_triggers ORDER BY created_at DESC LIMIT 5"
# Inspect app store
genie db query "SELECT name, item_type, version FROM app_store"
This runs raw SQL against the Genie database. Write queries (INSERT, UPDATE, DELETE) will modify data directly — use with care.
genie db backup
Dump the database to a compressed snapshot file.
Creates a backup at ~/.genie/snapshot.sql.gz.
$ genie db backup
Dumping database to ~/.genie/snapshot.sql.gz...
✅ Backup complete (2.3 MB)
genie db restore
Restore the database from a backup snapshot.
If no file is specified, restores from the default ~/.genie/snapshot.sql.gz.
# Restore from default snapshot
genie db restore
# Restore from a specific file
genie db restore ~/backups/genie-2026-03-30.sql.gz
This replaces the current database contents with the snapshot data. Make sure to back up first if you have unsaved state.
genie db url
Print the PostgreSQL connection URL for direct access with external tools.
$ genie db url
postgresql://genie:genie@localhost:19642/genie
# Use with psql
psql $(genie db url)