Skip to main content
Glama

codex_run

Delegates coding, research, refactoring, or audit tasks to the local OpenAI Codex CLI, with async fan-out, model/reasoning presets, and session IDs for follow-ups.

Instructions

Delegate a coding, research, refactoring, or audit task to the local OpenAI Codex CLI (codex exec). Supports anchor project grouping (group + task_name), concurrent async fan-out (wait_seconds: 0), GPT model/reasoning presets (fast, balanced, deep, ultra), and returns session_id for follow-ups via codex_resume.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "prompt": "<prompt>",
      "cwd": "<cwd>"
    },
    "name": "codex_run"
  }
}

Input Schema

NameRequiredDescriptionDefault
cwdYesAbsolute path to the target working directory.
groupNoParent task group name in the orchestrator ledger & live console.默认任务组
modelNoOptional GPT model slug override (e.g., "gpt-6.2-astra", "gpt-6.2-sol").
imagesNoOptional image file paths to attach to the prompt.
presetNoQuick model + reasoning preset from routing.json.
promptYesDetailed task specification / instructions for Codex.
sandboxNoSandbox policy for Codex shell commands.workspace-write
add_dirsNoAdditional writable directories alongside cwd.
worktreeNoRun inside a new managed Git worktree (forces use_anchor_project=false).
ephemeralNoDo not persist session files to disk (disables resume).
task_nameNoNumbered child agent label (e.g., "01-库结构盘点").
wait_secondsNoSeconds to wait before returning running status with job_id (0..600). Use 0 for async fan-out.
approval_policyNoApproval policy (use "never" for non-interactive execution).never
reasoning_effortNoOptional reasoning effort override.
use_anchor_projectNoAnchor Codex session metadata in CODEX_ANCHOR_DIR while granting --add-dir access to cwd.
skip_git_repo_checkNoAllow running outside a Git repository.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.1.0

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden for a 16-parameter tool that defaults to `workspace-write` and can run `danger-full-access` shell commands. It does disclose some behavior (async fan-out, session persistence and that `ephemeral` disables resume), but it never warns about filesystem mutation risk, permission requirements, or what a running/queued result looks like beyond `session_id`.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two dense sentences, front-loaded with the core action and followed by the capability menu and the resume handoff. Every clause carries information; nothing is redundant or padded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex 16-parameter delegation tool the description covers purpose, key modes, and the follow-up path, and no output schema exists to relieve it of return-value duty beyond `session_id`. The remaining gap is risk and return-state disclosure for sandbox and approval settings, which keeps it short of full completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3; the description rises above it by explaining cross-parameter semantics such as anchor project grouping via `group` + `task_name`, the meaning of the four presets, and the `wait_seconds: 0` fan-out idiom. It adds interpretive value over the raw field descriptions rather than merely restating them.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names the specific verb and resource (delegate a coding/research/refactoring/audit task to the local Codex CLI via `codex exec`) and explicitly distinguishes itself from the follow-up sibling `codex_resume`. An agent can tell what this tool is for without reading the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives concrete routing guidance: use `wait_seconds: 0` for concurrent async fan-out, and use `codex_resume` for follow-ups on the returned `session_id`. It also explains when the preset shortcuts apply. What it lacks is explicit guidance on when to prefer `codex_review` or other siblings over this general delegation tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.