Skip to content

[B2a] Brain TUI stats panel (Ctrl+P popup) #177

Description

@four-bytes-robby

Purpose

Ctrl+P popup showing search analytics and project stats in a compact modal.

Design

Add BrainStatsPanel component in src/tui.tsx:

  • Triggered by Ctrl+P keyboard shortcut (use opencode TUI keyboard hook or useEffect with keydown)
  • Modal/popup layout showing:
    🧠 Brain Stats — {project}
    ─────────────────────────
    📊 Search Analytics (this session)
      Searches:    42
      Avg results: 8.3
      Avg score:   0.72
      Top query:   "symfony entity pattern"
      
    📁 Project Index
      Files:   142
      Chunks:  847
      Memories: 23
      KB entries: 5
      
    🎯 Feedback
      Reported: 12/42 (29%)
      Helpful:  10/12 (83%)
      Used:      8/12 (67%)
    ─────────────────────────
    [ESC to close]
    

Data sources:

  • Search analytics from search_analytics table (B2b-core)
  • Project stats from getProjectStats() (B2c)
  • Feedback stats from search_analytics WHERE helpful IS NOT NULL

Acceptance

  • Ctrl+P opens stats popup
  • ESC closes it
  • All counters reflect live data
  • Works in both sidebar and home variants
  • Graceful fallback when no analytics data yet

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions