Skip to content

Ruslan/session-lens

Repository files navigation

SessionLens 🔍

SessionLens is a universal AI session visualizer that converts raw JSON logs from various AI platforms into beautiful, analytical HTML reports.

Originally built for OpenCode, SessionLens is designed with a provider-based architecture to support multiple AI ecosystems.

Features

  • 📊 Multi-Provider Support: Built-in logic to handle different JSON formats (OpenCode, with more coming soon).
  • 💰 Financial Insights: Detailed cost tracking per message and per session.
  • ⚡ Performance Metrics: Token counts (input, output, cached), TPS (Tokens Per Second), and Latency.
  • 🧠 Deep Reasoning: Dedicated visualization for model thinking/reasoning blocks.
  • 🛠 Tool Audit: Full visibility into tool calls, arguments, and execution results.
  • 🕒 Timeline View: Precise timestamps for every interaction.

Supported Providers

Provider Status Description
opencode ✅ Active Full support for OpenCode session.json
gemini ✅ Active Google Gemini CLI logs
claude 🗓 Planned Anthropic Claude exports
openai 🗓 Planned ChatGPT conversation exports

Requirements

  • Ruby (2.7 or higher)
  • No external gems required.

Usage

1. Export session from a provider

OpenCode:

opencode export [sessionID] > session.json

Gemini CLI: Within an interactive session, use:

/chat share session.json

2. Generate the report

For OpenCode:

ruby convert.rb --input session.json --output report.html --provider opencode

For Gemini CLI:

ruby convert.rb --input session.json --output report.html --provider gemini

Demo

SessionLens Demo

Generate demo reports from included sample sessions:

make demo-opencode
make demo-gemini

Options

Option Shorthand Description Default
--input -i Path to the source log file session.json
--output -o Path for the HTML report report.html
--provider -p Format provider (opencode) opencode
--template -t Path to custom ERB template template.html.erb

Architecture

SessionLens uses a Provider Pattern. Each provider translates platform-specific JSON into a standardized set of Domain Models (Execution, Loop, Message, ToolCall), which are then rendered via a unified ERB template.

Contributing

Created to enhance AI transparency and auditability (inspired by OpenCode Issue #9387). Contributions for new providers are welcome!

License

MIT

About

Visualize LLM agent sessions with analytics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors