codex-goal-loop

Writes structured goal instructions for OpenAI Codex's persistent /goal agent loop.

60|11|Updated Jun 15, 2026
One-click install
npx skills add https://github.com/matyasstoch/david-skills --skill codex-goal-loop-matyasstoch
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: codex-goal-loop
Source: https://github.com/matyasstoch/david-skills/tree/main/skills/codex-goal-loop
Command: npx skills add https://github.com/matyasstoch/david-skills --skill codex-goal-loop-matyasstoch

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Long-running autonomous Codex runs fail when prompts are vague, lack stop conditions, or drift without verification. This Skill turns a task into a precise /goal contract so Codex can loop plan-act-test-review until a verifiable condition is met. ## Core Features & Use Cases - 4-Part Goal Contract: Structures every goal with an objective, constraints, an exact validation command, and a verifiable stop condition. - One-Paragraph Goal Drafting: Produces dense, ready-to-paste /goal instructions with templates for migrations, coverage lifts, and TDD builds. - Lifecycle Operations: Covers launching in the Codex TUI, pausing, resuming, replacing drifting goals, and troubleshooting common failures. - Use Case: You want Codex to migrate a project from Pydantic v1 to v2 overnight. Use this Skill to draft a goal that pins the validation command (pytest -q), forbids public API changes, and stops when the suite passes with zero deprecation warnings. ## Quick Start Ask the assistant to write a one-paragraph Codex /goal instruction for your task, including the validation command and stop condition.

Frequently Asked Questions about codex-goal-loop

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a good Codex /goal prompt?▼

A good /goal prompt packs four parts into one paragraph: a single-sentence objective, explicit constraints on what must not change, the exact shell command that validates progress, and a verifiable stop condition. Use literal paths and commands, and forbid scope creep explicitly.

What is the Codex /goal command and how does it work?▼

/goal is a slash command in Codex v0.128.0+ that turns a prompt into a persistent agent looping plan, act, test, review, and iterate. When a turn ends without meeting the goal, Codex auto-continues instead of waiting for input, stopping only at the stop condition, a pause, or budget limits.

Does Codex /goal work with API key authentication?▼

No, /goal requires ChatGPT authentication with a Plus, Pro, Business, Edu, or Enterprise subscription. API-key auth does not work, and Pro is the realistic minimum for long runs due to token budget demands.

When should I not use the Codex /goal loop?▼

Avoid /goal for exploratory work, vague improvement requests, tasks without a verifiable definition of done, anything touching production credentials, or destructive shared-infrastructure operations. It fits only mechanical tasks over 30 minutes with a testable stop condition.

Why is /goal missing from my Codex slash commands?▼

The command requires Codex v0.128.0 or later, so run codex update first. Also confirm goals = true is set in ~/.codex/config.toml, fully restart the Codex app, and note the command is singular /goal, not /goals.

How do I fix a Codex goal that is drifting off track?▼

For minor drift, type a correction in the composer, which auto-pauses and folds it in. For a loose objective, run /goal pause, review status, then replace the contract with /goal followed by a tighter version rather than piling on instructions.