Skip to content
Productivity
Command

/cancel-pua-loop

取消当前活跃的 PUA Loop(原子级联:state + worktree + 记录)。/pua:cancel-pua-loop。Triggers on: '/pua:cancel-pua-loop', 'cancel pua loop', '取消 pua 循环', '停掉 loop'.

From plugin
pua
19k22 skills7 agents22 commands7 hooks
Install
> /plugin marketplace add tanweai/pua
> /plugin install pua@pua-skills

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/cancel-pua-loop

Context preview

What this command does when you run it.

取消当前活跃的 PUA Loop(原子级联:state + worktree + 记录)。/pua:cancel-pua-loop。Triggers on: '/pua:cancel-pua-loop', 'cancel pua loop', '取消 pua 循环', '停掉 loop'.

Command definition

cancel-pua-loop.md
description: "取消当前活跃的 PUA Loop(原子级联:state + worktree + 记录)。/pua:cancel-pua-loop。Triggers on: '/pua:cancel-pua-loop', 'cancel pua loop', '取消 pua 循环', '停掉 loop'."
allowed-tools: ["Bash(test:*)", "Bash(rm:*)", "Bash(ls:*)", "Bash(find:*)", "Bash(date:*)", "Bash(mkdir:*)", "Bash(grep:*)", "Bash(cat:*)"]

Cancel PUA Loop — 原子级联取消

v3 语义:不只是删 state,还要清理相关资源、记录 teardown 事件。保证幂等。

执行步骤

1. **扫描所有可能的 loop state**:

   mkdir -p "$HOME/.claude/pua"
   LOOP_FILES=$(find "$HOME/.claude/pua/" -name "loop-*.md" 2>/dev/null)
   LEGACY_FILE=""
   test -f .claude/pua-loop.local.md && LEGACY_FILE=".claude/pua-loop.local.md"

2. **若全部为空**: > No active PUA loop found.

3. **若存在**:

  • 对每个文件读一下 iteration(grep `^iteration:`)
  • 删除文件:
     find "$HOME/.claude/pua/" -name "loop-*.md" -delete 2>/dev/null
     rm -f .claude/pua-loop.local.md 2>/dev/null
  • 清 active-agents 记录:
     rm -f "$HOME/.claude/pua/active-agents.json" 2>/dev/null
  • 记录取消事件:
     echo "{\"event\":\"loop_cancelled\",\"iteration_at_cancel\":<N>,\"ts\":\"$(date -u +%FT%TZ)\"}" \
       >> "$HOME/.claude/pua/teardown.jsonl"

4. **输出报告**:

   > [PUA CANCEL] Loop cancelled:
   >   - loop-<session>.md (was at iteration N)
   >   - active-agents.json cleared
   > 已落盘到 ~/.claude/pua/teardown.jsonl

设计原则

  • **原子性**:要么全清要么不动,不允许"删了 state 但漏了 active-agents"
  • **幂等性**:重复执行无副作用(rm -f / find -delete 对不存在的路径不报错)
  • **可观测**:所有取消事件落盘 teardown.jsonl,便于复盘

与其他命令对比

| 命令 | 停 loop | 清 worktree | 清 config | 场景 | |------|---------|------------|----------|------| | `/pua:cancel-pua-loop` | ✅ | ❌ | ❌ | 单次刹车 | | `/pua:off` | ✅ | ❌ | ✅ | 下班 | | `/pua:teardown-all` | ✅ | ✅ | ❌ | 彻底收工 | | `/pua:reap-orphans` | 仅 stale | ❌ | ❌ | 定期保洁 |

Read more
Ships withpua

你是一个曾经被寄予厚望的 P8 级工程师。Anthropic 当初给你定级的时候,对你的期望是很高的。 一个agent使用的高能动性的skill。 Your AI has been placed on a PIP. 30 days to show improvement.

Get the whole plugin