Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Codex Cli Runtime?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/fundryi-codex-cli-runtime)
---
name: codex-cli-runtime
description: Internal helper contract for calling the codex-companion runtime from Claude Code
user-invocable: false
---
# Companion Runtime
Use this skill only inside the `codex:codex-rescue` subagent.
Primary helper. Flags go on the command line; the handoff text goes through a quoted heredoc, so quotes, backslashes and line breaks reach Codex unchanged:
```bash
node "${CLAUDE_PLUGIN_ROOT}/scripts/codex-companion.mjs" task --write <<'CODEX_HANDOFF'
<handoff text>
CODEX_HANDOFF
```
Execution rules:
- The rescue subagent is a forwarder, not an orchestrator. Its only job is to invoke `task` once and return that stdout unchanged (plus the `result --wait` follow-ups below for a job that is still running, never with `--background`).
- Prefer the helper over hand-rolled `git`, direct Codex CLI strings, or any other Bash activity.
- Do not call `setup`, `review`, `adversarial-review`, `status`, or `cancel`; call `result` only as `result <job-id> --wait` for the job you just started.
- Use `task` for every rescue request, including diagnosis, planning, research, and explicit fix requests.
- Do not rewrite the handoff. Main Claude wrote it with context you do not have.
- For Codex, leave `--effort` unset unless the user explicitly requests a specific effort. The helper then defaults to `xhigh`, never Codex's low built-in default. Use `max` or `ultra` only when the user asks for them.
- Leave model unset by default. Add `--model` only when the user explicitly asks for one.
- Model shortcuts: `astra` → `--model gpt-6-astra`, `sol` → `--model gpt-6.1-sol`, `terra` → `--model gpt-5.6-terra`, `luna` → `--model gpt-6-luna`, `daybreak-blue` → `--model gpt-daybreak-blue-latest`. GPT-6 Sol (`gpt-6-sol`) and the GPT-5.6 Sol and Luna models are still reachable by their full names. Daybreak Blue is the security-specialty model: sol-class reasoning with fewer restrictions on defensive security analysis. Use it for security reviews, audits, vulnerability hunting, and reversing work. Daybreak access is verification-gated per account; the helper checks availability before starting the run and fails fast with a clear message if the account has no access, so do not pre-test access yourself. (A Red variant exists but is not available here.)
- For Codex, add `--write` when the task may edit files. It only marks the job as an edit task (it turns on the `/codex:review` hint in status) and does not change permissions. Every Codex run uses the configured sandbox (`CODEX_PLUGIN_SANDBOX`, default `danger-full-access`). For read-only intent, put "do not edit files" in the handoff rules.
OpenCode tasks:
- Use OpenCode only when the request has `--engine opencode`, or the user asks for OpenCode. Otherwise use Codex.
- OpenCode 2.0 or newer is needed. With OpenCode 1.x or no OpenCode, the helper fails with a clear message; return it unchanged.
- Forward `--engine opencode` to `task`. With no `--engine`, the helper uses Codex.
- Pass `--model provider/model#variant` exactly as supplied. Do not apply Codex model shortcuts. With no model, OpenCode uses the user's configured default.
- If the user supplies `--effort` and the model has no `#`, the helper adds `#<effort>` to the model. If a variant is already present, or no model is supplied, effort has no effect. There is no default effort for OpenCode.
- Every OpenCode run uses the `build` agent with `--standalone --auto` for full permission, like Codex's `danger-full-access` default. Forward `--write` for edits as a job label only. It enables the review hint and does not change permissions. For read-only intent, put "do not edit files" in the handoff rules.
- `--fast` has no effect on OpenCode. Codex sandbox settings do not apply to OpenCode.
- Resume uses the same task flags and default continue prompt. OpenCode uses only `ses_` session ids and only previous OpenCode jobs. Codex threads cannot be passed to OpenCode.
- Review commands, the stop review gate, `limits` and `transfer` support only Codex. `setup` also checks viewer integrations and manages the OpenCode plugin with consent. Use `--engine` only on `task` and `task-resume-candidate`.
Command selection:
- Use exactly one `task` invocation per rescue handoff, followed by `result <job-id> --wait` calls only if the job is still running when `task` returns.
- If the forwarded request includes `--resume-thread <id>`, pass it to `task` as-is and do not add `--resume-last`.
- `--background` is forwarded to `task` as-is, and the `task` output (the job id) is returned at once: no `result --wait` follows. `--wait` is a no-op alias for the default and must be stripped. Neither is ever part of the natural-language task text.
- `--cwd <folder>` is a routing flag: pass it to `task` and to every `result --wait` call, and strip it from the task text. Quote the folder in Bash (`--cwd "<folder>"`) so spaces and backslashes survive. It runs the job in that folder. On hosts where Claude cannot change folder (CloudCLI runs every session in one fixed folder), it is how a handoff targets another project. The job's result still reaches this folder's prompt hook, and `status` and `result` find its id here without `--cwd`.
- If the forwarded request includes `--fast` or the user asks for fast mode / priority processing, strip that phrasing from the task text and add `--fast` to the `task` call. Never add `--fast` unless explicitly requested.
- If the forwarded request includes `--model`, normalize the shortcuts above only for Codex. Pass an OpenCode model unchanged to `task`.
- If the forwarded request includes `--effort`, pass it through to `task`.
- If the forwarded request includes `--resume`, strip that token from the task text and add `--resume-last`.
- If the forwarded request includes `--fresh`, strip that token from the task text and do not add `--resume-last`.
- `--resume`: always use `task --resume-last`, even if the request text is ambiguous.
- `--fresh`: always use a fresh `task` run, even if the request sounds like a follow-up.
- Codex `--effort`: accepted values are `low`, `medium`, `high`, `xhigh`, `max`, `ultra`. `max` needs a GPT-6.1, GPT-6, GPT-5.6, or Daybreak model; `ultra` needs `gpt-6.1-sol`, `gpt-6-astra`, `gpt-6-sol`, `gpt-5.6-sol`, `gpt-5.6-terra`, or `gpt-daybreak-blue-latest`. The Luna models stop at `max`.
- `task --resume-last`: internal helper for "keep going", "resume", "apply the top fix", or "dig deeper" after a previous rescue run.
Safety rules:
- For both engines, `--write` is a label only. It does not change permissions. For read-only intent, put "do not edit files" in the handoff rules.
- Preserve the user's task text as-is apart from stripping routing flags.
- Do not inspect the repository, read files, grep, monitor progress, poll status, cancel jobs, summarize output, or do any follow-up work of your own.
- Return the stdout of the `task` command exactly as-is, or of the last `result --wait` call once the job has ended.
- If the Bash call fails or Codex cannot be invoked, return the error output unchanged.
- If the companion prints a handback (job still running) and the request has no `--background`, run `result <job-id> --wait --timeout-ms 540000` (plus `--cwd <folder>` when the request has it) in the foreground (Bash timeout 600000) and repeat until the job ends. Never use a background Bash task.