State Enforcement (v2.0):
- .state file as single source of truth for task phase
- Approval gates for research, decomposition, design, test_design
- status.py --transition refuses illegal phase transitions
- status.py --validate-folder detects out-of-order artifacts
- status.py --audit checks all tasks for violations
- status.py --create-task is the only valid way to create tasks
- Pre-v2.0 tasks without .state are UNTRACKED -- all commands refuse them
- New --upgrade command bootstraps .state files for existing tasks
Project Scoping:
- --project flag added to all status.py commands across 16+ files
- _find_project_dir errors instead of silently falling back to ~/.automaton/
- --scope-check marks framework files OUT_OF_SCOPE when working on a project
- Dashboard handlers use stored project_root instead of re-detecting from CWD
- Prompts reference ~/.automaton/scripts/vram_detect.py (not {project}/.automaton/)
Harness Integration:
- status.py --can-edit now supports project-level checks (no --task required)
- --can-edit --file checks file scope without --task
- --json output for machine-readable harness integration
- opencode plugin (plugins/automaton-guard/plugin.ts) intercepts edit/write
- Git pre-commit hook (scripts/git-hooks/pre-commit) blocks commits without task
- Formal integration contract (contracts/harness-integration.md)
Other:
- upgrade.sh delegates to status.py --upgrade instead of manual heuristics
- Phase prompts reference --project {project} for multi-project scoping
- 200 tests passing (14 new)
5.5 KiB
SPEC: Inflight Upgrade Path
Goal
Create a migration and upgrade path so that projects already using Automaton can adopt the new enforcement mechanisms (.state file, phase-scoped prompts, status.py) without breaking existing tasks or requiring manual intervention.
Background
Existing projects have tasks in progress with artifact files but no .state files. They use the current prompts without FORBIDDEN sections. The upgrade needs to be backward-compatible — existing tasks must continue to work, and the transition should be automatic.
Requirements
1. .state file bootstrap for existing tasks
When status.py encounters a task folder without a .state file:
- Use the artifact heuristic (from
workflow.md) to determine the current phase - Write
.statewith the inferred phase name - Output a note: "Bootstrapped .state for task '{task-name}': phase inferred as '{phase}' from existing artifacts"
This is already specified in the status-script spec. This task ensures:
- The artifact heuristic is correctly implemented in
status.py - Edge cases are handled (empty artifact files, partially completed phases)
- The bootstrap is logged so users can verify the inferred phase
2. Upgrade script
Create scripts/upgrade.sh (and reference it in scripts/update.sh) that:
- Scans
{project}/.automaton/tasks/for all task folders - For each task folder:
- Check if
.stateexists - If not, call
status.py --task {task-name}to bootstrap.state - Report the inferred phase for user verification
- Check if
- Scans sub-task folders (
subtasks/*/) and does the same - Runs
status.py --auditacross all tasks to detect:- Out-of-order artifacts (Category 1)
- State-artifact inconsistencies (Category 2)
- Unauthorized modifications if git is available (Category 3)
- Produces a summary:
Upgrade Summary: - 5 tasks scanned - 3 tasks already had .state (no change) - 2 tasks bootstrapped with inferred .state: - add-user-auth: research (SPEC.md exists) - fix-login-bug: implement (IMPLEMENTATION.md exists) Audit Results: - 1 violation found: - fix-login-bug: IMPLEMENTATION.md exists but .state says research (corrected to implement) - 4 tasks clean
3. Update install.sh to create .state for new tasks
When the Orchestrator creates a new task folder, it must:
- Create the task folder
- Write
.statewith contentnew\n - This is already covered by the state-file-enforcement spec; this task ensures the orchestrator prompt is updated to include this step
4. Update migrate-project.sh
The existing migration script needs to:
- Handle
.statefiles that may exist in old task folders (ignore them — they'll be bootstrapped bystatus.py) - Not delete
.statefiles during migration - Add
.stateto the list of non-artifact files (alongsideVRAM_CONFIG.mdandPARENT_SPEC.md)
5. Backward-compatible phase prompts
The updated prompts (with FORBIDDEN sections and .state checks) must work even when .state doesn't exist:
- If
.statedoesn't exist, the precondition check should say: "No .state file found. Proceeding based on artifact heuristic. Recommend running 'python ~/.automaton/scripts/status.py --task {task}' to bootstrap .state." - The prompt should not refuse to work if
.stateis missing — it should warn but continue - This ensures a graceful transition period
6. Documentation updates
Update README.md to document:
- The
.statefile and its role - The
status.pycommand and its flags - The upgrade path for existing projects
- That
status.py --listreplaces manual artifact checking
Update CHANGELOG.md under [unreleased]:
- Add
.statefile enforcement - Add
status.pyscript - Phase-scoped prompts with ALLOWED/FORBIDDEN sections
- Backward-compatible with existing tasks (automatic
.statebootstrap)
7. Version marker
Add a version marker to ~/.automaton/config.md:
## Framework Version
- **Version**: 2.0
- **State enforcement**: enabled (`.state` file + `status.py`)
This allows status.py to detect the framework version and adjust behavior if needed. Existing projects without this marker are assumed to be on version 1.x and get the bootstrap treatment.
Acceptance Criteria
status.pybootstraps.statefor tasks without it (artifact heuristic fallback)scripts/upgrade.shscans all tasks and bootstraps missing.statefilesscripts/upgrade.shrunsstatus.py --auditand reports violationsscripts/upgrade.shproduces a human-readable summary including audit resultsscripts/install.shor orchestrator prompt updated to create.statefor new tasksscripts/migrate-project.shhandles.statefiles correctly- Phase prompts work with or without
.state(graceful degradation) README.mdupdated with new features and upgrade instructionsCHANGELOG.mdupdated under[unreleased]- Version marker added to
config.md - Tests for
status.pybootstrap logic intests/test_status.py - Tests for
status.py --validate-folderand--auditintests/test_status.py - Tests for
upgrade.shintests/test_upgrade.py
Non-Goals
- This spec does not cover the
.statefile format itself (covered by state-file-enforcement) - This spec does not cover
status.pyimplementation (covered by status-script) - This spec does not cover prompt restructuring (covered by phase-scoped-prompts)
- This spec does not cover autopilot integration (covered by autopilot-gate-integration)