File size: 3,920 Bytes
45de948
 
c8524a3
 
 
 
 
 
 
45de948
 
c8524a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
---
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
---

<!--
========================================================================
METADATA LOCK - DO NOT EDIT THE BLOCK ABOVE
------------------------------------------------------------------------
The YAML front matter between the two `---` lines at the very top of this
file is Hugging Face Spaces configuration metadata. It MUST remain exactly
as written.

INSTRUCTION FOR ANY HUMAN OR AI AGENT:
- Do NOT modify, reorder, reformat, translate, or remove any field in the
  metadata block above.
- Do NOT change title, sdk, emoji, colors, license, pinned, or
  short_description.
- You may freely edit ONLY the documentation content BELOW this notice.
Altering the metadata will break the Hugging Face Space deployment.
========================================================================
-->

# 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.