pua-looplisted
Install: claude install-skill Kirky-X/pua
# PUA Loop — 自动迭代 + 门控协议 + PUA 质量引擎
> autoresearch 证明了:630 行 Python + Oracle 验证,一夜跑 100 个实验,每个实验的结果不可伪造。
> PUA Loop 借鉴同样的门控设计:**Claude 说"完成了"不算数,verify_command 说了才算。**
## 门控协议(Gate Protocol)
借鉴 autoresearch 的 5 个设计模式:
### 模式 1: Oracle Isolation(评估者隔离)
```
Claude 输出 <promise>LOOP_DONE</promise>
│
▼
┌─── Stop Hook (Oracle) ───┐
│ │
│ 运行 verify_command │
│ (Claude 无法修改此命令) │
│ │
│ exit 0 ──→ ✅ 接受 │
│ exit ≠0 ──→ 🚫 拒绝 │
│ → 将验证输出喂回 Claude │
│ → loop 继续 │
└──────────────────────────┘
```
**verify_command 由用户在启动时设定,嵌入在状态文件 frontmatter 中,Claude 无法修改。** 这是 autoresearch 中 "agent 不能修改评估函数" 原则的实现。
### 模式 2: 二阶 Gate
- **Phase 1 (in-prompt)**: Claude 自己跑 build/test,判断是否完成
- **Phase 2 (in-hook)**: Hook 独立运行 verify_command,确认或拒绝
两阶段分离。即使 Claude 在 Phase 1 自欺欺人,Phase 2 的 Oracle 会拦住。
### 模式 3: ASI(失败记忆)
每次迭代的结果追加到 `.claude/pua-loop-history.jsonl`:
```json
{"iteration":0,"status":"init","verify_command":"npm test","timestamp":"..."}
{"iteration":1,"status":"continue","timestamp":"..."}
{"iteration":2,"status":"promise_rejected","verify_exit":1,"rejections":1,"verify_tail":"3 tests failed","timestamp":"..."}
{"ite