跳到正文
Skillpedia
智能体41k · #6996

cancel

它能做什么

这项技能用于结束 oh-my-claudecode 中正在运行的自动化模式,并清理它们遗留的状态。适合希望停止后台模式,或在模式完成后将其重置的人。

适用场景

  • ✓当你想停止仍在运行的自动化模式,例如 autopilot 或 ralph 的时候。
  • ✓当某个自动化模式已经结束,需要清理其保存的状态的时候。
  • ✓当你想停止所有会话中的自动化模式的时候。

技能链接

https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/skills/cancel/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/skills/cancel/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请停止仍在运行的 autopilot 任务,并清理它的状态。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会检测哪个模式处于活动状态,并在当前会话中取消它。只有在你明确要求时,它才会影响其他会话,并且它会遵守锁定机制,以免干扰正在进行的工作。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Cancel Skill

Intelligent cancellation that detects and cancels the active OMC mode.

The cancel skill is the standard way to complete and exit any OMC mode. When the stop hook detects completion, it instructs the LLM to invoke this skill for state cleanup. Retry a failed operation in the same scope and report what remains; --force changes shutdown urgency, never scope, lock handling, or ownership checks. --all is the only cross-session authorization.

Cancellation Contract

The flags control independent scope and shutdown dimensions:

Invocation Scope Shutdown behavior
no flags Current session only Graceful cancellation, including teammate shutdown waits
--force Current session only Forced cancellation: skip graceful waits, but still use protected state tools and honor locks/ownership
--all Every known session, by explicit session id Normal safe cancellation independently for each session, then explicit legacy/global cleanup
--force --all Every known session, by explicit session id Forced-all: skip graceful waits for each session, then perform the authorized legacy/global cleanup

Resolve the current identity from OMC_SESSION_ID in CLI contexts or the hook-provided session_id. A missing or ambiguous identity for no flags or --force fails closed: do not aggregate state, choose a discovered session, or issue an unscoped cleanup. This is a fail-closed error for the default command and for --force. --all may enumerate known sessions, but every concrete id is still read, cancelled, and cleared independently.

What It Does

Automatically detects and cancels active modes:

  • Autopilot: Stops the workflow while preserving progress for resume.
  • Ralph: Stops the persistence loop.
  • Legacy Ultrawork / UltraQA: Removes stale upgraded-installation state only; neither is a live workflow.
  • Ultragoal: Clears its session runtime guard while preserving durable .omc/ultragoal/ plan and ledger artifacts.
  • Swarm: Stops coordinated agents and releases claimed tasks only in its authorized shared cleanup path.
  • Ultrapilot / Pipeline: Stops their worker or sequential execution.
  • Team: Uses the active team surface for graceful shutdown, then clears session-scoped Team state; forced paths skip waits. Claude Code 2.1.178+ has no TeamDelete.
  • Team + Ralph: Team is cancelled first, then linked Ralph is cleared in the same session; a Team failure retains linked Ralph.
  • OMC Teams, Plan Consensus, and Self-Improve: Use their mode-specific protected cleanup and preserve artifacts designated for resume.

Usage

/oh-my-claudecode:cancel
/oh-my-claudecode:cancel --force
/oh-my-claudecode:cancel --all
/oh-my-claudecode:cancel --force --all

Or say: cancelomc, stopomc.

Critical: Deferred Tool Handling

The state tools (state_clear, state_read, state_write, state_list_active, state_get_status) may be deferred by Claude Code. Before calling any of them, load all of them with ToolSearch:

ToolSearch(query="select:mcp__plugin_oh-my-claudecode_t__state_clear,mcp__plugin_oh-my-claudecode_t__state_read,mcp__plugin_oh-my-claudecode_t__state_write,mcp__plugin_oh-my-claudecode_t__state_list_active,mcp__plugin_oh-my-claudecode_t__state_get_status")

If state_clear is unavailable or fails, retry the same scoped operation and report the failure. The fallback below is only an emergency escape from a stop-hook loop for a non-force, non-Team cancellation. It removes files only for an explicitly identified current session. Do NOT use this fallback for autopilot, team, or omc-teams, or for --force/--all; never use it to bypass a lock, ownership check, corruption, or another state-tool failure. Linked modes need one protected operation per mode.

Replace MODE with the specific mode (for example ralplan, ralph, ultrawork, or ultragoal).

# Emergency fallback: direct file removal for one identified session only.
SESSION_ID="${OMC_SESSION_ID:-${CLAUDE_SESSION_ID:-${CLAUDECODE_SESSION_ID:-}}}"
REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || { d="$PWD"; while [ "$d" != "/" ] && [ ! -d "$d/.omc" ]; do d="$(dirname "$d")"; done; echo "$d"; })"
sha256portable() { printf '%s' "$1" | (sha256sum 2>/dev/null || shasum -a 256) | cut -c1-16; }

if [ -n "${OMC_STATE_DIR:-}" ]; then
  SOURCE="$(git remote get-url origin 2>/dev/null || echo "$REPO_ROOT")"
  HA
常见问题

强制选项有什么作用?

它会跳过关闭时的平缓等待,但仍会遵守锁定和所有权检查。

默认会取消所有会话吗?

不会。默认只在当前会话中操作,取消所有会话需要你明确请求。

每次运行后都需要这样做吗?

这是结束并退出自动化模式的标准方式,用于干净地收尾。

详情

作者的原始描述

Cancel any active OMC mode (autopilot, ralph, ultragoal, swarm, ultrapilot, pipeline, team) and clean up retired legacy state

repo: Yeachan-Heo/oh-my-claudecode

热度

GitHub 星标
41k
排名
#6996
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能