Skip to main content
subagent

ocr-grammar-fixer — Claude Code subagent: cleans up OCR text

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

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --agent ocr-extraction-team/ocr-grammar-fixer
Open on GitHub

What ocr-grammar-fixer 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.

What it helps with

  • 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 for the agent

  • 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

How to install ocr-grammar-fixer

1claude-code-templates

npx claude-code-templates@latest --agent ocr-extraction-team/ocr-grammar-fixer

2Manually: put the files in place

.claude/agents/ocr-grammar-fixer.md

For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean

Questions about ocr-grammar-fixer

How do I install ocr-grammar-fixer in Claude?

Run npx claude-code-templates@latest --agent ocr-extraction-team/ocr-grammar-fixer; the agent file lands at .claude/agents/ocr-grammar-fixer.md.

What does ocr-grammar-fixer do?

It corrects text that came out of OCR: confused characters, broken word boundaries, punctuation and capitalisation. The intended meaning of the original stays the same.

Which tools does the subagent use?

It has Read, Write and Edit, which covers reading a file, making the corrections and writing the result back.

Similar subagents

All subagents for Agent setup: memory, context, orchestration →

From the same set205

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor