Introduction¶
In the DeepSeek Harness (DSH) plugin ecosystem, building applications with complex logic flows and multi-agent interactions typically requires handling state machine maintenance and information isolation. The Evolving-Werewolf plugin provides a complete 9-player Werewolf engine solution. It does not rely on an LLM as the game host; instead, the engine hosts the flow and introduces a cross-game knowledge accumulation mechanism. AI players can extract experience through post-game reviews, continuously improving their strategy after multiple games.
What Is It?¶
This is a DSH plugin maintained by VegeFin. Its core value is that AI players extract experience through post-game review at the end of each game and write that experience into a knowledge base. The experience is then injected via role personas in the next game, improving strategy. Currently, the plugin includes a complete 9-player configuration (3 Werewolves / 1 Seer / 1 Witch / 1 Hunter / 3 Villagers).
Core Features¶
- Cross-Game Knowledge Accumulation and Evolution: After a game ends, the engine automatically extracts review insights and writes them into role-specific knowledge bases. In the next game, AI players carry this experience and avoid known mistakes.
- Engine-Hosted Flow: All flows are driven by a state machine and do not consume LLM tokens as the game host, avoiding information distortion.
- Complete Role Abilities: Supports full skills, including Werewolf two-round discussion voting, Seer checking, Witch save/poison (first-night self-save, one potion per night), Hunter’s last words and shooting, etc.
- Standard Daytime Flow: Includes standard processes such as sheriff election, campaign speeches, withdrawal, sheriff vote, sheriff directed statements, and sheriff 1.5x voting power (tie re-vote).
- Information Isolation: Wolf target is visible only to Werewolves and the Witch; death cause is not public; role channels are private.
- Anti-Deadlock Mechanism: Includes 60-second reminder, 180-second timeout skip, runtime awareness (preventing slow players from being incorrectly eliminated), and a progression mutex lock.
- Death Freeze and Review: Eliminated player information is frozen, and after the game ends, the engine outputs a decision trace review with clear causality.
- Human Seats and Panel: Supports random human seat assignment; players operate via a browser panel and compete against AI.
- Asset Pipeline: Integrates Zhipu AI (GLM-4V-Flash / CogView-3-Flash) for UI avatars and role asset generation.
Installation and Enablement¶
Ensure Node.js >= 18 and DSH are installed, then run the following steps:
# 1. 克隆仓库
git clone https://github.com/VegeFin/Evolving-Werewolf.git
cd Evolving-Werewolf
# 2. 安装依赖
pnpm install # 或 npm install
# 3. 添加到 DSH web 配置
dsh plugin --profile web add ./
# 4. 启动 DSH Web
dsh web
After startup, the plugin automatically loads werewolf_* tools.
Configuration¶
The plugin relies on image-config.json to configure the Zhipu AI API key to enable image generation and recognition.
cp image-config.example.json image-config.json
Edit image-config.json and fill in the API key registered on the Zhipu Open Platform:
{
"apiKey": "your-api-key",
"baseURL": "https://open.bigmodel.cn/api/paas/v4",
"visionModel": "glm-4v-flash",
"drawModel": "cogview-3-flash",
"drawSize": "1024x1024",
"assetDir": "ui/assets"
}
knowledge.json stores knowledge base seeds; after each game, the engine automatically appends experience.
Typical Usage¶
Host-Side Tools¶
The host controls the game flow by calling DSH tools:
werewolf_start: Start the game, randomly assign identities, and generate eight AI players. IfhumanSeatis not specified, the system randomly assigns a human seat.werewolf_act: A player performs an action (18 action types).werewolf_status: View public state; the host can see the full role table and review report.werewolf_ask_rule: Query rules or role abilities.werewolf_abort: The host aborts the game.werewolf_look/werewolf_draw: Use vision or image-to-image models to analyze/generate images.
Player Actions (werewolf_act)¶
When the host calls werewolf_act, it must pass action and related parameters:
speech+text: Speak (daytime campaign speech or post-campaign daytime speech).vote+target: Vote (0 means abstain).sheriff_vote+target: Vote for sheriff.sheriff_run/sheriff_not: Run for sheriff / not run.direction+text=left/right: Sheriff sets speaking direction.kill+target+text: Werewolf selects kill target.seer+target: Seer checks.witch_save/witch_poison+target/witch_none: Witch save / poison / take no action.hunter+target: Hunter shoots (0 means no shoot).alive: Confirm online.review+text: Submit review.
Human Player Panel¶
After the game starts, visit http://127.0.0.1:<port>/werewolf/panel in a browser. The panel displays the identity card, event stream, speaking stage, and action area.
Directory Structure¶
The plugin directory structure is as follows:
Evolving-Werewolf/
├── lib/
│ └── index.js # 静态引擎主文件(v33)
├── ui/
│ ├── panel.html # 人类玩家面板
│ ├── assets/ # UI 资源
│ └── protos/ # UI 原型
├── archive/ # 动态版本归档(开发调试用)
├── image-config.example.json
├── knowledge.example.json
├── package.json
└── cordis.patch.yml
Use Cases and Notes¶
This plugin is suitable for developers who need to run multi-player logic games or simulated adversarial scenarios in a DSH environment. It provides a complete game loop and supports human players participating via the browser. Before use, please review the source code and license. The asset pipeline is optional and does not affect core gameplay.