# ocr-grammar-fixer

A Claude subagent that fixes OCR output: character recognition errors, broken spacing, punctuation and grammar, with the original meaning kept intact.

- subagent · `type=agent` · Claude Code · 522 installs
- Author: davila7
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/davila7/claude-code-templates/tree/HEAD/cli-tool/components/agents/ocr-extraction-team/ocr-grammar-fixer.md
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/agents/ocr-grammar-fixer

## What it does

The `ocr-grammar-fixer` subagent takes text that has already been through OCR and hunts for the usual artifacts. It knows the classic mix-ups: `rn` read as `m`, `l` against `I` and `1`, `0` against `O`, `cl` against `d`, `li` against `h`. It also checks word boundaries, so missing or extra spaces, merged and split words, displaced punctuation and random capitalisation all get caught.

Correction runs in five passes. First it scans for odd letter combinations and spacing patterns, then reads the surrounding words to work out what was meant. After that it restores business and marketing terminology, fixes punctuation and capitalisation, and finally checks that the result reads naturally. Meaning wins over a literal character-by-character match.

It has `Read`, `Write` and `Edit` available, which is enough to open a file, apply fixes and save the result. By default it returns only the corrected text with no commentary; ask for the reasoning and it will show the artifacts it found. Handy when scanned documents or PDFs leave you with garbled characters and retyping by hand is not worth the time.

## Install

### Claude Code (native platform)

1. **claude-code-templates**
```bash
npx claude-code-templates@latest --agent ocr-extraction-team/ocr-grammar-fixer
```

2. **Manually: put the files in place**
- File: `.claude/agents/ocr-grammar-fixer.md` — For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

### Codex

**Manually: put the files in place**
- File: `.codex/agents/ocr-grammar-fixer.toml` — Codex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/

### Cursor

**Manually: put the files in place**
- File: `.cursor/agents/ocr-grammar-fixer.md` — Cursor also reads .claude/agents/

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/davila7/claude-code-templates/tree/HEAD/cli-tool/components/agents/ocr-extraction-team/ocr-grammar-fixer.md

## When to use it
- clean up recognition errors in OCR-processed text
- restore missing and extra spaces between words
- fix random capitalisation and displaced punctuation
- recover correct spelling of business and marketing terms
- turn scanned text into something publishable

## Example prompts
- fix the OCR errors in `report.txt` and save the result
- clean up `scan.md`: spacing, capitalisation, punctuation
- list the OCR artifacts you found and explain each fix

## Similar
- [grammar-check](https://affpapa.org/en/nevibecode/skills/grammar-check.md) — skill · 3000 installs
- [PDF OCR Extraction](https://affpapa.org/en/nevibecode/skills/pdf-ocr-extraction.md) — skill · 5700 installs
- [silicon-paddle-ocr](https://affpapa.org/en/nevibecode/skills/silicon-paddle-ocr.md) — skill · 1200 installs
- [ocr-super-surya](https://affpapa.org/en/nevibecode/skills/ocr-super-surya.md) — skill · 558 installs
- [transcript-fixer](https://affpapa.org/en/nevibecode/skills/transcript-fixer.md) — skill · 1200 installs
- [xcode-build-fixer](https://affpapa.org/en/nevibecode/skills/xcode-build-fixer.md) — skill · 3600 installs

From the same set: [davila7/claude-code-templates](https://affpapa.org/en/nevibecode/by/davila7/claude-code-templates.md) — 205 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
