cancellable-loop

cancellable-loop is a skill for Claude Code, Codex from dcc-mcp/dcc-mcp-core. It costs 45 tokens per session (454 once invoked), scanned A, original, MIT.

A small example showing how a long-running loop can notice when the user or calling program asks it to stop. Cooperative cancellation means the loop checks for that request during its work and exits cleanly.

In plain words
What is it for?
Use it when writing or studying skills that repeat work over many steps and need to respond to cancellation requests.
Why use it?
It demonstrates how to prevent lengthy tasks from continuing after cancellation. The example can be used as a reference when building similar skills.

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/dcc-mcp/dcc-mcp-core/cancellable-loop
Any agent
npx skills add dcc-mcp/dcc-mcp-core --skill cancellable-loop
Clone the repo
git clone --depth 1 https://github.com/dcc-mcp/dcc-mcp-core

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cancellable-loop

README.md
[![agentmods](https://agentmods.dev/badge/skills/dcc-mcp/dcc-mcp-core/cancellable-loop.svg)](https://agentmods.dev/skills/dcc-mcp/dcc-mcp-core/cancellable-loop)
Your own site
<a href="https://agentmods.dev/skills/dcc-mcp/dcc-mcp-core/cancellable-loop"><img src="https://agentmods.dev/badge/skills/dcc-mcp/dcc-mcp-core/cancellable-loop.svg" alt="Measured on agentmods" height="20"></a>
Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 454 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.1 $0.00045 $0.00454
Opus 5 $0.00023 $0.00227
Sonnet 5 $0.00009 $0.00091
Haiku 4.5 $0.00005 $0.00045

Measured 5d ago against content hash d7d8a5217ab0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

cancellable-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 5d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/count.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

examples/skills/cancellable-loop/SKILL.md · 53 lines

What it actually says

Cancellable Loop

A minimal example that shows how to write a skill script that honours notifications/cancelled from the MCP client.

The pattern is simple: call check_cancelled() at the top of every iteration of a long-running loop. When the dispatcher installs a CancelToken and the client cancels the request, check_cancelled() raises CancelledError and the script unwinds cleanly. Outside of a request context (REPL, unit tests) check_cancelled() is a no-op, so the same script remains easy to run in isolation.

Tools

  • cancellable_loop__count — Iterate iterations times, sleeping sleep_ms milliseconds per step, checking for cancellation each iteration.

Example

{"name": "cancellable_loop__count", "arguments": {"iterations": 100, "sleep_ms": 50}}
# → {"success": true, "message": "Completed 100 iterations", "context": {"iterations": 100}}

If the client sends notifications/cancelled while the loop is running, the next check_cancelled() call raises CancelledError and the @skill_entry wrapper converts it into a standard error dict.

  • dcc_mcp_core.check_cancelled — the API this skill demonstrates.
  • Issue #329 — cooperative cancellation checkpoints.
  • Issue #318 — async dispatcher integration (wires the CancelToken).
Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 5d ago First seen · 53 lines · 45 tokens per session scan A d7d8a5217ab0

Subscribe to this mod's changes

cancellable-loop is a skill published in the GitHub repository dcc-mcp/dcc-mcp-core (42 stars, last pushed yesterday), licensed MIT. It adds 45 tokens to every session and 454 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-30.

Related

Other skills, from other repositories

artclaw-tool-creator

ArtClaw Tool Creator - AI 引导创建自定义 DCC 工具。支持三种创建方式:包装 Skill、编写脚本、组合工具。.

IvanYangYangXi/artclaw_bridge · 41 tokens

houdini-simulation

Houdini 仿真工作流指南:Pyro/RBD/FLIP/Vellum 的标准搭建流程。 Use when AI needs to: (1) set up simulations, (2) configure DOPs, (3) build Pyro/RBD/FLIP/Vellum setups. Houdini only (runpython).

IvanYangYangXi/artclaw_bridge · 75 tokens

sd-node-ops

SD 节点创建、连接、参数设置指南。包含原子节点和库节点的正确使用方式。 Use when AI needs to: (1) create nodes, (2) connect nodes, (3) set parameters, (4) build material graphs. Substance Designer only (runpython).

IvanYangYangXi/artclaw_bridge · 67 tokens

houdini-node-ops

Houdini 节点创建、连接、参数设置的操作指南。 Use when AI needs to: (1) create nodes, (2) connect nodes, (3) set node parameters, (4) build node networks. Houdini only (runpython).

IvanYangYangXi/artclaw_bridge · 61 tokens

ue5-blueprint-workflow

UE5.6/UE5.7 Blueprint graph workflow for feature implementation, input events, node wiring, and graph validation. Use when requests involve adding Blueprint logic, keyboard input behavior, function chains, event graph edits, or pin-level connection guidance.

IvanYangYangXi/artclaw_bridge · 58 tokens

blender-context

查询 Blender 编辑器上下文:当前选择、场景信息、文件名、视口相机状态、集合结构。 Use when AI needs to: (1) get selected objects, (2) get scene overview, (3) check current file, (4) inspect viewport state, (5) get collection hierarchy. Blender only (runpython).

IvanYangYangXi/artclaw_bridge · 77 tokens