Skip to content

Add session log sanitizer for oversized image debugging#2

Open
WesleyMFrederick wants to merge 1 commit intodecodetool:mainfrom
WesleyMFrederick:add-session-log-hasher
Open

Add session log sanitizer for oversized image debugging#2
WesleyMFrederick wants to merge 1 commit intodecodetool:mainfrom
WesleyMFrederick:add-session-log-hasher

Conversation

@WesleyMFrederick
Copy link
Copy Markdown

Resolves #1

This utility helps users share session logs affected by the oversized image crash without exposing large base64 data.

Features

  • Replaces base64 image data with SHA-256 hashes
  • Preserves full JSON structure for debugging
  • Reduces file size by ~90% for image-heavy sessions
  • CLI tool with progress feedback and error handling

Usage

node scripts/hash-session-logs.cjs ~/.claude/projects/session.jsonl

Output is written to .claude-session-logs/ directory with .hashed.jsonl extension.

Testing

Tested on real Claude Code session files with embedded screenshots from Decode whiteboard integration. Typical reduction: 50MB → 5MB.

Implementation Details

  • Uses SHA-256 for deterministic hashing
  • Processes JSONL files line-by-line for memory efficiency
  • Only hashes base64 data >100 chars (preserves small inline data)
  • Graceful error handling preserves original data on parse failures

Addresses decodetool#1 by providing a tool to sanitize session logs for sharing.
Replaces base64 image data with SHA-256 hashes while preserving
structure, reducing file size by ~90% for image-heavy sessions.

Usage:
  node scripts/hash-session-logs.cjs <session-file.jsonl> [output-dir]

Features:
- SHA-256 hashing of base64 image data
- Preserves full JSON structure for debugging
- Progress feedback and size reduction reporting
- Error handling with line-level recovery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(context-management): session permanently unresponsive after oversized image

1 participant