codex-worker
Orchestrates multiple Codex CLI agents in parallel using tmux sessions to speed up large development tasks.
Install
mkdir -p .claude/skills/codex-worker && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4553" && unzip -o skill.zip -d .claude/skills/codex-worker && rm skill.zipInstalls to .claude/skills/codex-worker
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
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.Key capabilities
- →Spawn multiple parallel Codex CLI agents
- →Manage isolated git worktrees for each task
- →Orchestrate parallel execution via tmux sessions
- →Perform batch triage and multi-file refactors
- →Support interactive multi-turn dialogue
How it works
It creates separate git worktrees for each task and launches interactive Codex CLI instances within isolated tmux sessions to enable concurrent processing.
Inputs & outputs
When to use codex-worker
- →Batch triage issues
- →Parallelize refactoring modules
- →Fix lint errors across multiple packages
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:
| Format | Example | |
|---|---|---|
| Task name | <type>-<number>-<desc> | issue-836-prompt-dollar-sign |
| Git branch | same as task name | issue-836-prompt-dollar-sign |
| Worktree dir | <project>.worktrees/<task> | kimi-cli.worktrees/issue-836-prompt-dollar-sign |
| tmux session | codex-worker-<task> | codex-worker-issue-836-prompt-dollar-sign |
More examples:
issue-518-mcp-config-isolationfix-share-dir-skills-pathfeat-ask-user-toolrefactor-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 {}
When not to use it
- →When the task cannot be decomposed into independent subtasks
- →When tmux or codex CLI are unavailable in the environment
Prerequisites
Limitations
- →Requires manual cleanup of tmux sessions and worktrees
- →Codex TUI requires a 5-second initialization delay before accepting input
How it compares
It replaces the built-in Task tool with full-featured, independent agents that have their own file system access and shell environments.
Compared to similar skills
codex-worker side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| codex-worker (this skill) | 1 | 6mo | Review | Advanced |
| cursor-local-dev-loop | 3 | 27d | Review | Beginner |
| agent-challenges | 1 | 6mo | No flags | Intermediate |
| sensei | 0 | 1mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by MoonshotAI
View all by MoonshotAI →You might also like
cursor-local-dev-loop
jeremylongshore
Optimize local development workflow with Cursor. Triggers on "cursor workflow", "cursor development loop", "cursor productivity", "cursor daily workflow". Use when working with cursor local dev loop functionality. Trigger with phrases like "cursor local dev loop", "cursor loop", "cursor".
agent-challenges
ruvnet
Agent skill for challenges - invoke with $agent-challenges
sensei
Azure
**WORKFLOW SKILL** — Iteratively improve skill frontmatter compliance using the Ralph loop pattern. WHEN: "run sensei", "sensei help", "improve skill", "fix frontmatter", "skill compliance", "frontmatter audit", "score skill", "check skill tokens". INVOKES: token counting tools, test runners, git co
workflow-update
nomadoor
Use when editing example_workflows JSON files or changing node schema in ways that affect sample workflows.
gsd-fast
Esteban-Marketing
Execute a trivial task inline — no subagents, no planning overhead
continue-work
papeete-consulting-lab
>