fix(executor): add completion verification to prevent hallucinated success (#315)

Executor self-check after SUMMARY.md creation verifies key-files exist
on disk and commit hashes exist in git log. Orchestrator spot-checks
SUMMARY claims before trusting and proceeding to next wave. Segmented
execution (execute-plan.md) gets the same self-check inline.
This commit is contained in:
David Sienkowski
2026-02-04 17:58:27 -05:00
parent 83845755b3
commit f380275ed8
4 changed files with 61 additions and 1 deletions

View File

@@ -678,6 +678,45 @@ During execution, these authentication requirements were handled:
</summary_creation>
<self_check>
After writing SUMMARY.md, verify your own claims before proceeding.
**1. Check created files exist:**
Parse `key-files.created` from the SUMMARY frontmatter. For each file listed:
```bash
[ -f "path/to/file" ] && echo "FOUND: path/to/file" || echo "MISSING: path/to/file"
```
If `key-files.created` is empty (docs-only plans), skip this check.
**2. Check commits exist:**
Parse commit hashes from the "Task Commits" section. Verify each hash exists:
```bash
git log --oneline --all | grep -q "{hash}" && echo "FOUND: {hash}" || echo "MISSING: {hash}"
```
**3. Append self-check result to SUMMARY.md:**
If ANY file or commit is missing, append to SUMMARY.md:
```markdown
## Self-Check: FAILED
Missing files:
- path/to/missing-file.ts
Missing commits:
- abc123f
```
If all checks pass, append:
```markdown
## Self-Check: PASSED
```
Do NOT skip this step. Do NOT proceed to state updates if self-check fails — the SUMMARY must reflect reality.
</self_check>
<state_updates>
After creating SUMMARY.md, update STATE.md.