From sidekick
Canonical Kay delegation workflow for the Kay sidekick. Use when activating Kay mode before delegated implementation work.
How this skill is triggered — by the user, by Claude, or both
Slash command
/sidekick:kay-delegate [ocg|xiaomi] <task to delegate>[ocg|xiaomi] <task to delegate>The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Kay is the implementation sidekick. The host AI plans, explains, and verifies.
Kay is the implementation sidekick. The host AI plans, explains, and verifies. Kay writes files, runs tests, and executes implementation work.
Host AI = Brain
Kay = Hands
kay exec; do not confuse host Codex planning work with delegated Kay implementation work.kay exec; Cursor's sessionStart hook binds SIDEKICK_SESSION_ID before activation.The stop workflow lives canonically in skills/kay-stop/SKILL.md.
Kay readiness is checked when delegation starts for the current session. SessionStart does not update or repair the Kay runtime; if the health check fails, guide the user through the Kay setup or login path below.
Before delegating, verify the runtime is available:
for candidate in kay code coder; do
if command -v "$candidate" >/dev/null 2>&1 \
&& "$candidate" --version 2>/dev/null | grep -qiE '^kay([[:space:]]|$)' \
&& "$candidate" exec --help >/dev/null 2>&1; then
KAY_RUNTIME="$candidate"
break
fi
done
test -n "${KAY_RUNTIME:-}" || { echo "No Kay-compatible runtime found"; exit 1; }
Then verify Kay config:
$CODE_HOME/config.toml defaults to ~/.kay/config.toml~/.code/config.toml and ~/.codex/config.toml are compatibility-onlyocg or opencode-go -> OpenCode Go routingxiaomi -> Xiaomi routingopencode-go. SIDEKICK_KAY_PROVIDER and SIDEKICK_KAY_MODEL_PROVIDER remain supported as environment overrides.opencode-go keeps the existing task-based routing:
mimo-v2.5-promimo-v2.5minimax-m2.7deepseek-v4-flashxiaomi uses provider-specific routing:
mimo-v2.5mimo-v2.5-proIf login is missing, guide the user to:
kay login --provider opencode-go --with-api-key
For Xiaomi-backed sessions, use:
kay login --provider xiaomi --with-api-key
and configure Xiaomi's OpenAI-compatible base URL plus API key in Kay before launching.
If kay is unavailable, install or repair Kay. The code and coder names are compatibility aliases only. The codex binary name is reserved for the real OpenAI Codex CLI.
Create the current-session Kay marker before delegating so Sidekick hooks can enforce direct-edit denial, inject --full-auto, surface bounded redacted Kay output with [KAY] and [KAY-SUMMARY] markers, and maintain .kay/conversations.idx.
Provider argument handling:
xiaomi, set SIDEKICK_KAY_PROVIDER_ARG=xiaomi before running the activation block.ocg or opencode-go, set SIDEKICK_KAY_PROVIDER_ARG=ocg before running the activation block.SIDEKICK_KAY_PROVIDER_ARG unset and use the default OpenCode Go routing.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 Kay 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 Kay mode"; exit 1; }
KAY_PROVIDER_INPUT="${SIDEKICK_KAY_PROVIDER_ARG:-${SIDEKICK_KAY_PROVIDER:-${SIDEKICK_KAY_MODEL_PROVIDER:-opencode-go}}}"
case "${KAY_PROVIDER_INPUT}" in
""|ocg|opencode-go)
KAY_PROVIDER="opencode-go"
;;
xiaomi)
KAY_PROVIDER="xiaomi"
;;
*)
echo "Unsupported Kay provider: ${KAY_PROVIDER_INPUT}. Use ocg or xiaomi."; exit 1
;;
esac
KAY_STATE_ROOT="${HOME}/.kay"
CODEX_STATE_ROOT="${HOME}/.codex"
mkdir -p "${KAY_STATE_ROOT}/sessions/${SIDEKICK_SESSION}" \
"${SIDEKICK_HOST_HOME}/sessions/${SIDEKICK_SESSION}" \
"${HOME}/.sidekick/sessions/${SIDEKICK_SESSION}"
rm -f "${CODEX_STATE_ROOT}/sessions/${SIDEKICK_SESSION}/.codex-delegation-active"
printf '%s\n' "kay" > "${HOME}/.sidekick/sessions/${SIDEKICK_SESSION}/active-sidekick"
printf '%s\n' "${KAY_PROVIDER}" > "${HOME}/.sidekick/sessions/${SIDEKICK_SESSION}/kay-provider"
: > "${KAY_STATE_ROOT}/sessions/${SIDEKICK_SESSION}/.kay-delegation-active"
Kay and Codex are mutually exclusive per host session. Kay activation clears any current-session Codex marker and writes active-sidekick=kay, so the Codex hook becomes a no-op before Kay commands start.
Confirm: "Kay sidekick mode activated for this session using <provider>. Delegating implementation work to Kay."
To stop: /sidekick:kay-stop
Child runtime command used after Kay mode is active:
kay exec --full-auto "<task description>"
Compatibility aliases (code, codex, coder) accept the same arguments when an older environment only exposes them.
Sidekick injects the selected provider and task-specific model automatically when Kay mode is active. Do not hand-add -c model_provider=... or -c model=... 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 sessionskay 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.
npx claudepluginhub alo-exp/sidekick --plugin sidekickGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.