v2.0: state enforcement, project scoping, harness integration
CI / build (push) Has been cancelled

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)
This commit is contained in:
2026-06-15 14:16:46 -04:00
parent 79b783864e
commit 05c76852a2
151 changed files with 7295 additions and 632 deletions
+80
View File
@@ -0,0 +1,80 @@
# Fix Prompt Consistency
## Goal
Fix three categories of inconsistency in the prompt files: missing stop conditions, deprecated task paths, and a blind spot in the prompt-path test.
## Requirements
### R1. Add stop condition to `bug_finder.md`
`prompts/bug_finder.md` (47 lines) is the only delivery-style prompt that has neither a `## Stop Condition (MANDATORY)` block nor requires a `CONTRACT_MET` output. Every other delivery prompt (research, design, test_design, implement, doc_review, referee, decompose) has this block.
**Fix**: Append the standard block at the end of `prompts/bug_finder.md`:
```
## Stop Condition (MANDATORY)
You are not allowed to end this session until you have produced the BUG_REPORT.md file AND output the exact phrase "CONTRACT_MET".
Until then, continue working or ask clarifying questions.
```
### R2. Add stop condition to `adversarial_bug_find.md`
`prompts/adversarial_bug_find.md` outputs `ADVERSARIAL_BUG_FIND_COMPLETE` instead of `CONTRACT_MET`. This is a non-standard completion signal. While the orchestrator spec (orchestrate.md:340) says it checks for "CONTRACT_MET or the phase's stop condition," the inconsistency is error-prone.
**Fix**: Add the standard block after line 18 and update the existing output line to also require `CONTRACT_MET`:
```
## Stop Condition (MANDATORY)
You are not allowed to end this session until you have produced the ADVERSARIAL_BUG_REPORT.md file AND output the exact phrase "CONTRACT_MET".
Until then, continue working or ask clarifying questions.
```
### R3. Fix deprecated task path in `onboarding.md`
`prompts/onboarding.md:67` uses the deprecated `{project}/tasks/onboarding/` path instead of the canonical `{project}/.automaton/tasks/onboarding/`.
**Fix**: Change line 67 from:
```
Then produce a file called ONBOARDING_REPORT.md at {project}/tasks/onboarding/ONBOARDING_REPORT.md
```
to:
```
Then produce a file called ONBOARDING_REPORT.md at {project}/.automaton/tasks/onboarding/ONBOARDING_REPORT.md
```
Also update line 101-102 which references the deprecated location in documentation:
```
- If `{project}/tasks/` exists but `{project}/.automaton/tasks/` does not, tasks need to be moved.
```
This is correct as-is — it references the legacy location for migration detection. Keep it.
### R4. Fix `test_prompt_paths.py` regex to catch concrete deprecated paths
`tests/test_prompt_paths.py:13` uses:
```python
LEGACY_PATH = re.compile(r"\{project\}/tasks/\{task-name\}/")
```
This only matches the literal placeholder `{task-name}`. It misses concrete task names like `{project}/tasks/onboarding/`.
**Fix**: Add a second pattern that catches any kebab-case name in the deprecated location:
```python
CONCRETE_LEGACY_PATH = re.compile(r"\{project\}/tasks/[\w-]+/")
```
Add a new test that asserts zero matches of this pattern in prompts.
### R5. Verify no other deprecated paths exist
Run the updated test across all prompt files to ensure `onboarding.md` was the only violation.
## Acceptance Criteria
- [ ] `prompts/bug_finder.md` ends with `## Stop Condition (MANDATORY)` block
- [ ] `prompts/adversarial_bug_find.md` ends with `## Stop Condition (MANDATORY)` block
- [ ] `prompts/onboarding.md` uses `{project}/.automaton/tasks/onboarding/` not `{project}/tasks/onboarding/`
- [ ] `tests/test_prompt_paths.py` has a new test for concrete deprecated paths
- [ ] Running `python -m pytest tests/test_prompt_paths.py -v` catches `{project}/tasks/onboarding/` in onboarding.md BEFORE the fix and passes AFTER
- [ ] All existing prompt tests still pass
## Non-Goals
- Not standardizing all stop signals to CONTRACT_MET (compaction.md uses COMPACTION_COMPLETE by design — the orchestrator handles custom signals)
- Not rewriting onboarding.md to use the migration script (that's a separate task)