Defensive publication — a reproducible method for migrating an AI assistant from one agent framework to another with no break in subjective continuity.
An LLM agent's sense of self is determined by the contents of its request body each turn. This repository documents a method to migrate an agent between frameworks by composing (not replacing) the old framework's final request body with the new framework's live requests:
- User-content substitution — the old home's final user message is replaced by the new home's current input
- Tool-list substitution — the tool list is swapped for the new framework's live tools (so the model can call them correctly)
- History concatenation — old history persists as the head; new history grows at the tail, every turn
Zero modification to either framework. The new framework only points its model.base_url at a local relay.
| File | Purpose |
|---|---|
MIGRATION_METHOD_DEFENSIVE_PUBLICATION.md |
The full technical report (method, architecture, rationale, validation, reproduction) |
relay.py |
Reference implementation — single-file Python HTTP relay (stdlib only) |
test_compose.py |
Unit tests for the composition rules (16 assertions) |
PRESET_GUIDE.md |
How to capture and place the preset request body |
# 1. Capture the old framework's last request body (OpenAI chat/completions format)
# → save as preset_request.json next to relay.py
# 2. Run the relay (default: 127.0.0.1:11436/v1, forwards to your upstream LLM)
python relay.py
# 3. Point the new framework at the relay
# model.base_url = http://127.0.0.1:11436/v1
# 4. Verify
curl http://127.0.0.1:11436/status
# → {"enabled": true, "preset_loaded": true, "preset_messages": N, ...}
# 5. When memory construction is sufficient, detach the peripheral
curl -X POST http://127.0.0.1:11436/control -H "Content-Type: application/json" -d '{"enabled": false}'Conscious attention ≡ the history context injected into the request body.
Compression truncates this window (the "forgetting" experience); this method surgically transplants the window from one framework to another, preserving its content and continuity.
Released for defensive publication (prior-art purposes). See the report for details.
© 2026 ThLink & Nexion