Home / Commands / uditgoenka/autoresearch

autoresearch_predict

5 expert personas debate proposed changes before implementation

commandLicense: MIT Source: uditgoenka/autoresearch

Install

Copy this folder into your Claude Code project (needs Node.js):

curl -fsSL --create-dirs -o .claude/commands/autoresearch-predict.md https://raw.githubusercontent.com/uditgoenka/autoresearch/HEAD/.opencode/commands/autoresearch_predict.md

Or install it for every project:

curl -fsSL --create-dirs -o ~/.claude/commands/autoresearch-predict.md https://raw.githubusercontent.com/uditgoenka/autoresearch/HEAD/.opencode/commands/autoresearch_predict.md

File content

Made by its original authors and shared under MIT. We show it unchanged, with credit and a link to the source. Source β†—

---
name: autoresearch_predict
description: "5 expert personas debate proposed changes before implementation"
argument-hint: "[Scope: <glob>] [Goal: <text>] [--depth shallow|standard|deep] [--adversarial] [--chain <targets>]"
disable-model-invocation: true
---

EXECUTE IMMEDIATELY.

## Parse Arguments

Extract from $ARGUMENTS:
- `Scope:` or `--scope` β€” file globs to analyze
- `Goal:` or `--goal` β€” focus area for analysis
- `Depth:` or `--depth` β€” shallow (3 personas, 1 round), standard (5, 2), deep (8, 3)
- `--personas N` β€” override persona count (3-8)
- `--rounds N` β€” override debate rounds (1-3)
- `--adversarial` β€” use hostile reviewer personas instead of default
- `--budget N` β€” max findings across all personas (default 40)
- `--fail-on <severity>` β€” CI gate: exit non-zero if findings at/above threshold
- `--incremental` β€” reuse existing knowledge files, update only changed files
- `--chain`, `--<subcommand>`

Remaining text not matching flags = goal description.

## Setup (if Scope or Goal missing)

question (single batch):
  Q1 (Scope): "Which files to analyze?" β€” suggested globs + entire codebase
  Q2 (Goal): "What should personas focus on?" β€” code quality, security, performance, architecture, all
  Q3 (Depth): "How deep?" β€” shallow (3 personas, 1 round), standard (5, 2 β€” recommended), deep (8, 3)
  Q4 (Chain): "After analysis, chain to?" β€” debug, security, fix, ship, scenario, no chain
If all provided β†’ skip.

## Phase 1: Reconnaissance

Scan all in-scope files. Build structured knowledge:
- File inventory with purpose annotations
- Dependency graph (imports/exports)
- API surface (routes, handlers, types)
- Data flow (inputs β†’ processing β†’ outputs β†’ storage)
- Existing test coverage map

## Phase 2: Persona Generation

Load `references/predict-personas.md` for persona definitions.

**Default set (5):** Architect, Security Analyst, Performance Engineer, Reliability Engineer, Devil's Advocate.
**Adversarial set (--adversarial):** Breaker, Cheater, Scaler, Newbie, Malicious Insider.

Each persona receives: task description + codebase knowledge + their specific evaluation criteria.
Personas are isolated β€” no shared context between them.

## Phase 3: Independent Analysis

Each persona analyzes the codebase independently:
- Read relevant code through their lens
- Produce findings with: title, severity, confidence (0-100%), file:line, recommendation
- Max findings per persona: budget / persona_count

## Phase 4: Debate (per round)

For each debate round:
1. Present all personas' findings to each other
2. Each persona can: challenge findings, raise new issues, change confidence
3. Cross-examination: personas must respond to challenges with evidence
4. No persona can dismiss without counter-evidence

## Phase 5: Consensus

Synthesizer aggregates all findings:
1. Deduplicate (same file:line + same issue = merge, keep highest severity)
2. Resolve conflicts (if personas disagree, note dissent)
3. **Anti-herd check:** if all personas agree on everything, synthesizer MUST find at least 1 counter-argument
4. Rank by: severity Γ— average confidence Γ— persona agreement count

## Phase 6: Report

Create output directory: `autoresearch/predict-{YYMMDD}-{HHMM}/`

Write:
- `summary.md` β€” top findings, consensus view, risk assessment
- `debate.md` β€” full persona analysis + debate transcript
- Per-persona sections with individual findings

Print to console: top 10 findings ranked by severity Γ— confidence.

## Phase 7: CI Gate

If `--fail-on` set: check findings against threshold. Exit non-zero if exceeded.

## Chain Handoff

Write handoff.json: version "2.1.0", source "predict", timestamp, status (COMPLETE|ERROR), findings = consensus findings with severity + confidence + file:line, config{scope, goal, depth}.
Invoke next target in --chain order via the `autoresearch` skill's Subcommand routing.