The Problem
Developers who hop between AI‑coding assistants (Cursor, Windsurf, Claude Code, VS Code Copilot, etc.) end up with fragmented session logs, no unified cost view, and no way to compare tool effectiveness. The result is hidden token spend and scattered knowledge that cannot be audited or shared.
What This Does
agentlytics scans the local data directories used by each supported editor, aggregates session metadata, and serves a single dashboard. The core CLI lives in index.js (Node entry) and mod.ts (Deno entry). The UI is a React/Vite app under ui/; its root component ui/src/App.jsx pulls data from the back‑end via the thin wrapper in ui/src/lib/api.js. Constants such as the list of editors and UI theme live in ui/src/lib/constants.js and ui/src/lib/theme.jsx, both of which are imported by many other modules (21 and 16 inbound imports respectively).
How It Is Wired
Execution starts at one of the documented entry points:
- Node –
index.js(run vianpx agentlytics). It loads the editor adapters fromeditors/index.js, which re‑exports the per‑editor modules (editors/cursor.js,editors/windsurf.js, etc.). Each adapter reads its editor’s local storage (viafscalls inside the adapter files) and returns a normalized session list. The aggregate is written to an on‑disk cache (cache.js) and, unless--collectis used, the process spawns the HTTP server defined inserver.js.server.jscreates an Express app, registers the API routes fromui/src/lib/api.js, and serves the static UI fromui/index.html.
- Deno –
mod.ts. It imports the same editor adapters (they are pure JavaScript) and runs a sandboxed scan, printing a summary or JSON. The Deno taskdeno task startlaunches the full dashboard by executing the same server code with full permissions.
- UI –
ui/src/main.jsxboots the Vite dev server (ui/vite.config.js). On load,ui/src/lib/api.jsissues HTTP calls to the Express back‑end (/api/sessions,/api/summary). The most‑connected UI modules (ui/src/components/PageHeader.jsx,ChatSidebar.jsx,ShareModal.jsx) render the data. Becauseui/src/lib/api.jsis imported by 21 other modules, any change there has the widest blast radius.
The import graph shows no circular dependencies. The hub modules (api.js, constants.js, theme.jsx) have zero outgoing imports, keeping them stable. The heaviest outbound fan‑in is ui/src/App.jsx (imports 21 modules), indicating it orchestrates most UI state.
How To Use It
# Clone the repo
git clone https://github.com/moses-y/agentlytics
cd agentlytics
# Install Node dependencies (root and UI)
npm ci # installs server side deps
cd ui && npm ci # installs UI deps
# Run the CLI (Node version)
npx agentlytics # scans editors, starts dashboard at http://localhost:4637
# Or collect cache only
npx agentlytics --collect
# Run the UI in dev mode (optional)
cd ui && npm run dev # Vite serves UI on localhost:5173, proxying to the back‑end
For Deno users (no install required):
deno run --allow-read --allow-env https://raw.githubusercontent.com/f/agentlytics/master/mod.ts
# JSON output
deno run --allow-read --allow-env https://raw.githubusercontent.com/f/agentlytics/master/mod.ts --json
No additional configuration files or environment variables are referenced in the source; the tools read editor data from their default locations.
Real‑World Use
A development team can add npx agentlytics to their CI pre‑commit hook to generate a daily cost report. The script writes cache.js, which the UI then visualises, allowing the team to spot spikes (e.g., a new model rollout) and enforce token budgets across editors.
Code Health & Issues
- HIGH – No LICENSE – repository root lacks a licence file; default is “all rights reserved”.
- HIGH – No test suite – 66 source files, zero test files; regressions cannot be automatically detected.
- HIGH – No CI pipeline – no
.github/workflowsor other CI config; builds are never gate‑checked. - MEDIUM – No Dependabot – two
package*.jsonmanifests present but no automated update bot. - LOW – Missing repo conventions – no
.editorconfig,.gitattributes, or formatter config.
These findings are from deterministic static analysis; no additional issues were inferred.
The Bottom Line
agentlytics delivers a functional local analytics pipeline for a wide range of AI coding agents, with a clear separation between data collection (editor adapters), caching (cache.js), and a React dashboard. The codebase is usable but lacks essential production safeguards: licensing, tests, and CI. It is suitable for individual power users or teams willing to add testing and automation before relying on it in production.