Adds a new `discuss` command that enables interactive discussion sessions
with multiple AI reviewers, including session persistence and context loading.
- Add ReviewerStatus type for tracking reviewer state
- Track start/end time and duration for each reviewer
- Display live status during parallel execution:
✓ done (with duration) | ⋯ thinking | ○ pending
- Update spinner in real-time as reviewers complete
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix convergence check: NOT_CONVERGED was incorrectly matching CONVERGED
- Allow convergence after round 1 (was requiring 2 rounds minimum)
- Unify codex-cli streaming/non-streaming to use same bypass flag
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add Fair Debate Model and Parallel Execution to core concepts
- Update max_rounds default from 2 to 5
- Document new CLI options: --reviewers, --all/-a, --git-remote
- Add Reviewer Selection section with interactive/CLI examples
- Rewrite Workflow to show Round 1 independent → Round 2+ debate model
- Add Fair Debate Model explanation section
- Add Parallel Execution section with example output
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Each round now executes all reviewers in parallel using Promise.all:
1. Build messages for all reviewers (same info)
2. Execute all chatStream calls concurrently
3. Collect all responses
4. Display results after all complete
Benefits:
- Faster execution (N reviewers run simultaneously)
- Semantically correct (same round = simultaneous)
- Same total API usage, just concurrent
Display shows: "Round N: All reviewers thinking (parallel)"
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changed debate model:
- Round N: each reviewer sees only rounds 1 to N-1
- Reviewers in same round have identical information (fair)
- No anchoring bias from earlier reviewers in same round
Example with 3 reviewers:
Round 2: claude sees [gemini_r1, codex_r1]
gemini sees [claude_r1, codex_r1] <- same info level
codex sees [claude_r1, gemini_r1] <- same info level
Also increased default max_rounds from 3 to 5 since convergence
may take longer with this fairer model.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Bug: Round 1 is independent (no one sees others), so session doesn't
have other reviewers' messages. When entering Round 2 debate phase,
we were only sending messages after lastSeen, missing others' Round 1.
Fix: Check if reviewer just finished Round 1 (myMessageCount === 1).
If so, send ALL other reviewers' messages, not just incremental.
Round 3+ continues to use incremental (lastSeen + 1) since debate
context is already established in session.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Round 1: Each reviewer gives independent assessment
- Only sees analysis, not other reviewers' opinions
- Avoids anchoring bias from first reviewer
Round 2+: Full debate mode
- Sees all previous discussion
- Can agree/disagree with specific points from [reviewer_id]
This ensures diverse initial perspectives before debate begins.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- claude-code: add --dangerously-skip-permissions
- codex-cli: use --dangerously-bypass-approvals-and-sandbox
- gemini-cli: already has -y (yolo mode)
This allows CLI tools to access network (e.g., gh commands to fetch PR)
without permission prompts.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Usage:
- Default: shows interactive menu to select reviewers
[0] All reviewers
[1] claude
[2] gemini
...
- --all (-a): use all reviewers, skip selection
- --reviewers claude,gemini: specify reviewers directly
Requires at least 2 reviewers for a debate.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add --git-remote argument to specify which git remote to use when
constructing PR URLs from a PR number. This is useful when working
with forks where the user wants to review PRs from a specific remote
(e.g., upstream) instead of the default origin.
If not provided, defaults to 'origin' for backward compatibility.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Now shows convergence check as a distinct step:
┌─ 🔍 Convergence Judge ─────────────────────────
⠋ Evaluating if reviewers reached consensus...
└─ Verdict: CONVERGED / NOT CONVERGED
Makes it clear this is a separate judge, not another reviewer.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Previous prompt was too lenient ("mostly agree on key points").
Now requires TRUE consensus:
- All reviewers must agree on the same verdict
- NOT converged if any reviewer says "I disagree/reject [X]'s view"
- NOT converged if they agree on problems but disagree on actions
- System prompt: "Be conservative - when in doubt, say NOT_CONVERGED"
This fixes false positives like Gemini saying "I reject [claude]'s view"
but still being marked as converged.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- "adversarial debate against" → "code review debate with"
- "opponent" → "the other reviewer"
- Add "shared goal: find real issues and reach the best conclusion"
- "agree where valid, challenge where you disagree"
- "acknowledge good points and build on them"
Keep the anti-sycophancy stance but focus on solving problems together.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Replace anonymous [AI Reviewer] with specific reviewer IDs (e.g., [claude], [gemini])
- Rewrite prompts to emphasize adversarial debate, not collaborative review
- Each AI now knows: "You are [X], your opponent is [Y]"
- Use action words like "Challenge their points", "Defend your position"
- Remove verbose old instructions, keep prompts focused
This makes AIs actually argue with each other instead of politely agreeing.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Gemini CLI only supports index-based sessions (-r latest or -r 5),
not custom session IDs like Claude CLI. Since "latest" could refer
to a different session if user runs other Gemini commands, this is
unreliable. Disabled session support for Gemini CLI - it will always
use full context mode instead.
Also updated README to clarify session support per provider.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fixed bug where sessionId was checked instead of hasSession.
Now gemini-cli properly uses -r latest to resume sessions
for incremental discussion like claude-code.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- New gemini-cli provider using the Gemini CLI tool
- Uses -y (yolo mode) for auto-approve and -o text for clean output
- Supports session resumption with -r latest
- 15 minute timeout like other CLI providers
- Added to init wizard as a no-API-key option
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Previously only the final conclusion was rendered with markdown.
Now all reviewer outputs are buffered and rendered with marked
when each reviewer finishes speaking.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Session persistence (reduces token usage):
- Claude Code provider maintains session across rounds
- Uses --session-id for first call, --resume for subsequent
- Only sends incremental messages in session mode
Post-analysis interactive Q&A:
- In interactive mode (-i), user can ask specific reviewers before debate
- Format: @reviewer_id question (e.g., @claude What about security?)
- Allows clarifying questions before full debate begins
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The summarizer uses non-streaming chat(), so onMessage callback
never fires to stop the spinner. Now explicitly stop it after
runStreaming() returns.
Also refactored spinner/interval to use object ref to fix
TypeScript control flow analysis issues with closures.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use marked + marked-terminal to render final conclusion
- Proper colors, bold, table alignment in terminal
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Structured format with clear sections (共识点, 分歧点, 行动项, 总体评估)
- Priority table for action items (P0/P1/P2)
- Detailed issue format with location, problem, risk, consensus level
- Clear merge status and conditions
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Increase CLI provider timeout from 5 to 15 minutes for large PRs
- Display random programmer jokes while waiting for AI reviewers
- 36 English cold jokes rotate every 8 seconds
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add interactive mode to `magpie init` allowing users to select which AI
reviewers to configure. Shows available options with API key requirements
and generates a customized config. Supports -y flag for defaults.
Add --local flag to `magpie review` to review uncommitted changes (staged
+ unstaged) without needing a PR. Falls back to last commit if no local
changes exist.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add convergence detection (default enabled, configurable)
- Add token usage estimation and cost tracking
- Add spinner for waiting states
- Fix AI sycophancy by clarifying debate context
- Explicitly state reviewer count in prompts
- Update README with Chinese documentation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add codex-cli provider that calls the codex CLI command, similar to claude-code provider.
Also update gemini model to gemini-3-pro in user config.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add Google Gemini provider using @google/generative-ai SDK with support
for both standard and streaming chat methods. Update default config
template to use simpler model-based reviewer names (claude, gemini)
instead of role-based names. Analyzer and summarizer now use claude-code.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>