Source profileQuality 93/100

adriannoes/awesome-agentic-ai/cursor-claude-codex/skills/david-ondrej/agent-orchestration/codex-goal-loop/SKILL.md

codex-goal-loop

Explain and write effective instructions for OpenAI Codex's `/goal` feature — the persistent self-checking agent loop (plan → act → test → review → iterate). Use when the user mentions Codex `/goal`, "goal loop", "Ralph loop", wants to kick off a long-running autonomous Codex run, asks how to write a goal prompt, or wants a one-paragraph goal instruction drafted.

Source repository stars
51
Declared platforms
1
Static risk flags
1
Last source update
2026-08-22
Source checked
2026-08-25

Decision brief

What it does: where it fits

Explain and write effective instructions for OpenAI Codex's `/goal` feature — the persistent self-checking agent loop (plan → act → test → review → iterate).

Best for

  • Task is 30 min of mechanical work.
  • There's a verifiable stop condition (tests pass, coverage hit, eval ≥ X, build green).
  • Repo is agent-ready (working build, decent tests, AGENTS.md present).

Not for

  • Tasks that require unconfirmed production actions or broad system permissions.
  • Environments where the pinned source and install steps cannot be inspected.

Compatibility matrix

Platform support, with evidence labels

PlatformStatusEvidenceWhat to check
CodexDeclaredSource recordInstall path and trigger
Claude CodeNot declaredNo explicit evidencePortability before use
CursorNot declaredNo explicit evidencePortability before use
Gemini CLINot declaredNo explicit evidencePortability before use
Open the compatibility checker

Installation

Inspect first. Install second.

The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

Source-detected install commandSource
npx skills add https://github.com/adriannoes/awesome-agentic-ai --skill "cursor-claude-codex/skills/david-ondrej/agent-orchestration/codex-goal-loop"
Safe inspection promptEditorial

Inspect the Agent Skill "codex-goal-loop" from https://github.com/adriannoes/awesome-agentic-ai/blob/7f71af8164e8f5a775253417aa405b5d9d063faf/cursor-claude-codex/skills/david-ondrej/agent-orchestration/codex-goal-loop/SKILL.md at commit 7f71af8164e8f5a775253417aa405b5d9d063faf. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

Workflow

What the source asks the agent to do

  1. 01

    What /goal is

    /goal is a slash command in Codex v0.128.0+ (April 30, 2026) that turns a Codex prompt into a persistent agent looping plan → act → test → review → iterate until a stop condition is met, the user pauses, or the token budget runs out. Internally called the "Ralph loop."

    /goal is a slash command in Codex v0.128.0+ (April 30, 2026) that turns a Codex prompt into a persistent agent looping plan → act → test → review → iterate until a stop condition is met, the user pauses, or the token bu…Key difference from a normal prompt: when a turn ends but the goal isn't met, Codex auto-continues instead of waiting for input.Lifecycle states: pursuing, paused, achieved, unmet, budget-limited.
  2. 02

    Requirements

    Codex CLI/app/extension v0.128.0+

    Codex CLI/app/extension v0.128.0+goals = true in /.codex/config.toml (or codex features enable goals)ChatGPT auth (Plus/Pro/Business/Edu/Enterprise) — API-key auth does not work. Pro is the realistic minimum for long runs.
  3. 03

    When to use it

    Use only when all three are true: 1. Task is 30 min of mechanical work. 2. There's a verifiable stop condition (tests pass, coverage hit, eval ≥ X, build green). 3. Repo is agent-ready (working build, decent tests, AGENTS.md present).

    Task is 30 min of mechanical work.There's a verifiable stop condition (tests pass, coverage hit, eval ≥ X, build green).Repo is agent-ready (working build, decent tests, AGENTS.md present).
  4. 04

    The 5-part contract (every goal needs this)

    1. Objective — one sentence, one concrete outcome. 2. Constraints — what must NOT change (public API, files, libs, conventions). 3. Validation command — the exact shell command that proves progress (pytest -q, pnpm test, etc.). 4. Stop condition — verifiable: "Stop when X passes…

    Objective — one sentence, one concrete outcome.Constraints — what must NOT change (public API, files, libs, conventions).Validation command — the exact shell command that proves progress (pytest -q, pnpm test, etc.).
  5. 05

    Writing a goal (the core deliverable)

    When the user wants a quick /goal instruction, produce a structured markdown block with one line per contract item (proper newlines, not flowing prose). Do not prefix the output with /goal — David adds the slash command himself in the composer. Emit only the contract body. Templ…

    One objective, one stop condition. Not a backlog.Documentation is mandatory. Every /goal prompt must include a single sentence committing the agent to concise, targeted docs — new .md files or focused updates to existing docs.Never instruct the agent to create new ADRs — ADRs require David's explicit approval, so goal prompts must not pre-approve or encourage them.

Permission review

Static risk signals and limitations

Reads files

low · line 91

The documentation asks the agent to read local files, directories, or repositories.

Hand-written goals under-specify. Ask a second AI session (Claude with the codebase loaded, ChatGPT with project connected, or a separate Codex thread in the same dir) to: (1) inspect the codebase, (2) surface hidden assumptions/constraints

Reads files

low · line 97

The documentation asks the agent to read local files, directories, or repositories.

Codex can now write and set its own goal natively (the `create_goal` tool). Instead of crafting the contract yourself, give it your high-level intent and tell it to set the goal: "Inspect this repo, then write yourself a `/goal` with a veri

Evidence record

Why each signal appears

EvidenceSourceComputedTestedEditorial
SignalValueEvidence typeMeaning
Quality score93/100ComputedDocumentation, specificity, maintenance, and trust rules
Repository stars51SourceRepository attention, not individual Skill quality
Compatibility1 platformsSourceDeclared in the catalog source record
Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

Pinned source

Provenance and original SKILL.md

Repository
adriannoes/awesome-agentic-ai
Skill path
cursor-claude-codex/skills/david-ondrej/agent-orchestration/codex-goal-loop/SKILL.md
Commit
7f71af8164e8f5a775253417aa405b5d9d063faf
License
MIT
Collected
2026-08-25
Default branch
main
View the original SKILL.md

Codex /goal Loop

What /goal is

/goal is a slash command in Codex v0.128.0+ (April 30, 2026) that turns a Codex prompt into a persistent agent looping plan → act → test → review → iterate until a stop condition is met, the user pauses, or the token budget runs out. Internally called the "Ralph loop."

Key difference from a normal prompt: when a turn ends but the goal isn't met, Codex auto-continues instead of waiting for input.

Lifecycle states: pursuing, paused, achieved, unmet, budget-limited.

When monitoring a running /goal, every check should include a one-line update to David: what Codex is doing and whether it is on track. Keep it extremely concise.

Not: a budget command, a safety boundary, "run forever", or a replacement for /plan. It's a contract enforcer with a verification loop.

Requirements

  • Codex CLI/app/extension v0.128.0+
  • goals = true in ~/.codex/config.toml (or codex features enable goals)
  • ChatGPT auth (Plus/Pro/Business/Edu/Enterprise) — API-key auth does not work. Pro is the realistic minimum for long runs.

When to use it

Use only when all three are true:

  1. Task is >30 min of mechanical work.
  2. There's a verifiable stop condition (tests pass, coverage hit, eval ≥ X, build green).
  3. Repo is agent-ready (working build, decent tests, AGENTS.md present).

Fits: migrations, coverage lifts, TDD feature builds, refactors with contract tests, prompt/eval optimization, deploy retry loops, bug-repro-then-fix.

Bad fits: exploratory work, vague "improve this", anything without a "done" definition, prod credentials, destructive shared-infra ops.

The 5-part contract (every goal needs this)

  1. Objective — one sentence, one concrete outcome.
  2. Constraints — what must NOT change (public API, files, libs, conventions).
  3. Validation command — the exact shell command that proves progress (pytest -q, pnpm test, etc.).
  4. Stop condition — verifiable: "Stop when X passes" OR "when further changes need human/product input."
  5. Documentation — one sentence instructing the agent to write concise, targeted docs for every change, either creating new .md files or updating existing ones.

Plus: tell Codex what to read first, ask it to work in checkpoints with a short progress log.

Writing a goal (the core deliverable)

When the user wants a quick /goal instruction, produce a structured markdown block with one line per contract item (proper newlines, not flowing prose). Do not prefix the output with /goal — David adds the slash command himself in the composer. Emit only the contract body. Template:

**Objective:** <one-sentence objective>
**Read first:** <files/PLAN.md/issue>
**Constraints:** <what not to change, libs, conventions>
**Validate:** `<exact command>` after each change
**Document:** Write concise, targeted documentation for all changes — create new `.md` files or update existing docs as needed.
**Checkpoints:** work in checkpoints and log progress briefly
**Stop when:** <verifiable condition>, OR when further changes require human/product input

Example (migration)

**Objective:** Migrate this project from Pydantic v1 to v2.
**Read first:** pyproject.toml, src/, tests/
**Constraints:** no public API changes; keep imports backwards-compatible via shims if needed; no new dependencies
**Validate:** `pytest -q` after each change
**Checkpoints:** work in checkpoints; log progress briefly
**Stop when:** full suite passes with zero deprecation warnings, OR when a change requires architecture decisions

Example (coverage lift)

**Objective:** Raise coverage in src/auth/ from ~38% to ≥75%.
**Read first:** src/auth/, tests/auth/, AGENTS.md
**Constraints:** no new deps; mirror existing test style; do not modify production code unless strictly required for testability
**Validate:** `pytest --cov=src/auth --cov-report=term-missing`
**Checkpoints:** work in checkpoints; log coverage delta each one
**Stop when:** coverage ≥75% AND all tests pass, OR when uncovered code needs design changes

Writing rules

  • One objective, one stop condition. Not a backlog.
  • Documentation is mandatory. Every /goal prompt must include a single sentence committing the agent to concise, targeted docs — new .md files or focused updates to existing docs.
  • Never instruct the agent to create new ADRs — ADRs require David's explicit approval, so goal prompts must not pre-approve or encourage them.
  • Forbid reward-hacking explicitly: "Do not delete, skip, weaken, or narrow tests to make the goal pass." Otherwise Codex may game the stop condition.
  • 4,000-char limit on the objective. If longer, put detail in a file (PLAN.md/GOAL_BRIEF.md) and make the goal point to it — keep the goal itself compact.
  • Use literal strings for paths, commands, issue numbers — exact.
  • Forbid scope creep explicitly: "Do not refactor unrelated code. Do not add dependencies."
  • Tell Codex when to pause: "If , pause and ask before proceeding."
  • Short, vague goals burn tokens for no extra value vs. a normal prompt.

Meta-prompting trick (highest-leverage)

Hand-written goals under-specify. Ask a second AI session (Claude with the codebase loaded, ChatGPT with project connected, or a separate Codex thread in the same dir) to: (1) inspect the codebase, (2) surface hidden assumptions/constraints/edge cases, (3) emit a structured /goal markdown block using the 4-part contract. Paste that into Codex. Order-of-magnitude better runs.

Claude Code cmux note: after Claude finishes, it may prefill a predicted next user message; that draft is Claude, not David speaking.

Self-goal setting

Codex can now write and set its own goal natively (the create_goal tool). Instead of crafting the contract yourself, give it your high-level intent and tell it to set the goal: "Inspect this repo, then write yourself a /goal with a verifiable stop condition and pursue it." It's the meta-prompting trick done inline — the agent turns your intent into the contract. Still give it the same raw materials (files to read, constraints, the validation command) so the goal it writes is grounded. Add: "ask clarifying questions before committing if the intent is underspecified" — catches ambiguity up front and prevents the self-set goal from drifting.

Launching

  1. cd <repo> (goals run scoped to the working directory).
  2. Run codex (bare — opens TUI). Not codex exec "/goal ..."/goal is a TUI slash command only.
  3. Sign in with ChatGPT (not API key).
  4. Type /goal <your contract> in the composer, Enter.
  5. Walk away.

Controlling a running goal

CommandEffect
/goal (alone)Status: current checkpoint, what's verified, what remains, blockers
/goal pauseFreeze
/goal resumeUnfreeze (required in v0.129+; paused goals never auto-resume)
/goal clearKill the goal
/goal <new>Replace the current goal
Ctrl+C / any typed messageAuto-pauses; user input always wins priority

Resuming across sessions: goal state is persisted server-side. cd back into the repo, run codex, /goal for status, /goal resume.

Budget-limited state: Codex doesn't stop abruptly — it summarizes, notes what's left, saves state. /goal resume works after budget refresh or upgrade.

When a goal drifts

  • Minor drift: just type a correction in the composer (auto-pauses, folds it in, resumes).
  • Loose objective: /goal pause, read status, then /goal <tighter version> — replaces the contract. Don't pile instructions on a vague goal.
  • Bad mess: /goal clear, git status or git stash, rewrite with the meta-prompting trick, restart.

Don't let a drifting goal keep running "to see where it goes." Tokens burn, diffs compound.

Operational tips

  • Inspect status periodically with bare /goal.
  • Always review the diff before merging — long autonomy means more code to validate, not less. Human oversight becomes more critical, not optional.
  • Keep approvals/sandboxing tight; default permissions are correct.
  • First run: pick a 30-min scoped task so you learn how /goal actually stops before trusting it overnight.
  • Bake recurring policy into AGENTS.md so every goal inherits it without restating: adversarial self-review before declaring done, an extra QA pass even when tests pass, and the standard validation command. Saves repeating it in each goal paragraph.

Troubleshooting

SymptomFix
/goal missing from slash popupcodex update (need ≥0.128.0)
Flag on but command missingQuit and restart codex fully
Typed /goalsIt's singular: /goal
Doesn't activateSign out, sign back in with ChatGPT subscription (not API key)
Stopped with progress summaryBudget-limited — /goal resume after refresh, or tighten scope
/goal resume says no active goalTerminal state or cleared — start fresh with /goal <new>
Goal looks active but won't auto-continueStuck in Plan mode — plan-only work doesn't trigger continuation. Draft the plan, then switch to Goal execution

Mental model

/goal is a contract enforcer with a verification loop, not a "run forever" button. The shift: stop writing prompts, start writing specifications with stop conditions. Spend the time upfront defining "done"; the run takes care of itself.

Frequently asked questions

What to verify before installation and use

What does the codex-goal-loop source document cover?

Explain and write effective instructions for OpenAI Codex's `/goal` feature — the persistent self-checking agent loop (plan → act → test → review → iterate).

How do I install codex-goal-loop?

The source record exposes this install command: npx skills add https://github.com/adriannoes/awesome-agentic-ai --skill "cursor-claude-codex/skills/david-ondrej/agent-orchestration/codex-goal-loop". Inspect the command and pinned source before running it.

Which Agent platforms does the source record declare?

The pinned source record declares support for: codex.

Which permission-related actions were detected?

Static rules flagged read-files in the source; the page lists the matching lines and excerpts.

Alternatives

Compare before choosing

Computed 9980

vasilyu1983/AI-Agents-public

qa-testing-ios

Guides iOS testing with XCTest, XCUITest, Swift Testing, simctl, and xcresult. Use when choosing destinations, controlling flakes, or parsing test artifacts for native apps.

Computed 973,066

samber/cc-skills-golang

golang-testing

Production-ready Golang tests — table-driven tests, testify suites and mocks, parallel tests, fuzzing, fixtures, goroutine leak detection with goleak, snapshot testing, code coverage, integration tests, idiomatic test naming. Use when writing or reviewing Go tests, choosing a testing approach, setting up Go test CI, or debugging flaky/slow tests. For testify-specific APIs see `samber/cc-skills-golang@golang-stretchr-testify`; for measurement methodology see `samber/cc-skills-golang@golang-benchm

Computed 973,066

samber/cc-skills-golang

golang-troubleshooting

Troubleshoot Golang programs systematically - find and fix the root cause. Use when encountering bugs, crashes, deadlocks, or unexpected behavior in Go code. Covers debugging methodology, common Go pitfalls, test-driven debugging, pprof setup and capture, Delve debugger, race detection, GODEBUG tracing, and production debugging. Start here for any 'something is wrong' situation. Not for interpreting profiles or benchmarking (→ See `samber/cc-skills-golang@golang-benchmark` skill) or applying opt

Computed 973,066

samber/cc-skills-golang

golang-uber-fx

Golang application framework using uber-go/fx — fx.New, fx.Provide, fx.Invoke, fx.Module, fx.Lifecycle hooks, fx.Annotate (name/group/As), fx.Decorate, fx.Supply, fx.Replace, fx.WithLogger, and signal-aware Run(). Apply when using or adopting uber-go/fx, when the codebase imports `go.uber.org/fx`, or when wiring services with fx.New. For raw DI without lifecycle, see `samber/cc-skills-golang@golang-uber-dig` skill.