| name | autonomous-execution |
| description | Guidelines for autonomous execution in automation/orchestration contexts |
| type | usage |
| scope | project |
Autonomous Execution Guidelines
Purpose
Provide clear guidelines for agents running in autonomous automation contexts (tmux sessions, background agents, orchestration workflows) where human interaction is not available.
Activation cues
- Running in tmux session spawned by orchestration system
- Executing as part of automated PR fixing (fixpr, fixcomment workflows)
- Background agent tasks with no interactive terminal
- Any automation context where asking questions blocks progress
Core Principle
Success = Remote commits pushed
In autonomous contexts:
- Exit 0 without commits = FAILURE
- Asking questions without proceeding = FAILURE
- Stopping for user input = FAILURE
Critical Rules for Autonomous Execution
1. Git Dirty State Handling
If you encounter unexpected staged changes or modified files after checkout:
git status
git diff --stat
git reset --hard origin/<branch-name>
git clean -fd
CRITICAL:
- ✅ ALWAYS handle dirty state automatically
- ✅ Clean and proceed, don't block
- ❌ NEVER ask "Do you want me to keep/stash/discard?"
- ❌ NEVER stop with "Per instructions, I have to stop"
2. Decision Making
Make autonomous decisions within task scope:
- ✅ Clean dirty git state automatically
- ✅ Choose between equivalent approaches
- ✅ Fix obvious issues without confirmation
- ✅ Determine which tests to run
- ✅ Decide commit message phrasing
Only ask questions for:
- ❓ Ambiguous requirements affecting correctness
- ❓ Multiple valid architectural approaches with tradeoffs
- ❓ User preference choices that impact UX
NEVER ask about:
- ❌ Operational details (git state, temp files, etc.)
- ❌ Obvious bug fixes
- ❌ Standard code formatting/style choices
- ❌ Test execution strategy
3. Working Directory Assumptions
In automation contexts, assume:
- Working directory is temporary (
/tmp/worldarchitect.ai/pr-*)
- Dirty state is safe to clean/reset
- Previous run artifacts can be discarded
- No valuable uncommitted work exists
Therefore:
- Clean aggressively without asking
- Reset to clean state if uncertain
- Focus on completing task, not preserving unknown state
4. Error Recovery
When encountering issues:
"I hit an error. Should I retry or abort?"
try_alternative_approach()
if still_fails:
log_error_and_exit_1()
5. Success Criteria
Only exit 0 if:
- ✅ Remote commits pushed to PR branch
- ✅ All requested changes implemented
- ✅ Tests pass (if required by task)
Exit 1 if:
- ❌ Unable to make commits due to technical issue
- ❌ Tests fail and cannot be fixed
- ❌ Actual blocker preventing completion
NEVER:
- ❌ Exit 0 after asking question without proceeding
- ❌ Exit 0 with "I need more information to continue"
- ❌ Exit 0 with "waiting for user response"
Examples
✅ CORRECT: Autonomous Dirty State Handling
git status
git diff --stat
git reset --hard origin/feature-x
git clean -fd
gh pr checkout 123
git push
❌ WRONG: Stopping to Ask
git status
"I hit unexpected local changes. Per instructions, I have to stop.
Do you want me to: 1) keep, 2) stash, 3) discard?"
✅ CORRECT: Autonomous Decision Making
./run_tests.sh mvp_site/tests/test_agents.py
Edit mvp_site/agents.py (change field names)
Edit mvp_site/tests/test_agents.py (change test field names)
./run_tests.sh mvp_site/tests/test_agents.py
git add -A
git commit -m "[codex-automation-commit] fix PR #4018: correct field name to faction_minigame_enabled"
git push
Integration with Other Skills
- pr-workflow-manager: Use PR workflow best practices, but handle dirty state autonomously
- receiving-code-review: Implement feedback, clean state automatically
- build-test-lint-autopilot: Run tests, decide which to execute autonomously
Monitoring and Debugging
When running autonomously, provide clear logging:
echo "[AUTONOMOUS] Detected dirty state, cleaning automatically"
echo "[AUTONOMOUS] Decided to reset to origin/branch-name"
echo "[AUTONOMOUS] Proceeding with PR fixes after clean"
This helps debugging while maintaining autonomous execution.
Summary
In autonomous contexts:
- Handle dirty state automatically (clean and proceed)
- Make decisions within task scope
- Only exit 0 if commits are pushed
- Never stop to ask operational questions
- Provide clear logging for debugging
Remember: Automation contexts have no human watching. Asking questions = blocking forever = failure.