Run T-Stack migrations after updating framework files to a new version. Applies sequential migrations, validates agent integrity, and bumps the migrated version tracker. Use when: after updating T-Stack, after copying new agent files, version mismatch detected.
Runs migrations after T-Stack framework files have been updated to a new version.
Read both version files:
.tstack/.migrated — the version migrations have been applied through.tstack/.version — the version of the installed framework filesIf .tstack/.migrated does not exist:
.tstack/.migrated found — T-Stack hasn't been initialized yet. Run /setup first."If .tstack/.version does not exist:
.tstack/.version found — T-Stack installation appears broken. Ensure framework files were copied correctly."Record both values. Continue to Step 2.
Parse both version strings as semver (Major.Minor.Patch).
.migrated >= .version: Already up to date.
<version>. No migrations needed.".migrated < .version: Migrations needed.
<migrated> to <version>."Read .tstack/version.json. Verify it contains valid JSON with version, framework, and initOnly keys.
version.json is missing or malformed: Warn: ".tstack/version.json is missing or invalid. Framework files may not have been updated correctly. Consider re-running the update."version.json version does not match .tstack/.version: Warn: "Version mismatch — version.json says <json_version> but .version says <file_version>. Re-copy framework files."Continue to Step 4 regardless of warnings (validation is informational).
List all subdirectories in .tstack/migrations/. Each subdirectory name is a version number.
.tstack/.migrated AND less than or equal to .tstack/.version.Example: .migrated = 0.2.0, .version = 0.4.0
→ Run: .tstack/migrations/0.3.0/migration.md, then .tstack/migrations/0.4.0/migration.md
If no migration directories match: Warn: "No migration files found for the version range <migrated> → <version>. The version bump may not require migration steps. Updating .migrated to match."
For each migration version (in ascending order):
.tstack/migrations/<version>/migration.md.<version>..."If any migration step fails or validation check fails, report the failure and stop. Do not continue to the next migration. The user must resolve the issue before retrying.
Some files (like .github/copilot-instructions.md) are classified as hybrid — they contain both framework-owned regions and state/user-owned regions. These files are NOT bulk-copied during updates. Instead, migrations handle them with region-aware updates:
<!-- #region ... --> and <!-- #endregion ... --> markers for state-owned sections).Migration files specify which regions to preserve. If a hybrid file doesn't exist, create it fresh from the template.
.tstack/.migratedWrite the .tstack/.version value to .tstack/.migrated, replacing its current content.
If any migration in the chain recommended a Scout re-scan, invoke the Scout agent to refresh .tstack/project.md.
If the Scout agent is not available as a subagent, instruct the user: "A Scout re-scan is recommended. Run @scout Scan this project and build the profile."
Report to the user:
<version>."