“Find why the /orders endpoint got slow this week and suggest a fix.”
What MoClaw does
- 1 Pulls recent Postgres and API logs with get_logs to find slow statements on the orders path.
- 2 Runs a read-only execute_sql to EXPLAIN the offending query and inspects the orders table with list_tables.
- 3 Checks get_advisors for related performance recommendations.
- 4 Drafts a migration adding the missing composite index and shows it for review before any apply_migration.
MoClaw reports: 'The orders list query does a sequential scan on (customer_id, created_at). Logs show p95 jumped to 1.8s this week. Suggested fix: add a composite index. Here is the migration, not yet applied.'