Migration
When the aibox context schema evolves between versions, existing projects may need to update their context files. The aibox doctor command helps identify gaps and produces migration artifacts.
context/AIBOX.md is gonePre-v0.16 releases generated a context/AIBOX.md "universal baseline" file
on every aibox apply. That file has been removed as part of the
aibox⇄processkit split. The canonical agent entry document is now AGENTS.md
at the project root, owned by processkit and rendered at aibox init time
(write-if-missing — never overwritten).
Existing projects upgrading to v0.16.0 can safely delete context/AIBOX.md.
Anything you wrote into it by hand should be moved into AGENTS.md,
context/DECISIONS.md, or one of the work-instructions files, depending on
its nature.
How Version Tracking Works
Two pieces track the version:
-
aibox.tomlcontains the target schema version:[context]schema_version = "1.0.0" -
.aibox-versionin the project root records the version that was last applied. This file is created duringaibox initand updated after successful migrations.
When aibox doctor detects a mismatch between these two values, it flags the project as needing migration.
Running Doctor
aibox doctor
Doctor performs the following checks:
- Validates
aibox.tomlsyntax and field values - Detects the container runtime (podman or docker)
- Checks for
.aibox-home/and.devcontainer/directories - Compares
.aibox-versionagainstcontext.schema_version - Validates that expected context files exist for the chosen process flavor
Example output when migration is needed:
==> Running diagnostics...
✓ Config version: 0.1.0
✓ Image: python
✓ Process: product
✓ Container name: my-app
✓ Container runtime: podman
✓ .aibox-home/ directory exists at .aibox-home
✓ .devcontainer/ directory exists
! Schema version mismatch: .aibox-version says 0.9.0, config says 1.0.0
✓ Diagnostics complete
Migration Artifacts
When a version mismatch is detected, doctor generates migration artifacts in
context/migrations/:
context/
└── migrations/
├── pending/ # Migrations queued but not yet started
├── in-progress/ # Migration currently being applied
└── applied/ # Completed migrations (archived for reference)
Each migration is identified by a MIG-ID and lives as a versioned document in the appropriate subdirectory. Migrations are managed through the normal resource grammar:
aibox get migration # show pending/in-progress migrations
aibox set migration <id> in-progress # begin a pending migration
aibox apply migration <id> # mark a migration as applied
aibox delete migration <id> --reason "…" # reject and archive without applying
Applying a Migration
Strict Schema And Storage Policy
Migrations are the durable fix for schema, vocabulary, filename, ID, and directory-layout drift. A clean project should satisfy the current schemas and storage policy directly, not by carrying project-local compatibility allowlists.
Do not resolve doctor findings by adding legacy_known_* schema entries,
doctor suppressions, mixed-layout exceptions, or local notes that accept legacy
event names, IDs, filenames, or directory shapes as the steady state. If a
schema genuinely needs a new value or layout, introduce that as an explicit
schema migration and then migrate existing entities and references to the new
standard.
Compatibility shims are acceptable only as short-lived migration aids. Before a migration is marked applied, the repository should contain canonical values, canonical filenames, canonical directory placement, and updated references.
With an AI agent (recommended)
- Run
aibox doctorto identify gaps and queue migration artifacts - Run
aibox set migration <id> in-progressto begin the next pending migration - Open the migration document from
context/migrations/in-progress/ - Paste its contents into a Claude Code session (or let the agent find it via
AGENTS.md) - Review the changes the agent makes
- Run
aibox apply migration <id>to mark the migration complete
Manually
- Run
aibox doctorto generate migration artifacts - Run
aibox set migration <id> in-progressto move the migration tocontext/migrations/in-progress/ - Follow the migration document's checklist
- Run
aibox apply migration <id>to archive the migration tocontext/migrations/applied/
Migration artifacts describe structural changes. They do not migrate content. If a file is renamed, the artifact tells you to create the new file -- but you need to move the content yourself (or have an AI agent do it thoughtfully).
Best Practices
Never auto-migrate content. Structural changes (new files, renames) can be automated. Content changes (rewriting sections, reformatting entries) should always be reviewed by a human or guided AI session.
Migrate forward, do not grandfather. Fix schema and storage drift by moving entities to the current vocabulary, filenames, IDs, and directory layout. Project-local allowlists and doctor suppressions are not acceptable terminal states.
Commit before migrating. Always commit your current state before applying migration changes. This gives you a clean rollback point.
Run doctor after migrating. After applying changes, run aibox doctor again to confirm everything is clean.
Keep .aibox-version in version control. This file should be committed so all team members know which schema version the project uses.
Schema Document Format
Schema documents in the schemas/ directory define the expected structure for each version. They specify:
- Which files each process flavor should contain
- Required sections within each file
- File naming conventions
- Directory structure requirements
These schemas are used by doctor to validate the project and by migration tooling to compute diffs between versions.