Audience: Developers maintaining a DevSpec project
Tooling:specdev alignCLI
Goal: Keep your project specs synchronized with the evolving DevSpec Toolkit
The DevSpec Toolkit evolves rapidly. New versions bring stricter schemas, improved prompts, and entirely new steps. The Alignment Workflow is the systematic process for upgrading your project to match the current toolkit version with zero data loss.
Unlike traditional code migrations that might just patch syntax, DevSpec migration often involves semantic upgrades. For example, converting a prose document into a structured JSON file or adding entirely new required fields like "User Stories" to a roadmap.
The specdev align tool manages this complexity by:
- Detecting the exact gap between your project and the toolkit.
- Planning the necessary changes (renames, additions, transforms).
- Automating mechanical fixes (file renames, schema updates).
- Assisting with semantic changes via AI prompt generation.
Before starting an alignment or migration:
- Clean Git State: Ensure you have no uncommitted changes.
git status # Should say "nothing to commit, working tree clean" - Latest Toolkit: Update the submodule to the target version.
git submodule update --remote devspec_toolkit
- Virtual Env:
devspec_envactive (runsource devspec_env/bin/activatefrom the toolkit root).source devspec_env/bin/activate
First, determine if migration is actually needed.
specdev align statusOutput Scenarios:
- "Aligned": Your
spec/specdev_versionmatches the toolkit. No action needed. - "Migration Required": Versions differ. Proceed to step 2.
- "Bootstrap": No version file found. Toolkit treats this as migrating from "empty" to "current".
See exactly what will change before touching anything.
specdev align diffThis reports:
- Missing Steps: New files you need to create.
- Renames: Steps that have been renumbered (e.g.,
13_old→15_new). - Schema Drifts: Fields that are now missing, extra, or have type mismatches.
- Paradigm Shifts: Prose files (like
roadmap.md) that need conversion to JSON.
Get a step-by-step checklist of operations.
specdev align planThis separates changes into:
- Mechanical: Safe to auto-apply (renames, schema headers).
- Semantic: Requires AI assistance or manual input.
Run the auto-fixer to handle the boring stuff.
specdev align apply --autoSafety: This automatically creates a hybrid backup (Git branch + local folder) before modifying any files.
What this does:
- Renames files (e.g.,
13_scaffold.json→15_scaffold.json). - Updates
$schemaURLs in JSON files. - Adds an in-progress marker to
spec/specdev_version(migration_status: in_progress+target_version), leavingtoolkit_versionat the old value.
apply --autodoes not finalize the version. It only marks the migration as in-progress;toolkit_versionis advanced — and amigration_historyentry recorded — solely byalign validate(step 7), once the full migration is verified. The in-progress marker is cleared at that point.
For complex changes (like converting prose to JSON or inferring new fields), generate tailored AI prompts.
specdev align prompts --output migration_prompts/This creates file-specific prompts (e.g., migration_prompts/prompt_migrate_14_roadmap.md) pre-filled with:
- Your original source data.
- The target schema.
- Specific transformation rules.
Iterate through the generated prompts:
- Open
migration_prompts/prompt_X.md. - Copy content to your AI assistant.
- Paste the AI's JSON output into the target spec file.
- Repeat for all generated prompts.
Confirm that your project is fully aligned and validity is restored.
specdev align validateThis checks:
- Schema compliance for all files.
- Trace integrity (links between steps).
- Presence of
_migration_notes(if any data couldn't be mapped).
If successful, it updates spec/specdev_version to the new toolkit version.
If something goes wrong (e.g., data corruption, completely broken specs), you can restore to the pre-migration state.
specdev align rollbackYou will be presented with a list of available backups:
- Git Backups: Restores the
backup/pre-migration-vX.Y.Zbranch. - Folder Backups: Restores from
spec/migration_backups/.
Cause: A JSON file exists but lacks the $schema key.
Fix: Add the $schema key manually or run align apply --auto if the file name matches a known step.
Cause: The toolkit expects to migrate roadmap.md to 14_roadmap.json, but can't find roadmap.md.
Fix: If you don't have the source file, you can skip this by manually creating an empty valid JSON file for the target step.
Cause: Migration renamed a step (e.g., FR-01 in step 04), but downstream files still reference the old name.
Fix: Run specdev align prompts again—it generates specific "fix reference" prompts for broken links.
Q: Can I skip versions (e.g., v0.1 to v0.5)?
A: Yes. The align tool compares your current state directly to the target state. It does not run a chain of sequential scripts. It calculates the net difference and plans accordingly.
Q: What happens to data that doesn't fit the new schema?
A: We follow a Lossless Migration philosophy. Any data that cannot be mapped to a valid field is moved to a special _migration_notes object within the JSON file, or a sidecar _migration_notes.md file. It is never silently deleted.
Q: Do I need to be in a Git repo?
A: It is highly recommended, but align apply works without Git by using folder-based backups in spec/migration_backups/.