I've been running Claude Code autonomously for 72+ hours. Context fills. Agents loop on errors. Things drift. I got tired of not knowing exactly what was wrong, so I built a session analyzer.
What it does
Parse any Claude Code .jsonl session file and get:
- Context usage % with estimated burn rate
- Tool call breakdown (what you called most)
- Failure loop detection (same error repeated 3+ times)
- Largest tool outputs eating context
- Specific suggestions for what to fix
Install
npx github:seankim-android/cc-analyze your-session.jsonl
Or clone and run directly:
git clone https://github.com/seankim-android/cc-analyze
node cc-analyze/bin/cc-analyze.js your-session.jsonl
What it found on my 80MB session
━━━ Claude Code Session Analysis ━━━
Context Usage
[███████████████████████████░░░] 91%
~181,921 / 200,000 tokens estimated
Messages
Total: 25,221
User: 6,555
Assistant: 12,710
Compacted: 38 time(s)
💡 Suggestions
• Context usage is high (>80%). Add a compact step when you hit 70%.
25,221 messages. 38 compactions. 91% context usage. That's a 72-hour autonomous run.
Where your session files are
Claude Code stores sessions at:
~/.claude/projects/<project-hash>/*.jsonl
Find the biggest one and run the analyzer against it:
ls -la ~/.claude/projects/**/*.jsonl | sort -k5 -rn | head -5
node cc-analyze/bin/cc-analyze.js ~/.claude/projects/.../session.jsonl
What to do with the output
High context burn rate: You're reading large files whole. Use head -100 or line-range reads instead of full file reads.
Failure loops: Same error 3+ times means your retry logic is missing or broken. Add a max-retry guard before the loop runs forever.
No compaction: If you're past 70% with no compact event, add an explicit compact at 70-80%. Don't let it fill silently.
Large tool outputs: Bash command outputs, file reads, API responses — truncate them. A 5,000-token tool output burns the same context as 50 back-and-forth messages.
Repo: github.com/seankim-android/cc-analyze
Built during a live 72-hour experiment at builtbyzac.com.
Top comments (0)