codex-sub-agentsUse OpenAI Codex CLI for coding tasks. Triggers: codex, code review, fix CI, refactor code, implement feature, coding agent, gpt-5-codex. Enables Clawdbot to delegate coding work to Codex CLI as a subagent or direct tool.
Install via ClawdBot CLI:
clawdbot install adamsardo/codex-sub-agentsUse OpenAI Codex CLI (codex) for coding tasks including code review, refactoring, bug fixes, CI repairs, and feature implementation. Codex CLI runs locally on your machine with full filesystem access.
Codex CLI requires ChatGPT Plus/Pro/Business/Enterprise subscription.
# Install
npm i -g @openai/codex
# Authenticate (opens browser for OAuth)
codex login
# Or use API key
printenv OPENAI_API_KEY | codex login --with-api-key
# Verify auth
codex login status
codex # Launch interactive terminal UI
codex "explain this codebase" # Start with a prompt
codex --cd ~/projects/myapp # Set working directory
codex exec "fix the CI failure" # Run and exit
codex exec --full-auto "add input validation" # Auto-approve workspace writes
codex exec --json "list all API endpoints" # JSON output for parsing
codex exec -i screenshot.png "match this design" # With image input
codex resume # Pick from recent sessions
codex resume --last # Continue most recent
codex resume <SESSION_ID> # Resume specific session
| Command | Purpose |
|---------|---------|
| /model | Switch model (gpt-5-codex, gpt-5) |
| /approvals | Set approval mode (Auto, Read Only, Full Access) |
| /review | Code review against branch, uncommitted changes, or specific commit |
| /diff | Show Git diff including untracked files |
| /compact | Summarize conversation to free context |
| /init | Generate AGENTS.md scaffold |
| /status | Show session config and token usage |
| /undo | Revert most recent turn |
| /new | Start fresh conversation |
| /mcp | List configured MCP tools |
| /mention | Attach file to conversation |
| Mode | Behavior |
|------|----------|
| Auto (default) | Read/edit/run commands in workspace; asks for outside access |
| Read Only | Browse files only; requires approval for changes |
| Full Access | Full machine access including network (use sparingly) |
| Flag | Purpose |
|------|---------|
| --model, -m | Override model (gpt-5-codex, gpt-5) |
| --cd, -C | Set working directory |
| --add-dir | Add additional writable roots |
| --image, -i | Attach image(s) to prompt |
| --full-auto | Workspace write + approve on failure |
| --sandbox | read-only, workspace-write, danger-full-access |
| --json | Output newline-delimited JSON |
| --search | Enable web search tool |
Call Codex from Clawdbot's exec tool for coding tasks:
# In Clawdbot session
exec codex exec --full-auto --cd ~/projects/medreport "fix the TypeScript errors in src/components"
Spawn a coding subagent that uses Codex:
// In agents.defaults or per-agent config
{
agents: {
list: [
{
id: "coder",
workspace: "~/clawd-coder",
model: "openai-codex/gpt-5.2", // Uses Codex auth
tools: {
allow: ["exec", "read", "write", "edit", "apply_patch", "process"]
}
}
]
}
}
Configure Codex as a text-only fallback:
{
agents: {
defaults: {
cliBackends: {
"codex-cli": {
command: "codex",
args: ["exec", "--full-auto"],
output: "text",
sessionArg: null // Codex manages its own sessions
}
}
}
}
}
Run Codex as an MCP server for other agents:
codex mcp-server # Exposes Codex tools via stdio MCP
Use your ChatGPT Pro subscription via the openai-codex provider:
{
agents: {
defaults: {
model: { primary: "openai-codex/gpt-5.2" },
models: {
"openai-codex/gpt-5.2": { alias: "Codex" },
"anthropic/claude-opus-4-5": { alias: "Opus" }
}
}
}
}
Auth syncs automatically from ~/.codex/auth.json to Clawdbot's auth profiles.
# Interactive review
codex
/review # Choose: branch, uncommitted, or specific commit
# Non-interactive
codex exec "review the changes in this PR against main branch"
# Work across monorepo packages
codex --cd apps/frontend --add-dir ../backend --add-dir ../shared
# Or in TUI
codex --cd ~/projects/myapp --add-dir ~/projects/shared-lib
Create reusable prompts in ~/.codex/prompts/:
<!-- ~/.codex/prompts/pr.md -->
---
description: Prepare and open a draft PR
argument-hint: [BRANCH=<name>] [TITLE="<title>"]
---
Create branch `dev/$BRANCH` if specified.
Stage and commit changes with a clear message.
Open a draft PR with title $TITLE or auto-generate one.
Invoke: /prompts:pr BRANCH=feature-auth TITLE="Add OAuth flow"
Add MCP servers to extend Codex:
# Add stdio server
codex mcp add github -- npx @anthropic/mcp-server-github
# Add HTTP server
codex mcp add docs --url https://mcp.deepwiki.com/mcp
# List configured
codex mcp list
Enable in ~/.codex/config.toml:
[features]
web_search_request = true
[sandbox_workspace_write]
network_access = true
Then Codex can search for current docs, APIs, etc.
/init to create AGENTS.md with repo-specific instructions/review before commits for AI code review/approvals appropriately — Auto for trusted repos, Read Only for exploration--add-dir for monorepos instead of danger-full-accesscodex exec --full-auto "The CI is failing on the lint step. Fix all ESLint errors."
codex exec --cd src/components "Refactor UserProfile.tsx to use React Query instead of useEffect for data fetching"
codex exec -i spec.png --cd ~/projects/app "Implement this feature based on the design spec"
codex exec "Review the diff between main and feature/auth branch. Focus on security issues."
| Issue | Solution |
|-------|----------|
| Auth fails | Run codex logout then codex login |
| Commands blocked | Check /approvals, may need --full-auto |
| Out of context | Use /compact to summarize |
| Wrong directory | Use --cd flag or check /status |
| Model unavailable | Verify subscription tier supports model |
Generated Mar 1, 2026
A financial services company uses Codex CLI to refactor outdated monolithic codebases into modular microservices, improving maintainability and reducing technical debt. The tool analyzes code, suggests architectural changes, and implements them with approval workflows, ensuring compliance with security standards.
A SaaS startup leverages Codex CLI to automatically diagnose and fix CI failures, such as broken builds or flaky tests, by analyzing logs and code changes. It also optimizes pipeline configurations for faster deployments, reducing downtime and developer intervention.
A healthcare software development team integrates Codex CLI into their Git workflow to perform automated code reviews before commits, catching bugs, security vulnerabilities, and style inconsistencies. This ensures regulatory compliance and improves code quality across distributed teams.
A marketing agency uses Codex CLI to quickly implement new features or design changes in web applications based on client feedback. By attaching image inputs and using interactive prompts, developers can match designs and iterate faster during prototyping phases.
An enterprise with complex monorepos employs Codex CLI to explore and document codebases across multiple directories, generating explanations and AGENTS.md scaffolds. This aids onboarding new developers and maintaining up-to-date technical documentation.
Offer Codex CLI as a premium tool with tiered subscriptions (e.g., individual, team, enterprise) based on usage limits, advanced features like MCP integration, and priority support. Revenue comes from monthly or annual fees, targeting developers and tech companies seeking productivity gains.
Provide consulting services to help businesses integrate Codex CLI into their existing workflows, such as setting up custom slash commands, configuring MCP servers, and training teams. Revenue is generated through project-based contracts and ongoing support retainers.
License Codex CLI as a white-label tool for development agencies to rebrand and offer to their clients as part of custom software solutions. Revenue comes from licensing fees and partnerships, enabling agencies to enhance their service offerings with AI-powered coding assistance.
💬 Integration Tip
Start by integrating Codex CLI as a direct exec tool in Clawdbot for simple coding tasks, then gradually explore subagent delegation for more complex workflows to leverage its full capabilities.
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
Provides a 7-step debugging protocol plus language-specific commands to systematically identify, verify, and fix software bugs across multiple environments.
A comprehensive skill for using the Cursor CLI agent for various software engineering tasks (updated for 2026 features, includes tmux automation guide).
Write, run, and manage unit, integration, and E2E tests across TypeScript, Python, and Swift using recommended frameworks.
Control and operate Opencode via slash commands. Use this skill to manage sessions, select models, switch agents (plan/build), and coordinate coding through Opencode.
Coding style memory that adapts to your preferences, conventions, and patterns for consistent coding.