Codex Goal — Autonomous Goal Execution & Auditing Skill
The autonomous execution engine of AI Codex. Designed for complex, multi-step engineering tasks requiring sustained focus, self-auditing, and verifiable completion.
Overview
codex-goal is triggered when a user defines an end-to-end goal (e.g., implementing an entire feature suite, refactoring a legacy subsystem, or completing an engineering roadmap). It does not stop at surface-level code edits; it continuously tests, audits, fixes compiler/test errors, and validates invariants until the goal is fully fulfilled. It outputs a complete execution walkthrough in codex-drive/walkthroughs/.
When to Trigger
- User runs
/codex-goal(e.g.,/codex-goal implement end-to-end OAuth2 login flow with tests,/codex-goal complete database migration from SQLite to Postgres,/codex-goal eliminate all memory leaks in image pipeline) - Tasks intended to run autonomously without requiring constant step-by-step user input
- Multi-phase refactoring or complex greenfield implementations
Execution Workflow
┌────────────────────────────────────────────────────────┐
│ 1. DEFINE OBJECTIVE & FORMULATE SUCCESS CRITERIA │
│ Break the goal into deterministic, testable checks. │
└──────────────────────────┬─────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ 2. ITERATIVE EXECUTION & IMPLEMENTATION LOOP │
│ Write code, update manifests, wire components. │
└──────────────────────────┬─────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ 3. AUTOMATED VERIFICATION & TEST RUNS │
│ Run linters, compilers, unit tests & type checks. │
└──────────────────────────┬─────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ 4. SELF-AUDIT & RECOVERY (IF FAILING -> RE-ITERATE) │
│ Audit against success criteria. Fix all errors. │
└──────────────────────────┬─────────────────────────────┘
│ (All Checks Pass)
▼
┌────────────────────────────────────────────────────────┐
│ 5. WRITE COMPLETION WALKTHROUGH IN CODEX-DRIVE │
│ Write codex-drive/walkthroughs/YYYY-MM-DD-*.goal.md │
└────────────────────────────────────────────────────────┘
Goal Walkthrough Specification (codex-drive/walkthroughs/)
All execution walkthroughs generated by codex-goal MUST be Markdown (.md) files with exact date-time metadata.
Filename Format:
codex-drive/walkthroughs/YYYY-MM-DD-<slug>.goal.md
Standard Goal Walkthrough Template:
# [Goal Title] Autonomous Execution & Verification Walkthrough
> **Created At**: YYYY-MM-DD HH:MM:SS (Local Time)
> **Active Codex Edition**: [`skills/codex/<edition>/`](file:///...)
> **Status**: GOAL_COMPLETED | CANCELLED
> **Total Iterations**: [e.g., 4 iterations]
> **Total Automated Checks**: [e.g., 18 tests passed, 0 errors]
---
## 1. Goal Definition & Success Criteria
- **Stated Goal**: [Full description of the objective]
- **Success Checklist**:
- [x] All required domain models and schemas implemented
- [x] Endpoints / UI components fully integrated
- [x] Zero compiler errors, zero type errors, zero lint warnings
- [x] 100% automated test suite passing
---
## 2. Changes Summary by Component
### Component A: `src/domain/`
- `[NEW]` [`src/domain/model.ts`](file:///...) — Core domain invariants
- `[MODIFY]` [`src/domain/service.ts`](file:///...) — Integrated business logic
### Component B: `src/api/`
- `[NEW]` [`src/api/routes.ts`](file:///...) — REST/gRPC endpoints
---
## 3. Verification & Self-Audit Trail
| Iteration | Action Taken | Test Result | Self-Audit Verdict |
|---|---|---|---|
| **1** | Scaffolding models and routes | Compilation succeeded, test failed | [WARNING] Incomplete edge case handling |
| **2** | Added boundary validation | Tests passed, linter warned on unused type | [WARNING] Minor lint issue |
| **3** | Cleaned up types & ran full test suite | All 18 tests passed, zero warnings | [OK] **GOAL FULLY ACHIEVED** |
---
## 4. Final Verification Command Output
```bash
$ npm test
[OK] All 18 test suites passed (1.2s)
5. Next Actions & Operational Readiness
- Code is verified, tested, and ready for deployment or merge.
---
## Response Protocol
When `codex-goal` completes:
1. Provide a direct link to `[View Goal Walkthrough](file:///.../codex-drive/walkthroughs/YYYY-MM-DD-<slug>.goal.md)`.
2. Summarize the major changes and test verification results.
3. Include the completion token `<!-- GOAL_COMPLETE -->` in the response.