Skip to content

Metrics: cross-workspace analytics with scope toggle #33

@23min

Description

@23min

Summary

Add a scope toggle to the Metrics Dashboard: This Workspace | All Workspaces. Default is "This Workspace" (current behaviour). "All Workspaces" scans all workspaceStorage hash directories to aggregate metrics across every project.

Motivation

Users accumulate Copilot sessions across many projects and workspaces. Currently the dashboard only shows sessions for the current workspace. Cross-workspace analytics would surface:

  • Token usage — Total tokens consumed across all projects, broken down by model
  • Model usage — Which models are used most across all sessions
  • Tool call inventory — Which tools are used most, including MCP tools
  • Agent/mode usage — Which custom agents get the most use
  • Subagent activity — How often subagents are spawned and what they do

UI Design

Scope toggle at the top of the existing Metrics Dashboard, alongside the provider filter:

[This Workspace · All Workspaces]    All | Copilot | Claude | Codex
  • Both controls work independently
  • "All Workspaces" scans all hash dirs under workspaceStorage (Copilot), all project dirs under ~/.claude/projects/ (Claude), etc.
  • Session deduplication by session ID is required since the same session can appear under multiple workspace hashes (see Copilot: mitigate workspaceStorage hash instability in containers #26)

Focus

The analytics should focus on AI assistant behaviour (token use, model distribution, tool calls, agent usage) rather than user behaviour (session duration, activity heatmaps, etc.).

Implementation Notes

  • CopilotSessionProvider.discoverSessions() currently filters by workspace name. Need an "all workspaces" mode that skips the filter.
  • ClaudeSessionProvider could scan all dirs under ~/.claude/projects/ instead of just the current workspace path.
  • May want lazy/incremental loading for large session counts (71 workspace hashes = potentially hundreds of sessions).

Files

  • src/parsers/copilotProvider.ts — Needs "all workspaces" discovery mode
  • src/parsers/claudeProvider.ts — Needs cross-project scanning
  • src/views/metricsPanel.ts — Scope toggle state and message handling
  • webview/metrics.ts — UI for scope toggle
  • src/analyzers/metricsCollector.ts — May need optimisation for larger datasets

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions