seivings 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- seivings-0.1.0/.claude-plugin/marketplace.json +14 -0
- seivings-0.1.0/.github/workflows/ci.yml +29 -0
- seivings-0.1.0/.github/workflows/release.yml +50 -0
- seivings-0.1.0/.gitignore +7 -0
- seivings-0.1.0/CONTRIBUTING.md +30 -0
- seivings-0.1.0/LICENSE.md +105 -0
- seivings-0.1.0/PKG-INFO +262 -0
- seivings-0.1.0/README.md +235 -0
- seivings-0.1.0/benchmarks/bench.py +125 -0
- seivings-0.1.0/benchmarks/whole_picture.py +152 -0
- seivings-0.1.0/plugin/.claude-plugin/plugin.json +8 -0
- seivings-0.1.0/plugin/hooks/hooks.json +17 -0
- seivings-0.1.0/pyproject.toml +47 -0
- seivings-0.1.0/src/seivings/__init__.py +7 -0
- seivings-0.1.0/src/seivings/__main__.py +3 -0
- seivings-0.1.0/src/seivings/cli.py +193 -0
- seivings-0.1.0/src/seivings/core.py +481 -0
- seivings-0.1.0/src/seivings/hook.py +161 -0
- seivings-0.1.0/src/seivings/mcp_server.py +65 -0
- seivings-0.1.0/src/seivings/ocr.py +566 -0
- seivings-0.1.0/src/seivings/tokens.py +96 -0
- seivings-0.1.0/src/seivings/transform.py +199 -0
- seivings-0.1.0/tests/conftest.py +15 -0
- seivings-0.1.0/tests/fixtures/chat.png +0 -0
- seivings-0.1.0/tests/fixtures/chat.txt +8 -0
- seivings-0.1.0/tests/fixtures/dashboard.png +0 -0
- seivings-0.1.0/tests/fixtures/dashboard.txt +14 -0
- seivings-0.1.0/tests/fixtures/form.png +0 -0
- seivings-0.1.0/tests/fixtures/form.txt +18 -0
- seivings-0.1.0/tests/fixtures/make_screenshots.js +46 -0
- seivings-0.1.0/tests/fixtures/settings.png +0 -0
- seivings-0.1.0/tests/fixtures/settings.txt +13 -0
- seivings-0.1.0/tests/pdfgen.py +51 -0
- seivings-0.1.0/tests/render.py +44 -0
- seivings-0.1.0/tests/test_convert.py +239 -0
- seivings-0.1.0/tests/test_hook.py +88 -0
- seivings-0.1.0/tests/test_mcp.py +42 -0
- seivings-0.1.0/tests/test_tokens.py +41 -0
- seivings-0.1.0/tests/test_transform.py +149 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "seivings",
|
|
3
|
+
"description": "Seivings: hand Claude compact text instead of screenshots, using far fewer tokens.",
|
|
4
|
+
"owner": {
|
|
5
|
+
"name": "Ismaelnrj"
|
|
6
|
+
},
|
|
7
|
+
"plugins": [
|
|
8
|
+
{
|
|
9
|
+
"name": "seivings",
|
|
10
|
+
"source": "./plugin",
|
|
11
|
+
"description": "When Claude reads a screenshot or image in your project, it gets compact text instead, using far fewer tokens."
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
test:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
python: ["3.10", "3.13"]
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
- uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: ${{ matrix.python }}
|
|
22
|
+
- name: Install Tesseract and test fonts
|
|
23
|
+
run: sudo apt-get update && sudo apt-get install -y tesseract-ocr fonts-dejavu-core
|
|
24
|
+
- name: Install Seivings
|
|
25
|
+
run: pip install -e ".[dev,mcp]"
|
|
26
|
+
- name: Test
|
|
27
|
+
run: pytest -q
|
|
28
|
+
- name: Benchmark
|
|
29
|
+
run: python benchmarks/bench.py
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# Publishes to PyPI when a GitHub release is published, using PyPI trusted
|
|
4
|
+
# publishing: no passwords or API tokens are stored anywhere. PyPI must list
|
|
5
|
+
# this repository, this file (release.yml) and the environment "pypi" as a
|
|
6
|
+
# trusted publisher for the project "seivings".
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
release:
|
|
10
|
+
types: [published]
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
build:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
- uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.13"
|
|
23
|
+
- name: Check the release tag matches the package version
|
|
24
|
+
run: |
|
|
25
|
+
version=$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')
|
|
26
|
+
if [ "${GITHUB_REF_NAME#v}" != "$version" ]; then
|
|
27
|
+
echo "Release tag $GITHUB_REF_NAME does not match version $version in pyproject.toml"
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
- name: Build
|
|
31
|
+
run: pip install build && python -m build
|
|
32
|
+
- uses: actions/upload-artifact@v4
|
|
33
|
+
with:
|
|
34
|
+
name: dist
|
|
35
|
+
path: dist/
|
|
36
|
+
|
|
37
|
+
publish:
|
|
38
|
+
needs: build
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
environment:
|
|
41
|
+
name: pypi
|
|
42
|
+
url: https://pypi.org/p/seivings
|
|
43
|
+
permissions:
|
|
44
|
+
id-token: write # lets PyPI verify this workflow; nothing else
|
|
45
|
+
steps:
|
|
46
|
+
- uses: actions/download-artifact@v4
|
|
47
|
+
with:
|
|
48
|
+
name: dist
|
|
49
|
+
path: dist/
|
|
50
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Contributing to Seivings
|
|
2
|
+
|
|
3
|
+
## Development setup
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
git clone https://github.com/Ismaelnrj/Seivings.git
|
|
7
|
+
cd Seivings
|
|
8
|
+
python -m venv .venv
|
|
9
|
+
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
10
|
+
pip install -e ".[dev,mcp]"
|
|
11
|
+
pytest
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
RapidOCR installs with pip. Tesseract is optional; the tests that cover it are skipped when it is missing. Tests never call the paid API: Claude engine tests use a fake client. To run the one live test, set `SEIVINGS_LIVE=1` and `ANTHROPIC_API_KEY`.
|
|
15
|
+
|
|
16
|
+
## Good first contributions
|
|
17
|
+
|
|
18
|
+
- A screenshot that Seivings reads badly, together with the text it should produce. Only share images you have the right to share and that contain nothing private.
|
|
19
|
+
- Accuracy improvements, measured with `python benchmarks/bench.py` (local engine, free) or `python benchmarks/whole_picture.py --run` (Claude engine, costs about $0.10) before and after your change.
|
|
20
|
+
- Support for more document formats.
|
|
21
|
+
|
|
22
|
+
## Pull requests
|
|
23
|
+
|
|
24
|
+
- Keep each pull request to one change, and add or update a test for it.
|
|
25
|
+
- Run `pytest` before opening it.
|
|
26
|
+
- Explain what changed and why in the description.
|
|
27
|
+
|
|
28
|
+
## Licensing of contributions
|
|
29
|
+
|
|
30
|
+
Seivings is licensed under FSL-1.1-ALv2 (see [LICENSE.md](LICENSE.md)). By submitting a contribution you confirm that you wrote it or otherwise have the right to submit it, and you agree that it is licensed under the same terms as the project, including the Apache 2.0 future license grant, and that the maintainer may distribute it under other license terms in the future.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-ALv2
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 Ismael Naranjo Morales
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
seivings-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: seivings
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Transform screenshots, scans, PDFs and documents into compact text or code that keeps the whole picture, so LLMs spend fewer tokens.
|
|
5
|
+
Project-URL: Homepage, https://github.com/Ismaelnrj/Seivings
|
|
6
|
+
Project-URL: Issues, https://github.com/Ismaelnrj/Seivings/issues
|
|
7
|
+
Author: Ismaelnrj
|
|
8
|
+
License-Expression: FSL-1.1-ALv2
|
|
9
|
+
License-File: LICENSE.md
|
|
10
|
+
Keywords: claude,llm,mcp,ocr,pdf,screenshot,tokens
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Image Recognition
|
|
15
|
+
Classifier: Topic :: Text Processing
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Requires-Dist: anthropic>=2.14
|
|
18
|
+
Requires-Dist: onnxruntime>=1.18
|
|
19
|
+
Requires-Dist: pillow>=10.1
|
|
20
|
+
Requires-Dist: pypdfium2>=4.30
|
|
21
|
+
Requires-Dist: rapidocr>=3.10
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
24
|
+
Provides-Extra: mcp
|
|
25
|
+
Requires-Dist: mcp<3,>=2; extra == 'mcp'
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# Seivings
|
|
29
|
+
|
|
30
|
+
**Transform screenshots, scans, PDFs and documents into compact text or code that keeps the whole picture, so AI models spend fewer tokens reading them.**
|
|
31
|
+
|
|
32
|
+
Plain OCR only gives you the words. Seivings also keeps what the words alone miss: which toggle is on, who wrote each chat message, the numbers behind a chart, the arrows in a diagram. Every image becomes the most compact format that fits it:
|
|
33
|
+
|
|
34
|
+
| The image shows | Seivings writes |
|
|
35
|
+
|---|---|
|
|
36
|
+
| Code | The code itself, with exact indentation |
|
|
37
|
+
| A chart | Python: the data, plus a short matplotlib snippet that redraws it |
|
|
38
|
+
| A diagram or flowchart | Mermaid |
|
|
39
|
+
| A table | Markdown table |
|
|
40
|
+
| An app or web UI | An indented outline with on screen text in quotes and state in brackets |
|
|
41
|
+
| A document page | Markdown with headings, lists and tables |
|
|
42
|
+
| A terminal or log | The text exactly as shown |
|
|
43
|
+
|
|
44
|
+
For example, a settings screenshot becomes:
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
card "Notification settings"
|
|
48
|
+
"Choose how and when we contact you."
|
|
49
|
+
toggle "Email alerts" [on]: "Get an email when a build fails."
|
|
50
|
+
toggle "Weekly digest" [off]: "A summary of activity every Monday at 9:00."
|
|
51
|
+
toggle "Mentions" [on]: "Notify me when someone mentions @me in a comment."
|
|
52
|
+
toggle "Marketing" [off]: "Product news and offers. You can unsubscribe at any time."
|
|
53
|
+
button "Save changes" (dark)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
That is about 120 tokens instead of 1,196 for the image, and the reader still knows which settings are on. OCR text alone cannot tell you that. (This example shows the format; the whole picture benchmark below measures real transforms.)
|
|
57
|
+
|
|
58
|
+
## Two engines
|
|
59
|
+
|
|
60
|
+
| | `claude` (default when a key is set) | `local` |
|
|
61
|
+
|---|---|---|
|
|
62
|
+
| What it keeps | The whole picture: text, layout, state, chart data, diagrams | The words, in reading order, with code indentation |
|
|
63
|
+
| How | A Claude vision model transforms the image once, then local OCR fact checks every on screen text | OCR on your machine (RapidOCR, or Tesseract) |
|
|
64
|
+
| Cost | Your Anthropic API usage, see below | Free |
|
|
65
|
+
| Privacy | The image is sent to Anthropic | Nothing leaves your machine |
|
|
66
|
+
|
|
67
|
+
`auto` (the default) uses `claude` when `ANTHROPIC_API_KEY` is set and `local` otherwise. If a Claude call fails (network, refusal, bad key), Seivings falls back to local OCR and says so.
|
|
68
|
+
|
|
69
|
+
### What a transform costs
|
|
70
|
+
|
|
71
|
+
For one full HD screenshot (2,691 image tokens), when the model doing the real work is Claude Opus 5.5:
|
|
72
|
+
|
|
73
|
+
| Transform model | Transform cost | Opus reads the text | Total | vs Opus reading the image ($0.0108) |
|
|
74
|
+
|---|---:|---:|---:|---|
|
|
75
|
+
| `claude-haiku-5-5` | $0.0005 | $0.0016 | $0.0021 | 81% cheaper |
|
|
76
|
+
| `claude-sonnet-5-5` (default) | $0.0094 | $0.0016 | $0.0110 | About the same, but about 85% less context used |
|
|
77
|
+
| `claude-opus-5-5` | $0.0188 | $0.0016 | $0.0204 | 89% more expensive for one use |
|
|
78
|
+
|
|
79
|
+
Every transform saves context space, which matters most in long agent sessions where an image is carried through every turn. Saving money on a single read needs a cheaper transform model than the reader, so pass `--model claude-haiku-5-5` when cost matters more than accuracy on complex images. Seivings prints the exact cost of each transform from the API's usage report.
|
|
80
|
+
|
|
81
|
+
### The fact check
|
|
82
|
+
|
|
83
|
+
A transform can invent details, and the model reading it never sees the image to notice. So after every transform Seivings runs local OCR and checks each on screen text in the output against what OCR found. If more than 15% cannot be confirmed, the verdict becomes `review` and the unconfirmed texts are listed.
|
|
84
|
+
|
|
85
|
+
## Install
|
|
86
|
+
|
|
87
|
+
Python 3.10 or newer. No system packages are needed.
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
pip install seivings
|
|
91
|
+
|
|
92
|
+
# with the MCP server for AI agents
|
|
93
|
+
pip install "seivings[mcp]"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
For the `claude` engine, set your key: `export ANTHROPIC_API_KEY=...`.
|
|
97
|
+
|
|
98
|
+
Local OCR uses RapidOCR, whose English models are bundled (about 380 MB installed, mostly numpy, OpenCV and the ONNX runtime). For other languages, install [Tesseract](https://github.com/tesseract-ocr/tesseract) with your language pack and pass `--lang spa` (or `--lang eng+spa`); Seivings then uses Tesseract automatically.
|
|
99
|
+
|
|
100
|
+
## Usage
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
seivings screenshot.png # transformed text to stdout, summary to stderr
|
|
104
|
+
seivings --engine local shot.png # never send the image anywhere
|
|
105
|
+
seivings --model claude-haiku-5-5 shot.png # cheapest Claude transform
|
|
106
|
+
seivings report.pdf -o out/ # writes out/report.pdf.txt
|
|
107
|
+
seivings docs/ --json # every supported file in a folder, as JSON
|
|
108
|
+
seivings --clipboard | pbcopy # the image on your clipboard (macOS)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The text goes to stdout and the summary goes to stderr, so you can pipe the text anywhere. A summary looks like this (example numbers):
|
|
112
|
+
|
|
113
|
+
```text
|
|
114
|
+
settings.png | original ~1,196 tok | text ~117 tok | saved 90% | as ui | engine claude-sonnet-5-5 $0.0056 | verified 100% | verdict: use_text
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Options: `--engine auto|claude|local`, `--model`, `--effort low|medium|high` (default `low`), `--mode auto|text|code` (layout hint), `--ocr auto|rapidocr|tesseract`, `--tier high|standard` (image pricing tier for the estimate), `--fence LANG`, `-q`. The engine and model can also come from `SEIVINGS_ENGINE` and `SEIVINGS_MODEL`.
|
|
118
|
+
|
|
119
|
+
### Verdicts
|
|
120
|
+
|
|
121
|
+
| Verdict | Meaning | What to do |
|
|
122
|
+
|---|---|---|
|
|
123
|
+
| `use_text` | The text is cheaper, and it was confirmed (or OCR was confident). | Send the text. |
|
|
124
|
+
| `review` | Unconfirmed on screen text, a photo described in words, low OCR confidence, or (local engine) charts the text cannot carry. | Check the notes before trusting it. |
|
|
125
|
+
| `keep_original` | Nothing readable, or the text costs as much as the image. | Send the original. |
|
|
126
|
+
|
|
127
|
+
### Python
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
from seivings import convert
|
|
131
|
+
|
|
132
|
+
result = convert("dashboard.png") # also .pdf and .docx
|
|
133
|
+
print(result.text) # e.g. Python that redraws the chart
|
|
134
|
+
print(result.content_kind, result.verdict, result.saved_pct, result.transform_cost_usd)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Use with AI agents
|
|
138
|
+
|
|
139
|
+
### Claude Code plugin (automatic)
|
|
140
|
+
|
|
141
|
+
When Claude reads a screenshot or image in your project, it gets the Seivings text instead, with no action from you.
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
pipx install seivings # puts the seivings-hook command on your PATH
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Then, in Claude Code:
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
/plugin install seivings --marketplace Ismaelnrj/Seivings
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
On older Claude Code versions: `claude plugin marketplace add Ismaelnrj/Seivings`, then `claude plugin install seivings@seivings`.
|
|
154
|
+
|
|
155
|
+
How it behaves:
|
|
156
|
+
|
|
157
|
+
- Only images inside the project folder are converted, and only when the verdict is `use_text`. Everything else reaches Claude unchanged.
|
|
158
|
+
- The text starts with a note saying it replaced an image. If Claude needs the pixels, it reads the same file again and gets the original.
|
|
159
|
+
- Conversions are cached by file content, so each screenshot is converted (and paid for) once.
|
|
160
|
+
- It uses the Claude engine when `ANTHROPIC_API_KEY` is set where Claude Code runs, otherwise local OCR.
|
|
161
|
+
- Images pasted straight into the chat are not files, so the plugin cannot see them. Save them into the project, or run `seivings --clipboard`.
|
|
162
|
+
- `SEIVINGS_HOOK=off` turns it off.
|
|
163
|
+
|
|
164
|
+
### Any coding agent
|
|
165
|
+
|
|
166
|
+
Add this to your project's `CLAUDE.md` (or your agent's instructions file):
|
|
167
|
+
|
|
168
|
+
```markdown
|
|
169
|
+
## Reading images and PDFs
|
|
170
|
+
Before opening a screenshot, scanned page or PDF, run `seivings <file>`.
|
|
171
|
+
Use its text when the verdict is use_text. Open the original only when the
|
|
172
|
+
verdict is review or keep_original, or when you need exact colors or pixels.
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### MCP server
|
|
176
|
+
|
|
177
|
+
Claude Code:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
claude mcp add seivings -- seivings-mcp
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Claude Desktop and other MCP clients:
|
|
184
|
+
|
|
185
|
+
```json
|
|
186
|
+
{
|
|
187
|
+
"mcpServers": {
|
|
188
|
+
"seivings": { "command": "seivings-mcp", "env": { "ANTHROPIC_API_KEY": "your key" } }
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
The server exposes one tool, `read_as_text(path, mode)`. It only opens supported image, PDF and .docx files, so it cannot be used to read arbitrary files such as keys or configs.
|
|
194
|
+
|
|
195
|
+
## Benchmarks
|
|
196
|
+
|
|
197
|
+
### Local OCR on real browser screenshots
|
|
198
|
+
|
|
199
|
+
Screenshots of a chat app, a dashboard and a settings page, rendered by Chromium ([`tests/fixtures`](tests/fixtures)), scored against the exact page text:
|
|
200
|
+
|
|
201
|
+
| Engine | Words missed or wrong | Code lines wrong (114 lines) |
|
|
202
|
+
|---|---:|---:|
|
|
203
|
+
| Tesseract | 9.1% | 20 |
|
|
204
|
+
| RapidOCR (default) | 1.5% | 7 |
|
|
205
|
+
|
|
206
|
+
### Token savings with the local engine
|
|
207
|
+
|
|
208
|
+
From [`benchmarks/bench.py`](benchmarks/bench.py), on synthetic renders (cleaner than real screenshots, so read accuracy as a best case):
|
|
209
|
+
|
|
210
|
+
| Input | As image/PDF | As text | Saved | Text accuracy | Verdict |
|
|
211
|
+
|---|---:|---:|---:|---:|---|
|
|
212
|
+
| Code, retina editor window (1600x1000, dark) | 2,088 | 180 | 91% | 100.0% | `use_text` |
|
|
213
|
+
| Docs page, full HD screenshot (1920x1080) | 2,691 | 168 | 94% | 100.0% | `use_text` |
|
|
214
|
+
| Phone screenshot (1170x2532) | 3,822 | 167 | 96% | 100.0% | `use_text` |
|
|
215
|
+
| Tight 1x crop of a paragraph | 133 | 168 | n/a | 100.0% | `keep_original` |
|
|
216
|
+
| Bar chart, no text | 2,088 | 0 | n/a | n/a | `keep_original` |
|
|
217
|
+
| 10 page text PDF (Letter) | 23,320 | 8,386 | 64% | 100.0% (text layer) | `use_text` |
|
|
218
|
+
| 1 page scanned PDF | 1,496 | 167 | 89% | 99.9% | `use_text` |
|
|
219
|
+
|
|
220
|
+
### Whole picture: does the reader still get it right?
|
|
221
|
+
|
|
222
|
+
[`benchmarks/whole_picture.py`](benchmarks/whole_picture.py) asks a reader model 10 questions about four real screenshots, three ways: with the image, with the Seivings transform, and with local OCR text only. Several questions can only be answered from visuals (which toggles are on, how many bars, bar or line chart, which form field is still empty). It reports accuracy and the reader's exact input tokens.
|
|
223
|
+
|
|
224
|
+
**Not run yet.** It needs an API key and costs about $0.15: `python benchmarks/whole_picture.py --run`. This is the number that decides whether transforms are good enough, and it belongs in this table once measured.
|
|
225
|
+
|
|
226
|
+
## How the numbers are estimated
|
|
227
|
+
|
|
228
|
+
- **Images**: `ceil(width / 28) * ceil(height / 28)` tokens, after the same downscaling Claude applies (2,576 px and 4,784 tokens at most on Claude 4.7 and later; 1,568 px and 1,568 tokens on older models). Source: [Anthropic vision docs](https://platform.claude.com/docs/en/build-with-claude/vision).
|
|
229
|
+
- **PDFs**: each page costs its page image (1,568 tokens at most) plus its extracted text. Source: [Anthropic PDF docs](https://platform.claude.com/docs/en/build-with-claude/pdf-support).
|
|
230
|
+
- **Text**: characters divided by 3.5, chosen to overestimate, so real savings are usually a little higher.
|
|
231
|
+
- **Transform cost**: exact input and output tokens from the API, times list prices (November 2026).
|
|
232
|
+
|
|
233
|
+
## Limitations
|
|
234
|
+
|
|
235
|
+
- Transforms can still miss or misread details; the fact check catches invented text, not wrong colors or miscounted bars. Read the notes on `review` verdicts.
|
|
236
|
+
- Chart values that are not printed on the chart are estimates, marked `# estimated`.
|
|
237
|
+
- The local engine only recovers words: it cannot see which toggle is on or what a chart shows.
|
|
238
|
+
- Scanned PDF pages are transformed; PDF pages with a text layer use that text, so their pictures are not described yet.
|
|
239
|
+
- Images embedded inside .docx files are not converted yet.
|
|
240
|
+
|
|
241
|
+
## License
|
|
242
|
+
|
|
243
|
+
Seivings is **source available** under the [Functional Source License 1.1, Apache 2.0 Future License](LICENSE.md) (FSL-1.1-ALv2).
|
|
244
|
+
|
|
245
|
+
- **You can** use it for free, at home or at work, read and change the code, share copies, and contribute.
|
|
246
|
+
- **You cannot** offer Seivings, or a product with the same or substantially similar functionality, as a commercial product or service that competes with it.
|
|
247
|
+
- **Two years after each release**, that release becomes available under the Apache License 2.0.
|
|
248
|
+
- **The Seivings name** is not licensed for use by others.
|
|
249
|
+
|
|
250
|
+
This summary is not legal advice; [LICENSE.md](LICENSE.md) is the binding text.
|
|
251
|
+
|
|
252
|
+
## Contributing
|
|
253
|
+
|
|
254
|
+
Bug reports with a sample image (where you can share one) help the most. See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
255
|
+
|
|
256
|
+
## Roadmap
|
|
257
|
+
|
|
258
|
+
- Run and publish the whole picture benchmark.
|
|
259
|
+
- PDFs through the Claude Code plugin, not only images.
|
|
260
|
+
- A shrunk image option for pictures where words cannot carry the meaning.
|
|
261
|
+
- Transform the pictures inside text layer PDF pages and .docx files.
|
|
262
|
+
- Batch processing of whole folders through the Message Batches API, at half the price.
|