retrospect
Retrospect is a tool designed to analyze conversation logs from AI coding assistants like Claude Code and ChatGPT. It automatically extracts key information from these logs, such as the user's goal, the outcome of the conversation, and any difficulties encountered. The tool then organizes this information into structured summaries and generates a comprehensive markdown report. Developers and researchers can use Retrospect to gain insights into how users interact with AI coding tools, identify areas for improvement, and track progress over time. It offers a convenient way to understand patterns and trends in AI-assisted coding sessions, saving significant time and effort compared to manual review. The tool also caches generated summaries for faster re-analysis and allows comparison with Anthropic's native facets.
Retrospect solves the problem of manually reviewing lengthy conversation logs to understand user interactions with AI coding assistants. Instead of spending hours sifting through transcripts, users can quickly get a structured overview of goals, outcomes, and friction points, allowing them to identify patterns and areas for improvement more efficiently.
CAPABILITIES & CONSTRAINTS
README
# retrospect
[](README.fr.md)
A portable Python CLI that reproduces the Claude Code `/insights` pipeline — analyzes conversation logs, generates structured "facets" per conversation via LLM, and aggregates them into a markdown narrative report.
Works with **Claude Code** session logs and **ChatGPT** exports.
## What it does
1. **Parses** conversation logs (Claude Code JSONL or ChatGPT JSON export)
2. **Generates facets** — structured JSON summaries per conversation (goal, outcome, key points, friction) via LLM
3. **Caches** facets locally so reruns are instant
4. **Aggregates** into a markdown report with statistics and narrative
## Requirements
- Python 3.11+
- [Ollama](https://ollama.com/) running locally **or** an Anthropic API key
## Installation
```bash
git clone https://github.com/<you>/insights
cd insights
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
```
## Usage
```bash
# Analyze Claude Code sessions from ~/.claude/usage-data/session-meta/
python insights.py ~/.claude/usage-data/session-meta/
# Analyze a ChatGPT export
python insights.py ~/Downloads/conversations.json
# Use Claude instead of Ollama
INSIGHTS_LLM=claude python insights.py ~/.claude/usage-data/session-meta/
```
## Configuration
All settings are configurable via environment variables:
| Variable | Default | Description |
|---|---|---|
| `INSIGHTS_LLM` | `ollama` | Backend: `ollama` or `claude` |
| `INSIGHTS_MODEL` | `mistral-small3.1:24b` | Ollama model to use |
| `OLLAMA_URL` | `http://localhost:11434` | Ollama server URL |
| `INSIGHTS_MAX_CHARS` | `32000` | Max chars per conversation sent to LLM (uses head + tail) |
| `INSIGHTS_TIMEOUT` | `300` | LLM request timeout in seconds |
Output directories default to `~/notes/insights/facets/` and `~/notes/insights/reports/`.
## Comparing with Anthropic's native facets
```bash
# After running the pipeline on Claude Code sessions:
python compare.py --detail
```
This compares your generated facets against Anthropic's own `/insights` facets (stored in `~/.claude/usage-data/facets/`) — useful for evaluating pipeline quality.
## Project layout
```
insights.py # CLI entry point + orchestration
config.py # Configuration (env vars + paths)
llm.py # LLM backends (Ollama / Claude)
facets.py # Facet generation, validation, caching
report.py # Report aggregation
compare.py # Compare our facets vs Anthropic's
parsers/
claude_code.py # Claude Code session-meta parser
chatgpt.py # ChatGPT export parser
```
## Running tests
```bash
pytest
```
## Facet schema
Each facet is a JSON file with these fields:
```json
{
"underlying_goal": "What the user was actually trying to do",
"outcome": "achieved | mostly_achieved | not_achieved | unclear_from_transcript",
"key_points": ["Point 1", "Point 2"],
"friction": "Main difficulty encountered, or empty string",
"brief_summary": "1-2 sentence factual summary",
"conversation_id": "session-id",
"source": "claude_code | chatgpt"
}
```
PUBLIC HISTORY
IDENTITY
Identity inferred from code signals. No PROVENANCE.yml found.
Is this yours? Claim it →METADATA
README BADGE
Add to your README:
