A .NET 10 console application that monitors GitHub Copilot CLI and Claude CLI agent sessions with a rich terminal UI dashboard.
- Real-time dashboard — Auto-refreshing TUI built with Spectre.Console
- Status detection — Classifies each agent session as:
- 🔴 Attention — Process running, waiting for user input
- 🟢 Running — Process running, actively executing
- 🟡 Idle — Process running, no recent activity
- ⚪ Stopped — No process running (historical session)
- Keyboard navigation — Arrow keys, PgUp/PgDn, Home/End
- Filtering — Cycle through filters (Open/All/Attention/Running/Idle/Stopped) with
F - Search — Press
/to search sessions by path, summary, or branch - Resume sessions — Press
Enteron a stopped session to resume it in a new Windows Terminal tab - Hybrid process detection — Uses file locks on
session.db+ process start time matching for reliable detection
- .NET 10 SDK
- Windows (process detection uses Windows-specific APIs)
git clone https://github.com/danespinosa/AgentMonitor.git
cd AgentMonitor
dotnet rundotnet publish -c Release -o bin/publishThen run bin/publish/AgentMonitor.exe directly, create a desktop shortcut, or add a Windows Terminal profile:
{
"name": "Agent Monitor",
"commandline": "C:\\path\\to\\AgentMonitor.exe",
"icon": "🤖",
"colorScheme": "One Half Dark"
}| Key | Action |
|---|---|
↑ ↓ |
Navigate sessions |
PgUp PgDn |
Page through sessions |
Home End |
Jump to first/last |
F |
Cycle filter (Open → All → Attention → Running → Idle → Stopped) |
/ |
Enter search mode |
Enter |
Resume selected stopped session |
Esc |
Clear search / exit search mode |
Q |
Quit |
AgentMonitor/
├── AgentMonitor.Core/ # Class library (reusable core)
│ ├── Models/ # AgentSession, AgentType, SessionStatus
│ ├── Providers/ # Session discovery from file system
│ │ ├── CopilotSessionProvider.cs # Reads ~/.copilot/session-state/
│ │ └── ClaudeSessionProvider.cs # Reads ~/.claude/projects/
│ └── Services/
│ ├── SessionMonitorService.cs # Orchestrates detection + status
│ └── ProcessDetector.cs # File lock + process time matching
├── UI/
│ ├── DashboardRenderer.cs # Stateless Spectre.Console renderer
│ ├── DashboardState.cs # Cursor, filter, search state
│ └── SessionLauncher.cs # Resume sessions in new terminal
├── Program.cs # Entry point with Live display loop
└── diagnostics/ # Standalone .NET 10 file-based scripts
├── check-locks.cs # Show locked session.db files
├── list-sessions.cs # List all sessions with status
├── inspect-session.cs # Deep inspect a specific session
└── search-sessions.cs # Search sessions by text
-
File lock detection — Each running
copilot.exeholds a write lock on itssession.db. We attemptFileAccess.ReadWritewithFileShare.Read— if it throwsIOException, the file is locked by a real process. -
Process time matching (fallback) — Some sessions don't create
session.db(e.g., before any conversation starts). For these, we matchcopilot.exeprocess start times to session directory creation times within a 5-second window, and verify the session hasn't emitted asession.shutdownevent.
| CLI | Session data location | Key files |
|---|---|---|
| Copilot CLI | ~/.copilot/session-state/{uuid}/ |
workspace.yaml, events.jsonl, session.db |
| Claude CLI | ~/.claude/projects/{project}/ |
sessions-index.json, {session-id}.jsonl |
The diagnostics/ folder contains standalone .NET 10 file-based apps that reference the AgentMonitor.Core class library. Run them from the diagnostics/ directory:
cd diagnostics
# Show which sessions have active file locks
dotnet run check-locks.cs
# List all sessions with status
dotnet run list-sessions.cs
# Search sessions by path, summary, or branch
dotnet run search-sessions.cs -- jaws
# Deep inspect a specific session
dotnet run inspect-session.cs -- <session-id>- Fork the repo
- Create a feature branch
- Submit a PR — requires 1 approving review before merge
MIT