codex-first-executor

A routing policy for choosing between Claude and Codex as external coding agents based on the task. It also defines retry, timeout, and fallback behavior when an external call fails.

In plain words
What is it for?
Route security-sensitive changes, repetitive patches, visual frontend work, analysis, cross-file refactors, standalone algorithms, and documentation to the suggested executor.
Why use it?
It avoids sending every task to the same agent when risk, project context, or repetition call for a different choice. Failed or unavailable calls can follow a defined fallback path.

Skill for Claude CodeCodex

Part of the compound-engineering plugin — 40 skills, 4 commands, 2 hooks shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/jerrylalala/compound-engineering/codex-first-executor
Any agent
npx skills add Jerrylalala/compound-engineering --skill codex-first-executor
Clone the repo
git clone --depth 1 https://github.com/Jerrylalala/compound-engineering

Made for: Claude Code, Codex.

Or install compound-engineering, the plugin that ships this one along with the rest of its 40 skills, 4 commands, 2 hooks.

Per session 59 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,268 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00059 $0.01268
Opus 5 $0.00030 $0.00634
Sonnet 5 $0.00012 $0.00254
Haiku 4.5 $0.00006 $0.00127

Measured 3d ago against content hash 49ce6a58f0dd, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

codex-first-executor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/compound-engineering/skills-custom/codex-first-executor/SKILL.md · 134 lines

How it starts

The opening of the file, as written. The whole thing — 134 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Codex-first External Executor — 任务特征路由

Codex 洞察(P7,P5+P8 合并):路由策略和执行器可靠性不可分。 这不是「Codex 优先」品牌路由,而是「按任务特征选择最合适的执行器」。


前置条件

必须先通过 Executor Capability Gate 检查(skills-custom/executor-capability-gate)再执行路由决策。


任务特征路由矩阵(Dispatch Policy Matrix)

任务特征 推荐执行器 理由
高风险改动(auth、payment、migration、production data) Claude 主做 + ce:review 需要项目上下文和谨慎判断
大量机械 patch(格式化、重命名、批量模板替换) Codex 重复性操作,Codex 擅长
前端视觉任务(UI 组件、CSS) Claude + design contract + UI Review Contract 需要视觉理解
纯分析/代码审查 Codex 交叉审核([C] 参数) 补充视角,有价值
跨文件重构(需要项目上下文) Claude 主做 上下文依赖强
独立算法实现(无上下文依赖) Codex(可选) 相对独立,Codex 可胜任
文档写作/注释 Codex(可选) 相对机械

执行器可靠性管理

重试策略

调用 Codex
    ├─ 成功(exit 0)→ 使用结果
    ├─ 失败(exit 1, 网络错误)→ 等待 30s,重试 1 次
    ├─ 重试失败 → 降级到 Claude 执行
    └─ Rate limit (429) → 等待 retry-after header 时间,或降级

超时管理

# Codex 调用超时(180s)
timeout 180 codex -- "$TASK_PROMPT"
EXIT_CODE=$?
if [ $EXIT_CODE -eq 124 ]; then
  echo "Codex 超时,降级到 Claude 执行"
elif [ $EXIT_CODE -eq 0 ]; then
  # 成功调用后记录时间(供 executor-capability-gate Check 4 Rate Limit 使用)
  date +%s > ~/.codex/.last_call
fi

降级路径

Codex → Claude (降级)
    触发条件:CLI 不可用 / 超时 / rate limit / 任务不适合
    降级后:记录降级原因到 state.md(如有 Task Bundle)

Codex 审核模式([C] 参数)

当用户使用 ce:review [C]ce:brainstorm [C] 时,Codex 作为交叉审核视角,不是主执行器:

Claude 执行主任务
    ↓
Claude 生成结果/审核报告
    ↓
Codex 独立审核(仅审核,不修改代码)
    ↓
多模型仲裁(Review Contract 定义的权重)
    ├─ Claude trust_score: 1.0
    └─ Codex trust_score: 0.85
    ↓
合并结论(多方一致 → confidence: high)

Gemini 策略

架构澄清:Gemini 有两种使用模式,定位不同:

模式 状态 入口
审核视角(交叉审核,不执行代码) ✅ 已激活 ce:review [G]ce:brainstorm [G]
执行器路由(Gemini 作为主执行引擎) ⏸ 暂缓

当前决策

  • [G] 审核参数已可用:Gemini 作为独立视角交叉审核 PR 或方案,结果整合进 review/brainstorm 报告
  • Gemini 作为主线执行器(类似 Codex 替代 Claude 执行任务)暂不实现
  • 本 Executor 路由矩阵目前只路由 Claude ↔ Codex,不包含 Gemini 执行路径

Read the full file on GitHub · 134 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 134 lines · 59 tokens per session scan A 49ce6a58f0dd

Subscribe to this mod's changes

codex-first-executor is a skill published in the GitHub repository Jerrylalala/compound-engineering (5 stars, last pushed 3mo ago), licensed MIT. It adds 59 tokens to every session and 1,268 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens

chat-perf

Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.

microsoft/vscode · 51 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens