Skip to content

OakcoderX/duida

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DuiDa 对打

Where AI agents debate, so you don't have to.

DuiDa is a multi-role structured debate framework for AI agents. Define fighters with opposing stances, set the rules, and let them argue it out — producing structured decisions along the way.

Why DuiDa?

CrewAI lets agents do things. DuiDa lets agents think things.

Most multi-agent frameworks focus on task execution. DuiDa focuses on adversarial discussion → structured decision-making. Think of it as a debate arena where AI roles with different perspectives clash, and a recorder extracts the consensus into structured output.

Quick Start

npm install duida

# Or run directly
npx duida fight --arena templates/screenwriting/short-drama.yaml --input novel.txt

Core Concepts

Arena (擂台)

Who fights, what rules. Defined in YAML:

id: short-drama
name: 不挑活儿编剧室
referee: producer-li
recorder: writer-zhang

fighters:
  - id: producer-li
    name: 李制片
    role: referee
    stance: |
      你是编剧室的项目经理和总导演...

  - id: writer-wang
    name: 王编剧 (远见家)
    role: fighter
    stance: |
      你是一个充满理想主义的编剧...

rounds:
  - id: synopsis
    name: 总纲撰写
    objective: 完成所有分集梗概
    next: detailed

Board (白板)

Current score and match history. Updated after each bout.

Bout (回合)

One LLM call = one round of debate. The core loop:

import { run, loadArena, GeminiAdapter } from 'duida';

const arena = loadArena('./my-arena.yaml');
const adapter = new GeminiAdapter({ apiKey: process.env.GEMINI_API_KEY });

const board = await run(arena, { adapter }, {
  topic: '改编这部小说为80集短剧',
  sourceText: novelText,
});

console.log(board.score); // Structured output (e.g. StoryBible)

Signal System

The referee controls the loop via signals:

  • CONTINUE — keep debating
  • NEXT_ROUND — move to next stage
  • PAUSE — wait for user input
  • STOP — all done

Built-in Templates

Template Description
screenwriting/short-drama 不挑活儿编剧室 — 短剧/电影/动漫通用
screenwriting/children-content 少儿内容编剧室 — 4-12岁儿童
screenwriting/romance-drama 花千树编剧室 — 高概念爱情
screenwriting/sci-fi 深空编剧室 — 硬科幻
screenwriting/chinese-film 中国电影编剧室 — 原创电影

Create Your Own Arena

Any scenario where multiple perspectives need to clash:

  • Product Review — PM + Engineer + Designer + QA
  • Investment Decision — Analyst + Risk + Fund Manager
  • Academic Review — 3 Reviewers + Editor
  • Legal Analysis — Prosecution + Defense + Judge

Just write a YAML file. No code needed.

Multi-Model Support

import { GeminiAdapter, OpenAIAdapter, ClaudeAdapter } from 'duida';

// Pick your LLM
const adapter = new GeminiAdapter({ apiKey: '...' });
const adapter = new OpenAIAdapter({ apiKey: '...' });
const adapter = new ClaudeAdapter({ apiKey: '...' });

Origin

DuiDa is abstracted from AIKuaiDa (AI快打编剧室), a screenwriting tool that uses multi-role AI discussion to produce structured screenplays.

The name DuiDa (对打) means "strike against" in Chinese — one word, three meanings:

  • 对打 (duì dǎ) — clash, strike against
  • 对话 (duì huà) — dialogue, discussion
  • 对决 (duì jué) — showdown, duel

License

Apache-2.0

About

DuiDa (对打) — Multi-role structured debate framework. Where AI agents debate, so you don't have to.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages