Agent skill

Goal Loop

by davidondrej in davidondrej/skills

Draft /goal prompts and explain persistent agent loops. An agent skill from davidondrej/skills.

MITAuto-check passedAgent Workflows

Install Goal Loop

skills CLI
$ npx skills add davidondrej/skills --skill goal-loop -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install davidondrej/skills goal-loop --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/davidondrej/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/agent-orchestration/goal-loop .claude/skills/goal-loop && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
goal-loop
GitHub stars
4.1k
Token cost
~1.9k tokens
SKILL.md length
875 words
Files
1
Skills in repo
51
Repo updated
First seen
Licence
MIT

At a glance

Draft /goal prompts and explain persistent agent loops. An agent skill from davidondrej/skills.

  • Works in 4 steps: Objective — one sentence, one concrete… → Constraints — what must NOT change… → Validation command — the exact shell… → …
  • Autonomous run setup
  • SKILL.md covers What /goal is, When to use it, The 4-part contract (every… and Writing a goal (the core…, plus 4 more sections
  • Calls pytest and pnpm

What it does

Goal Loop is an agent skill from davidondrej/skills. Draft /goal prompts and explain persistent agent loops. Use for goal or Ralph loops, autonomous run setup, monitoring, and troubleshooting.

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Agent Workflows, covering Autonomous loops. The repository describes itself as: access to david ondrej's personal agent skills. The licence is MIT.

When your agent uses it

  • Autonomous run setup
  • Troubleshooting

Example prompts

  • “/goal-loop”

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

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

What it can do on your machine

Read from SKILL.md and the folder at commit ba8e24c. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pytest
    • pnpm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use pnpm, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Goal Loop loads about 1.9k tokens when it runs. Until then it costs about 37 tokens; SKILL.md has 875 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~37
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from davidondrej/skills at commit ba8e24c, republished under its MIT licence (© davidondrej). 875 words, ~1,860 tokens.

Download SKILL.mdSave it as .claude/skills/goal-loop/SKILL.md (or your agent's skills folder).
name
goal-loop
description
Draft /goal prompts and explain persistent agent loops. Use for goal or Ralph loops, autonomous run setup, monitoring, and troubleshooting.

Agent /goal Loop

What /goal is

/goal makes an agent persist through plan → act → test → review → iterate. If a turn ends before the goal is met, it auto-continues instead of waiting for input. The loop ends at its stop condition, a user pause, or the token budget limit. It is also called the “Ralph loop”.

Before giving runtime instructions, check goal support in the installed agent and interface through its help, exposed tools, or current official documentation. Verify feature flags, authentication, and limits; do not transfer one agent's requirements to another. Lifecycle states, budgets, and pause/resume vary by runtime.

A goal enforces a contract through verification. It is not a budget command, a safety boundary, “run forever”, or a replacement for /plan.

When to use it

Use for repeated autonomous work with a verifiable stop condition: passing tests, target coverage, eval ≥ X, or a green build. For code work, establish a working build and relevant checks first. No minimum task duration applies.

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

Also specify what to read first, checkpoints, and a short progress log.

Writing a goal (the core deliverable)

When asked for a goal prompt, return only the contract body as a Markdown block, one item per line. Do not prefix it with /goal — the user adds that command in the composer.

**Objective:** <one-sentence objective>
**Read first:** <files/PLAN.md/issue>
**Constraints:** <what not to change, libs, conventions>
**Validate:** <relevant checks during work and final acceptance command>
**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:** run relevant tests during the migration; run `pytest -q` before declaring done
**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.
  • Update docs when behavior, setup, or usage needs explaining, or the task requires it.
  • Match checks to the change and final acceptance criteria; do not require the full suite after every edit.
  • Never instruct the agent to create new ADRs — ADRs require the user's explicit approval, so goal prompts must not pre-approve or encourage them.
  • Forbid reward-hacking: "Do not delete, skip, weaken, or narrow tests to make the goal pass."
  • Respect the runtime's length limit. Link longer detail in PLAN.md/GOAL_BRIEF.md.
  • Use exact paths, commands, and issue numbers.
  • Forbid scope creep explicitly: "Do not refactor unrelated code. Do not add dependencies."
  • Tell the agent when to pause: "If <condition>, pause and ask before proceeding."
Draft with another agent

Give a second AI session access to the codebase. Ask it to inspect the code, surface assumptions, constraints, and edge cases, then produce the structured 4-part contract. Paste that contract into the goal agent.

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

Self-goal setting

Use a supported goal-creation tool such as create_goal only when the user explicitly asks to set a goal. They can give high-level intent: "Inspect this repo, then write yourself a /goal with a verifiable stop condition and pursue it." Supply files to read, constraints, and the validation command. If intent is underspecified, ask clarifying questions before setting the goal.

Show full SKILL.md (323 more words)Show less

Launching and controlling a goal

  1. Identify the agent, version, interface, and intended working directory or session.
  2. Check its supported goal commands/tools and any setup or authentication requirements.
  3. Start the goal using that runtime's supported interface and the agreed contract.
  4. Verify it is active and know how to inspect, pause/stop, and resume it.

Before resuming across sessions, verify where that runtime stores goal state and which session must be reopened. Do not assume server-side persistence, automatic pause on user input, replacement semantics, or resumption after a budget refresh.

When a goal drifts

  • Minor drift: send a correction and check that the agent incorporates it.
  • Loose objective: use the runtime's supported pause/stop control, inspect status, then tighten the objective before resuming.
  • Bad mess: stop the goal, review the diff, and undo only changes identified as belonging to that run. Preserve the user's and other agents' work; do not use a blanket reset or stash. Rewrite the goal before restarting.

Correct or stop drift promptly.

Operational tips

  • Inspect status periodically with the runtime's supported command or tool. Every monitoring check must include a concise one-line update to the user: what the agent is doing and whether it is on track.
  • Always review the diff before merging. Human oversight remains essential.
  • Keep approvals/sandboxing tight; default permissions are correct.
  • Start with a small task to learn how the runtime stops before an overnight run.
  • 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

  • Missing goal command: check support and setup for the installed agent and interface before suggesting updates or configuration changes.
  • Will not start or continue: inspect the actual error, goal status, authentication, and limits. Use that runtime's documented recovery steps.
  • No saved goal: verify the session and persistence behavior before creating a replacement.

© davidondrej, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/agent-orchestration/goal-loop of davidondrej/skills.

Open the folder on GitHubat commit ba8e24c

Compare with similar skills

Goal Loop next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Goal Loop compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Goal Loop this skilldavidondrej/skills4.1k—~1.9kAutomated safety check: PassMIT
Show Me Your Work Decision Logcursor/plugins10k9 repos~1.6kAutomated safety check: PassNone
Autoresearch Iteration Loopuditgoenka/autoresearch6.5k1 repos~2kAutomated safety check: PassMIT
PUA Looptanweai/pua20k1 repos~1.1kAutomated safety check: PassMIT
AutopilotYeachan-Heo/oh-my-claudecode40k1 repos~4.4kAutomated safety check: PassMIT
Install Loop Engineeringcobusgreyling/loop-engineering11k1 repos~648Automated safety check: PassMIT

Similar skills

  • Official

    Keeps a TSV decision log for long or unattended agent runs, one row per decision with what, why, evidence and result, so a reviewer can check the work later.

    10k GitHub starsUsed in 9 repos~1.6k tokens
    Agent WorkflowsAuto-check passed
  • Autoresearch Iteration Loop

    uditgoenka/autoresearch

    Runs an autonomous modify, verify, keep-or-discard loop against any metric, with subcommands for planning, debugging, fixing, security audits, shipping and more.

    6.5k GitHub starsUsed in 1 repo~2k tokens
    Agent WorkflowsAuto-check passed
  • PUA Loop

    tanweai/pua

    Runs an unattended iterate-until-verified loop in which a user-set verify command, not the agent's own claim, decides when the task is finished.

    20k GitHub starsUsed in 1 repo~1.1k tokens
    Agent WorkflowsAuto-check passed
  • Autopilot

    Yeachan-Heo/oh-my-claudecode

    Takes a short product idea through requirements, design, planning, parallel implementation, QA cycles and multi-reviewer validation to produce working code.

    40k GitHub starsUsed in 1 repo~4.4k tokens
    Agent WorkflowsAuto-check passed
  • Install Loop Engineering

    cobusgreyling/loop-engineering

    Installs Loop Engineering into a project through the single @cobusgreyling/loop CLI, scaffolding a report-only loop and a readiness score.

    11k GitHub starsUsed in 1 repo~648 tokens
    Agent WorkflowsAuto-check passed
  • Loopy

    Forward-Future/loopy

    Discover, find, compare, audit, repair, adapt, craft, run, debrief, save, and prepare repeatable AI-agent loops for publication.

    3.2k GitHub stars~3.9k tokensUpdated 27 days ago
    Agent WorkflowsAuto-check passed

More from davidondrej/skills

All 51 skills in this repo
  • Nagent

    davidondrej/skills

    Launch a new bb worker thread with the right project, model, worktree, and task brief.

    4.1k GitHub stars~1.7k tokensUpdated yesterday
    Auto-check: notes
  • Browser Harness

    davidondrej/skills

    Direct browser control via CDP. An agent skill from davidondrej/skills.

    4.1k GitHub starsUsed in 2 repos~3k tokens
    Auto-check passed
  • Persistent Localhost

    davidondrej/skills

    Manage persistent dev servers, APIs, and other local processes on a port using macOS LaunchAgents.

    4.1k GitHub stars~618 tokensUpdated yesterday
    Auto-check passed
  • Reset Cursor Acp

    davidondrej/skills

    Reset a stuck Cursor ACP thread in <chat-system and reload its configuration.

    4.1k GitHub stars~728 tokensUpdated yesterday
    Auto-check passed
  • Anti Sleep

    davidondrej/skills

    Keep a Mac awake for a set duration or while a process runs.

    4.1k GitHub stars~640 tokensUpdated yesterday
    Auto-check: warnings
  • Bb CLI

    davidondrej/skills

    Use this when controlling bb. An agent skill from davidondrej/skills.

    4.1k GitHub stars~823 tokensUpdated yesterday
    Auto-check passed

Categories

Questions about Goal Loop

What does Goal Loop do?

Draft /goal prompts and explain persistent agent loops. An agent skill from davidondrej/skills. Goal Loop is an agent skill from davidondrej/skills. Draft /goal prompts and explain persistent agent loops.

When should I use Goal Loop?

Goal Loop fits situations like: autonomous run setup; troubleshooting.

How do I install Goal Loop in Claude Code?

Run `npx skills add davidondrej/skills --skill goal-loop -a claude-code`. Or copy the skill folder (skills/agent-orchestration/goal-loop in davidondrej/skills) into .claude/skills/goal-loop in your project. Claude Code loads it when a task matches its description.

How do I install Goal Loop in Codex?

Run `npx skills add davidondrej/skills --skill goal-loop -a codex`. Or copy the skill folder (skills/agent-orchestration/goal-loop in davidondrej/skills) into .agents/skills/goal-loop in your project. Codex loads it when a task matches its description.

Can I use Goal Loop in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add davidondrej/skills --skill goal-loop -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/goal-loop, .gemini/skills/goal-loop, .github/skills/goal-loop and .opencode/skills/goal-loop in your project.

What does Goal Loop need to run?

Going by SKILL.md and its folder, Goal Loop needs the command-line tools its instructions call (pytest and pnpm).

Does Goal Loop access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Goal Loop safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Goal Loop use?

Goal Loop is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Goal Loop use?

About 1.9k tokens (SKILL.md is roughly 7.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Goal Loop?

Skills that share tags, products or a category with Goal Loop: Show Me Your Work Decision Log (cursor/plugins, 10k stars), Autoresearch Iteration Loop (uditgoenka/autoresearch, 6.5k stars), PUA Loop (tanweai/pua, 20k stars) and Autopilot (Yeachan-Heo/oh-my-claudecode, 40k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Goal Loop?

davidondrej (a GitHub user) maintains it in davidondrej/skills, which has 4,107 GitHub stars. The repository holds 51 skills in this directory. The repository was last updated on October 7, 2026.

Source: davidondrej/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.