@rrr2010/opencode-roundtable 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,198 @@
1
+ # opencode-roundtable
2
+
3
+ OpenCode plugin that orchestrates **multi-agent round-robin debates**.
4
+ Agents with different personalities debate a topic turn by turn, sharing
5
+ context while keeping their own system prompts and tools.
6
+
7
+ A built-in observer automatically consolidates every debate into an
8
+ executive summary.
9
+
10
+ ## Installation
11
+
12
+ ### Local (dev)
13
+
14
+ ```bash
15
+ cp src/roundtable.ts ~/.config/opencode/plugins/roundtable.ts
16
+ ```
17
+
18
+ Restart OpenCode. The plugin is auto-loaded from the plugins directory.
19
+
20
+ ### npm (coming soon)
21
+
22
+ ```json
23
+ {
24
+ "plugin": ["@your-ns/opencode-roundtable"]
25
+ }
26
+ ```
27
+
28
+ Add to `opencode.json` — OpenCode installs it with Bun on startup.
29
+
30
+ ## Features
31
+
32
+ - **Round-robin debate** — agents speak in sequence, each seeing the full discussion history
33
+ - **Shared context** — tool outputs and discoveries are visible to all participants
34
+ - **Built-in observer** — automatically consolidates the debate into an executive summary (overridable with a specific agent)
35
+ - **Isolated session** — the debate runs in a child session, keeping the main session clean
36
+ - **Extend mode** — continue a concluded roundtable with more rounds or a new topic
37
+ - **Agent discovery** — `available_agents` tool helps the orchestrator know which agents exist
38
+ - **Parallel roundtables** — multiple independent debates can run simultaneously
39
+ - **User intervention** — the human can jump into the debate at any time
40
+ - **Stuck session recovery** — if an extend is aborted mid-way, the next call auto-recovers
41
+
42
+ ## Tool API
43
+
44
+ ### `roundtable()`
45
+
46
+ ```typescript
47
+ roundtable({
48
+ agents?: string[], // Names in speaking order (min 2). Required for new debates.
49
+ prompt: string, // Topic or challenge. For multi-round, include per-round instructions.
50
+ rounds?: number, // Complete rounds (default: 1, max: 50)
51
+ observer?: string, // Agent for final consolidation (default: built-in)
52
+ sessionID?: string, // ses_xxxx — pass to extend a concluded debate
53
+ title?: string, // Custom title (default: auto-generated from prompt)
54
+ })
55
+ ```
56
+
57
+ **Returns:** `{ sessionID: string, summary: string }` after the debate concludes.
58
+
59
+ **Side effect:** injects system-level prompts into each agent's context (role, topic, turn routing, lifecycle signals).
60
+
61
+ ### `available_agents()`
62
+
63
+ ```typescript
64
+ available_agents()
65
+ ```
66
+
67
+ **Returns:** `"Available agents: pm, dev, rv, ..."` — a formatted string of agent names.
68
+
69
+ ## Usage Examples
70
+
71
+ ### Basic — one round, built-in observer
72
+
73
+ ```typescript
74
+ roundtable({
75
+ agents: ["pm", "dev"],
76
+ prompt: "What architecture should we use?",
77
+ })
78
+ ```
79
+
80
+ ### Multi-round with per-round instructions
81
+
82
+ ```typescript
83
+ roundtable({
84
+ agents: ["pm", "dev"],
85
+ prompt: "Round 1: list pros. Round 2: list cons. Round 3: propose an implementation plan.",
86
+ rounds: 3,
87
+ })
88
+ ```
89
+
90
+ ### Explicit observer
91
+
92
+ ```typescript
93
+ roundtable({
94
+ agents: ["pm", "dev"],
95
+ prompt: "Should we migrate to microservices?",
96
+ rounds: 2,
97
+ observer: "rv",
98
+ })
99
+ ```
100
+
101
+ ### Extend a concluded debate
102
+
103
+ ```typescript
104
+ roundtable({
105
+ sessionID: "ses_abc123",
106
+ rounds: 2,
107
+ prompt: "Dive deeper into operational costs",
108
+ })
109
+ ```
110
+
111
+ The session ID is injected into S1 as a noReply when the roundtable starts — check S1 context to find it.
112
+
113
+ ### Discover agents first
114
+
115
+ ```typescript
116
+ const agents = available_agents()
117
+ // agents => "Available agents: pm, dev, rv, build, plan"
118
+ roundtable({
119
+ agents: ["pm", "dev"],
120
+ prompt: "...",
121
+ })
122
+ ```
123
+
124
+ ## Configuration
125
+
126
+ Place `~/.config/opencode/roundtable.json` to override defaults:
127
+
128
+ ```json
129
+ {
130
+ "$schema": "https://raw.githubusercontent.com/opencode-ai/roundtable/main/docs/roundtable.schema.json",
131
+ "defaultTimeoutMs": 300000,
132
+ "loopSimilarityThreshold": 0.85,
133
+ "toolOutputPreviewMax": 500,
134
+ "maxRounds": 10,
135
+ "defaultObserverPrompt": "You are an impartial roundtable observer..."
136
+ }
137
+ ```
138
+
139
+ If the file doesn't exist, it's created automatically with defaults.
140
+
141
+ ## Tips
142
+
143
+ ### Agent selection
144
+
145
+ Choose agents whose expertise matches the topic:
146
+
147
+ | Agent | Best for |
148
+ |-------|----------|
149
+ | `pm` | Product decisions, strategy, trade-offs |
150
+ | `dev` | Technical complexity, implementation effort |
151
+ | `rv` | Code review, docs quality, inconsistency detection |
152
+ | `plan` | Architecture planning, scope definition |
153
+ | `build` | Implementation details, execution |
154
+
155
+ ### Multi-round strategy
156
+
157
+ For complex topics, structure rounds progressively:
158
+
159
+ 1. **Round 1:** Explore — each agent lists their perspective
160
+ 2. **Round 2:** Challenge — agents critique each other's positions
161
+ 3. **Round 3+:** Converge — propose concrete solutions
162
+
163
+ Include all round instructions in the `prompt` parameter — all agents see the full agenda.
164
+
165
+ ### Extend mode
166
+
167
+ - Use the session ID from the S1 noReply message
168
+ - Original topic is preserved; new prompt becomes the continuation
169
+ - Agents must be the same as the original debate
170
+ - Continue an extend for iterative refinement
171
+
172
+ ## Agent colors (recommended)
173
+
174
+ ```json
175
+ {
176
+ "agent": {
177
+ "pm": { "color": "#3498db" },
178
+ "dev": { "color": "#2ecc71" },
179
+ "rv": { "color": "#e74c3c" },
180
+ "plan": { "color": "#f39c12" },
181
+ "build": { "color": "#9b59b6" }
182
+ }
183
+ }
184
+ ```
185
+
186
+ ## Documentation
187
+
188
+ - [docs/SPEC.md](./docs/SPEC.md) — Full technical specification
189
+ - [docs/IMPLEMENTATION.md](./docs/IMPLEMENTATION.md) — Phased implementation plan
190
+
191
+ ## Requirements
192
+
193
+ - OpenCode (latest version)
194
+ - No external dependencies
195
+
196
+ ## License
197
+
198
+ MIT