Context Cleaner
Transcript cleaning tool that strips bulky tool data (thinking blocks, file contents, diffs, stdout) while preserving conversation flow, edit intent, and filenames.
Workflow
- •Get the transcript path
- •Run the cleaning script
- •Report results and resume command
Step 1: Get Transcript Path
Check these sources in order:
- •SessionStart hook context - Look for
Transcript:in the system-reminder at the top of conversation - •Environment variable - Run
echo $TRANSCRIPT_PATHin Bash - •Ask the user - If neither is available, ask for the path
Step 2: Run the Cleaning Script
bash
python3 <skill-path>/scripts/context-cleaner.py <transcript_path>
The script:
- •Creates a NEW file with
00effaced{NNN}suffix (original preserved) - •Unifies all sessionId entries to match the new filename
- •Strips: thinking blocks, Read/Write/Edit/Bash contents, file paths, tool results, hook progress lines
- •Preserves: conversation text, edit intent, filenames, uuid chain
Step 3: Report Results
The script outputs cleaning statistics and a resume command. Share the resume command with the user:
code
claude --resume <new_session_id> --verbose
SessionStart Hook
The src/contextCleaner_sessionStartHook.sh file provides:
- •Transcript path injection into Claude context (every session)
- •CLAUDE_ENV_FILE env vars ($SESSION_ID, $TRANSCRIPT_PATH)
- •Resume command copied to clipboard
- •Cleaned session detection (00effaced pattern)
Installation: copy to ~/.claude/hooks/ and register in ~/.claude/settings.json under SessionStart.