sevenevesai

Claude Session Parser — Communication skill for Claude Code

Communication community

Streaming parser for Claude Code session JSONL files: token usage, chat events, and activity classification.

How to install Claude Session Parser

This entry records only its repository, not the path inside it, so there is no exact command to give. Open sevenevesai/claude-session-parser and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Claude Session Parser does

Streaming parser for Claude Code session JSONL files: token usage, chat events, and activity classification.

Alternatives in Communication

  • Lark Coding Agent Bridge — Bot that bridges Feishu/Lark messenger with a local Claude Code or Codex CLI 2.4k ★
  • Claudix - Claude Code For VSCode — by Haleclipse - A VSCode extension that brings Claude Code directly into your editor with interactive chat int 1k ★
  • Claude Code Webui — Web-based interface for Claude CLI with streaming chat responses 969 ★

README

Streaming parser for Claude Code session JSONL files

[github](https://github.com/sevenevesai/claude-session-parser) [crates.io](https://crates.io/crates/claude-session-parser)

Pulls structured token-usage and chat-event data out of the `.jsonl` files [Claude Code](https://claude.com/claude-code) writes to `~/.claude/projects//.jsonl`. Streaming, read-only, no network, no subprocess, no writes.


Install

[dependencies]
claude-session-parser = "0.2"

Usage

use std::path::Path;
use claude_session_parser::{parse_jsonl_entries, parse_chat_events, reduce_session};

let path = Path::new("/path/to/session.jsonl");

// Usage / billing view: one UsageEntry per assistant turn
let parsed = parse_jsonl_entries(path)?;
let summary = reduce_session(&parsed.entries, "claude-opus-4-7", "session-id");
if let Some(s) = summary {
    println!(
        "turns={} cost=${:.4} cache_hit={:.1}%",
        s.message_count, s.estimated_cost_usd, s.cache_hit_pct
    );
}

// Chat view: flat, timestamp-ordered event stream
let events = parse_chat_events(path)?;
for evt in events {
    println!("{:?}", evt);
}
# Ok::<(), std::io::Error>(())

API

Function What it returns
parse_jsonl_entries(path) Vec — one per assistant message (tokens, model, tool uses, cache stats, activity class, hooks)
parse_chat_events(path) Vec — flat, timestamp-ordered user / assistant / thinking / tool-use / tool-result events
reduce_session(entries, model, session_id) Option — totals, cost, context-window %, cache-hit rate
cost_for_entry(&UsageEntry)