agentleFS
ErricccErriccc/osborn/.claude/skills/org-migration/SKILL.md

org-migration

Skill8 starsChanged 14 days agoMITView on GitHub

Runbook for migrating the whole osborn Fly fleet from one Fly org to another — apps, volumes, per-user ~/.claude data (sessions + DBs + indexes), the voice-e2e engine, and the Supabase + Railway + sync pointers — headless, with a wipe-proof zero-downtime cutover. Use when moving to a new Fly organization, especially when the source org is frozen (machine starts are refused) or you only have API tokens (no interactive login / no WireGuard). Admin/ops only — needs both orgs' Fly tokens, the Supabase service-role key, and Railway access, so this is intentionally NOT bundled into user sandboxes.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run with bounded parallelism (~4–5).

    line 68

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Osborn Fly cross-org migration (runbook)

Move the entire fleet from a SOURCE Fly org to a DEST Fly org. Proven 2026-11-23 (audos → kelechi: 13 sprites + 2 pools + engine, zero active-user data loss).

This is an operator runbook, not a shipped capability. It lives in the repo's dev-time .claude/skills (NOT agent/.claude/skills, which seeds into every user sandbox via the npm package → frontend/Dockerfile.sandbox). The env-driven tool scripts/migrate.py runs the phases; the exact 2026-11-23 reference scripts also live at ~/Developer/osborn-fleet-backup/kelechi-*.

Inputs (env for scripts/migrate.py)

  • SRC_FLY_TOKEN — SOURCE org token (a frozen source is fine — reads / exec / autostart work)
  • DST_FLY_TOKEN — DEST org token (fly apps create <name> NO --org; drive via Machines REST API — the macaroon 401s on legacy GraphQL whoami/volumes destroy)
  • SUPABASE_URL + SUPABASE_KEY — service-role key (audit + cutover; bypasses RLS)
  • Railway railway CLI logged in + linked to the frontend service (for the cutover)
  • optional: DST_SANDBOX_APP=osborn-sandbox4, DST_SUFFIX=-k, FRONTEND_DIR, RAILWAY_SERVICE

Tool — scripts/migrate.py <subcommand>

list · image <ver> · infra <src-app> · data <src-app> · roll <ver> [apps…] · audit · cutover-plan · cutover-commit. infra records a namemap; cutover-* resolve through it (idempotent, re-run-safe). data pulls ~/.claude and copies the Claude login files (phase 3). Railway staging + the deploy are manual (phase 6). migrate.py help prints the full contract. Reuse for a new org pair = just set the two tokens.

Hard-won facts (read first)

  • A frozen source still starts via fly-proxy autostart — hit https://<app>.fly.dev/sessions/manifest and it boots (explicit fly machine start 403s). The Machines REST exec endpoint works on any running machine in both orgs.
  • fly ssh/WireGuard do NOT work from a headless token-only session (6pn UDP). Use the Machines REST API + the agent's HTTPS endpoints only.
  • Source agent self-stops after 15 min idle (OSBORN_IDLE_EXIT, un-settable on a frozen org). So any single transfer must finish inside 15 min → download to a FILE first (raw ~14 MB/s), extract after.
  • The agent never writes Supabase instances (only the frontend does) → booting dest machines pre-cutover is safe.
  • Dest-app naming: strip a trailing -n, append -k. Pool apps get a FRESH osborn-pool-<12hex> name (a -k suffix breaks machine-pool.ts POOL_APP_NAME_RE).

Phases

  1. Image — build+push the sandbox image to the dest org (fly deploy --build-only --push --remote-only --image-label <ver> --build-arg OSBORN_VERSION=<ver> --app <dest-sandbox-app> --config frontend/fly-sandbox.toml), then retag :latest to it (GET /v2/<app>/manifests/<ver> → PUT raw bytes to /manifests/latest, Content-Type = the manifest's own OCI mediaType).
  2. Infra replicas — per sprite+pool app: fly apps create <dest> (no --org) + shared IPv4/IPv6 + volume(s) sized to source + machine(s) with the source config copied verbatim, swapping image→dest image, mount→new volume, FLY_API_TOKEN→dest token, stripping HOME/OSBORN_CWD/DEV_*. Iterate EVERY machine for multi-machine apps.
  3. Data (machine-to-machine — the winning method) — the DEST execs it over Fly's backbone: read the source token (machine config env or exec: printenv OSBORN_SYNC_TOKEN), then curl https://<src>.fly.dev/sessions/export -o /workspace/_exp.tgz && tar xzf … -C /workspace/.claude. Only ~/.claude matters — real /workspace is ~9.6 G but ~90% is junk that self-heals (swapfile ~8 G, .npm-global ~1.5 G, .cache). But /sessions/export MISSES files migrate.py data copies separately (base64-over-exec): ~/.claude/.credentials.json — the Claude OAuth login; without it the dest agent can't auth to Claude and silently falls back to a non-Claude model — plus ~/.claude.json / ~/.claude/.config.json config (and ~/.osborn/secrets.json is belt-and-suspenders since phase 2 copies secrets via the config env). Verify source vs dest counts. Dormant machines with no reachable token → skip, they self-heal. Run with bounded parallelism (~4–5). (NOT laptop-relay: single POST times out on 2 GB, chunked finalize loses /tmp chunks on autostop.)
  4. Engine — rebuild osborn-voice-e2e into the dest org (Playwright image), create the replica + its secrets (from .env + Railway OSBORN_ENGINE_TOKEN/GOOGLE_API_KEY).
  5. Pointer audit — the only live org pointers are Supabase instances.{sandbox_id,server_url,sandbox_url} + machine_pool.app_name; Railway FLY_API_TOKEN / FLY_SANDBOX_APP / FLY_SANDBOX_IMAGE / FLY_HARNESS_APP / BROWSER_ENGINE_HOST; local voice-native-sync CLOUD_URL. (bug_reports.sandbox_id is a machine id, shared_sessions.snapshot_url is Supabase storage — not org pointers.)
  6. CUTOVER (gated) — ⚠️ a token/DB-org mismatch WIPES rows (GET /api/sandbox 404 → clears instances.sandbox_id, frontend/src/app/api/sandbox/route.ts). Safe order: back up the rows → stage all Railway vars (railway variables --set … --skip-deploys) + flip the local sync CLOUD_URL → trigger a REAL deploy (a changed marker var WITHOUT --skip-deploys, from the linked dir — a no-op same-value set does NOT deploy) and watch railway logs until the dest app names appear → flip the DB keyed by user_id (wipe-proof + idempotent, repairs any cleared row; set instance_type='cloud'), re-applying on a short loop until rows STAY correct → verify rows + pool + site 200.
  7. Delete old org (separate, gated) — only after a safety window with the dest proven; the source apps are the rollback until then (re-apply the row backup + re-stage Railway to the source token + redeploy).

Reference implementation

scripts/migrate.py is THE tool — read it before running (each subcommand shows the exact Machines-API / Railway commands). Its read subcommands (list/audit/cutover-plan) are validated; it mirrors the proven 2026-11-23 run whose one-off scripts are kept at ~/Developer/osborn-fleet-backup/kelechi-* as a rollback reference only (not maintained — don't edit both). An admin UI / background runner is tracked in the productization issue.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.