Checkpointing Assembly State For Resume 标志

Checkpointing Assembly State For Resume

组织
runtime-si
checkpointing-assembly-state-for-resume

保存并恢复长时间装配任务的状态(例如由 550 块拼图、LEGO 搭建或多米诺骨牌布局组成的任务),让运行数小时后中断的任务能够从停止处继续。save_checkpoint 会以原子方式写入一个带版本号的 JSON 检查点(临时文件、fsync、重命名),并对有效内容计算 SHA-256 校验值。内容包括任务、步骤、已放置的拼图片/积木/物品及其单元格和姿态、待处理队列、backtracking-a-wrong-placement 的记录、参考快照和用于通过快照差异检测受扰动零件的物品、机械臂及其所持物品、时间戳,以及记录变更的活动流;同时保留最新的 N 个检查点。resume_from_checkpoint 会加载通过校验的最新检查点(并迁移较旧的架构版本),通过 snapshot-diff skill 将其与新观测结果进行比较;对于积木任务,还会使用 verifying-build-against-model,并列出继续操作前需要重新验证的物品。适用于长时间任务中每隔几次已验证的放置操作后保存状态,以及中断的任务重新启动时恢复状态;仅涉及文件和 CPU,不会移动机械臂。

概览

发布者runtime-si
代码仓库RoboSkillHub
技能名称checkpointing-assembly-state-for-resume
星标数
242
复刻数
27
附带文件
6
许可协议Apache-2.0
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 6 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 runtime-si 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Checkpointing Assembly State For Resume AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/runtime-si/RoboSkillHub/tree/main/skills/checkpointing-assembly-state-for-resume
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/runtime-si/RoboSkillHub.git /tmp/RoboSkillHub
mkdir -p .claude/skills
cp -r /tmp/RoboSkillHub/skills/checkpointing-assembly-state-for-resume .claude/skills/checkpointing-assembly-state-for-resume
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Checkpointing Assembly State For Resume,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Checkpointing Assembly State For Resume。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Checkpointing Assembly State For Resume 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

checkpointing-assembly-state-for-resume

A 550-piece jigsaw takes a robot 5-9 hours; a LEGO set or a domino field is similar. Over that time something stops the run - a motor fault, a crash, the end of the day. Graph-as-Policy's graph state lives in the process; this skill keeps the task's state on disk so a new process can pick it up, and then asks whether the world still looks like that state before building on it.

How it composes

  • Save after every verified step (or every few): the forward loop's placements (choosing-next-piece-and-slot / backtracking-a-wrong-placement: {piece, col, row, score?, margin?, confidence?, verified?, locked?}), the bricks placed so far (planning-brick-assembly-order's sequence entries: {id, seq, step, cell {x, y, layer, rotation}, size, colour, arm, ...}), generic items ({id, pose?, cell?, mask? | polygon_px? | box?} - dominoes, parts), the pending queue (choose_next's queue or the planner's remaining sequence), in_progress (the job started but not finished: {piece | id, col, row, arm, phase}), the ledger (ledger_path of backtracking-a-wrong-placement, read and embedded with its hash), the arms ({id, joints?, ee_pose?, gripper?, holding?}), grid, and a reference snapshot: snapshot_now (one robot.get_observation, cut to camera_name), reference_snapshot (an Observation or CameraFrame) or reference_snapshot_path (.npz with rgb / depth_m / K / pose, or an image; its arrays are copied in, so the file may go away). Take the snapshot only after a step passed its check; between snapshots the last one is carried over, so pieces placed since are known not to be in it.
  • Resume once at start-up, before the arms move: resumed - go on with pending; resumed_with_rechecks - park the arms (returning-to-a-recorded- pose), look for lost_items, run the jigsaw / brick checks on the recheck ids (a moved piece: nudge it back or re-seat it; missing / misplaced / unseated bricks: verifying-build-against-model's repairs), then go on; no_checkpoint - start fresh; state_mismatch - re-perceive the board (localizer, build check) and save a new checkpoint. The returned placements, bricks, pending, ledger_path, pieces are in the formats the other skills take.

save_checkpoint

  1. One file per save, <task>.<seq:08d>.ckpt.json in checkpoint_dir: {"schema", "schema_version": 3, "sha256", "payload"}, the hash over the payload's canonical JSON (sorted keys, no spaces). Written to a temp file in the same directory, flushed, fsynced, renamed over the name, then the directory is fsynced: a reader sees the old set of files or the old set plus the whole new one.
  2. Arrays (snapshot RGB / depth, item masks) go to blobs/<sha256>.npy.z (zlib-compressed .npy, named by the hash of the uncompressed bytes, written atomically before the checkpoint that names them); the payload holds {"$blob", "dtype", "shape"}. An unchanged snapshot is stored once. Arrays up to 64 numbers (a pose, K, joints) stay inline.
  3. Every save is the whole state except the reference, which is carried from the previous checkpoint unless a new one is given (carry_reference). Jigsaw placements become snapshot-diff items by cell when grid is given (the diff skill's grid forms); items with a mask, polygon or box are used as they are; or pass reference_items.
  4. Activity stream (py_trees' blackboard ActivityStream, adapted): the state is viewed as keys (/placements/<piece>, /bricks/<id>, /arms/<id>, /ledgers/<name>, /pending, /step_index, ...) and every key INITIALISED, WRITTEN or UNSET since the previous checkpoint is appended with its previous and current value and the step; the newest 500 are kept.
  5. Rotate: the newest keep (5) checkpoints of the task stay; blobs no checkpoint in the directory references are deleted once 10 minutes old.

resume_from_checkpoint

  1. Pick: the task's files newest first (or every task's with no task_id); the first that parses, matches its hash, is not from a newer schema and has a task and step is used. Each one skipped is listed in skipped with the reason; leftover temp files of a killed save are listed in stale_temp_files and ignored.
  2. Migrate older versions step by step: v1, a bare run state as the jigsaw / LEGO skills take it (placements, or a planner sequence with placed - the count already built -, ledger / ledger_path, queue, snapshot_path; no envelope, no hash); v2, the first envelope (step, queue, arms keyed by id, one snapshot_path, saved_at in unix seconds). A v1 file has no hash to check.
  3. Ledgers: the file at the saved path is compared with the embedded copy. Same - fine. Missing or unreadable - the copy is written back (restore_ledgers). More events than the copy - backtracking decided after the checkpoint, its actions may be half done: the event's piece and every piece its actions name are rechecked (ledger_after_checkpoint), and the newer file is returned.
  4. What the stop left behind: a piece an arm was holding is lost (held_when_stopped, lost_items); the in_progress job's piece is rechecked; a placement saved with verified: false too.
  5. Snapshot check: one fresh robot.get_observation (or current) goes to detecting-disturbed-pieces-by-snapshot-diff with the stored reference and items (and grid, diff_args): moved / lost items are rechecked with the shift, rotation and depth change it measured, occluded ones too; an item it calls unchanged although 40 % of its pixels changed is rechecked as appearance_changed (a removed thin piece can still match the table texture under it); unexplained changes become unexpected_object entries; items removed from the state since the snapshot (backtracking lifted them) are expected to be gone and ignored. Unregistrable views, or a quarter (and 3) of the items moved, give state_mismatch.
  6. Build check (bricks with a stored build - plate_pose, plate_studs, system, camera_name, args): the placed bricks are the target of verifying-build-against-model, seen through the fresh frame's depth or build_observed bricks; missing, misplaced, wrong_colour, unseated, extra and unverified bricks are rechecked; a quarter (and 3) wrong gives state_mismatch. Colour is off unless build.check_colour.
  7. Everything else that no check cleared is rechecked: placed_after_reference when the snapshot was compared but the piece is newer, not_checked when no check could run (no reference, no observation, a damaged snapshot blob, the sibling skill not installed). verify: none skips the checks and returns the state as saved.

Both sibling skills are loaded from the skills installed beside this one (or a GAP_SKILLS_PATH root); when one is missing its check is skipped and said so in detail.

Measured

All on the CPU (Intel Core Ultra 7 265KF, 20 cores), no robot, no GPU and no simulator: nothing moves, so the simulation check does not apply. tests/bundles/_checkpoint_eval.py reproduces every number below.

Killed writers (--part kill, 200 trials): a separate process saves a 550-piece jigsaw state (placements, the localizer records of all 550 pieces, a 40-event ledger file, a new 640 x 480 RGB-D snapshot every save, keep 5) in a loop and is SIGKILLed at a random moment after 1-3 saves. Resume returned a valid checkpoint 200 / 200 times: the last acknowledged one 148 times, the one being written (renamed but not yet acknowledged) 52 times, never an older one, no file skipped; 20 kills left a temp file, listed and ignored; the ledger compared same every time. SIGKILL does not lose the page cache, so this tests the rename protocol, not power loss (see Limits).

Damaged files (--part corrupt, 400 trials): one random byte of the newest checkpoint changed (200) or the file cut at a random length (200): 400 / 400 skipped with the reason and the previous checkpoint returned; no damaged state was ever accepted. (A flip that produced invalid UTF-8 crashed the reader before this run; fixed.)

Disturbed boards (--part disturb, seeds 100-119): the synthetic RGB-D boards of detecting-disturbed-pieces-by-snapshot-diff's tests (15 jigsaw pieces, 8 bricks or 8 standing dominoes; the overhead camera at 1 m or the wrist camera at 25 cm; sensor noise per frame), saved with a reference snapshot and the items' masks, resumed against a new render. 20 boards per row; "found" = disturbed items in recheck; "extra" = other items rechecked per board.

family / camerauntouched: resumedone moved 3-6 mm: foundone removed: foundtwo moved: found (mismatch)sweep 40 % moved: state_mismatchextra per board (mean / max)
jigsaw / overhead20/2020/2020/2040/40 (0)20/200-1.1 / 3
jigsaw / wrist20/2020/2020/2040/40 (3)20/200-1.15 / 3
bricks / overhead20/2020/2020/2040/40 (0)20/200 / 0
bricks / wrist20/2020/2020/2040/40 (0)20/200 / 0
dominoes / overhead20/2020/2020/2040/40 (0)20/200 / 0
dominoes / wrist20/2020/2020/2040/40 (2)20/200-0.2 / 1
  • The extra rechecks are the moved item's direct neighbours (the diff skill flags a slid jigsaw piece's neighbour whose footprint it overlaps); the sweep rows found 599 of 600 moved items.
  • "Two moved" ended state_mismatch on 5 of 120 small boards: two moved plus one flagged neighbour is 3 of 8 dominoes (or 4 of 15 pieces), over the quarter. On a 550-piece board the fraction decides, not the count.
  • Before the appearance_changed guard, 2 of 20 removed jigsaw pieces (overhead) resumed unflagged: the diff skill matched them to the table under them at 0.56-0.59 with 48-86 % of their pixels changed. The 0.4 threshold was then set on separate seeds (0-19: unmoved items read at most 0.21 of 3475); the table is the rerun on seeds 100-119.

Brick builds (--part build, 20 random 8-brick LEGO builds on a 12 x 12 plate, wrist D405 depth with the station noise model): untouched 20 / 20 resumed; a top brick removed 20 / 20 rechecked first as missing; a top brick moved one stud 19 / 20 first as misplaced (1 as an extra brick plus the brick missing), every one resumed_with_rechecks.

Recorded station frames (overhead Orbbec, RGB only, 5 sessions, the scene static; not committed): 24 pixel-square items on the table, saved from one frame's PNG through reference_snapshot_path, resumed against the next frame (10 consecutive pairs and first-to-last per session): 55 / 55 resumed, no recheck.

Time (--part timing, median of 15): save of the 550-piece state 36 ms (a 498 kB file), 79 ms with a new 640 x 480 RGB-D snapshot, 51 ms with the snapshot carried over; resume with verify: none 11 ms. A resume with the snapshot check is the diff skill's time: 0.7-0.8 s for 15 items at 640 x 480 alone, median 1.0-1.8 s with 12 resumes running at once.

Unit tests (tests/bundles/test_checkpointing_assembly_state_for_resume.py, 31): the envelope and round trip, rotation, the activity stream, a crash before the rename, torn / flipped / empty files, all files corrupt, writers SIGKILLed at random moments (4 runs), a corrupt snapshot blob, blob collection, a snapshot file deleted after saving, unstorable values; v1 bare jigsaw state, v1 planner sequence, v2 envelope, a newer version skipped, an edited v2 file, a migrated state saved again; held, in-progress and unverified items; no observation; a grid mismatch; a newer ledger file and a missing one; an untouched, knocked, emptied, swept and foreign board; pieces placed and lifted after the snapshot; grid cells as items; bricks from depth and from upstream perception; the examples' routes.

Limits

  • Power loss is not tested. The writes follow the POSIX recipe (fsync the file, rename, fsync the directory), and a SIGKILL never left a broken state, but a kill keeps the page cache; a power cut on a disk that lies about fsync can still lose the newest file (then the one before is used). fsync: false is faster and only safe against process crashes.
  • One writer per task. Two processes saving the same task_id into one directory can take the same sequence number; the rename keeps one of them whole. Different tasks may share a directory.
  • Only as good as the checks. Pieces placed after the last snapshot can only be listed (placed_after_reference), not verified; take a snapshot after each verified placement or batch. The snapshot check inherits the diff skill's limits (a 1 mm bump is under the overhead camera's noise, textureless items cannot have their move measured, the camera must not move by centimetres) and the build check the verify skill's (overhead LEGO seating is below the noise).
  • Arms are reported, not moved. The skill treats a held piece as lost and says so; parking (returning-to-a-recorded-pose) and finding the piece are the graph's job. The arms' saved joints are not compared with now.
  • Synthetic boards and static station frames only; no stopped robot run was resumed on hardware yet. The station frames are RGB only, without pieces.
  • Schema versions 1 and 2 are this format's own earlier drafts and the bare run state the jigsaw / LEGO skills pass; the migration chain is there for the versions that come next.
  • MAX_DISTURBED_FRACTION (a quarter) and MIN_MISMATCH_ITEMS (3) are design choices checked on the synthetic boards, not on robot runs.

The constants, and why

Each constant in scripts/ carries its source. In short: KEEP 5 (a torn newest file leaves four; 0.5 MB each for 550 pieces); MAX_ACTIVITY 500 (py_trees' ActivityStream default); INLINE_ARRAY_MAX 64 (a pose, K or a joint vector stays readable in the JSON); BLOB_ZLIB_LEVEL 1 (a full-frame mask 307 kB -> 1-2 kB); BLOB_GRACE_S 600 s (another task's blobs are never collected between its blob and checkpoint writes); MAX_DISTURBED_FRACTION 0.25 and MIN_MISMATCH_ITEMS 3 (a nudge moves 1-3 items, a sweep most; see the table); CHANGED_FRACTION_RECHECK 0.4 (unmoved items read at most 0.21).

Method

The candidate (jigsaw survey, "2 state / 8 long run") pointed at py_trees' blackboard - a keyed store with an activity log - as the pattern; no jigsaw code persists its state. This skill keeps that pattern: the state is viewed as blackboard keys (absolute_name with the / separator) and the difference between checkpoints is recorded as py_trees' activity items (INITIALISED / WRITE / UNSET with previous and current values) in a bounded stream - adapted from py_trees/blackboard.py (BSD-3-Clause, commit 49bcffd, header in scripts/checkpoint_store.py, licence in LICENSE.py_trees), with the stream dropping its oldest item where upstream's ActivityStream.push pops its newest. The file format (hashed envelope, content-addressed blobs, atomic rename, rotation, migration chain) and the resume logic (ledger reconciliation, held and in-progress items, the two sibling checks and the recheck list) are this skill's design. The candidate's append-only JSON-lines step log is not implemented: every checkpoint is a whole state, and the activity stream inside it says what changed.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Checkpointing Assembly State For Resume AI 技能有什么作用?

保存并恢复长时间装配任务的状态(例如由 550 块拼图、LEGO 搭建或多米诺骨牌布局组成的任务),让运行数小时后中断的任务能够从停止处继续。save_checkpoint 会以原子方式写入一个带版本号的 JSON 检查点(临时文件、fsync、重命名),并对有效内容计算 SHA-256 校验值。内容包括任务、步骤、已放置的拼图片/积木/物品及其单元格和姿态、待处理队列、backtracking-a-wrong-placement 的记录、参考快照和用于通过快照差异检测受扰动零件的物品、机械臂及其所持物品、时间戳,以及记录变更的活动流;同时保留最新的 N 个检查点。resume_from_checkpoint 会加载通过校验的最新检查点(并迁移较旧的架构版本),通过 snapshot-diff skill 将其与新观测结果进行比较;对于积木任务,还会使用 verifying-build-against-model,并列出继续操作前需要重新验证的物品。适用于长时间任务中每隔几次已验证的放置操作后保存状态,以及中断的任务重新启动时恢复状态;仅涉及文件和 CPU,不会移动机械臂。

为什么在 TypingMind 中使用 Checkpointing Assembly State For Resume?

因为您只需安装一次,就能搭配任何模型使用。Checkpointing Assembly State For Resume 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Checkpointing Assembly State For Resume?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/runtime-si/RoboSkillHub/tree/main/skills/checkpointing-assembly-state-for-resume。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Checkpointing Assembly State For Resume?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Checkpointing Assembly State For Resume 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Checkpointing Assembly State For Resume 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Checkpointing Assembly State For Resume AI 技能免费吗?

是的。runtime-si 已在 GitHub 上根据 Apache-2.0 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇