cancel

yeachan-heo/oh-my-claudecode · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/yeachan-heo/oh-my-claudecode --skill cancel
0 commentsdiscussion
summary

Intelligent cancellation that detects and cancels the active OMC mode.

skill.md

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 work is complete, it instructs the LLM to invoke this skill for proper state cleanup. If cancel fails or is interrupted, retry with --force flag, or wait for the 2-hour staleness timeout as a last resort.

What It Does

Automatically detects which mode is active and cancels it:

  • Autopilot: Stops workflow, preserves progress for resume
  • Ralph: Stops persistence loop, clears linked ultrawork if applicable
  • Ultrawork: Stops parallel execution (standalone or linked)
  • UltraQA: Stops QA cycling workflow
  • Swarm: Stops coordinated agent swarm, releases claimed tasks
  • Ultrapilot: Stops parallel autopilot workers
  • Pipeline: Stops sequential agent pipeline
  • Team: Sends shutdown_request to all teammates, waits for responses, calls TeamDelete, clears linked ralph if present
  • Team+Ralph (linked): Cancels team first (graceful shutdown), then clears ralph state. Cancelling ralph when linked also cancels team first.

Usage

/oh-my-claudecode:cancel

Or say: "cancelomc", "stopomc"

Critical: Deferred Tool Handling

The state management tools (state_clear, state_read, state_write, state_list_active, state_get_status) may be registered as deferred tools by Claude Code. Before calling any state tool, you MUST first load all of them via 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, use this bash fallback as an emergency escape from the stop hook loop. This is NOT a full replacement for the cancel flow — it only removes state files to unblock the session. Linked modes (e.g. ralph→ultrawork, autopilot→ralph/ultraqa) must be cleared separately by running the fallback once per mode.

Replace MODE with the specific mode (e.g. ralplan, ralph, ultrawork, ultraqa).

WARNING: Do NOT use this fallback for autopilot or omc-teams. Autopilot requires state_write(active=false) to preserve resume data. omc-teams requires tmux session cleanup that cannot be done via file deletion alone.

# Fallback: direct file removal when state_clear MCP tool is unavailable
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"; })"

# Cross-platform SHA-256 (macOS: shasum, Linux: sha256sum)
sha256portable() { printf '%s' "$1" | (sha256sum 2>/dev/null || shasum -a 256) | cut -c1-16; }

# Resolve state directory (supports OMC_STATE_DIR centralized storage)
if [ -n "${OMC_STATE_DIR:-}" ]; then
  # Mirror getProjectIdentifier() from worktree-paths.ts
  SOURCE="$(git remote get-url origin 2>/dev/null || echo "$REPO_ROOT")"
  HASH="$(sha256portable "$SOURCE")"
  DIR_NAME="$(basename "$REPO_ROOT" | sed 's/[^a-zA-Z0-9_-]/_/g')"
  OMC_STATE="$OMC_STATE_DIR/${DIR_NAME}-${HASH}/state"
  [ ! -d "$OMC_STATE" ] && { echo "ERROR: State dir not found at $OMC_STATE" >&2; exit 1; }
elif [ "$REPO_ROOT" != "/" ] && [ -d "$REPO_ROOT/.omc" ]; then
  OMC_STATE="$REPO_ROOT/.omc/state"
else
  echo "ERROR: Could not locate .omc state directory" >&2
  exit 1
fi
MODE="ralplan"  # <-- replace with the target mode

# Clear session-scoped state for the specific mode
if [ -n "$SESSION_ID" ] && [ -d "$OMC_STATE/sessions/$SESSION_ID" ]; then
  rm -f "$OMC_STATE/sessions/$SESSION_ID/${MODE}-state.json"
  rm -f "$OMC_STATE/sessions/$SESSION_ID/${MODE}-stop-breaker.json"
  # Write cancel signal so stop hook detects cancellation in progress
  NOW_ISO="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
  EXPIRES_ISO="$(date -u -d "+30 seconds" +"%Y-%m-%dT%H:%M:%SZ" 2>/dev/null || python3 - <<'PY'\nfrom datetime import datetime, timedelta, timezone\nprint((datetime.now(timezone.utc) + timedelta(seconds=30)).strftime('%Y-%m-%dT%H:%M:%SZ'))\nPY\n)"
  printf '{"active":true,"requested_at":"%s","expires_at":"%s","mode":"%s","source":"bash_fallback"}' \
    "$NOW_ISO" "$EXPIRES_ISO" "$MODE" > "$OMC_STATE/sessions/$SESSION_ID/cancel-signal-state.json"
fi

# Clear legacy state only if no session ID (avoid clearing another session's state)
if [ -z "$SESSION_ID" ]; then
  rm -f "$OMC_STATE/${MODE}-state.json"
fi

Auto-Detection

/oh-my-claudecode:cancel follows the session-aware state contract:

  • By default the command inspects the current session via state_list_active and state_get_status, navigating .omc/state/sessions/{sessionId}/… to discover which mode is active.
  • When a session id is provided or already known, that session-scoped path is authoritative. Legacy files in .omc/state/*.json are consulted only as a compatibility fallback if the session id is missing or empty.
  • Swarm is a shared SQLite/marker mode (.omc/state/swarm.db / .omc/state/swarm-active.marker) and is not session-scoped.
  • The default cleanup flow calls state_clear with the session id to remove only the matching session files; modes stay bound to their originating session.

Active modes are still cancelled in dependency order:

  1. Autopilot (includes linked ralph/ultraqa/ cleanup)
  2. Ralph (cleans its linked ultrawork or )
  3. Ultrawork (standalone)
  4. UltraQA (standalone)
  5. Swarm (standalone)
  6. Ultrapilot (standalone)
  7. Pipeline (standalone)
  8. Team (Claude Code native)
  9. OMC Teams (tmux CLI workers)
  10. Plan Consensus (standalone)
  11. Self-Improve (standalone — clear state, clean orphaned worktrees, preserve iteration_state for resume, set status: "user_stopped" in .omc/self-improve/state/agent-settings.json)

Force Clear All

Use --force or --all when you need to erase every session plus legacy artifacts, e.g., to reset the workspace entirely.

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

Steps under the hood:

  1. state_list_active enumerates .omc/state/sessions/{sessionId}/… to find every known session.
  2. state_clear runs once per session to drop that session’s files.
  3. A global state_clear without session_id removes legacy files under .omc/state/*.json, .omc/state/swarm*.db, and compatibility artifacts (see list).
  4. Team artifacts (~/.claude/teams/*/, ~/.claude/tasks/*/, .omc/state/team-state.json) are best-effort cleared as part of the legacy fallback.
    • Cancel for native team does NOT affect omc-teams state, and vice versa.

Every state_clear command honors the session_id argument, so even force mode still uses the session-aware paths first before deleting legacy files.

Legacy compatibility list (removed only under --force/--all):

  • .omc/state/autopilot-state.json
  • .omc/state/ralph-state.json
  • .omc/state/ralph-plan-state.json
  • .omc/state/ralph-verification.json
  • .omc/state/ultrawork-state.json
  • .omc/state/ultraqa-state.json
  • .omc/state/swarm.db
  • .omc/state/swarm.db-wal
  • .omc/state/swarm.db-shm
  • .omc/state/swarm-active.marker
  • .omc/state/swarm-tasks.db
  • .omc/state/ultrapilot-state.json
  • .omc/state/ultrapilot-ownership.json
  • .omc/state/pipeline-state.json
  • .omc/state/omc-teams-state.json
  • .omc/state/plan-consensus.json
  • .omc/state/ralplan-state.json
  • .omc/state/boulder.json
  • .omc/state/hud-state.json
  • .omc/state/subagent-tracking.json
  • .omc/state/subagent-tracker.lock
  • .omc/state/rate-limit-daemon.pid
  • .omc/state/rate-limit-daemon.log
  • .omc/state/checkpoints/ (directory)
  • .omc/state/sessions/ (empty directory cleanup after clearing sessions)

Implementation Steps

When you invoke this skill:

1. Parse Arguments

# Check for --force or --all flags
FORCE_MODE=false
if [[ "$*" == *"--force"* ]] || [[ "$*" == *"--all"* ]]; then
  FORCE_MODE=true
fi

2. Detect Active Modes

The skill now relies on the session-aware state contract rather than hard-coded file paths:

  1. Call state_list_active to enumerate .omc/state/sessions/{sessionId}/… and discover every active session.
  2. For each session id, call state_get_status to learn which mode is running (autopilot, ralph, ultrawork, etc.) and whether dependent modes exist.
  3. If a session_id was supplied to /oh-my-claudecode:cancel, skip legacy fallback entirely and operate solely within that session path; otherwise, consult legacy files in .omc/state/*.json only if the state tools report no active session. Swarm remains a shared SQLite/marker mode outside session scoping.
  4. Any cancellation logic in this doc mirrors the dependency order discovered via state tools (autopilot → ralph → …).

3A. Force Mode (if --force or --all)

Use force mode to clear every session plus legacy artifacts via state_clear. Direct file removal is reserved for legacy cleanup when the state tools report no active sessions.

3B. Smart Cancellation (default)

If Team Active (Claude Code native)

Teams are detected by checking for config files in ~/.claude/teams/:

# Check for active teams
TEAM_CONFIGS=$(find ~/.claude/teams -name config.json -maxdepth 2 2>/dev/null)

Two-pass cancellation protocol:

Pass 1: Graceful Shutdown

For each team found in ~/.claude/teams/:
  1. Read config.json to get team_name and members list
  2. For each non-lead member:
     a. Send shutdown_request via SendMessage
     b. Wait up to 15 seconds for shutdown_response
     c. If response received: member terminates and is auto-removed
     d. If timeout: mark member as unresponsive, continue to next
  3. Log: "Graceful pass: X/Y members responded"

Pass 2: Reconciliation

After graceful pass:
  1. Re-read config.json to check remaining members
  2. If only lead remains (or config is empty): proceed to TeamDelete
  3. If unresponsive members remain:
     a. Wait 5 more seconds (they may still be processing)
     b. Re-read config.json again
     c. If still stuck: attempt TeamDelete anyway
     d. If TeamDelete fails: report manual cleanup path

TeamDelete + Cleanup:

  1. Call TeamDelete() — removes ~/.claude/teams/{name}/ and ~/.claude/tasks/{name}/
  2. Clear team state: state_clear(mode="team")
  3. Check for linked ralph: state_read(mode="ralph") — if linked_team is true:
     a. Clear ralph state: state_clear(mode="ralph")
     b. Clear linked ultrawork if present: state_clear(mode="ultrawork")
  4. Run orphan scan (see below)
  5. Emit structured cancel report

Orphan Detection (Post-Cleanup):

After TeamDelete, verify no agent processes remain:

node 
how to use cancel

How to use cancel on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add cancel
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/yeachan-heo/oh-my-claudecode --skill cancel

The skills CLI fetches cancel from GitHub repository yeachan-heo/oh-my-claudecode and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/cancel

Reload or restart Cursor to activate cancel. Access the skill through slash commands (e.g., /cancel) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

User Story & Requirements Generation

Create detailed user stories, acceptance criteria, and feature specs

Example

Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios

Reduce spec writing time by 50%, ensure comprehensive coverage

Competitive Analysis

Research competitors, compare features, identify gaps

Example

Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities

Complete competitive research in 2 hours instead of 2 days

Roadmap Prioritization

Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs

Example

Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale

Make data-driven prioritization decisions faster

Stakeholder Communication

Draft PRDs, status updates, and stakeholder presentations

Example

Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement

Save 3-5 hours/week on communication overhead

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client
  • Access to product documentation and roadmap tools (Jira, Notion, etc.)
  • Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
  • Stakeholder contact information and communication channels

Time Estimate

30-60 minutes to see productivity improvements

Installation Steps

  1. 1.Install product management skill
  2. 2.Start with user story generation for known feature
  3. 3.Progress to competitive analysis: research 2-3 competitors
  4. 4.Use for roadmap prioritization: apply RICE/ICE scoring
  5. 5.Draft stakeholder communications and refine based on feedback
  6. 6.Build template library for recurring PM tasks
  7. 7.Share effective prompts with product team

Common Pitfalls

  • Not validating competitive research—verify facts before sharing
  • Accepting user stories without involving engineering team
  • Over-relying on frameworks without qualitative judgment
  • Not customizing outputs to company culture and communication style
  • Skipping stakeholder validation of generated requirements

Best Practices

✓ Do

  • +Validate research and competitive analysis with real data
  • +Collaborate with engineering when generating technical requirements
  • +Customize frameworks and templates to your company context
  • +Use skill for first drafts, refine with stakeholder input
  • +Document successful prompt patterns for PM tasks
  • +Combine AI efficiency with human judgment and intuition

✗ Don't

  • Don't publish competitive analysis without fact-checking
  • Don't finalize user stories without engineering review
  • Don't make prioritization decisions solely on AI scoring
  • Don't skip customer validation of generated requirements
  • Don't ignore company-specific context and culture

💡 Pro Tips

  • Provide context: company goals, constraints, customer feedback
  • Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
  • Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
  • Use skill for 70% generation + 30% customization to company needs

When to Use This

✓ Use When

Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.

✗ Avoid When

Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.

Learning Path

  1. 1Basic: user stories, feature specs, status updates
  2. 2Intermediate: competitive analysis, prioritization frameworks, PRDs
  3. 3Advanced: product strategy, go-to-market planning, OKR setting
  4. 4Expert: product vision, market positioning, business model innovation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.761 reviews
  • Aarav Nasser· Dec 24, 2024

    cancel is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Kabir Anderson· Dec 24, 2024

    Solid pick for teams standardizing on skills: cancel is focused, and the summary matches what you get after install.

  • Aanya Lopez· Dec 8, 2024

    Keeps context tight: cancel is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Aarav Rahman· Dec 4, 2024

    cancel is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Kabir Thomas· Nov 27, 2024

    cancel has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • James Yang· Nov 23, 2024

    I recommend cancel for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Zaid Agarwal· Nov 23, 2024

    Solid pick for teams standardizing on skills: cancel is focused, and the summary matches what you get after install.

  • Aarav Zhang· Nov 19, 2024

    Useful defaults in cancel — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • James Gupta· Nov 15, 2024

    Solid pick for teams standardizing on skills: cancel is focused, and the summary matches what you get after install.

  • James Huang· Nov 15, 2024

    cancel is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

showing 1-10 of 61

1 / 7