From sidekick
Canonical Codex delegation workflow for the OpenAI Codex CLI sidekick. Use when activating Codex mode before delegated implementation work.
How this skill is triggered — by the user, by Claude, or both
Slash command
/sidekick:codex-delegate <task to delegate to Codex><task to delegate to Codex>The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Codex is the OpenAI execution sidekick. The host AI plans, explains, and verifies.
Codex is the OpenAI execution sidekick. The host AI plans, explains, and verifies. Codex writes files, runs tests, and executes implementation work through the local OpenAI Codex CLI.
Host AI = Brain
Codex = Hands
SIDEKICK_SESSION_ID before activation, and sessionEnd clears session-scoped delegation markers.While Codex mode is active, the host AI remains the user-interactor, orchestrator, verifier, advisor, and mentor. Codex is the primary implementation executor.
The host keeps freedom to:
git status, git diff, bash tests/*.bash, and similar).planning/ and site/Sidekick hooks narrow enforcement to implementation ownership: direct Write/Edit/Delete on implementation files is denied on Claude/Codex hosts and surfaced as an advisory on Cursor via postToolUse. Delegate implementation through codex exec.
Codex readiness is checked when delegation starts for the current session. SessionStart does not install or repair the runtime. If the health check fails, guide the user through the local OpenAI Codex CLI setup path first.
Before delegating, verify the local OpenAI Codex CLI is available:
if command -v codex >/dev/null 2>&1 \
&& ! codex --version 2>/dev/null | grep -qiE '^kay([[:space:]]|$)' \
&& codex exec --help 2>/dev/null | grep -q -- '--ask-for-approval'; then
CODEX_RUNTIME="codex"
fi
test -n "${CODEX_RUNTIME:-}" || { echo "No OpenAI Codex CLI runtime found"; exit 1; }
This check intentionally rejects the legacy Kay compatibility alias exposed as codex. Sidekick's Codex mode requires the real OpenAI Codex CLI.
Delegation defaults:
gpt-5.4-minixhighworkspace-writeneverIf the CLI is installed but not authenticated, guide the user through the local OpenAI Codex CLI login flow before continuing.
Create the current-session Codex marker before delegating so Sidekick hooks can enforce direct-edit denial, inject the Codex runtime flags above, surface bounded redacted Codex output with [CODEX] and [CODEX-SUMMARY] markers, and maintain .codex/conversations.idx:
SIDEKICK_SESSION="${SIDEKICK_SESSION_ID:-${SIDEKICK_HOST_SESSION_ID:-${CODEX_THREAD_ID:-${CLAUDE_SESSION_ID:-${SESSION_ID:-}}}}}"
test -n "${SIDEKICK_SESSION}" || { echo "No host session id found for Codex mode"; exit 1; }
CODEX_STATE_ROOT="${HOME}/.codex"
mkdir -p "${CODEX_STATE_ROOT}/sessions/${SIDEKICK_SESSION}" \
"${HOME}/.sidekick/sessions/${SIDEKICK_SESSION}"
rm -f "${HOME}/.kay/sessions/${SIDEKICK_SESSION}/.kay-delegation-active"
printf '%s\n' "codex" > "${HOME}/.sidekick/sessions/${SIDEKICK_SESSION}/active-sidekick"
: > "${CODEX_STATE_ROOT}/sessions/${SIDEKICK_SESSION}/.codex-delegation-active"
Session-scoped markers only:
~/.sidekick/sessions/<session>/active-sidekick — shared selector (kay or codex)~/.codex/sessions/<session>/.codex-delegation-active — Codex enforcement markerDelegation ends when the host session ends (Cursor sessionEnd hook clears markers) or when /sidekick:codex-stop runs. Do not use project-level or repo-root activation markers.
Codex and Kay are mutually exclusive per host session. Codex activation clears any current-session Kay marker and writes active-sidekick=codex, so the Kay hook becomes a no-op before Codex commands start.
Confirm: "Codex sidekick mode activated for this session. Delegating implementation work to Codex."
To stop: /sidekick:codex-stop
Child runtime command used after Codex mode is active:
codex exec -m gpt-5.4-mini -c model_reasoning_effort=xhigh --sandbox workspace-write --ask-for-approval never "<task description>"
Sidekick injects the model, reasoning, sandbox, and approval flags automatically while Codex mode is active. Do not hand-add them unless you are debugging the routing layer.
Useful options:
--json for machine-readable progress--output-last-message for final-response-only outputresume --last to continue prior non-interactive sessionscodex exec automation for file changes, tests, and commits.AGENTS.md instructions.Use this loop after every sidekick task or subtask before reporting completion, starting dependent work, or accepting a sidekick STATUS: SUCCESS. Treat STATUS: SUCCESS as a claim to audit, not proof.
Verification checklist:
MISSED_REQUIREMENT, INTEGRATION_ERROR, REGRESSION, WRONG_LOGIC, SYNTAX_ERROR, WRONG_FILE, UNVERIFIED_ASSUMPTION, KNOWLEDGE_GAP, MISUNDERSTOOD_TASK, TRIAL_INCOMPLETE, API_FAILURE, EXECUTION_ERROR_EXTERNAL.Recovery protocol:
TRIAL_INCOMPLETE, API_FAILURE, or EXECUTION_ERROR_EXTERNAL, do not treat partial output as complete; retry after the model provider or environment is usable, or report the external blocker with evidence.The host AI only reports completion after its own verification evidence supports the result.
Creates bite-sized, testable implementation plans from specs or requirements, with file structure and task decomposition. Activates before coding multi-step tasks.
npx claudepluginhub alo-exp/sidekick --plugin sidekick