Delegation Workflow

The complete flow for delegating a coding task through Kay or Codex — from current-session readiness through runtime routing, host verification, retry, and deactivation. If you need the task-first docs map, read Start Here first.

Working across runtimes? Keep Audience, Glossary, and Compatibility handy while you read the workflow.

Step 1 — Activate Codex

1

Run /sidekick:codex-delegate

Type /sidekick:codex-delegate in the host. Claude and Codex hosts both use the canonical skills/codex-delegate/SKILL.md workflow, with rendered host copies generated from the same source.

2

Health check

The host verifies that the real OpenAI Codex CLI is available, is not Kay's compatibility alias, and supports codex exec --ask-for-approval. Any failure halts activation with a specific repair path.

3

Create session state

The host creates the Codex marker under .codex/sessions/<session>, prepares the host session directory, and ensures the project-local .codex/conversations.idx audit ledger can be written.

4

Confirm activation

The host clears any Kay marker, writes active-sidekick=codex, then confirms Codex sidekick mode. The hook layer routes implementation work to Codex until you run /sidekick:codex-stop.

Health check failing? See Troubleshooting → Health Check Failures for step-by-step fixes. The most common causes are a missing Codex CLI, an unauthenticated CLI, or a Kay compatibility alias being resolved as codex.

Kay Workflow

Kay uses its native automation flow. Sidekick keeps the runtime packaged, exposes the delegate/stop skills for host pickers, and preserves a project-local Kay audit ledger. Claude Code and Codex both activate Kay mode through /sidekick:kay-delegate; active Kay mode launches Kay as a child execution runtime through kay exec while the host remains in the planning and verification role.

1

Verify Kay runtime

Run kay --version and kay exec --help. If Kay provider login is missing, run kay login --provider opencode-go --with-api-key.

2

Activate Kay mode

Run /sidekick:kay-delegate, /sidekick:kay-delegate xiaomi, or /sidekick:kay-delegate ocg, then give the host the task to delegate. Activation clears any Codex marker and writes active-sidekick=kay. The hook surfaces bounded, redacted output with [KAY].

3

Review the summary

The Kay progress surface emits compact [KAY-SUMMARY] context when a STATUS block appears and preserves lookup metadata in .kay/conversations.idx. Review changed files, test output, and the final task summary before continuing.

Step 2 — Run the Child Runtime

When you describe a task, the host converts it into a focused sidekick prompt and delegates through the active runtime:

runtime commands
Kay: kay exec "<task description>" Codex: codex exec -m gpt-5.4-mini -c model_reasoning_effort=xhigh --sandbox workspace-write --ask-for-approval never "<task description>"
The host writes this for you. You describe what you need in plain language. The host includes the relevant files, constraints, and success criteria, while Sidekick manages the runtime flags.

Step 3 — Monitor Sidekick Output

The host streams bounded sidekick output and checks whether the child runtime completed the requested work:

  • Error signalError:, Failed:, fatal:, or non-zero exit
  • Wrong output — success criteria not satisfied or changed files do not match the request
  • Stall — repeated output without meaningful progress

If no failure signal is detected, the host still performs the verification pass in Step 4 before reporting success.

Step 4 — Host Verification

Every sidekick result is verified against the original prompt and surrounding repository behavior:

L1

Inspect

The host checks the diff, touched files, signatures, imports, config, and assumptions.

L2

Run evidence

The host runs the smallest meaningful tests, lint, build, type checks, or runtime checks.

L3

Classify failures

Failures are classified as missed requirement, integration error, regression, wrong logic, syntax error, wrong file, unverified assumption, knowledge gap, misunderstood task, incomplete trial, API failure, or external execution error.

Step 5 — Output Review

The host presents the result only after verification evidence supports it. Review the changed files, assumptions, and command output before accepting the work.

  • Files changed — every file created, modified, or deleted
  • Assumptions — anything the sidekick inferred that was not explicit
  • Verification — exact commands run and their result
  • Residual risk — anything not covered by automated checks

If something needs adjustment, describe the change in plain language. The host relaunches the active sidekick with focused correction context; there is no need to re-activate.

Always review assumptions. If the sidekick guessed a wrong path, API, env var, or test framework, correct it immediately. The host should verify the correction before continuing.

Step 6 — Recovery on Failure

If host verification finds a failure, the host relaunches or guides the active sidekick. It includes the original task, failure code, evidence, relevant files, constraints, and exact success criteria.

Recovery prompt includes

  • The original task prompt and success criteria
  • Observed evidence from diff, logs, and verification commands
  • Failure taxonomy code or codes
  • Relevant files and examples
  • Constraints that forbid the wrong location or approach

The host repeats verify → relaunch until the result satisfies the original task and no taxonomy failure remains.

Step 7 — Deactivate (optional)

Delegation mode persists for the entire session. You can delegate as many tasks as needed without re-running activation. To return to direct host behavior, stop the active sidekick:

/sidekick:kay-stop /sidekick:codex-stop

This removes the current-session marker and clears active-sidekick when it still points at the stopped sidekick. The project audit ledger is preserved.

You don't have to deactivate between tasks. Sidekick mode is designed to stay active for a full working session. Deactivate before switching sidekicks or returning to direct host implementation.