Skip to main content

Cross-tool usage analytics for Claude Code and Codex CLI

Project description

ai-cli-insights

Cross-tool usage analytics for Claude Code and Codex CLI. Collects session data from both tools and generates rich HTML insight reports with narratives, trend charts, friction analysis, and actionable recommendations.

Features

  • Unified data collection from Claude Code (~/.claude/) and Codex CLI (~/.codex/)
  • Three report modes: cross-tool comparison, Claude-only, Codex-only
  • Optional deep analysis via external LLM CLI (Codex / Claude / Gemini)
  • Period-over-period comparison, trend sparklines, quality scoring
  • Friction pattern analysis with evidence-based recommendations
  • Prompt library with copy-to-clipboard templates
  • Zero third-party dependencies — pure Python standard library

Installation

pip install ai-cli-insights

Quick Start

# Generate a cross-tool report for the last 30 days
ai-cli-insights generate --days 30 --tool all

# Force a specific LLM analyzer
ai-cli-insights generate --days 30 --tool all --llm-analyzer claude

# Claude-only report
ai-cli-insights generate --tool claude

# Codex-only report
ai-cli-insights generate --tool codex

# Short form (generate is the default command)
ai-cli-insights --days 7 --tool claude

The HTML report is saved to the output directory and can be opened in any browser.

By default, generate runs with --days 30 --tool all --llm-analyzer auto. Deep LLM analysis order is codex -> claude -> gemini. When LLM analysis succeeds, core narrative/recommendation sections are replaced by live model output.

Configuration

# Create a config template
ai-cli-insights init

This writes a config.json to your config directory:

  • macOS: ~/Library/Application Support/ai-cli-insights/config.json
  • Linux: ~/.config/ai-cli-insights/config.json

Edit it to customize:

  • domain_patterns — keyword patterns to classify sessions into work domains
  • project_patterns — patterns to identify which project a session belongs to
  • template_modes — report titles and slugs

Without a config file, reports still work — domains and projects will just show raw paths.

Claude Code Skill

# Install a Claude Code skill for easy /multi-insights access
ai-cli-insights install-skill

# Install a Codex CLI skill
ai-cli-insights install-codex-skill

This writes:

  • Claude Code skill: ~/.claude/skills/multi-insights/SKILL.md
  • Codex CLI skill: ~/.codex/skills/multi-insights/SKILL.md

CLI Reference

ai-cli-insights [command] [options]

Commands:
  generate        Generate an HTML insights report (default)
  init            Write a config template to the config directory
  install-skill   Install Claude Code skill file
  install-codex-skill  Install Codex CLI skill file

Generate options:
  --days N        Analyze the last N days (default: 30)
  --tool MODE     all | claude | codex (default: all)
  --analyst WHO   codex | claude — label the analyzing model (default: codex)
  --output-dir    Override the output directory
  --llm-analyzer  auto | codex | claude | gemini | none (default: auto)
  --llm-model     Optional model name passed to selected LLM CLI
  --llm-timeout-sec  Timeout per provider call (default: 120)

python -m ai_cli_insights also works.

Data Sources

Tool Source What it provides
Claude Code ~/.claude/usage-data/session-meta/*.json Session metadata, tool counts, tokens
Claude Code ~/.claude/usage-data/facets/*.json Outcomes, friction, goals
Codex CLI ~/.codex/state_5.sqlite Thread metadata, tokens
Codex CLI ~/.codex/sessions/*.jsonl Event details, timestamps, tools
Codex CLI ~/.codex/history.jsonl User message counts

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_cli_insights-0.1.8.tar.gz (54.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_cli_insights-0.1.8-py3-none-any.whl (66.5 kB view details)

Uploaded Python 3

File details

Details for the file ai_cli_insights-0.1.8.tar.gz.

File metadata

  • Download URL: ai_cli_insights-0.1.8.tar.gz
  • Upload date:
  • Size: 54.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ai_cli_insights-0.1.8.tar.gz
Algorithm Hash digest
SHA256 2d05953ea4d1cde4bf6016fe7b3ea5ae585a32985dca5caa68c9ca70f4794b97
MD5 5121da2313eee171e4953b9ca6458907
BLAKE2b-256 e858793a6110691cff1820be6143a47246848da4f28e296e55342e05273ae66c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_cli_insights-0.1.8.tar.gz:

Publisher: publish-pypi.yml on baoluchuling/ai-cli-insights

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ai_cli_insights-0.1.8-py3-none-any.whl.

File metadata

File hashes

Hashes for ai_cli_insights-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 14e7f63a42f254b016a3db35f4297f7868d4d50e28c6496987dbc25bab38c738
MD5 f324f7b9ce256fe63b309a95623140a4
BLAKE2b-256 2b51ca481a3f6555a7bb450ac1317b80039dd719d25c4efb0acb36c30f900b0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_cli_insights-0.1.8-py3-none-any.whl:

Publisher: publish-pypi.yml on baoluchuling/ai-cli-insights

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page