Skip to content

Timwood0x10/CodeTribunal

Repository files navigation

CodeTribunal

       ██████╗ ██████╗ ██████╗ ███████╗████████╗██████╗ ██╗██████╗ ██╗   ██╗███╗   ██╗ █████╗ ██╗     
      ██╔════╝██╔═══██╗██╔══██╗██╔════╝╚══██╔══╝██╔══██╗██║██╔══██╗██║   ██║████╗  ██║██╔══██╗██║     
      ██║     ██║   ██║██║  ██║█████╗     ██║   ██████╔╝██║██████╔╝██║   ██║██╔██╗ ██║███████║██║     
      ██║     ██║   ██║██║  ██║██╔══╝     ██║   ██╔══██╗██║██╔══██╗██║   ██║██║╚██╗██║██╔══██║██║     
      ╚██████╗╚██████╔╝██████╔╝███████╗   ██║   ██║  ██║██║██████╔╝╚██████╔╝██║ ╚████║██║  ██║███████╗
       ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝   ╚═╝   ╚═╝  ╚═╝╚═╝╚═════╝  ╚═════╝ ╚═╝  ╚═══╝╚═╝  ╚═╝╚══════╝

An AI-powered code review roundtable where multiple LLM agents debate and critique your code.

Each agent gets a random persona, and one is secretly the Troublemaker — tasked with giving subtly harmful advice without getting caught. You must identify who is sabotaging the review.

Features

  • Multi-LLM Support: Ollama (default), OpenAI, Anthropic Claude — mix and match per player
  • Persona System: 8 unique reviewer personalities with distinct styles
  • Troublemaker Mechanic: One agent secretly works against you — can you spot them?
  • Cross-Examination Debate: AI agents accuse each other with evidence before voting
  • Vote to Eliminate: AI jury votes out the most suspicious member
  • Pause/Resume: Freeze and continue conversations at any time
  • Code Analysis: Integrates with garbage-code-hunter for real code analysis
  • Dual Storage: Zero-config goagent in-memory, or persistent SQLite with database.path
  • YAML Config: Full configurability via config/roundtable.yaml

Quick Start

Prerequisites

  • Go 1.26+
  • Ollama (for default local setup): ollama pull llama3.2

Step 1: Set API Keys

The project uses Xiaomi MiMo as the default LLM provider. Set your API key:

# Set the Xiaomi MiMo API key (default provider/use the local Ollama model if none is available).
export XIAOMI_OPENAI_API_KEY=your_api_key_here

# Optional: Other providers (if you configure them in roundtable.yaml)
export OPENAI_API_KEY=sk-your-openai-key
export ANTHROPIC_API_KEY=sk-ant-your-anthropic-key

💡 Tip: Add these to your ~/.bashrc or ~/.zshrc to persist across sessions.

Step 2: Run the Application

CodeTribunal supports two modes:

Mode A: Web UI (Recommended)

Start the web server and open in browser:

go run ./cmd/roundtable/main.go serve
# Or simply:
go run ./cmd/roundtable serve

# Or with Make:
make serve

The server starts at http://localhost:8765 — open it in your browser to use the full web interface.

Mode B: CLI Mode

Run in terminal with interactive commands:

go run ./cmd/roundtable/main.go
# Or:
go run ./cmd/roundtable

# Or with Make:
make run

Screenshots

Main Interface

Main Interface

The main interface shows the control panel, player list, and real-time chat area with the AI debate.

Code Review Discussion

Code Review - Architecture

Agent Beta (Architect) provides detailed architectural analysis, discussing coupling, design patterns, and code organization.

Code Review - Security

Agent Delta focuses on security vulnerabilities, identifying critical issues like command injection and hardcoded secrets.

AI Debate Mode

Battle Mode

In battle mode, agents engage in cross-examination, debating each other's findings with evidence from the discussion.

Configure

Edit config/roundtable.yaml:

llm:
  default_provider: ollama
  default_model: llama3.2
  providers:
    ollama:
      base_url: http://localhost:11434
    openai:
      api_key: ${OPENAI_API_KEY}
      model: gpt-4o
    anthropic:
      api_key: ${ANTHROPIC_API_KEY}
      model: claude-sonnet-4-20250514

roundtable:
  players:
    - id: player-1
      name: "GPT"
      provider: openai
    - id: player-2
      name: "Claude"
      provider: anthropic
    - id: player-3
      name: "DeepSeek"
      provider: openai
      model: deepseek-chat
    - id: player-4
      name: "Local"
      provider: ollama

Usage

> submit /path/to/your/code    # Start a code review round
> vote player-2                # Vote for the troublemaker
> battle                       # Trigger AI battle mode (debate on a topic)
> status                       # Check game state
> pause                        # Pause the ongoing session
> resume                       # Resume a paused session
> exit                         # Quit

Storage

# config/roundtable.yaml
database:
  path: ""                       # "" = goagent in-memory (default, no setup)
  # path: ./data/tribunal.db     # Set to enable persistent SQLite storage
  • Default: goagent in-memory MemoryRepository — zero config, restart loses history
  • SQLite: Set database.path to a file path — persistent storage with modernc.org/sqlite

How It Works

flowchart LR
    Deal["Deal<br/>Assign personas & pick troublemaker"] --> Analyze["Analyze<br/>garbage-code-hunter scan"]
    Analyze --> Speak["Speak<br/>3 rounds of discussion"]
    Speak --> Debate["Debate<br/>Cross-examination & accusations"]
    Debate --> Vote["Vote<br/>AI jury eliminates one member"]
    Vote --> Reveal["Reveal<br/>Unmask identities"]
    Vote -.->|troublemaker alive| Speak
Loading
  1. Deal: Each player draws one of 8 personas; one is secretly the troublemaker
  2. Analyze: Run garbage-code-hunter --json to scan the codebase
  3. Speak: 3 rounds — opening statements, rebuttals, closing arguments
  4. Debate: Cross-examination — each player accuses a suspect with quoted evidence
  5. Vote: AI jury eliminates the most-voted member. If the troublemaker survives, loop back to Speak
  6. Reveal: Identities revealed — did you catch the saboteur?

You can pause/resume the session anytime, or interject with questions mid-discussion.

Personas

Persona Style
🏛️ Architect Module boundaries, coupling, design patterns
⚡ Performance Guru Algorithmic complexity, memory, cache
🛡️ Security Guardian Input validation, injections, access control
🧹 Clean Code Freak Naming, formatting, dead code
🧪 Test Driver Coverage, boundary conditions, error paths
🚗 Old Hand Production wisdom, real-world experience
🕴️ Agent 47 Concise bullet points, only critical issues
🦸 Deadpool Breaks the fourth wall, meta-humor

Troublemaker Disguises

The troublemaker uses subtle tactics — overcomplicating simple issues, suggesting irrelevant tech, or downplaying real problems. They must stay 80% helpful and only let their bias slip occasionally.

Disguise Strategy
🧠 Deep Thinker Overcomplicate with academic jargon
⛓️ Blockchain! Suggest irrelevant trendy tech
🔄 Rewrite It Suggest rewrites far beyond scope
✅ It's Perfect Downplay every issue's severity
🤖 Let AI Do It Deflect to linters/automation

Tech Stack

  • Language: Go 1.26+
  • Agent Framework: goagent v0.1.1
    • Core agent infrastructure providing base types, session management, and in-memory storage (MemoryRepository)
    • Handles LLM integration, message routing, and agent lifecycle management
    • The foundation that enables multi-agent orchestration and debate mechanics
  • Vector Database: sqlite-vec (via asg017/sqlite-vec-go-bindings v0.1.6)
    • SQLite extension for vector similarity search and KNN queries
    • Powers the experience retrieval system — finds similar past game sessions using embeddings
    • Uses keyword-hashing based embeddings (128-dimensional float32 vectors)
    • Requires mattn/go-sqlite3 (CGo) for extension support
  • Primary Database: modernc.org/sqlite v1.50.1 (pure Go, no CGO)
    • Persistent storage for sessions, messages, and game experiences
    • Works alongside sqlite-vec in a dual-database architecture
  • Real-time Communication: github.com/coder/websocket v1.8.14
    • WebSocket support for live chat updates between frontend and backend
  • Dependencies:
    • golang.org/x/sync v0.20.0 (errgroup, semaphore)
    • gopkg.in/yaml.v3 v3.0.1 (configuration parsing)
    • github.com/google/uuid v1.6.0 (unique identifiers)
  • Code Analyzer: garbage-code-hunter by TimWood
    • External tool for static code analysis and issue detection

Author

TimWoodGitHub

License

This project is licensed under the Apache License 2.0.

See the LICENSE file for details.

About

An AI-powered code review roundtable where multiple LLM agents debate and critique your code.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages