agentleFS
nateherkainateherkai/token-dashboard/CLAUDE.md

token-dashboard

CLAUDE.md718 starsChanged 7 months agoMITView on GitHub

Guidance for Claude Code when working in this repository. Token Dashboard — a local dashboard for tracking Claude Code token usage, costs, and session history. Reads the JSONL transcripts Claude Code writes to ~/.claude/projects/ and turns them into per-prompt cost analytics, tool/file heatmaps, subagent attribution, cache analytics, project comparisons, and a rule-based tips engine. Inspired by phuryn/claude-usage but diverges in UI (vanilla JS + ECharts, dark theme, hash router, SSE refresh) and scope (expensive-prompt drill-down, skills view, tips engine, streaming-snapshot…

  • Installs packages

The file

We split this CLAUDE.md into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Fully local: No telemetry, no remote calls for user data.

    line 27
  2. Distinctive:

    Small files with clear responsibilities: If a file grows past ~400 lines or accretes three distinct concerns, split it.

    line 30
  3. Very specific:

    Streaming-snapshot dedup: When adding scanner logic that joins the messages table, remember (session_id, message_id) is the dedup key, not …

    line 31

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md

Guidance for Claude Code when working in this repository.

Project overview

Token Dashboard — a local dashboard for tracking Claude Code token usage, costs, and session history. Reads the JSONL transcripts Claude Code writes to ~/.claude/projects/ and turns them into per-prompt cost analytics, tool/file heatmaps, subagent attribution, cache analytics, project comparisons, and a rule-based tips engine.

Inspired by phuryn/claude-usage but diverges in UI (vanilla JS + ECharts, dark theme, hash router, SSE refresh) and scope (expensive-prompt drill-down, skills view, tips engine, streaming-snapshot dedup). See docs/inspiration.md for the original's feature set and known limitations.

Status

Working codebase. 68 Python unit tests (python3 -m unittest discover tests). Seven UI tabs wired up (Overview, Prompts, Sessions, Projects, Skills, Tips, Settings). Runs on macOS, Windows, and Linux.

Architecture

  • cli.py → token_dashboard/scanner.py → ~/.claude/token-dashboard.db (SQLite)
  • token_dashboard/server.py exposes JSON APIs (/api/*) + SSE stream (/api/stream) + static frontend (web/)
  • web/ is vanilla JS, no build step — hash router + ECharts

Data source

Claude Code writes one JSONL file per session to ~/.claude/projects/<project-slug>/<session-id>.jsonl. Each line is a message record; usage fields live at message.usage and model identifier at message.model. The scanner is incremental — it tracks each file's mtime and byte offset in the files table and only reads new bytes on subsequent scans.

Conventions

  • Fully local. No telemetry, no remote calls for user data. Tests run offline.
  • Stdlib only. No pip install. If a new feature needs a third-party library, argue for it first — we're willing to pay ergonomics cost to keep install friction at zero.
  • SQLite parameter binding always. Any f-string in a SQL statement must interpolate only internal, caller-controlled values (column names, placeholder lists). User-reachable values go through ?.
  • Small files with clear responsibilities. If a file grows past ~400 lines or accretes three distinct concerns, split it.
  • Streaming-snapshot dedup. When adding scanner logic that joins the messages table, remember (session_id, message_id) is the dedup key, not uuid. See scanner._evict_prior_snapshots and the migration note in db._migrate_add_message_id.

Customizing

Env vars: PORT (default 8080), HOST (default 127.0.0.1), CLAUDE_PROJECTS_DIR, TOKEN_DASHBOARD_DB. Pricing lives in pricing.json. See README.md § Environment variables for details.

Known limitations

See docs/KNOWN_LIMITATIONS.md. Current summary: Skills tokens_per_call is populated only for skills installed under the three scanned roots (~/.claude/skills/, ~/.claude/scheduled-tasks/, ~/.claude/plugins/); project-local skills and subagent-dispatched skills show invocation counts but blank token counts.

Verifying changes

python3 -m unittest discover tests        # all tests
python3 cli.py dashboard --no-open        # start the server
curl http://127.0.0.1:8080/api/overview   # sanity-check an endpoint

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.