Analysis updated 2026-05-18
Clean up a raw Claude Code session log to read it without noisy JSON fields.
Compare a fully cleaned output against a newline-only render to see what the script strips.
Study exactly what information gets fed into an LLM during a coding session.
| w-yariki/claude-session-cleaner | 0xhassaan/nn-from-scratch | 3ks/embedoc | |
|---|---|---|---|
| Stars | 0 | 0 | — |
| Language | Python | Python | Python |
| Last pushed | — | — | 2023-06-08 |
| Maintenance | — | — | Dormant |
| Setup difficulty | easy | moderate | hard |
| Complexity | 2/5 | 4/5 | 1/5 |
| Audience | developer | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
This project is a small Python script called clean_session.py. It takes the raw log files that Claude Code, an AI coding tool, creates while you work with it, and turns them into something a person can actually read. Claude Code saves every session as a .jsonl file, a format where each line is its own small chunk of data. These files record everything that happens during a coding session: your messages, the AI's replies, tool calls, and a lot of internal bookkeeping information most people never look at. Reading them directly is messy, since they are packed with technical fields and escaped characters instead of normal line breaks. This script cleans that up. It removes bookkeeping fields you would not care about, such as internal IDs, timestamps, and file paths. It turns escaped newline characters back into real line breaks so the text reads naturally. It also adds a separator before each remaining entry, showing its original line number and who or what produced it: a person, the AI, the system, or a summary. Because line numbers are kept from the original file, you can tell where something was removed just by seeing a gap in the numbering. At the top of the cleaned file, it prints a short summary with statistics about the session. The README frames this as a learning tool for people curious about how large language models like Claude actually work behind the scenes. It suggests running small experiments, such as clearing context, disabling parts of the interface, or comparing a fully cleaned file against a version where only the newline formatting was fixed, to notice what information is fed to the model and what is not. Using it requires only Python 3.8 or newer, no other dependencies. You run it from the command line, pointing it at one of your session log files, and it writes a cleaned version to an output folder you can customize. This is a niche, personal utility rather than a general-purpose tool, aimed at people who already use Claude Code and want to inspect what happens under the hood.
A small Python script that reformats messy Claude Code session log files into clean, readable text for studying how the AI works.
Mainly Python. The stack also includes Python.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.