mochify-cli CLAUDE.md

A repository guide for Claude Code, an AI coding assistant, in a Rust command-line tool that processes images and PDFs through an online image-processing service. It records the project's commands, structure, and development rules.

In plain words
What is it for?
It helps Claude Code work on the Rust CLI, process image or PDF files, run the MCP server, and use the project's expected test and lint commands.
Why use it?
It gives the coding assistant one place to learn how to build, run, test, format, and check the project.

Instructions file

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/getmochify/mochify-cli/claude-md
Clone the repo
git clone --depth 1 https://github.com/getmochify/mochify-cli
Per session 1,081 This file is loaded in full into every session.
When invoked 1,081 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01081 $0.01081
Opus 5 $0.00541 $0.00541
Sonnet 5 $0.00216 $0.00216
Haiku 4.5 $0.00108 $0.00108

Measured yesterday against content hash 342a2b9ae615, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

mochify-cli CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 105 lines

How it starts

The opening of the file, as written. The whole thing — 105 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project

mochify-cli is a Rust CLI tool and MCP server that wraps the mochify.app image processing API (POST https://api.mochify.app/v1/squish). It uploads local images via multipart form and saves the processed result.

Commands

# Build
cargo build

# Build release
cargo build --release

# Check (fast, no binary output)
cargo check

# Run (process an image)
cargo run -- photo.jpg -t webp -w 800

# Process a PDF (auto-detected by .pdf extension)
cargo run -- document.pdf --op rasterize -t png --dpi 150
cargo run -- document.pdf -p "split into pngs"   # NLP prompt path

# Run MCP server on stdio
cargo run -- serve

# Run tests
cargo test

# Run a single test
cargo test <test_name>

# Lint
cargo clippy

# Format
cargo fmt

Architecture

src/
  main.rs        Async entry point. Parses CLI args (clap), dispatches:
                   - `serve` subcommand → starts MCP server on stdio
                   - no subcommand     → calls process_files(), which routes
                     `.pdf` inputs to process_pdfs() and images to the squish flow
  cli.rs         Clap `Args` struct and `Commands` enum (Serve subcommand)
  api.rs         `MochifyClient` + `ProcessParams` / `PdfParams` — all HTTP logic.
                   `squish()` posts an image to /v1/squish; `pdf()` posts a PDF to
                   /v1/pdf and saves the returned zip. Response bytes written to disk.
  mcp/
    mod.rs       Re-exports MochifyMcp
    tools.rs     `MochifyMcp` struct implements ServerHandler via rmcp macros.
                   Exposes `squish` (mirrors ProcessParams) and `pdf` (mirrors PdfParams).

Key design decisions

  • Thin tools in MCP mode — the MCP client (e.g. Claude) handles natural-language interpretation and maps prompts to the structured squish / pdf tool parameters. No NLP layer needed in the CLI (the CLI's own --prompt flag does call /v1/prompt, including mode: "pdf" for PDFs).
  • PDFs are auto-detected by the .pdf extension on the default path; PDFs and images can't be mixed in one invocation (the NLP prompt resolves to a single mode). --op split|rasterize (plus --dpi, -t, --quality for rasterize) configure it, or --prompt resolves it. Output is saved as a .zip.
  • Auth is optional — without --api-key / MOCHIFY_API_KEY, requests go through on the free tier (25/month; unauthenticated IPs get 3/month). The key is sent as Authorization: Bearer <key>.
  • rmcp macros pattern — tools use #[tool_router] on the impl block + #[tool_handler] on impl ServerHandler. The struct must have a tool_router: ToolRouter<Self> field initialized via Self::tool_router().

Read the full file on GitHub · 105 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 105 lines · 1,081 tokens per session scan A 342a2b9ae615

Subscribe to this mod's changes

mochify-cli CLAUDE.md is an instructions file published in the GitHub repository getmochify/mochify-cli (1 stars, last pushed 1mo ago), licensed MIT. It adds 1,081 tokens to every session, about $0.0054 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.