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.
| Agent | History | Tokens and cost | Skill install |
|---|---|---|---|
| Claude Code | Read | Yes | Plugin |
| Codex | Read | Yes | Plugin |
| OpenCode | Read (the database needs Node 22.5 or later) | Yes | Untested |
| Pi | Read | Yes | Untested |
| Cursor | Read | No: its local transcripts hold no token counts | Untested |
| Gemini CLI | Untested: built from its source format, not yet tried on real history | Yes | None yet, use npx |
| Claude chat | Imported from a data export with ai-insights import claude; see Import chat history | No: the export records no model or token counts | Not 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.
| Agent | Default location | Moved 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 rollouts | CODEX_HOME |
| OpenCode | ~/.local/share/opencode/opencode.db (and channel databases such as opencode-<channel>.db), plus the older storage/ files | OPENCODE_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/*/chats | GEMINI_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.
| Kept | Not kept |
|---|---|
| When each session ran, how long, and in which project | The agent's replies |
| Token counts, models and estimated cost per request | Tool output: file contents, command output, search results |
| Which tools ran, failed or were declined, with shell commands redacted and cut to 300 characters | Thinking text, images and attachments |
| Your own prompts, secrets redacted and cut to 2,000 characters | Anything 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.
| Agent | What it does by default | Setting |
|---|---|---|
| Claude Code | Deletes 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 CLI | Deletes 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 |
| Codex | Keeps rollouts until you delete them. | None needed |
| OpenCode | No automatic session cleanup. | None needed |
| Pi | Keeps session files until you delete them. | None needed |
| Cursor | Not 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:
{
"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-sessionschanges that, up to 50,000. - Lines AI Insights does not understand are skipped and counted.
scanshows 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.