You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: templates/skills/maxsim-batch/SKILL.md
+320-7Lines changed: 320 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,7 +87,7 @@ When all agents complete:
87
87
88
88
Agent Teams (available since Claude Code v2.1.32, Feb 2026) enable inter-agent communication for workflows that require debate, cross-checking, or collaborative problem-solving. MaxsimCLI sets `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` during install and registers `TeammateIdle` and `TaskCompleted` quality-gate hooks.
89
89
90
-
**Current status:** Infrastructure is in place (env var, hooks). Workflow templates that invoke `TeamCreate`/`SendMessage` for Tier 2 patterns (competitive implementation, multi-reviewer code review, collaborative debugging) are planned but not yet implemented. All workflows currently use Tier 1 subagents. See PROJECT.md §7.2 for the full specification.
90
+
**Current status:** Infrastructure is in place (env var, hooks). Tier 2 workflow patterns (competitive implementation, multi-reviewer code review, collaborative debugging) are defined below with executable `TeamCreate`/`SendMessage` call syntax. All workflows gracefully degrade to Tier 1 subagents when Agent Teams are unavailable. See PROJECT.md §7.2 for the authoritative specification.
91
91
92
92
### Tier Selection Logic
93
93
@@ -103,19 +103,332 @@ MaxsimCLI chooses the tier automatically based on the workflow:
**Use when:** A task is marked `critical` and `config.execution.competitive_enabled` is `true`. Multiple agents implement the same task independently, then adversarially critique each other's work before a neutral verifier selects the winner.
4. Simplicity -- fewer abstractions when correctness is equal
211
+
212
+
Output: WINNER: competitor-{a|b|c}
213
+
Followed by justification.
214
+
"
215
+
)
216
+
```
217
+
218
+
Discard the losing worktree branch. Merge the winner via the standard flow.
219
+
220
+
**Tier 1 fallback:** Spawn 2 independent executor subagents via `Agent(isolation: "worktree", run_in_background: true)` with different approach prompts. After both complete, spawn a verifier to compare. No inter-agent messaging -- the verifier reads both outputs directly.
**Use when:** A PR or implementation requires review from multiple specialist perspectives that must challenge each other's findings.
227
+
228
+
**Flow:**`TeamCreate` --> spawn 3 specialist reviewers --> each reviews independently --> `SendMessage` to share findings --> each reviewer challenges other reviewers' findings --> coordinator synthesizes unified report.
229
+
230
+
**Step 1 -- Create the review team:**
231
+
```
232
+
TeamCreate(
233
+
team_name: "review-phase-{N}-task-{id}",
234
+
description: "Multi-dimensional code review: {description}. Reviewers share and cross-check findings."
235
+
)
236
+
```
237
+
238
+
**Step 2 -- Spawn specialist reviewers:**
239
+
```
240
+
// Security reviewer
241
+
Spawn teammate "reviewer-security" with prompt:
242
+
"Review the implementation for security concerns: authentication, authorization, input validation, injection risks, token handling, data exposure.
243
+
Files to review: {file list or PR reference}.
244
+
Report findings as: CRITICAL / WARNING / INFO with evidence (file path + line number).
245
+
When done, send your findings to reviewer-performance and reviewer-tests."
246
+
Model: {executor_model}
247
+
248
+
// Performance reviewer
249
+
Spawn teammate "reviewer-performance" with prompt:
250
+
"Review the implementation for performance concerns: N+1 queries, missing indexes, unnecessary allocations, caching opportunities, algorithmic complexity.
251
+
Files to review: {file list or PR reference}.
252
+
Report findings as: CRITICAL / WARNING / INFO with evidence (file path + line number).
253
+
When done, send your findings to reviewer-security and reviewer-tests."
254
+
Model: {executor_model}
255
+
256
+
// Test coverage reviewer
257
+
Spawn teammate "reviewer-tests" with prompt:
258
+
"Review the implementation for test coverage: missing edge cases, untested error paths, assertion quality, flaky test patterns, coverage gaps.
259
+
Files to review: {file list or PR reference}.
260
+
Report findings as: CRITICAL / WARNING / INFO with evidence (file path + line number).
261
+
When done, send your findings to reviewer-security and reviewer-performance."
262
+
Model: {executor_model}
263
+
```
264
+
265
+
**Step 3 -- Share and cross-check findings:**
266
+
After each reviewer completes their initial review, they share findings with the others via `SendMessage`:
267
+
268
+
```
269
+
// Each reviewer sends findings to the other two
270
+
SendMessage({
271
+
type: "message",
272
+
recipient: "reviewer-performance",
273
+
content: "My security findings: {findings list}. Do any of these conflict with your performance findings? Are there performance optimizations that would introduce security risks?",
274
+
summary: "Security reviewer sharing findings for cross-check"
275
+
})
276
+
```
277
+
278
+
Each reviewer then challenges the others' findings:
279
+
```
280
+
SendMessage({
281
+
type: "message",
282
+
recipient: "reviewer-security",
283
+
content: "Reviewing your security findings: Finding #2 (SQL injection risk in query builder) -- I confirmed this also causes a performance issue due to string concatenation in a hot path. Finding #4 (token expiry) -- this is a false positive; the token refresh middleware handles this case. Evidence: {file}:{line}.",
The team lead (or a fresh agent) collects all findings and cross-check results, then produces a unified review:
290
+
291
+
```
292
+
Agent(
293
+
subagent_type: "verifier",
294
+
model: "{verifier_model}",
295
+
prompt: "
296
+
Synthesize a unified code review from three specialist reviewers.
297
+
298
+
Security findings: {security reviewer's final findings}
299
+
Performance findings: {performance reviewer's final findings}
300
+
Test coverage findings: {test reviewer's final findings}
301
+
Cross-check disputes: {list of challenged findings and resolutions}
302
+
303
+
Produce a single review report:
304
+
- CRITICAL items (must fix before merge)
305
+
- WARNING items (should fix, not blocking)
306
+
- INFO items (suggestions)
307
+
- Disputed findings and resolution
308
+
"
309
+
)
310
+
```
311
+
312
+
Post the unified report as a GitHub comment on the relevant issue.
313
+
314
+
**Tier 1 fallback:** Spawn 3 independent reviewer subagents via `Agent(run_in_background: true)`. Each produces its own report. The orchestrator merges reports manually -- no cross-checking between reviewers. Less thorough but fully functional.
**Use when:** A bug's root cause is unclear and multiple hypotheses need to be tested simultaneously. Each investigator pursues a different theory and actively tries to disprove the others.
321
+
322
+
**Flow:**`TeamCreate` --> spawn 2-3 investigators --> each pursues a different hypothesis --> `SendMessage` to share evidence and challenge other hypotheses --> hypothesis that survives adversarial testing wins --> fix implemented by the confirmed investigator.
323
+
324
+
**Step 1 -- Create the investigation team:**
325
+
```
326
+
TeamCreate(
327
+
team_name: "debug-phase-{N}-task-{id}",
328
+
description: "Adversarial debugging: {bug description}. Investigators pursue competing hypotheses and challenge each other's evidence."
329
+
)
330
+
```
331
+
332
+
**Step 2 -- Spawn investigators with distinct hypotheses:**
333
+
Derive hypotheses from the bug symptoms, error logs, and codebase analysis.
334
+
335
+
```
336
+
// Investigator A -- hypothesis: race condition
337
+
Spawn teammate "investigator-a" with prompt:
338
+
"Bug: {bug description with symptoms and error output}.
339
+
Your hypothesis: RACE CONDITION in {suspected component}.
340
+
Investigate this hypothesis:
341
+
1. Find evidence supporting or refuting it
342
+
2. Write a reproducer test if possible
343
+
3. If confirmed, draft a fix
344
+
4. Share evidence with other investigators via SendMessage
345
+
5. Actively challenge other investigators' hypotheses with counter-evidence"
346
+
Model: {executor_model}
347
+
348
+
// Investigator B -- hypothesis: configuration error
349
+
Spawn teammate "investigator-b" with prompt:
350
+
"Bug: {bug description with symptoms and error output}.
351
+
Your hypothesis: CONFIGURATION ERROR in {suspected component}.
352
+
Investigate this hypothesis:
353
+
1. Find evidence supporting or refuting it
354
+
2. Write a reproducer test if possible
355
+
3. If confirmed, draft a fix
356
+
4. Share evidence with other investigators via SendMessage
357
+
5. Actively challenge other investigators' hypotheses with counter-evidence"
358
+
Model: {executor_model}
359
+
360
+
// Investigator C -- hypothesis: data corruption
361
+
Spawn teammate "investigator-c" with prompt:
362
+
"Bug: {bug description with symptoms and error output}.
363
+
Your hypothesis: DATA CORRUPTION in {suspected component}.
364
+
Investigate this hypothesis:
365
+
1. Find evidence supporting or refuting it
366
+
2. Write a reproducer test if possible
367
+
3. If confirmed, draft a fix
368
+
4. Share evidence with other investigators via SendMessage
369
+
5. Actively challenge other investigators' hypotheses with counter-evidence"
370
+
Model: {executor_model}
371
+
```
372
+
373
+
**Step 3 -- Evidence sharing and adversarial challenges:**
374
+
Investigators share findings and challenge each other via `SendMessage`:
375
+
376
+
```
377
+
// Investigator A shares evidence
378
+
SendMessage({
379
+
type: "message",
380
+
recipient: "investigator-b",
381
+
content: "Evidence for race condition hypothesis: I found unsynchronized access to {resource} at {file}:{line}. The timing window is ~50ms under load. This contradicts your configuration hypothesis because the config values are correct -- the issue only manifests under concurrent access. Can you disprove this?",
content: "Your race condition evidence is plausible but I found that the same symptom occurs on single-threaded test runs. See: {test output}. This suggests the root cause is upstream of the concurrent access point. My config hypothesis: the timeout value at {file}:{line} defaults to 0 when the env var is missing.",
390
+
summary: "Investigator-b providing counter-evidence to race condition hypothesis"
391
+
})
392
+
```
393
+
394
+
**Step 4 -- Resolution:**
395
+
The team lead evaluates which hypothesis survived adversarial testing:
396
+
397
+
```
398
+
Agent(
399
+
subagent_type: "verifier",
400
+
model: "{verifier_model}",
401
+
prompt: "
402
+
Evaluate competing debugging hypotheses.
403
+
404
+
Hypothesis A (race condition): {evidence summary, challenges received, responses}
405
+
Hypothesis B (configuration): {evidence summary, challenges received, responses}
406
+
Hypothesis C (data corruption): {evidence summary, challenges received, responses}
407
+
408
+
Determine:
409
+
1. Which hypothesis best explains ALL symptoms?
410
+
2. Which hypothesis survived adversarial challenge?
Followed by: evidence that confirms, evidence that was disproven, recommended fix.
415
+
"
416
+
)
417
+
```
418
+
419
+
The confirmed investigator's fix is merged. Other worktree branches are discarded.
420
+
421
+
**Tier 1 fallback:** Spawn 2-3 independent debugging subagents via `Agent(isolation: "worktree", run_in_background: true)`. Each investigates a different hypothesis and reports findings. The orchestrator compares reports without inter-agent debate. Less adversarial but still tests multiple hypotheses in parallel.
422
+
423
+
---
111
424
112
425
### Graceful Degradation
113
426
114
427
If Agent Teams are unavailable (env var `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` not set, unsupported plan, or feature not yet stable), MaxsimCLI falls back to Tier 1 subagents for all workflows. Inform the user with this exact message:
115
428
116
429
> "Competitive mode: using Tier 1 subagents (Agent Teams not available or not required for this strategy). Each executor works independently; verifier selects the best result."
117
430
118
-
The user is informed but not blocked. All workflows remain fully functional via Tier 1.
431
+
The user is informed but not blocked. All workflows remain fully functional via Tier 1. Each pattern above includes a specific Tier 1 fallback that preserves the core workflow (parallel execution + verifier selection) without inter-agent messaging.
0 commit comments