Black Friday40% off all plans
For AI agents

Teach your coding agent to compress

Give Claude Code, Codex, Cursor, Gemini, Grok or any other agent one block of instructions, and it can compress and convert videos, images, GIFs and PDFs with the compresto CLI.

New to the command-line tool? See what the CLI does →

Set it up in three steps

  1. 1

    Install the CLI

    Homebrew installs compresto and the tools it relies on.

    brew install dqhieu/tap/compresto
  2. 2

    Sign in yourself

    Agents are told never to handle your license key, so do this step once in your own Terminal.

    compresto auth login
  3. 3

    Give your agent the instructions

    Copy the block below into your project, or point the agent at the Markdown link.

    Jump to the instructions

The instructions

Paste this into your project’s agent instructions file. It covers setup checks, the options agents need, where output goes, and what they must not do without asking.

Compresto instructions (Markdown)

## Compressing media with Compresto

Use the `compresto` command-line tool to compress or convert videos, images, GIFs and PDFs. It runs locally on macOS and nothing is uploaded.

### Before the first use

1. Check that it is installed: `compresto --version`. If the command is missing, install it with `brew install dqhieu/tap/compresto`.
2. Check the license: `compresto auth status --json`. If `loggedIn` or `valid` is false (exit code 3), stop and ask the user to run `compresto auth login` themselves. Never ask for, read or type the license key.
3. If a command exits with code 4, a required tool is missing. Run `compresto doctor`; it prints the `brew install` command that fixes it.

### Usage

```bash
compresto <files or folders> [options] --json
```

- Always pass `--json`. Each file produces one JSON line on stdout with `input`, `output`, `status` (`compressed`, `skipped` or `failed`), `inputBytes`, `outputBytes`, `savedPercent`, and `error` or `reason` when relevant. The last line is a summary with `"type":"summary"`. Only rely on `output` when `status` is `compressed`.
- Preview first when unsure: `--dry-run` reports each file as `planned` with the commands that would run, and changes nothing. It works without a license.
- Quote paths that contain spaces.

| Goal | Options |
| --- | --- |
| Compress, keeping the format | no extra options |
| Convert a video | `--to mp4`, `mov`, `webm`, `gif` or `mp3` |
| Convert an image | `--to jpg`, `png`, `webp` or `avif` |
| Quality | `--quality highest`, `high`, `good`, `medium` or `acceptable` |
| PDF quality | `--pdf-quality best`, `high`, `balance` or `low` |
| Hit a file size (video, JPEG) | `--target-size 8MB` |
| Resize a video | `--resolution 1080`, `--max-width N`, `--max-height N` |
| Resize an image or GIF | `--resize 50%`, `--max-width N`, `--max-long-edge N` |
| Trim a video | `--start 0:10 --end 0:25` |
| Remove audio | `--no-audio` |
| GIF from video | `--to gif --gif-width 640 --gif-fps 15` |
| A folder and its subfolders | `--recursive` |
| Several files at once | `--jobs 4` |
| Choose where output goes | `--output out/` for a folder, `--output name.ext` for one file |

### Where the output goes

- Same format: next to the original as `name_compressed.ext`.
- Converted with `--to`: next to the original with the new extension, for example `photo.png` becomes `photo.webp`.
- With `--output out/`: in that folder, under the original name. End the folder path with a slash; with a single input, a path without one is treated as a file name.
- Originals are never changed or deleted unless `--replace` is passed.

### Rules

- Do not pass `--replace` or `--force` unless the user asked for it. `--replace` puts the result in place of the original and moves the original to the Trash. `--force` overwrites an output file that already exists.
- A `skipped` file is not an error: it could not be made smaller, so the original was kept.
- If a file fails with "already exists", an earlier run already wrote that output. Use the existing file, or ask the user before overwriting it with `--force`.
- After converting to a new format, update references to the old file name in the project.
- Supported inputs are video (MP4, MOV, M4V, MKV, WebM, AVI and more), images (JPEG, PNG, WebP, AVIF, HEIC, TIFF, BMP), GIF and PDF. EPUB and SVG are not supported.
- Transparency is kept in PNG, WebP and AVIF. JPEG cannot store it and fills it with white.

### Exit codes

| Code | Meaning |
| --- | --- |
| 0 | Success |
| 1 | At least one file failed; check each result's `error` |
| 2 | Invalid arguments |
| 3 | Not signed in, or the license is not valid |
| 4 | A required tool is missing |

Run `compresto --help` for every option. Full documentation: https://compresto.app/docs/cli/introduction

Where to paste it

Claude Code
CLAUDE.md
Codex
AGENTS.md
Cursor
AGENTS.md or .cursor/rules
Gemini CLI
GEMINI.md
Grok and others
AGENTS.md, or wherever the agent keeps project instructions

File names change between versions. If yours differs, check your agent’s documentation.

Or point your agent at a link

The same instructions are served as plain Markdown, so you can ask an agent to read them in a prompt without adding anything to your project.

Example prompt

Read https://compresto.app/agents.md and follow it. Then compress the images in ./public with the compresto CLI and tell me how much space was saved.

Things to ask for

  • “Compress the screenshots in docs/images with compresto.”
  • “Convert the PNGs in public/ to WebP with compresto and update the references.”
  • “Use compresto to turn demo.mov into a 640-pixel-wide GIF for the README.”
  • “Get promo.mp4 under 8 MB with compresto.”

Built to be safe to hand over

Originals stay put

By default the result is written next to the original under a new name. Agents are told not to replace or overwrite files unless you ask.

A dry run before anything changes

Agents can preview the exact commands with --dry-run, which touches no files and needs no license.

Results they can read

With --json, every file reports its status, sizes and any error, and the exit code says what went wrong.

Nothing leaves your Mac

Compression runs locally. The agent never needs your license key: you sign in yourself, and it stays in the macOS Keychain.

Frequently asked questions

Which agents does this work with?

Any coding agent that can run shell commands on your Mac, including Claude Code, Codex, Cursor, Gemini CLI and Grok. The instructions are plain Markdown, so they are not tied to one tool.

Does the agent need my license key?

No. You sign in once with compresto auth login. The instructions tell agents to check the sign-in status and to ask you to sign in if needed, never to handle the key themselves.

Can an agent delete or overwrite my files?

Not by default. Output goes to a new file and existing files are never overwritten. Replacing originals needs the --replace option, which the instructions reserve for when you ask for it, and it moves originals to the Trash rather than deleting them.

Does it work on Linux or in CI?

No. The compresto CLI is for macOS, and each Mac that signs in uses a device on your license.

Every option is covered in the CLI documentation.