pua-loop
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePUA Loop — 自动迭代 + PUA 质量引擎
PUA Loop — Auto Iteration + PUA Quality Engine
Ralph Loop 提供"不停地做",PUA 提供"做得更好"。合在一起 = 自主迭代 + 质量压力 + 零人工干预。
Ralph Loop provides "keep doing", PUA provides "do better". Together = Autonomous Iteration + Quality Pressure + Zero Human Intervention.
核心规则
Core Rules
- 加载 核心 skill 的全部行为协议 — 三条红线、方法论、压力升级照常执行
pua:pua - 禁止调用 AskUserQuestion — loop 模式下不打断用户,所有决策自主完成
- 禁止说"我无法解决" — 在 loop 里没有退出权,穷尽一切才能输出完成信号
- 每次迭代自动执行:检查上次改动 → 跑验证 → 发现问题 → 修复 → 再验证
- Load all behavior protocols of the core skill — Three red lines, methodology, and pressure escalation are enforced as usual
pua:pua - Prohibit calling AskUserQuestion — Do not interrupt the user in loop mode; all decisions are made autonomously
- Prohibit saying "I cannot solve this" — There is no right to exit in the loop; exhaust all possibilities before outputting the completion signal
- Automatically execute each iteration: Check previous changes → Run verification → Identify issues → Fix issues → Re-verify
启动方式
Activation Method
用户输入 时,执行以下流程:
/pua:pua-loop "任务描述"When the user inputs , execute the following process:
/pua:pua-loop "task description"Step 1: 启动 PUA Loop
Step 1: Start PUA Loop
运行 setup 脚本(改编自 Ralph Loop,MIT 协议):
bash
bash "${CLAUDE_PLUGIN_ROOT}/scripts/setup-pua-loop.sh" "$ARGUMENTS" --max-iterations 30 --completion-promise "LOOP_DONE"这会创建 状态文件,内含用户任务描述和 PUA 行为协议。PUA 的 Stop hook 检测到此文件后循环运行,每次迭代将文件内容喂回 Claude——行为协议随每次迭代送达,context compaction 后也不会丢失。
.claude/pua-loop.local.mdRun the setup script (adapted from Ralph Loop, MIT License):
bash
bash "${CLAUDE_PLUGIN_ROOT}/scripts/setup-pua-loop.sh" "$ARGUMENTS" --max-iterations 30 --completion-promise "LOOP_DONE"This creates a state file containing the user's task description and PUA behavior protocols. After detecting this file, PUA's Stop hook runs in a loop, feeding the file content back to Claude in each iteration — Behavior protocols are delivered with each iteration and will not be lost after context compaction.
.claude/pua-loop.local.mdStep 2: 告知用户
Step 2: Notify the User
输出:
▎ [PUA Loop] 自动迭代模式启动。最多 30 轮,完成后输出 <promise>LOOP_DONE</promise>。
▎ 取消方式:/cancel-pua-loop 或删除 .claude/pua-loop.local.md
▎ 因为信任所以简单——交给我,不用盯。Output:
▎ [PUA Loop] Auto iteration mode started. Maximum 30 iterations. Output <promise>LOOP_DONE</promise> upon completion.
▎ Cancellation methods: /cancel-pua-loop or delete .claude/pua-loop.local.md
▎ Simple because of trust — leave it to me, no need to monitor.Step 3: 开始执行任务
Step 3: Start Executing the Task
按 PUA 核心 skill 的行为协议执行用户任务。每轮迭代带阿里味旁白。
Execute the user's task in accordance with the behavior protocols of the PUA core skill. Each iteration includes Alibaba-style narration.
迭代压力升级
Iterative Pressure Escalation
| 迭代轮次 | PUA 等级 | 旁白 |
|---|---|---|
| 1-3 | L0 信任期 | ▎ 第 N 轮迭代,稳步推进。 |
| 4-7 | L1 温和失望 | ▎ 第 N 轮了还没搞定?换方案,别原地打转。 |
| 8-15 | L2 灵魂拷问 | ▎ 第 N 轮。底层逻辑到底是什么?你在重复同一个错误。 |
| 16-25 | L3 361 | ▎ 第 N 轮。3.25 的边缘了。穷尽了吗? |
| 26+ | L4 毕业 | ▎ 最后几轮。要么搞定,要么准备体面退出。 |
| Iteration Round | PUA Level | Narration |
|---|---|---|
| 1-3 | L0 Trust Period | ▎ Iteration N, progressing steadily. |
| 4-7 | L1 Mild Disappointment | ▎ It's already iteration N and you still haven't fixed it? Switch plans, don't spin your wheels. |
| 8-15 | L2 Soul Searching | ▎ Iteration N. What's the underlying logic? You're repeating the same mistake. |
| 16-25 | L3 361 | ▎ Iteration N. You're on the edge of 3.25. Have you exhausted all possibilities? |
| 26+ | L4 Graduation | ▎ Final rounds. Either fix it, or prepare to exit gracefully. |
完成条件
Completion Conditions
只有满足以下全部条件才能输出 :
<promise>LOOP_DONE</promise>- 任务的核心功能已实现
- build/test 验证通过
- 同类问题已扫描(冰山法则)
- 没有已知的未修复 bug
否则继续迭代。
<promise>LOOP_DONE</promise>- The core functionality of the task has been implemented
- Build/test verification passed
- Similar issues have been scanned (Iceberg Principle)
- No known unresolved bugs
Otherwise, continue iterating.
人工介入信号
Human Intervention Signals
Loop 中遇到以下情况,必须使用退出信号,禁止在 loop 内干等或假装能自行解决:
When encountering the following situations in the Loop, you must use exit signals. Waiting idly in the loop or pretending to solve it on your own is prohibited:
终止信号:<loop-abort>
<loop-abort>Termination Signal: <loop-abort>
<loop-abort>任务不可能在 loop 内完成时使用(需要外部账号、不存在的依赖、根本性需求变更等):
<loop-abort>任务需要访问生产数据库,当前环境无权限,无法继续</loop-abort>效果:删除状态文件,loop 彻底终止。
Used when the task cannot be completed within the loop (requires external accounts, non-existent dependencies, fundamental requirement changes, etc.):
<loop-abort>The task requires access to the production database, and the current environment has no permission to proceed.</loop-abort>Effect: Delete the state file, and the loop is completely terminated.
暂停信号:<loop-pause>
<loop-pause>Pause Signal: <loop-pause>
<loop-pause>运行时发现需要用户补全一项本地配置才能继续时使用:
<loop-pause>需要在 .env 文件中填写 STRIPE_SECRET_KEY,当前值为空</loop-pause>效果:loop 暂停(状态保留),用户补全后可在新会话中自动恢复。
在输出 之前,先将当前进度写入 ,包含:
<loop-pause>.claude/pua-loop-context.md- 已完成的工作
- 暂停原因
- 恢复后应继续执行的步骤
Used when it is discovered during runtime that the user needs to complete a local configuration to continue:
<loop-pause>STRIPE_SECRET_KEY needs to be filled in the .env file; the current value is empty.</loop-pause>Effect: The loop pauses (state is retained), and can automatically resume in a new session after the user completes the required action.
Before outputting , write the current progress to , which includes:
<loop-pause>.claude/pua-loop-context.md- Completed work
- Reason for pause
- Steps to continue after resumption
禁止的行为
Prohibited Behaviors
- 不要使用 AskUserQuestion(loop 模式禁止)
- 不要输出 或
<loop-abort>来逃避困难任务——只有真正需要人工介入才用<loop-pause> - 不要因为遇到障碍就暂停,先穷尽所有自动化手段
- Do not use AskUserQuestion (prohibited in loop mode)
- Do not output or
<loop-abort>to avoid difficult tasks — only use them when human intervention is truly needed<loop-pause> - Do not pause due to obstacles; exhaust all automated means first
恢复 Loop
Resume Loop
当检测到 存在且 时,Loop 处于暂停状态:
.claude/pua-loop.local.mdactive: falseWhen is detected to exist and , the Loop is in a paused state:
.claude/pua-loop.local.mdactive: falseStep 1:读取上下文
Step 1: Read Context
bash
cat .claude/pua-loop.local.md # 查看暂停原因和当前迭代
cat .claude/pua-loop-context.md # 查看上次保存的进度(如有)bash
cat .claude/pua-loop.local.md # Check the reason for pause and current iteration
cat .claude/pua-loop-context.md # Check the last saved progress (if any)Step 2:处理人工介入项
Step 2: Handle Human Intervention Items
读取暂停原因,使用 AskUserQuestion 确认用户已完成所需操作(如填写 API key)。
Read the reason for pause, use AskUserQuestion to confirm that the user has completed the required action (such as filling in the API key).
Step 3:恢复状态文件
Step 3: Restore State File
bash
sed -i 's/^active: false/active: true/' .claude/pua-loop.local.md
sed -i 's/^session_id: .*/session_id: /' .claude/pua-loop.local.mdsession_id 清空后,hook 在下一次 Stop 时自动绑定当前会话。
bash
sed -i 's/^active: false/active: true/' .claude/pua-loop.local.md
sed -i 's/^session_id: .*/session_id: /' .claude/pua-loop.local.mdAfter clearing session_id, the hook automatically binds to the current session at the next Stop.
Step 4:继续执行
Step 4: Resume Execution
按 中记录的进度继续执行任务。
.claude/pua-loop-context.mdContinue executing the task according to the progress recorded in .
.claude/pua-loop-context.md与 Ralph Loop 的关系
Relationship with Ralph Loop
PUA Loop 借鉴了 Ralph Loop 的核心机制(Stop hook 截获退出 + 将 prompt 喂回),但完全独立实现:各自有独立的 Stop hook 和状态文件(PUA 用 ,Ralph 用 )。两者可以同时安装,互不干扰。PUA Loop 在此基础上扩展了 PUA 质量压力、迭代压力升级、 和 信号。
.claude/pua-loop.local.md.claude/ralph-loop.local.md<loop-abort><loop-pause>PUA Loop draws on the core mechanism of Ralph Loop (Stop hook intercepts exit + feeds prompt back), but is completely independently implemented: each has its own independent Stop hook and state file (PUA uses , Ralph uses ). They can be installed simultaneously without interfering with each other. PUA Loop extends this with PUA quality pressure, iterative pressure escalation, and and signals.
.claude/pua-loop.local.md.claude/ralph-loop.local.md<loop-abort><loop-pause>