How Cavekit's autonomous execution loop works — state machine, stop hook, completion sentinel, lock, budgets, iteration cap.

Apache-2.0Auto-check passedAgent Workflows

Install Autonomous Loop

skills CLI
$ npx skills add hashgraph-online/awesome-codex-plugins --skill autonomous-loop -a claude-code

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

GitHub CLI
$ gh skill install hashgraph-online/awesome-codex-plugins autonomous-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/hashgraph-online/awesome-codex-plugins.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/JuliusBrussee/blueprint/skills/autonomous-loop .claude/skills/autonomous-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
autonomous-loop
GitHub stars
1.2k
Token cost
~1.6k tokens
SKILL.md length
473 words
Files
1
Skills in repo
686
Repo updated
First seen
Licence
Apache-2.0

At a glance

How Cavekit's autonomous execution loop works — state machine, stop hook, completion sentinel, lock, budgets, iteration cap.

  • Works in 5 steps: Setup — /ck:make calls → Work — the agent does one wave of task… → Stop fires — Claude Code's Stop event… → …
  • Phrases: how does the loop work
  • SKILL.md covers Architecture, Files the loop touches, Lifecycle and Completion sentinel, plus 4 more sections
  • Calls node

What it does

Autonomous Loop is an agent skill from hashgraph-online/awesome-codex-plugins. How Cavekit's autonomous execution loop works — state machine, stop hook, completion sentinel, lock, budgets, iteration cap. Read this skill any time you are about to run /ck:make, debug a stuck session, or write a new command that needs the loop. Trigger phrases: "how does the loop work", "stop hook", "autonomous", "completion sentinel", "why is the session looping".

Its SKILL.md is about 1.6k 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: A curated list of awesome OpenAI Codex / ChatGPT plugins, skills, and resources. The 1 Codex Marketplace. See live plugins at: https://hol.org/plugins/best-codex-plugins. The licence is Apache-2.0.

When your agent uses it

  • Phrases: how does the loop work
  • Completion sentinel
  • Why is the session looping

Example prompts

  • “how does the loop work”
  • “stop hook”
  • “autonomous”
  • “/autonomous-loop”

Workflow steps

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

  1. Setup — /ck:make calls
  2. Work — the agent does one wave of task execution per iteration.
  3. Stop fires — Claude Code's Stop event triggers stop-hook.sh. The hook
  4. Repeat — Claude Code treats decision:block + reason:... as a new
  5. Teardown — one of

What it can do on your machine

Read from SKILL.md and the folder at commit 78497e5. 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:

    • node

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

  • Network

    No URLs in SKILL.md.

    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

Autonomous Loop loads about 1.6k tokens when it runs. Until then it costs about 97 tokens; SKILL.md has 473 words of instructions outside code blocks.

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

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 hashgraph-online/awesome-codex-plugins at commit 78497e5, republished under its Apache-2.0 licence (© hashgraph-online). 473 words, ~1,601 tokens.

Download SKILL.mdSave it as .claude/skills/autonomous-loop/SKILL.md (or your agent's skills folder).
name
autonomous-loop
description
How Cavekit's autonomous execution loop works — state machine, stop hook, completion sentinel, lock, budgets, iteration cap. Read this skill any time you are about to run /ck:make, debug a stuck session, or write a new command that needs the loop. Trigger phrases: "how does the loop work", "stop hook", "autonomous", "completion sentinel", "why is the session looping".

Autonomous Loop

The loop lets a single /ck:make invocation run dozens of agent iterations without user intervention, while still respecting per-task budgets, session budgets, and explicit user-approval gates.

Architecture

┌─────────────────┐  Stop event   ┌────────────────────┐
│  Claude Code    │──────────────▶│   stop-hook.sh     │
│   session       │               │  (.cavekit/loop    │
└─────────────────┘               │   active?)         │
        ▲                         └─────────┬──────────┘
        │                                   │ route()
        │ next prompt injected              ▼
        │                         ┌────────────────────┐
        │                         │ cavekit-tools.cjs  │
        │                         │  routeDecision()   │
        │                         │  + status-block    │
        │                         │  + backprop-       │
        │                         │    directive       │
        │                         └─────────┬──────────┘
        │                                   │
        └───────── {decision:"block",       │
                    reason:<next prompt>} ◀─┘

Files the loop touches

All under <project>/.cavekit/:

FileWriterPurpose
.loop.jsonsetup-loopSentinel; stop-hook no-ops without it.
.loop.lockstop-hook (heartbeat)Single-writer lock. PID + hostname + ts.
state.mdcavekit-toolsphase, current_task, iteration.
token-ledger.jsontoken-monitor hookSession + per-task token tallies.
task-status.jsoncommandsAuthoritative task registry.
.progress.jsonprogress-trackerZero-context UI snapshot.
.auto-backprop-pending.jsonauto-backprop hookFlag file from failed tests.
history/backprop-log.mdbackprop skillAppend-only trace log.
capabilities.jsondiscover commandMCP + CLI tool detection.

Lifecycle

  1. Setup — /ck:make calls:

    node "${CLAUDE_PLUGIN_ROOT}/scripts/cavekit-tools.cjs" setup-loop

    This writes .loop.json (activating the stop hook) and resets state.md.

  2. Work — the agent does one wave of task execution per iteration.

  3. Stop fires — Claude Code's Stop event triggers stop-hook.sh. The hook:

    • reads stdin for session_id and transcript_path
    • acquires / refreshes the lock
    • scans the last 20 transcript lines for <promise>CAVEKIT COMPLETE</promise>
    • if sentinel found → teardown + exit silently
    • else → asks routeDecision() for the next prompt
    • prepends the backprop directive if the flag file exists
    • returns {"decision":"block","reason":<next prompt>}
  4. Repeat — Claude Code treats decision:block + reason:... as a new user message, so the session continues.

  5. Teardown — one of:

    • completion sentinel detected
    • max-iterations reached (CAVEKIT_MAX_ITERATIONS)
    • session budget exhausted (CAVEKIT_BUDGET_EXHAUSTED)
    • lock stolen by another session (CAVEKIT_LOCK_CONFLICT)
    • user interrupt (hook returns no output; session stops normally)

Completion sentinel

To end the loop cleanly, emit exactly:

<promise>CAVEKIT COMPLETE</promise>

The hook searches for this literal in the last 20 transcript lines. Put it on its own line at the very end of the final message. Do not wrap it in code fences or paraphrase it — the search is a literal substring match.

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

Terminal sentinels

When routeDecision() cannot safely continue, it returns one of these strings instead of a prompt:

SentinelMeaning
CAVEKIT_LOOP_DONEAll tasks complete. Hook exits silent.
CAVEKIT_MAX_ITERATIONSIteration cap hit. Loop halted.
CAVEKIT_BUDGET_EXHAUSTEDSession budget exhausted.
CAVEKIT_LOCK_CONFLICTAnother session owns the lock.

The hook translates each into a short user-facing message before returning.

Lock protocol

The lock is a JSON file (.loop.lock) with {owner, pid, host, heartbeat_at}.

  • Owner tag: session:<session_id>.
  • Heartbeat: every Stop invocation refreshes heartbeat_at.
  • Stale: > 5 minutes since last heartbeat. A new session may steal a stale lock.
  • Conflict: non-owner with fresh lock → returns CAVEKIT_LOCK_CONFLICT.

Never delete .loop.lock while a session might be active. Use cavekit-tools release-lock --owner <tag> instead.

Debugging a stuck loop

bash
# Inspect current state
node "${CLAUDE_PLUGIN_ROOT}/scripts/cavekit-tools.cjs" status

# Who holds the lock?
cat .cavekit/.loop.lock

# What would the router do right now?
node "${CLAUDE_PLUGIN_ROOT}/scripts/cavekit-tools.cjs" route

# Drop the loop entirely (safe after a crash)
node "${CLAUDE_PLUGIN_ROOT}/scripts/cavekit-tools.cjs" teardown-loop

Turn on debug logging by exporting CAVEKIT_DEBUG=1. The hook will write to .cavekit/.debug.log.

What not to do

  • Do not hand-edit state.md's phase field while a loop is active. The hook assumes single-writer semantics and will overwrite you.
  • Do not set your own stop hook that also blocks. Multiple blocking hooks race, and Claude Code picks one arbitrarily.
  • Do not emit the completion sentinel unless every task in the registry is truly complete. The hook trusts the sentinel and tears down immediately.

© hashgraph-online, Apache-2.0. 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 plugins/JuliusBrussee/blueprint/skills/autonomous-loop of hashgraph-online/awesome-codex-plugins.

Open the folder on GitHubat commit 78497e5

Compare with similar skills

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

Autonomous Loop compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Autonomous Loop this skillhashgraph-online/awesome-codex-plugins1.2k—~1.6kAutomated safety check: PassApache-2.0
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 hashgraph-online/awesome-codex-plugins

All 686 skills in this repo
  • Anime Reaction Gif

    hashgraph-online/awesome-codex-plugins

    Create original anime-style reaction stickers as looping GIFs and MP4 previews, using generated character pose sheets and timed key poses.

    1.2k GitHub stars~922 tokensUpdated today
    Auto-check passed
  • Calibredb

    hashgraph-online/awesome-codex-plugins

    Manage and query Calibre libraries with the calibredb CLI (local paths or Calibre Content server URLs).

    1.2k GitHub stars~1k tokensUpdated today
    Auto-check passed
  • Rust API Test Harness

    hashgraph-online/awesome-codex-plugins

    A skill your agent uses when adding, changing, testing, or debugging Rust HTTP APIs and services, especially when Codex needs black-box integration tests, random-port app startup, real database test…

    1.2k GitHub stars~1.7k tokensUpdated today
    Auto-check passed
  • Art

    hashgraph-online/awesome-codex-plugins

    Make a studio's game look like something at build time — a cover from a real frame of the game (free), painted covers, backdrops, textures and character plates from image models through the…

    1.2k GitHub stars~2.4k tokensUpdated today
    Auto-check passed
  • Game Balance Economy

    hashgraph-online/awesome-codex-plugins

    Balance game difficulty, resources, rewards, probability, progression, economies, and dominant strategies.

    1.2k GitHub stars~618 tokensUpdated today
    Auto-check passed
  • Manuscript Engagement Analytics

    hashgraph-online/awesome-codex-plugins

    Analyze nonfiction manuscripts for reader engagement signals, including heading-level word counts, slow starts, long slogs, weak takeaway titles, value pacing, beta-reader comment dropoff, and…

    1.2k GitHub stars~875 tokensUpdated today
    Auto-check passed

Categories

Questions about Autonomous Loop

What does Autonomous Loop do?

How Cavekit's autonomous execution loop works — state machine, stop hook, completion sentinel, lock, budgets, iteration cap. Autonomous Loop is an agent skill from hashgraph-online/awesome-codex-plugins. How Cavekit's autonomous execution loop works — state machine, stop hook, completion sentinel, lock, budgets, iteration cap.

When should I use Autonomous Loop?

Autonomous Loop fits situations like: phrases: how does the loop work; completion sentinel; why is the session looping.

How do I install Autonomous Loop in Claude Code?

Run `npx skills add hashgraph-online/awesome-codex-plugins --skill autonomous-loop -a claude-code`. Or copy the skill folder (plugins/JuliusBrussee/blueprint/skills/autonomous-loop in hashgraph-online/awesome-codex-plugins) into .claude/skills/autonomous-loop in your project. Claude Code loads it when a task matches its description.

How do I install Autonomous Loop in Codex?

Run `npx skills add hashgraph-online/awesome-codex-plugins --skill autonomous-loop -a codex`. Or copy the skill folder (plugins/JuliusBrussee/blueprint/skills/autonomous-loop in hashgraph-online/awesome-codex-plugins) into .agents/skills/autonomous-loop in your project. Codex loads it when a task matches its description.

Can I use Autonomous 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 hashgraph-online/awesome-codex-plugins --skill autonomous-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/autonomous-loop, .gemini/skills/autonomous-loop, .github/skills/autonomous-loop and .opencode/skills/autonomous-loop in your project.

What does Autonomous Loop need to run?

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

Does Autonomous 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 Autonomous 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 Autonomous Loop use?

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

How many tokens does Autonomous Loop use?

About 1.6k tokens (SKILL.md is roughly 6.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 Autonomous Loop?

Skills that share tags, products or a category with Autonomous 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 Autonomous Loop?

hashgraph-online (a GitHub organization) maintains it in hashgraph-online/awesome-codex-plugins, which has 1,242 GitHub stars. The repository holds 686 skills in this directory. The repository was last updated on October 8, 2026.

Source: hashgraph-online/awesome-codex-plugins on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.