gitwtfhub

wtf is image-context-cascade?

dlgod7/image-context-cascade — explained in plain English

Analysis updated 2026-05-18

12TypeScriptAudience · developerComplexity · 3/5Setup · easy

TL;DR

A middleware tool that shrinks AI coding agent sessions by turning old pasted screenshots into small, restorable placeholders before each request is sent.

Mindmap

mindmap
  root((image context cascade))
    What it does
      Shrinks agent sessions
      Downgrades old screenshots
      Restorable placeholders
    Tech stack
      TypeScript
      Node.js
      Claude Code Codex
    Use cases
      Prevent session bloat
      Rescue existing sessions
      Restore archived images
    Audience
      AI agent developers
    Setup
      Paste setup prompt to agent
      Install CLI
      Per host hooks

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Stop an AI coding agent session from growing huge or crashing after many pasted screenshots.

REASON 2

Rescue an existing bloated Claude Code or Codex session file to make it small again.

REASON 3

Automatically archive old images at the end of a Claude Code session via a hook.

REASON 4

Restore a specific archived image later by its hash if the agent needs to see it again.

What's in the stack?

TypeScriptNode.jsClaude CodeCodex

How it stacks up

dlgod7/image-context-cascadealamops/agetoraza-ali/blendpixel.com
Stars121212
LanguageTypeScriptTypeScriptTypeScript
Setup difficultyeasyhardeasy
Complexity3/54/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 5min

Behavior and automation level depend on which coding agent host you use (Pi, Claude Code, Codex, or generic).

Wtf does this do

image-context-cascade solves a specific problem that shows up when using AI coding agents like Claude Code or Codex: every screenshot you paste into a conversation gets resent in full, as base64 text, on every single request after that, even many turns later. In one measured session, screenshots ate over 86 percent of the context window, and requests can grow so large the session simply breaks with an error. This tool fixes the problem before a request ever leaves your machine, by downgrading older images to small, stable placeholders while keeping the images from the current turn intact. It sorts images into three tiers: hot images from the current turn are sent as is, warm images from recent history can get optional thumbnails, and cold images from older history become tiny placeholders that can be restored later by their hash if needed. Nothing is ever permanently deleted, only archived, and only images are touched, so the actual text of a conversation stays unchanged. Measured results show a single 1.3 megabyte image shrinking to 315 characters, and in one real session, downgrading four historical images cut input tokens from over 91,000 down to under 2,000. A full 50 megabyte session was reduced to about 2 megabytes with one command. Setup differs slightly by which coding agent you use. Some agents with the right hooks get this handled automatically on every request, Claude Code archives images automatically when a session ends, Codex needs the agent to propose the action for approval, and any other agent can use a manual command line tool on its session file. The project has no runtime dependencies and works with Anthropic, OpenAI Chat, and OpenAI Responses style request formats. Known limits include that it only handles images and not general text, it only recognizes exact byte-identical images rather than resized copies, and images referenced only by remote URL rather than embedded data are not processed. The README does not state a license.

Yoink these prompts

Prompt 1
Help me install and configure image-context-cascade for the coding agent I'm using.
Prompt 2
Show me how to run image-cascade rescue on an existing session.jsonl file as a dry run first.
Prompt 3
Explain the difference between hot, warm, and cold image tiers in this tool.
Prompt 4
Walk me through restoring a downgraded image using its short hash.
Prompt 5
Help me measure how much space image-context-cascade would save on my current agent sessions.

Frequently asked questions

wtf is image-context-cascade?

A middleware tool that shrinks AI coding agent sessions by turning old pasted screenshots into small, restorable placeholders before each request is sent.

What language is image-context-cascade written in?

Mainly TypeScript. The stack also includes TypeScript, Node.js, Claude Code.

How hard is image-context-cascade to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is image-context-cascade for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.