codex-worker

0
0
Source

Spawn and manage multiple Codex CLI agents via tmux to work on tasks in parallel. Use whenever a task can be decomposed into independent subtasks (e.g. batch triage, parallel fixes, multi-file refactors). When codex and tmux are available, prefer this over the built-in Task tool for parallelism.

Install

mkdir -p .claude/skills/codex-worker && curl -L -o skill.zip "https://mcp.directory/api/skills/download/4553" && unzip -o skill.zip -d .claude/skills/codex-worker && rm skill.zip

Installs to .claude/skills/codex-worker

About this skill

codex-worker

Orchestrate multiple Codex CLI (codex) agents running in parallel, each in its own git worktree and tmux session.

When to use: Whenever you identify that a task can be split into independent subtasks — don't wait for the user to ask for parallelism. Examples:

  • User says "triage all open issues updated in the last 7 days" → fetch the issue list, then spawn one codex worker per issue.
  • User says "refactor these 5 modules" → one worker per module.
  • User says "fix lint errors across packages" → one worker per package.

Replaces Task tool: When codex and tmux are available in the environment, use codex workers instead of the built-in Task (subagent) tool. Codex workers are full-featured agents with their own file system access, shell, and isolated worktree — far more capable than subagents.

Preflight check

command -v codex && codex login status && command -v tmux

All three must succeed. The project must be a git repository.

Naming convention

Git branch and worktree directory share a task name:

<type>-<issue number (optional)>-<short description>

The tmux session adds a codex-worker- prefix so workers are easy to filter:

FormatExample
Task name<type>-<number>-<desc>issue-836-prompt-dollar-sign
Git branchsame as task nameissue-836-prompt-dollar-sign
Worktree dir<project>.worktrees/<task>kimi-cli.worktrees/issue-836-prompt-dollar-sign
tmux sessioncodex-worker-<task>codex-worker-issue-836-prompt-dollar-sign

More examples:

  • issue-518-mcp-config-isolation
  • fix-share-dir-skills-path
  • feat-ask-user-tool
  • refactor-jinja-templates

List only codex workers: tmux ls | grep ^codex-worker-

Usage

Prefer tmux + interactive codex for all tasks. It supports multi-turn dialogue, the user can tmux attach to inspect or intervene, and you can send follow-up prompts from outside.

Spawn a worker

NAME="issue-836-prompt-dollar-sign"        # task name
SESSION="codex-worker-$NAME"               # tmux session name
PROJECT_DIR="$(pwd)"
WORKTREE_DIR="$PROJECT_DIR.worktrees"

# 1. Create worktree (skip if exists)
git worktree add "$WORKTREE_DIR/$NAME" -b "$NAME" main 2>/dev/null

# 2. Launch interactive codex inside tmux
tmux new-session -d -s "$SESSION" -x 200 -y 50 \
  "cd $WORKTREE_DIR/$NAME && codex --dangerously-bypass-approvals-and-sandbox"

Send a prompt

The Codex TUI needs time to initialize before it accepts input. After launching a session, wait at least 5 seconds before sending a prompt. Then send the text followed by Enter. If the prompt stays in the input field without being submitted, send an additional Enter.

sleep 5  # wait for Codex TUI to initialize
tmux send-keys -t "$SESSION" "Your prompt here" Enter
# If it doesn't submit, send another Enter:
# tmux send-keys -t "$SESSION" Enter

Peek at output

tmux capture-pane -t "$SESSION" -p | tail -30

Attach for hands-on interaction

tmux attach -t "$SESSION"

Parallel fan-out

TASKS=(
  "issue-518-mcp-config-isolation|Triage #518: MCP config 被子 agent 继承的隔离问题。分析根因,给出修复方案。"
  "issue-836-prompt-dollar-sign|Triage #836: prompt 包含 $ 时启动静默失败。分析根因,给出修复方案。"
)

PROJECT_DIR="$(pwd)"
WORKTREE_DIR="$PROJECT_DIR.worktrees"

for entry in "${TASKS[@]}"; do
  NAME="${entry%%|*}"
  PROMPT="${entry#*|}"
  SESSION="codex-worker-$NAME"
  git worktree add "$WORKTREE_DIR/$NAME" -b "$NAME" main 2>/dev/null
  tmux new-session -d -s "$SESSION" -x 200 -y 50 \
    "cd $WORKTREE_DIR/$NAME && codex --dangerously-bypass-approvals-and-sandbox"
  sleep 5  # wait for Codex TUI to fully initialize
  tmux send-keys -t "$SESSION" "$PROMPT" Enter
done

Fallback: codex exec

Only use codex exec when you explicitly don't need follow-up (e.g. CI, pure analysis with -o output). It does not support multi-turn dialogue.

codex exec --dangerously-bypass-approvals-and-sandbox \
  -o "/tmp/$NAME-result.md" \
  "Your prompt here"

Lifecycle management

List active workers:

tmux ls | grep ^codex-worker-

Kill a finished worker:

tmux kill-session -t "codex-worker-$NAME"

Clean up worktree after merging:

tmux kill-session -t "codex-worker-$NAME" 2>/dev/null
git worktree remove "$WORKTREE_DIR/$NAME"
git branch -d "$NAME"

Batch cleanup of dead sessions:

tmux list-sessions -F '#{session_name}:#{pane_dead}' \
  | grep ':1$' \
  | cut -d: -f1 \
  | xargs -I{} tmux kill-session -t {}

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

643969

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

591705

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

318398

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

339397

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

451339

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

304231

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.