agentsclimarketplace

Clipsmith ocr

Skill OctopusGarage/clipsmith/skills/clipsmith-ocr

Run native macOS image OCR through Vision.framework via pyobjc bridge (same engine family used by Preview/Live Text), with Chinese+English recognition defaults and deterministic CLI execution. Use when you need to extract text from local images on macOS — including screenshots, photos, or scanned documents — and want output to stdout or a text file. Also known as image-to-text or read-text-from-image.From its SKILL.md

Install
npx -y skills add OctopusGarage/clipsmith --skill clipsmith-ocr

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its file declares

Copied from the file, not written here

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

8.6 KB, ~1.9k tokens by cl100k_base, as published. Nobody here has run it

clipsmith-ocr

Deterministic local OCR executor backed by Apple Vision.framework. No network calls, no third-party cloud, no API keys. Recognition runs on-device using the same ML model as Preview and Live Text.

Two implementation details that affect output and are not in Apple's public docs:

  • Bounding-box coordinate origin is lower-left (not upper-left like screen coordinates). The script compensates by sorting on -(y + height) descending, then x ascending to produce correct reading order.
  • Language correction (setUsesLanguageCorrection_) is always enabled — Vision silently applies a language model to fix likely OCR errors based on the primary recognition language. This improves accuracy but can silently "correct" uncommon proper nouns or technical terms to more common alternatives.

NEVER

  • NEVER pass a remote URL or HTTP path — Vision.framework requires a local file:// URI. Remote paths produce empty output with no error raised.
  • NEVER treat empty output as success — Vision returns an empty string (not an exception) when: image resolution is too low, format is unsupported, or text contrast is insufficient. Always check that output is non-empty when text is expected.
  • NEVER use fast mode for Chinese-heavy imagesfast drops strokes on dense CJK characters; use accurate (default) unless throughput is more important than accuracy.
  • NEVER assume pyobjc is available system-wide — this skill is a uv project. The execution wrapper (run.ts) uses uv run --project <skillRoot> to activate or create the correct environment automatically. Never call ocr-image-macos.py directly with python3; always invoke via npx tsx scripts/run.ts.
  • NEVER run pip install pyobjc-* system-wide — if pyobjc is missing, run uv sync --project <skillRoot> to restore the skill environment. System-level pip install targets the wrong Python and won't be used by run.ts.
  • NEVER run on non-macOS — the script fails fast with an explicit error; do not attempt fallback OCR (tesseract accuracy for Chinese is significantly lower).
  • NEVER put zh-Hant before zh-Hans in the languages list for Simplified Chinese documents — Vision uses the first language as the primary for character disambiguation; wrong ordering causes Simplified characters to be interpreted as Traditional variants, producing incorrect output on ambiguous glyphs.

Before Running — Expert Pre-flight

Before invoking OCR, ask yourself:

  • Format: Is this image JPEG/PNG/HEIC/TIFF/BMP/GIF? WebP and SVG must be converted first with sips.
  • Density: Is the text Chinese-heavy, handwritten, or in a dense layout? If yes → accurate is mandatory, not optional.
  • Path: Is the path local and absolute (or ~/-prefixed)? HTTP paths and relative paths without context will silently fail or error.
  • Environment: The skill manages dependencies through uv. No manual pip install needed — run.ts invokes uv run --project <skillRoot> which auto-resolves dependencies. If the environment is missing or stale, run uv sync --project <skillRoot> once.

Required Constraints

  • Run on macOS only — Vision.framework is not available on Linux or Windows.
  • Default recognition languages: zh-Hans, zh-Hant, en.
  • Default recognition level: accurate — required for dense Chinese text; fast is ~10× faster but drops strokes on complex CJK layouts.
  • Input must be a local file path — Vision.framework uses a file URL internally.

Recognition Level Decision

ScenarioUse
Chinese text, mixed scripts, handwriting, dense layoutsaccurate (default)
English-only, printed text, speed matters more than accuracyfast

Supported Image Formats

Vision.framework accepts: JPEG, PNG, HEIC/HEIF, TIFF, BMP, GIF (first frame only).

Does NOT accept: WebP, SVG, raw camera formats.

If input is WebP or SVG, convert first:

sips -s format png input.webp --out input.png

After OCR completes, delete the converted file immediately — it is a temporary artifact. Only the original image and final bundle files should remain.

Runtime Inputs

Required: image_path — absolute or ~/-relative path to a local image file. Optional:

  • output_text — path to write OCR result; stdout only if omitted.
  • languages — comma-separated BCP-47 codes (default: zh-Hans,zh-Hant,en).
  • recognition_levelaccurate (default) or fast.

Clipsmith Bundle Normalization

The OCR runner extracts text to stdout or output_text. Before finalizing a Clipsmith capture job, run the raw-output-to-capture.json normalization step by creating a bundle directory containing:

  • ocr.md with the raw OCR text. This is mandatory when OCR text was produced.
  • post.md with the OCR text or source metadata for consumers that expect a post-like primary file.
  • summary.md.
  • The original OCR image as a separate file when it should be preserved.
  • capture.json with schema clipsmith.capture_bundle.v1, platform image-ocr, the local source path, content_files entries for summary.md, post.md, and ocr.md with kind: "ocr-text", assets entries only for OCR image files with kind ocr-image, warnings, and status.

Run clipsmith validate-bundle "<bundle_dir>" --json before finalizing.

Execution

cd /Users/kingsonwu/programming/OctopusGarage/clipsmith/skills/clipsmith-ocr
npx tsx scripts/run.ts \
  --image_path "/path/to/image.jpg" \
  [--output_text "/path/to/result.txt"] \
  [--languages "zh-Hans,zh-Hant,en"] \
  [--recognition_level accurate]

The wrapper invokes uv run --project <skillRoot> python scripts/ocr-image-macos.py internally. uv creates or reuses the skill environment and installs pyobjc from pyproject.toml when needed. Never call ocr-image-macos.py directly.

To use the full skill root path:

SKILL=/Users/kingsonwu/programming/OctopusGarage/clipsmith/skills/clipsmith-ocr
npx tsx "$SKILL/scripts/run.ts" --image_path "/path/to/image.jpg"

Failure Modes and Remedies

SymptomLikely CauseRemedy
Empty output, no errorImage below ~64×64 px, wrong format, low contrastUpscale or convert; verify format is in supported list
Missing macOS Vision bridge dependenciesuv environment missing or staleRun uv sync --project <skillRoot>never pip install system-wide
Image file not foundPath wrong or ~ not expandedUse absolute path; script calls expanduser() automatically
Vision request execution failedCorrupted image fileVerify file opens in Preview; try re-exporting
Garbled or merged linesLow-DPI scan or rotated imageIncrease DPI or rotate to upright before OCR
Script fails before OCR (import error, module not found)Called python3 directly instead of via run.tsAlways use npx tsx <skillRoot>/scripts/run.ts; or uv sync --project <skillRoot> if the uv environment is missing

Resources

FilePurpose
references/architecture.mdStrategy layer: stage model, fallback order, quality gates, edge cases
scripts/ocr-image-macos.pyCore OCR implementation via Vision.framework
scripts/run.tsExecution entry point (input parsing, delegation)

MANDATORY — load references/architecture.md when:

  • OCR returns empty output and the cause is unclear
  • Input format is unsupported or needs conversion
  • You need the fallback order, stage model, or known edge case handling (HEIC, GIF, PDF, rotated images)

Do NOT load references/architecture.md for standard successful runs — the information above is sufficient.

Success Criteria

A run is successful only when all conditions hold:

  1. Script validates runtime is macOS.
  2. Input image exists, is readable, and has a supported format.
  3. Vision request completes without API error.
  4. OCR text is printed to stdout (may be empty if image contains no recognizable text).
  5. If output_text is provided, text file is written successfully.

What ships with it: 8 files

15.4 KB alongside SKILL.md, 2 of them executable

agents/

references/

scripts/

Gives 0 of the 12 instructions most pdf office docs skills give in ~1.9k tokens

Counted across 636 of the 690 authors here whose files we hold, read 2026-08-07

  • Extract text or tables using pdfplumber or pdftotextin 89 of 636, across 23 files
  • Create new PDFs using reportlabin 83 of 636, across 16 files
  • Read forms.md before filling out PDF formsin 80 of 636, across 13 files
  • OCR scanned PDFs using pytesseract and pdf2imagein 77 of 636, across 10 files
  • Use qpdf to merge or split PDFs or large filesin 70 of 636, across 3 files
  • Use Excel formulas instead of hardcoded calculated values or Python calculationsin 68 of 636, across 13 files
  • Unpack, edit, and repack XML for existing documents or presentationsin 63 of 636, across 8 files
  • Document sources for all hardcoded valuesin 61 of 636, across 9 files
  • Write minimal, concise Python code without unnecessary commentsin 59 of 636, across 7 files
  • Run the recalculation script (recalc.py) after adding or modifying formulasin 59 of 636, across 7 files
  • Fix all identified formula errors and recalculate before finishingin 58 of 636, across 6 files
  • Format years as text stringsin 57 of 636, across 5 files

Said here and by no other author read

  • invoke OCR via the TypeScript wrapper script
  • use accurate recognition level for Chinese-heavy images
  • place Simplified Chinese before Traditional in languages list
  • convert WebP and SVG images before OCR
  • delete temporary converted images after OCR completes
  • write raw OCR text to an ocr.md bundle file

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.

Keep looking

Skills are one crate of 326,144. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.