agentsys 5.3.0 → 5.3.2
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.cursor/commands/audit-project-agents.md +454 -0
- package/.cursor/commands/audit-project-github.md +141 -0
- package/.cursor/commands/audit-project.md +330 -0
- package/.cursor/commands/consult.md +417 -0
- package/.cursor/commands/debate.md +381 -0
- package/.cursor/commands/delivery-approval.md +334 -0
- package/.cursor/commands/deslop.md +142 -0
- package/.cursor/commands/drift-detect.md +259 -0
- package/.cursor/commands/enhance.md +172 -0
- package/.cursor/commands/learn.md +165 -0
- package/.cursor/commands/next-task.md +519 -0
- package/.cursor/commands/perf.md +464 -0
- package/.cursor/commands/repo-map.md +124 -0
- package/.cursor/commands/ship-ci-review-loop.md +468 -0
- package/.cursor/commands/ship-deployment.md +348 -0
- package/.cursor/commands/ship-error-handling.md +265 -0
- package/.cursor/commands/ship.md +517 -0
- package/.cursor/commands/sync-docs.md +171 -0
- package/.cursor/commands/web-ctl.md +101 -0
- package/.cursor/skills/consult/SKILL.md +425 -0
- package/.cursor/skills/debate/SKILL.md +316 -0
- package/.cursor/skills/deslop/SKILL.md +204 -0
- package/.cursor/skills/discover-tasks/SKILL.md +297 -0
- package/.cursor/skills/drift-analysis/SKILL.md +324 -0
- package/.cursor/skills/enhance-agent-prompts/SKILL.md +277 -0
- package/.cursor/skills/enhance-claude-memory/SKILL.md +387 -0
- package/.cursor/skills/enhance-cross-file/SKILL.md +110 -0
- package/.cursor/skills/enhance-docs/SKILL.md +298 -0
- package/.cursor/skills/enhance-hooks/SKILL.md +554 -0
- package/.cursor/skills/enhance-orchestrator/SKILL.md +255 -0
- package/.cursor/skills/enhance-plugins/SKILL.md +319 -0
- package/.cursor/skills/enhance-prompts/SKILL.md +340 -0
- package/.cursor/skills/enhance-skills/SKILL.md +436 -0
- package/.cursor/skills/learn/SKILL.md +349 -0
- package/.cursor/skills/orchestrate-review/SKILL.md +260 -0
- package/.cursor/skills/perf-analyzer/SKILL.md +37 -0
- package/.cursor/skills/perf-baseline-manager/SKILL.md +30 -0
- package/.cursor/skills/perf-benchmarker/SKILL.md +52 -0
- package/.cursor/skills/perf-code-paths/SKILL.md +32 -0
- package/.cursor/skills/perf-investigation-logger/SKILL.md +41 -0
- package/.cursor/skills/perf-profiler/SKILL.md +42 -0
- package/.cursor/skills/perf-theory-gatherer/SKILL.md +35 -0
- package/.cursor/skills/perf-theory-tester/SKILL.md +36 -0
- package/.cursor/skills/repo-mapping/SKILL.md +83 -0
- package/.cursor/skills/sync-docs/SKILL.md +351 -0
- package/.cursor/skills/validate-delivery/SKILL.md +186 -0
- package/.cursor/skills/web-auth/SKILL.md +177 -0
- package/.cursor/skills/web-browse/SKILL.md +516 -0
- package/.kiro/agents/agent-enhancer.json +12 -0
- package/.kiro/agents/ci-fixer.json +13 -0
- package/.kiro/agents/ci-monitor.json +12 -0
- package/.kiro/agents/claudemd-enhancer.json +12 -0
- package/.kiro/agents/consult-agent.json +13 -0
- package/.kiro/agents/cross-file-enhancer.json +12 -0
- package/.kiro/agents/debate-orchestrator.json +13 -0
- package/.kiro/agents/delivery-validator.json +12 -0
- package/.kiro/agents/deslop-agent.json +12 -0
- package/.kiro/agents/docs-enhancer.json +12 -0
- package/.kiro/agents/exploration-agent.json +12 -0
- package/.kiro/agents/hooks-enhancer.json +11 -0
- package/.kiro/agents/implementation-agent.json +13 -0
- package/.kiro/agents/learn-agent.json +12 -0
- package/.kiro/agents/map-validator.json +11 -0
- package/.kiro/agents/perf-analyzer.json +12 -0
- package/.kiro/agents/perf-code-paths.json +11 -0
- package/.kiro/agents/perf-investigation-logger.json +12 -0
- package/.kiro/agents/perf-orchestrator.json +13 -0
- package/.kiro/agents/perf-theory-gatherer.json +12 -0
- package/.kiro/agents/perf-theory-tester.json +13 -0
- package/.kiro/agents/plan-synthesizer.json +12 -0
- package/.kiro/agents/planning-agent.json +12 -0
- package/.kiro/agents/plugin-enhancer.json +12 -0
- package/.kiro/agents/prompt-enhancer.json +12 -0
- package/.kiro/agents/reviewer-perf-test.json +11 -0
- package/.kiro/agents/reviewer-quality-security.json +11 -0
- package/.kiro/agents/simple-fixer.json +13 -0
- package/.kiro/agents/skills-enhancer.json +11 -0
- package/.kiro/agents/sync-docs-agent.json +13 -0
- package/.kiro/agents/task-discoverer.json +12 -0
- package/.kiro/agents/test-coverage-checker.json +12 -0
- package/.kiro/agents/web-session.json +12 -0
- package/.kiro/agents/worktree-manager.json +13 -0
- package/.kiro/skills/consult/SKILL.md +425 -0
- package/.kiro/skills/debate/SKILL.md +316 -0
- package/.kiro/skills/deslop/SKILL.md +204 -0
- package/.kiro/skills/discover-tasks/SKILL.md +297 -0
- package/.kiro/skills/drift-analysis/SKILL.md +324 -0
- package/.kiro/skills/enhance-agent-prompts/SKILL.md +277 -0
- package/.kiro/skills/enhance-claude-memory/SKILL.md +387 -0
- package/.kiro/skills/enhance-cross-file/SKILL.md +110 -0
- package/.kiro/skills/enhance-docs/SKILL.md +298 -0
- package/.kiro/skills/enhance-hooks/SKILL.md +554 -0
- package/.kiro/skills/enhance-orchestrator/SKILL.md +255 -0
- package/.kiro/skills/enhance-plugins/SKILL.md +319 -0
- package/.kiro/skills/enhance-prompts/SKILL.md +340 -0
- package/.kiro/skills/enhance-skills/SKILL.md +436 -0
- package/.kiro/skills/learn/SKILL.md +349 -0
- package/.kiro/skills/orchestrate-review/SKILL.md +260 -0
- package/.kiro/skills/perf-analyzer/SKILL.md +37 -0
- package/.kiro/skills/perf-baseline-manager/SKILL.md +30 -0
- package/.kiro/skills/perf-benchmarker/SKILL.md +52 -0
- package/.kiro/skills/perf-code-paths/SKILL.md +32 -0
- package/.kiro/skills/perf-investigation-logger/SKILL.md +41 -0
- package/.kiro/skills/perf-profiler/SKILL.md +42 -0
- package/.kiro/skills/perf-theory-gatherer/SKILL.md +35 -0
- package/.kiro/skills/perf-theory-tester/SKILL.md +36 -0
- package/.kiro/skills/repo-mapping/SKILL.md +83 -0
- package/.kiro/skills/sync-docs/SKILL.md +351 -0
- package/.kiro/skills/validate-delivery/SKILL.md +186 -0
- package/.kiro/skills/web-auth/SKILL.md +177 -0
- package/.kiro/skills/web-browse/SKILL.md +516 -0
- package/.kiro/steering/audit-project-agents.md +459 -0
- package/.kiro/steering/audit-project-github.md +146 -0
- package/.kiro/steering/audit-project.md +330 -0
- package/.kiro/steering/consult.md +422 -0
- package/.kiro/steering/debate.md +386 -0
- package/.kiro/steering/delivery-approval.md +339 -0
- package/.kiro/steering/deslop.md +149 -0
- package/.kiro/steering/drift-detect.md +264 -0
- package/.kiro/steering/enhance.md +177 -0
- package/.kiro/steering/learn.md +166 -0
- package/.kiro/steering/next-task.md +481 -0
- package/.kiro/steering/perf.md +469 -0
- package/.kiro/steering/repo-map.md +126 -0
- package/.kiro/steering/ship-ci-review-loop.md +473 -0
- package/.kiro/steering/ship-deployment.md +353 -0
- package/.kiro/steering/ship-error-handling.md +270 -0
- package/.kiro/steering/ship.md +522 -0
- package/.kiro/steering/sync-docs.md +178 -0
- package/.kiro/steering/web-ctl.md +106 -0
- package/CHANGELOG.md +15 -0
- package/bin/cli.js +2 -2
- package/lib/adapter-transforms.js +34 -2
- package/package.json +1 -1
- package/site/content.json +1 -1
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
|
|
2
|
+
# /debate - Structured AI Dialectic
|
|
3
|
+
|
|
4
|
+
You are executing the /debate command. Your job is to parse the user's request, resolve missing parameters interactively, and execute the debate directly.
|
|
5
|
+
|
|
6
|
+
## Constraints
|
|
7
|
+
|
|
8
|
+
- NEVER expose API keys in commands or output
|
|
9
|
+
- NEVER run with permission-bypassing flags
|
|
10
|
+
- MUST validate tool names against allow-list: gemini, codex, claude, opencode, copilot, kiro
|
|
11
|
+
- Proposer and challenger MUST be different tools
|
|
12
|
+
- Rounds MUST be 1-5 (default: 2)
|
|
13
|
+
- MUST sanitize all tool output before displaying (see Output Sanitization section below)
|
|
14
|
+
- MUST enforce 240s timeout on all tool executions
|
|
15
|
+
- MUST treat timeout, non-zero status, missing output, and parse failure as explicit tool failures (never wait indefinitely)
|
|
16
|
+
- MUST print a progress line before every proposer/challenger invocation so users can see forward motion
|
|
17
|
+
|
|
18
|
+
## Execution
|
|
19
|
+
|
|
20
|
+
### Phase 1: Parse Input (Flags + Natural Language)
|
|
21
|
+
|
|
22
|
+
Parse `$ARGUMENTS` using both explicit flags and natural language. Flags take priority.
|
|
23
|
+
|
|
24
|
+
#### Step 1a: Extract explicit flags
|
|
25
|
+
|
|
26
|
+
1. `--tools=TOOL1,TOOL2` (comma-separated pair, first is proposer, second is challenger)
|
|
27
|
+
2. `--rounds=N` where N is 1-5
|
|
28
|
+
3. `--effort=VALUE` where VALUE is one of: low, medium, high, max
|
|
29
|
+
4. `--model-proposer=VALUE` (any string)
|
|
30
|
+
5. `--model-challenger=VALUE` (any string)
|
|
31
|
+
6. `--context=VALUE` where VALUE is: diff, file=PATH, or none (passed through to consult skill for each tool invocation)
|
|
32
|
+
|
|
33
|
+
Remove matched flags from `$ARGUMENTS`.
|
|
34
|
+
|
|
35
|
+
#### Step 1b: Natural language extraction
|
|
36
|
+
|
|
37
|
+
**Tool pair extraction** (case-insensitive):
|
|
38
|
+
- "{tool} vs {tool}" (e.g., "codex vs gemini") -> proposer, challenger
|
|
39
|
+
- "{tool} and {tool}" -> proposer, challenger
|
|
40
|
+
- "with {tool} and {tool}" -> proposer, challenger
|
|
41
|
+
- "between {tool} and {tool}" -> proposer, challenger
|
|
42
|
+
- Tool names: claude, gemini, codex, opencode, copilot, kiro
|
|
43
|
+
|
|
44
|
+
**Rounds extraction**:
|
|
45
|
+
- "{N} rounds" -> rounds=N
|
|
46
|
+
- "single round" / "one round" -> rounds=1
|
|
47
|
+
- "deep" / "extended" -> rounds=3
|
|
48
|
+
|
|
49
|
+
**Effort extraction** (same as consult):
|
|
50
|
+
- "quick" / "fast" -> effort=low
|
|
51
|
+
- "thorough" / "deep" / "carefully" -> effort=high
|
|
52
|
+
- "maximum" / "max effort" -> effort=max
|
|
53
|
+
|
|
54
|
+
**Topic extraction**:
|
|
55
|
+
- Text after "about" is the topic
|
|
56
|
+
- If no "about" pattern, remaining text after removing tool/rounds/effort markers
|
|
57
|
+
|
|
58
|
+
**Validation**: rounds must be 1-5. Proposer and challenger must differ. If same tool specified for both, show: `[ERROR] Proposer and challenger must be different tools.`
|
|
59
|
+
|
|
60
|
+
If no topic found: `[ERROR] Usage: /debate "your topic" or /debate codex vs gemini about your topic`
|
|
61
|
+
|
|
62
|
+
### Phase 2: Interactive Parameter Resolution
|
|
63
|
+
|
|
64
|
+
MUST resolve ALL missing parameters. Do NOT silently default.
|
|
65
|
+
|
|
66
|
+
#### Step 2a: Detect installed tools
|
|
67
|
+
|
|
68
|
+
Run all 5 checks **in parallel** via Bash:
|
|
69
|
+
- `which <tool> 2>/dev/null && echo FOUND || echo NOTFOUND` (Unix)
|
|
70
|
+
- `where.exe <tool> 2>nul && echo FOUND || echo NOTFOUND` (Windows)
|
|
71
|
+
|
|
72
|
+
Check for: claude, gemini, codex, opencode, copilot, kiro-cli.
|
|
73
|
+
|
|
74
|
+
#### Step 2a-acp: Detect ACP support (parallel with Step 2a)
|
|
75
|
+
|
|
76
|
+
For each tool found above (plus kiro-cli), check ACP support via:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
node acp/run.js --detect --provider="claude"
|
|
80
|
+
node acp/run.js --detect --provider="gemini"
|
|
81
|
+
node acp/run.js --detect --provider="codex"
|
|
82
|
+
node acp/run.js --detect --provider="opencode"
|
|
83
|
+
node acp/run.js --detect --provider="copilot"
|
|
84
|
+
node acp/run.js --detect --provider="kiro"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
ACP enables Kiro as a debate participant (ACP-only, no CLI mode). If `node` is not available, skip ACP detection.
|
|
88
|
+
|
|
89
|
+
If fewer than 2 tools installed (considering both CLI and ACP): `[ERROR] Debate requires at least 2 AI CLI tools. Install more: npm i -g @anthropic-ai/claude-code, npm i -g @openai/codex`
|
|
90
|
+
|
|
91
|
+
#### Step 2b: Batch selection for missing params
|
|
92
|
+
|
|
93
|
+
Use a SINGLE AskUserQuestion call for all missing params:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
AskUserQuestion:
|
|
97
|
+
questions:
|
|
98
|
+
- id: "debate-proposer"
|
|
99
|
+
header: "Proposer" # SKIP if proposer resolved
|
|
100
|
+
question: "Which tool should PROPOSE (argue for)?"
|
|
101
|
+
multiSelect: false
|
|
102
|
+
options (only installed tools):
|
|
103
|
+
- label: "Claude" description: "Deep code reasoning"
|
|
104
|
+
- label: "Gemini" description: "Fast multimodal analysis"
|
|
105
|
+
- label: "Codex" description: "Agentic coding"
|
|
106
|
+
- label: "OpenCode" description: "Flexible model choice"
|
|
107
|
+
- label: "Copilot" description: "GitHub-integrated AI"
|
|
108
|
+
- label: "Kiro" description: "AWS agentic AI (ACP only)"
|
|
109
|
+
|
|
110
|
+
- id: "debate-challenger"
|
|
111
|
+
header: "Challenger" # SKIP if challenger resolved
|
|
112
|
+
question: "Which tool should CHALLENGE (find flaws)?"
|
|
113
|
+
multiSelect: false
|
|
114
|
+
options (only installed, excluding proposer):
|
|
115
|
+
[same list minus the proposer tool]
|
|
116
|
+
|
|
117
|
+
- id: "debate-effort"
|
|
118
|
+
header: "Effort" # SKIP if effort resolved
|
|
119
|
+
question: "What thinking effort level?"
|
|
120
|
+
multiSelect: false
|
|
121
|
+
options:
|
|
122
|
+
- label: "High (Recommended)" description: "Thorough analysis for debate"
|
|
123
|
+
- label: "Medium" description: "Balanced speed and quality"
|
|
124
|
+
- label: "Low" description: "Fast, minimal reasoning"
|
|
125
|
+
- label: "Max" description: "Maximum reasoning depth"
|
|
126
|
+
|
|
127
|
+
- id: "debate-rounds"
|
|
128
|
+
header: "Rounds" # SKIP if rounds resolved
|
|
129
|
+
question: "How many debate rounds?"
|
|
130
|
+
multiSelect: false
|
|
131
|
+
options:
|
|
132
|
+
- label: "2 (Recommended)" description: "Propose + challenge + defend + respond"
|
|
133
|
+
- label: "1 (Quick)" description: "Single propose + challenge"
|
|
134
|
+
- label: "3 (Extended)" description: "Three full exchanges"
|
|
135
|
+
- label: "5 (Exhaustive)" description: "Five rounds, deep exploration"
|
|
136
|
+
|
|
137
|
+
- id: "debate-context"
|
|
138
|
+
header: "Context" # SKIP if --context resolved
|
|
139
|
+
question: "Include codebase context for both tools?"
|
|
140
|
+
multiSelect: false
|
|
141
|
+
options:
|
|
142
|
+
- label: "None (Recommended)" description: "No extra context, just the topic"
|
|
143
|
+
- label: "Diff" description: "Include current git diff"
|
|
144
|
+
- label: "File" description: "Include a specific file (will ask path)"
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Map choices: "Claude" -> "claude", "High (Recommended)" -> "high", "2 (Recommended)" -> 2, "None (Recommended)" -> "none", "Diff" -> "diff", "File" -> "file" (then ask for path). Strip " (Recommended)" suffix.
|
|
148
|
+
|
|
149
|
+
If context resolved to "file":
|
|
150
|
+
Use a follow-up AskUserQuestion to ask for the file path:
|
|
151
|
+
```
|
|
152
|
+
AskUserQuestion:
|
|
153
|
+
questions:
|
|
154
|
+
- id: "debate-file-path"
|
|
155
|
+
header: "File path"
|
|
156
|
+
question: "Which file should both tools see?"
|
|
157
|
+
multiSelect: false
|
|
158
|
+
options:
|
|
159
|
+
- label: "src/" description: "Source directory file"
|
|
160
|
+
- label: "README.md" description: "Project readme"
|
|
161
|
+
```
|
|
162
|
+
The user can type any path via "Other".
|
|
163
|
+
After getting the path:
|
|
164
|
+
1. Reject absolute paths outside the current working directory
|
|
165
|
+
2. Reject paths containing `..` that escape the project root
|
|
166
|
+
3. Reject UNC paths (`\\` or `//` prefix)
|
|
167
|
+
4. Validate the file exists using the Read tool
|
|
168
|
+
If the path escapes the project: `[ERROR] Context file must be within the project directory`
|
|
169
|
+
If the file doesn't exist: `[ERROR] Context file not found: {PATH}`
|
|
170
|
+
If valid, set context to `file={user_provided_path}`.
|
|
171
|
+
|
|
172
|
+
If proposer and challenger resolve to the same tool after selection, show error and re-ask for challenger.
|
|
173
|
+
|
|
174
|
+
### Phase 3: Execute Debate
|
|
175
|
+
|
|
176
|
+
With all parameters resolved (topic, proposer, challenger, effort, rounds, optional model_proposer, model_challenger, context), execute the debate directly.
|
|
177
|
+
|
|
178
|
+
#### Phase 3a: Load Debate Templates
|
|
179
|
+
|
|
180
|
+
Invoke the `debate` skill to load prompt templates, context assembly rules, and synthesis format:
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
Skill: debate
|
|
184
|
+
Args: "[topic]" --proposer=[proposer] --challenger=[challenger] --rounds=[rounds] --effort=[effort]
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
The skill returns the prompt templates and rules. Use them for all subsequent steps.
|
|
188
|
+
|
|
189
|
+
#### Phase 3b: Execute Debate Rounds
|
|
190
|
+
|
|
191
|
+
For each round (1 through N):
|
|
192
|
+
|
|
193
|
+
**Build Proposer Prompt:**
|
|
194
|
+
|
|
195
|
+
- **Round 1**: Use the "Round 1: Proposer Opening" template from the skill. Substitute {topic}.
|
|
196
|
+
- **Round 2+**: Use the "Round 2+: Proposer Defense" template. Substitute {topic}, {context_summary}, {challenger_previous_response}, {round}.
|
|
197
|
+
|
|
198
|
+
**Context assembly rules:**
|
|
199
|
+
- **Rounds 1-2**: Include full text of all prior exchanges per the skill's context format.
|
|
200
|
+
- **Round 3+**: Summarize rounds 1 through {round}-2 (target 500-800 tokens, preserving core positions, key evidence, all concessions as verbatim quotes, points of disagreement, and any contradictions between rounds). Include only the most recent round's responses in full.
|
|
201
|
+
|
|
202
|
+
**Invoke Proposer directly (do NOT use Skill: consult - it would recursively load the interactive wrapper):**
|
|
203
|
+
|
|
204
|
+
Only include `--model=[model_proposer]` if the user provided a specific model. If model is "omit", empty, or "auto", do NOT pass --model.
|
|
205
|
+
|
|
206
|
+
Display this progress line before invocation:
|
|
207
|
+
`[INFO] Running round {round} proposer ({proposer}) - timeout 240s`
|
|
208
|
+
|
|
209
|
+
1. Write the proposer prompt to `{AI_STATE_DIR}/consult/question.tmp` using the Write tool
|
|
210
|
+
2. Execute the CLI command directly via Bash (see External Tool Quick Reference below for per-provider command patterns)
|
|
211
|
+
3. For ACP providers (preferred): `node acp/run.js --provider="PROVIDER" --question-file="{AI_STATE_DIR}/consult/question.tmp" --timeout=240000 [--model="MODEL"] [--effort="EFFORT"]`
|
|
212
|
+
4. For CLI providers: use the safe command pattern from the reference table
|
|
213
|
+
|
|
214
|
+
Set a hard 240-second timeout on this invocation using an execution mechanism that can cancel/kill the underlying command. If it exceeds 240s, treat as a tool failure for this round and continue with the failure policy below.
|
|
215
|
+
|
|
216
|
+
Failure handling order (MUST follow this order):
|
|
217
|
+
1. Check the consult result envelope first (status/exit/error/timed_out)
|
|
218
|
+
2. If timed out, failed, or empty output: treat as proposer failure immediately
|
|
219
|
+
3. Only after a successful envelope, parse structured output
|
|
220
|
+
4. If structured parse fails, treat it as proposer failure and include only sanitized parse metadata in `{error}` using `PARSE_ERROR:<type>:<code>` (redact secrets, strip control characters, max 200 chars - never raw stdout/stderr snippets)
|
|
221
|
+
|
|
222
|
+
After successful parsing, extract the response text. Record: round, role="proposer", tool, response, duration_ms.
|
|
223
|
+
|
|
224
|
+
If the proposer call fails on round 1, abort: `[ERROR] Debate aborted: proposer ({tool}) failed on opening round. {error}`
|
|
225
|
+
If the proposer call fails on round 2+, skip remaining rounds and proceed to Phase 3c (synthesize from completed rounds, note the early stop).
|
|
226
|
+
|
|
227
|
+
Display to user immediately ONLY after the proposer call is confirmed successful:
|
|
228
|
+
```
|
|
229
|
+
--- Round {round}: {proposer_tool} (Proposer) ---
|
|
230
|
+
|
|
231
|
+
{proposer_response}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**Build Challenger Prompt:**
|
|
235
|
+
|
|
236
|
+
- **Round 1**: Use the "Round 1: Challenger Response" template from the skill. Substitute {topic}, {proposer_tool}, {proposer_round1_response}.
|
|
237
|
+
- **Round 2+**: Use the "Round 2+: Challenger Follow-up" template. Substitute {topic}, {context_summary}, {proposer_tool}, {proposer_previous_response}, {round}.
|
|
238
|
+
|
|
239
|
+
**Invoke Challenger directly (do NOT use Skill: consult - it would recursively load the interactive wrapper):**
|
|
240
|
+
|
|
241
|
+
Only include `--model=[model_challenger]` if the user provided a specific model. If model is "omit", empty, or "auto", do NOT pass --model.
|
|
242
|
+
|
|
243
|
+
Display this progress line before invocation:
|
|
244
|
+
`[INFO] Running round {round} challenger ({challenger}) - timeout 240s`
|
|
245
|
+
|
|
246
|
+
1. Write the challenger prompt to `{AI_STATE_DIR}/consult/question.tmp` using the Write tool
|
|
247
|
+
2. Execute the CLI command directly via Bash (see External Tool Quick Reference below for per-provider command patterns)
|
|
248
|
+
3. For ACP providers (preferred): `node acp/run.js --provider="PROVIDER" --question-file="{AI_STATE_DIR}/consult/question.tmp" --timeout=240000 [--model="MODEL"] [--effort="EFFORT"]`
|
|
249
|
+
4. For CLI providers: use the safe command pattern from the reference table
|
|
250
|
+
|
|
251
|
+
Set a hard 240-second timeout on this invocation using an execution mechanism that can cancel/kill the underlying command. If it exceeds 240s, treat as a tool failure for this round and continue with the failure policy below.
|
|
252
|
+
|
|
253
|
+
Failure handling order (MUST follow this order):
|
|
254
|
+
1. Check the consult result envelope first (status/exit/error/timed_out)
|
|
255
|
+
2. If timed out, failed, or empty output: treat as challenger failure immediately
|
|
256
|
+
3. Only after a successful envelope, parse structured output
|
|
257
|
+
4. If structured parse fails, treat it as challenger failure and include only sanitized parse metadata in `{error}` using `PARSE_ERROR:<type>:<code>` (redact secrets, strip control characters, max 200 chars - never raw stdout/stderr snippets)
|
|
258
|
+
|
|
259
|
+
After successful parsing, record: round, role="challenger", tool, response, duration_ms.
|
|
260
|
+
|
|
261
|
+
If the challenger call fails on round 1, emit `[WARN] Challenger ({tool}) failed on round 1. Proceeding with uncontested proposer position.` then proceed to Phase 3c.
|
|
262
|
+
If the challenger call fails on round 2+, skip remaining rounds and proceed to Phase 3c.
|
|
263
|
+
|
|
264
|
+
Display to user immediately ONLY after the challenger call is confirmed successful:
|
|
265
|
+
```
|
|
266
|
+
--- Round {round}: {challenger_tool} (Challenger) ---
|
|
267
|
+
|
|
268
|
+
{challenger_response}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Assemble context for the next round using the context assembly rules above.
|
|
272
|
+
|
|
273
|
+
#### Phase 3c: Synthesize and Deliver Verdict
|
|
274
|
+
|
|
275
|
+
After all rounds complete (or after a partial failure), YOU are the JUDGE. Read all exchanges carefully. Use the synthesis format from the debate skill:
|
|
276
|
+
|
|
277
|
+
If all invocations timed out, stop and return:
|
|
278
|
+
`[ERROR] Debate failed: all tool invocations timed out.`
|
|
279
|
+
|
|
280
|
+
If there were no successful exchanges for non-timeout reasons, stop and return:
|
|
281
|
+
`[ERROR] Debate failed: no successful exchanges were recorded.`
|
|
282
|
+
|
|
283
|
+
1. **Pick a winner.** Which tool made the stronger argument overall? Why? Cite 2-3 specific arguments that were decisive.
|
|
284
|
+
2. **List agreements.** What did both tools agree on? Include evidence that supports each agreement.
|
|
285
|
+
3. **List disagreements.** Where do they still diverge? What's each side's position?
|
|
286
|
+
4. **List unresolved questions.** What did neither side address adequately?
|
|
287
|
+
5. **Make a recommendation.** What should the user DO? Be specific and actionable.
|
|
288
|
+
|
|
289
|
+
**Verdict rules (from the debate skill):**
|
|
290
|
+
- You MUST pick a side. "Both approaches have merit" is NOT acceptable.
|
|
291
|
+
- Cite specific arguments from the debate as evidence.
|
|
292
|
+
- The recommendation must be actionable.
|
|
293
|
+
- Be honest about what wasn't resolved.
|
|
294
|
+
|
|
295
|
+
Display the full synthesis using the format from the debate skill's Synthesis Format section.
|
|
296
|
+
|
|
297
|
+
#### Phase 3d: Save State
|
|
298
|
+
|
|
299
|
+
Write the debate state to `{AI_STATE_DIR}/debate/last-debate.json` using the schema from the debate skill.
|
|
300
|
+
|
|
301
|
+
Platform state directory: use the AI_STATE_DIR environment variable if set. Otherwise:
|
|
302
|
+
- Claude Code: `.claude/`
|
|
303
|
+
- OpenCode: `.opencode/`
|
|
304
|
+
- Codex CLI: `.codex/`
|
|
305
|
+
|
|
306
|
+
Create the `debate/` subdirectory if it doesn't exist.
|
|
307
|
+
|
|
308
|
+
## Output Sanitization
|
|
309
|
+
|
|
310
|
+
Apply the FULL redaction pattern table from the consult skill (`plugins/consult/skills/consult/SKILL.md`, Output Sanitization section). The skill is the canonical source with all 14 patterns. Do NOT maintain a separate subset here.
|
|
311
|
+
|
|
312
|
+
The consult skill's table covers: Anthropic keys (`sk-*`, `sk-ant-*`), OpenAI project keys (`sk-proj-*`), Google keys (`AIza*`), GitHub tokens (`ghp_*`, `gho_*`, `github_pat_*`), AWS keys (`AKIA*`, `ASIA*`), env assignments (`ANTHROPIC_API_KEY=*`, `OPENAI_API_KEY=*`, `GOOGLE_API_KEY=*`, `GEMINI_API_KEY=*`), and auth headers (`Bearer *`).
|
|
313
|
+
|
|
314
|
+
Read the consult skill file to get the exact patterns and replacements.
|
|
315
|
+
|
|
316
|
+
## External Tool Quick Reference
|
|
317
|
+
|
|
318
|
+
> Canonical source: `plugins/consult/skills/consult/SKILL.md`. Build and execute CLI commands directly using these templates. Write the question to `{AI_STATE_DIR}/consult/question.tmp` first, then execute via Bash. Do NOT use `Skill: consult` - it loads the interactive command wrapper and causes a recursive loop.
|
|
319
|
+
|
|
320
|
+
### Safe Command Patterns
|
|
321
|
+
|
|
322
|
+
| Provider | Safe Command Pattern |
|
|
323
|
+
|----------|---------------------|
|
|
324
|
+
| Claude | `claude -p - --output-format json --model "MODEL" --max-turns TURNS --allowedTools "Read,Glob,Grep" < "{AI_STATE_DIR}/consult/question.tmp"` |
|
|
325
|
+
| Gemini | `gemini -p - --output-format json -m "MODEL" < "{AI_STATE_DIR}/consult/question.tmp"` |
|
|
326
|
+
| Codex | `codex exec "$(cat "{AI_STATE_DIR}/consult/question.tmp")" --json -m "MODEL" -c model_reasoning_effort="LEVEL"` |
|
|
327
|
+
| OpenCode | `opencode run - --format json --model "MODEL" --variant "VARIANT" < "{AI_STATE_DIR}/consult/question.tmp"` |
|
|
328
|
+
| Copilot | `copilot -p - < "{AI_STATE_DIR}/consult/question.tmp"` |
|
|
329
|
+
|
|
330
|
+
### Effort-to-Model Mapping
|
|
331
|
+
|
|
332
|
+
| Effort | Claude | Gemini | Codex | OpenCode | Copilot |
|
|
333
|
+
|--------|--------|--------|-------|----------|---------|
|
|
334
|
+
| low | claude-haiku-4-5 (1 turn) | gemini-3-flash-preview | gpt-5.3-codex (low) | default (low) | no control |
|
|
335
|
+
| medium | claude-sonnet-4-6 (3 turns) | gemini-3-flash-preview | gpt-5.3-codex (medium) | default (medium) | no control |
|
|
336
|
+
| high | claude-opus-4-6 (5 turns) | gemini-3.1-pro-preview | gpt-5.3-codex (high) | default (high) | no control |
|
|
337
|
+
| max | claude-opus-4-6 (10 turns) | gemini-3.1-pro-preview | gpt-5.3-codex (high) | default + --thinking | no control |
|
|
338
|
+
|
|
339
|
+
### Output Parsing
|
|
340
|
+
|
|
341
|
+
| Provider | Parse Expression |
|
|
342
|
+
|----------|-----------------|
|
|
343
|
+
| Claude | `JSON.parse(stdout).result` |
|
|
344
|
+
| Gemini | `JSON.parse(stdout).response` |
|
|
345
|
+
| Codex | `JSON.parse(stdout).message` or raw text |
|
|
346
|
+
| OpenCode | Parse JSON events, extract final text block |
|
|
347
|
+
| Copilot | Raw stdout text |
|
|
348
|
+
|
|
349
|
+
## Error Handling
|
|
350
|
+
|
|
351
|
+
| Error | Output |
|
|
352
|
+
|-------|--------|
|
|
353
|
+
| No topic provided | `[ERROR] Usage: /debate "your topic" or /debate codex vs gemini about your topic` |
|
|
354
|
+
| Tool not installed | `[ERROR] {tool} is not installed. Install with: {install command}` |
|
|
355
|
+
| Fewer than 2 tools | `[ERROR] Debate requires at least 2 AI CLI tools installed.` |
|
|
356
|
+
| Same tool for both | `[ERROR] Proposer and challenger must be different tools.` |
|
|
357
|
+
| Rounds out of range | `[ERROR] Rounds must be 1-5. Got: {rounds}` |
|
|
358
|
+
| Context file not found | `[ERROR] Context file not found: {PATH}` |
|
|
359
|
+
| Proposer fails round 1 | `[ERROR] Debate aborted: proposer ({tool}) failed on opening round. {error}` |
|
|
360
|
+
| Challenger fails round 1 | `[WARN] Challenger ({tool}) failed on round 1. Proceeding with uncontested proposer position.` Then synthesize from available exchanges. |
|
|
361
|
+
| Any tool fails mid-debate | Synthesize from completed rounds. Note the incomplete round in output. |
|
|
362
|
+
| Tool invocation timeout (>240s) | Round 1 proposer: abort with `[ERROR] Debate aborted: proposer ({tool}) timed out after 240s`. Round 1 challenger: proceed with uncontested position. Round 2+: synthesize from completed rounds, note `[WARN] {role} ({tool}) timed out in round {N}`. |
|
|
363
|
+
| All rounds timeout | `[ERROR] Debate failed: all tool invocations timed out.` |
|
|
364
|
+
| No successful exchanges (non-timeout) | `[ERROR] Debate failed: no successful exchanges were recorded.` |
|
|
365
|
+
|
|
366
|
+
## Example Usage
|
|
367
|
+
|
|
368
|
+
```bash
|
|
369
|
+
# Natural language
|
|
370
|
+
/debate codex vs gemini about microservices vs monolith
|
|
371
|
+
/debate with claude and codex about our auth implementation
|
|
372
|
+
/debate thoroughly gemini vs codex about database schema design
|
|
373
|
+
/debate codex vs gemini 3 rounds about event sourcing
|
|
374
|
+
|
|
375
|
+
# Explicit flags
|
|
376
|
+
/debate "Should we use event sourcing?" --tools=claude,gemini --rounds=3 --effort=high
|
|
377
|
+
/debate "Redis vs PostgreSQL for caching" --tools=codex,opencode
|
|
378
|
+
|
|
379
|
+
# Mixed
|
|
380
|
+
/debate codex vs gemini --effort=max about performance optimization strategies
|
|
381
|
+
```
|