chatlog

Extract conversation messages from Claude Code or Codex session files into JSON.

Updated Mar 27, 2026
One-click install
npx skills add https://github.com/megumi-ben/work17 --skill chatlog-megumi-ben
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: chatlog
Source: https://github.com/megumi-ben/work17/tree/main/.codex/skills/chatlog
Command: npx skills add https://github.com/megumi-ben/work17 --skill chatlog-megumi-ben

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? AI coding sessions in Claude Code and Codex are stored as raw JSONL files with mixed record types, making it hard to get a clean copy of the actual conversation. This Skill locates the current session file and converts it into a structured JSON file of user and assistant messages. ## Core Features & Use Cases - Automatic Tool Detection: Checks the CLAUDECODE environment variable to determine whether the session belongs to Claude Code or Codex. - Session File Discovery: Finds the most recent session JSONL file from ~/.claude/projects or ~/.codex/sessions. - Message Extraction: Parses JSONL records, merges consecutive same-role messages, filters non-message records, and writes a clean {"messages": [...]} JSON output. - Use Case: After a long debugging session, ask the assistant to save the chatlog so you can archive the Q&A, share it with teammates, or feed it into documentation. ## Quick Start Ask the assistant to save the current conversation to a chatlog JSON file.

Frequently Asked Questions about chatlog

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I save my Claude Code conversation to a file?

Claude Code stores sessions as JSONL files under ~/.claude/projects/<project-slug>/. The extraction script filters user and assistant records, pulls text content, and writes a JSON file with a messages array.

How do I export a Codex session conversation?

Codex sessions live in ~/.codex/sessions/YYYY/MM/DD/ as rollout JSONL files. Filter records where type is response_item and payload.type is message, then extract text items from payload.content into JSON.

Where are Claude Code session files stored?

They are stored at ~/.claude/projects/<project-slug>/<session-uuid>.jsonl, where the project slug is the working directory path with slashes replaced by dashes. The newest file is the current session.

Why does the exported chatlog merge consecutive messages?

Claude Code streams assistant replies as multiple chunks, so consecutive same-role records are merged into one message. This produces a clean alternating user/assistant transcript instead of fragmented entries.

Does the extraction include tool calls and file snapshots?

No. Records whose type is not user or assistant, such as file-history-snapshot entries, are skipped. Only plain text content from user and assistant messages is kept in the output.