SuperAPI AI Directory

reread

ReRead is a locally running token usage and prompt cache analysis tool that supports Claude Code, Codex, and Antigravity. It reads the session files these coding agents save locally, analyzing the proportion of context re-read on each reply, when and why cache was lost, and which sessions cost the most. The tool generates an HTML report and opens it in the browser; no data is uploaded, and there are no external dependencies.

Open website

About this tool

ReRead is a token usage and prompt cache analysis tool for Claude Code, Codex, and Antigravity. It aims to answer one core question: how much of your coding agent usage goes toward re-reading context rather than doing new work, and why.

Key capabilities

ReRead reads the session files Claude Code, Codex, and Antigravity save locally, analyzes the token usage of each reply, and generates a detailed HTML report. The report includes the following:

  • Key finding cards: arranged from highest to lowest cost, each card provides a number, what it means, and a suggested action, such as how much usage long contexts consume, how concentrated usage is in a few sessions, the cost and causes of cache loss, how large context grows before each compaction, how much usage thinking consumes, and so on.
  • Usage: distinguishes re-reads from cache, history rewrites, and other parts.
  • Daily statistics: the cost per day and the proportion of it that is re-reading.
  • Statistics by context size: the proportion of usage taken by replies with large contexts (over 150k).
  • Cache loss causes: including interruptions longer than the cache lifetime (5 minutes or 1 hour), switching models mid-session, and changes near the start of the context (tools, MCP servers, settings).
  • Statistics by project, model, and tool: when multiple tools are used, they can be viewed separately.
  • Statistics by effort level: the cost of each tool's different effort levels, and the proportion of output taken by thinking.
  • Session list: lists the 10 most expensive sessions, supports sorting and searching, and shows their git branch. Opening a single session shows how the context grows reply by reply, marking each rebuild and compaction.
  • Sharing features: copy a line of text, or save an image card without project names; a toggle can hide names throughout the report for easy screenshots.
  • Export: export the numbers as JSON, or export sessions as CSV.

The report is a standalone HTML file written to a new folder in the temp directory that only you can read (or to a file specified via --html), supports offline use and light/dark modes.

How to use

ReRead requires Node.js 20 or higher (version 22.15 or higher can also read Codex's compacted sessions; on olderOn older versions, ReRead would show how many were skipped).

Basic usage: running ReRead reads all tools on your machine that have sessions; you can select a single tool with --tool claude, --tool codex, or --tool antigravity.

Status bar cache countdown: reread statusline (Claude Code only) outputs a line of information for the Claude Code status bar, including context size, the remaining time the cache stays hot, and the session's re-read ratio. When the cache is cold, it shows the cost of rewriting the history on the next reply, so you can decide whether to compact first or start over. Add it to ~/.claude/settings.json to use it; see docs/statusline.md for more information.

Editor extension: the ReRead extension shows the same countdown in the editor status bar, for the most recent Claude Code session in the workspace, regardless of whether Claude Code runs in the terminal or the editor. Clicking it opens that workspace's report in an editor tab. It can be installed from the VS Code Marketplace or Open VSX (for Cursor, Antigravity, and other editors).

In SSH or CI environments, the report is written but not opened automatically; the path is printed instead. The CLAUDE_CONFIG_DIR and CODEX_HOME environment variables are supported, and NO_COLOR disables colors. Unknown options raise an error, so typos won't silently run with default values.

Privacy by design

ReRead only reads the token count, model, time, ID, folder name, and git branch of each reply in ~/.claude/projects//*.jsonl, ~/.codex/sessions//rollout-.jsonl, and Antigravity's ~/.gemini/antigravity-cli/brain//.system_generated/logs/transcript.jsonl. It never retains or prints what you or the agent write, makes no network requests, and has no dependencies. Reports contain no external scripts, fonts, or images, and their security policy allows only their own scripts to run. For detailsSee SECURITY.md.

Each type of token is weighted by the API price of the model that read it (input, cache write, cache read, output), so the ratios match what the same tokens would cost on the API. Subscription plans measure usage in their own way and do not disclose it, so percentages should be treated as a reference, not as the actual metering of your plan.

A reply is counted only once, in the session it belongs to, even if a resumed session duplicates it; replies from subagents are counted in the session that launched them. "Rewriting history" is estimated from token counts: when a reply's cache reads drop below half the context of the previous reply while the context has not shrunk, it is considered a rewrite.

Thinking is the output portion the model uses for reasoning and is billed as output: Claude Code records it as thinking_tokens, Codex records it as reasoning_output_tokens, along with the effort level of each reply. ReRead shows its share of output and usage, and --by effort breaks down cost by tool and effort level. Antigravity's records do not contain this information, so its replies are not counted as thinking.

Use cases and limitations

ReRead is for developers who want to understand the token consumption breakdown of coding agents, optimize cache usage, and reduce the cost of long sessions. It can be used alongside tools such as ccusage: ccusage reports how many tokens were used and the cost, while ReRead explains why.

Limitations include: requires Node.js 20+; supports only Claude Code, Codex, and Antigravity (the retired Gemini CLI is not supported); Antigravity does not record model and thinking information, so its replies are priced according to the model in settings and are not counted as thinking; for models without price data (such as DeepSeek or Qwen run through Claude Code), ReRead counts them but does not include them in cost and ratios, and lists these models in the summary and report. Each tool's session format is undocumented and may change; if reading is incorrect, please file an issue.

ReRead is an independent project, not affiliated with Anthropic, OpenAI, or Google, and is released under the MIT license.