Checkpointed Agent Loop logo

Checkpointed Agent Loop

CommunityPopular
davepoon
checkpointed-agent-loop

Run long or failure-prone Claude Code tasks as bounded, resumable loops with a durable state machine, attempt budget, and verification evidence checkpoint.

Overview

Publisherdavepoon
Repositorybuildwithclaude
Skill namecheckpointed-agent-loop
Stars
3.5K
Forks
509
Bundled files
2
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by davepoon on GitHub. Read the source before you install it.

Installation

Install the Checkpointed Agent Loop AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/davepoon/buildwithclaude.git /tmp/buildwithclaude
mkdir -p .claude/skills
cp -r /tmp/buildwithclaude/plugins/all-skills/skills/checkpointed-agent-loop .claude/skills/checkpointed-agent-loop
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Checkpointed Agent Loop in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Checkpointed Agent Loop on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Checkpointed Agent Loop is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Checkpointed Agent Loop

Use this skill when a task can be interrupted, needs bounded retries, or must prove verification before it is called complete. It adds a small local checkpoint file around ordinary Claude Code work so a new context can resume from explicit state instead of reconstructing progress from chat.

The included Node.js utility stores state and evidence. It does not execute commands, call a model, spawn agents, access secrets, or contact a network service. Claude Code remains responsible for each actual tool call and for deciding whether a human approval is required.

When to Use This Skill

  • A migration, refactor, test repair, or investigation may span multiple sessions.
  • A bounded retry loop is safer than repeatedly improvising from conversation history.
  • A task needs a durable next action and a record of which verification actually ran.
  • You need to stop at an external dependency or a human decision without claiming success.

Do not use it for a one-line edit or a workflow that already has its own durable runner.

State Model

The checkpoint uses these states and only these transitions:

text
planned -> running
running -> verifying | failed | blocked
verifying -> succeeded | running | failed | blocked

succeeded, failed, and blocked are terminal. Entering running consumes one attempt, and the finite maxAttempts value cannot be exceeded. A transition to succeeded is rejected until the checkpoint contains at least one passing evidence record from verifying.

Setup

Choose a project-local path that is not committed with application code, for example .agent/checkpoints/data-migration.json. Keep objectives, reasons, and evidence free of API keys, tokens, passwords, personal data, and raw secret-bearing logs.

Set the helper path for the commands below:

bash
SKILL_DIR="<absolute path to the installed checkpointed-agent-loop skill>"
CHECKPOINT=".agent/checkpoints/task.json"

Initialize with a finite budget:

bash
node "$SKILL_DIR/scripts/checkpoint-loop.mjs" init \
  --file "$CHECKPOINT" \
  --task "data-migration" \
  --objective "Migrate the user table without losing records" \
  --max-attempts 3 \
  --next-action "Inspect the current migration and test fixture"

Operating Protocol

1. Start one bounded attempt

Before making the change, persist the next action and enter running:

bash
node "$SKILL_DIR/scripts/checkpoint-loop.mjs" transition \
  --file "$CHECKPOINT" \
  --to running

Use Claude Code-native tools for exactly the bounded action described by nextAction. Do not turn one attempt into an unbounded plan.

2. Enter verification

After the action, move to verification before deciding the outcome:

bash
node "$SKILL_DIR/scripts/checkpoint-loop.mjs" transition \
  --file "$CHECKPOINT" \
  --to verifying

Run the relevant check yourself. The helper records a check name and outcome; it never runs that check for you:

bash
node "$SKILL_DIR/scripts/checkpoint-loop.mjs" evidence \
  --file "$CHECKPOINT" \
  --check "npm test -- workspace migration" \
  --outcome passed \
  --artifact "artifacts/migration-test.txt"

Only cite an artifact that exists and is safe to share. A failed check can be recorded with --outcome failed; do not convert it to a passing record by rewriting the expected value.

3. Finish, retry, or escalate

If verification is genuinely passing:

bash
node "$SKILL_DIR/scripts/checkpoint-loop.mjs" transition \
  --file "$CHECKPOINT" \
  --to succeeded

If the change needs another bounded attempt, provide a concrete next action and reason:

bash
node "$SKILL_DIR/scripts/checkpoint-loop.mjs" transition \
  --file "$CHECKPOINT" \
  --to running \
  --next-action "Fix the null-row fixture and rerun the focused test" \
  --reason "Verification found a reproducible null-row failure"

Use failed for a terminal technical failure. Use blocked only when progress needs an external dependency or human decision:

bash
node "$SKILL_DIR/scripts/checkpoint-loop.mjs" transition \
  --file "$CHECKPOINT" \
  --to blocked \
  --reason "Waiting for the database owner to approve the production window"

4. Resume after interruption

Read the checkpoint before doing any work in a new session:

bash
node "$SKILL_DIR/scripts/checkpoint-loop.mjs" status \
  --file "$CHECKPOINT" \
  --format summary

For machine-readable recovery, omit --format summary. Continue from nextAction, inspect the history and evidence, and never repeat a completed attempt merely because the old conversation is unavailable.

Safety Rules

  • Use a positive, finite attempt budget. A loop without a ceiling is not a recoverable loop.
  • Never mark succeeded without passing verification evidence in the checkpoint.
  • Do not place secrets or full sensitive logs in the checkpoint; store only a safe check name and sanitized artifact path.
  • The helper does not run evidence commands. Execute checks with normal approval and tool policy, then record their observed result.
  • Destructive actions, external writes, payments, deployments, and permission changes still require the normal human approval boundary.
  • Treat a malformed or manually edited checkpoint as invalid and stop for review; do not guess its missing state.

Examples

Interrupted migration

An agent initializes data-migration with three attempts, enters running, updates the migration, and is interrupted before verification. The next session runs status, sees running and the saved nextAction, performs only that action, then records the actual test result before moving to succeeded or a bounded retry.

Attempt ceiling reached

An agent records a failed verification, transitions back to running with maxAttempts: 2, and fails the same focused check on the second attempt. A third transition into running is rejected with attempt budget exhausted; the agent must report the failure or escalate rather than silently looping forever.

Verification

The script has a local Node test suite covering legal transitions, terminal immutability, attempt limits, evidence rules, malformed input, atomic persistence, and rejected-operation preservation:

bash
node --test "$SKILL_DIR/scripts/checkpoint-loop.test.mjs"

The repository validator checks the frontmatter and directory/name contract:

bash
node scripts/validate-skills.js

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Checkpointed Agent Loop AI skill do?

Run long or failure-prone Claude Code tasks as bounded, resumable loops with a durable state machine, attempt budget, and verification evidence checkpoint.

Why use Checkpointed Agent Loop on TypingMind?

Because you install it once and use it with any model. Checkpointed Agent Loop is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Checkpointed Agent Loop in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/davepoon/buildwithclaude/tree/main/plugins/all-skills/skills/checkpointed-agent-loop. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Checkpointed Agent Loop?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Checkpointed Agent Loop?

As many as you like. As long as a model supports skills, you can use Checkpointed Agent Loop with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Checkpointed Agent Loop AI skill free?

Yes. It is published on GitHub by davepoon under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇