---
phase: 67-paul-codex-executor
plan: 01
subsystem: infra
tags: [paul-framework, codex, delegation, executor, fallback]

requires:
  - phase: 65-paul-delegated-apply
    provides: Delegated-apply workflow, micro-prompt template, evaluation protocol

provides:
  - Codex CLI as alternative executor in PAUL delegated-apply
  - Rule of thirds (1/3 Codex if >3 tasks)
  - Auto-fallback Claude → Codex on quota error
  - UTF-8 guard for Codex micro-prompts
  - File overlap protection between executors

affects: [all future phases using /paul:apply with >3 tasks]

tech-stack:
  added: [codex-cli]
  patterns: [multi-executor-delegation, auto-fallback, file-conflict-detection]

key-files:
  modified:
    - ~/.claude/paul-framework/references/delegated-apply.md
    - ~/.claude/paul-framework/workflows/apply-phase.md
    - ~/.claude/paul-framework/templates/PLAN.md

key-decisions:
  - "Reguła 1/3: ceil(count/3) tasków do Codex przy >3 taskach auto"
  - "Codex dostaje najprostsze taski (fewest files)"
  - "Codex i Claude NIE MOGĄ edytować tych samych plików"
  - "Auto-fallback Claude→Codex przy quota error, reverse fallback przy Codex timeout"
  - "UTF-8 guard obowiązkowy w każdym Codex micro-prompt"

patterns-established:
  - "codex exec -c 'approval_mode=\"full-auto\"' jako non-interactive executor"
  - "File overlap check przed przydziałem executorów"
  - "delegation: codex jako tryb wymuszający Codex dla wszystkich tasków"

duration: ~10min
started: 2026-04-03T21:00:00Z
completed: 2026-04-03T21:10:00Z
---

# Phase 67 Plan 01: PAUL Codex Executor

**Integracja Codex CLI jako alternatywny executor w PAUL — reguła 1/3 przy >3 taskach, auto-fallback Claude→Codex, ochrona plików przed współdzieleniem executorów, UTF-8 guard.**

## Performance

| Metric | Value |
|--------|-------|
| Duration | ~10min |
| Tasks | 3 completed (delegated, parallel) |
| Files modified | 3 |
| Execution mode | Delegated auto (3 sub-agents parallel) |

## Acceptance Criteria Results

| Criterion | Status | Notes |
|-----------|--------|-------|
| AC-1: Reguła 1/3 Codex przy >3 taskach | Pass | Zdefiniowana w delegated-apply.md + apply-phase.md |
| AC-2: Auto-fallback Claude → Codex | Pass | W execute_tasks + error_handling |
| AC-3: UTF-8 guard w Codex prompts | Pass | Micro-prompt guard w delegated-apply.md |
| AC-4: Backward compatible | Pass | <=3 tasków = bez Codex, delegation: off = inline |

## Accomplishments

- Sekcja "Codex Executor" w delegated-apply.md z regułą 1/3, auto-fallback, UTF-8 guard
- Executor assignment logic w apply-phase.md z file overlap protection
- Tryb `delegation: codex` w PLAN.md template
- Error handling: Codex timeout, encoding issues, file conflicts
- Anti-patterns: mixing executors on same files, Polish text without guard

## Files Created/Modified

| File | Change | Purpose |
|------|--------|---------|
| `~/.claude/paul-framework/references/delegated-apply.md` | Modified | +Codex Executor section, +codex mode, +constraints |
| `~/.claude/paul-framework/workflows/apply-phase.md` | Modified | +executor assignment, +Codex path, +fallback, +error handling |
| `~/.claude/paul-framework/templates/PLAN.md` | Modified | +codex mode w frontmatter, tabeli, sekcji |

## Deviations from Plan

None — plan executed as specified.

## Next Phase Readiness

**Ready:** PAUL wspiera 4 tryby delegation: auto, parallel, codex, off. Codex zintegrowany jako executor z pełną ochroną (file overlap, UTF-8, fallback).

**Blockers:** None

---
*Phase: 67-paul-codex-executor, Plan: 01*
*Completed: 2026-04-03*
