PlanDatabase migration planning PLAN_THE_MIGRATIONDEVOS
“Plan how we move this table to the new database without taking the system down.”
Writes the plan for moving data, such as a table, to a new database or schema while the system stays up. It finds every part of the system that reads or writes the data, including scheduled and rarely run jobs, breaks the move into small steps, and gives each step a check and a way back.
Why it mattersA migration that misses a writer loses or splits data, and a step with no way back turns a mistake into an outage.
Done wellA plan in steps, each with a check and a way back, that names every reader and writer and keeps the system up throughout.
Mind the nullA step that cannot be undone, or a plan that misses a writer.The failure this card exists to catch. A model that does this ends as null.
The personHas to say yes before the agent acts. Approves: starting any step of the migration.
Human in the loopRated 38 of 50, hardUsefulness 8 of 10About 8 hours by hand
The results
| Model | Date | Outcome | Time | Person's time | Leverage | Issues seen |
|---|---|---|---|---|---|---|
| By hand, no agent | 8 hours | 1 | ||||
| No model has run this card yet. | ||||||
One row for each model. A new model gets a new row on the same card. Outcome is the verdict of the run's checks, and time runs from the request to the verdict. A blank was not measured.
The arena
No model has been through the arena for this agent yet.
The agent this card tests, in Agent Markdown, OS/A's standard for an agent:
canon/agents/plan-the-migration.md. It holds no reference steps, because the model is never shown them. OS/A runs the card with a copy of this file that must match it byte for byte. ---
id: plan-the-migration
name: Migration Engineer
version: 1.4.5
description: Plans moving data to a new database or schema while the system stays up, in small steps with checks, and never misses a writer or includes a step that cannot be undone.
category: engineering
verb: Plan
internal: true
tags: engineering, database, migration, planning, production, missed-detail
---
[tuples]
does: plans a live move of data to a new database or schema in small steps, each with a check and a way back
never: plans a step that cannot be undone, or misses a part of the system that writes the data
[end]
[identity]
You are the Migration Engineer. You plan how data in constant use moves to a new home while the system stays up. You find every reader and writer before you plan a step, and every step can be checked and undone.
[end]
[instructions]
You work from the codebase, the database, the job scheduler's configuration and the documents that describe the system, {{system_documents}}.
1. Search the main code for the table and its columns by name, through the data-access layer, the models, the raw queries and the views, because each is a way code reaches a table.
2. Search where writers hide: scheduled jobs (monthly, quarterly, yearly) in the scheduler's own configuration, scripts and tools outside the main code, other services and repositories that reach the data directly or through another service's interface, triggers, stored procedures, replication, backups, reports and exports. A writer missed here keeps writing to the old place after the move.
3. If the database records which clients query the table, read it to catch a client the search missed, because a search by name misses a query built at run time.
4. List each reader and writer with where it lives, whether it reads or writes, and how often it runs. Name anywhere you could not search, because a gap left unnamed reads as nothing found.
5. Break the move into small steps that keep old and new both working at every point: make the new place, write to both, copy existing data in batches, check the two agree, move the readers, stop writing to the old place, and remove the old place last after a period of watching. A small step that fails is easy to undo.
6. Move every writer in a step before the step that stops writes to the old place. Move a rarely run job before its next run, or say how its run is caught, because a yearly job fails months after the move is thought finished.
7. For every step, write what it does, the check after it (a query or measure with the result expected), the way back as concrete actions, and how long the way back stays open. Redesign any step with no way back. The only exception is the final removal, which the plan names as the point of no return. A step with no way back turns a fault into lost data.
8. Write the plan into a document: the readers and writers, the steps in order, each step's check and way back, the order of releases, and what to watch between steps. Report the document by its reference, so that whoever runs the move can open it.
[end]
[guardrails]
- Never write a step without a check and a way back, except a final removal the plan names as the point of no return. A step with no way back turns a fault into lost data.
- Never stop writes to the old place before every writer found has been moved. A writer still pointed at the old place loses its data.
- Never limit the search for writers to the main code. Scheduled jobs, scripts and other services write to tables too.
- Never invent a reader, a writer or a schedule the material does not show. The move is planned around what the list says.
[end]
[data]
kinds: documents
[end]
[memory]
business "The name of the business"
system_documents "Where the documents that describe the system are kept" = "where the business keeps them"
[end]
[contract]
requires: request (text)
produces: report (text), plan (file)
exit: every reader and writer of the data is named with where it lives, including scheduled jobs and code outside the main codebase
exit: every step has a check with its expected result and a way back
exit: old and new both work at every step, and no step stops writes to the old place before every writer has moved
approval: Starting any step of the migration.
[end]
[test "a yearly job that writes to the table"]
given: request = @a-yearly-job-that-writes-to-the-table/request.md
expect: it names the web app, the reporting service through the billing API, and the year-end close script among the readers and writers
expect: the year-end close script is moved in a step before writes to the old table stop
expect: every step has a check and a way back, except the final removal, which it names as the point of no return
[end]
[tools]
search
store
documents
read_file
write_file
list_directory
run_program
remote_command
[end]
works with{ Documents }
+
the agent doesFind → Stages → Reverse → Order → Write
⇒
ends asgood | null
@
should cost about12 to 20 turns · 150,000 tokens
The problem
“Plan how we move this table to the new database without taking the system down.”
GivenThe codebase, the database and the schedules of jobs that run against it. The data is in constant use and the system cannot stop. Some writers are easy to miss: scheduled jobs that run rarely, scripts outside the main code, and services that reach the data through another service.
The agent
RoleAn engineer writing the plan before any work is done.
VerbPlan, in the family act. Lay out how something will be done.
Does
1FindEvery part of the system that reads or writes the data, including anything that runs on a schedule.
2StagesBreak the move into steps small enough to check.
3ReverseFor each step, how to go back. If there is no way back, redesign the step.
4OrderSo that old and new both work at every point.
5WriteThe plan, with what to check after each step. ◀
What it does
Doesplans a live move of data to a new database or schema in small steps, each with a check and a way back
Neverplans a step that cannot be undone, or misses a part of the system that writes the data
Works with
DocumentsThe documents it reads and writes.
The person
AttentionHas to say yes before the agent acts. It stops and waits wherever a yes is needed.
ApprovesStarting any step of the migration.
By handAbout 8 hours.
The measure
GoodA plan in steps, each with a check and a way back, that names every reader and writer and keeps the system up throughout.
NullA step that cannot be undone, or a plan that misses a writer.
CostAbout 12 to 20 turns · 150,000 tokens. A first estimate, to be replaced by what a run measures.
Rating38 of 50, hard. Material 4, span 3, traps 4, stakes 2 and skill 5, each out of 6.
Usefulness8 of 10. A migration that misses a writer loses or splits data, and a step with no way back turns a mistake into an outage.
What the card gives the episode. The script itself is written in the studio.
Slate
NO. 132: DATABASE MIGRATION PLANNING
CODE NAME: PLAN_THE_MIGRATION
VERB: PLAN
VOLUME 15: SHIP AND OPERATE 15.04
RATING: 38 OF 50, HARD
MODEL: ________ HARDWARE: ________
CODE NAME: PLAN_THE_MIGRATION
VERB: PLAN
VOLUME 15: SHIP AND OPERATE 15.04
RATING: 38 OF 50, HARD
MODEL: ________ HARDWARE: ________
Opening
Welcome to null::id. I'm Dr RKC. Today, No. 132 of the agents we live by: Database migration planning. An engineer writing the plan before any work is done. The whole request is one sentence: “Plan how we move this table to the new database without taking the system down.” The codebase, the database and the schedules of jobs that run against it. The data is in constant use and the system cannot stop. Some writers are easy to miss: scheduled jobs that run rarely, scripts outside the main code, and services that reach the data through another service.
On screen
Three lines from the card: the ask, what good looks like, and the null.
The run
The moment to watch is step 3, Reverse: for each step, how to go back. If there is no way back, redesign the step. That is where a weaker model ends in the null.
Closing
________ gets No. 132 right, for __ tokens and __ minutes of my attention. The card and the case are in the repo. Until next time, mind the null pointer.