Skip to main content

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.

PyPI Python 3.10+ CI License: MIT

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:

  1. ๐Ÿ“‚ Discover log sessions across platforms
  2. ๐Ÿ” Navigate sessions like a debugger โ€” overview โ†’ turn โ†’ tool call
  3. ๐Ÿ’ก 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

retrolens-0.5.4.tar.gz (285.8 kB view details)

Uploaded Source

Built Distribution

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

retrolens-0.5.4-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

File details

Details for the file retrolens-0.5.4.tar.gz.

File metadata

  • Download URL: retrolens-0.5.4.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

Hashes for retrolens-0.5.4.tar.gz
Algorithm Hash digest
SHA256 ab4ae13ac0d0805f4ffc59c058f9a6f2539296677f8d1a9d777059b7456d9343
MD5 81beb8d423536701c73f7611f1cb260f
BLAKE2b-256 4c440ea4c6629b401e9f25940639888fa455009d11fc44608f9f32dfb4826bba

See more details on using hashes here.

Provenance

The following attestation bundles were made for retrolens-0.5.4.tar.gz:

Publisher: release.yml on JoelYYoung/retrolens

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

File details

Details for the file retrolens-0.5.4-py3-none-any.whl.

File metadata

  • Download URL: retrolens-0.5.4-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

Hashes for retrolens-0.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5319fb08b6269e9cc9be7a3f1621e20dd3056916101e66da351806da40eb9abe
MD5 7998c92b1a9dea80a0b1d71f099b4f84
BLAKE2b-256 8f238138cca7495f413567c7ae358264932c9c10d365980966ce72f373d3a6cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for retrolens-0.5.4-py3-none-any.whl:

Publisher: release.yml on JoelYYoung/retrolens

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