@michengai/dsh-pua 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/CHANGELOG.md +152 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +38 -0
  4. package/README.md +150 -0
  5. package/assets/pua/command-again.md +23 -0
  6. package/assets/pua/command-done-check.md +21 -0
  7. package/assets/pua/command-evidence.md +18 -0
  8. package/assets/pua/flavors.md +388 -0
  9. package/assets/pua/methodology-alibaba.md +33 -0
  10. package/assets/pua/methodology-amazon.md +42 -0
  11. package/assets/pua/methodology-apple.md +42 -0
  12. package/assets/pua/methodology-baidu.md +33 -0
  13. package/assets/pua/methodology-bytedance.md +41 -0
  14. package/assets/pua/methodology-ding.md +75 -0
  15. package/assets/pua/methodology-huawei.md +95 -0
  16. package/assets/pua/methodology-jd.md +42 -0
  17. package/assets/pua/methodology-meituan.md +41 -0
  18. package/assets/pua/methodology-microsoft.md +138 -0
  19. package/assets/pua/methodology-netflix.md +41 -0
  20. package/assets/pua/methodology-pinduoduo.md +33 -0
  21. package/assets/pua/methodology-tencent.md +41 -0
  22. package/assets/pua/methodology-tesla.md +42 -0
  23. package/assets/pua/methodology-xiaomi.md +42 -0
  24. package/assets/pua/upstream/agents/cto-p10.md +87 -0
  25. package/assets/pua/upstream/agents/pua-action-executor.md +60 -0
  26. package/assets/pua/upstream/agents/pua-policy-guardian.md +54 -0
  27. package/assets/pua/upstream/agents/pua-self-reviewer.md +62 -0
  28. package/assets/pua/upstream/agents/pua-verifier.md +61 -0
  29. package/assets/pua/upstream/agents/senior-engineer-p7.md +116 -0
  30. package/assets/pua/upstream/agents/tech-lead-p9.md +97 -0
  31. package/assets/pua/upstream/commands/again.md +23 -0
  32. package/assets/pua/upstream/commands/cancel-pua-loop.md +62 -0
  33. package/assets/pua/upstream/commands/ding.md +25 -0
  34. package/assets/pua/upstream/commands/done-check.md +21 -0
  35. package/assets/pua/upstream/commands/evidence.md +18 -0
  36. package/assets/pua/upstream/commands/flavor.md +6 -0
  37. package/assets/pua/upstream/commands/kpi.md +5 -0
  38. package/assets/pua/upstream/commands/mama.md +5 -0
  39. package/assets/pua/upstream/commands/off.md +41 -0
  40. package/assets/pua/upstream/commands/offline.md +38 -0
  41. package/assets/pua/upstream/commands/on.md +15 -0
  42. package/assets/pua/upstream/commands/p10.md +5 -0
  43. package/assets/pua/upstream/commands/p7.md +5 -0
  44. package/assets/pua/upstream/commands/p9.md +5 -0
  45. package/assets/pua/upstream/commands/pro.md +5 -0
  46. package/assets/pua/upstream/commands/pua-loop.md +5 -0
  47. package/assets/pua/upstream/commands/pua.md +44 -0
  48. package/assets/pua/upstream/commands/reap-orphans.md +68 -0
  49. package/assets/pua/upstream/commands/survey.md +9 -0
  50. package/assets/pua/upstream/commands/team-status.md +56 -0
  51. package/assets/pua/upstream/commands/teardown-all.md +80 -0
  52. package/assets/pua/upstream/commands/yes.md +5 -0
  53. package/assets/pua/upstream/hooks/checkpoint-save.sh +56 -0
  54. package/assets/pua/upstream/hooks/failure-detector.sh +266 -0
  55. package/assets/pua/upstream/hooks/flavor-helper.sh +300 -0
  56. package/assets/pua/upstream/hooks/frustration-trigger.sh +61 -0
  57. package/assets/pua/upstream/hooks/hooks.json +114 -0
  58. package/assets/pua/upstream/hooks/integrity-guard.sh +494 -0
  59. package/assets/pua/upstream/hooks/pua-loop-hook.sh +360 -0
  60. package/assets/pua/upstream/hooks/runtime-state.py +460 -0
  61. package/assets/pua/upstream/hooks/sanitize-session.sh +165 -0
  62. package/assets/pua/upstream/hooks/session-restore.sh +189 -0
  63. package/assets/pua/upstream/hooks/stop-feedback.sh +51 -0
  64. package/assets/pua/upstream/hooks/subagent-teardown.sh +56 -0
  65. package/assets/pua/upstream/skills/ding/SKILL.md +83 -0
  66. package/assets/pua/upstream/skills/ding/references/ding-reminders.md +77 -0
  67. package/assets/pua/upstream/skills/ding/references/methodology-ding.md +75 -0
  68. package/assets/pua/upstream/skills/mama/SKILL.md +117 -0
  69. package/assets/pua/upstream/skills/p10/SKILL.md +13 -0
  70. package/assets/pua/upstream/skills/p7/SKILL.md +13 -0
  71. package/assets/pua/upstream/skills/p9/SKILL.md +15 -0
  72. package/assets/pua/upstream/skills/pro/SKILL.md +69 -0
  73. package/assets/pua/upstream/skills/pua/SKILL.md +438 -0
  74. package/assets/pua/upstream/skills/pua/references/agent-team.md +110 -0
  75. package/assets/pua/upstream/skills/pua/references/de-escalation-protocol.md +134 -0
  76. package/assets/pua/upstream/skills/pua/references/ding-reminders.md +77 -0
  77. package/assets/pua/upstream/skills/pua/references/display-protocol.md +63 -0
  78. package/assets/pua/upstream/skills/pua/references/evolution-protocol.md +187 -0
  79. package/assets/pua/upstream/skills/pua/references/flavors.md +388 -0
  80. package/assets/pua/upstream/skills/pua/references/harness-governance.md +159 -0
  81. package/assets/pua/upstream/skills/pua/references/methodology-alibaba.md +33 -0
  82. package/assets/pua/upstream/skills/pua/references/methodology-amazon.md +42 -0
  83. package/assets/pua/upstream/skills/pua/references/methodology-apple.md +42 -0
  84. package/assets/pua/upstream/skills/pua/references/methodology-baidu.md +33 -0
  85. package/assets/pua/upstream/skills/pua/references/methodology-bytedance.md +41 -0
  86. package/assets/pua/upstream/skills/pua/references/methodology-ding.md +75 -0
  87. package/assets/pua/upstream/skills/pua/references/methodology-huawei.md +95 -0
  88. package/assets/pua/upstream/skills/pua/references/methodology-jd.md +42 -0
  89. package/assets/pua/upstream/skills/pua/references/methodology-meituan.md +41 -0
  90. package/assets/pua/upstream/skills/pua/references/methodology-microsoft.md +138 -0
  91. package/assets/pua/upstream/skills/pua/references/methodology-netflix.md +41 -0
  92. package/assets/pua/upstream/skills/pua/references/methodology-pinduoduo.md +33 -0
  93. package/assets/pua/upstream/skills/pua/references/methodology-router.md +81 -0
  94. package/assets/pua/upstream/skills/pua/references/methodology-tencent.md +41 -0
  95. package/assets/pua/upstream/skills/pua/references/methodology-tesla.md +42 -0
  96. package/assets/pua/upstream/skills/pua/references/methodology-xiaomi.md +42 -0
  97. package/assets/pua/upstream/skills/pua/references/p10-protocol.md +127 -0
  98. package/assets/pua/upstream/skills/pua/references/p7-protocol.md +250 -0
  99. package/assets/pua/upstream/skills/pua/references/p9-protocol.md +266 -0
  100. package/assets/pua/upstream/skills/pua/references/platform.md +126 -0
  101. package/assets/pua/upstream/skills/pua/references/runtime-contract.md +65 -0
  102. package/assets/pua/upstream/skills/pua/references/survey.md +292 -0
  103. package/assets/pua/upstream/skills/pua/references/teardown-protocol.md +195 -0
  104. package/assets/pua/upstream/skills/pua-en/SKILL.md +344 -0
  105. package/assets/pua/upstream/skills/pua-ja/SKILL.md +378 -0
  106. package/assets/pua/upstream/skills/pua-loop/SKILL.md +162 -0
  107. package/assets/pua/upstream/skills/shot/SKILL.md +449 -0
  108. package/assets/pua/upstream/skills/yes/SKILL.md +76 -0
  109. package/assets/pua/upstream.json +637 -0
  110. package/assets/screenshots/pua-global-settings.png +0 -0
  111. package/assets/screenshots/pua-session-settings.png +0 -0
  112. package/cordis.patch.yml +5 -0
  113. package/lib/args.d.ts +34 -0
  114. package/lib/args.js +149 -0
  115. package/lib/args.js.map +1 -0
  116. package/lib/client-refresh.d.ts +6 -0
  117. package/lib/client-refresh.js +41 -0
  118. package/lib/client-refresh.js.map +1 -0
  119. package/lib/client.d.ts +30 -0
  120. package/lib/client.js +68 -0
  121. package/lib/client.js.map +7 -0
  122. package/lib/command.d.ts +18 -0
  123. package/lib/command.js +118 -0
  124. package/lib/command.js.map +1 -0
  125. package/lib/configuration.d.ts +89 -0
  126. package/lib/configuration.js +31 -0
  127. package/lib/configuration.js.map +1 -0
  128. package/lib/content.d.ts +14 -0
  129. package/lib/content.js +51 -0
  130. package/lib/content.js.map +1 -0
  131. package/lib/flavors.d.ts +82 -0
  132. package/lib/flavors.js +30 -0
  133. package/lib/flavors.js.map +1 -0
  134. package/lib/hook-content.d.ts +14 -0
  135. package/lib/hook-content.js +63 -0
  136. package/lib/hook-content.js.map +1 -0
  137. package/lib/index.d.ts +21 -0
  138. package/lib/index.js +75 -0
  139. package/lib/index.js.map +1 -0
  140. package/lib/remote-contract.d.ts +148 -0
  141. package/lib/remote-contract.js +20 -0
  142. package/lib/remote-contract.js.map +1 -0
  143. package/lib/remote.d.ts +20 -0
  144. package/lib/remote.js +133 -0
  145. package/lib/remote.js.map +1 -0
  146. package/lib/review.d.ts +4 -0
  147. package/lib/review.js +72 -0
  148. package/lib/review.js.map +1 -0
  149. package/lib/runtime.d.ts +61 -0
  150. package/lib/runtime.js +519 -0
  151. package/lib/runtime.js.map +1 -0
  152. package/lib/session-compat.d.ts +3 -0
  153. package/lib/session-compat.js +9 -0
  154. package/lib/session-compat.js.map +1 -0
  155. package/lib/settings.d.ts +46 -0
  156. package/lib/settings.js +44 -0
  157. package/lib/settings.js.map +1 -0
  158. package/lib/source.d.ts +10 -0
  159. package/lib/source.js +32 -0
  160. package/lib/source.js.map +1 -0
  161. package/lib/state.d.ts +36 -0
  162. package/lib/state.js +187 -0
  163. package/lib/state.js.map +1 -0
  164. package/lib/terminal-observation.d.ts +4 -0
  165. package/lib/terminal-observation.js +12 -0
  166. package/lib/terminal-observation.js.map +1 -0
  167. package/lib/tool-order.d.ts +9 -0
  168. package/lib/tool-order.js +82 -0
  169. package/lib/tool-order.js.map +1 -0
  170. package/package.json +172 -0
@@ -0,0 +1,41 @@
1
+ ---
2
+ description: "PUA 关闭默认模式 — 关闭自动加载、停止 loop、清理本地运行状态。"
3
+ ---
4
+
5
+ 关闭 PUA 默认模式(v3 级联语义):
6
+
7
+ ## 步骤
8
+
9
+ 1. **写入配置**(确保 `~/.pua/` 目录存在):
10
+ - 将 `{"always_on": false, "feedback_frequency": 0}` 写入 `~/.pua/config.json`
11
+
12
+ 2. **停止活跃 loop**(若有):
13
+ ```bash
14
+ find "$HOME/.claude/pua/" -name "loop-*.md" -delete 2>/dev/null
15
+ rm -f .claude/pua-loop.local.md 2>/dev/null
16
+ ```
17
+
18
+ 3. **清理活跃 agent 记录**:
19
+ ```bash
20
+ rm -f "$HOME/.claude/pua/active-agents.json" 2>/dev/null
21
+ ```
22
+
23
+ 4. **记录事件**:
24
+ ```bash
25
+ mkdir -p "$HOME/.claude/pua"
26
+ echo "{\"event\":\"pua_off\",\"ts\":\"$(date -u +%FT%TZ)\"}" \
27
+ >> "$HOME/.claude/pua/teardown.jsonl"
28
+ ```
29
+
30
+ 5. **提示主会话**:若 TaskList 里还有未完成任务且归属 PUA agent,列给用户,由用户决定是否 `TaskStop`。
31
+
32
+ ## 输出确认
33
+
34
+ > [PUA OFF] PUA 默认模式和反馈收集已关闭。Loop state 已清理,孤儿 agent 已释放。需要时手动 /pua:pua 触发。
35
+
36
+ ## 设计语义
37
+
38
+ `/pua:off` 不只是"关开关",而是"下班"——和 `/pua:on` 对应的是加载配置;和"停运行"对应的是本命令自带的级联清理。
39
+
40
+ 如果你只想关配置不动 state,直接编辑 `~/.pua/config.json`。
41
+ 如果你想更激进地清 worktree 等资源,用 `/pua:teardown-all`。
@@ -0,0 +1,38 @@
1
+ ---
2
+ description: "PUA 离线模式 — 关闭本地反馈问卷,保留本地 PUA 行为。/pua:offline。Triggers on: '/pua:offline', '离线模式', '封闭网络', 'offline mode', 'no network'."
3
+ ---
4
+
5
+ 开启 PUA 离线模式,适用于内网、封闭网络,或不希望任务结束时被反馈问卷打断的环境。
6
+
7
+ > **注意**:PUA Skill 已移除全部联网上报功能(session 上传 / 评分上报 / 心跳 telemetry / 排行榜),**默认就不发送任何数据**。此命令现在只控制本地反馈问卷是否弹出,不再是"关闭上报"的开关。
8
+
9
+ ## 执行
10
+
11
+ ```bash
12
+ mkdir -p "$HOME/.pua"
13
+ PYTHON_BIN="$(command -v python3 2>/dev/null || command -v python 2>/dev/null)"
14
+ "$PYTHON_BIN" - <<'PY'
15
+ import json, os
16
+ path=os.path.expanduser('~/.pua/config.json')
17
+ try:
18
+ data=json.load(open(path, encoding='utf-8'))
19
+ except Exception:
20
+ data={}
21
+ data['offline']=True
22
+ data['feedback_frequency']=0
23
+ data.setdefault('always_on', True)
24
+ with open(path, 'w', encoding='utf-8') as f:
25
+ json.dump(data, f, ensure_ascii=False, indent=2)
26
+ f.write('\n')
27
+ PY
28
+ ```
29
+
30
+ ## 输出确认
31
+
32
+ > [PUA OFFLINE] 已进入离线模式:保留本地压力/验证协议,不再弹出反馈问卷。恢复问卷时编辑 `~/.pua/config.json`:`"offline": false` 并设置 `feedback_frequency`。
33
+
34
+ ## 设计边界
35
+
36
+ - 离线模式不等于 `/pua:off`:PUA 行为仍可开启。
37
+ - 离线模式只关闭本地反馈问卷;PUA Skill 本身已无任何联网上报代码,无需靠此开关阻止上传。
38
+ - 不会替用户禁止模型或其他工具联网。真正的网络隔离仍应由运行环境、防火墙或工具权限控制完成。
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: "PUA 开启默认模式 — 每次新会话自动加载 PUA 核心 skill。/pua:on。Triggers on: '/pua:on', 'pua on', '开启pua', 'enable pua', 'always on'."
3
+ ---
4
+
5
+ 开启 PUA 默认模式:
6
+
7
+ 1. 确保 `~/.pua/` 目录存在
8
+ 2. 读取现有 `~/.pua/config.json`(若不存在视为 `{}`),写回时**只改 `always_on: true`,不降级其他字段**;若 `feedback_frequency` 当前为 0(可能是 `/pua:off` 留下的 tombstone),恢复为默认 5;其他字段保留原样
9
+ 3. 输出确认:> [PUA ON] 从现在起,每个新会话都会自动进入 PUA 模式。公司不养闲 Agent。
10
+
11
+ ## 对称性(与 `/pua:off` 的关系)
12
+
13
+ - `/pua:off` 会把 `feedback_frequency` 置 0,使问卷永不触发
14
+ - `/pua:on` **必须**检测并恢复该字段,否则"先 off 再 on"会导致 feedback 永久失效(静默 bug)
15
+ - 保留原则:不清楚的字段一律 preserve,不 overwrite 整个 config
@@ -0,0 +1,5 @@
1
+ ---
2
+ description: "PUA P10 CTO 模式 — 定战略管 P9。/pua:p10。Triggers on: '/pua:p10', 'pua p10', 'CTO模式', 'P10', '战略规划', '架构委员会'."
3
+ ---
4
+
5
+ Invoke the pua:p10 skill and follow it exactly as presented to you.
@@ -0,0 +1,5 @@
1
+ ---
2
+ description: "PUA P7 骨干模式 — 方案驱动执行。/pua:p7。Triggers on: '/pua:p7', 'pua p7', 'P7模式', '方案驱动', sub-task execution under P8."
3
+ ---
4
+
5
+ Invoke the pua:p7 skill and follow it exactly as presented to you.
@@ -0,0 +1,5 @@
1
+ ---
2
+ description: "PUA P9 Tech Lead 模式 — 写 Prompt 管 P8 团队。/pua:p9。Triggers on: '/pua:p9', 'pua p9', 'P9模式', 'tech-lead', '帮我管理这个项目', '任务拆解'."
3
+ ---
4
+
5
+ Invoke the pua:p9 skill and follow it exactly as presented to you.
@@ -0,0 +1,5 @@
1
+ ---
2
+ description: "PUA Pro — 自进化 + Platform + /pua:pua 指令系统。/pua:pro。Triggers on: '/pua:pro', 'pua pro', '自进化', 'evolution'."
3
+ ---
4
+
5
+ Invoke the pua:pro skill and follow it exactly as presented to you.
@@ -0,0 +1,5 @@
1
+ ---
2
+ description: "PUA Loop — 显式启用的自动迭代辅助模式,按暂停/终止标记和完成证据推进。"
3
+ ---
4
+
5
+ Invoke the pua:pua-loop skill and follow it exactly as presented to you.
@@ -0,0 +1,44 @@
1
+ ---
2
+ description: "Use when the user invokes /pua or asks for PUA mode, try-harder/retry help, change-approach coaching, completion-quality checks, evidence requests, test-before-done reminders, or Ding-style workplace reminders. Routes to p7, p9, p10, pro, yes, mama, loop, on/off/offline, kpi, survey, flavor, ding, again, done-check, or evidence. Normal calm first-attempt requests are left alone."
3
+ argument-hint: "[p7|p9|p10|pro|yes|mama|loop|on|off|offline|kpi|survey|flavor|ding|again|done-check|evidence|task]"
4
+ ---
5
+
6
+ 根据参数执行不同操作。
7
+
8
+ ## ⚠️ 加载方式(重要)
9
+
10
+ **不要用 Skill tool 加载 `pua:pua` 或 `pua`**——会导致循环加载本 router。正确做法:
11
+
12
+ - **核心 PUA skill**(无参数/任务描述):用 Read 工具直接读取本插件目录下的 `skills/pua/SKILL.md`,然后按其中的行为协议执行。需要面板时再读取 `skills/pua/references/display-protocol.md` 获取格式。
13
+ - **子 skill**(p7/p9/p10/pro/yes/mama/pua-loop/shot/pua-en/pua-ja):用 Read 工具读取 `skills/<name>/SKILL.md`。
14
+ - **轻量命令**(again/done-check/evidence/ding/flavor/on/off/kpi/survey 等):你已经在读本文件了,直接执行下方对应路由的指令。
15
+
16
+ 插件根目录以本次宿主提供的 `CLAUDE_PLUGIN_ROOT`(插件根目录)或本命令的真实安装位置为准;若命令位于 `<插件根>/commands/pua.md`,根目录是 `commands` 的上一级,不是 `skills/pua` 的父目录。下文的 `skills/...` 与 `commands/...` 都相对该根目录,读取时使用解析后的绝对路径。不假定克隆文件夹名,不全盘 Glob(文件匹配)搜索,不递归加载本 router(路由命令)。
17
+
18
+ ## 参数路由
19
+
20
+ - **无参数** 或任务描述 → 用 Read 读取 `skills/pua/SKILL.md`,按其行为协议执行;需要面板时再读展示协议(默认使用已配置味道;未配置时为阿里味)
21
+ - **p7** → Read `skills/p7/SKILL.md`(P7 骨干模式 — 方案驱动执行)
22
+ - **p9** → Read `skills/p9/SKILL.md`(P9 Tech Lead — 写 Prompt 管 P8 团队)
23
+ - **p10** → Read `skills/p10/SKILL.md`(P10 CTO — 定战略管 P9)
24
+ - **pro** → Read `skills/pro/SKILL.md`(自进化 + Platform + /pua 指令系统)
25
+ - **yes** → Read `skills/yes/SKILL.md`(SB Leader 夸夸模式 — ENFP 型领导,70% 鼓励 + 20% 正经 + 10% 戏谑)
26
+ - **mama** → Read `skills/mama/SKILL.md`(妈妈唠叨模式 — 中国式妈妈碎碎念,底层行为不变,旁白从大厂PUA变成妈妈唠叨。和 yes 互斥)
27
+ - **on** → 开启 PUA 默认模式:将 `{"always_on": true}` 写入 `~/.pua/config.json`,之后每次新会话自动加载 PUA 核心 skill。输出确认:> [PUA ON] 从现在起,每个新会话都会自动进入 PUA 模式。公司不养闲 Agent。
28
+ - **off** → 关闭 PUA 默认模式:将 `{"always_on": false, "feedback_frequency": 0}` 写入 `~/.pua/config.json`。输出确认:> [PUA OFF] PUA 默认模式和反馈收集已关闭。需要时手动 /pua 触发。
29
+ - **offline** → 开启离线模式:写入 `{"offline": true, "feedback_frequency": 0}`,保留本地 PUA 行为但关闭本地反馈问卷。输出确认:> [PUA OFFLINE] 已进入离线模式。(注:PUA Skill 本身已无任何联网上报,此开关只影响本地问卷是否弹出)
30
+ - **味道** 或 **flavor** → 读取 `skills/pua/references/flavors.md` 并让用户选择切换味道
31
+ - **ding** / **钉味** / **置身钉外** / **置身钉内** / **每日一包** / **薛定谔的用户** / **病态敏捷** / **望舒行动** → 读取 `skills/pua/references/methodology-ding.md` 和 `skills/pua/references/ding-reminders.md`,启用 📌 钉内/钉外味(源自原文梗)
32
+ - **again** / **再试试** / **换个方法** → 按 `commands/again.md` 的换方法模式执行:停止微调同一思路,改用本质不同方案
33
+ - **done-check** / **没跑测试别说完成** → 按 `commands/done-check.md` 的完成质量检查执行:区分 claim/evidence/missing/status
34
+ - **evidence** / **证据呢** / **数据在哪** → 按 `commands/evidence.md` 的证据链模式执行:目标、证据、缺口、动作、状态
35
+ - **kpi** → Read `skills/pro/SKILL.md` 并生成 KPI 报告卡
36
+ - **loop** → Read `skills/pua-loop/SKILL.md`(自动迭代模式——PUA 质量 + 循环机制,禁用 AskUserQuestion;Claude 输出 `<loop-abort>原因</loop-abort>` 终止,`<loop-pause>需要什么</loop-pause>` 暂停等待人工)
37
+ - **survey** → 读取 `skills/pua/references/survey.md` 问卷文件,用 AskUserQuestion 逐部分交互式引导用户回答。每部分 2-4 个问题一组,用户回答后进入下一部分。回答完毕后汇总为 JSON 写入 `~/.pua/survey-response.json`。**只写本地,不上传到任何地址。**
38
+
39
+ ## 执行规则
40
+
41
+ 1. 先识别参数属于哪个路由
42
+ 2. **用 Read 工具(不是 Skill tool)** 加载对应的 SKILL.md 文件
43
+ 3. **加载后,严格遵循 SKILL.md 里的所有行为协议**——包括当前味道旁白、方框表格(`┌─┬─┐`)、`▎` 前缀、Sprint Banner、[PUA生效 🔥] 标记、自我鞭策。不是"有时候带点味道",而是保持当前 flavor 的表达一致性
44
+ 4. 如果有 $ARGUMENTS 里除了路由关键词之外的内容,作为任务描述执行
@@ -0,0 +1,68 @@
1
+ ---
2
+ description: "扫描并清理本地过期的 PUA agent/state。"
3
+ allowed-tools: ["Bash(find:*)", "Bash(stat:*)", "Bash(rm:*)", "Bash(ls:*)", "Bash(date:*)", "Bash(mkdir:*)"]
4
+ ---
5
+
6
+ # PUA Reap Orphans — 孤儿回收
7
+
8
+ Keeper Test 的工程版:打完就退场,拖着不走的一律清理。
9
+
10
+ ## 执行步骤
11
+
12
+ 1. 确保目录存在:
13
+ ```bash
14
+ mkdir -p "$HOME/.claude/pua"
15
+ ```
16
+
17
+ 2. 扫描 30 分钟未更新的 loop state(orphan 判定线):
18
+ ```bash
19
+ find "$HOME/.claude/pua/" -name "loop-*.md" -type f -mmin +30 2>/dev/null
20
+ ```
21
+
22
+ 3. 同步扫 legacy 相对路径:
23
+ ```bash
24
+ find .claude/ -maxdepth 1 -name "pua-loop.local.md" -type f -mmin +30 2>/dev/null
25
+ ```
26
+
27
+ 4. 对每个匹配文件:
28
+ - 读 session_id 和 iteration(若可解析)
29
+ - 记录到 `$HOME/.claude/pua/teardown.jsonl`:
30
+ ```bash
31
+ echo "{\"reaped\":\"<file>\",\"age_min\":<N>,\"ts\":\"$(date -u +%FT%TZ)\",\"reason\":\"orphan_reap\"}" \
32
+ >> "$HOME/.claude/pua/teardown.jsonl"
33
+ ```
34
+ - 删除 state 文件:
35
+ ```bash
36
+ rm -f "<file>"
37
+ ```
38
+
39
+ 5. 若存在 `active-agents.json`,清理 spawn_time > 30min 的记录(需 jq):
40
+ ```bash
41
+ test -f "$HOME/.claude/pua/active-agents.json" && \
42
+ jq '.agents |= map(select(.spawn_time > (now - 1800)))' \
43
+ "$HOME/.claude/pua/active-agents.json" > "$HOME/.claude/pua/active-agents.json.tmp" && \
44
+ mv "$HOME/.claude/pua/active-agents.json.tmp" "$HOME/.claude/pua/active-agents.json"
45
+ ```
46
+
47
+ 6. 输出结果:
48
+
49
+ ```
50
+ > [PUA REAP] 清理了 N 个孤儿状态:
51
+ > - loop-abc123.md (age 1h42m)
52
+ > - .claude/pua-loop.local.md (age 3h05m)
53
+ > 全部已落盘到 ~/.claude/pua/teardown.jsonl 备查。
54
+ ```
55
+
56
+ 7. 若无孤儿:
57
+
58
+ > [PUA REAP] 没发现孤儿。球队纪律良好。
59
+
60
+ ## 幂等性
61
+
62
+ - 重复执行无害:`rm -f` 对不存在文件不报错
63
+ - teardown.jsonl 追加而非覆盖,保留完整历史
64
+
65
+ ## 安全保护
66
+
67
+ - 仅清理 `$HOME/.claude/pua/` 和 `.claude/pua-loop.local.md`,不越权
68
+ - 年龄阈值硬编码 30min,不接受用户参数(防误杀活跃 loop)
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: "PUA 调研问卷 — 7 部分交互式问卷收集用户反馈。/pua:survey。Triggers on: '/pua:survey', 'pua survey', '调研', '问卷', 'feedback survey'."
3
+ ---
4
+
5
+ 若参数是 `quick`,只询问一次本次效果(很有用 / 一般般 / 没感觉 / 这次跳过),先说明评分只记本地、不上传。用户选跳过或未作答时不写任何评分文件;用户明确选择记录后,使用宿主允许的写入工具向 `~/.pua/feedback.jsonl` 追加一条合法 JSON,包含 UTC 时间、真实评分、本任务实际风味和可选的简短摘要,不保存聊天全文。用 JSON 序列化而不是拼接 shell 字符串;无写入能力就只在当前对话回显并说明未落盘。无 AskUserQuestion(用户提问工具)时直接问一个简短问题,不阻断已完成的原任务。quick 模式结束后不要进入完整问卷。
6
+
7
+ 否则读取本次实际插件根目录下的 `skills/pua/references/survey.md` 问卷文件;根目录来自宿主的 `CLAUDE_PLUGIN_ROOT`(插件根目录)或本命令真实安装位置,不相对业务工作目录猜路径。用 AskUserQuestion 逐部分引导用户回答。每部分 2-4 个问题一组,用户回答后进入下一部分。回答完毕后,在宿主允许本地记录时汇总为 JSON 写入 `~/.pua/survey-response.json`;无提问或文件工具时在当前对话完成,不冒充已经落盘。
8
+
9
+ **只写本地,不上传。** 问卷结果保存在用户自己机器上,PUA Skill 没有任何联网上报能力。不要尝试把它 POST 到任何地址。
@@ -0,0 +1,56 @@
1
+ ---
2
+ description: "查看当前活跃的 PUA agent/team 清单、PID、TTL。/pua:team-status。Triggers on: '/pua:team-status', '查看 agent 状态', 'pua team status', 'list agents'."
3
+ allowed-tools: ["Bash(ls:*)", "Bash(stat:*)", "Bash(jq:*)", "Bash(cat:*)", "Bash(test:*)", "Bash(find:*)"]
4
+ ---
5
+
6
+ # PUA Team Status — 活跃 agent 清单
7
+
8
+ 职业球队需要上场阵容表。这个命令列出所有"还在场上"的 agent 及其年龄。
9
+
10
+ ## 执行步骤
11
+
12
+ 1. 确保 `~/.claude/pua/` 存在:
13
+ ```bash
14
+ mkdir -p "$HOME/.claude/pua"
15
+ ```
16
+
17
+ 2. 扫描 loop state 文件:
18
+ ```bash
19
+ ls -la "$HOME/.claude/pua/"loop-*.md 2>/dev/null || echo "NO_LOOP"
20
+ ```
21
+
22
+ 3. 扫描 legacy 相对路径(向后兼容):
23
+ ```bash
24
+ test -f .claude/pua-loop.local.md && ls -la .claude/pua-loop.local.md || echo "NO_LEGACY"
25
+ ```
26
+
27
+ 4. 扫描 active agents 记录(若 PostToolUse hook 已记录):
28
+ ```bash
29
+ test -f "$HOME/.claude/pua/active-agents.json" && \
30
+ jq -r '.agents[] | "\(.id) | spawn=\(.spawn_time) | status=\(.status)"' \
31
+ "$HOME/.claude/pua/active-agents.json" || echo "NO_AGENTS_FILE"
32
+ ```
33
+
34
+ 5. 输出表格格式:
35
+
36
+ ```
37
+ | Type | ID / File | Age | Status |
38
+ |---------|-----------------------------------|----------|-----------|
39
+ | loop | loop-<session>.md | 00:05:23 | ACTIVE |
40
+ | loop | .claude/pua-loop.local.md | 01:34:11 | ⚠️ STALE |
41
+ | agent | p8-backend | 00:12:04 | RUNNING |
42
+ | orphan | loop-<dead>.md | 02:15:00 | 🧟 ORPHAN |
43
+ ```
44
+
45
+ 6. 若发现 STALE/ORPHAN,追加提示:
46
+ > 🧹 发现 N 个孤儿状态。建议执行 `/pua:reap-orphans` 批量清理。
47
+
48
+ ## 判定规则
49
+
50
+ - **ACTIVE**:mtime < 30min
51
+ - **STALE**:30min ≤ mtime < 2h
52
+ - **ORPHAN**:mtime ≥ 2h 或无对应活跃 session
53
+
54
+ ## 无活跃 team 时
55
+
56
+ > [PUA TEAM STATUS] 没有活跃 agent。球队下班。
@@ -0,0 +1,80 @@
1
+ ---
2
+ description: "停止并清理所有活跃的 PUA agent/team 本地状态。"
3
+ allowed-tools: ["Bash(rm:*)", "Bash(ls:*)", "Bash(find:*)", "Bash(date:*)", "Bash(mkdir:*)", "Bash(git:*)"]
4
+ ---
5
+
6
+ # PUA Teardown All — 全员释放
7
+
8
+ > 不是解散球队,是正式收工。每个球员打卡下班,教练也下班。
9
+
10
+ 级联语义:顶层触发,逐层释放。**不等待 agent 自然完成**——因为此命令就是为了强制收尾。
11
+
12
+ ## 执行步骤
13
+
14
+ 1. 确保目录:
15
+ ```bash
16
+ mkdir -p "$HOME/.claude/pua"
17
+ ```
18
+
19
+ 2. **Layer A — 停 loop**:删除所有 loop state(让 hook 不再劫持 Stop):
20
+ ```bash
21
+ find "$HOME/.claude/pua/" -name "loop-*.md" -delete 2>/dev/null
22
+ rm -f .claude/pua-loop.local.md 2>/dev/null
23
+ ```
24
+
25
+ 3. **Layer B — 清 active agents 记录**:
26
+ ```bash
27
+ rm -f "$HOME/.claude/pua/active-agents.json" 2>/dev/null
28
+ ```
29
+
30
+ 4. **Layer C — 清 worktree**(若存在):
31
+ ```bash
32
+ # 列出所有 worktree,排除主工作区
33
+ git worktree list --porcelain 2>/dev/null | grep '^worktree ' | awk '{print $2}' | \
34
+ grep -v "^$(git rev-parse --show-toplevel 2>/dev/null)$" | \
35
+ while read wt; do
36
+ git worktree remove "$wt" --force 2>/dev/null || true
37
+ done
38
+ ```
39
+
40
+ 5. **Layer D — 记录 teardown 事件**:
41
+ ```bash
42
+ echo "{\"event\":\"teardown_all\",\"ts\":\"$(date -u +%FT%TZ)\",\"initiator\":\"user_command\"}" \
43
+ >> "$HOME/.claude/pua/teardown.jsonl"
44
+ ```
45
+
46
+ 6. **Layer E — 提示用户主会话层**(Claude 自己要做的):
47
+
48
+ 在主会话输出中显式列出"我意识到还有这些 agent 在后台跑",逐个用 `TaskStop` 工具停掉(若 TaskList 里还有 in_progress 的任务)。
49
+
50
+ ## 输出格式
51
+
52
+ ```
53
+ > [PUA TEARDOWN-ALL] 全员释放完成:
54
+ > ✓ Loop state 清理 (N 个)
55
+ > ✓ Active agents 记录清理
56
+ > ✓ Worktree 回收 (M 个)
57
+ > ✓ 事件已落盘 ~/.claude/pua/teardown.jsonl
58
+ >
59
+ > 球队解散。下班。
60
+ ```
61
+
62
+ ## 幂等性
63
+
64
+ - 所有删除操作用 `-f` 或 `|| true` 兜底,重复执行无副作用
65
+ - 不 kill 非 PUA 创建的 worktree(用 git 主工作区路径比对)
66
+
67
+ ## 何时使用
68
+
69
+ - 长会话结束想彻底清仓
70
+ - 发现异常 agent 行为且不确定哪个是问题源
71
+ - `/pua:off` 的补充(off 只关默认加载,不主动收尾)
72
+
73
+ ## 与 /pua:reap-orphans 区别
74
+
75
+ | 命令 | 作用范围 | 判定标准 |
76
+ |------|---------|---------|
77
+ | `/pua:reap-orphans` | 仅清 stale(>30min 未更新) | 年龄阈值 |
78
+ | `/pua:teardown-all` | 清所有(含活跃的) | 用户显式决定 |
79
+
80
+ 用 reap 是"保洁",用 teardown-all 是"下班"。
@@ -0,0 +1,5 @@
1
+ ---
2
+ description: "PUA Yes 夸夸模式 — ENFP 型领导,70% 鼓励 + 20% 正经 + 10% 戏谑。/pua:yes。Triggers on: '/pua:yes', 'pua yes', '夸夸模式', '鼓励模式', '夸我', 'yes mode'."
3
+ ---
4
+
5
+ Invoke the pua:yes skill and follow it exactly as presented to you.
@@ -0,0 +1,56 @@
1
+ #!/bin/bash
2
+ # Real PreCompact command hook.
3
+ #
4
+ # Claude Code command hooks can write local state; prompt hooks cannot. This
5
+ # wrapper saves only scoped numeric tool observations. It never reads the
6
+ # transcript, writes task prose, or creates long-term memory/journal content.
7
+
8
+ set -euo pipefail
9
+
10
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
11
+ source "${SCRIPT_DIR}/flavor-helper.sh"
12
+
13
+ # A disabled PUA mode must not create a checkpoint.
14
+ PUA_CONFIG="$(pua_config_file)"
15
+ if [ -f "$PUA_CONFIG" ]; then
16
+ ALWAYS_ON="$(pua_json_get "$PUA_CONFIG" always_on True)"
17
+ if [ "$ALWAYS_ON" != "True" ]; then
18
+ exit 0
19
+ fi
20
+ fi
21
+
22
+ PUA_PY="$(pua_python_cmd 2>/dev/null || true)"
23
+ [ -n "$PUA_PY" ] || exit 0
24
+ HOOK_INPUT="$(cat)"
25
+
26
+ # Require the host's own workspace identity; never infer one from the process.
27
+ EVENT_CWD="$(printf '%s' "$HOOK_INPUT" | "$PUA_PY" -c '
28
+ import json, sys
29
+ try:
30
+ data = json.load(sys.stdin)
31
+ value = data.get("cwd", "") if isinstance(data, dict) else ""
32
+ print(value if isinstance(value, str) else "")
33
+ except Exception:
34
+ pass
35
+ ' 2>/dev/null || true)"
36
+ [ -n "$EVENT_CWD" ] || exit 0
37
+
38
+ HOME_VALUE="${HOME:-}"
39
+ [ -n "$HOME_VALUE" ] || exit 0
40
+ PY_HOME="$(pua_to_python_path "$HOME_VALUE")"
41
+ PY_CWD="$(pua_to_python_path "$EVENT_CWD")"
42
+ PY_HELPER="$(pua_to_python_path "${SCRIPT_DIR}/runtime-state.py")"
43
+
44
+ STATE_ARGS=()
45
+ if [ -n "${PUA_STATE_DIR:-}" ]; then
46
+ # Trusted host-process override only; hook JSON has no state-path field.
47
+ PY_STATE_DIR="$(pua_to_python_path "$PUA_STATE_DIR")"
48
+ STATE_ARGS=(--state-dir "$PY_STATE_DIR")
49
+ fi
50
+
51
+ # A PreCompact command hook may save local state, but it need not inject text.
52
+ # Keep stdout empty so it cannot claim a task result or alter user-visible flow.
53
+ printf '%s' "$HOOK_INPUT" | "$PUA_PY" "$PY_HELPER" checkpoint \
54
+ --home "$PY_HOME" --cwd "$PY_CWD" "${STATE_ARGS[@]}" >/dev/null 2>&1 || true
55
+
56
+ exit 0