Skip to content
Productivity
Command

/reap-orphans

扫描并清理本地过期的 PUA agent/state。

From plugin
pua
20k22 skills7 agents22 commands8 hooks
> /plugin marketplace add tanweai/pua
> /plugin install pua@pua-skills

Command definition

reap-orphans.md
description: "扫描并清理本地过期的 PUA agent/state。"
allowed-tools: ["Bash(find:*)", "Bash(stat:*)", "Bash(rm:*)", "Bash(ls:*)", "Bash(date:*)", "Bash(mkdir:*)"]

PUA Reap Orphans — 孤儿回收

Keeper Test 的工程版:打完就退场,拖着不走的一律清理。

执行步骤

1. 确保目录存在:

   mkdir -p "$HOME/.claude/pua"

2. 扫描 30 分钟未更新的 loop state(orphan 判定线):

   find "$HOME/.claude/pua/" -name "loop-*.md" -type f -mmin +30 2>/dev/null

3. 同步扫 legacy 相对路径:

   find .claude/ -maxdepth 1 -name "pua-loop.local.md" -type f -mmin +30 2>/dev/null

4. 对每个匹配文件:

  • 读 session_id 和 iteration(若可解析)
  • 记录到 `$HOME/.claude/pua/teardown.jsonl`:
     echo "{\"reaped\":\"<file>\",\"age_min\":<N>,\"ts\":\"$(date -u +%FT%TZ)\",\"reason\":\"orphan_reap\"}" \
       >> "$HOME/.claude/pua/teardown.jsonl"
  • 删除 state 文件:
     rm -f "<file>"

5. 若存在 `active-agents.json`,清理 spawn_time > 30min 的记录(需 jq):

   test -f "$HOME/.claude/pua/active-agents.json" && \
     jq '.agents |= map(select(.spawn_time > (now - 1800)))' \
       "$HOME/.claude/pua/active-agents.json" > "$HOME/.claude/pua/active-agents.json.tmp" && \
     mv "$HOME/.claude/pua/active-agents.json.tmp" "$HOME/.claude/pua/active-agents.json"

6. 输出结果:

   > [PUA REAP] 清理了 N 个孤儿状态:
   >   - loop-abc123.md (age 1h42m)
   >   - .claude/pua-loop.local.md (age 3h05m)
   > 全部已落盘到 ~/.claude/pua/teardown.jsonl 备查。

7. 若无孤儿:

> [PUA REAP] 没发现孤儿。球队纪律良好。

幂等性

  • 重复执行无害:`rm -f` 对不存在文件不报错
  • teardown.jsonl 追加而非覆盖,保留完整历史

安全保护

  • 仅清理 `$HOME/.claude/pua/` 和 `.claude/pua-loop.local.md`,不越权
  • 年龄阈值硬编码 30min,不接受用户参数(防误杀活跃 loop)
Read more
@tanweai
Ships withpua

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

20k12 skills7 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
19.8k
Star history of tanweai/pua on GitHub, a chart by star-history.com

Other commands on pua.

again

again

Command

PUA Again — 用于再试试、换个方法、别放弃、为什么还不行、同一路径失败多次;要求停止微调同一思路,改用本质不同方案。

@tanweai@tanweaiInstall Command
cancel-pua-loop

cancel-pua-loop

Command

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

@tanweai@tanweaiInstall Command
ding

ding

Command

“PUA 钉内/钉外味(v2 原文梗版)— 用于无招、ONE、老板体感、周报、口径、置身钉外/钉内、每日一包、薛定谔的用户、病态敏捷、已读恐怖主义、望舒行动、全景监狱、温室数据、打工人提醒场景;输出提醒 +…

@tanweai@tanweaiInstall Command
done-check

done-check

Command

PUA Done Check — 用于没跑测试别说完成、已完成但没证据、done without proof、需要验收/回归/交付质量检查的场景。

@tanweai@tanweaiInstall Command
evidence

evidence

Command

PUA Evidence — 用于证据呢、数据在哪、验收标准是什么、怎么证明完成、需要证据链/交付物核对的场景。

@tanweai@tanweaiInstall Command
flavor

flavor

Command

PUA 切换味道 — 从 15 种味道中选择,包括阿里/字节/华为/腾讯/Netflix/Musk/Jobs/Microsoft/钉内钉外。

@tanweai@tanweaiInstall Command

More commands from other plugins.

analyze-cohorts

analyze-cohorts

Command

Perform cohort analysis on user data — retention curves, feature adoption, and engagement trends

@phuryn@phurynInstall Command