run

A command for running a limited, repeatable coding loop with several inspect, edit, and test cycles. It also provides setup checks, a demonstration mode, time-style limits, and resumable approval pauses.

In plain words
What is it for?
Starting an autonomous or Claude-Code-style loop, checking the environment with `--doctor`, running the safe demo with `--demo`, or resuming a paused run.
Why use it?
It helps handle tasks that need multiple rounds of work while keeping the run bounded and making approval points explicit.

Command

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 commands/silupanda/codex-agent-loop/run
Clone the repo
git clone --depth 1 https://github.com/SiluPanda/codex-agent-loop
Per session 27 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 728 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00027 $0.00728
Opus 5 $0.00014 $0.00364
Sonnet 5 $0.00005 $0.00146
Haiku 4.5 $0.00003 $0.00073

Measured yesterday against content hash 690a0cb7e7f1, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

run scanned grade A with 0 findings 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 yesterday.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/run.md · 82 lines

How it starts

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

/agent-loop:run

This command definition is included for Codex builds that surface plugin-defined slash commands. If /agent-loop:run is unrecognized in your Codex build, use $agent-loop instead.

This plugin command is namespaced by plugin id, so invoke it as:

/agent-loop:run ...

Run the local Codex Agent Loop runner at:

~/.codex/plugins/agent-loop/scripts/agent_loop.py

When to use

  • The user explicitly asks for a loop, autonomous run, or Claude-Code-style persistence.
  • The task likely needs multiple inspect/edit/test cycles.
  • You want a bounded run with a turn cap and resumable approval pauses.

Arguments

The user invoked this command with: $ARGUMENTS

Workflow

  1. Treat $ARGUMENTS as CLI flags plus the task text.
  2. If --resume is present, run the script with that resume path.
  3. Only add --approve-pending after the user explicitly approves the paused action.
  4. If --doctor is present, run the environment check and summarize the result.
  5. If --demo is present, run the safe onboarding demo.
  6. Approval modes in human terms:
    • on-write = safe
    • never = hands-off
    • always = review-everything
  7. If the first positional token looks like 10m, 1h, or 5t, treat it as a shorthand budget:
    • m = minutes
    • h = hours
    • t = turns
  8. Run:
python3 ~/.codex/plugins/agent-loop/scripts/agent_loop.py $ARGUMENTS
  1. If the runner pauses for approval:
    • summarize the pending command or patch
    • show the saved state path
    • ask whether to resume with --approve-pending
  2. If the runner completes, report:
  • stop reason
  • backend
  • turns used
  • files changed
  • verification commands
  • final answer
  1. Do not claim any command or patch executed unless the runner output shows it.

Notes:

  • Agent Loop is bounded; it should stop when the task is complete or when it hits a budget/pause/error.
  • In fallback mode, a stop reason like completed_via_fallback means the run completed through codex exec; it is not an error.

Read the full file on GitHub · 82 lines

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. yesterday First seen · 82 lines · 0 tokens per session scan A 690a0cb7e7f1

Subscribe to this mod's changes

run is a command published in the GitHub repository SiluPanda/codex-agent-loop (4 stars, last pushed 4mo ago), licensed MIT. It adds 27 tokens to every session and 728 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.