Clean oversized Codex session logs by replacing embedded image/base64 payloads with small placeholders while keeping the surrounding conversation, tool calls, and text intact.
Use this when the user says a Codex chat/thread is heavy, slow, bloated, or contains pasted screenshots/images/base64 they want removed from history.
rg -l "" ~/.codex/sessions ~/.codex/session_index.jsonl .```bash
node ~/.codex/skills/codex-session-image-scrubber/scripts/scrub-codex-session-images.mjs --thread-id
```
Or, with an exact file:
```bash
node ~/.codex/skills/codex-session-image-scrubber/scripts/scrub-codex-session-images.mjs --file /path/to/rollout.jsonl
```
```bash
node ~/.codex/skills/codex-session-image-scrubber/scripts/scrub-codex-session-images.mjs --thread-id
```
ls -lh .parseErrors: 0.```bash
rg -n "data:image|iVBORw0KGgo|/9j/4AAQ|UklGR"
```
Exit code 1 with no output is the desired result.
or text markers if present; they are small and can preserve conversation structure.~/.codex/sessions; the script defaults to ~/.codex/session_backups.The deterministic scrubber is at scripts/scrub-codex-session-images.mjs.
Useful options:
--thread-id : find a rollout JSONL under ~/.codex/sessions.--file : scrub a specific JSONL.--write: perform the rewrite; without this the script is dry-run only.--backup-dir : override the backup directory.--sessions-dir : override the Codex sessions root.--min-bytes : threshold for suspicious image fields; defaults to 100000.共 1 个版本