Files
automaton/tasks/phase-scoped-prompts/IMPLEMENTATION.md
T
gitea 05c76852a2
CI / build (push) Has been cancelled
v2.0: state enforcement, project scoping, harness integration
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)
2026-06-15 14:16:46 -04:00

56 lines
3.2 KiB
Markdown

# Implementation: Phase-Scoped Prompts with Forbidden Actions
## Changes Made
### 1. ALLOWED/FORBIDDEN sections in all phase prompts
Each phase prompt now includes:
- **ALLOWED ACTIONS** — explicit list of what the agent can do
- **FORBIDDEN ACTIONS** — explicit list of what the agent cannot do, including "Do NOT" instructions and handling user overrides
Phase-specific definitions:
- research.md: ALLOWED read/ask questions/write SPEC.md; FORBIDDEN edit code, create IMPLEMENTATION.md, skip to implementation
- decompose.md: ALLOWED read SPEC/ask questions/write DECOMPOSITION.md; FORBIDDEN edit code, modify SPEC.md, create sub-task folders
- design.md: ALLOWED read SPEC/ask questions/write DESIGN.md; FORBIDDEN edit code, create IMPLEMENTATION.md, skip to implementation
- test_design.md: ALLOWED read SPEC+DESIGN/ask questions/write TEST_PLAN.md; FORBIDDEN edit code, write test implementations
- implement.md: ALLOWED edit code/write tests/create IMPLEMENTATION.md; FORBIDDEN create new tasks, modify SPEC/DESIGN
- bug_finder.md: ALLOWED read code/SPEC/IMPLEMENTATION/write BUG_REPORT.md; FORBIDDEN edit code, fix bugs
- adversarial_bug_find.md: ALLOWED read code/SPEC/BUG_REPORT/write ADVERSARIAL_BUG_REPORT.md; FORBIDDEN edit code, fix bugs
- doc_review.md: ALLOWED read DESIGN/code/docs/write DOC_REVIEW.md/update docs; FORBIDDEN edit non-doc code, modify SPEC/DESIGN
- referee.md: ALLOWED read all artifacts/write VERDICT.md; FORBIDDEN edit code, modify any artifact other than VERDICT.md
- orchestrate.md: ALLOWED read .state/transition state/create tasks/delegate; FORBIDDEN edit code directly, skip phases
### 2. User override resistance
Each prompt includes a "Handling User Overrides" section telling agents to refuse forbidden actions and suggest the correct phase.
### 3. `.state` precondition check
Every phase prompt includes `.state` as the first file to read, with instructions to STOP if the phase doesn't match.
### 4. Pre-Work Validation (MANDATORY)
Every phase prompt requires running `python ~/.automaton/scripts/status.py --validate-folder --task {task-name}` before starting work.
### 5. Approval gates
- research.md, decompose.md, design.md, test_design.md: include Approval Gate section with `--transition {phase}:awaiting_approval`, `--approve`, and `--transition {next-phase}`
- implement.md, bug_finder.md, adversarial_bug_find.md, doc_review.md, referee.md: include "No Approval Gate" section with direct `--transition`
### 6. Orchestrate.md restructuring
- Reduced from 493 to 143 lines
- State determination logic referenced from workflow.md
- Sub-task management extracted to subtask_management.md
- Gate-check loop with `--validate-folder` and approval pauses
## Files Modified
- `prompts/research.md` (updated)
- `prompts/design.md` (updated)
- `prompts/decompose.md` (updated)
- `prompts/test_design.md` (updated)
- `prompts/implement.md` (updated)
- `prompts/bug_finder.md` (updated)
- `prompts/adversarial_bug_find.md` (updated)
- `prompts/doc_review.md` (updated)
- `prompts/referee.md` (updated)
- `prompts/orchestrate.md` (rewritten, 143 lines)
- `prompts/subtask_management.md` (new, extracted)
## Test Results
- All prompt self-consistency tests passing
- onboarding.md excluded from stop-condition test