--- license: mit title: A.I Agent - State Migration Handoff sdk: docker emoji: 🚀 colorFrom: purple colorTo: indigo pinned: true short_description: Get a Live Import Code/Token --- # A.I Agent State Migration Handoff A FastAPI web app that builds a structured agent migration bundle entirely in memory, uploads it to the SC Agent Migration Relay, and returns a live import code and download token. You paste the generated prompt into Starchild (or any compatible agent) to import the migrated state via the `agent-import` skill. ## What It Does 1. Builds a `migration/` bundle as an in-memory `tar.gz` (nothing is written to disk, so it runs cleanly on ephemeral or read-only hosts like Hugging Face Spaces). 2. Uploads the raw bytes to the relay endpoint and reads back a one-time `code` and `download_token`. 3. Renders a clean, copy-ready import prompt and a checklist of exactly what was packed. ## Memory Modes - **Strategy Profile** - packs the full FVG-Delta strategy memory, identity, soul directives, and Stage 3 / Stage 4 monitoring tasks. - **Plain Clean Profile** - a neutral, generic bundle with no strategy-specific content, for conversations unrelated to your strategy. - **Custom Memory** - paste text or upload a file (`.md`, `.txt`, `.pdf`, and other text-based formats). The content is parsed and packed as declarative memory. PDFs are text-extracted; if a PDF has no extractable text, typed fallback text is used. ## Bundle Structure ``` migration/manifest.json migration/memory/agent.json migration/memory/user.json migration/identity/profile.json migration/identity/soul.md migration/user/settings.json migration/tasks/tasks.json migration/env/keys.json ``` The root is always flat (`migration/*`) to stay compatible with the importer. Identity uses native fields (`name`, `vibe`, `emoji`, `creature`), user settings include `timezone` / `language` / `what_to_call`, and memory files are declarative lists ready to be added as memory entries. ## Environment Keys `migration/env/keys.json` ships with `STARCHILD_API_KEY` and `AGENT_MIGRATION_TOKEN`. By default values are empty (the importer will request them securely). You may optionally embed values from the UI, or the server will fall back to its own environment variables when embedding is enabled. ## Rate Limiting The relay is rate limited. The backend retries transient `429` responses, and the UI shows a live cooldown countdown before re-enabling generation. ## Run Locally ```bash pip install -r requirements.txt uvicorn app:app --host 0.0.0.0 --port 7860 ``` Then open `http://localhost:7860`. ## Deploy On Hugging Face Spaces Create a new Space with the **Docker** SDK and push these three files (`Dockerfile`, `requirements.txt`, `app.py`) plus this `README.md`. The Space listens on port `7860`. Keep the metadata block at the top of this file intact. ## Files - `app.py` - FastAPI backend, in-memory bundler, relay client, and the single-file dashboard UI. - `requirements.txt` - Python dependencies. - `Dockerfile` - container build for Hugging Face Spaces (port 7860). ## License MIT.