codex

A guide for using the Codex command-line program to make focused code changes or run automation. It describes non-interactive execution, structured JSON output, and the setup needed for authentication.

In plain words
What is it for?
Use it for quick fixes, targeted edits, and automated coding tasks. It covers installing Codex, checking its setup, logging in, and running it in fully automatic mode.
Why use it?
It helps another agent invoke Codex consistently when nobody is available to approve commands at a terminal. It also explains the flags needed for automated runs.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/markus-global/markus/codex
Any agent
npx skills add markus-global/markus --skill codex
Clone the repo
git clone --depth 1 https://github.com/markus-global/markus

Made for: Claude Code, Codex.

Per session 22 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,996 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00022 $0.01996
Opus 5 $0.00011 $0.00998
Sonnet 5 $0.00004 $0.00399
Haiku 4.5 $0.00002 $0.00200

Measured 2d ago against content hash b43b4c5025e5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

codex scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

**Note:** `OPENAI_BASE_URL` is deprecated and no longer supported by Codex CLI. Custom endpoint configuration should use `~/.codex/config.toml`.
templates/skills/codex/SKILL.md · 218 lines

How it starts

The opening of the file, as written. The whole thing — 218 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Codex

Codex (codex binary) is OpenAI's agentic coding CLI. Markus invokes it via invoke_coding_tool({ tool: "codex", ... }). Use it for fast, focused changes where speed and non-interactive automation matter more than deep multi-turn exploration.

Installation

npm install -g @openai/codex
codex --version

Verify with markus doctor. Requires authentication via codex login or CODEX_API_KEY env var for non-interactive mode.

How Markus Invokes Codex

Markus runs Codex in fully automated, non-interactive mode:

codex exec --full-auto --json --skip-git-repo-check "<prompt>"
Flag Purpose
exec --full-auto Non-interactive mode — auto-approves all file edits and shell commands
--json Emits JSONL events for structured progress parsing
--skip-git-repo-check Allows running outside strict git repo requirements

Additional args can be configured via CodingToolConfig.defaultArgs.

Full-Auto Approval Mode

In a Markus agent session, there is no human at the terminal to approve Codex actions. The exec --full-auto mode is essential:

  • Codex can edit files and run commands without prompting
  • All actions happen within the sandbox (see below)
  • If Codex would normally ask "Allow this edit?", it proceeds automatically

Note: OPENAI_BASE_URL is deprecated and no longer supported by Codex CLI. Custom endpoint configuration should use ~/.codex/config.toml.

Implication: Write precise prompts with clear scope boundaries. Codex will act autonomously on whatever the prompt authorizes.

AGENTS.md Context File

Codex reads project-level instruction files to understand repo conventions. The standard file is AGENTS.md in the repository root — a markdown file describing:

  • Project structure and architecture
  • Coding conventions and patterns
  • Test commands and CI expectations
  • Areas that are off-limits or require caution

If the repo already has AGENTS.md, Codex uses it automatically. Ensure it stays accurate for the project.

Read the full file on GitHub · 218 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 218 lines · 22 tokens per session scan B b43b4c5025e5

Subscribe to this mod's changes

codex is a skill published in the GitHub repository markus-global/markus (157 stars, last pushed 5d ago), licensed Apache-2.0. It adds 22 tokens to every session and 1,996 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.