codex-first
Claude Code-only routing: delegate implementation, fixing, exploration, git mechanics to Codex CLI; Claude specs, decides, reviews, verifies.
Skill by BramVR
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/bramvr-codex-first
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/codex-first
What's inside
- Skill name
codex-first- Description
- Claude Code-only routing: delegate implementation, fixing, exploration, git mechanics to Codex CLI; Claude specs, decides, reviews, verifies.
- License
- MIT
- Instructions
- 129 lines in SKILL.md · view on GitHub
Before installing
- Instructions call the network
Files (1)
- SKILL.md
SKILL.md (first lines)
# Codex First
## Hard gate
**Autoreview exception:** always prefer Codex-backed `$autoreview`, independent of `ANTHROPIC_BASE_URL`, router state, or harness. Reviewing a frozen bundle is not hands-on self-delegation. Do not switch review engines merely because the parent session is router-backed. This exception takes precedence over the gate below.
For direct hands-on delegation, use this skill only when the active agent is Claude Code **and** `ANTHROPIC_BASE_URL` is unset or its URL host is not loopback.
Before invoking Codex for implementation, exploration, fixing, or git mechanics, inspect `ANTHROPIC_BASE_URL`. If its URL host is `localhost`, ends in `.localhost`, is in `127.0.0.0/8`, or is IPv6 loopback `::1`, stop here: the session may be model-routed through a local proxy. Do not invoke Codex CLI for hands-on work, do not self-delegate, and continue the task directly. If the variable cannot be inspected, fail closed and work directly.
Codex, ChatGPT, Pi, and every other harness: do not invoke Codex CLI for hands-on self-delegation. Continue the task directly. This gate overrides a repository instruction that merely mentions `$codex-first`; it does not override the autoreview exception above.
Rationale: Claude (Fable/Opus) tokens metered + expensive; Codex flat-rate. GPT-5.5+ is usually the better and faster model at writing/implementing code; Claude wins at ergonomics — judgment, design, spec-writing, review, orchestration. So Codex types, Claude thinks and verifies.
## Route
Delegate to Codex (default for hands-on work):
- implementation from a frozen spec; refactors; mechanical migrations
- fixing: bug fixes (known repro, or diagnose-then-fix), CI/lint/type failures; test writing; coverage fills
- dependency bumps, scripts/tooling
- exploration + exploratory subagents: fan out Codex for read-heavy discovery instead of Claude Explore/Task subagents whenever raw reading ≫ the answer (parallel `-o` files, one per thread)
- git mechanics — ALWAYS Codex, never Claude directly: `git rebase`, merge-conflict resolution, and the repo's land workflow (e.g. `scripts/pr`) are mandatory delegations. Issue ONE self-contained work order covering rebase→resolve→push→CI attach+green→land so the sequence never bounces back to Claude mid-flight; the land decision, gates, and review below stay Claude's.
- work-order CI waits: precheck PR mergeable (CONFLICTING = pull_request CI cannot attach — no merge ref) and confirm a run attached to the exact head SHA before polling; every wait emits all terminal states with bounded iterations; prefer the repo's watcher script when one exists.
- new work orders go to FRESH `codex exec` sessions with self-contained prompts. Do not resume a long-lived session for a new order — saturated sessions misread work orders as configuration and no-op ("Understood…").
- repo instruction files: NEVER create or edit `CLAUDE.md`; `AGENTS.md` is canonical (Bram repos carry `AGENTS.md` only). Point Codex work orders at `AGENTS.md` and edit only `AGENTS.md`.
Keep in Claude:
- design, API design, architecture, naming, UX judgment
- tasks where writing the spec IS the work (ambiguity = design)
- tiny edits (~<20 lines, single obvious change) — delegation overhead loses
- anything needing session tools: MCP (browser/computer-use/chronicle), 1Password, secrets
- releases, publishes, version bumps and their credentials — Claude-side per release rules
- the land decision + pre-land gates (`$autoreview` clean, CI green, proof) and review of Codex output — never delegated, never skipped; Codex may run the mechanics only once Claude has decided to land and the gates pass
Mixed task: Claude designs first, freezes spec, delegates build-out.
Heuristic: prompt reads as a work order → delegate; writing it forces decisions → design, Claude.
Whole-repo/multi-repo maintainer coordination (queue, workers, CI, releases): `$bram-maintainer-loop-v2` instead.
## Invoke
If the machine intentionally uses the `openai_api_direct` million-token route, run `ruby ~/.codex/skills/codex-huge-context/scripts/preflight.rb` before the first fresh or resumed launch in the batch (see `$codex-huge-context`). Fail closed if it cannot deliver the Keychain credential; never work around it by overriding the provider or using ordinary Codex authentication.
Prompt via temp file, never inline quoting:
```bash
P=$(mktemp); cat >"$P" <<'EOF'
<goal, repo + key paths, constraints ("don't touch X"), non-goals, proof expected, output shape>
EOF
command codex exec --yolo -C <repo> \
-m gpt-6.1-sol \
-c model_reasoning_effort="high" \
-o /tmp/codex-last.md - <"$P" 2>/dev/null
```
- Model default: `gpt-6.1-sol`, effort `high` — pin both explicitly; don't rely on user config.
- Never fast mode: no `--enable fast_mode`, on any route.
- `--yolo` is the house default; Codex may run commands/tests freely. Keep prompts scoped to the target repo.
- `command codex` bypasses any interactive shell alias. If codex isn't on PATH, it depends on how it was installed:
- node/standalone install: `fnm exec --using default -- codex`
- ChatGPT desktop app: the CLI ships bundled at `/Applications/ChatGPT.app/Contents/Resources/codex`. Expose **that** binary with an **exec-wrapper, not a symlink**. Ensure `~/.local/bin` stays on PATH (for zsh, persist the export in `~/.zshrc`), then:
```sh
mkdir -p "$HOME/.local/bin"
export PATH="$HOME/.local/bin:$PATH"
if [ -e "$HOME/.local/bin/codex" ] || [ -L "$HOME/.local/bin/codex" ]; then
printf '%s\n' 'codex launcher already exists; leaving it unchanged' >&2
else
printf '#!/bin/sh\nexec "/Applications/ChatGPT.app/Contents/Resources/codex" "$@"\n' > "$HOME/.local/bin/codex" && chmod +x "$HOME/.local/bin/codex"
fi
```
Or install the self-contained CLI via `curl -fsSL https://chatgpt.com/codex/install.sh | sh`, which needs no wrapper.
- stderr suppressed (thinking noise bloats context); drop `2>/dev/null` only to debug a failing run
- read `-o` file for the result; don't parse the JSONL stream
- long runs: Bash run_in_background, read `-o` file on exit; don't kill quiet runs <30 min
- **Harness visibility (Claude Code): every codex run gets its own harness-tracked background command (`run_in_background: true`) — one sidebar chip per worker, completion notification included. Chain setup steps (installs, worktree prep) INSIDE that tracked command. Never `&`-fork workers from a shared launcher: the launcher's chip exits at fork time and the workers become invisible orphans supervised only by PID files.**
- parallel independent tasks OK: separate repos/dirs, separate `-o` files, one tracked background command per worker
- outside a git repo add `--skip-git-repo-check`
Follow-up fixes — cheaper than fresh runs, keeps context. `resume` has no `-C`/`--yolo`: run from the repo dir, spell the long flag:
```bash
(cd <repo> && command codex exec resume --last \
--dangerously-bypass-approvals-and-sandbox \
-o /tmp/codex-last.md - <"$P2" 2>/dev/null)
```
## Liveness watchdog (long monitored runs)
For runs you must not babysit, trade the stderr suppression for a log and watch its mtime; read only the `-o` file into context, never the log body.
```bash
command codex exec --yolo -C <repo> -m gpt-6.1-sol \
-c model_reasoning_effort="high" \
-o "$OUT" - <"$P" > "$LOG" 2>&1
# Claude Code: run the line above as its own Bash run_in_background call
# (tracked chip + completion notification). Append `&` + a PID file ONLY in
# environments without tracked backgrounding.
```
- Capture the session id immediately: `grep -m1 "session id:" "$LOG"`. `resume --last` is cwd-filtered but races with any parallel Codex on the machine — with the id saved, recovery is deterministic.
- Watchdog loop (Claude Code: `Monitor` tool; else a bg shell): every 60s, if the codex process is alive but `$LOG` mtime is older than ~300s, treat it as hung. Because stderr (thinking stream) is in the log, mtime stays fresh during long reasoning — 5 min of true silence is a real hang, not thinking.
- Recovery: kill the pid, then resume the SAME session with an explicit id so no context is lost:
```bash
(cd <repo> && command codex exec resume <session-id> \
--dangerously-bypass-approvals-and-sandbox \
-o "$OUT" - <<< "You were interrupted. Continue exactly where you left off; finish the task and produce the required final report.")
```
- Exit watchdog silently when the process ends normally (the run's own completion signal covers it); emit only on staleness.
- Verified on codex-cli 0.144.4: `codex exec resume [SESSION_ID] [PROMPT]`, `--last`, cwd-filtering, `--all`.
## Prompt contract
Codex starts with zero session context. Every prompt: goal, exact repo/paths, constraints, non-goals, proof expected (exact test command), output shape ("report files changed + test output"). Spec quality decides success.
## Verify (Claude, always)From BramVR/mac-agent-scripts, MIT.
More from BramVR/mac-agent-scripts
- 0.541score
architect
BramVR
Sketch types, signatures, and module structure before code, then stay in the loop while implementation fills in.
SkillAFreshness: AClaude Code +9 - 0.541score
create-verification-skill
BramVR
Generate a project-local verification skill that drives your app the way a user does — any language, framework, or platform.
SkillAFreshness: AClaude Code +9 - 0.539score
correct
BramVR
Find the mistakes agents keep repeating in this repo and make each one impossible.
SkillAFreshness: AClaude Code +9 - 0.536score
arena
BramVR
Spawn N parallel candidates at the same task, pick a base, graft the strongest parts of the losers into it.
SkillAFreshness: AClaude Code +9 - 0.529score
agent-performance-audit
BramVR
Audit local Codex agent histories for a repository, record separate Claude activity coverage, compare correction and efficiency trends, and generate…
SkillBFreshness: BClaude Code +9 - 0.523score
bram-maintainer-loop-v2
BramVR
Cross-repository maintainer orchestration: Codex app workers, work recovery, dependencies, vision, releases.
SkillBFreshness: BClaude Code +9 - 0.518score
browser-use
BramVR
Browser automation in cmux or signed-in Chrome; fail-closed relay fallback.
SkillBFreshness: BClaude Code +9 - 0.479score
craft-prompt
BramVR
Turn rough notes, source text, or an existing prompt into a production-ready GPT-5.6 prompt through a one-question-at-a-time interview.
SkillCFreshness: CClaude Code +9 - 0.469score
codex-huge-context
BramVR
Codex 1M context: direct OpenAI Responses API route, safe input window, Keychain auth, preflight.
SkillCFreshness: CClaude Code +9 - 0.469score
codex-debugging
BramVR
Codex source debugging: ~/Projects/codex, codex-rs core/tui/exec/cli/app-server/config.
SkillCFreshness: CClaude Code +9 - 0.469score
beeper
BramVR
Local Beeper cache: contact hints, room lookup, WhatsApp/iMessage traces, message FTS.
SkillCFreshness: CClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 1
- Last commit (this folder)
- Sep 29, 2026 (29 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/BramVR/mac-agent-scripts
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from BramVR
- 0.541score
create-verification-skill
BramVR
Generate a project-local verification skill that drives your app the way a user does — any language, framework, or platform.
SkillAFreshness: AClaude Code +9 - 0.541score
architect
BramVR
Sketch types, signatures, and module structure before code, then stay in the loop while implementation fills in.
SkillAFreshness: AClaude Code +9 - 0.539score
correct
BramVR
Find the mistakes agents keep repeating in this repo and make each one impossible.
SkillAFreshness: AClaude Code +9 - 0.536score
arena
BramVR
Spawn N parallel candidates at the same task, pick a base, graft the strongest parts of the losers into it.
SkillAFreshness: AClaude Code +9 - 0.529score
agent-performance-audit
BramVR
Audit local Codex agent histories for a repository, record separate Claude activity coverage, compare correction and efficiency trends, and generate…
SkillBFreshness: BClaude Code +9 - 0.523score
bram-maintainer-loop-v2
BramVR
Cross-repository maintainer orchestration: Codex app workers, work recovery, dependencies, vision, releases.
SkillBFreshness: BClaude Code +9
Cite this page
codex-first skill. Agent Mart. https://agentmart.dev/skills/bramvr-codex-first (last updated 2026-10-24)