Codex Task Execution Loop
Purpose
- Execute implementation tasks safely in a single agent.
- Preserve the proven 4-step quality cycle without subagents.
Execution Contract
This skill follows the non-entry execution contract standard.
Required contract_extensions: task_unit_id, cycle_index.
See codex-execution-contract.md and non-entry-execution-contract-template.md for full rules.
input:
objective: "Implement one task unit and run quality gate"
contract_extensions: { task_unit_id: "task-12.3", cycle_index: 2 }
output:
status: "completed"
quality_gate:
gate_id: "task-cycle-check"
gate_type: "implementation"
trigger:
event: "post-cycle validation"
source: "codex-task-execution-loop"
criteria:
- id: "task-unit-complete"
description: "Task unit checks are complete"
- id: "contract-aligned"
description: "Cycle contract fields remain aligned"
result: "pass"
evidence:
- check_id: "cycle-checks"
status: "pass"
summary: "Cycle checks passed"
source_ref: ".claude/skills/codex-task-execution-loop/SKILL.md"
blockers: []
branching:
on_pass: "handoff"
on_fail: "revise"
max_cycles: 2
contract_extensions: { task_unit_id: "task-12.3", cycle_index: 2 }
Contract Compliance
- Emit structured output compliant with
codex-execution-contract.md.
- Always include baseline output fields:
status, summary, changed_files, tests, quality_gate, blockers, next_actions.
- Validate required input fields from
../workflow-entry/references/non-entry-execution-contract-template.md (objective, scope, constraints, acceptance_criteria, allowed_commands, sandbox_mode) before proceeding.
- Echo required skill extensions in
contract_extensions: task_unit_id, cycle_index.
- Treat missing required fields as contract violations and regenerate output before handoff.
- On contract violation (missing/invalid field, invalid status value, or missing extension keys): do not proceed; emit status: blocked with violation description in blockers.
- Reference:
non-entry-execution-contract-template.md.
4-Step Cycle (Mandatory Per Task)
- Implement one task unit.
- Run escalation check.
- Run quality gate.
- Decide commit readiness and report.
Step Details
1) Implement one task unit
- Follow
coding-principles.
- Add or update tests using
testing-principles.
- Keep change scope small enough for one review/commit unit.
2) Escalation check
Escalate to user if any condition is true:
- Requirements are unclear or changed: emit
[Stop: requirement-change-detected] + [Approve: route-selection].
- Task is blocked by missing environment or permissions: emit
[Stop: quality-gate-failed] + [Approve: resume-after-fix] with blocker details.
- Fix would require architecture change not in design docs: emit
[Stop: high-risk-change] + [Approve: high-risk-change].
3) Quality gate
Run and fix until stable:
- Formatting/lint/static checks
- Build/compile
- Unit tests
- Integration tests when affected
Use ai-development-guide for anti-pattern checks and fail-fast error handling discipline.
4) Commit readiness and report
- If all gates pass, mark task as ready.
- If not, emit
[Stop: quality-gate-failed] + [Approve: resume-after-fix], then return explicit blockers and next action options.
Hard Rules
- Never batch multiple unrelated tasks in one cycle.
- Never skip quality gate after implementation changes.
- Never hide errors via silent fallback.
- Never claim completion without verification evidence.
Integration and E2E Handling
- Use
integration-e2e-testing when adding or changing cross-component behavior.
- Keep integration tests close to implementation.
- Run E2E on milestone boundaries or before final handoff.
Quality Gate Evidence
- This executor owns
quality_gate emission and branching using quality-gate-evidence-template.md.
- Emit canonical fields:
gate_id, gate_type, trigger, criteria, result, evidence, blockers, branching.
- Use
gate_type: implementation for task execution loops.
- Normalize local statuses into
result: pass|fail|blocked before handoff.
- If
result: blocked, emit [Stop: quality-gate-failed] and pause for escalation handling.
Stop/Approval Protocol
Use canonical markers: [Stop: <Gate Name>].
Classify every stop as approval_gate or escalation_gate.
At each stop, emit a full gate record: gate_name, gate_type, trigger, ask_method, required_user_action, resume_if, fallback_if_rejected.
Default ask_method is AskUserQuestion.
Resume an approval_gate only with explicit user approved: true; resume an escalation_gate only after user direction or reroute.
Respect batch boundary: no autonomous implementation starts before [Stop: pre-implementation-approval] is approved.
Enforce max_revision_cycles: 2; overflow requires human intervention.
Agent-local task/review outcomes never replace user approvals.
Stop points for this skill:
[Stop: pre-implementation-approval] (approval_gate)
[Stop: high-risk-change] (approval_gate)
[Stop: requirement-change-detected] (escalation_gate)
[Stop: quality-gate-failed] (escalation_gate)
[Stop: revision-limit-reached] (escalation_gate)
Full protocol and payload schema: ../workflow-entry/references/stop-approval-section-template.md.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: codex-task-execution-loop3description: Single-agent execution loop for implementation tasks. Replaces task-executor/quality-fixer subagent cycle with direct Codex skill-driven implementation and quality gates. Use when this capability is needed.4---56# Codex Task Execution Loop78## Purpose910- Execute implementation tasks safely in a single agent.11- Preserve the proven 4-step quality cycle without subagents.1213## Execution Contract1415This skill follows the non-entry execution contract standard.16Required `contract_extensions`: `task_unit_id`, `cycle_index`.17See [`codex-execution-contract.md`](../workflow-entry/references/codex-execution-contract.md) and [`non-entry-execution-contract-template.md`](../workflow-entry/references/non-entry-execution-contract-template.md) for full rules.1819```yaml20input:21 objective: "Implement one task unit and run quality gate"22 contract_extensions: { task_unit_id: "task-12.3", cycle_index: 2 }23output:24 status: "completed"25 quality_gate:26 gate_id: "task-cycle-check"27 gate_type: "implementation"28 trigger:29 event: "post-cycle validation"30 source: "codex-task-execution-loop"31 criteria:32 - id: "task-unit-complete"33 description: "Task unit checks are complete"34 - id: "contract-aligned"35 description: "Cycle contract fields remain aligned"36 result: "pass"37 evidence:38 - check_id: "cycle-checks"39 status: "pass"40 summary: "Cycle checks passed"41 source_ref: ".claude/skills/codex-task-execution-loop/SKILL.md"42 blockers: []43 branching:44 on_pass: "handoff"45 on_fail: "revise"46 max_cycles: 247 contract_extensions: { task_unit_id: "task-12.3", cycle_index: 2 }48```4950## Contract Compliance5152- Emit structured output compliant with [`codex-execution-contract.md`](../workflow-entry/references/codex-execution-contract.md).53- Always include baseline output fields: `status`, `summary`, `changed_files`, `tests`, `quality_gate`, `blockers`, `next_actions`.54- Validate required input fields from `../workflow-entry/references/non-entry-execution-contract-template.md` (objective, scope, constraints, acceptance_criteria, allowed_commands, sandbox_mode) before proceeding.55- Echo required skill extensions in `contract_extensions`: `task_unit_id`, `cycle_index`.56- Treat missing required fields as contract violations and regenerate output before handoff.57- On contract violation (missing/invalid field, invalid status value, or missing extension keys): do not proceed; emit status: blocked with violation description in blockers.58- Reference: [`non-entry-execution-contract-template.md`](../workflow-entry/references/non-entry-execution-contract-template.md).5960## 4-Step Cycle (Mandatory Per Task)61621. Implement one task unit.632. Run escalation check.643. Run quality gate.654. Decide commit readiness and report.6667## Step Details6869### 1) Implement one task unit7071- Follow `coding-principles`.72- Add or update tests using `testing-principles`.73- Keep change scope small enough for one review/commit unit.7475### 2) Escalation check7677Escalate to user if any condition is true:78- Requirements are unclear or changed: emit `[Stop: requirement-change-detected]` + `[Approve: route-selection]`.79- Task is blocked by missing environment or permissions: emit `[Stop: quality-gate-failed]` + `[Approve: resume-after-fix]` with blocker details.80- Fix would require architecture change not in design docs: emit `[Stop: high-risk-change]` + `[Approve: high-risk-change]`.8182### 3) Quality gate8384Run and fix until stable:85- Formatting/lint/static checks86- Build/compile87- Unit tests88- Integration tests when affected8990Use `ai-development-guide` for anti-pattern checks and fail-fast error handling discipline.9192### 4) Commit readiness and report9394- If all gates pass, mark task as ready.95- If not, emit `[Stop: quality-gate-failed]` + `[Approve: resume-after-fix]`, then return explicit blockers and next action options.9697## Hard Rules9899- Never batch multiple unrelated tasks in one cycle.100- Never skip quality gate after implementation changes.101- Never hide errors via silent fallback.102- Never claim completion without verification evidence.103104## Integration and E2E Handling105106- Use `integration-e2e-testing` when adding or changing cross-component behavior.107- Keep integration tests close to implementation.108- Run E2E on milestone boundaries or before final handoff.109110## Quality Gate Evidence111112- This executor owns `quality_gate` emission and branching using [`quality-gate-evidence-template.md`](../workflow-entry/references/quality-gate-evidence-template.md).113- Emit canonical fields: `gate_id`, `gate_type`, `trigger`, `criteria`, `result`, `evidence`, `blockers`, `branching`.114- Use `gate_type: implementation` for task execution loops.115- Normalize local statuses into `result: pass|fail|blocked` before handoff.116- If `result: blocked`, emit `[Stop: quality-gate-failed]` and pause for escalation handling.117118## Stop/Approval Protocol119120Use canonical markers: `[Stop: <Gate Name>]`.121Classify every stop as `approval_gate` or `escalation_gate`.122At each stop, emit a full gate record: `gate_name`, `gate_type`, `trigger`, `ask_method`, `required_user_action`, `resume_if`, `fallback_if_rejected`.123Default `ask_method` is `AskUserQuestion`.124Resume an `approval_gate` only with explicit user `approved: true`; resume an `escalation_gate` only after user direction or reroute.125Respect batch boundary: no autonomous implementation starts before `[Stop: pre-implementation-approval]` is approved.126Enforce `max_revision_cycles: 2`; overflow requires human intervention.127Agent-local task/review outcomes never replace user approvals.128129Stop points for this skill:130- `[Stop: pre-implementation-approval]` (`approval_gate`)131- `[Stop: high-risk-change]` (`approval_gate`)132- `[Stop: requirement-change-detected]` (`escalation_gate`)133- `[Stop: quality-gate-failed]` (`escalation_gate`)134- `[Stop: revision-limit-reached]` (`escalation_gate`)135136Full protocol and payload schema: [`../workflow-entry/references/stop-approval-section-template.md`](../workflow-entry/references/stop-approval-section-template.md).137138---139> Converted and distributed by [TomeVault](https://tomevault.io/claim/ssaattww) — claim your Tome and manage your conversions.140<!-- tomevault:4.0:skill_md:2026-04-14 -->