acpx-team 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 +119 -0
- package/acpx/SKILL.md +546 -0
- package/acpx/bin/acpx-council +374 -0
- package/acpx/config/agent-profiles.yaml +245 -0
- package/acpx/config/role-templates/_README.md +41 -0
- package/acpx/lib/protocols.sh +521 -0
- package/acpx/lib/roles.sh +339 -0
- package/acpx/lib/synthesize.sh +187 -0
- package/acpx/lib/workspace.sh +274 -0
- package/acpx/references/protocols.md +273 -0
- package/acpx/references/roles.md +286 -0
- package/acpx-council.js +10 -0
- package/package.json +47 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# workspace.sh — Shared workspace management for acpx council
|
|
3
|
+
# Manages .acpx-workspace/ for inter-agent context sharing
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
ACPX_WORKSPACE="${ACPX_WORKSPACE:-.acpx-workspace}"
|
|
8
|
+
|
|
9
|
+
# ─── Core Functions ────────────────────────────────────────────
|
|
10
|
+
|
|
11
|
+
workspace_init() {
|
|
12
|
+
local task="${1:?Usage: workspace_init <task_description>}"
|
|
13
|
+
local protocol="${2:-auto}"
|
|
14
|
+
|
|
15
|
+
rm -rf "$ACPX_WORKSPACE"
|
|
16
|
+
mkdir -p "$ACPX_WORKSPACE/agents"
|
|
17
|
+
|
|
18
|
+
# Write shared context
|
|
19
|
+
cat > "$ACPX_WORKSPACE/context.md" <<CTX
|
|
20
|
+
# Council Context
|
|
21
|
+
|
|
22
|
+
## Task
|
|
23
|
+
${task}
|
|
24
|
+
|
|
25
|
+
## Protocol
|
|
26
|
+
${protocol}
|
|
27
|
+
|
|
28
|
+
## Created
|
|
29
|
+
$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
30
|
+
|
|
31
|
+
## Status
|
|
32
|
+
Phase: plan
|
|
33
|
+
Round: 0
|
|
34
|
+
CTX
|
|
35
|
+
|
|
36
|
+
# Initialize empty decision log
|
|
37
|
+
cat > "$ACPX_WORKSPACE/decisions.md" <<DEC
|
|
38
|
+
# Decisions Log
|
|
39
|
+
_Auto-populated as consensus forms_
|
|
40
|
+
|
|
41
|
+
## Agreed Points
|
|
42
|
+
_(none yet)_
|
|
43
|
+
|
|
44
|
+
## Divergent Points
|
|
45
|
+
_(none yet)_
|
|
46
|
+
|
|
47
|
+
## Action Items
|
|
48
|
+
_(none yet)_
|
|
49
|
+
DEC
|
|
50
|
+
|
|
51
|
+
# Initialize open questions
|
|
52
|
+
> "$ACPX_WORKSPACE/open-questions.md"
|
|
53
|
+
> "$ACPX_WORKSPACE/plan.md"
|
|
54
|
+
|
|
55
|
+
echo "$ACPX_WORKSPACE"
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
workspace_set_phase() {
|
|
59
|
+
local phase="${1:?Usage: workspace_set_phase <plan|execute|review|done>}"
|
|
60
|
+
if [[ ! -d "$ACPX_WORKSPACE" ]]; then
|
|
61
|
+
echo "Error: workspace not initialized. Run workspace_init first." >&2
|
|
62
|
+
return 1
|
|
63
|
+
fi
|
|
64
|
+
sed -i.bak "s/Phase: .*/Phase: ${phase}/" "$ACPX_WORKSPACE/context.md"
|
|
65
|
+
rm -f "$ACPX_WORKSPACE/context.md.bak"
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
workspace_set_round() {
|
|
69
|
+
local round="${1:?Usage: workspace_set_round <number>}"
|
|
70
|
+
if [[ ! -d "$ACPX_WORKSPACE" ]]; then
|
|
71
|
+
echo "Error: workspace not initialized." >&2
|
|
72
|
+
return 1
|
|
73
|
+
fi
|
|
74
|
+
sed -i.bak "s/Round: .*/Round: ${round}/" "$ACPX_WORKSPACE/context.md"
|
|
75
|
+
rm -f "$ACPX_WORKSPACE/context.md.bak"
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
# ─── Context ───────────────────────────────────────────────────
|
|
79
|
+
|
|
80
|
+
workspace_write_context() {
|
|
81
|
+
local key="${1:?Usage: workspace_write_context <key> <value>}"
|
|
82
|
+
local value="${2:?missing value}"
|
|
83
|
+
local file="$ACPX_WORKSPACE/context.md"
|
|
84
|
+
|
|
85
|
+
# Append key-value under a section
|
|
86
|
+
printf '\n## %s\n%s\n' "$key" "$value" >> "$file"
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
workspace_read_context() {
|
|
90
|
+
if [[ -f "$ACPX_WORKSPACE/context.md" ]]; then
|
|
91
|
+
cat "$ACPX_WORKSPACE/context.md"
|
|
92
|
+
else
|
|
93
|
+
echo "Error: workspace not initialized." >&2
|
|
94
|
+
return 1
|
|
95
|
+
fi
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
# ─── Agent Outputs ─────────────────────────────────────────────
|
|
99
|
+
|
|
100
|
+
workspace_write_agent_output() {
|
|
101
|
+
local agent="${1:?Usage: workspace_write_agent_output <agent> <round> [file]}"
|
|
102
|
+
local round="${2:?missing round}"
|
|
103
|
+
local source="${3:-/dev/stdin}"
|
|
104
|
+
|
|
105
|
+
local dir="$ACPX_WORKSPACE/agents/${agent}"
|
|
106
|
+
mkdir -p "$dir"
|
|
107
|
+
|
|
108
|
+
# Write round output
|
|
109
|
+
if [[ "$source" == "/dev/stdin" ]]; then
|
|
110
|
+
cat > "$dir/round-${round}.md"
|
|
111
|
+
else
|
|
112
|
+
cp "$source" "$dir/round-${round}.md"
|
|
113
|
+
fi
|
|
114
|
+
|
|
115
|
+
# Update latest symlink
|
|
116
|
+
ln -sf "round-${round}.md" "$dir/latest.md"
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
workspace_read_agent_output() {
|
|
120
|
+
local agent="${1:?Usage: workspace_read_agent_output <agent> [round]}"
|
|
121
|
+
local round="${2:-latest}"
|
|
122
|
+
|
|
123
|
+
local file="$ACPX_WORKSPACE/agents/${agent}/round-${round}.md"
|
|
124
|
+
if [[ -f "$file" ]]; then
|
|
125
|
+
cat "$file"
|
|
126
|
+
elif [[ "$round" == "latest" && -L "$ACPX_WORKSPACE/agents/${agent}/latest.md" ]]; then
|
|
127
|
+
cat "$ACPX_WORKSPACE/agents/${agent}/latest.md"
|
|
128
|
+
else
|
|
129
|
+
echo "Error: no output for agent=${agent} round=${round}" >&2
|
|
130
|
+
return 1
|
|
131
|
+
fi
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
workspace_list_agents() {
|
|
135
|
+
if [[ ! -d "$ACPX_WORKSPACE/agents" ]]; then
|
|
136
|
+
echo "Error: workspace not initialized." >&2
|
|
137
|
+
return 1
|
|
138
|
+
fi
|
|
139
|
+
ls -1 "$ACPX_WORKSPACE/agents/" 2>/dev/null || echo "(no agents)"
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
# ─── Decisions ─────────────────────────────────────────────────
|
|
143
|
+
|
|
144
|
+
workspace_add_decision() {
|
|
145
|
+
local category="${1:?Usage: workspace_add_decision <agreed|divergent|action> <text>}"
|
|
146
|
+
local text="${2:?missing text}"
|
|
147
|
+
local file="$ACPX_WORKSPACE/decisions.md"
|
|
148
|
+
|
|
149
|
+
local marker
|
|
150
|
+
case "$category" in
|
|
151
|
+
agreed) marker="## Agreed Points" ;;
|
|
152
|
+
divergent) marker="## Divergent Points" ;;
|
|
153
|
+
action) marker="## Action Items" ;;
|
|
154
|
+
*) echo "Error: category must be agreed|divergent|action" >&2; return 1 ;;
|
|
155
|
+
esac
|
|
156
|
+
|
|
157
|
+
# Replace the _(none yet)_ or append after the section
|
|
158
|
+
if grep -q "_((none yet))_" "$file" 2>/dev/null || grep -q "_(none yet)_" "$file" 2>/dev/null; then
|
|
159
|
+
sed -i.bak "/${marker}/,+1 s/_(none yet)_/- ${text}/" "$file"
|
|
160
|
+
rm -f "$file.bak"
|
|
161
|
+
else
|
|
162
|
+
# Insert after the section header
|
|
163
|
+
sed -i.bak "/${marker}/a\\- ${text}" "$file"
|
|
164
|
+
rm -f "$file.bak"
|
|
165
|
+
fi
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
# ─── Synthesis ─────────────────────────────────────────────────
|
|
169
|
+
|
|
170
|
+
workspace_write_synthesis() {
|
|
171
|
+
local source="${1:-/dev/stdin}"
|
|
172
|
+
if [[ "$source" == "/dev/stdin" ]]; then
|
|
173
|
+
cat > "$ACPX_WORKSPACE/synthesis.md"
|
|
174
|
+
else
|
|
175
|
+
cp "$source" "$ACPX_WORKSPACE/synthesis.md"
|
|
176
|
+
fi
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
workspace_read_synthesis() {
|
|
180
|
+
if [[ -f "$ACPX_WORKSPACE/synthesis.md" ]]; then
|
|
181
|
+
cat "$ACPX_WORKSPACE/synthesis.md"
|
|
182
|
+
else
|
|
183
|
+
echo "Error: no synthesis available yet." >&2
|
|
184
|
+
return 1
|
|
185
|
+
fi
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
# ─── Plan ──────────────────────────────────────────────────────
|
|
189
|
+
|
|
190
|
+
workspace_write_plan() {
|
|
191
|
+
local source="${1:-/dev/stdin}"
|
|
192
|
+
if [[ "$source" == "/dev/stdin" ]]; then
|
|
193
|
+
cat > "$ACPX_WORKSPACE/plan.md"
|
|
194
|
+
else
|
|
195
|
+
cp "$source" "$ACPX_WORKSPACE/plan.md"
|
|
196
|
+
fi
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
workspace_read_plan() {
|
|
200
|
+
if [[ -f "$ACPX_WORKSPACE/plan.md" ]]; then
|
|
201
|
+
cat "$ACPX_WORKSPACE/plan.md"
|
|
202
|
+
else
|
|
203
|
+
echo "Error: no plan available yet." >&2
|
|
204
|
+
return 1
|
|
205
|
+
fi
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
# ─── Gather all agent outputs for a round ──────────────────────
|
|
209
|
+
|
|
210
|
+
workspace_gather_round() {
|
|
211
|
+
local round="${1:?Usage: workspace_gather_round <round>}"
|
|
212
|
+
local result=""
|
|
213
|
+
|
|
214
|
+
for agent_dir in "$ACPX_WORKSPACE/agents"/*/; do
|
|
215
|
+
[[ -d "$agent_dir" ]] || continue
|
|
216
|
+
local agent_name
|
|
217
|
+
agent_name=$(basename "$agent_dir")
|
|
218
|
+
local file="${agent_dir}round-${round}.md"
|
|
219
|
+
if [[ -f "$file" ]]; then
|
|
220
|
+
result="${result}---\n## ${agent_name}\n\n$(cat "$file")\n\n"
|
|
221
|
+
fi
|
|
222
|
+
done
|
|
223
|
+
|
|
224
|
+
printf '%b' "$result"
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
# ─── Cleanup ───────────────────────────────────────────────────
|
|
228
|
+
|
|
229
|
+
workspace_cleanup() {
|
|
230
|
+
if [[ -d "$ACPX_WORKSPACE" ]]; then
|
|
231
|
+
rm -rf "$ACPX_WORKSPACE"
|
|
232
|
+
echo "Workspace cleaned up."
|
|
233
|
+
fi
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
workspace_archive() {
|
|
237
|
+
local name="${1:-council-$(date +%Y%m%d-%H%M%S)}"
|
|
238
|
+
if [[ -d "$ACPX_WORKSPACE" ]]; then
|
|
239
|
+
tar czf "${name}.tar.gz" -C "$(dirname "$ACPX_WORKSPACE")" "$(basename "$ACPX_WORKSPACE")"
|
|
240
|
+
echo "Workspace archived to ${name}.tar.gz"
|
|
241
|
+
fi
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
# ─── Status ────────────────────────────────────────────────────
|
|
245
|
+
|
|
246
|
+
workspace_status() {
|
|
247
|
+
if [[ ! -d "$ACPX_WORKSPACE" ]]; then
|
|
248
|
+
echo "No active workspace."
|
|
249
|
+
return 0
|
|
250
|
+
fi
|
|
251
|
+
|
|
252
|
+
echo "Workspace: $ACPX_WORKSPACE"
|
|
253
|
+
grep -E "^(Phase|Round):" "$ACPX_WORKSPACE/context.md" 2>/dev/null || true
|
|
254
|
+
echo ""
|
|
255
|
+
echo "Agents:"
|
|
256
|
+
for agent_dir in "$ACPX_WORKSPACE/agents"/*/; do
|
|
257
|
+
[[ -d "$agent_dir" ]] || continue
|
|
258
|
+
local name rounds
|
|
259
|
+
name=$(basename "$agent_dir")
|
|
260
|
+
rounds=$(ls -1 "${agent_dir}"round-*.md 2>/dev/null | wc -l | tr -d ' ')
|
|
261
|
+
echo " ${name}: ${rounds} round(s)"
|
|
262
|
+
done
|
|
263
|
+
echo ""
|
|
264
|
+
if [[ -f "$ACPX_WORKSPACE/synthesis.md" ]]; then
|
|
265
|
+
echo "Synthesis: available"
|
|
266
|
+
else
|
|
267
|
+
echo "Synthesis: pending"
|
|
268
|
+
fi
|
|
269
|
+
if [[ -f "$ACPX_WORKSPACE/plan.md" && -s "$ACPX_WORKSPACE/plan.md" ]]; then
|
|
270
|
+
echo "Plan: available"
|
|
271
|
+
else
|
|
272
|
+
echo "Plan: pending"
|
|
273
|
+
fi
|
|
274
|
+
}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# Collaboration Protocols
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
|
|
5
|
+
1. [Protocol 1: Parallel Fan-Out](#protocol-1-parallel-fan-out--synthesis)
|
|
6
|
+
2. [Protocol 2: Round-Robin Deliberation](#protocol-2-round-robin-deliberation)
|
|
7
|
+
3. [Protocol 3: Role-Specialized Council](#protocol-3-role-specialized-council-recommended)
|
|
8
|
+
4. [Protocol 4: Adversarial Debate](#protocol-4-adversarial-debate)
|
|
9
|
+
5. [Protocol 5: Sequential Pipeline](#protocol-5-sequential-pipeline)
|
|
10
|
+
6. [Protocol 6: DOVA Hybrid](#protocol-6-dova-hybrid-3-phase)
|
|
11
|
+
7. [Protocol 7: DCI Structured Deliberation](#protocol-7-dci-structured-deliberation)
|
|
12
|
+
8. [Decision Matrix](#decision-matrix)
|
|
13
|
+
9. [Cost Estimation](#cost-estimation)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Protocol 1: Parallel Fan-Out → Synthesis
|
|
18
|
+
|
|
19
|
+
Send the same task to N agents in parallel, collect, synthesize. Fastest protocol.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Setup
|
|
23
|
+
acpx claude sessions new --name fan-claude && acpx codex sessions new --name fan-codex && acpx gemini sessions new --name fan-gemini
|
|
24
|
+
|
|
25
|
+
# Fan-out in parallel
|
|
26
|
+
acpx --format quiet claude -s fan-claude "Task description here" > /tmp/fan1.txt &
|
|
27
|
+
acpx --format quiet codex -s fan-codex "Task description here" > /tmp/fan2.txt &
|
|
28
|
+
acpx --format quiet gemini -s fan-gemini "Task description here" > /tmp/fan3.txt &
|
|
29
|
+
wait
|
|
30
|
+
|
|
31
|
+
# Synthesize (orchestrator combines)
|
|
32
|
+
echo "[Claude]: $(cat /tmp/fan1.txt)\n\n[Codex]: $(cat /tmp/fan2.txt)\n\n[Gemini]: $(cat /tmp/fan3.txt)"
|
|
33
|
+
|
|
34
|
+
# Cleanup
|
|
35
|
+
acpx claude sessions close fan-claude && acpx codex sessions close fan-codex && acpx gemini sessions close fan-gemini
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**When to use**: Quick multi-model opinion, getting diverse perspectives fast, any "get N opinions" task.
|
|
39
|
+
|
|
40
|
+
**Pros**: Fast (parallel), independent (no sycophancy), simple. **Cons**: No inter-agent learning, synthesis quality is the bottleneck.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Protocol 2: Round-Robin Deliberation
|
|
45
|
+
|
|
46
|
+
Round 1: parallel independent analysis. Round 2: agents see all responses and revise.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Setup
|
|
50
|
+
acpx claude sessions new --name r1c && acpx codex sessions new --name r1x && acpx gemini sessions new --name r1g
|
|
51
|
+
|
|
52
|
+
# Round 1: parallel
|
|
53
|
+
acpx --format quiet claude -s r1c "Analyze: <task>" > /tmp/rr1-c.txt &
|
|
54
|
+
acpx --format quiet codex -s r1x "Analyze: <task>" > /tmp/rr1-x.txt &
|
|
55
|
+
acpx --format quiet gemini -s r1g "Analyze: <task>" > /tmp/rr1-g.txt &
|
|
56
|
+
wait
|
|
57
|
+
|
|
58
|
+
# Build merged context
|
|
59
|
+
MERGED="[Claude]: $(cat /tmp/rr1-c.txt)\n\n[Codex]: $(cat /tmp/rr1-x.txt)\n\n[Gemini]: $(cat /tmp/rr1-g.txt)"
|
|
60
|
+
|
|
61
|
+
# Round 2: revise (same sessions preserve context)
|
|
62
|
+
acpx --format quiet claude -s r1c "Other reviewers:\n$MERGED\n\nRevise your assessment." > /tmp/rr2-c.txt &
|
|
63
|
+
acpx --format quiet codex -s r1x "Other reviewers:\n$MERGED\n\nRevise your assessment." > /tmp/rr2-x.txt &
|
|
64
|
+
acpx --format quiet gemini -s r1g "Other reviewers:\n$MERGED\n\nRevise your assessment." > /tmp/rr2-g.txt &
|
|
65
|
+
wait
|
|
66
|
+
|
|
67
|
+
# Final synthesis
|
|
68
|
+
echo "=== Round 2 Consensus ===\n\n[Claude]: $(cat /tmp/rr2-c.txt)\n\n[Codex]: $(cat /tmp/rr2-x.txt)\n\n[Gemini]: $(cat /tmp/rr2-g.txt)"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**When to use**: Design decisions, code review, architecture choices. The default deliberation protocol.
|
|
72
|
+
|
|
73
|
+
**Pros**: Agents learn from each other, session resume preserves context. **Cons**: 2× token cost, sycophancy risk (agents converge too fast).
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Protocol 3: Role-Specialized Council (Recommended)
|
|
78
|
+
|
|
79
|
+
Same as Protocol 2 but with role prefixes. See `references/roles.md` for role definitions and presets.
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Setup with team preset: code_review
|
|
83
|
+
acpx claude sessions new --name cr-claude && acpx codex sessions new --name cr-codex && acpx gemini sessions new --name cr-gemini
|
|
84
|
+
|
|
85
|
+
# Load role prefixes
|
|
86
|
+
SECURITY="[ROLE: Security Expert]\nAnalyze from a security perspective. Rate findings: CRITICAL/HIGH/MEDIUM/LOW."
|
|
87
|
+
PERF="[ROLE: Performance Expert]\nAnalyze from a performance perspective. Quantify where possible."
|
|
88
|
+
TESTING="[ROLE: Testing Expert]\nAnalyze from a testing perspective. List specific test cases needed."
|
|
89
|
+
|
|
90
|
+
# Round 1: role-specialized parallel analysis
|
|
91
|
+
acpx --format quiet claude -s cr-claude "$SECURITY\n\nReview src/auth.ts for vulnerabilities." > /tmp/cr1-c.txt &
|
|
92
|
+
acpx --format quiet codex -s cr-codex "$PERF\n\nReview src/auth.ts for performance issues." > /tmp/cr1-x.txt &
|
|
93
|
+
acpx --format quiet gemini -s cr-gemini "$TESTING\n\nReview src/auth.ts for test coverage gaps." > /tmp/cr1-g.txt &
|
|
94
|
+
wait
|
|
95
|
+
|
|
96
|
+
# Round 2: cross-review with role persistence
|
|
97
|
+
ALL="[Security (Claude)]: $(cat /tmp/cr1-c.txt)\n\n[Perf (Codex)]: $(cat /tmp/cr1-x.txt)\n\n[Testing (Gemini)]: $(cat /tmp/cr1-g.txt)"
|
|
98
|
+
|
|
99
|
+
acpx --format quiet claude -s cr-claude "Other experts:\n$ALL\n\n[ROLE: Security Expert — Deliberation] Maintain security perspective. Identify implications others missed." > /tmp/cr2-c.txt &
|
|
100
|
+
acpx --format quiet codex -s cr-codex "Other experts:\n$ALL\n\n[ROLE: Performance Expert — Deliberation] Check if proposals introduce performance regressions." > /tmp/cr2-x.txt &
|
|
101
|
+
acpx --format quiet gemini -s cr-gemini "Other experts:\n$ALL\n\n[ROLE: Testing Expert — Deliberation] Identify testing implications others missed." > /tmp/cr2-g.txt &
|
|
102
|
+
wait
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**When to use**: Security audits, architecture reviews, PR reviews, any task where diverse expert perspectives improve quality. **The recommended default protocol.**
|
|
106
|
+
|
|
107
|
+
**Pros**: Prevents redundant analysis, matches model strengths to roles, composable. **Cons**: Overhead for simple tasks.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Protocol 4: Adversarial Debate
|
|
112
|
+
|
|
113
|
+
Two agents argue opposing positions across rounds, then a judge synthesizes.
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Setup: advocate, critic, judge
|
|
117
|
+
acpx claude sessions new --name bull && acpx codex sessions new --name bear && acpx gemini sessions new --name judge
|
|
118
|
+
|
|
119
|
+
# Round 1: opening arguments
|
|
120
|
+
acpx --format quiet claude -s bull "Argue FOR adopting React Server Components in our project. Provide specific technical benefits." > /tmp/bull1.txt
|
|
121
|
+
acpx --format quiet codex -s bear "Argue AGAINST adopting React Server Components in our project. Provide specific technical risks." > /tmp/bear1.txt
|
|
122
|
+
|
|
123
|
+
# Round 2: cross-arguments (each sees opponent)
|
|
124
|
+
acpx --format quiet claude -s bull "The skeptic argues:\n$(cat /tmp/bear1.txt)\n\nCounter-argue. Address each concern." > /tmp/bull2.txt
|
|
125
|
+
acpx --format quiet codex -s bear "The advocate argues:\n$(cat /tmp/bull1.txt)\n\nCounter-argue. Address each claim." > /tmp/bear2.txt
|
|
126
|
+
|
|
127
|
+
# Judge synthesis
|
|
128
|
+
acpx --format quiet gemini -s judge "You are the judge. Synthesize this debate into a final recommendation.\n\n[FOR RSC]:\n$(cat /tmp/bull2.txt)\n\n[AGAINST RSC]:\n$(cat /tmp/bear2.txt)\n\nProvide:\n1. Summary of key arguments on each side\n2. Points of agreement\n3. Unresolved tensions\n4. Your final recommendation with confidence level (HIGH/MEDIUM/LOW)"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**When to use**: Go/no-go decisions, technology choices, "should we do X?" questions, high-stakes architectural decisions.
|
|
132
|
+
|
|
133
|
+
**Pros**: Forces engagement with counterarguments, reduces groupthink. **Cons**: Expensive, can produce false equivalence.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Protocol 5: Sequential Pipeline
|
|
138
|
+
|
|
139
|
+
Chain agents in order — each sees prior agents' full output. Write → Review → Edit.
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
# Step 1: Write
|
|
143
|
+
acpx claude sessions new --name writer
|
|
144
|
+
acpx --format quiet claude -s writer "Implement user authentication with JWT. Include login, signup, and token refresh." > /tmp/pipe-write.txt
|
|
145
|
+
|
|
146
|
+
# Step 2: Review
|
|
147
|
+
acpx codex sessions new --name reviewer
|
|
148
|
+
acpx --format quiet codex -s reviewer "Review this implementation for bugs, security issues, and edge cases:\n$(cat /tmp/pipe-write.txt)\n\nRate: CRITICAL/HIGH/MEDIUM/LOW for each finding." > /tmp/pipe-review.txt
|
|
149
|
+
|
|
150
|
+
# Step 3: Edit (fix issues from review)
|
|
151
|
+
acpx claude -s writer "Fix the issues identified in this review:\n$(cat /tmp/pipe-review.txt)\n\nOriginal code:\n$(cat /tmp/pipe-write.txt)" > /tmp/pipe-final.txt
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**When to use**: Write-review-edit cycles, implementation with quality gates, any ordered workflow.
|
|
155
|
+
|
|
156
|
+
**Pros**: Simplest to implement, clear audit trail, full context preserved. **Cons**: Sequential bottleneck, total latency = sum of all agents.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Protocol 6: DOVA Hybrid (3-Phase)
|
|
161
|
+
|
|
162
|
+
Ensemble → Blackboard → Iterative Refinement. Research-backed (0.82 confidence vs 0.58 single agent).
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# Phase 1: Ensemble (parallel independent solutions)
|
|
166
|
+
acpx claude sessions new --name dova-c && acpx codex sessions new --name dova-x && acpx gemini sessions new --name dova-g
|
|
167
|
+
|
|
168
|
+
acpx --format quiet claude -s dova-c "Solve: <task>. Provide your solution and rate your confidence (0-1)." > /tmp/do1.txt &
|
|
169
|
+
acpx --format quiet codex -s dova-x "Solve: <task>. Provide your solution and rate your confidence (0-1)." > /tmp/do2.txt &
|
|
170
|
+
acpx --format quiet gemini -s dova-g "Solve: <task>. Provide your solution and rate your confidence (0-1)." > /tmp/do3.txt &
|
|
171
|
+
wait
|
|
172
|
+
|
|
173
|
+
# Check agreement — if all confident and aligned, skip to synthesis
|
|
174
|
+
# (orchestrator evaluates)
|
|
175
|
+
|
|
176
|
+
# Phase 2: Blackboard (synthesize all solutions)
|
|
177
|
+
ALL="[Claude (conf: ?)]: $(cat /tmp/do1.txt)\n\n[Codex (conf: ?)]: $(cat /tmp/do2.txt)\n\n[Gemini (conf: ?)]: $(cat /tmp/do3.txt)"
|
|
178
|
+
acpx --format quiet claude -s dova-c "Synthesize these independent solutions into the best combined approach:\n$ALL\n\nRetain the strongest elements from each. Note any disagreements." > /tmp/board.txt
|
|
179
|
+
|
|
180
|
+
# Phase 3: Iterative refinement (2 rounds max)
|
|
181
|
+
acpx --format quiet claude -s dova-c "Critique and improve this synthesis:\n$(cat /tmp/board.txt)" > /tmp/ref1.txt
|
|
182
|
+
acpx --format quiet codex -s dova-x "Critique and improve this synthesis:\n$(cat /tmp/board.txt)" > /tmp/ref2.txt
|
|
183
|
+
# Optional second refinement round (diminishing returns beyond 2)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**When to use**: Complex analysis, research tasks, problems where quality justifies cost.
|
|
187
|
+
|
|
188
|
+
**Pros**: Highest quality (research-backed), adaptive (skip phases if high agreement). **Cons**: 3 phases = high token cost, complex orchestration.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Protocol 7: DCI Structured Deliberation
|
|
193
|
+
|
|
194
|
+
Most rigorous protocol with typed epistemic acts, 5 phases, and guaranteed convergence. Research-backed but expensive (~62× single agent cost).
|
|
195
|
+
|
|
196
|
+
**5 Phases**: Arrival → Independent First Thought → Mutual Engagement → Collective Shaping → Closure
|
|
197
|
+
|
|
198
|
+
**14 Typed Acts** (use as structured instructions in prompts):
|
|
199
|
+
|
|
200
|
+
| Family | Acts | Purpose |
|
|
201
|
+
|---|---|---|
|
|
202
|
+
| Orienting | frame, clarify, reframe | Define the problem |
|
|
203
|
+
| Generative | propose, extend, spawn | Generate solutions |
|
|
204
|
+
| Critical | ask, challenge | Pressure-test |
|
|
205
|
+
| Integrative | bridge, synthesize, recall | Combine ideas |
|
|
206
|
+
| Epistemic | ground, update | Evidence management |
|
|
207
|
+
| Decisional | recommend | Final decision |
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# Phase 1: Arrival — agents frame the problem
|
|
211
|
+
acpx claude sessions new --name dci1 && acpx codex sessions new --name dci2
|
|
212
|
+
acpx --format quiet claude -s dci1 "ACT: frame. Define the core problem with this task: <task>. What are we really trying to solve?" > /tmp/dci-f1.txt
|
|
213
|
+
acpx --format quiet codex -s dci2 "ACT: frame. Define the core problem with this task: <task>. What are we really trying to solve?" > /tmp/dci-f2.txt
|
|
214
|
+
|
|
215
|
+
# Phase 2: Independent First Thought — propose solutions without seeing others
|
|
216
|
+
acpx --format quiet claude -s dci1 "ACT: propose. Given your framing, propose a solution approach. Include rationale." > /tmp/dci-p1.txt &
|
|
217
|
+
acpx --format quiet codex -s dci2 "ACT: propose. Given your framing, propose a solution approach. Include rationale." > /tmp/dci-p2.txt &
|
|
218
|
+
wait
|
|
219
|
+
|
|
220
|
+
# Phase 3: Mutual Engagement — challenge and bridge
|
|
221
|
+
ALL="[Agent 1]: $(cat /tmp/dci-p1.txt)\n\n[Agent 2]: $(cat /tmp/dci-p2.txt)"
|
|
222
|
+
acpx --format quiet claude -s dci1 "ACT: challenge + bridge. Review proposals:\n$ALL\n\nChallenge weaknesses. Then bridge to create a combined approach." > /tmp/dci-c1.txt
|
|
223
|
+
acpx --format quiet codex -s dci2 "ACT: challenge + bridge. Review proposals:\n$ALL\n\nChallenge weaknesses. Then bridge to create a combined approach." > /tmp/dci-c2.txt
|
|
224
|
+
|
|
225
|
+
# Phase 4: Collective Shaping
|
|
226
|
+
ALL2="[A1 revised]: $(cat /tmp/dci-c1.txt)\n\n[A2 revised]: $(cat /tmp/dci-c2.txt)"
|
|
227
|
+
acpx --format quiet claude -s dci1 "ACT: synthesize. Combine into a unified recommendation:\n$ALL2\n\nIdentify: agreed points, tensions, and open questions." > /tmp/dci-final.txt
|
|
228
|
+
|
|
229
|
+
# Phase 5: Closure — always produces a decision packet
|
|
230
|
+
acpx --format quiet claude -s dci1 "ACT: recommend. Final decision packet:\n1. Selected option\n2. Residual objections (if any)\n3. Conditions to reopen discussion"
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**When to use**: Consequential decisions, multi-stakeholder tradeoffs, architecture-level choices where process quality matters.
|
|
234
|
+
|
|
235
|
+
**Pros**: Most rigorous, guarantees convergence, preserves dissent. **Cons**: Very expensive (~62× cost), complex to implement, overkill for routine tasks.
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Decision Matrix
|
|
240
|
+
|
|
241
|
+
| Protocol | Speed | Quality | Cost | Complexity | Best For |
|
|
242
|
+
|---|:---:|:---:|:---:|:---:|---|
|
|
243
|
+
| 1. Fan-Out | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | 💰 | Low | Quick multi-opinion |
|
|
244
|
+
| 2. Deliberation | ⭐⭐⭐ | ⭐⭐⭐⭐ | 💰💰 | Medium | Design decisions |
|
|
245
|
+
| 3. Role Council | ⭐⭐⭐ | ⭐⭐⭐⭐⭐ | 💰💰 | Medium | Reviews, audits |
|
|
246
|
+
| 4. Adversarial | ⭐⭐ | ⭐⭐⭐⭐ | 💰💰💰 | High | Go/no-go choices |
|
|
247
|
+
| 5. Pipeline | ⭐⭐ | ⭐⭐⭐ | 💰 | Very Low | Write-review-edit |
|
|
248
|
+
| 6. DOVA Hybrid | ⭐ | ⭐⭐⭐⭐⭐ | 💰💰💰💰 | High | Complex analysis |
|
|
249
|
+
| 7. DCI Structured | ⭐ | ⭐⭐⭐⭐⭐ | 💰💰💰💰💰 | Very High | Critical decisions |
|
|
250
|
+
|
|
251
|
+
**Default recommendation**: Protocol 3 (Role Council) for most tasks. Protocol 1 (Fan-Out) for quick checks. Protocol 4 (Adversarial) for high-stakes decisions.
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Cost Estimation
|
|
256
|
+
|
|
257
|
+
Rough token cost multipliers relative to a single agent solving the task alone:
|
|
258
|
+
|
|
259
|
+
| Protocol | Agents | Rounds | Multiplier |
|
|
260
|
+
|---|:---:|:---:|:---:|
|
|
261
|
+
| Fan-Out | 3 | 1 | 3× |
|
|
262
|
+
| Deliberation | 3 | 2 | 6× |
|
|
263
|
+
| Role Council | 3 | 2 | 6× (+ role prefix overhead) |
|
|
264
|
+
| Adversarial | 3 | 2-3 | 6-9× |
|
|
265
|
+
| Pipeline | 3 | 1 each | 3× (but sequential) |
|
|
266
|
+
| DOVA Hybrid | 3 | 3-4 | 9-12× |
|
|
267
|
+
| DCI Structured | 2-3 | 5 | 10-15× |
|
|
268
|
+
|
|
269
|
+
**Cost-saving tips**:
|
|
270
|
+
- Use `--format quiet` to minimize token output
|
|
271
|
+
- Skip Round 2 if Round 1 responses already agree
|
|
272
|
+
- Use Protocol 1 for simple tasks, upgrade only when quality matters
|
|
273
|
+
- Limit to 3 agents — diminishing returns beyond 3 (research-backed)
|