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.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:
if [[ -z "${SIDEKICK_HOST_HOME:-}" ]]; then
if [[ -n "${CURSOR_VERSION:-${CURSOR_PROJECT_DIR:-${CURSOR_PLUGIN_ROOT:-}}}" ]]; then
SIDEKICK_HOST_HOME="${HOME}/.cursor"
elif [[ -n "${CODEX_HOME:-${CODEX_THREAD_ID:-${CODEX_PROJECT_DIR:-${CODEX_PLUGIN_ROOT:-}}}}" ]]; then
SIDEKICK_HOST_HOME="${CODEX_HOME:-${HOME}/.codex}"
elif [[ -n "${CLAUDE_SESSION_ID:-${CLAUDE_PROJECT_DIR:-${CLAUDE_PLUGIN_ROOT:-}}}" ]]; then
SIDEKICK_HOST_HOME="${HOME}/.claude"
else
echo "No host home found for Codex mode"; exit 1
fi
fi
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}" \
"${SIDEKICK_HOST_HOME}/sessions/${SIDEKICK_SESSION}" \
"${HOME}/.sidekick/sessions/${SIDEKICK_SESSION}" \
"${HOME}/.kay/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"
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.
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub alo-exp/sidekick --plugin sidekick