Skip to content
DocsWhat it reads

Start

What it reads

Which agents AI Insights reads, where each keeps its history, what is kept from it, and how long agents keep their files.

On this page

Supported agents

AI Insights reads six agents, plus Claude chat history you import from its data export. “Untested” means the code exists and has tests on synthetic files, but nobody has confirmed it on that agent in daily use yet.

Supported agents
AgentHistoryTokens and costSkill install
Claude CodeReadYesPlugin
CodexReadYesPlugin
OpenCodeRead (the database needs Node 22.5 or later)YesUntested
PiReadYesUntested
CursorReadNo: its local transcripts hold no token countsUntested
Gemini CLIUntested: built from its source format, not yet tried on real historyYesNone yet, use npx
Claude chatImported from a data export with ai-insights import claude; see Import chat historyNo: the export records no model or token countsNot needed: it is not a coding agent

Run npx ai-insights@latest doctor to see which of these it found on your machine, where, how many transcripts and over which dates.

Where each agent's history lives

These are the default places AI Insights looks. The environment variables are the ones each agent itself uses to move its files.

History locations
AgentDefault locationMoved by
Claude Code~/.claude/projects and ~/.config/claude/projects, plus Claude Desktop's Code and Cowork session stores (local-agent-mode-sessions and claude-code-sessions in Claude Desktop's app data folder)CLAUDE_CONFIG_DIR (then only $CLAUDE_CONFIG_DIR/projects is read for the CLI), XDG_CONFIG_HOME
Codex~/.codex/sessions and ~/.codex/archived_sessions, including compressed .jsonl.zst rolloutsCODEX_HOME
OpenCode~/.local/share/opencode/opencode.db (and channel databases such as opencode-<channel>.db), plus the older storage/ filesOPENCODE_DB, XDG_DATA_HOME
Pi~/.pi/agent/sessions, and OMP's ~/.omp/agent/sessions, ~/.omp/profiles and ~/.local/share/omp/PI_CODING_AGENT_SESSION_DIR, PI_CODING_AGENT_DIR, PI_CONFIG_DIR, XDG_DATA_HOME
Cursor~/.cursor/projects/*/agent-transcripts (prompts and tool calls; no tokens)CURSOR_CONFIG_DIR
Gemini CLI~/.gemini/tmp/*/chatsGEMINI_CLI_HOME

Claude Desktop's app data folder is ~/Library/Application Support/Claude on macOS, %APPDATA%\Claude on Windows and ~/.config/Claude on Linux.

What is kept

From each transcript, AI Insights keeps numbers and metadata, and the prompts you typed. Everything below is stored only in your ~/.ai-insights/ folder.

What the cache keeps and drops
KeptNot kept
When each session ran, how long, and in which projectThe agent's replies
Token counts, models and estimated cost per requestTool output: file contents, command output, search results
Which tools ran, failed or were declined, with shell commands redacted and cut to 300 charactersThinking text, images and attachments
Your own prompts, secrets redacted and cut to 2,000 charactersAnything needed to resume, rewind or replay a session
Paths of files read or edited, lines changed, commits, skills, MCP servers and other feature use
The session labels your agent saved, if you ran the agent review

During the agent review, your agent can ask for an excerpt of one session. That excerpt is read from the transcript on demand, redacted and cut to about 4,000 characters, and handed to your agent. It is not stored. See What your agent sees.

How long agents keep history

AI Insights can only look back as far as your agents keep their files. doctor prints what it found for each agent on a keeps line, and the report's “Where your history lives” section shows the same with links to each agent's docs.

Retention by agent
AgentWhat it does by defaultSetting
Claude CodeDeletes a transcript 30 days after it last changed, the next time it starts. Sessions started or last continued in Claude Desktop or Cowork are kept at any age (since v2.1.248).cleanupPeriodDays in ~/.claude/settings.json
Gemini CLIDeletes a project's chats 30 days after their last update, the next time it starts in that project.general.sessionRetention.maxAge (or enabled: false) in ~/.gemini/settings.json
CodexKeeps rollouts until you delete them.None needed
OpenCodeNo automatic session cleanup.None needed
PiKeeps session files until you delete them.None needed
CursorNot documented; AI Insights reports it as unknown.Unknown

To keep a year of Claude Code transcripts, add this to the top-level object in ~/.claude/settings.json:

~/.claude/settings.json
{
  "cleanupPeriodDays": 365
}

When transcripts are due for deletion within 7 days, the command line and the report say how many, and the “Keep your history” finding lists the steps. Once a transcript is gone, AI Insights still has the stats it already read from it, but not the transcript.

Limits

Every read is bounded, so a huge or malformed history cannot stall the run.

  • A run reads the newest 5,000 transcripts by default. --max-sessions changes that, up to 50,000.
  • Lines AI Insights does not understand are skipped and counted. scan shows the count as unreadable lines; a few are normal, many suggest an agent version newer than AI Insights knows.
  • Per-session lists are capped, for example tool calls at 10,000 for Codex and 20,000 for the other agents. The cards then show the count as “10,000+”.
  • Cursor sessions add no tokens or cost, because Cursor's local transcripts hold none.
  • Models without a known price are counted as unpriced rather than guessed. See Cost says some requests are unpriced.

Something wrong or missing? Edit this page on GitHub or open an issue.