DEV Community

Cover image for Open Source Project of the Day (#117): AgentsView — Session Analytics and Cost Tracking Across 30+ AI Coding Agents, Local-First, No Account Required
WonderLab
WonderLab

Posted on

Open Source Project of the Day (#117): AgentsView — Session Analytics and Cost Tracking Across 30+ AI Coding Agents, Local-First, No Account Required

Introduction

"Gartner predicts: by 2028, AI coding costs will surpass the average developer salary as token consumption surges."

This is article #117 in the Open Source Project of the Day series. Today's project is AgentsView — a local-first analytics and session management tool for AI coding agents.

You use Claude Code for one task, Cursor for another module, Codex for automation scripts. Each tool has its own session history in its own directory in its own format. You want to know: how much did I spend on AI coding tools this month? Which agent do I use most? Which sessions are worth revisiting? There's no unified answer.

AgentsView does one thing directly: index all agent session data into a local SQLite database, then provide a unified search interface, cost analytics, and dashboard. Single binary, runs locally, no account required, data stays on your machine.

What You'll Learn

  • AgentsView's architecture: Go + SQLite + Svelte, and why it's 100× faster than re-parsing raw files
  • The 30+ supported agents and their session directory paths
  • Practical CLI commands: daily cost summary, session list, statistics
  • PostgreSQL team sync and DuckDB analytics mirror
  • S3 support for multi-machine centralized session management
  • Privacy design: DNS-rebinding protection, local binding, anonymous telemetry

Prerequisites

  • Regular user of Claude Code, Cursor, or similar AI coding tools
  • Interest in tracking AI tool token costs

Project Background

What Is AgentsView?

AgentsView is a local-first AI agent session analytics platform. The core logic: every AI coding tool writes session history to local files, in different formats, but all are files. AgentsView parses those files, builds a unified SQLite index, and provides a unified query and analytics interface.

It doesn't change how any tool works. It doesn't insert a proxy layer. It just makes already-existing data queryable.

Author

Project Stats

  • ⭐ GitHub Stars: ~4,000
  • 🍴 Forks: ~305
  • 📄 License: MIT
  • 💻 Language: Go 81.1% / TypeScript 10.7% / Svelte 5.9% / Rust 1.1%

Core Features

Multi-Agent Auto-Discovery

AgentsView automatically scans session directories for 30+ mainstream AI coding tools:

Agent Session Directory
Claude Code ~/.claude/projects/
Codex ~/.codex/sessions/
Gemini CLI ~/.gemini/
Cursor ~/.cursor/projects/
Forge ~/.forge/
Copilot CLI ~/.copilot/
Devin CLI ~/.local/share/devin/
OpenCode ~/.local/share/opencode/
Zed ~/Library/Application Support/Zed/
Aider .aider.chat.history.md (opt-in)

All directory paths are overridable via environment variables.

Full-Text Search

Built on SQLite FTS5, indexes all session content across all agents. Looking for a Claude Code session from three weeks ago that discussed an 'auth module refactoring' approach? Full-text search in AgentsView finds it immediately — no manual directory browsing, no grepping raw JSONL files.

Token and Cost Tracking

AgentsView extracts token usage and model metadata from each agent's session data, building a cost view:

# Today's cost summary
agentsview usage daily

# Today's cost with per-model breakdown
agentsview usage daily --breakdown

# Last 7 days
agentsview usage weekly

# Last 28-day statistics
agentsview stats
Enter fullscreen mode Exit fullscreen mode

Typical output:

Daily Usage — 2026-07-07
─────────────────────────────────────────
Agent        Sessions  Input Tok   Output Tok  Cost
──────────   ────────  ──────────  ──────────  ──────
Claude Code  8         1,823,441   142,891     $4.21
Codex        3         284,920     31,204      $0.87
Cursor       12        ——          ——          ——
──────────   ────────  ──────────  ──────────  ──────
Total        23        2,108,361   174,095     $5.08
Enter fullscreen mode Exit fullscreen mode

Analytics Dashboard

The Web UI (http://127.0.0.1:8080) provides:

  • Usage heatmaps: activity by day and hour
  • Tool usage statistics: which tools are called most frequently (bash, read, write...)
  • Velocity metrics: average tokens per session, task completion duration
  • Project-level breakdown: agent usage patterns by project directory

Recent Edits Feed

A practical feature: displays files recently modified by agents, grouped by project. At the end of a workday, instead of digging through git diff to review what AI changed, AgentsView lists it directly.

Live Updates

AgentsView runs as a daemon, watching for new session data via file watching, pushing live updates to the Web UI via SSE (Server-Sent Events). Active AI sessions show up in the dashboard in real time.


Quick Start

Install:

# macOS / Linux
curl -fsSL https://agentsview.io/install.sh | bash

# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://agentsview.io/install.ps1 | iex"

# macOS Homebrew
brew install --cask agentsview
Enter fullscreen mode Exit fullscreen mode

Start:

# Foreground mode (for debugging)
agentsview serve

# Background daemon (recommended)
agentsview serve --background

# Open Web UI
open http://127.0.0.1:8080
Enter fullscreen mode Exit fullscreen mode

Useful CLI commands:

# Session management
agentsview session list                        # List all sessions
agentsview session list --agent claude-code    # Claude Code sessions only
agentsview session show <session-id>           # View session details

# Cost tracking
agentsview usage daily                         # Today's cost
agentsview usage daily --breakdown             # Per-model breakdown
agentsview usage weekly                        # This week's cost
agentsview stats                               # 28-day statistics

# Search
agentsview search "auth module refactoring"    # Full-text search

# Export
agentsview session export <id> --format html   # Export as HTML
agentsview session export <id> --format gist   # Export to GitHub Gist
Enter fullscreen mode Exit fullscreen mode

Deep Dive

Why 100× Faster Than Re-Parsing Files

AI coding tools write session data as JSONL or Markdown files. Your session history accumulates over time — potentially thousands of files.

Naive approach:
Each search or analysis → re-scan all files → parse each JSONL → filter → return
Grows linearly with file count. With 50,000 sessions: unusably slow.

AgentsView approach:
First run → parse all files → write to SQLite (with FTS5 index + token summary tables)
Subsequent queries → direct SQL queries on SQLite
SQLite FTS5 full-text search: millisecond responses regardless of file count
Enter fullscreen mode Exit fullscreen mode

Incremental sync: after new sessions are written, the daemon watches for file changes and processes only new content — no full re-index.

Three-Layer Storage Architecture

SQLite (primary storage, local, writable)
    ↓ (optional sync)
PostgreSQL (team sharing, read-only service)
    ↓ (optional sync)
DuckDB (analytics mirror, read-only or via Quack protocol)
Enter fullscreen mode Exit fullscreen mode

PostgreSQL team sync:

# Configure PostgreSQL backend
AGENTSVIEW_POSTGRES_URL=postgresql://user:pass@host/db

# Push to team database
agentsview sync postgres push

# Pull from team database
agentsview sync postgres pull
Enter fullscreen mode Exit fullscreen mode

Team members each run AgentsView locally, periodically pushing to a shared PostgreSQL database — creating team-level AI usage dashboards: who uses which tools, organization-wide token consumption trends, high-value session archiving.

DuckDB mirror:

DuckDB's Quack protocol supports remote reads, enabling direct SQL analysis queries against AgentsView data without exporting to files.

S3 Support

Claude Code and Codex session sources can be configured with s3:// paths:

CLAUDE_CODE_DIR=s3://my-bucket/claude-sessions
Enter fullscreen mode Exit fullscreen mode

For developers working across multiple machines, session data can be centralized in S3 and AgentsView builds a local index after fetching.

Technology Choices

Go backend: Single binary distribution, cross-platform, no runtime dependencies, high performance for file parsing and SQLite I/O-intensive operations.

Svelte 5 frontend: Lightweight framework, suitable for embedding in single binary distribution (frontend assets compiled into the Go binary).

CGO dependency: SQLite bindings require CGO, which means pre-compiled binary distribution rather than go install.

Tauri desktop: Wraps the same Web UI to provide native macOS and Windows desktop app experience, backed by the same local HTTP service.

Privacy Design

Data boundaries:
  - Web service binds to 127.0.0.1 (not 0.0.0.0)
  - DNS-rebinding protection: validates Host header, blocks cross-origin requests to local data
  - For external access (reverse proxy / SSH tunnel): use --public-url to explicitly allow

Telemetry:
  - Only anonymous daemon_active ping (version, OS, architecture)
  - No session content, file paths, or user identity
  - Disable with: AGENTSVIEW_TELEMETRY_ENABLED=0
Enter fullscreen mode Exit fullscreen mode

Aider is opt-in (requires explicit AIDER_DIR config) because Aider history files live in repository root directories — automatic scanning would trigger macOS privacy prompts.


Use Cases

Individual developers:

  • See monthly AI tool spending and which tool gives the best cost-to-value ratio
  • Retrieve an approach from a session three weeks ago
  • Understand personal AI usage patterns

Team Tech Leads:

  • Build team-level AI usage dashboards via PostgreSQL sync
  • Track organization-wide AI tool cost trends
  • Identify high-value sessions for team knowledge archiving

Heavy AI tool users:

  • Switch between 30+ tools and need a unified session history entry point
  • Compare different agents' efficiency and cost on similar task types

Links and Resources


Conclusion

AgentsView addresses a problem that becomes more real as AI coding tools proliferate: you're using multiple tools, each managing its own data, leaving you with no visibility into the overall picture of usage and cost.

Gartner's 2026 projection — AI coding costs surpassing developer salaries by 2028 — isn't hyperbole. The median Claude Code user already spends $6 per day. A 30-person team at $10 per person per day is $1M per year. At that scale, the gap between 'no visibility into spending' and 'data-informed decisions' is real.

AgentsView's design choices — local-first, single binary, no account required, data stays on the machine — reduce adoption friction and privacy concerns simultaneously. For developers who use AI coding tools heavily every day, installing and trying it is low-cost and likely to surface useful insights.


Explore PrimeSkills — A marketplace for handpicked AI Agents and skills. Each is validated in real enterprise workflows, stripping away hype and keeping only what truly works.

Welcome to my Homepage for more useful insights and interesting products.

Top comments (0)