Codex Session Image Scrubber
/install codex-session-image-scrubber
Codex Session Image Scrubber
Purpose
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.
Workflow
-
Confirm the target thread/session.
- Prefer a thread id if the user provides one.
- If they provide a remembered phrase, locate the session with
rg -l "\x3Cphrase>" ~/.codex/sessions ~/.codex/session_index.jsonl. - Do not edit the active file until you know which JSONL is the target.
-
Dry-run the scrubber.
node ~/.codex/skills/codex-session-image-scrubber/scripts/scrub-codex-session-images.mjs --thread-id \x3Cthread-id>Or, with an exact file:
node ~/.codex/skills/codex-session-image-scrubber/scripts/scrub-codex-session-images.mjs --file /path/to/rollout.jsonl -
If the dry-run looks right, write the cleaned file.
node ~/.codex/skills/codex-session-image-scrubber/scripts/scrub-codex-session-images.mjs --thread-id \x3Cthread-id> --write -
Validate after writing.
- Confirm size dropped with
ls -lh \x3Cfile> \x3Cbackup>. - Confirm the JSONL still parses; the script reports
parseErrors: 0. - Check obvious image payloads are gone:
Exit coderg -n "data:image|iVBORw0KGgo|/9j/4AAQ|UklGR" \x3Cfile>1with no output is the desired result.
- Confirm size dropped with
-
Tell the user the before/after size, backup path, and whether validation passed. Suggest reopening the thread so the app reloads the lighter file.
Safety Rules
- Only remove image payloads, not text that mentions images.
- Keep
\x3Cimage>or\x3C/image>text markers if present; they are small and can preserve conversation structure. - Always keep a backup outside
~/.codex/sessions; the script defaults to~/.codex/session_backups. - If multiple session files match a thread id, stop and pick explicitly instead of guessing.
- If the user wants the backup removed later, ask for confirmation before deleting it.
Script
The deterministic scrubber is at scripts/scrub-codex-session-images.mjs.
Useful options:
--thread-id \x3Cid>: find a rollout JSONL under~/.codex/sessions.--file \x3Cpath>: scrub a specific JSONL.--write: perform the rewrite; without this the script is dry-run only.--backup-dir \x3Cpath>: override the backup directory.--sessions-dir \x3Cpath>: override the Codex sessions root.--min-bytes \x3Cn>: threshold for suspicious image fields; defaults to100000.
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install codex-session-image-scrubber - After installation, invoke the skill by name or use
/codex-session-image-scrubber - Provide required inputs per the skill's parameter spec and get structured output
What is Codex Session Image Scrubber?
Use when a Codex thread or local session is slow because prior turns contain heavy image, screenshot, or base64 payloads. Helps locate the session JSONL, bac... It is an AI Agent Skill for Claude Code / OpenClaw, with 40 downloads so far.
How do I install Codex Session Image Scrubber?
Run "/install codex-session-image-scrubber" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Codex Session Image Scrubber free?
Yes, Codex Session Image Scrubber is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Codex Session Image Scrubber support?
Codex Session Image Scrubber is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Codex Session Image Scrubber?
It is built and maintained by Vyctor H. Brzezowski (@vyctorbrzezowski); the current version is v0.1.0.