Skip to content
Back to skills

Codex Delegate

ASecurity

Delegate a well-scoped task to the Codex CLI (GPT) running non-interactively, then review only its short final message and the git diff. Use to save Claude context tokens on exploratory or mechanical work with clear acceptance criteria (sweeping many files, repetitive edits across many files, end-to-end checks with curl/docker, digging through logs). Not for tiny edits or tasks that need decisions from the user. Usage: /codex-delegate <task description>

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 2, 2026
ai-agentsrustgobashdockerdebugginggit

Works with

  • cli

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned December 2, 2026

npx -y skills add Leen15/leen15-claude-marketplace --skill codex-delegate --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Codex Delegate?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Codex Delegate
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leen15-codex-delegate/badge)](https://www.skillsdirectory.com/skills/leen15-codex-delegate)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: codex-delegate
description: Delegate a well-scoped task to the Codex CLI (GPT) running non-interactively, then review only its short final message and the git diff. Use to save Claude context tokens on exploratory or mechanical work with clear acceptance criteria (sweeping many files, repetitive edits across many files, end-to-end checks with curl/docker, digging through logs). Not for tiny edits or tasks that need decisions from the user. Usage: /codex-delegate <task description>
---

Delegate work to **Codex CLI** (GPT) as a worker. Codex spends its own tokens on reading files, running commands and retrying; Claude only pays for writing the prompt and reading back a compact result. Claude stays responsible for the decision, the review and the final verification.

## When to delegate

Good fit (tell the user in one line that you are delegating, then do it):
- exploration with a compact answer (search many files, collect data from logs);
- mechanical edits across many files with a clear rule;
- end-to-end verification on a local stack (curl, docker, DB checks) with explicit pass/fail criteria.

Do it yourself instead when:
- the change is a few lines (prompt + review would cost as much);
- the task needs decisions or approvals from the user mid-way (Codex cannot ask);
- it touches production, real credentials or secrets.

## Pick the worker model

Choose the model from the shape of the task, not its size in files. Pass it via `CODEX_DELEGATE_ARGS`.

| Model | Use for | Avoid for |
|---|---|---|
| `gpt-6-luna` (fast, cheap) | Recon and read-only sweeps with a compact answer (find usages, collect values from logs, list files matching a rule); small scoped edits with a single clear rule; one-shot checks (run lint/tests, report result). Think "Haiku-class worker". | Anything with more than ~3 dependent steps, where step N depends on what it learned in step N-1; tasks that need to keep a plan in mind for a long time. It is very capable per step but loses track of long multi-step work. |
| `gpt-6.2-sol` (default) | Multi-step work: edits that need understanding across files, end-to-end verification with setup/check/cleanup, debugging with retries, anything with a non-trivial acceptance checklist. | Trivial lookups (wasteful). |

Rules of thumb:
- Read-only + one question + answer fits in a few lines → Luna.
- Writes code, or has setup → action → verify → cleanup → Sol.
- Unsure → Sol. A failed Luna run plus a rerun costs more than one Sol run.
- If a Luna run comes back incomplete or confused, rerun on Sol; do not retry Luna with a longer prompt.

Reasoning effort: keep the default unless the task is clearly trivial (`-c model_reasoning_effort=low`) or clearly hard (`high`).

## Step 1 — write the prompt to a file

Write the prompt in English to `${TMPDIR:-/tmp}/codex-delegate/<task-name>-prompt.txt` (create the directory). Always include:

1. **Repo and rules**: "Work in the <repo> repo. Read AGENTS.md (or CLAUDE.md) and follow it."
2. **Non-interactive**: "You are running non-interactively: you cannot ask questions. If something blocks you, stop and report it."
3. **Context you already have**: the facts Codex needs, already verified, so it does not re-investigate ("do not re-investigate").
4. **Scope**: exact files it may change; what it must not touch. If it must not fix code on failure, say "report, do not fix".
5. **Approvals, explicit and narrow**: any local writes the user approved for this task only (e.g. "create a temporary user, delete it at the end, confirm cleanup with a query"). Never give real passwords or production access: use temporary test data.
6. **Acceptance criteria**: a checklist with what evidence to show for each item.
7. **Git**: "Do not commit or push."
8. **Final message format**: "Final message (it is all the reviewer will read): under 25 lines, in <user's language>: result of each check with evidence, cleanup confirmation, files changed."

## Step 2 — run it in the background

```bash
bash "<this skill's base directory>/run.sh" "<repo_dir>" "<prompt_file>" "<task-name>"
# with an explicit model (see "Pick the worker model"):
CODEX_DELEGATE_ARGS="-m gpt-6-luna" bash "<this skill's base directory>/run.sh" ...
```

Tell the user in the same line which model you picked and why (e.g. "delegating to Codex (Luna: read-only sweep)").

Run it with the Bash tool and `run_in_background: true` (tasks take minutes). You are notified when it ends; do not poll. The script:
- runs `codex exec -C <repo> --approve-for-me -o <summary> "<prompt>" < /dev/null` (stdin must be closed, otherwise Codex hangs on "Reading additional input from stdin...");
- uses the user's Codex config for model and reasoning effort; extra flags go in `CODEX_DELEGATE_ARGS`;
- prints only: exit code, elapsed time, tokens used by Codex, Codex's final message, `git status --short`, `git diff --stat`, and the path of the full log.

## Step 3 — review (mandatory)

- Read the script output. **Do not read the full log** unless the final message is missing or something does not add up.
- Read the actual `git diff` of the changed code files (not only the stat) and check it against the scope.
- Verify side effects yourself with one cheap check (e.g. the cleanup query, a lint run, a curl) instead of trusting the summary.
- Report to the user: outcome, what you checked yourself, files changed, tokens used by Codex. Do not commit unless the user asks.

If Codex went out of scope or failed, say so plainly; fix the prompt and rerun, or do the task yourself.

Files in this skill

  • SKILL.md5.4 KB
  • run.sh1.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.