npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rajat-rastogi/copilot-insights

v0.3.0

Published

Local, read-only intelligence dashboard for GitHub Copilot sessions: API-equivalent cost, budget tracking, code impact, workflow quality, and session trajectories.

Readme

Copilot Insights

Local, read-only cost, budget, code-impact, performance, and workflow intelligence for the GitHub Copilot CLI.

Node.js 18+ Zero dependencies MIT License

Copilot Insights turns the local events.jsonl transcripts written by the GitHub Copilot CLI into one private, read-only view of what your sessions actually delivered. It values token usage at public API rates, reconstructs code edits, finds churn and correction loops, and measures workflow quality on normalized units of work, not raw token volume.

No proxy, SDK wrapper, database, or vendor account connection is required. The server binds to localhost and never writes to the Copilot state directory.

Install and run

Prerequisite: Node.js 22 or newer (18+ works; 22+ unlocks full cost, budget, and coaching accuracy).

Run it with a single command, no install required:

npx @rajat-rastogi/copilot-insights@latest

Then open http://127.0.0.1:4477.

Prefer a permanent install?

npm install -g @rajat-rastogi/copilot-insights
copilot-insights

Everything runs on your own machine: it reads your local Copilot CLI history (~/.copilot), binds to localhost only, never uploads anything, and never writes to the Copilot state directory. If you have not used the Copilot CLI yet, the dashboard will simply be empty.

Why this exists

Usage pages answer "how many tokens did I use?" They do not answer:

  • What code did those tokens buy?
  • Which files keep getting reworked across sessions?
  • How often do I correct the agent, abandon a run, or wait for its first edit?
  • What did my Copilot CLI usage look like valued at API-equivalent prices?

Copilot Insights answers those questions from the data already stored on your machine.

Highlights

Code impact, not token volume

  • Reconstructs daily additions and removals from edit and create tool payloads (and legacy patch/write formats).
  • Ranks the files and directories the agent touches most.
  • Builds an AI-written-code risk map from repeat sessions, edit count, churn, and changed lines.
  • Detects files edited repeatedly within a session or across many sessions.

Cost intelligence and budget

  • Prices each recognized model with separate input, output, and cache rates.
  • Shows API-equivalent cost per session, per edit, and per 100 changed lines.
  • Tracks spend against your per-user budget (a single amount plus a monthly/yearly period, in API-equivalent USD), calendar-to-date, with a burn-rate projection for the period end.
  • Surfaces AIU (AI Units) consumed as a tracking metric.
  • Reports pricing coverage and leaves unknown models visibly unpriced instead of silently guessing.

Workflow intelligence

  • Same-file rework loops.
  • Sessions that end without a final assistant response.
  • Corrective follow-ups such as "wrong," "undo," or "you missed…".
  • Median time from the first user request to the first parseable edit.
  • Tool error rate and median tool latency.

Coaching

A dedicated panel of ranked, quantified, evidence-linked recommendations for having more impact and spending fewer tokens for the same result. Opportunities are detected from your own sessions against best-practice thresholds and your own-history outliers, with a trend arrow vs the previous period:

  • Efficiency — token/$/AIU reclaimable from correction cycles, abandoned runs, in-session rework, over-long (context-bloated) sessions, high reasoning effort on mechanical tasks, premium models on small edits, and verbose generation.
  • Impact — reconnaissance overhead (slow first edit) and files that keep getting re-edited across sessions.

Each card quantifies the estimated opportunity, gives a concrete suggestion, and links to the exact sessions/files behind it. Estimates are directional heuristics (they may overlap), computed entirely from your local data.

Session trajectories and Wrapped

  • Complete user, assistant, reasoning, tool, result, duration, and error timeline for every session.
  • Reconstructed sub-agent spawn trees and parent/child breadcrumbs.
  • Shareable Wrapped slides with tokens, code output, and API-equivalent value.

Supported source

| Source | Auto-discovered location | Notes | |---|---|---| | GitHub Copilot CLI | ~/.copilot/session-state/<sessionId>/events.jsonl | Override the root with COPILOT_STATE_DIR or --dir. Sessions are grouped by working directory. |

Each session directory holds a newline-delimited events.jsonl transcript (session.start, session.model_change, user.message, assistant.message, tool.execution_start, tool.execution_complete, …) plus a workspace.yaml whose name is used as the session label.

Run from source

Cloned the repo instead? There are no runtime dependencies and no build step:

npm start

Open http://127.0.0.1:4477.

The default scan covers the last 30 days. Parsed transcripts are cached by file modification time, so refreshes only re-read changed files.

Try it with sample data

No Copilot CLI history yet? Run the bundled, synthetic dataset:

npm run sample

The sample writes a Copilot-layout state directory to ./sample-data with sub-agents, create and edit operations, cross-session churn, a correction, an abandoned trajectory, and a failed tool call. It does not read your local history.

Command-line options

node server.mjs [options]

  --days <n>                activity window; default: 30
  --all                     include full discovered history
  --dir <path>              read one Copilot session-state directory only
  --pricing <path>          use a custom per-model pricing JSON file
  --port <number>           localhost port; default: 4477

Environment equivalents:

| Variable | Purpose | |---|---| | PORT | Server port | | COPILOT_STATE_DIR | Explicit Copilot session-state directory | | COPILOT_STORE_DB | Explicit session-store.db for token accounting | | COPILOT_INSIGHTS_PRICING | Custom pricing table path |

Pricing

pricing.json is an editable table in USD per million tokens. Each row contains a regular-expression model pattern and input, output, cacheRead, and optional cacheWrite rates. Patterns match the Copilot CLI's dot-notation model IDs (for example claude-opus-4.8, claude-sonnet-4.5, gpt-5.6-sol, gpt-5.3-codex).

Token accounting. The events.jsonl transcript records only output tokens per assistant turn. The full per-request accounting (input, output, cache read/write, reasoning) lives in the local Copilot session store ~/.copilot/session-store.db (assistant_usage_events, keyed by session id). When that store is present and the runtime provides Node's built-in node:sqlite (Node 22.5+), Copilot Insights reads it and prices sessions cache-aware. On older Node, or when the store is unavailable, it falls back to an output-only estimate. Either way, cost is a directional estimate, not an invoice, and a session with an unknown model stays unpriced and reduces the displayed coverage.

Budget. To track spend against a budget, open Budget setup and enter a single allocation amount plus a period (monthly or yearly) in API-equivalent USD; the other period is pro-rated automatically (÷12 or ×12). The "Cost intelligence & budget" panel then shows, for both this month and this year, calendar-to-date spend vs budget, utilization, remaining, and a linear burn-rate projection for the period end (on track / over), independent of the day-window selector. AIU consumed is shown alongside as a tracking metric. The budget is saved only in your browser (localStorage); set it to 0 to hide the cards. Because the tool reads only your local machine, the budget reflects your own usage.

How impact and workflow signals are calculated

Impact is reconstructed from edit (old_str/new_str) and create (file_text) tool payloads, plus legacy Write, MultiEdit, str_replace_editor, and apply_patch formats for portability. A create payload contains the new content but not a prior version, so its lines are counted as additions.

| Signal | Definition | |---|---| | Rework loop | Another edit to the same file in the same session | | Churn | Repeat file touches within or across sessions | | Abandoned | A non-live, user-started session ending without a final assistant response | | Correction | A later user message matching an explainable negative-correction phrase | | Time to first edit | First user message to first parseable edit operation |

These are coaching heuristics, not claims about code authorship or correctness. Open a session trajectory to inspect the source events behind a signal.

Sub-agent spawn trees are reconstructed best-effort by linking a task/agent tool call to a child session whose id appears in the call's arguments or result.

Privacy and security

  • The HTTP server listens on 127.0.0.1, not on the public network.
  • The Copilot state directory is read-only; the dashboard never modifies it.
  • Transcript content is served only to the local browser.
  • There is no telemetry, cloud database, analytics SDK, or third-party runtime dependency.

Treat your own screenshots and exported API responses as sensitive: session labels, prompts, tool arguments, results, and local file paths may contain private information.

Architecture

~/.copilot/session-state/<id>/events.jsonl      ~/.copilot/session-store.db
      │  (trajectory: messages, tools, edits)          │  (per-request token usage)
      ▼                                                 ▼
adapters.mjs        discovery + normalized session/event model + token enrichment
      │
      ▼
analytics.mjs       pricing, edit parsing, risk, scoreboard, workflow signals
      │
      ▼
server.mjs          cached read-only API + localhost static server
      │
      ▼
public/             dependency-free HTML, CSS, SVG charts, and JavaScript UI

Development

npm test
node --check server.mjs
node --check adapters.mjs
node --check analytics.mjs
node --check public/app.js

The analytics tests cover the Copilot event parser, edit/create impact, multi-file patches, cache-aware pricing, code impact, churn, corrections, rework, latency, abandonment, and explicit handling of unknown models.

License

MIT