gitwtfhub

wtf is tokenscope?

avivavi/tokenscope — explained in plain English

Analysis updated 2026-07-25

5TypeScriptAudience · developerComplexity · 2/5Setup · easy

TL;DR

TokenScope reads Claude Code session logs from your disk and shows where your AI token budget is being wasted. It gives each project a context score, flags costly patterns like repeated file reads, and suggests fixes you can apply immediately.

Mindmap

mindmap
  root((repo))
    What it does
      Reads Claude Code logs
      Scores token waste
      Generates CODEMAP.md
    Key metrics
      Context Score 0-100
      Cache efficiency
      Error rate and loops
    Recommendations
      Flags repeated reads
      Spots unused MCP servers
      Suggests config fixes
    Customization
      Per-project config file
      Suppress irrelevant advice
    Tech stack
      Node.js 18 plus
      TypeScript
      Zero dependencies
      npx runner
    Use cases
      Optimize AI spend
      Audit coding sessions
      Improve agent efficiency

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Find which projects waste the most tokens in Claude Code sessions.

REASON 2

Get a Context Score for each project showing cache, errors, and repeated reads.

REASON 3

Generate a CODEMAP.md file so your AI agent can navigate code without opening full files.

REASON 4

Spot unused MCP servers and error loops that quietly burn through your token budget.

What's in the stack?

TypeScriptNode.jsnpx

How it stacks up

avivavi/tokenscopeagentigris/agentfundalange/tinyclaude
Stars555
LanguageTypeScriptTypeScriptTypeScript
Setup difficultyeasyhardmoderate
Complexity2/55/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 5min

Requires Node 18 or higher but has no other dependencies, run instantly with npx.

The license for this repository is not specified in the available documentation.

Wtf does this do

TokenScope is a tool for people using Claude Code who want to understand where their token budget actually goes. Claude Code is an AI coding assistant, and every time you interact with it, the conversation consumes tokens, which cost money. Claude Code already saves records of these sessions to your disk as JSON files. TokenScope reads those files and gives you a clear picture of what happened, rather than trying to predict what a task might cost in advance. The tool runs locally on your machine with no dependencies, requiring only Node version 18 or higher. You can run it without installing anything by using the npx command. It gives you an overview of all your projects, flags the biggest sources of wasted tokens, and can break down individual sessions for a specific project. It also generates a file called CODEMAP.md, which is a lightweight map of your repository that an AI agent can read instead of opening entire files. A central feature is the Context Score, a zero to one hundred grade for each project based on five measured signals. These include cache efficiency, error rate, repeated file reads, and other forms of waste. Importantly, spending a lot of tokens does not guarantee a low score. The grade only drops for actual waste, not for spending that serves your work. Each component of the score also shows an estimated dollar impact, so you can see which problems are costing you the most real money. TokenScope also provides specific, evidence-backed recommendations. For example, if it notices you reading the same file three or more times in a session, it flags that as a repeated read. If a single file read consumes over fifteen thousand tokens, it flags that too. It identifies error loops where failed tool calls pile up, and it can spot configured MCP servers that you never actually use. Each finding comes with your own numbers as proof, along with suggested fixes you can paste directly into your configuration files. You can also teach TokenScope about your specific workflow by placing a small configuration file in your project. If your work involves verification steps that look expensive but are intentional, you can tell the tool to suppress certain advice. This keeps the recommendations relevant to how you actually work.

Yoink these prompts

Prompt 1
Run TokenScope on my Claude Code session logs and show me which projects have the lowest Context Scores so I can fix the biggest waste first.
Prompt 2
Analyze my Claude Code sessions for repeated file reads and tell me which files I should add to CODEMAP.md so the AI stops re-reading them.
Prompt 3
Show me the dollar impact of error loops and unused MCP servers across my Claude Code projects, then give me config changes to paste in.
Prompt 4
Set up a TokenScope config file for my project that suppresses repeated-read warnings for my intentional verification steps.
Prompt 5
Generate a CODEMAP.md for my repository and explain how it helps reduce token consumption in future Claude Code sessions.

Frequently asked questions

wtf is tokenscope?

TokenScope reads Claude Code session logs from your disk and shows where your AI token budget is being wasted. It gives each project a context score, flags costly patterns like repeated file reads, and suggests fixes you can apply immediately.

What language is tokenscope written in?

Mainly TypeScript. The stack also includes TypeScript, Node.js, npx.

What license does tokenscope use?

The license for this repository is not specified in the available documentation.

How hard is tokenscope to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is tokenscope for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.