Metadata-Version: 2.4
Name: claude-code-insights
Version: 0.1.0
Summary: Local session-history browser, token/cost analytics, and productivity insights for Claude Code.
Project-URL: Homepage, https://github.com/pragnesh12/claude-code-insights
Project-URL: Repository, https://github.com/pragnesh12/claude-code-insights
Project-URL: Issues, https://github.com/pragnesh12/claude-code-insights/issues
Author-email: Pragnesh Rana <pragnesh.rana@nyusoft.com>
License: MIT
License-File: LICENSE
Keywords: analytics,claude,claude-code,cli,productivity,tokens
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Provides-Extra: tokens
Requires-Dist: tiktoken>=0.5; extra == 'tokens'
Description-Content-Type: text/markdown

<div align="center">

# ◆ claude-code-insights

**Turn your Claude Code session history into a browsable dashboard — with token, cost, and productivity analytics. 100% local.**

[![PyPI](https://img.shields.io/pypi/v/claude-code-insights?color=d97757&label=pypi)](https://pypi.org/project/claude-code-insights/)
[![Python](https://img.shields.io/badge/python-3.9%2B-6E97D6)](https://pypi.org/project/claude-code-insights/)
[![License: MIT](https://img.shields.io/badge/license-MIT-5FB389)](LICENSE)
[![Runs 100% local](https://img.shields.io/badge/runs-100%25%20local-d97757)](#privacy)

</div>

---

`claude-code-insights` reads the `.jsonl` transcripts Claude Code already keeps under
`~/.claude/projects/`, builds a single self-contained `claude_insights.html` you open in any
browser, and prints a quick summary to your terminal. No server, no upload, no account.

```text
Claude Insights — 128 sessions · 14 projects
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Est. tokens:     678K input · 388K output
Est. cost:       ~$13.08  (Opus pricing)
Top tool:        Bash (621 calls)
Busiest day:     2026-06-23 (52 prompts)
Longest session: Refactor auth flow (4h 12m)
```

<!--
  📸 Add a screenshot to make this shine: save a PNG of the dashboard to docs/screenshot.png,
  then uncomment the block below.

<div align="center">
  <img src="docs/screenshot.png" alt="claude-code-insights dashboard" width="820">
</div>
-->

## Three views

| View | What you get |
|------|--------------|
| 🗂️ **History** | Search and filter every session, read full conversations, and export one or all of them to Markdown, CSV, JSON, HTML, or plain text. |
| 📊 **Analytics** | Estimated token usage and cost, cost-by-project and tool-usage charts, input/output token ratio, your most expensive sessions, and automatic insights (cost spikes, tool-heavy or very long sessions, streaks). |
| 🔥 **Productivity** | Prompts-per-day trend, an hour-by-day activity heatmap, current/longest streaks, busiest projects, prompt-length distribution, session durations, and clustering of repeated prompt patterns. |

## Install

```bash
pipx install claude-code-insights        # recommended
# or
uvx claude-code-insights                 # run without installing
# or
pip install claude-code-insights         # into the current environment
```

For more accurate token counts (uses `tiktoken`):

```bash
pipx install "claude-code-insights[tokens]"
```

## Usage

```bash
claude-insights              # write claude_insights.html + print a summary
claude-insights --open       # also open the report in your browser
claude-insights --cli-only   # terminal summary only, skip the HTML
claude-insights --dir PATH   # use a custom projects directory
claude-insights --out FILE   # custom HTML output filename
claude-insights --version
```

You can also run it as a module: `python3 -m claude_insights --open`.

## Privacy

Everything runs on your machine — nothing is uploaded anywhere. The generated HTML embeds your
prompts and responses, which may contain file paths, code, and secrets. **Review the file before
sharing it with anyone.**

## A note on cost figures

Cost numbers are **estimates**, not real API charges. They multiply estimated token counts by
Claude **Opus** pricing ($5 / $25 per 1M input / output tokens) — your actual model and rates may
differ. Treat them as a relative signal, not a bill.

## Development

```bash
git clone https://github.com/pragnesh12/claude-code-insights
cd claude-code-insights
pip install -e ".[tokens]"
claude-insights --help
```

## License

[MIT](LICENSE) · An unofficial tool — not affiliated with or endorsed by Anthropic. "Claude" and
"Claude Code" are trademarks of Anthropic.
