Agent-driven maintenance

Situation

You want Claude/Cursor/an MCP agent to do database maintenance rounds, and you need the blast radius fenced.

Commands

pgdba check --format json --state-dir /var/lib/pgdba
# the agent reads summary_for_agents: duty groups, grade, next_actions
pgdba why <finding-id>                       # agent drills into one finding
pgdba check --apply --only <finding-id>      # human-approved execution

What pgdba does

pgdba-report.json carries a summary_for_agents block: next_actions lists each remediation with requires_apply, stable finding IDs correlate across runs, and the audit log records every action in execution order. The agent can read everything and propose everything; execution still passes the per-action gate.

Done looks like

A loop where the agent triages (summary_for_agents), explains (why), and the human approves the apply โ€” with requires_apply making the boundary explicit to both.