← 返回
未分类 中文

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...
在 Codex 线程或本地会话因先前回合包含大量图片、截图或base64 负载而导致速度慢时使用,可帮助定位会话 JSONL 文件。
vyctorbrzezowski vyctorbrzezowski 来源
未分类 clawhub v0.1.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 89
下载
💾 1
安装
1
版本
#latest

概述

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

  1. 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 "" ~/.codex/sessions ~/.codex/session_index.jsonl.
    • Do not edit the active file until you know which JSONL is the target.
  1. Dry-run the scrubber.

```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

```

  1. If the dry-run looks right, write the cleaned file.

```bash

node ~/.codex/skills/codex-session-image-scrubber/scripts/scrub-codex-session-images.mjs --thread-id --write

```

  1. Validate after writing.
    • Confirm size dropped with ls -lh .
    • Confirm the JSONL still parses; the script reports parseErrors: 0.
    • Check obvious image payloads are gone:

```bash

rg -n "data:image|iVBORw0KGgo|/9j/4AAQ|UklGR"

```

Exit code 1 with no output is the desired result.

  1. 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 or 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 : 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 个版本

  • v0.1.0 当前
    2026-06-07 06:52 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 197 📥 68,162
dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 80 📥 182,904
knowledge-management

Session Brief

vyctorbrzezowski
生成当前会话的紧凑完整上下文,直接在聊天中输出,适用于用户需要获取对话摘要以供参考的场景。
★ 0 📥 293