AI-powered text formatting for your terminal — fix grammar, rephrase, summarize, and more. CLI-first, cross-platform, works system-wide.
pip install prosefmt==1.1.0 Copy PIP instructions
AI-powered text rewriting — system-wide, from any app, with a single hotkey.
Highlight text in any application — browser, email, Slack, VS Code, terminal — press your hotkey, and prosefmt rewrites it in place. Grammar fixed, tone shifted, translated, summarized — all without leaving the app you're in. Linux reads the highlighted selection directly; macOS and Windows copy the highlight with Cmd+C / Ctrl+C, then paste the rewrite back.
$ prosefmt "i can haz good grammer?" I can have good grammar. $ echo "this sentense has a typo" | prosefmt This sentence has a typo. $ prosefmt -m professional "lets meet tmrw and discuss" Let's meet tomorrow to discuss. $ prosefmt menu -s -n # highlight text → picker → rewrite → paste back Table of Contents Why prosefmt? Quick Start (2 minutes) How It Works Installation Setup Guide 1. Clipboard tools 2. AI provider 3. Config file 4. Picker tool 5. Verify Usage Basic System-wide rewriting Mode picker Diff output Popup output Undo Built-in Modes Custom Modes Translation workflow Per-mode provider and model Output routing System-Wide Hotkeys i3 / Sway Hyprland GNOME / KDE macOS Windows Architecture Configuration Reference CLI Reference FAQ Development Why prosefmt? Every other AI writing tool is a GUI desktop app — Electron, PyQt5, or Tauri. They weigh 100–200 MB, can't be scripted, and most are broken on Wayland.
prosefmt is to AI text tools what ripgrep is to grep — fast, composable, Unix-native, and built for power users. Quick Start Get running in 2 minutes with Ollama (free, local, no API key):
# 1. Install prosefmt pip install prosefmt # or: uv tool install prosefmt # 2. Install & start Ollama (https://ollama.com) curl -fsSL https://ollama.com/install.sh | sh ollama pull qwen2.5:1.5b ollama serve # keep running in background # 3. Create config + check everything works prosefmt config init prosefmt check # 4. Try it! prosefmt "me and him went to store yesterday" That's it. For system-wide hotkeys, jump to System-Wide Hotkeys.
┌──────────────────────────────────────────────────────────────┐ │ INPUT │ │ │ │ Highlight text + hotkey (--system) │ │ Clipboard content (--clipboard) │ │ CLI argument: prosefmt "text" │ │ Pipe: echo "text" | prosefmt │ └─────────────────────────┬────────────────────────────────────┘ │ ▼ ┌──────────────────────────────────────────────────────────────┐ │ PICKER (optional) │ │ │ │ prosefmt menu → rofi / wofi / fuzzel / dmenu / fzf │ │ Choose a mode or type a free-form custom instruction │ └─────────────────────────┬────────────────────────────────────┘ │ mode name (or custom prompt) ▼ ┌──────────────────────────────────────────────────────────────┐ │ PROCESSING │ │ │ │ config.toml → system_prompt + mode.prompt │ │ AI provider → Ollama / OpenAI / Anthropic / compat │ │ List preservation → bullets & numbered lists kept intact │ └─────────────────────────┬────────────────────────────────────┘ │ ▼ ┌──────────────────────────────────────────────────────────────┐ │ OUTPUT │ │ │ │ "replace" → paste rewritten text back in-place │ │ "popup" → show in a desktop popup (original untouched)│ │ "clipboard" → write to clipboard │ │ "stdout" → print to terminal │ │ "--diff" → show what changed (red/green diff) │ └──────────────────────────────────────────────────────────────┘ Module Overview src/prosefmt/ ├── cli.py CLI entry point (Click) — subcommands, flags, routing ├── config.py TOML config loading — modes, providers, system prompt ├── core.py Rewrite engine — prompt assembly, list preservation ├── modes.py List-structure preservation helpers ├── clipboard.py Cross-platform clipboard (X11, Wayland, macOS, Windows) ├── picker.py Mode picker UI (rofi, wofi, fuzzel, dmenu, zenity, fzf) ├── popup.py Result display popup (zenity, yad, kdialog, rofi) ├── diff.py Text diff formatting (unified diff, ANSI colour) ├── notify.py Desktop notifications (notify-send, osascript, toast) └── providers/ ├── base.py Provider protocol ├── ollama.py Ollama (local, default) ├── openai_compat.py OpenAI / Groq / Together / LM Studio / vLLM └── anthropic.py Anthropic Claude Design principles:
uv tool install prosefmt New to uv? Install with: curl -LsSf https://astral.sh/uv/install.sh | sh
pip install prosefmt From source git clone https://github.com/digitronik/prosefmt.git cd prosefmt uv sync --extra dev Setup Guide One-time setup — takes about 5 minutes.
prosefmt uses native OS clipboard tools. macOS and Windows users can skip this step.
# Debian / Ubuntu / Mint / Pop!_OS sudo apt install xclip xdotool # Fedora / RHEL / CentOS / Rocky sudo dnf install xclip xdotool # Arch / Manjaro / EndeavourOS sudo pacman -S xclip xdotool # openSUSE sudo zypper install xclip xdotool Linux (Wayland) — GNOME on Wayland, Sway, Hyprland, etc. # Debian / Ubuntu / Mint sudo apt install wl-clipboard wtype # Fedora / RHEL / CentOS sudo dnf install wl-clipboard wtype # Arch / Manjaro sudo pacman -S wl-clipboard wtype # openSUSE sudo zypper install wl-clipboard wtype Not sure? Run echo $XDG_SESSION_TYPE — it prints x11 or wayland.
Pick one. You can always switch or add more later.
No API key needed. Runs entirely on your machine.
# Install Ollama → https://ollama.com/download curl -fsSL https://ollama.com/install.sh | sh # Pull a model (qwen2.5:1.5b is fast, works on CPU) ollama pull qwen2.5:1.5b # Start the server (keep running) ollama serve Other good models: llama3.2:3b, mistral:7b, phi3:mini
export OPENAI_API_KEY="sk-..." # Add to ~/.bashrc or ~/.zshrc so it persists Option C — Anthropic (Claude) export ANTHROPIC_API_KEY="sk-ant-..." # Add to ~/.bashrc or ~/.zshrc so it persists Option D — Any OpenAI-compatible endpoint Works with Groq, Together AI, LM Studio, vLLM, and anything that speaks /v1/chat/completions.
Configure the URL and model in your config file (next step).
prosefmt config init This creates ~/.config/prosefmt/config.toml with all modes, providers, and prompts ready to edit. It also checks your clipboard tools and tells you what's missing.
nano ~/.config/prosefmt/config.toml # or: vim, code, etc. The minimum config for Ollama (the defaults already cover this):
default_provider = "ollama" [providers.ollama] url = "http://localhost:11434" model = "qwen2.5:1.5b" For OpenAI:
default_provider = "openai" [providers.openai] model = "gpt-4o-mini" # API key from OPENAI_API_KEY env var 4. Picker tool (optional) The prosefmt menu command opens an interactive mode picker. Install any one of these:
sudo dnf install rofi # Fedora (works on X11 + Wayland) sudo apt install rofi # Ubuntu/Debian sudo pacman -S rofi # Arch # Or any of: wofi, fuzzel, dmenu, zenity, fzf # prosefmt auto-detects the best one available Skip this if you only use prosefmt -s -n (direct rewriting without a picker).
prosefmt check ✓ Clipboard tools installed ✓ Picker: rofi (for 'prosefmt menu') ✓ Popup: zenity (for --popup / default_output = "popup") ✓ Provider 'ollama' is reachable (model: qwen2.5:1.5b) If anything is missing, prosefmt check prints the exact command to fix it.
# Pass text as an argument (default mode: fix grammar) prosefmt "me and him went to the store yesterday" # Use a specific mode prosefmt -m professional "lets meet tmrw and discuss" # Pipe from stdin echo "this sentense has a typo" | prosefmt # Read from clipboard, print the result prosefmt --clipboard # Override provider/model for one run prosefmt -p openai --model gpt-4o "some text here" System-wide rewriting Highlight text, press your hotkey, and the rewritten text replaces the original — without switching windows or touching the mouse. On Linux this reads the primary selection. On macOS and Windows, prosefmt sends Cmd+C / Ctrl+C itself (there is no primary selection), rewrites that text, then pastes it back over the highlight.
# Read highlighted text → rewrite → paste back in-place prosefmt --system --notify # With a specific mode prosefmt -m professional -s -n # Short form for hotkey bindings prosefmt -s -n How --system works:
Clipboard safety: Your Ctrl+C buffer is automatically saved before pasting and restored afterwards. prosefmt never destroys your clipboard.
prosefmt menu opens an interactive mode picker — no shell scripting required.
# Highlight text → pick a mode → rewrite → paste back prosefmt menu -s -n # Read from clipboard → pick a mode → rewrite prosefmt menu -c The picker auto-detects the best installed tool: rofi → wofi → fuzzel → dmenu → zenity → fzf → osascript.
Type anything into the picker that isn't a mode name, and prosefmt treats it as a one-shot custom instruction:
┌────────────────────────────────┐ │ ✎ prosefmt │ │ fix │ │ professional │ │ casual │ │ rephrase │ │ > translate to French ←────│── typed freely, runs as ad-hoc prompt │ > make this sound excited ←───│── also works └────────────────────────────────┘ No config changes needed for one-off instructions.
See exactly what changed — a unique feature no competitor offers:
# Show a diff of original vs. result prosefmt --diff "Their were a few things we didnt finish" --- original +++ rewritten -Their were a few things we didnt finish +There were a few things we didn't finish. # Diff in a popup window prosefmt --diff --popup -s # Diff works with any mode prosefmt --diff -m professional "text here" Popup output Show the result in a desktop popup window instead of replacing the original text. Perfect for translations and summaries where you want to read the result, not paste it.
# Show rewrite in a popup prosefmt --popup -s -m summarize # Popup auto-detects: zenity → yad → kdialog → rofi → osascript → notify-send Popup tools can be checked with prosefmt check.
Every rewrite saves the original text. One-step undo:
# Print the original text prosefmt undo # Paste it back to the active window prosefmt undo -s # Write to clipboard prosefmt undo -c Built-in Modes prosefmt ships with 8 modes. All prompts are user-editable in config.toml.
# List all modes (built-in + custom) prosefmt list # Mode names only (useful for scripts) prosefmt list --names Custom Modes Add any number of custom modes in config.toml. All prompts are yours to edit — nothing is hardcoded.
# ~/.config/prosefmt/config.toml [modes.translate-spanish] prompt = "Translate to Spanish. Keep technical terms in English." label = "🇪🇸 Spanish" [modes.slack] prompt = "Rewrite for Slack: brief, friendly, one or two sentences max." label = "Slack-ready" [modes.eli5] prompt = "Explain this like I'm five — simple words, short sentences, no jargon." label = "Simplified" [modes.code-comments] prompt = "Add clear, concise comments to this code. Do not change any code." label = "Comments added" preserve_structure = false Use them exactly like built-in modes:
prosefmt -m translate-spanish "Good morning, how are you?" prosefmt -m slack "Please review the pull request I opened for the auth refactor." Custom modes appear automatically in prosefmt menu — no config changes to your hotkey bindings needed.
Set default_mode so pressing your hotkey (without a picker) uses a different mode:
default_mode = "professional" Now prosefmt -s -n rewrites in professional tone instead of fixing grammar.
You receive a message in Czech. You want to read it in English, write your reply, then send it back as Czech — all without switching apps.
[modes.translate-english] prompt = "Translate to English. Keep technical terms as-is." label = "→ English" default_output = "popup" # show translation in popup — don't replace original [modes.translate-czech] prompt = "Translate to Czech. Keep technical terms in English." label = "→ Czech" default_output = "replace" # replace English with Czech in-place Workflow:
1. Highlight Czech message → Mod+Shift+G → pick "translate-english" → popup shows English translation (Czech text untouched) 2. Read the popup, type your English reply 3. Highlight English reply → Mod+Shift+G → pick "translate-czech" → English replaced with Czech → hit send The same pattern works for any language pair — Hindi, French, Spanish, Japanese.
Route different tasks to different AI models — fast local model for grammar, powerful cloud model for complex rewrites:
[modes.fix] prompt = "Fix grammar, spelling, and punctuation only. Preserve the original sentence structure, meaning, and tone." provider = "ollama" model = "qwen2.5:1.5b" # fast, local, CPU-friendly [modes.review] prompt = "Review this text for clarity, tone, and impact." provider = "openai" model = "gpt-4o" # complex task → cloud model CLI flags --provider and --model always override the mode config for that run.
The default_output field decides what happens when a mode is used via --system:
[modes.summarize] prompt = "Summarize concisely. Key points only." default_output = "popup" # show summary, don't replace original [modes.translate-czech] prompt = "Translate to Czech." default_output = "replace" # paste translation, replacing original System-Wide Hotkeys Two hotkey bindings give you the full prosefmt experience:
Add to ~/.config/i3/config (or ~/.config/sway/config):
bindsym $mod+g exec --no-startup-id prosefmt -s -n bindsym $mod+Shift+g exec --no-startup-id prosefmt menu -s -n Reload with Mod+Shift+C.
bind = $mainMod, G, exec, prosefmt -s -n bind = $mainMod SHIFT, G, exec, prosefmt menu -s -n Linux — GNOME / KDE Add custom shortcuts in Settings → Keyboard → Custom Shortcuts:
Install Hammerspoon, then add to ~/.hammerspoon/init.lua:
Create a Quick Action in Automator that runs:
/usr/local/bin/prosefmt --system --notify Assign a shortcut in System Settings → Keyboard → Keyboard Shortcuts → Services.
$modes = (& prosefmt list --names) -split "`n" | Where-Object { $_ } $mode = $modes | Out-GridView -Title "prosefmt — choose a mode" -PassThru if ($mode) { & prosefmt -m $mode --system --notify } AutoHotkey script:
#g:: Run "prosefmt --system --notify",, "Hide" #+g:: Run 'powershell -WindowStyle Hidden -File "%USERPROFILE%\prosefmt-menu.ps1"',, "Hide" Architecture ┌──────────────────────────────────────────────────────────────┐ │ config.toml │ │ Single source of truth for all prompts, modes, providers │ │ Python code NEVER references specific mode names │ └─────────────────────────────┬────────────────────────────────┘ │ ┌───────────────────▼────────────────────┐ │ prosefmt CLI │ │ Prompt-agnostic orchestrator │ │ (Click commands, input/output routing) │ └───────────────────┬────────────────────┘ │ ┌────────────────────────┼─────────────────────────┐ │ │ │ ▼ ▼ ▼ ┌─────────┐ ┌──────────────┐ ┌──────────────┐ │Providers│ │ Core Engine │ │ Platform │ │ │ │ │ │ Backends │ │ Ollama │ │ Prompt │ │ │ │ OpenAI │◄────────►│ assembly │────────► │ Clipboard │ │Anthropic│ │ List │ │ Picker │ │ Compat │ │ preservation │ │ Popup │ │ │ │ Undo │ │ Notify │ └─────────┘ └──────────────┘ │ Diff │ └──────────────┘ All via subprocess to native OS tools Zero GUI dependencies Key Design Decisions Config-driven — The Python code never contains the string "fix", "professional", or any mode name. All modes and prompts live in config.toml. Users can edit, reorder, add, or delete any mode without touching code.
List-structure preservation — When rewriting bulleted or numbered lists, prosefmt strips the prefixes before sending to the AI (so the model doesn't lose or mangle them), then re-attaches them to the result.
Clipboard save/restore — The --system flag wraps the paste operation in a context manager that saves your Ctrl+C clipboard, pastes the result, then restores the original clipboard content.
Tool auto-detection — The picker, popup, and notification systems each maintain a priority list of native tools. prosefmt picks the best available one at runtime:
Create it: prosefmt config init · View it: prosefmt config show
API keys are set via environment variables — never put them in config.toml.
Auto-detected on first run. Override if detection is wrong.
# ~/.config/prosefmt/config.toml default_mode = "fix" default_provider = "ollama" temperature = 0.1 seed = 42 system_prompt = """You are a text rewriter. Output ONLY the rewritten text. No preamble, no explanation, no 'Here is'. Keep technical terms, code, URLs, and formatting unchanged.""" # ── Providers ────────────────────────────────────────────────── [providers.ollama] url = "http://localhost:11434" model = "qwen2.5:1.5b" [providers.openai] model = "gpt-4o-mini" # API key: OPENAI_API_KEY env var [providers.anthropic] model = "claude-haiku-4-5-20251001" # API key: ANTHROPIC_API_KEY env var # [providers.openai-compat] # url = "https://api.groq.com/openai/v1" # model = "llama-3.3-70b-versatile" # ── Modes ────────────────────────────────────────────────────── [modes.fix] prompt = "Fix grammar, spelling, and punctuation only. Do not add, remove, or rearrange words beyond what is needed. Preserve the original sentence structure, meaning, and tone. Keep the same number of sentences." label = "Grammar fixed" [modes.professional] prompt = "Rewrite this text in a professional, formal tone suitable for work emails and business communication. Keep the original meaning." label = "Made professional" [modes.casual] prompt = "Rewrite this text in a casual, friendly tone. Keep it natural and conversational. Preserve the original meaning." label = "Made casual" [modes.rephrase] prompt = "Rephrase this text for better clarity and readability. Use different words while keeping the same meaning." label = "Rephrased" temperature = 0.4 [modes.concise] prompt = "Make this text shorter by removing unnecessary words. Keep the same meaning." label = "Made concise" [modes.expand] prompt = "Expand this text with more detail and explanation. Keep the same meaning and tone." label = "Expanded" temperature = 0.4 [modes.email] prompt = "Rewrite this as a professional email with an appropriate greeting and sign-off. Keep the core message intact." label = "Formatted as email" preserve_structure = false [modes.summarize] prompt = "Summarize this text in 2-3 sentences. Include only the key points." label = "Summarized" preserve_structure = false temperature = 0.4 default_output = "popup" # ── Custom examples (uncomment to enable) ────────────────────── # [modes.translate-english] # prompt = "Translate to English. Output only the translation." # label = "→ English" # default_output = "popup" # model = "qwen2.5:7b" # [modes.explain] # prompt = "Explain this in simple terms. Be brief." # label = "Explained" # default_output = "popup" CLI Reference prosefmt [TEXT] Rewrite TEXT (default mode: fix) prosefmt -m MODE [TEXT] Rewrite with a specific mode prosefmt -s / --system Read highlighted text, paste result back prosefmt -c / --clipboard Read from clipboard prosefmt -n / --notify Show desktop notification when done prosefmt --popup Show result in popup window prosefmt --diff Show diff of original vs. result prosefmt -p / --provider PROVIDER Override AI provider prosefmt --model MODEL Override AI model prosefmt --config-path PATH Use a custom config file prosefmt menu Open mode picker, then rewrite prosefmt menu -s -n Highlight → picker → rewrite → paste back prosefmt menu -c Clipboard → picker → rewrite prosefmt list List all modes (human-readable) prosefmt list --names Mode names only (one per line) prosefmt undo Print the original text from last rewrite prosefmt undo -s Paste original back to active window prosefmt undo -c Write original text to clipboard prosefmt check Verify clipboard, picker, popup, provider prosefmt config init Create config file prosefmt config show Show active configuration prosefmt --version Show version prosefmt --help Show help Flag combinations cheatsheet Goal Command Fix grammar of highlighted text prosefmt -s -n Choose mode, rewrite highlighted text prosefmt menu -s -n Fix grammar from clipboard prosefmt -c Rewrite in professional tone prosefmt -m professional "text" See what changed prosefmt --diff "text with erors" Translate and show popup prosefmt --popup -m translate-english -s Use OpenAI for this one run prosefmt -p openai --model gpt-4o "text" Pipe through prosefmt cat draft.txt | prosefmt -m concise FAQ What happens to my clipboard when using --system? prosefmt saves your current clipboard (Ctrl+C buffer) before pasting, then restores it afterwards. Your clipboard is never destroyed.
Yes. Configure all your providers in config.toml, then assign different modes to different providers using the provider and model fields on each mode. For example, use Ollama for quick grammar fixes and OpenAI for complex rewrites.
Yes, with Ollama. Once you've pulled a model (ollama pull qwen2.5:1.5b), everything runs locally on your machine with no internet connection needed.
Any service that speaks the OpenAI /v1/chat/completions format works out of the box:
[providers.openai-compat] url = "http://localhost:1234/v1" # LM Studio default model = "your-model-name" Set PROSEFMT_COMPAT_API_KEY if the service requires authentication.
Small language models (1.5B–3B parameters) struggle with non-Latin scripts. Use a larger model for translation modes:
[modes.translate-hindi] prompt = "Translate to Hindi. Keep technical terms in English." model = "qwen2.5:7b" # needs a larger model Or route translation to a cloud provider: provider = "openai".
Yes — that's the whole point. Every prompt in config.toml is yours to edit. Small local models work best with short, direct, single-instruction prompts. Cloud models can handle more nuanced instructions. The config file includes tips for prompt writing.
Those are GUI desktop apps (100–200 MB, Electron or PyQt5). They can't be piped, scripted, or used from hotkeys without their own UI. Most are broken on Wayland. prosefmt is a ~90 KB CLI tool with 2 Python dependencies that composes with Unix pipes and works everywhere.
git clone https://github.com/digitronik/prosefmt.git cd prosefmt uv sync --extra dev # Git hooks (ruff lint + format) uv run pre-commit install uv run pre-commit run --all-files # Run tests uv run pytest -v # Lint uv run ruff check src/ tests/ uv run ruff format --check src/ tests/ CI runs lint + tests on Python 3.11–3.14 across Linux, macOS, and Windows on every push and pull request.
Contributions welcome — open an issue or pull request on GitHub.
All 2 files in this release have provenance metadata.
ai anthropic cli formatter grammar ollama openai prosefmt rewriter text
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
All 2 files in this release have been uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




