Skip to content

Latest commit

Β 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Copilot CLI Session Monitor

A lightweight macOS menu bar app that shows your active GitHub Copilot CLI sessions at a glance. Click any session to jump straight to its terminal tab.

Copilot CLI Session Monitor

Features

  • πŸ–₯️ Live session list β€” see all active Copilot CLI sessions in your menu bar
  • πŸ–±οΈ One-click tab switching β€” click a session to focus its terminal tab
  • πŸ”„ Auto-refresh β€” updates every 30 seconds automatically
  • πŸ“ Directory context β€” shows the working directory for each session
  • πŸͺΆ Lightweight β€” single binary, no dock icon, reads local files only (no network)

How It Works

Copilot CLI stores session metadata locally. This app reads two sources:

  1. ~/.copilot/session-store.db β€” SQLite database with session names, directories, and timestamps
  2. ~/.copilot/session-state/*/inuse.*.lock β€” lock files that indicate which sessions have a live process

The app cross-references lock file PIDs with running processes to determine which sessions are active, then displays them in a native macOS menu bar dropdown.

graph LR
    A["~/.copilot/session-store.db"] -->|SQLite read-only| B["Session Reader"]
    C["~/.copilot/session-state/*/inuse.*.lock"] -->|Glob + PID check| B
    B -->|Active sessions| D["Menu Builder"]
    D -->|systray API| E["macOS Menu Bar"]
    E -->|Click session| F["AppleScript"]
    F -->|Switch tab| G["Terminal.app / Ghostty"]
    H["30s Timer"] -->|Refresh| B

    style A fill:#2d333b,color:#e6edf3,stroke:#444
    style C fill:#2d333b,color:#e6edf3,stroke:#444
    style E fill:#1a7f37,color:#fff,stroke:#444
    style G fill:#2d333b,color:#e6edf3,stroke:#444
Loading

Note: This app is read-only β€” it never modifies any Copilot files.

Prerequisites

  • macOS 26 (Tahoe) or later
  • Go 1.25+ (for building from source)
  • GitHub Copilot CLI 1.0.12 or later installed and used at least once (so ~/.copilot/ exists)

Quick Start

git clone https://github.com/liamchampton/copilot-cli-session-monitor.git
cd copilot-cli-session-monitor
make bundle
open 'Copilot CLI Session Monitor.app'

Installation

Option 1: Install to Applications (recommended)

Build the .app bundle and copy it to /Applications:

make install

Then launch from Spotlight or Finder: search for "Copilot CLI Session Monitor".

Option 2: Run from source

Build and run the binary directly (useful for development):

make run

Option 3: Build only

Compile the binary without creating an .app bundle:

make build
./copilot-monitor

Note: Running the bare binary works, but macOS requires a .app bundle for the menu bar icon to render reliably. Use make bundle or make install for the best experience.

Usage

Once running, you'll see a small terminal icon in your macOS menu bar:

  • Solid β€” at least one Copilot session is active
  • Faded β€” no active sessions

Click the icon to see:

● Plan Terminal Session Sidebar
  ~/Documents/github/agent-controller

● Azure VS Code Changelog Calendar
  ~/Documents/github/everything-vs-code-shipped

● product-store-demo
  ~/Documents/github/product-store-demo

──────────────────────────
3 active Β· 13:25
──────────────────────────
Quit

Click any session name to switch to its terminal tab.

Terminal Compatibility

Session detection works with any terminal β€” it reads from Copilot CLI's local files, not the terminal itself. Tab switching currently supports macOS default terminal and Ghostty.

Terminal Session list Active/idle status Click to switch tab
macOS default terminal βœ… βœ… βœ…
Ghostty βœ… βœ… βœ…
iTerm2 βœ… βœ… ❌ Not yet
Warp βœ… βœ… ❌ Not yet
Kitty βœ… βœ… ❌ Not yet
Alacritty βœ… βœ… ❌ Not yet
tmux βœ… βœ… ❌ Not yet
VS Code terminal βœ… βœ… ❌ Not yet

Want support for your terminal? Contributions welcome β€” see CONTRIBUTING.md.

macOS Permissions

On first launch, macOS will ask for Automation permission to control Terminal.app (or Ghostty, if detected). This is required for the tab-switching feature. Grant it in:

System Settings β†’ Privacy & Security β†’ Automation β†’ Copilot CLI Session Monitor β†’ Terminal / Ghostty

Uninstall

If installed to /Applications:

make uninstall

Or manually delete:

rm -rf '/Applications/Copilot CLI Session Monitor.app'

Remove all traces:

The app itself stores no data. To fully clean up:

# Remove the app
rm -rf '/Applications/Copilot CLI Session Monitor.app'

# Remove build artifacts (if in the project directory)
make clean

Note: This does not touch your ~/.copilot/ directory β€” that belongs to GitHub Copilot CLI.

Development

Project Structure

copilot-cli-session-monitor/
β”œβ”€β”€ main.go                        # Entry point β€” systray.Run()
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ menu/
β”‚   β”‚   β”œβ”€β”€ builder.go             # Systray menu construction
β”‚   β”‚   └── builder_test.go        # Unit tests for menu builder
β”‚   β”œβ”€β”€ monitor/
β”‚   β”‚   └── monitor.go             # Refresh timer orchestration
β”‚   β”œβ”€β”€ session/
β”‚   β”‚   β”œβ”€β”€ types.go               # CopilotSession struct
β”‚   β”‚   β”œβ”€β”€ reader.go              # SQLite + lock file reader
β”‚   β”‚   └── reader_test.go         # Unit tests for session reader
β”‚   └── terminal/
β”‚       └── focus.go               # Terminal tab switching (Terminal.app + Ghostty)
β”œβ”€β”€ assets/
β”‚   β”œβ”€β”€ AppIcon.icns               # macOS app icon (icns format)
β”‚   β”œβ”€β”€ app-icon.png               # App icon source (png)
β”‚   β”œβ”€β”€ icon-active.png            # Green menu bar icon
β”‚   └── icon-idle.png              # Gray menu bar icon
β”œβ”€β”€ bundle/
β”‚   └── Info.plist                 # macOS app bundle metadata
β”œβ”€β”€ .github/
β”‚   └── agents/
β”‚       └── go-testing-agent.agent.md  # Copilot agent for Go tests
β”œβ”€β”€ Makefile                       # Build, bundle, install targets
β”œβ”€β”€ CONTRIBUTING.md                # Contribution guidelines
β”œβ”€β”€ LICENSE                        # Project license
β”œβ”€β”€ go.mod
└── go.sum

Make Targets

Target Description
make build Compile the Go binary
make bundle Build + package as Copilot CLI Session Monitor.app
make install Build + bundle + copy to /Applications
make uninstall Remove from /Applications
make run Build and run directly (for development)
make clean Remove build artifacts

Key Design Decisions

  • Read-only β€” never writes to Copilot's files
  • Pure Go SQLite (modernc.org/sqlite) β€” no CGo dependency for database access
  • Goroutine-safe β€” cancel pattern prevents leaked goroutines on menu refresh
  • Persistent DB connection β€” opened once, reused across refreshes
  • Efficient queries β€” scans lock files first, then queries only active session IDs

Tech Stack

  • Go β€” application language
  • fyne.io/systray β€” cross-platform system tray
  • modernc.org/sqlite β€” pure Go SQLite driver
  • AppleScript β€” Terminal.app and Ghostty tab switching

Contributing

Contributions are welcome! Please read CONTRIBUTING.md and open an issue first to discuss what you'd like to change.

About

A MacOS status bar application that to track your GitHub Copilot CLI terminal sessions

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages