Skip to main content
Glama

codex_exec

Execute guarded coding or shell work orders with file-scope whitelists, destructive-command blocking, and JSON ACK, so automated agents can modify Codex CLI workspaces safely and verifiably.

Instructions

Execute a scoped, guarded coding or shell Work Order on Codex CLI (default model="gpt-6.2-sol", reasoning_effort="max"). Enforces real-time destructive command blocking, file-scope whitelist/blacklist verification (allowed_paths/forbidden_paths with auto-revert), spin-loop circuit breaking, lean prefix stripping, persistent workspace cache lanes, and 2-field {"ok","err"} JSON ACK.

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": {
      "task": "<task>",
      "cwd": "<cwd>"
    },
    "name": "codex_exec"
  }
}

Input Schema

NameRequiredDescriptionDefault
cwdYesAbsolute path to the target workspace directory.
laneNoNamed cache lane within cwd. Keep "default" sequentially; use distinct names for parallel workers.default
taskYesImperative Work Order specifying exact objective, target files, specifications, constraints, and verification commands.
asyncNo
modelNoCodex model slug. Defaults to "gpt-6.2-sol".gpt-6.2-sol
imagesNo
profileNoReasoning effort preset: max=max (default), heavy=high, logic=medium, worker/fast=low.max
sandboxNoworkspace-write
lean_modeNo
timeout_secNo
max_commandsNoMaximum shell commands allowed in a single work order before terminating.
service_tierNoOptional explicit Codex service_tier override.
session_modeNo"auto" (default) reuses the warm thread for (cwd, lane, model, effort, sandbox); "fresh" starts a new thread.auto
strict_guardNoEnable real-time destructive command blocking, live scope watchdog, max_commands cap, and spin-loop breaker (default true).
allowed_pathsNoStrict file or directory whitelist relative to cwd (supports prefixes like "src/" and globs like "tests/*.test.ts"). Any mutation outside allowed_paths triggers a guard violation and optional auto-revert.
fresh_sessionNoShortcut for session_mode="fresh".
writable_dirsNo
forbidden_pathsNoBlacklist of relative files, directories, or globs Codex must never modify.
reasoning_effortNoExplicit reasoning_effort override (defaults to "max").
allow_destructiveNoExplicitly allow destructive git/filesystem commands (default false).
max_files_changedNoOptional hard cap on the number of distinct files allowed to change.
auto_rotate_tokensNo
auto_revert_violationsNoAutomatically revert unauthorized file mutations in Git repositories and delete unauthorized newly created files (defaults to true when allowed_paths or forbidden_paths is provided).
kill_on_scope_violationNoImmediately terminate the worker if a live file_change event violates allowed_paths or forbidden_paths (defaults to true when strict_guard and scope paths are set).
use_silent_worker_promptNo
enforce_structured_outputNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.6/5.0
Behavior4/5

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

Because there are no annotations, the description must disclose how the tool behaves, and it does: it blocks destructive commands in real time, checks file scope against a whitelist/blacklist and reverts unauthorized changes, breaks spin loops, reuses persistent cache lanes, and returns a two-field {ok, err} JSON ACK. That last detail is especially useful given there is no output schema. It remains silent on authentication, cost or latency expectations, and failure modes outside guard violations.

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

Conciseness4/5

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

The description is remarkably compact for a 26-parameter tool, front-loading the verb and resource before a tight feature list. Some clauses, like 'lean prefix stripping' and 'spin-loop circuit breaking', are jargon-dense and could be plainer. Still, almost every clause carries distinct information, so it is efficient overall.

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

Completeness3/5

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

For a 26-parameter mutation tool with no annotations and no output schema, the description covers the safety model well but leaves much unexplained, notably how async execution works, what images and service_tier do, and the full shape of a result beyond ok/err. It is adequate to start the call, not complete enough to predict all behavior.

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

Parameters3/5

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

Schema coverage is 65%, so the schema documents most of the parameters, with a few gaps. The description adds real meaning for the safety-related parameters (allowed_paths/forbidden_paths enforcement and revert, destructive-command blocking) and restates the default model and reasoning effort. It gives no guidance for async, images, service_tier, writable_dirs, auto_rotate_tokens, lean_mode, or the silent-worker and structured-output flags. This is sufficient but incomplete, hence a 3.

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

Purpose4/5

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

The description states a specific verb and resource: executing a 'scoped, guarded coding or shell Work Order on Codex CLI', and it names the default model and reasoning effort. The purpose is unambiguous. However, it does not distinguish itself from siblings such as codex_batch_exec or codex_resume, so it cannot reach a 5.

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

Usage Guidelines3/5

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

Guidance is only implied: the Work Order wording and 'scoped' framing suggest this is the tool that runs one bounded coding or shell task in a workspace. The description never says when to choose this over codex_batch_exec, codex_resume, or the job/cancel/status tools, and it states no prerequisites or exclusions. A parenthetical such as 'for one workspace; use codex_batch_exec for multiple' would have been needed for a higher score.

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