A real migration is not one prompt. It's two dozen branches, three on-call rotations, and a backlog of "we discovered this in week 2." Statefulai keeps the plan, the gotchas, and the exceptions intact through every context-window reset.
Mapped from a real beta workspace. Names changed.
The hard-won gotchas of a long migration. Statefulai pins them as procedural rules and resurfaces them at every relevant turn — even six weeks later, in a different branch, by a different agent.
->>'$.path' on large JSONB columns; v16 still seq-scans without a partial expression index.
Found during w2 perf test. Killed throughput on the events table.
▸ rule · @no-jsonb-path-on-events · used 14×
pgvector ≥ 0.6 required — older versions silently drop nullable indexes during dump/restore.
Caught by a missing-row count during shadow restore.
▸ rule · @pgvector-min-version · used 9×
maintenance_work_mem = 2GB per session before REINDEX CONCURRENTLY, then reset.
Default 64MB makes large indexes take 40× longer.
▸ rule · @reindex-memory · used 6×
min_pool_size raised to 20 during cutover; v16 prepared-statement cache warms slowly.
First minute of cutover spiked p99 to 3s without this.
▸ rule · @pool-warm-cutover · used 3×
created_at on the audit table before swapping the write target.
Default got rewritten silently by ORM upgrade.
▸ rule · @audit-backfill-ts · used 2×
pg_stat_progress_create_index rather than waiting on the lock. Index rebuilds that look "stuck" are often progressing.
Saved 90 minutes of unnecessary panic.
▸ rule · @watch-create-index · used 1×
A migration spawns a lot of throw-away branches. Statefulai tags every memory write with its branch and prefers same-branch hits at retrieval time — so the agent never tells you to do something that was true on a discarded branch three weeks ago.
$ codex run "continue index rebuild for billing_events" \ --with-context --branch migration/index-rebuild ↳ retrieved plan (6 weeks, 23 branches) ↳ retrieved 6 pinned constraints ↳ next step from plan: REINDEX CONCURRENTLY billing_events_idx_path ↳ applying pinned rules: @no-jsonb-path-on-events → drop expression index first @reindex-memory → SET maintenance_work_mem = 2GB @watch-create-index → use pg_stat_progress for progress ok dry-run passes · ready to execute · ETA 38m