Debugger-style AI conversation log navigator โ let any agent extract lessons and workflows from chat sessions
Project description
RetroLens ๐ฌ
A debugger for AI conversations โ let any agent navigate, analyze, and learn from past chat sessions.
What is this?
Every day you use AI agents (VS Code Copilot, Claude Code, Cursorโฆ) to write code. Those conversation logs are full of reusable workflows and hard-won lessons โ but they're locked inside opaque log files.
RetroLens is a lightweight CLI + Skill that gives any general-purpose AI agent the ability to:
- ๐ Discover log sessions across platforms
- ๐ Navigate sessions like a debugger โ overview โ turn โ tool call
- ๐ก Analyze what happened and extract lessons, workflows, and agent directives
The CLI handles only what agents can't do well โ parsing complex log formats and providing a structured traversal API. All analysis and writing is done by the agent itself, guided by SKILL.md.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ AI Agent (Copilot / Claude / Cursor / ...) โ
โ โ
โ Reads SKILL.md โ learns how to use CLI โ
โ Calls CLI โ gets structured JSON data โ
โ Analyzes โ uses its own LLM reasoning โ
โ Writes โ LESSONS.md, AGENTS.md, etc. โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CLI calls
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ retrolens CLI โ
โ โ
โ cfg โ configure log path & source โ
โ ls โ list sessions โ
โ read โ drill into turns & tool calls โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Parses log files
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Log Files โ
โ VS Code Copilot ยท Claude Code ยท Custom โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Integrating this skill
retrolens must be installed for agent use.
pip install retrolens
retrolens --version
Then add the skill to your agent.
Claude Code
This repo ships a Claude marketplace that installs the retrolens-plugin/ bundle as a plugin.
Step 1: Add marketplace
/plugin marketplace add JoelYYoung/retrolens
Step 2: Install the plugin
/plugin install retrolens
Manual install alternative:
git clone https://github.com/JoelYYoung/retrolens.git
cp -r retrolens/retrolens-plugin ~/.claude/plugins/retrolens
/reload-plugins
VS Code Copilot
VS Code Copilot discovers skills from your repo at .github/skills/<name>/SKILL.md.
From this repo, copy the skill into your target project:
mkdir -p .github/skills/retrolens
cp retrolens-plugin/SKILL.md .github/skills/retrolens/SKILL.md
Generic Skill-Based Agents
If your agent supports local skill folders, copy the skill file:
cp retrolens-plugin/SKILL.md <your-agent-skills-dir>/retrolens/SKILL.md
Then prompt the agent to follow the workflows in SKILL.md while calling the retrolens CLI.
Quick Start
You can specify what to analyze and what artifact to produce.
Common workflows:
1) Find sessions for this project
Use the RetroLens skill to locate conversation logs for this repository and list the most recent 10 sessions (title, date, turn count).
2) Add support for a new log format (custom reader)
This is only needed if your logs are not from VS Code Copilot or Claude Code.
Use the RetroLens skill: logs for a new platform are in <LOG_DIR>. Sample the files, implement a custom reader, and validate it can parse turns and tool calls correctly.
3) Analyze a specific session (ID/prefix: XXX)
Use the RetroLens skill to analyze session XXX: summarize the goal, key pivots, failures and fixes, then write reusable directives to notes/session-XXX-lessons.md.
4) Postmortem the latest session
Use the RetroLens skill to postmortem the latest session and produce 5 human-facing lessons and 5 agent directives in notes/retrolens-latest.md.
Providing the project path, log directory (or platform: VS Code / Claude Code), and the desired output file name will speed things up.
How It Works โ the Skill Model
RetroLens is designed to be used by AI agents, not by humans directly. The included SKILL.md teaches any general-purpose agent how to navigate and analyze conversation logs through a series of workflows:
| Workflow | What the Agent Does |
|---|---|
| Discover & Connect | Find log directories, auto-detect format, verify with ls |
| Build Custom Reader | Implement a reader for unsupported log formats |
| Analyze a Session | Progressive drill-down: ls โ read โ read --turn โ read --tool, then map workflow phases |
| Reflect & Extract Lessons | Categorize findings into human lessons and agent directives |
| Cross-Session Mining | Compare multiple sessions for recurring patterns |
The agent reads structured JSON from the CLI and does all reasoning, categorization, and writing itself.
CLI Reference
cfg โ Configure Working State
retrolens cfg set --path <dir> # Set log directory (auto-detects format)
retrolens cfg set --source vscode # Override detected source type
retrolens cfg set --reader ./r.py # Register a custom reader
retrolens cfg show # Show current config
retrolens cfg clear # Reset
ls โ List Sessions
retrolens ls # List sessions (default: 20)
retrolens ls --limit 50 --json # JSON output, up to 50
read โ Navigate Session Data
retrolens read <ID> # Session overview
retrolens read <ID> --turn N # Turn N detail
retrolens read <ID> -t N --tool M # Tool call M in turn N
retrolens read <ID> --turns 1-5 # Range of turn summaries
retrolens read <ID> --diff 1,3 # Compare two turns
retrolens read <ID> --raw -t N # Raw JSON data for a turn
retrolens read <ID> --json # JSON output (for agents)
<ID> can be a full UUID, a prefix (e.g. fb48c), or latest.
Supported Formats
| Platform | Source Type | Format |
|---|---|---|
| VS Code Copilot Chat | vscode |
JSONL (incremental state) |
| Claude Code | claude_code |
JSONL (event stream) |
| Custom | any | Via custom reader (see SKILL.md Workflow B) |
Custom Readers
For unsupported log formats, create a Python file that subclasses BaseReader:
from pathlib import Path
from retrolens.readers import BaseReader
from retrolens import models
class MyReader(BaseReader):
source_type = "myplatform"
def scan(self, path: Path | None = None) -> list[models.SessionInfo]: ...
def get_overview(self, session_id: str) -> models.SessionOverview: ...
def get_turn(self, session_id: str, turn_number: int) -> models.TurnDetail: ...
Register it: retrolens cfg set --reader ./my_reader.py
Full guide: retrolens-plugin/SKILL.md โ Workflow B, or retrolens-plugin/references/READER-API.md.
Bundled Scripts
| Script | Purpose |
|---|---|
retrolens-plugin/scripts/setup.sh |
Install RetroLens and verify |
retrolens-plugin/scripts/sample_log.py |
Sample & pretty-print a log file to identify format |
retrolens-plugin/scripts/validate_reader.py |
Validate a reader against real log data |
Project Structure
src/retrolens/
โโโ cli.py # Click CLI (cfg, ls, read)
โโโ config.py # Persistent config state
โโโ detect.py # Log format auto-detection
โโโ models.py # Pydantic v2 data models
โโโ formatters.py # Text / JSON dual-mode output
โโโ readers/
โโโ __init__.py # BaseReader ABC + ReaderRegistry
โโโ vscode_copilot.py # VS Code Copilot JSONL parser
โโโ claude_code.py # Claude Code JSONL parser
retrolens-plugin/
โโโ SKILL.md # โญ Agent skill document
โโโ scripts/ # Helper scripts (setup, discovery, validation)
โโโ references/ # Reader API docs
tests/ # 128 tests
Development
uv pip install -e ".[dev]" # Install with dev deps
python -m pytest tests/ -v # Run tests
ruff check src/ # Lint
License
MIT โ see LICENSE
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file retrolens-0.5.6.tar.gz.
File metadata
- Download URL: retrolens-0.5.6.tar.gz
- Upload date:
- Size: 285.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e44c08b79839d474edf020d53d4e43e789688f2a7d206593219a661b1057604
|
|
| MD5 |
efc7bc79b0e1e55cfaa98ec796e486c6
|
|
| BLAKE2b-256 |
3fcfcb98531b9970b51ff069f18b44a8b42e4c261b7e5cab5d157c8eb14d169d
|
Provenance
The following attestation bundles were made for retrolens-0.5.6.tar.gz:
Publisher:
release.yml on JoelYYoung/retrolens
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
retrolens-0.5.6.tar.gz -
Subject digest:
9e44c08b79839d474edf020d53d4e43e789688f2a7d206593219a661b1057604 - Sigstore transparency entry: 1280440605
- Sigstore integration time:
-
Permalink:
JoelYYoung/retrolens@912b57c0db4746b4a385e7b931d8e8e67e7e19fd -
Branch / Tag:
refs/tags/v0.5.6 - Owner: https://github.com/JoelYYoung
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@912b57c0db4746b4a385e7b931d8e8e67e7e19fd -
Trigger Event:
push
-
Statement type:
File details
Details for the file retrolens-0.5.6-py3-none-any.whl.
File metadata
- Download URL: retrolens-0.5.6-py3-none-any.whl
- Upload date:
- Size: 29.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7a2cad85f99ccdc73a4e0a0edc83508cb430987af75a1e9d5ccb20a58e774b2
|
|
| MD5 |
dc5cc3a27bc72ea6e40c535d3aa35d98
|
|
| BLAKE2b-256 |
da51319d68bed89a4b854fc86f4a7798c22d387dd148c0ad553972719d0936e8
|
Provenance
The following attestation bundles were made for retrolens-0.5.6-py3-none-any.whl:
Publisher:
release.yml on JoelYYoung/retrolens
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
retrolens-0.5.6-py3-none-any.whl -
Subject digest:
d7a2cad85f99ccdc73a4e0a0edc83508cb430987af75a1e9d5ccb20a58e774b2 - Sigstore transparency entry: 1280440608
- Sigstore integration time:
-
Permalink:
JoelYYoung/retrolens@912b57c0db4746b4a385e7b931d8e8e67e7e19fd -
Branch / Tag:
refs/tags/v0.5.6 - Owner: https://github.com/JoelYYoung
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@912b57c0db4746b4a385e7b931d8e8e67e7e19fd -
Trigger Event:
push
-
Statement type: