agentleFS
itsthestrangeritsthestranger/strangeClaw/skills/checkpoint-and-resume/SKILL.md

checkpoint-and-resume

Skill4 starsChanged 3 months agoMITView on GitHub

Make progress durable across ephemeral VMs and context resets -- commit WIP to a patch artifact, and structure the goal/summary so a replan resumes cleanly.

  • Commits and pushes

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 6 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill before a long-running task risks losing work: the sandbox VM is ephemeral and does not resume across sessions, so anything …

    line 11
  2. Distinctive:

    Before a burst that is approaching a budget guard (see below).

    line 16
  3. Very specific:

    When you must call agent_done mid-task instead of finishing -- structure the reply and history so a fresh replan can pick the work back up.

    line 19
  4. Distinctive:

    Run the bundled script exactly:

    line 39
  5. Very specific:

    If there is any uncommitted work (staged, unstaged, or untracked), it is committed onto a new checkpoint/<UTC timestamp> branch.

    line 52
  6. Very specific:

    Call agent_done with a resumable reply -- not a final answer -- when you are pausing deliberately (budget guard tripped, natural stopping …

    line 87
  7. Distinctive:

    Treat both a maximum burst count and a wall-clock ceiling as hard stops, not targets to fill:

    line 97
  8. Distinctive:

    Before starting a burst, check whether it can plausibly finish within the remaining budget.

    line 100
  9. Distinctive:

    When a guard is close to tripping, prefer stopping at a clean boundary (a passing test, a committed patch, an updated Next Steps list) over …

    line 103

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Checkpoint And Resume

When To Use

Use this skill before a long-running task risks losing work: the sandbox VM is ephemeral and does not resume across sessions, so anything not committed to a patch artifact or reflected in the resumable history summary can disappear. Reach for it:

  • Before a burst that is approaching a budget guard (see below).
  • Whenever you have uncommitted code changes and are about to pause, hand off, or risk running out of turns.
  • When you must call agent_done mid-task instead of finishing -- structure the reply and history so a fresh replan can pick the work back up.

This skill covers two checkpoints. A code checkpoint captures uncommitted work as a patch file. A loop checkpoint captures task state as text the next planning pass can act on. Use either independently; use both when you are pausing work that is both code-in-progress and plan-in-progress.

Requirements

Needs the shell tool only. git is present in the sandbox rootfs -- no integration or broker access is required for either checkpoint in this skill.

Out of scope: pushing a checkpoint to a remote (a credentialed git push or opening a PR) requires a host-side vcs service that does not exist yet. This skill only gets WIP into a local patch artifact under /output/; getting that artifact off the VM and onto a remote is a future capability, not something to attempt here.

Code Checkpoint Procedure

Run the bundled script exactly:

scripts/patch_out.sh [--repo <dir>] [--out <dir>] [--base <ref>]

Defaults: --repo is the current directory, --out is ${OUTPUT_DIR:-/output}/checkpoints, and --base is the branch's upstream if one is configured, else the repository's root commit -- or, if the repository has no commits at all yet, the new checkpoint commit itself, exported with format-patch --root.

What it does:

  1. If there is any uncommitted work (staged, unstaged, or untracked), it is committed onto a new checkpoint/<UTC timestamp> branch. The branch you started on is left checked out and clean afterward -- the WIP now lives on the checkpoint branch and in the exported patch, not as loose changes in the tree. If there is no uncommitted work but the branch has commits ahead of --base, no checkpoint branch is created; the existing commits are exported directly.
  2. git format-patch <base>..HEAD writes one patch file per commit into <out>/<UTC timestamp>/, and the script prints each produced file path.
  3. On a bare VM with no user.name/user.email configured, the WIP commit uses a fallback identity supplied via git -c flags for that one command -- it never writes repo or global config.

It exits non-zero with a clear message on stderr, and does not create any files, when --repo is not a git repository, or when there is nothing to checkpoint (clean tree, no commits ahead of --base).

To resume on a fresh VM: re-clone the repository, git am (or git apply) the patch files from the checkpoint directory in filename order, and continue from there.

Loop Checkpoint Procedure

The history summary is the resume contract. When ending a burst without finishing the task -- via agent_done with a reply that is not the final answer, or right before a replan -- make sure the summary that will drive the next pass is actionable:

  • Next Steps: concrete, ordered actions the next pass should take first. Name exact files, commands, IDs, and URLs verbatim -- a resumed pass has no memory of why, only what this section says to do.
  • Blocked: anything you could not resolve yourself (a missing credential, an ambiguous requirement, a failing check you could not isolate). A replan reads this section to decide whether to keep going autonomously or surface the blocker to the human.

Call agent_done with a resumable reply -- not a final answer -- when you are pausing deliberately (budget guard tripped, natural stopping point reached, or the remaining work depends on something outside this burst) and Next Steps/Blocked are populated so a fresh planning pass can continue without re-deriving context. Keep going instead of calling agent_done when there is still budget left and the next action is unambiguous -- do not checkpoint-and-stop reflexively on every turn; that just burns bursts on overhead.

Budget Guard

Treat both a maximum burst count and a wall-clock ceiling as hard stops, not targets to fill:

  • Before starting a burst, check whether it can plausibly finish within the remaining budget. If not, do the smallest useful unit of work and checkpoint instead of starting something you cannot finish.
  • When a guard is close to tripping, prefer stopping at a clean boundary (a passing test, a committed patch, an updated Next Steps list) over pushing one more risky action.
  • The rhythm is checkpoint, then pause -- always leave both a code checkpoint (if there is uncommitted work) and an updated summary before a burst ends, so the next burst starts from durable state rather than reconstructing it from raw history.

Out Of Scope

The credentialed push half of checkpointing -- git push to a remote, opening a pull request, or any other write that needs stored credentials -- is not covered here. It waits on a future host-side vcs service. This skill's code checkpoint stops at a local patch artifact under /output/.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.