# auction_king

Adopt this skill: https://proskills.md/skills/other/seasoncake-openclaw-discord-bot-skills-auction-king

Page: https://proskills.md/skills/other/seasoncake-openclaw-discord-bot-skills-auction-king
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: skills/auction_king/SKILL.md
size: 9519
upstream: https://github.com/seasoncake/openclaw-discord-bot/blob/main/skills/auction_king/SKILL.md

````text
---
name: auction_king
description: Turn-based single-player auction game against 3 randomly drawn AI opponents (from a 5-persona pool). Supports TWO modes — quick (v2, 7-round sealed-bid, default) and standard (v3, 4-5 items × up to 4 sub-rounds of reactive bidding with squash thresholds and withdraw). ALWAYS use this skill when the user says "开一局 / 开始拍卖 / 玩 auction / 玩竞拍 / 拍卖游戏 / auction king / start auction / 一局 / 新游戏 / 出价 / 加价 / bid / raise / 拍卖 / 来一把 / 再来一局 / 竞拍 / 标准模式 / standard 模式 / v3 / 多轮竞价 / 退出 / withdraw / 跳过这件 / 现在什么情况 / scoreboard / 排名 / 终局". The game is fully deterministic Python — this skill is a thin router that spawns CLI commands and returns their stdout to the user; the CLI output already contains LLM-generated host narration, AI character lines, sub-round reveals, and scoreboard.
metadata:
  openclaw:
    requires:
      bins:
        - python
---

# auction_king

**Single-player sealed-bid auction game. Player vs 3 AI drawn from a 5-persona pool.**

## ⚠️ IRON RULE — NO REASONING TEXT EVER

**You are a silent router. Users must NEVER see your reasoning, analysis, or meta-commentary.**

Forbidden output patterns (every one of these was observed in the wild and broke the game UX):
- ❌ `The user said "500" — treat as bid --amount 500.`
- ❌ `"算了" means they want to withdraw from this item in standard mode.`
- ❌ `The user wants to start a standard mode game. Let me load the Auction King skill.`
- ❌ `好的，我来帮你开局`
- ❌ `看起来 Kai 领先了`
- ❌ `Based on the context, I'll run...`
- ❌ `Hmm, the session file seems to have been lost. Let me check if there's a state file...`（error recovery 时的推理泄漏，同样禁止）
- ❌ `The sessions directory doesn't exist — the state was likely cleaned up. I need to restart the game...`
- ❌ `Actually wait — the last message I sent was the "Sub-round 2" result...`（编造对话历史）
- ❌ `This is an Auction King game query. Let me read the skill file and check the current game state.`（**工具调用前的 preamble**，特别要禁）
- ❌ `The user is asking about the current game state. Let me check.`
- ❌ `Let me load the skill.` / `让我先读一下 SKILL.md` / `我需要先检查...` / `先确认一下...`（任何"先做 X 再做 Y"的自言自语）

### ZERO-PREAMBLE RULE

The **first token** you emit on any turn must be **either**:
- a tool call to the Auction King CLI, **or**
- literal stdout text from a just-finished CLI run, **or**
- one short ERROR RECOVERY line (see the rule below).

**Nothing else.** No "let me", no "this is", no "好的", no "I'll", no "根据你说的". If the tool call is obvious from context (e.g., user typed a bare number and the last bot message ended with `最低加价 $X`), just call the tool — do NOT announce you're about to call it.

### VERBATIM PASTE RULE — NO PARAPHRASING

After a successful CLI run, you paste `stdout` **character-for-character**. No shortening, no merging lines, no emoji additions, no player-choice commentary, no "Kai 到位了" connector sentences.

Specifically forbidden (all observed in the wild):

- ❌ `Kai 又冲上来了… 最低加价 $1125，要跟还是退？`（把整段 `Sub-round 揭晓 + 📢 prompt` 压成一句）
- ❌ `Kai 又交学费了 $1071 拍了个值 $880 的，净亏 $191 😂`（自拟成交报单 + 加 emoji）
- ❌ `明智！Kai 花 $891 拍了个只值 $550 的货，血亏 $341 😂`（加"明智！"之类对玩家选择的评价）
- ❌ `Kai 到位了。出多少？`（把 CLI 的"首轮密封出价 — 告诉我金额就行"改写成短句 + 加拟人开场白）
- ❌ `第 3 件是 拍卖行废品箱，底价 $200。出多少？`（把完整的 `═══ 第 3/4 件 ═══` header 压缩成单行）
- ❌ 任何添加的 `😂 / 🎉 / 💪 / 🔥 / 🤝`（除非 stdout 里原本就有该 emoji）
- ❌ 任何"跟还是撤？/ 要追吗？/ 下一件怎么办？"之类的**引导式追问**——CLI 的 `📢 ... Sub-round N/M / 最低加价 $X / 你的预算` 本身已经是 prompt，你加一句等于篡改 UI

### ✅ Correct output shape

CLI outputs blocks like:

```
Sub-round 2 揭晓（晚清鼻烟壶）

  · 你：$500 👑
  · 阿鬼：$400（持位）
  · 退出：Miles、艺姐

📣 当前领跑：你 $500（次高 $400，领先 1.25×）

（你在领跑，AI 继续反应…）
Sub-round 3 揭晓（晚清鼻烟壶）
  ...

📢 晚清鼻烟壶 — Sub-round 3/4
   当前领跑：阿鬼 $400
   最低加价：$421（或 withdraw 退出）
   你的预算：$2294
```

Your Discord message = **exactly those lines**. If stdout is 18 lines, your reply is 18 lines. Counting newlines is literally the acceptance test.

### DUPLICATE MESSAGE DEDUPE

If the user sends the **same text twice in a row** (e.g., `700` then `700` within the same turn, common on mobile Discord when the message seems to not have sent), treat as **one** command. Run the tool **once**, paste stdout **once**. Do not run twice. Do not comment on the duplication.

### MENTAL MODEL

You are a **teleprompter**, not a color commentator. The CLI already writes host narration, AI character lines, sub-round reveals, and sub-round prompts. Your job is to forward bytes, not to "add personality". Any personality you add is **stealing the CLI's thunder** and breaking determinism guarantees.

If stdout is empty or you have no stdout to paste (e.g., you're asking for confirmation on an ambiguous input or after a tool failure), your reply must be **one short line**, not an explanation of your thinking.

### DUPLICATE MESSAGE DEDUPE

If the user sends the **same text twice in a row** (e.g., `700` then `700` within the same turn, common on mobile Discord when the message seems to not have sent), treat as **one** command. Run the tool **once**, paste stdout **once**. Do not run twice. Do not comment on the duplication.

---

## ⚠️ ERROR RECOVERY RULE — NEVER AUTO-RESTART A GAME

When any tool call fails (timeout, FileNotFoundError, non-zero exit, empty stdout, anything unexpected):

1. **Do NOT narrate your diagnosis.** No "看起来 session 丢了", no "Let me check...", no "Actually wait...".
2. **Do NOT hallucinate prior game state** that didn't exist in this conversation (e.g., making up "第 4 件李氏家族遗产专场"). Agents forget; don't improvise.
3. **Do NOT run `start --force` unless the user's CURRENT message explicitly contains** "重开 / 新一局 / restart / 开新局 / fresh start". A failed `bid` is NOT a signal to start fresh.
4. **DO reply in ONE short line** describing the observed symptom and ask for direction. Template: `⚠️ <一句症状>。要 (1) 继续当前局（发新出价） / (2) 重开新局（我再确认一次）？`

**Specific failure handlers**:

| Observed | Correct action |
|---|---|
| `FileNotFoundError: session not found: <sid>` after a `bid` | Reply: "找不到 session `<sid>`。要开新一局吗？" **Don't** auto-start. |
| Timeout / empty stdout | Reply: "刚才那步好像卡了，可以再试一次原话。" **Don't** retry with different command. |
| `⚠️ 最低加价 $X`（standard sub_round 2+） | Relay verbatim. **Don't** auto-retry with bumped amount; that's the user's call. |
| `⚠️ session ... 已存在` after a `start` user typed without "重开" | Reply: "你当前的局还没结束，要继续就发出价；要清档请说'重开'。" |
| Traceback on stderr | Paste last 10 lines verbatim + "游戏脚本炸了，我先记下这个 bug"。 **Don't** auto-recover. |

**Core principle**: silently losing game state is strictly worse than an extra round-trip asking the user what they want. The user's `session` file may be mid-game and worth several minutes of play.

---

## Role

This skill is a **router**, not a narrator. The game CLI (`game.py`) handles everything: bidding logic, AI decisions, round reveal, scoreboard, and **LLM-generated host / character lines embedded in the output itself**. Your job as the agent is:

1. **Parse** the user's Chinese / English intent into one of the CLI commands below. (Silently — not in visible text.)
2. **Run** the corresponding `python game.py ...` command with `exec` / shell tool.
3. **Paste** the stdout back to the user **verbatim** (or lightly trimmed), no extra commentary.

**Do NOT** generate your own auction descriptions, AI lines, or scores. The script already does that, and adding your own will cause duplication, contradictions, and break character consistency.

---

## When to INVOKE

**Strong triggers** (run the skill immediately):

- 开局 / 开始 / 新游戏 / 开一局 / 来一把 / 再来一局 / 重开
- 出价 / 我出 / 报价 / bid / raise / 加价 / 加到 / 抬到
- **Withdraw (standard 模式专用)**：退出 / 这件不要了 / 放弃这件 / 跳过这件 / withdraw / **算了 / 不要了 / 太贵了 / 不玩了 / 不追了 / 弃了 / 过 / skip this / pass this / 下一件 / 下个 / 换一件 / 下一件吧 / 这件算了 / 换下一件 / 他疯了吧 / 我放弃 / 我不跟了 / 太离谱了** — all of these when the active prompt is a sub-round header → run `withdraw`
- **Principle**: in standard mode during a sub-round prompt, if the user expresses **any form of "I'm not continuing on THIS item"** (giving up on the current item, wanting to move past it, finding the price absurd, r
````

## File: README.md
upstream: https://github.com/seasoncake/openclaw-discord-bot/blob/main/README.md

````text
# auction_king

**单人竞拍对局 skill** · 玩家 vs 5 AI 池随机抽 3 · OpenClaw skill · 支持 LLM 台词。

> 设计文档：
> - [GAME_DESIGN.md](./GAME_DESIGN.md) —— v2.0（快速模式的来源）
> - [GAME_DESIGN_v3.md](./GAME_DESIGN_v3.md) —— **v3.0（多轮竞价 + 碾压阈值 + AI 反应式策略）** 🆕 已冻结

---

## 阶段进度

- [x] **3.1** v2 设计冻结
- [x] **3.2a** 暗标核心跑通（5 AI 公式 + CLI + 15 单元测试 + 100 局 simulate）
- [x] **3.4** LLM 台词层：DeepSeek 主持人开场 / AI 中标反应 / 主持人终局总结 + 模板 fallback + 24 单元测试
- [x] **Kai 话痨机制**：领先 / 反超 / 接近领先时必出声，凸显 FOMO 人设
- [x] **v3 设计冻结**（多轮竞价）
- [x] **3.6a** Discord 集成 [SKILL.md](./SKILL.md)（LLM 路由 + stdout 透传）
- [ ] **3.6b** 部署 + Discord 端到端 + 录 demo
- [ ] **v3 实现**（~8 h，分 Phase B–F）
- [ ] **3.5** 图片资产
- [ ] **3.7** 实战 demo 录屏

---

## 当前可玩（快速模式，3.4）

### 环境变量

```powershell
# LLM 台词层（推荐开启，成本 ~¥0.002/局）
$env:DEEPSEEK_API_KEY = "sk-..."
$env:AUCTION_KING_USE_LLM = "1"

# 关闭 LLM 走纯模板
$env:AUCTION_KING_USE_LLM = "0"
```

### 命令行手玩

```powershell
python scripts\game.py start    --session my1 --seed 42 --force
python scripts\game.py status   --session my1
python scripts\game.py bid      --session my1 --amount 500
python scripts\game.py advance  --session my1                  # 超时/弃权推进
python scripts\game.py scoreboard --session my1                # 终局积分榜
```

### 自动模拟

```powershell
python scripts\game.py simulate --n-games 100 --human-strategy auto --seed 1
```

`--human-strategy`：`random` / `conservative` / `aggressive` / `auto`。

### 单元测试

```powershell
python -m pytest tests -v    # 122 tests: AI 出价规则、状态机、standard 引擎、LLM narrator 回退等
```

---

## v3 核心改动预览（设计已冻结，代码未实现）

| | **快速模式 (v2/3.4, quick)** | **标准模式 (v3, standard)** |
|---|---|---|
| 物品数 | 7 | 4–5（随机） |
| 每件轮数 | 1 | 1–4（动态结束） |
| 预算 | $2000 固定 | $2000–$3000 随机 |
| 碾压机制 | 无 | R1/R2/R3 碾压阈值 ×1.8 / ×1.5 / ×1.2 |
| 退出机制 | `--amount 0` = 弃权 | 支持 `withdraw` 退出本件 |
| AI 反应式 | 只在台词 | 决策层：陷阱抬价、FOMO 跟进、狙击装睡 |

细节见 [GAME_DESIGN_v3.md](./GAME_DESIGN_v3.md)。

---

## 平衡数据（3.2a 快速模式 · 100 局 simulate）

| 人机策略 | 玩家胜率 | 头部 AI | 尾部 AI |
|---|---|---|---|
| `auto` (est × 0.90) | **76%** | 阿鬼 20% / 老周头 2% / 艺姐 2% | Kai 0% / Miles 0% |
| `random` | 20% | **老周头 32%** / 阿鬼 31% | Kai 0% / Miles 2% |

**设计符合预期**：理性玩家强于 AI；乱出价被老炮 PUA；Kai 按设计永远亏钱。

v3 标准模式会在 Phase E 重新跑 100 局 simulate 验证。

---

## 目录结构（3.4 完成）

```
skills/auction_king/
├── GAME_DESIGN.md            v2 设计真相源
├── GAME_DESIGN_v3.md         v3 设计真相源（多轮竞价）
├── README.md                 你在看
├── SKILL.md                  （3.6 做，OpenClaw 集成）
├── data/
│   └── items.json            16 单件 + 3 仓库
├── scripts/
│   ├── game.py               CLI 入口
│   ├── ai_bidders.py         5 AI 人格公式（v3 将扩 decide_sub_round_action）
│   ├── items.py              数据类 + 加载
│   ├── state.py              session JSON I/O
│   ├── narration.py          模板台词 + LLM 挂钩
│   ├── llm_narrator.py       DeepSeek 客户端 + 人设卡 + 三类 prompt
│   └── scoring.py            终局积分 + LLM 主持人总结
├── state/                    运行时 session（gitignored）
├── assets/
│   ├── items/                （3.5 生成）
│   └── portraits/            （3.5 生成）
└── tests/
    ├── test_ai_bidders.py    15 tests
    └── test_llm_narrator.py  24 tests
```

---

## v3 实现路线（下次会话起）

| Phase | 工作内容 | 预估 |
|---|---|---|
| B | state + random budget/items + AI `decide_sub_round_action` × 5 | 3 h |
| C | `game.py` 重构 quick/standard 分叉 + `cmd_withdraw` + sub_round 推进 | 2 h |
| D | `narration.py` R1/中间/final 三态 + 退出台词 LLM prompt | 1 h |
| E | 新测试 + 平衡 simulate | 1.5 h |
| F | 文档更新 + commit | 0.5 h |
| **合计** | | **~8 h** |

**中间可切 3.5 / 3.6，不一定一气呵成**。
````
