Fabian-Galvez/DensePack

Packs text files into small images that an AI model reads for about half the input tokens. Includes a Claude Code plugin, a right-click tool and an HTML app.

Python

8

15 commits

updated Sep 30, 2026

See the code

See what people are saying

SourceMessageScoreDate

I built DensePack to combat Anthropic's pricing and help people save and build more with Claude Code. New benchmarks available show it beats every popular plugin on total session savings. (r/ClaudeAI)

**FIRST:** Big shoutout to the people that helped DensePack! I want to thank the 8 stargazzers that believed in this from the start. I hope you guys see this post or reach out to me directly (so I can personally give you updates) and continue to follow the project because DensePack is NOT like…

0

Oct 2, 2026

README

DensePack

DensePack packs text into the smallest image that Fable, Opus and Sonnet models can read. The image uses about half the input tokens of the text.

Anthropic's claude plugin eval ran three coding tasks on Opus 5.5. DensePack saved 31.8% to 38.3% of the price on average, and all runs passed their checks.

Turns are calls to the model that send the entire conversation that has been written to cache at cache read price.

The DensePack plugin and the right-click tool render their images with FreeType and run on Windows, Linux and macOS. The tests ran on Windows and Linux.


Contents



Savings

Anthropic's claude plugin eval ran three tasks on Opus 5.5, 5 times with DensePack and 5 times without it. Each run with DensePack cost less than its paired run without DensePack and passed all checks.

The mean price of the DensePack runs as a share of the runs without it, for the three benches

TaskWhat the agent doesMean saving
Code traceThe agent traces how a Read becomes an image through about 20,000 lines of code32.6%
Architecture docThe agent reads 14 hook scripts, about 8,700 lines, and outputs ARCHITECTURE.md31.8%
Five files read wholeThe agent reads five scripts whole, 5,586 lines, and writes a 5-line summary38.3%

Each bench is one short task in a new session. In longer sessions, each later turn reads the whole conversation again from the cache, and the images of the files that the agent read cost about half the tokens of their text.

The tasks run on a frozen copy of the DensePack scripts. The suite is in plugin/evals/. BENCHMARKS.md has the command that runs the suite, the price and the turns of each run, and the tasks where DensePack gives no saving.

Byte identical rebuild

  • Opus 5.5 read each file as a DensePack image and wrote the file again from the image.
  • Runs pass when the new file is byte for byte identical to the source file.
  • Each file had 100 runs.
FileText tokensImage tokensSavingPasses
Markdown prose, 115 lines1,85588652%100 of 100
Python script, 116 lines1,85983455%73 of 100
HTML email template, 25 lines2,3601,15051%63 of 100
GDScript game code, 222 lines, tabs2,7901,43049%65 of 100

Most failed runs have a wrong count of spaces or tabs. BENCHMARKS.md lists the errors.



Parts

  • The plugin, the right-click tool and the HTML app pack text into images.
  • The plugin and the right-click tool use the same renderer.
  • The HTML app has its own renderer with its own color coding and code mode, but without the line numbers, space counts and tab boxes of the plugin. No bench measured it.
PartWhat it doesWho it is forWhere to start
PluginThe plugin packs the files that the agent Reads, Bash output, Word files, CLAUDE.md and MEMORY.md, and the briefs and reports of subagents inside Claude Code with no extra step.

Two commands install the plugin.
People who use Claude CodeInstall the plugin
Right-click toolThe right-click tool packs a file from your file manager or your shell on Windows, Linux and macOS.

On Windows only, it also packs selected text with a hotkey or with the Ctrl+Right-click menu in each application.

The Windows and Linux installers add Pillow, freetype-py and NumPy to your own Python
People who use an AI chatINSTALL.md and tools/Tool-README.md
HTML appThe HTML app runs in your browser.

You paste text, and the image updates while you type.
You can download or copy the image.
People who want one image without an installUse the HTML app and index.html

tools/Tool-README.md lists the changes that the right-click tool makes, how to install it without the hotkeys and how to remove it.



Install the plugin

INSTALL.md has the steps for Windows, macOS and Linux.

/plugin marketplace add Fabian-Galvez/DensePack
/plugin install densepack@densepack-marketplace

  • DensePack needs Python 3.10 or newer and treats an older Python as missing.
  • On Windows, the first run installs Python with winget when it is missing.
  • On macOS and Linux, the plugin prints the command that installs Python.
  • The plugin then installs Pillow, freetype-py and NumPy into its own data folder.
  • On Windows, the hooks run through Git Bash, or through PowerShell when the computer has no Git for Windows.
  • The tests ran on Claude Code 2.1.283 and 2.1.284.
SystemPythonPillow, freetype-py and NumPy
Windowswinget installs Python 3.13 for your account. It needs no admin rightspip puts them in the data folder of the plugin
macOSThe plugin installs nothing and prints the brew command and the uv command for you to runpip puts them in the data folder of the plugin
LinuxThe plugin installs nothing and prints the apt, dnf or pacman command for you to runpip puts them in the data folder of the plugin

On Windows, the plugin tries the Python install one time. Restart Claude Code after the Python install.

Use these steps to update DensePack.

  1. Run claude plugin marketplace update densepack-marketplace in a terminal.
  2. Run claude plugin update densepack@densepack-marketplace.
  3. Restart Claude Code.

To remove DensePack, follow Remove DensePack in INSTALL.md.

CommandWhat it does
/densepackIt starts DensePack and sets each setting to its default
/dense-offIt stops all DensePack hooks in this session only. New sessions start with DensePack on
/maxpackIt sends images to Sonnet and is the default
/max-offIt sends text to Sonnet
/helppackIt prints all commands
/dense-removeIt restores the original text of each converted CLAUDE.md, .claude/CLAUDE.md, CLAUDE.local.md and MEMORY.md and removes CLAUDE_CODE_THRIFTY_SONIC when its value is still 0. It also deletes the trust entry of the marketplace folder in ~/.claude.json and the DensePack files that /plugin uninstall does not delete, except the files that Remove DensePack lists as kept. Run it before the uninstall
/mdpack <folder>It packs the CLAUDE.md, .claude/CLAUDE.md and CLAUDE.local.md of that folder into images and puts a pointer in their place, and the agent does not read these files. Run it from a folder next to that folder, and then open a new session in that folder. The new session reads the images and never the text
Coming soon
/dashpackIt shows the saving of each conversation while the conversation runs. It calculates the text price of each image that the agents read and of each later turn that reads the image again




Save the most

DensePack saves the most in long conversations that read many files, for example an audit of a repository.

  • Read files with the Read tool. DensePack also packs Bash output of 400 characters or more, but Bash reads save less.
  • Keep working in the same session, because each later turn reads the smaller images again.
  • Open Claude Code in an empty folder next to the repository. Then give the agent the full path of the repository.
    • DensePack sends the names of the files directly in that folder with your prompt. It also packs those files in the background when they hold 700,000 bytes or fewer in total.
    • DensePack does neither of these steps when the folder has more than 200 files.
    • DensePack sends each file that the agent reads with the Read tool as images when the images cost less than the text, except in the cases that Limits lists.

INSTALL.md has the numbered steps for a repository with a CLAUDE.md, for an audit and for each session.



Changes to your computer

  • DensePack changes some of your files and adds its own folders and packages.
  • /dense-remove undoes the changes to your files and deletes the DensePack folders of the projects that the transcripts in ~/.claude/projects name, except .claude/tmp/ and the files that Remove DensePack lists as kept.
  • /plugin uninstall deletes the packages.
What it changesWhat DensePack does
CLAUDE.md, .claude/CLAUDE.md and CLAUDE.local.md in a project, your ~/.claude/CLAUDE.md and the MEMORY.md of the projectDensePack copies each one to <name>.densepack.bak, packs the text into images and puts a short pointer in the file. Files stay text unless their images and pointer cost less than their text
~/.claude/settings.jsonDensePack adds "CLAUDE_CODE_THRIFTY_SONIC": "0" one time when the key is not there. From the next session on, Claude Code auto mode no longer tells the agent to read files with Bash. DensePack shows a note on screen about this change
.gitignore files in .claude/tmp/ and .claude/densepack-vault/DensePack writes one line, *, and Git then does not commit those folders
.claude/tmp/ and .claude/densepack-vault/ in each projectDensePack creates these folders. .claude/tmp/ holds the settings and the working files. The vault holds the images, their text copies and one folder for each conversation. At session start, DensePack deletes working files and images older than 24 hours. DensePack deletes the oldest conversation folders when those folders pass the default limit of 200 MB
~/.claude/densepack-stateDensePack creates this folder. The folder holds the path of the Python that DensePack found, the key that seals the image records, the list of converted instruction files and the images of your ~/.claude/CLAUDE.md and MEMORY.md
Pillow, freetype-py and NumPyDensePack installs them into the data folder of the plugin and does not change your own Python

HOW-IT-WORKS.md has the full table and the rules to read, edit and share a converted file. PLUGIN-FOLDERS-FILES.md lists each folder and working file.



How it works

DensePack has four parts.

PartWhat happens
The swapThe agent calls Read, and the Read runs on the real file. Then read_image.py packs the file into an image and puts the image in the result in place of the text, and the model receives the image.

Bash output of 400 characters or more goes through the same steps. Bash results return one image. When the output needs more than one image, the result holds the first image and a note that names the others. DensePack puts lines that a model can misread beside the image as exact text, for example random IDs that mix capital and small letters and hold a capital I or a small l. DensePack keeps the exact text of each packed output in .claude/densepack-vault/images/
The packingDensePack packs files, Bash output, briefs for subagents and reports from subagents, but only when the plugin calculates that the images cost less than the text.

DensePack packs briefs only when they have 1,000 characters or more.

Agents still write their briefs and reports as text, and DensePack replaces that text with images that the receiving agent opens with one Read. HOW-IT-WORKS.md explains each step
The imageOne function, pack_code(), packs the text into each image. In the image, a green number starts each line, a red number gives a count of spaces and a \t box gives a count of tabs. In files with tab indents, the band color shows the tab count
Exact linesWhen an Edit fails after the agent copied its text from an image, a Read of 20 lines or fewer gives the exact lines as text, and the agent sends the Edit again
  • DensePack sends images to Fable, Opus and Sonnet models, such as Fable 5.1, Opus 5.5 and Sonnet 5.5.
    • All these models get the same image with 17 px characters.
    • Sonnet gets images while /maxpack is on, which is the default.
    • Haiku and all other models get text.
  • The lead agent gets a note at session start that explains how to read the images, and a SubagentStart hook sends the same note to each subagent.
    • Haiku leads get no note, and Sonnet leads and subagents get none after /max-off.
    • Haiku subagents get the note, but their files stay text.
    • Only the lead agent also gets one line that tells it to write subagent tasks the same way as without DensePack.
  • DensePack stops Greps that print each line of a file as text when a Read of that file gives images, and it lets all other Greps pass. DensePack also stops Bash reads, such as cat, of the text file of a packed report or brief.

HOW-IT-WORKS.md explains the four parts, the seven slash commands, the hooks and each script.



Word files

  • DensePack packs .doc and .docx files into images before the agent reads them, because the Read tool of Claude Code cannot open Word files.
  • Doc and docx files get no images when their text is under 1,000 bytes or over 1,000,000 bytes, or when the images cost more than the text.
  • The agent can read the text of these files with a shell command.

DensePack also writes the text of each Word file beside its images.

  • The text copy holds the exact text of the images, with one line for each paragraph, list item and table row.
  • The key row of each image shows the name of the text copy after file=.
  • Word files that your prompt names or that a Glob, Grep or Bash listing shows get a text copy in .claude/densepack-vault/images/. DensePack names the text copy after the working copy in .claude/tmp, for example .claude-tmp-densepack_word_8d36c710126a.docx.txt beside .claude-tmp-densepack_word_8d36c710126a.docx.txt-image-1-of-3-DensePack.png.
  • Word files that you copy into .claude/densepack-vault/to-pack/ get text copies with their own names, for example report.docx.txt beside report.docx.txt-image-1-of-3-DensePack.png in to-pack/packed/.

.docx files are ZIP files of XML, and .doc files are OLE2 containers. DensePack reads the two formats with the Python standard library and does not need Word.

  • The Edit and Write tools of Claude Code do not work on Word files.
  • Use a shell command to change a Word file.
  • To change a .docx, unzip it, edit word/document.xml and zip it again.

HOW-IT-WORKS.md has the format table, the three ways that DensePack packs a Word file automatically and the three steps that keep the scan fast.



Speed and memory

Text sizeOld rendererNew renderer
11 KB3.2 s, 528 MB, 16 processes0.9 s, 55 MB, 1 process
21 KB5.4 s, 630 MB, 15 processes1.8 s, 76 MB, 1 process
228 KB29.6 s, 3.3 GB, 16 processes8.2 s, 243 MB, 1 process
  • When DensePack packs a named folder in the background, it starts one process for each file, up to the number of CPU cores.
  • Files of 60,000 bytes or more also start their own render processes.
  • In one test, the first Bash call took 9.4 s during the background pack and 2.7 s without DensePack.


Limits

  • DensePack sends Haiku text only, because in a test Haiku 4.5 scored 1 of 10 on a packed report and gave wrong numbers with no warning.
  • DensePack packs .doc and .docx files in four cases. See Word files.
    • Your prompt names the file.
    • Your prompt names the folder of the file by its full path. DensePack then packs up to 8 Word files of that folder before your message goes to the model.
    • The agent finds the file with Glob, Grep or a Bash listing.
    • You copy the file into .claude/densepack-vault/to-pack/.
  • When a Word file that your prompt names gets no images, DensePack tells the agent the reason and tells it to read the text with a shell command.
  • Short tasks can cost more with DensePack, because the session note and the extra steps of some runs cost more than the images save. In the task that copies 6 lines of a Python file on Opus 5.5, each run with DensePack cost $0.0915 to $0.1082, and each run without it cost $0.0827 to $0.0839. BENCHMARKS.md gives the price of each run and each cause.
  • Edit and Write work on files that arrived as images. They do not work on Word files because Claude Code does not Read Word files. See Word files.
    DensePack tells this to the agents that get images. The lead agent gets it at session start, and each subagent gets it when the subagent starts.
  • On Opus 5.5, DensePack adds about 569 tokens for the session start note and the command list to the first turn of a session. Each later turn reads these tokens again at the cache read price. The other hooks add nothing to messages that have no pasted image and name no folder and no Word file.
    This count comes from two claude -p sessions with no tool call, one with DensePack off and one with DensePack on.
  • No bench measured the cost of the session start note in a subagent.
  • After conversations that packed a report or a brief, the next session gets a summary at session start. With the default receipts setting, the summary is one line that names the file of the totals.
  • Files under 1,000 bytes, files over 1,000,000 bytes and files with a null byte stay text.
  • Reads with a limit of 20 lines or fewer stay text. Longer Reads of part of a file get images of those lines only, or text when the text costs less. When those lines need more than one image, the Read returns the first image and a note that names the others.
  • When one Sonnet turn reads more than 32 files, or more than 700,000 bytes of files, most Reads of that turn get text. Opus and Fable have no such limit.
  • Files stay text when the font has no glyph for more than 2% of their non-space characters, for example files in Chinese, Japanese or Korean and files of box-drawing characters.
  • On Windows without Git for Windows, the hooks run through a PowerShell script. Claude Code then runs commands in PowerShell, and DensePack packs no command output, because it packs only Bash output.
    DensePack will not run if a company policy blocks PowerShell scripts.
  • The benches measure the renderer of the plugin, which the right-click tool also uses. The HTML app uses its own renderer.
  • When one Sonnet turn gets many images, the reply can hold thousands of output tokens. More output lowers the saving because Anthropic bills output at 5x the input price.
  • Sonnet 5.5 and Opus 5.5 each copied one Python file of 116 lines from its image 10 times at medium effort. Sonnet 5.5 wrote all words correctly, with code that runs the same as the source, in 8 copies, and Opus 5.5 did this in all 10 copies. Run /max-off for work that must copy text exactly. BENCHMARKS.md has the results.


Thank you

The DensePack plugin renders each character with FreeType and the Inter font family. These two projects gave DensePack a good font from the first day. Thank you both.

Fonts for AI models to read are a later project.



Files

FileContents
README.mdWhat DensePack is, what it saves and how to install the plugin
HOW-IT-WORKS.mdThe swap, the packing, the image, the Edit check, Word files, the commands, the hooks and the scripts
INSTALL.mdThe install steps for Windows, macOS and Linux, the right-click tool, the HTML app and the removal steps
BENCHMARKS.mdThe benches, the prices and how Anthropic bills
PLUGIN-FOLDERS-FILES.mdThe folders and working files that the plugin writes and the purpose of each one
tools/Tool-README.mdThe right-click tool, its install, its use and the files it puts on your computer
PRIVACY-POLICY.mdThe privacy policy. DensePack sends no data to an external service and uses the network only to install what it needs
THIRD-PARTY-NOTICES.mdThe font and the libraries that this project uses, with their licenses
LICENSEThe MIT license
ai
claude-code
claude-code-plugin
image
llm
tokens
token-savings

Significant stargazers

Regis

8 followers · starred Sep 2026

Fabian-Galvez/DensePack

Packs text files into small images that an AI model reads for about half the input tokens. Includes a Claude Code plugin, a right-click tool and an HTML app.

Python

8

15 commits

updated Sep 30, 2026

See the code

See what people are saying

SourceMessageScoreDate

I built DensePack to combat Anthropic's pricing and help people save and build more with Claude Code. New benchmarks available show it beats every popular plugin on total session savings. (r/ClaudeAI)

**FIRST:** Big shoutout to the people that helped DensePack! I want to thank the 8 stargazzers that believed in this from the start. I hope you guys see this post or reach out to me directly (so I can personally give you updates) and continue to follow the project because DensePack is NOT like…

0

Oct 2, 2026

README

DensePack

DensePack packs text into the smallest image that Fable, Opus and Sonnet models can read. The image uses about half the input tokens of the text.

Anthropic's claude plugin eval ran three coding tasks on Opus 5.5. DensePack saved 31.8% to 38.3% of the price on average, and all runs passed their checks.

Turns are calls to the model that send the entire conversation that has been written to cache at cache read price.

The DensePack plugin and the right-click tool render their images with FreeType and run on Windows, Linux and macOS. The tests ran on Windows and Linux.


Contents



Savings

Anthropic's claude plugin eval ran three tasks on Opus 5.5, 5 times with DensePack and 5 times without it. Each run with DensePack cost less than its paired run without DensePack and passed all checks.

The mean price of the DensePack runs as a share of the runs without it, for the three benches

TaskWhat the agent doesMean saving
Code traceThe agent traces how a Read becomes an image through about 20,000 lines of code32.6%
Architecture docThe agent reads 14 hook scripts, about 8,700 lines, and outputs ARCHITECTURE.md31.8%
Five files read wholeThe agent reads five scripts whole, 5,586 lines, and writes a 5-line summary38.3%

Each bench is one short task in a new session. In longer sessions, each later turn reads the whole conversation again from the cache, and the images of the files that the agent read cost about half the tokens of their text.

The tasks run on a frozen copy of the DensePack scripts. The suite is in plugin/evals/. BENCHMARKS.md has the command that runs the suite, the price and the turns of each run, and the tasks where DensePack gives no saving.

Byte identical rebuild

  • Opus 5.5 read each file as a DensePack image and wrote the file again from the image.
  • Runs pass when the new file is byte for byte identical to the source file.
  • Each file had 100 runs.
FileText tokensImage tokensSavingPasses
Markdown prose, 115 lines1,85588652%100 of 100
Python script, 116 lines1,85983455%73 of 100
HTML email template, 25 lines2,3601,15051%63 of 100
GDScript game code, 222 lines, tabs2,7901,43049%65 of 100

Most failed runs have a wrong count of spaces or tabs. BENCHMARKS.md lists the errors.



Parts

  • The plugin, the right-click tool and the HTML app pack text into images.
  • The plugin and the right-click tool use the same renderer.
  • The HTML app has its own renderer with its own color coding and code mode, but without the line numbers, space counts and tab boxes of the plugin. No bench measured it.
PartWhat it doesWho it is forWhere to start
PluginThe plugin packs the files that the agent Reads, Bash output, Word files, CLAUDE.md and MEMORY.md, and the briefs and reports of subagents inside Claude Code with no extra step.

Two commands install the plugin.
People who use Claude CodeInstall the plugin
Right-click toolThe right-click tool packs a file from your file manager or your shell on Windows, Linux and macOS.

On Windows only, it also packs selected text with a hotkey or with the Ctrl+Right-click menu in each application.

The Windows and Linux installers add Pillow, freetype-py and NumPy to your own Python
People who use an AI chatINSTALL.md and tools/Tool-README.md
HTML appThe HTML app runs in your browser.

You paste text, and the image updates while you type.
You can download or copy the image.
People who want one image without an installUse the HTML app and index.html

tools/Tool-README.md lists the changes that the right-click tool makes, how to install it without the hotkeys and how to remove it.



Install the plugin

INSTALL.md has the steps for Windows, macOS and Linux.

/plugin marketplace add Fabian-Galvez/DensePack
/plugin install densepack@densepack-marketplace

  • DensePack needs Python 3.10 or newer and treats an older Python as missing.
  • On Windows, the first run installs Python with winget when it is missing.
  • On macOS and Linux, the plugin prints the command that installs Python.
  • The plugin then installs Pillow, freetype-py and NumPy into its own data folder.
  • On Windows, the hooks run through Git Bash, or through PowerShell when the computer has no Git for Windows.
  • The tests ran on Claude Code 2.1.283 and 2.1.284.
SystemPythonPillow, freetype-py and NumPy
Windowswinget installs Python 3.13 for your account. It needs no admin rightspip puts them in the data folder of the plugin
macOSThe plugin installs nothing and prints the brew command and the uv command for you to runpip puts them in the data folder of the plugin
LinuxThe plugin installs nothing and prints the apt, dnf or pacman command for you to runpip puts them in the data folder of the plugin

On Windows, the plugin tries the Python install one time. Restart Claude Code after the Python install.

Use these steps to update DensePack.

  1. Run claude plugin marketplace update densepack-marketplace in a terminal.
  2. Run claude plugin update densepack@densepack-marketplace.
  3. Restart Claude Code.

To remove DensePack, follow Remove DensePack in INSTALL.md.

CommandWhat it does
/densepackIt starts DensePack and sets each setting to its default
/dense-offIt stops all DensePack hooks in this session only. New sessions start with DensePack on
/maxpackIt sends images to Sonnet and is the default
/max-offIt sends text to Sonnet
/helppackIt prints all commands
/dense-removeIt restores the original text of each converted CLAUDE.md, .claude/CLAUDE.md, CLAUDE.local.md and MEMORY.md and removes CLAUDE_CODE_THRIFTY_SONIC when its value is still 0. It also deletes the trust entry of the marketplace folder in ~/.claude.json and the DensePack files that /plugin uninstall does not delete, except the files that Remove DensePack lists as kept. Run it before the uninstall
/mdpack <folder>It packs the CLAUDE.md, .claude/CLAUDE.md and CLAUDE.local.md of that folder into images and puts a pointer in their place, and the agent does not read these files. Run it from a folder next to that folder, and then open a new session in that folder. The new session reads the images and never the text
Coming soon
/dashpackIt shows the saving of each conversation while the conversation runs. It calculates the text price of each image that the agents read and of each later turn that reads the image again




Save the most

DensePack saves the most in long conversations that read many files, for example an audit of a repository.

  • Read files with the Read tool. DensePack also packs Bash output of 400 characters or more, but Bash reads save less.
  • Keep working in the same session, because each later turn reads the smaller images again.
  • Open Claude Code in an empty folder next to the repository. Then give the agent the full path of the repository.
    • DensePack sends the names of the files directly in that folder with your prompt. It also packs those files in the background when they hold 700,000 bytes or fewer in total.
    • DensePack does neither of these steps when the folder has more than 200 files.
    • DensePack sends each file that the agent reads with the Read tool as images when the images cost less than the text, except in the cases that Limits lists.

INSTALL.md has the numbered steps for a repository with a CLAUDE.md, for an audit and for each session.



Changes to your computer

  • DensePack changes some of your files and adds its own folders and packages.
  • /dense-remove undoes the changes to your files and deletes the DensePack folders of the projects that the transcripts in ~/.claude/projects name, except .claude/tmp/ and the files that Remove DensePack lists as kept.
  • /plugin uninstall deletes the packages.
What it changesWhat DensePack does
CLAUDE.md, .claude/CLAUDE.md and CLAUDE.local.md in a project, your ~/.claude/CLAUDE.md and the MEMORY.md of the projectDensePack copies each one to <name>.densepack.bak, packs the text into images and puts a short pointer in the file. Files stay text unless their images and pointer cost less than their text
~/.claude/settings.jsonDensePack adds "CLAUDE_CODE_THRIFTY_SONIC": "0" one time when the key is not there. From the next session on, Claude Code auto mode no longer tells the agent to read files with Bash. DensePack shows a note on screen about this change
.gitignore files in .claude/tmp/ and .claude/densepack-vault/DensePack writes one line, *, and Git then does not commit those folders
.claude/tmp/ and .claude/densepack-vault/ in each projectDensePack creates these folders. .claude/tmp/ holds the settings and the working files. The vault holds the images, their text copies and one folder for each conversation. At session start, DensePack deletes working files and images older than 24 hours. DensePack deletes the oldest conversation folders when those folders pass the default limit of 200 MB
~/.claude/densepack-stateDensePack creates this folder. The folder holds the path of the Python that DensePack found, the key that seals the image records, the list of converted instruction files and the images of your ~/.claude/CLAUDE.md and MEMORY.md
Pillow, freetype-py and NumPyDensePack installs them into the data folder of the plugin and does not change your own Python

HOW-IT-WORKS.md has the full table and the rules to read, edit and share a converted file. PLUGIN-FOLDERS-FILES.md lists each folder and working file.



How it works

DensePack has four parts.

PartWhat happens
The swapThe agent calls Read, and the Read runs on the real file. Then read_image.py packs the file into an image and puts the image in the result in place of the text, and the model receives the image.

Bash output of 400 characters or more goes through the same steps. Bash results return one image. When the output needs more than one image, the result holds the first image and a note that names the others. DensePack puts lines that a model can misread beside the image as exact text, for example random IDs that mix capital and small letters and hold a capital I or a small l. DensePack keeps the exact text of each packed output in .claude/densepack-vault/images/
The packingDensePack packs files, Bash output, briefs for subagents and reports from subagents, but only when the plugin calculates that the images cost less than the text.

DensePack packs briefs only when they have 1,000 characters or more.

Agents still write their briefs and reports as text, and DensePack replaces that text with images that the receiving agent opens with one Read. HOW-IT-WORKS.md explains each step
The imageOne function, pack_code(), packs the text into each image. In the image, a green number starts each line, a red number gives a count of spaces and a \t box gives a count of tabs. In files with tab indents, the band color shows the tab count
Exact linesWhen an Edit fails after the agent copied its text from an image, a Read of 20 lines or fewer gives the exact lines as text, and the agent sends the Edit again
  • DensePack sends images to Fable, Opus and Sonnet models, such as Fable 5.1, Opus 5.5 and Sonnet 5.5.
    • All these models get the same image with 17 px characters.
    • Sonnet gets images while /maxpack is on, which is the default.
    • Haiku and all other models get text.
  • The lead agent gets a note at session start that explains how to read the images, and a SubagentStart hook sends the same note to each subagent.
    • Haiku leads get no note, and Sonnet leads and subagents get none after /max-off.
    • Haiku subagents get the note, but their files stay text.
    • Only the lead agent also gets one line that tells it to write subagent tasks the same way as without DensePack.
  • DensePack stops Greps that print each line of a file as text when a Read of that file gives images, and it lets all other Greps pass. DensePack also stops Bash reads, such as cat, of the text file of a packed report or brief.

HOW-IT-WORKS.md explains the four parts, the seven slash commands, the hooks and each script.



Word files

  • DensePack packs .doc and .docx files into images before the agent reads them, because the Read tool of Claude Code cannot open Word files.
  • Doc and docx files get no images when their text is under 1,000 bytes or over 1,000,000 bytes, or when the images cost more than the text.
  • The agent can read the text of these files with a shell command.

DensePack also writes the text of each Word file beside its images.

  • The text copy holds the exact text of the images, with one line for each paragraph, list item and table row.
  • The key row of each image shows the name of the text copy after file=.
  • Word files that your prompt names or that a Glob, Grep or Bash listing shows get a text copy in .claude/densepack-vault/images/. DensePack names the text copy after the working copy in .claude/tmp, for example .claude-tmp-densepack_word_8d36c710126a.docx.txt beside .claude-tmp-densepack_word_8d36c710126a.docx.txt-image-1-of-3-DensePack.png.
  • Word files that you copy into .claude/densepack-vault/to-pack/ get text copies with their own names, for example report.docx.txt beside report.docx.txt-image-1-of-3-DensePack.png in to-pack/packed/.

.docx files are ZIP files of XML, and .doc files are OLE2 containers. DensePack reads the two formats with the Python standard library and does not need Word.

  • The Edit and Write tools of Claude Code do not work on Word files.
  • Use a shell command to change a Word file.
  • To change a .docx, unzip it, edit word/document.xml and zip it again.

HOW-IT-WORKS.md has the format table, the three ways that DensePack packs a Word file automatically and the three steps that keep the scan fast.



Speed and memory

Text sizeOld rendererNew renderer
11 KB3.2 s, 528 MB, 16 processes0.9 s, 55 MB, 1 process
21 KB5.4 s, 630 MB, 15 processes1.8 s, 76 MB, 1 process
228 KB29.6 s, 3.3 GB, 16 processes8.2 s, 243 MB, 1 process
  • When DensePack packs a named folder in the background, it starts one process for each file, up to the number of CPU cores.
  • Files of 60,000 bytes or more also start their own render processes.
  • In one test, the first Bash call took 9.4 s during the background pack and 2.7 s without DensePack.


Limits

  • DensePack sends Haiku text only, because in a test Haiku 4.5 scored 1 of 10 on a packed report and gave wrong numbers with no warning.
  • DensePack packs .doc and .docx files in four cases. See Word files.
    • Your prompt names the file.
    • Your prompt names the folder of the file by its full path. DensePack then packs up to 8 Word files of that folder before your message goes to the model.
    • The agent finds the file with Glob, Grep or a Bash listing.
    • You copy the file into .claude/densepack-vault/to-pack/.
  • When a Word file that your prompt names gets no images, DensePack tells the agent the reason and tells it to read the text with a shell command.
  • Short tasks can cost more with DensePack, because the session note and the extra steps of some runs cost more than the images save. In the task that copies 6 lines of a Python file on Opus 5.5, each run with DensePack cost $0.0915 to $0.1082, and each run without it cost $0.0827 to $0.0839. BENCHMARKS.md gives the price of each run and each cause.
  • Edit and Write work on files that arrived as images. They do not work on Word files because Claude Code does not Read Word files. See Word files.
    DensePack tells this to the agents that get images. The lead agent gets it at session start, and each subagent gets it when the subagent starts.
  • On Opus 5.5, DensePack adds about 569 tokens for the session start note and the command list to the first turn of a session. Each later turn reads these tokens again at the cache read price. The other hooks add nothing to messages that have no pasted image and name no folder and no Word file.
    This count comes from two claude -p sessions with no tool call, one with DensePack off and one with DensePack on.
  • No bench measured the cost of the session start note in a subagent.
  • After conversations that packed a report or a brief, the next session gets a summary at session start. With the default receipts setting, the summary is one line that names the file of the totals.
  • Files under 1,000 bytes, files over 1,000,000 bytes and files with a null byte stay text.
  • Reads with a limit of 20 lines or fewer stay text. Longer Reads of part of a file get images of those lines only, or text when the text costs less. When those lines need more than one image, the Read returns the first image and a note that names the others.
  • When one Sonnet turn reads more than 32 files, or more than 700,000 bytes of files, most Reads of that turn get text. Opus and Fable have no such limit.
  • Files stay text when the font has no glyph for more than 2% of their non-space characters, for example files in Chinese, Japanese or Korean and files of box-drawing characters.
  • On Windows without Git for Windows, the hooks run through a PowerShell script. Claude Code then runs commands in PowerShell, and DensePack packs no command output, because it packs only Bash output.
    DensePack will not run if a company policy blocks PowerShell scripts.
  • The benches measure the renderer of the plugin, which the right-click tool also uses. The HTML app uses its own renderer.
  • When one Sonnet turn gets many images, the reply can hold thousands of output tokens. More output lowers the saving because Anthropic bills output at 5x the input price.
  • Sonnet 5.5 and Opus 5.5 each copied one Python file of 116 lines from its image 10 times at medium effort. Sonnet 5.5 wrote all words correctly, with code that runs the same as the source, in 8 copies, and Opus 5.5 did this in all 10 copies. Run /max-off for work that must copy text exactly. BENCHMARKS.md has the results.


Thank you

The DensePack plugin renders each character with FreeType and the Inter font family. These two projects gave DensePack a good font from the first day. Thank you both.

Fonts for AI models to read are a later project.



Files

FileContents
README.mdWhat DensePack is, what it saves and how to install the plugin
HOW-IT-WORKS.mdThe swap, the packing, the image, the Edit check, Word files, the commands, the hooks and the scripts
INSTALL.mdThe install steps for Windows, macOS and Linux, the right-click tool, the HTML app and the removal steps
BENCHMARKS.mdThe benches, the prices and how Anthropic bills
PLUGIN-FOLDERS-FILES.mdThe folders and working files that the plugin writes and the purpose of each one
tools/Tool-README.mdThe right-click tool, its install, its use and the files it puts on your computer
PRIVACY-POLICY.mdThe privacy policy. DensePack sends no data to an external service and uses the network only to install what it needs
THIRD-PARTY-NOTICES.mdThe font and the libraries that this project uses, with their licenses
LICENSEThe MIT license
ai
claude-code
claude-code-plugin
image
llm
tokens
token-savings

Significant stargazers

Regis

8 followers · starred Sep 2026

Languages

Python

89.4%

HTML

6.6%

PowerShell

2.0%

Shell

1.7%