Codex Goal Loopのロゴ

Codex Goal Loop

コミュニティ
matyasstoch
codex-goal-loop

OpenAI Codexの`/goal`機能(計画→実行→テスト→レビュー→反復を繰り返す、継続的な自己チェック型エージェントループ)について説明し、効果的な指示の作成を支援します。ユーザーがCodexの`/goal`や「goal loop」に言及した場合、長時間実行する自律型Codex処理の開始方法を知りたい場合、goalプロンプトの書き方を尋ねた場合、または1段落のgoal指示文の作成を希望した場合に使用してください。

Add to TypingMind

概要

公開者matyasstoch
リポジトリdavid-skills
スキル名codex-goal-loop
スター
61
フォーク
11
同梱ファイル
指示のみ
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    matyasstochがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Codex Goal Loop」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/matyasstoch/david-skills/tree/main/skills/codex-goal-loop
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/matyasstoch/david-skills.git /tmp/david-skills
mkdir -p .claude/skills
cp -r /tmp/david-skills/skills/codex-goal-loop .claude/skills/codex-goal-loop
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでCodex Goal Loopを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にCodex Goal Loopを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Codex Goal Loopは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込む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.

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.

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 4-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."

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

Writing a one-paragraph goal (the core deliverable)

When the user wants a quick one-paragraph /goal instruction, produce a single dense paragraph that packs the 4-part contract into flowing prose. Template:

/goal <one-sentence objective>. Read first: <files/PLAN.md/issue>. Constraints: <what not to change, libs, conventions>. Validate after each change with: <exact command>. Work in checkpoints and log progress briefly. Stop when: <verifiable condition>, OR when further changes require human/product input.

Example (migration)

/goal 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 after each change with: pytest -q. 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)

/goal 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 with: pytest --cov=src/auth --cov-report=term-missing. 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.
  • 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 dense /goal paragraph using the 4-part contract. Paste that into Codex. Order-of-magnitude better runs.

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.

Always launch on a branch or worktree. Never on main.

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 reset --hard HEAD 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.

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>

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.

よくある質問

AIスキル「Codex Goal Loop」では何ができますか?

OpenAI Codexの`/goal`機能(計画→実行→テスト→レビュー→反復を繰り返す、継続的な自己チェック型エージェントループ)について説明し、効果的な指示の作成を支援します。ユーザーがCodexの`/goal`や「goal loop」に言及した場合、長時間実行する自律型Codex処理の開始方法を知りたい場合、goalプロンプトの書き方を尋ねた場合、または1段落のgoal指示文の作成を希望した場合に使用してください。

TypingMindでCodex Goal Loopを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Codex Goal Loopはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにCodex Goal Loopをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/matyasstoch/david-skills/tree/main/skills/codex-goal-loopを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Codex Goal Loopを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Codex Goal Loopで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもCodex Goal Loopを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Codex Goal Loop」は無料ですか?

matyasstochがGitHubで公開しています。ライセンス条件はリポジトリでご確認ください。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇