Agent discussion panel

From JeremyDev87/codingbuddy · View interactive version

Agent discussion panel is an AI agent skill from the GitHub repository JeremyDev87/codingbuddy. Use when rendering a multi-agent discussion as a TUI panel. Defines terminal panel layout, component architecture, real-time streaming behavior, and integration points for displaying AgentOpinion data with bordered boxes, severity badges, and consensus indicators.

How to use this skill

Skill file

Agent Discussion Panel (TUI)

Overview

The Agent Discussion Panel is a terminal UI component that renders multi-agent debates as a structured, scrollable panel. It consumes DiscussionResult data (from the AgentOpinion protocol) and renders it using the box-drawing format defined by the agent-discussion formatter skill.

Core principle: The panel is a _layout container_, not a formatter. It delegates all opinion rendering to the agent-discussion formatter and focuses on panel chrome, streaming lifecycle, and spatial arrangement.

Iron Law:

THE PANEL NEVER FORMATS OPINIONS — IT ARRANGES THEM
Formatting = agent-discussion skill. Layout = this skill.

Relationship to Other Components

┌─────────────────────────────────────────────────┐
│ AgentOpinion Protocol (discussion.types.ts)      │
│   Defines: AgentOpinion, DiscussionResult        │
└──────────────────┬──────────────────────────────┘
                   │ data
                   ▼
┌─────────────────────────────────────────────────┐
│ agent-discussion (formatter skill)               │
│   Renders: box chars, severity badges, consensus │
└──────────────────┬──────────────────────────────┘
                   │ formatted blocks
                   ▼
┌─────────────────────────────────────────────────┐
│ agent-discussion-panel (THIS skill — TUI layout) │
│   Arranges: header, stream, consensus, summary   │
└─────────────────────────────────────────────────┘

When to Use

When NOT to Use

Data Model Binding

The panel binds directly to the AgentOpinion protocol types:

// Input: DiscussionResult from discussion.types.ts
interface DiscussionResult {
  topic: string;              // → Panel header title
  specialists: string[];      // → Header participant count
  opinions: AgentOpinion[];   // → Opinion stream (main content)
  consensus: ConsensusStatus; // → Consensus bar
  summary: string;            // → Summary footer
  maxSeverity: OpinionSeverity; // → Header severity indicator
}

// Each opinion maps to a formatter block
interface AgentOpinion {
  agent: string;          // → Box title (with emoji prefix)
  opinion: string;        // → Box body text
  severity: OpinionSeverity; // → Severity badge
  evidence: string[];     // → Evidence lines in box
  recommendation: string; // → Recommendation line in box
}

Panel Architecture

Full Panel Layout

╔══════════════════════════════════════════════════════╗
║ 🗣️ AGENT DISCUSSION: {topic}                        ║
║ {specialist_count} agents | Max severity: {badge}    ║
╠══════════════════════════════════════════════════════╣
║                                                      ║
║ ┌─ 🔒 security-specialist ────────────────────────┐  ║
║ │ 🔴 CRITICAL: {title}                            │  ║
║ │ {description}                                    │  ║
║ │ Evidence: {file:line}                            │  ║
║ │ Recommendation: {action}                         │  ║
║ └──────────────────────────────────────────────────┘  ║
║                                                      ║
║ ┌─ ⚡ performance-specialist ─────────────────────┐  ║
║ │ 🟡 MEDIUM: {title}                              │  ║
║ │ {description}                                    │  ║
║ │ Evidence: {file:line}                            │  ║
║ │ Recommendation: {action}                         │  ║
║ └──────────────────────────────────────────────────┘  ║
║                                                      ║
║ ┌─ 📏 code-quality-specialist ────────────────────┐  ║
║ │ 🟢 LOW: {title}                                 │  ║
║ │ {description}                                    │  ║
║ │ Evidence: {file:line}                            │  ║
║ │ Recommendation: {action}                         │  ║
║ └──────────────────────────────────────────────────┘  ║
║                                                      ║
╠══════════════════════════════════════════════════════╣
║ ✅ CONSENSUS (3/3 agents agree)                      ║
║ Auth guard must be added to /api/admin/* endpoints.  ║
║ Priority: CRITICAL — unanimously recommended         ║
╠══════════════════════════════════════════════════════╣
║ 📋 SUMMARY | Findings: 3 | 🔴1 🟡1 🟢1             ║
║ Action: Fix 1 CRITICAL before merge                  ║
╚══════════════════════════════════════════════════════╝

Component Breakdown

The panel consists of four vertical sections:

| Section | Box Style | Source | Content |

|---------|-----------|--------|---------|

| Header | ╔═╗║╚═╝ (double-line) | DiscussionResult.topic, .specialists, .maxSeverity | Title, participant count, max severity badge |

| Opinion Stream | ┌─┐│└─┘ (single-line, per opinion) | DiscussionResult.opinions[] | Agent opinion blocks (delegated to formatter) |

| Consensus Bar | ╔═╗║╚═╝ (double-line) | DiscussionResult.consensus, inferred from opinions | Consensus/split/disagreement indicator |

| Summary Footer | ╠═╣ separator + ╚═╝ close | DiscussionResult.summary, severity counts | Compact stats and action items |

Component Specifications

1. Panel Header

Renders the discussion topic and metadata in a double-line bordered header.

╔══════════════════════════════════════════════════════╗
║ 🗣️ AGENT DISCUSSION: {topic}                        ║
║ {n} agents | Max severity: {severity_badge}          ║
╠══════════════════════════════════════════════════════╣

Rules:

2. Opinion Stream

The scrollable main content area displaying individual agent opinion blocks.

Rendering rules:

Grouping:

║ 📍 api/admin/users.ts                                ║
║                                                      ║
║ ┌─ 🔒 security-specialist ────────────────────────┐  ║
║ │ ...                                              │  ║
║ └──────────────────────────────────────────────────┘  ║
║                                                      ║
║ ┌─ 📏 code-quality-specialist ────────────────────┐  ║
║ │ ...                                              │  ║
║ └──────────────────────────────────────────────────┘  ║

Deduplication:

3. Consensus Bar

Displays the discussion's consensus status using double-line borders.

Rendering by ConsensusStatus:

| Status | Display |

|--------|---------|

| consensus | ✅ CONSENSUS ({n}/{n} agents agree) — green accent |

| majority | 📊 MAJORITY ({n}/{total} agents agree) — yellow accent |

| split | ⚖️ SPLIT OPINION ({n} vs {m}) — orange accent, shows FOR/AGAINST lists |

| disagreement | ❌ NO CONSENSUS ({n} agents disagree) — red accent, lists each position |

Rules:

4. Summary Footer

Compact statistics and action items at the panel bottom.

╠══════════════════════════════════════════════════════╣
║ 📋 SUMMARY | Agents: {n} | Findings: {total}        ║
║   🔴 {c} 🟠 {h} 🟡 {m} 🟢 {l} ℹ️ {i}               ║
║ Action: {action_summary}                             ║
╚══════════════════════════════════════════════════════╝

Rules:

Real-Time Streaming

The panel supports progressive rendering as agent opinions arrive one by one during parallel specialist execution.

Streaming Lifecycle

Phase 1: INITIALIZING
╔══════════════════════════════════════════════════════╗
║ 🗣️ AGENT DISCUSSION: {topic}                        ║
║ Waiting for agents... (0/{expected} responded)       ║
╠══════════════════════════════════════════════════════╣
║                                                      ║
║  ⏳ Collecting opinions...                           ║
║                                                      ║
╚══════════════════════════════════════════════════════╝

Phase 2: STREAMING (opinions arriving)
╔══════════════════════════════════════════════════════╗
║ 🗣️ AGENT DISCUSSION: {topic}                        ║
║ 2/{expected} agents responded | Max: 🟠 HIGH         ║
╠══════════════════════════════════════════════════════╣
║                                                      ║
║ ┌─ 🔒 security-specialist ────────────────────────┐  ║
║ │ 🟠 HIGH: ...                                    │  ║
║ └──────────────────────────────────────────────────┘  ║
║                                                      ║
║ ┌─ ⚡ performance-specialist ─────────────────────┐  ║
║ │ 🟡 MEDIUM: ...                                  │  ║
║ └──────────────────────────────────────────────────┘  ║
║                                                      ║
║  ⏳ Waiting: 📏 code-quality, 🏛️ architecture       ║
║                                                      ║
╚══════════════════════════════════════════════════════╝

Phase 3: COMPLETE (all opinions received)
[Full panel layout as shown in Panel Architecture]

Streaming Rules

  1. Header updates live — agent count and max severity refresh as each opinion arrives
  2. Opinions append — new opinions are inserted in severity-sorted position, not appended at bottom
  3. Waiting indicator — lists pending agent names with their emoji prefixes
  4. Consensus bar deferred — only rendered when all opinions are received (cannot compute consensus from partial data)
  5. Summary footer deferred — only rendered at Phase 3 (COMPLETE)
  6. No flicker — use terminal cursor repositioning or buffered output to avoid visual tearing

Streaming Data Events

// Event types the panel listens for
type PanelEvent =
  | { type: 'discussion_start'; topic: string; expectedAgents: string[] }
  | { type: 'opinion_received'; opinion: AgentOpinion }
  | { type: 'discussion_complete'; result: DiscussionResult };

Layout Constraints

Terminal Width Adaptation

| Terminal Width | Behavior |

|---------------|----------|

| >= 80 cols | Full layout with evidence and recommendations inline |

| 60-79 cols | Compact: evidence truncated with ..., recommendation on separate line |

| < 60 cols | Minimal: severity badge + title only, details collapsed; expand on focus |

Minimum Dimensions

Content Overflow

Integration Points

codingbuddy TUI

If a codingbuddy TUI dashboard exists, the panel integrates as a widget:

┌─ codingbuddy dashboard ──────────────────────────────────────┐
│ ┌── Task Progress ──┐  ┌── Agent Discussion Panel ────────┐  │
│ │ [=====>    ] 60%   │  │ ╔═══════════════════════════════╗│  │
│ │ Step 3/5: Testing  │  │ ║ 🗣️ Auth Endpoint Review      ║│  │
│ │                    │  │ ╠═══════════════════════════════╣│  │
│ │ ✅ Step 1          │  │ ║ ┌─ 🔒 security ──────────┐  ║│  │
│ │ ✅ Step 2          │  │ ║ │ 🔴 CRITICAL: ...       │  ║│  │
│ │ 🔄 Step 3          │  │ ║ └────────────────────────┘  ║│  │
│ │ ⬜ Step 4          │  │ ║ ┌─ 📏 code-quality ─────┐  ║│  │
│ │ ⬜ Step 5          │  │ ║ │ 🟡 MEDIUM: ...        │  ║│  │
│ └────────────────────┘  │ ║ └────────────────────────┘  ║│  │
│                         │ ╚═══════════════════════════════╝│  │
│                         └──────────────────────────────────┘  │
└──────────────────────────────────────────────────────────────┘

Widget API contract:

interface DiscussionPanelWidget {
  /** Render the panel into a bounded region */
  render(region: { x: number; y: number; width: number; height: number }): void;

  /** Feed a new opinion into the streaming panel */
  pushOpinion(opinion: AgentOpinion): void;

  /** Finalize the panel with complete discussion result */
  complete(result: DiscussionResult): void;

  /** Clear the panel content */
  reset(): void;
}

Standalone Mode

When not embedded in a dashboard, the panel renders full-width to stdout:

interface StandalonePanel {
  /** Render a complete discussion result to stdout */
  print(result: DiscussionResult): void;

  /** Start streaming mode, returns controller */
  startStreaming(topic: string, expectedAgents: string[]): StreamController;
}

interface StreamController {
  /** Add an opinion (re-renders panel) */
  addOpinion(opinion: AgentOpinion): void;

  /** Mark streaming complete, render final panel */
  finish(result: DiscussionResult): void;
}

Rendering Examples

Empty State (No Opinions Yet)

╔══════════════════════════════════════════════════════╗
║ 🗣️ AGENT DISCUSSION: API Security Review            ║
║ Waiting for agents... (0/4 responded)                ║
╠══════════════════════════════════════════════════════╣
║                                                      ║
║  ⏳ Collecting opinions from:                        ║
║     🔒 security  ⚡ performance                      ║
║     📏 code-quality  🏛️ architecture                 ║
║                                                      ║
╚══════════════════════════════════════════════════════╝

Single Agent Response

╔══════════════════════════════════════════════════════╗
║ 🗣️ AGENT DISCUSSION: API Security Review            ║
║ 1/4 agents responded | Max: 🔴 CRITICAL              ║
╠══════════════════════════════════════════════════════╣
║                                                      ║
║ ┌─ 🔒 security-specialist ────────────────────────┐  ║
║ │ 🔴 CRITICAL: Unauthenticated admin endpoint     │  ║
║ │                                                  │  ║
║ │ The /api/admin/users endpoint lacks auth guard.  │  ║
║ │ Any client can access user PII.                  │  ║
║ │                                                  │  ║
║ │ Evidence: api/admin/users.ts:12                  │  ║
║ │ Recommendation: Add AuthGuard + RolesGuard       │  ║
║ └──────────────────────────────────────────────────┘  ║
║                                                      ║
║  ⏳ Waiting: ⚡ performance, 📏 code-quality,        ║
║     🏛️ architecture                                  ║
║                                                      ║
╚══════════════════════════════════════════════════════╝

Disagreement with Split Opinion

╔══════════════════════════════════════════════════════╗
║ 🗣️ AGENT DISCUSSION: Caching Strategy               ║
║ 3 agents | Max severity: 🟠 HIGH                     ║
╠══════════════════════════════════════════════════════╣
║                                                      ║
║ ┌─ ⚡ performance-specialist ─────────────────────┐  ║
║ │ 🟠 HIGH: Add request-level caching              │  ║
║ │ DB query latency at p99 is 800ms. Cache would    │  ║
║ │ reduce to <50ms for repeated reads.              │  ║
║ │ Evidence: monitoring/latency-report.md:23        │  ║
║ │ Recommendation: Add Redis cache with 60s TTL     │  ║
║ └──────────────────────────────────────────────────┘  ║
║                                                      ║
║ ┌─ 🏛️ architecture-specialist ────────────────────┐  ║
║ │ 🟡 MEDIUM: Cache fits existing layer            │  ║
║ │ The CacheModule is already wired. Adding a new   │  ║
║ │ cache key requires no architectural changes.     │  ║
║ │ Evidence: src/cache/cache.module.ts:1            │  ║
║ │ Recommendation: Use existing CacheModule.set()   │  ║
║ └──────────────────────────────────────────────────┘  ║
║                                                      ║
║ ┌─ 🔒 security-specialist ────────────────────────┐  ║
║ │ 🟠 HIGH: Cache invalidation risk                │  ║
║ │ Stale cache may serve outdated auth state after  │  ║
║ │ permission changes, creating privilege window.   │  ║
║ │ Evidence: src/auth/permissions.service.ts:45     │  ║
║ │ Recommendation: TTL < 30s + invalidate on       │  ║
║ │   permission change events                       │  ║
║ └──────────────────────────────────────────────────┘  ║
║                                                      ║
╠══════════════════════════════════════════════════════╣
║ ⚖️ SPLIT OPINION (2 vs 1)                            ║
║                                                      ║
║ FOR caching (2):                                     ║
║   ⚡ performance — reduces p99 latency by 94%        ║
║   🏛️ architecture — fits existing cache layer        ║
║                                                      ║
║ AGAINST as-is (1):                                   ║
║   🔒 security — stale auth state risk                ║
║                                                      ║
║ Recommendation: Proceed with TTL < 30s + event       ║
║   invalidation                                       ║
╠══════════════════════════════════════════════════════╣
║ 📋 SUMMARY | Agents: 3 | Findings: 3                ║
║   🔴 0  🟠 2  🟡 1  🟢 0  ℹ️ 0                       ║
║ Action: Resolve split opinion, then fix 2 HIGH       ║
╚══════════════════════════════════════════════════════╝
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.