goal-loop

A recurring work pattern that lets an agent retry a task until a clear, machine-checkable condition is met. A cron job is a scheduled command, and the pattern uses one agent to make changes and another to check them.

In plain words
What is it for?
Use it for repeated coding, testing, building, or linting tasks when an automated check can decide whether the objective has been reached.
Why use it?
It helps with work that may need several attempts while preventing vague or subjective definitions of “done.”

Skill for Claude CodeCodex

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 skills/lamenting-hawthorn/skillloop/goal-loop
Any agent
npx skills add lamenting-hawthorn/SkillLoop --skill goal-loop
Clone the repo
git clone --depth 1 https://github.com/lamenting-hawthorn/SkillLoop

Made for: Claude Code, Codex.

Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,191 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.00049 $0.03191
Opus 5 $0.00024 $0.01596
Sonnet 5 $0.00010 $0.00638
Haiku 4.5 $0.00005 $0.00319

Measured 3d ago against content hash 0a949de1ee12, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

goal-loop 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 3d ago.

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.

references/hermes-skills/goal-loop/SKILL.md · 354 lines

How it starts

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

Goal Loop — The /goal Pattern

The /goal primitive: a cron job that runs on a cadence until an objective condition is met, verified by an independent checker model — not the agent that writes the code. This is the maker-vs-checker split applied to the stop condition itself.

When to Use

  • After passing the pre-loop-checklist (4-condition test + 30-second check)
  • When you have a clear, machine-checkable goal condition
  • When the work is iterative (agent tries, fails, learns, retries)
  • When verification can be fully automated

Do NOT use for:

  • One-shot tasks (use a single delegate_task)
  • Vague goals ("make it better")
  • Work that can't be verified by a test/build/linter
  • Anything where "done" is a judgment call

The Pattern (4 Parts)

                     ┌──────────────────────┐
                     │   Cron job fires on   │
                     │   cadence (e.g. 30m)  │
                     └──────────┬───────────┘
                                │
                     ┌──────────▼───────────┐
                     │  Read STATE.md        │
                     │  (resume, don't       │
                     │   restart from zero)  │
                     └──────────┬───────────┘
                                │
                     ┌──────────▼───────────┐
                     │  CHECKER subagent     │
                     │  (DIFFERENT model)    │
                     │  Evaluate: is goal    │
                     │  condition met?       │
                     └──────────┬───────────┘
                                │
                    ┌───────────┴───────────┐
                    │                       │
                    ▼                       ▼
              ┌──────────┐           ┌──────────┐
              │  GOAL    │           │  GOAL    │
              │  MET ✓   │           │  NOT MET │
              └────┬─────┘           └────┬─────┘
                   │                      │
                   ▼                      ▼
              ┌──────────┐           ┌──────────┐
              │  Report  │           │  WORKER   │
              │  success │           │  subagent │
              │  Update  │           │  (does    │
              │  STATE   │           │   the     │
              │  Option: │           │   work)   │
              │  self-   │           └────┬─────┘
              │  cancel  │                │
              └──────────┘                ▼
                                   ┌──────────┐
                                   │  Update  │
                                   │  STATE   │
                                   │  Report  │
                                   │  progress│
                                   │  (loop   │
                                   │   again  │
                                   │   next   │
                                   │   tick)  │
                                   └──────────┘

Read the full file on GitHub · 354 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. 3d ago First seen · 354 lines · 49 tokens per session scan A 0a949de1ee12

Subscribe to this mod's changes

goal-loop is a skill published in the GitHub repository lamenting-hawthorn/SkillLoop (9 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 49 tokens to every session and 3,191 once invoked, about $0.0002 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.