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.
- 📊 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.
| 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 |
- Ruby (2.7 or higher)
- No external gems required.
OpenCode:
opencode export [sessionID] > session.jsonGemini CLI: Within an interactive session, use:
/chat share session.json
For OpenCode:
ruby convert.rb --input session.json --output report.html --provider opencodeFor Gemini CLI:
ruby convert.rb --input session.json --output report.html --provider geminiGenerate demo reports from included sample sessions:
make demo-opencode
make demo-gemini| 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 |
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.
Created to enhance AI transparency and auditability (inspired by OpenCode Issue #9387). Contributions for new providers are welcome!
MIT
