Codex Cli logo

Codex Cli

Community
sugarforever
codex-cli

Use when an agent needs to delegate a task to the OpenAI Codex CLI from another agent environment such as Claude Code, OpenClaw, or similar. Covers checking whether Codex CLI is installed, running one-off Codex prompts with `codex exec`, resuming sessions, collecting outputs, attaching images or files as input with `-i`/stdin, and handling Codex image generation including finding and reporting generated image file paths.

Overview

Publishersugarforever
Repository01coder-agent-skills
Skill namecodex-cli
Stars
139
Forks
37
Bundled files
1
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by sugarforever on GitHub. Read the source before you install it.

Installation

Install the Codex Cli AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/sugarforever/01coder-agent-skills/tree/main/skills/codex-cli
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/sugarforever/01coder-agent-skills.git /tmp/01coder-agent-skills
mkdir -p .claude/skills
cp -r /tmp/01coder-agent-skills/skills/codex-cli .claude/skills/codex-cli
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Codex Cli in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Codex Cli on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Codex Cli is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Codex CLI

Use this skill when the user asks this agent to talk to Codex, consult Codex, delegate a coding/review/research task to Codex CLI, or ask Codex to generate an image.

The core interface is:

bash
codex exec "prompt"

For automation, prefer non-interactive codex exec over interactive codex.

First Check

Before using Codex CLI, verify it is available:

bash
command -v codex
codex --version
codex exec --help

If codex is missing, tell the user Codex CLI is not available in this environment and stop. Do not simulate a Codex response.

If codex exec --help is available, use it as the source of truth for the installed CLI flags. Codex CLI changes over time.

One-Off Task Workflow

Use this for normal delegation:

bash
codex exec -C "$PWD" -s read-only "Review this repository and identify likely bugs"

For tasks that may edit files, use the sandbox the user requested or the host agent allows:

bash
codex exec -C "$PWD" -s workspace-write "Implement the requested change"

For a response file:

bash
codex exec -C "$PWD" -o /tmp/codex-last-message.md "Summarize this project"

For machine-readable events:

bash
codex exec -C "$PWD" --json -o /tmp/codex-last-message.md "Analyze this project"

If the prompt is long, pass it via stdin:

bash
codex exec -C "$PWD" - < /tmp/prompt.txt

When using shell commands from another agent, avoid dangerous flags unless the user explicitly asked for them. Prefer read-only for review, planning, critique, image generation, and analysis.

Prompt Shape

For non-trivial tasks, shape the delegated prompt with OpenAI's Codex best-practices structure:

text
Goal:
Context:
Constraints:
Done when:

Keep the prompt scoped to one task. For complex implementation work, ask Codex for a plan first in read-only mode, then run a separate write task after the plan is accepted.

Session Resume

Codex emits a session id in normal startup output and in JSONL events as thread.started.

To resume:

bash
codex exec resume <session-id> "Continue from the previous task"

If the installed CLI supports a different resume syntax, follow codex exec resume --help.

Image and File Input

Codex cannot browse or read image files on its own. To let Codex see an image, attach it explicitly with -i/--image. This is the input side; image generation (below) is the output side.

Attach a single image:

bash
codex exec -C "$PWD" -s read-only -i screenshot.png "Explain the error shown here"

Attach multiple images. Both forms work — comma-separated or a repeated flag:

bash
codex exec -i before.png,after.png "Compare these two UI states"
codex exec -i mock1.png -i mock2.png "Which layout is closer to the spec?"

Best practices:

  • Put -i flags before the prompt text.
  • Use common raster formats: PNG (best for screenshots/UI, lossless) or JPEG. Keep images reasonably small; very large images slow the request.
  • Combine images with a clear text instruction — the image alone is rarely enough context.
  • For visual review/analysis, pair with -s read-only so Codex inspects but does not edit.

For non-image files there is no attach flag. Two options:

  • Let Codex read the file from the workspace: point it at the directory with -C "$PWD" and name the file in the prompt ("Review src/auth.ts"). Use this for files already in the repo.
  • Pipe file contents via stdin. With a prompt also present, stdin is appended to the prompt as a <stdin> block:
bash
codex exec -C "$PWD" "Summarize the attached log" < /tmp/build.log

Image Generation Workflow

Codex can generate images through its built-in image generation tool when asked through codex exec.

Example:

bash
codex exec "Generate a black banana image with aspect ratio 16:9"

Important behavior:

  • Built-in image generation commonly saves files under $CODEX_HOME/generated_images/<codex-session-id>/.
  • If CODEX_HOME is unset, use ~/.codex/generated_images/<codex-session-id>/.
  • Codex may not print the path in its final response.
  • The agent using this skill must proactively locate and report generated image paths after image generation.
  • The PNG metadata may not expose the exact image model. Do not claim a specific backend model unless Codex output, CLI logs, or metadata clearly show it.

Finding Generated Images

After any Codex image-generation request, find the image path before replying.

First extract the Codex session id from output if available. It may look like:

text
session id: 019e8cbf-5054-7131-9440-ee592f0d8a17

Then check:

bash
ls -l "${CODEX_HOME:-$HOME/.codex}/generated_images/<session-id>"

If the session id is not known, list recent generated images:

bash
find "${CODEX_HOME:-$HOME/.codex}/generated_images" -type f -maxdepth 3 -print

When possible, sort by modification time:

bash
find "${CODEX_HOME:-$HOME/.codex}/generated_images" -type f -maxdepth 3 -print0 \
  | xargs -0 ls -lt

If the user requested a project asset, copy or move the selected image into the project after generation if permissions allow. Never leave a project-referenced asset only under $CODEX_HOME/generated_images.

Verifying Aspect Ratio

If the user requested a specific aspect ratio, verify dimensions before answering.

On macOS:

bash
sips -g pixelWidth -g pixelHeight /path/to/image.png

Portable fallback:

bash
file /path/to/image.png

Report actual dimensions and whether they match approximately or exactly. Many generated images use nearest integer dimensions, so a 16:9 request may produce dimensions like 1672 x 941, which is effectively 16:9 but not mathematically exact.

Reporting Results

For normal Codex tasks, report:

  • command used, summarized if long
  • Codex status or final answer
  • any files Codex changed, if known
  • any limitations, errors, or missing permissions

For image tasks, always report:

  • generated image path
  • actual dimensions if available
  • whether the path is in $CODEX_HOME or copied into the project
  • whether the exact image model is known or not

Example response:

text
Codex generated the image here:
/Users/me/.codex/generated_images/019e.../ig_....png

Actual size: 1672 x 941, effectively 16:9.
The output does not expose the exact image backend model, so I cannot verify whether it was gpt-image-2.

Failure Handling

If Codex exits with network, auth, or model refresh errors, report the error plainly and include the relevant stderr lines.

If Codex claims it generated an image but no image file exists under $CODEX_HOME/generated_images, say so explicitly and do not invent a path.

If the host agent cannot read $CODEX_HOME/generated_images, ask the user to grant access or run:

bash
find "${CODEX_HOME:-$HOME/.codex}/generated_images" -type f -maxdepth 3 -print0 | xargs -0 ls -lt

Safety Notes

Do not pass secrets to Codex unless the user explicitly asks and understands the risk.

Use read-only for consultation. Use workspace-write only when Codex is expected to edit files. Avoid danger-full-access unless the user explicitly requested it in a controlled environment.

Do not claim Codex performed work solely from its final message. When file changes matter, inspect the filesystem or Git diff after the run.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Codex Cli AI skill do?

Use when an agent needs to delegate a task to the OpenAI Codex CLI from another agent environment such as Claude Code, OpenClaw, or similar. Covers checking whether Codex CLI is installed, running one-off Codex prompts with `codex exec`, resuming sessions, collecting outputs, attaching images or files as input with `-i`/stdin, and handling Codex image generation including finding and reporting generated image file paths.

Why use Codex Cli on TypingMind?

Because you install it once and use it with any model. Codex Cli is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Codex Cli in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/sugarforever/01coder-agent-skills/tree/main/skills/codex-cli. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Codex Cli?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Codex Cli?

As many as you like. As long as a model supports skills, you can use Codex Cli with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Codex Cli AI skill free?

Yes. It is published on GitHub by sugarforever under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇