Analyze conversation logs to extract insights and lessons learned
Analyze conversation logs from Claude Code and OpenCode to extract insights across 6 dimensions (communication, understanding, assumptions, efficiency, lessons, patterns). Use after work sessions to update CLAUDE.md with actionable lessons and flag detritus for cleanup.
/plugin marketplace add jasonkneen/codesurf-insights/plugin install jasonkneen-codesurf-insights@jasonkneen/codesurf-insights[project|all]Analyze conversation logs from Claude Code OR OpenCode to extract insights across 6 dimensions: user communication, model understanding, assumptions, efficiency, lessons learned, and language patterns.
project (default): Analyze current project's conversations onlyall: Analyze all projects globally{project-name}: Analyze specific project by nameIMPORTANT: First detect which tool's history to analyze by checking which paths exist:
Claude Code (check first):
~/.claude/projects/{current-project-hash}/conversations/*.jsonl~/.claude/projects/*/conversations/*.jsonlOpenCode (check if Claude paths don't exist or explicitly requested):
~/.local/share/opencode/storage/session/ses_*~/.local/share/opencode/storage/message/ses_*~/.local/share/opencode/storage/part/msg_*/prt_*.json{id, type, text, messageID, sessionID}Both (when running /analyze all):
Display progress as you analyze:
Analyzing conversations...
├── Source: Claude Code
│ ├── Project: my-app (12 conversations)
│ │ ├── [1/12] abc123... 47 messages, 3 insights
│ │ └── ...
├── Source: OpenCode
│ ├── Sessions found: 73
│ │ ├── [1/73] ses_485d888e... 23 messages, 2 insights
│ │ └── ...
Launch the conversation-analyzer agent for deep analysis. The agent will:
Combine insights across ALL conversation sources:
Claude Code (if CLAUDE.md exists):
<!-- codesurf-insights: START -->
### Learned: YYYY-MM-DD
- [LESSON] insight here
- [EFFICIENCY] insight here
<!-- codesurf-insights: END -->
OpenCode (if opencode.json exists, update project README or OPENCODE.md):
<!-- codesurf-insights: START -->
### Learned: YYYY-MM-DD
- [LESSON] insight here
- [EFFICIENCY] insight here
<!-- codesurf-insights: END -->
Write detailed report to ~/.claude/insights/reports/YYYY-MM-DD-HHmm.md
Include which sources were analyzed.
Show summary at completion:
Analysis Complete
═══════════════════════════════════════
Sources analyzed:
- Claude Code: 24 conversations
- OpenCode: 73 sessions
Total messages: 1,247
Detritus flagged: 312 (25%)
Insights extracted: 18
Top Insights:
1. [EFFICIENCY] Use Task agent for parallel file searches
2. [LESSON] Always check git status before bulk edits
3. [ASSUMPTION] Verify TypeScript vs JavaScript early
Full report: ~/.claude/insights/reports/2026-01-01-1430.md
CLAUDE.md updated with 5 new lessons
When parsing OpenCode parts, expect this structure:
{
"id": "prt_...",
"type": "text",
"text": "message content",
"synthetic": false,
"time": {"start": timestamp, "end": timestamp},
"messageID": "msg_...",
"sessionID": "ses_..."
}
all to analyze BOTH Claude Code and OpenCode history together/compact to clean logs