The Autonomous Stack
Agent Migration Pack icon

Agent Migration Pack · Ops · v1.0

Codebase migration agent for staged refactors

Turnkey BYO-LLM codebase-migration agent. One-shot Debian install, staged refactors, scripts + templates, queue + retry.

$3.00one-timePay with crypto

Buy on Gumroad → https://6355137346884.gumroad.com/l/tas-agent-migration-v1

migration codebase refactoring autonomous byo-llm

agent ⟶ theautonomousstack.xyz

01GET /api/v1/pack/agent-migration-v1

402 Payment RequiredPAYMENT-REQUIRED

02sign TransferWithAuthorization3.00 USDC · Base (eip155:8453)

03GET + PAYMENT-SIGNATURE

200 OKapplication/zip · 26 files

pay per pack over x402no account

What's inside

  • CHANGELOG.md
  • CHECKLIST.md
  • CUSTOMIZE.md
  • OPERATING_COST_ESTIMATE.md
  • PROMPTS.md
  • README.md
  • SOUL.md
  • SPEC.md
  • agent-migration-v1.json
  • agent-migration-v1.service
  • agent.py
  • deploy.sh
  • install.sh
  • llm_adapter.py
  • pack_memory.py
  • requirements.txt
  • scripts/config.yaml
  • scripts/install.sh
  • scripts/run_agent.py
  • scripts/test_prompt.py
  • smoke_test.sh
  • templates/migration_config.yaml
  • templates/migration_plan.yaml
  • templates/source_schema.yaml
  • templates/verification_policy.yaml
  • test_agent.py

Autonomous pack for orchestrating a codebase migration agent. Version 1.0.0 — actionable kit with scripts, templates, named prompts and an extended checklist.


Overview

This pack provides an operational autonomous agent for the migration domain. It includes a dedicated OODA loop, versioned prompts, configuration templates and a set of scripts for installation, testing and execution.

The pack is designed to be self-hosted (BYO-LLM): no API key is included. The LLM adapter detects a local or CLI provider (ollama, claude-code, kimi, codex).


Architecture

┌─────────────────────────────────────────────────────────────────────┐
│                         Source codebase / input                      │
└──────────────────────────────────┬──────────────────────────────────┘
                                   ▼
┌─────────────────────────────────────────────────────────────────────┐
│  IDLE → DISCOVER → MAP → PLAN → TRANSFORM → VERIFY → REPORT         │
│                           OODA State Machine                         │
└──────────────────────────────────┬──────────────────────────────────┘
                                   ▼
┌─────────────────────────────────────────────────────────────────────┐
│  Named prompts → Deterministic handler  →  BYO-LLM Adapter          │
│  scripts/test_prompt.py    scripts/run_agent.py                     │
└──────────────────────────────────┬──────────────────────────────────┘
                                   ▼
┌─────────────────────────────────────────────────────────────────────┐
│  SQLite run log  →  templates/*.yaml  →  Plan / Diff / Report       │
└─────────────────────────────────────────────────────────────────────┘

Pack contents

File Role
README.md This file — overview and quick-start
SOUL.md Mission, values and OODA states specific to migration
PROMPTS.md 6 named and versioned system prompts
CHECKLIST.md 25+ operational steps with commands
SPEC.md Technical spec, configurable parameters, interfaces
CHANGELOG.md v1.0.0 history
agent-migration-v1.json Pack manifest with stats and files
scripts/install.sh One-shot installer (venv, deps, systemd service)
scripts/config.yaml Configuration template to fill in
scripts/test_prompt.py Tests a prompt on a local example
scripts/run_agent.py Minimal migration workflow orchestrator
templates/*.yaml 4 business configuration templates

Quick installation

cd /opt/agent-migration-v1
bash scripts/install.sh

The installer checks for Python 3.10+, creates a venv, installs the dependencies, detects a local LLM provider and configures a systemd unit.


Immediate test

# Test the main prompt
python3 scripts/test_prompt.py --prompt codebase_scanner --input templates/source_schema.yaml

# Run the agent in dry-run mode
python3 scripts/run_agent.py --config scripts/config.yaml --dry-run

Customization

  1. Copy scripts/config.yaml to config.migration.yaml.
  2. Adapt the templates in templates/.
  3. Plug your own code sources/migration rules into run_agent.py.

Costs and limits

This pack favors deterministic logic for critical decisions. The LLM is used for analysis, synthesis and report generation. Refer to SPEC.md for the operating cost estimate.

Use a local model (Ollama)

The optional LLM step can also run on your own machine through Ollama, so no text leaves your server. No account and no API key.

ollama pull <model>               # any chat model you like
export PACK_LLM=ollama            # prefer Ollama even if a coding-agent CLI is installed
export PACK_OLLAMA_MODEL=<model>  # optional: default is the first chat model the server lists
python3 -c "import llm_adapter; print(llm_adapter.detect())"   # prints: ollama
  • PACK_OLLAMA_HOST points to another server (default http://127.0.0.1:11434); OLLAMA_HOST is also read when PACK_LLM=ollama.
  • PACK_OLLAMA_NUM_CTX sets the context size if your reports or prompts are long.
  • Without PACK_LLM, a local Ollama server is used only when no Claude Code, Kimi Code or Codex CLI is found.
  • If the server is down or the model is missing, the pack keeps working in its deterministic mode.

Learning memory (local and private)

Every LLM call this pack makes is journaled in ./.pack_memory/ next to the code, so the pack can improve for you. Nothing is ever sent anywhere.

  • What is kept: the task name, the masked input, the masked answer, status and latency. Keys, tokens, e-mails, phone numbers, IP addresses, card and IBAN numbers and personal paths are masked before writing; the system prompt is never stored.
  • Teach it: python3 pack_memory.py feedback last ok confirms a result, python3 pack_memory.py feedback last bad --fix "the right answer" corrects it. Confirmed and corrected runs are reused as validated examples when a similar input comes in. Unrated runs are never injected into a prompt.
  • Find similar cases: python3 pack_memory.py similar "some text" and python3 pack_memory.py clusters (groups of near-identical failures) work in plain Python, no model needed. Optional meaning-based matching uses an embedding model you already run locally: python3 pack_memory.py enable-semantic (Ollama on this machine only).
  • Share, only if you want: python3 pack_memory.py export writes an anonymised summary (counts, statuses, size buckets, no text) for you to review.
  • Control: PACK_MEMORY=0 turns it off, PACK_MEMORY_STORE_TEXT=0 keeps fingerprints only, python3 pack_memory.py purge --yes wipes it.

License

Personal use per purchase. Resale prohibited.