skimproof 0.8.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.
- skimproof-0.8.0/.gitignore +12 -0
- skimproof-0.8.0/LICENSE +21 -0
- skimproof-0.8.0/PKG-INFO +184 -0
- skimproof-0.8.0/README.md +155 -0
- skimproof-0.8.0/pyproject.toml +63 -0
- skimproof-0.8.0/src/skimproof/__init__.py +8 -0
- skimproof-0.8.0/src/skimproof/__main__.py +3 -0
- skimproof-0.8.0/src/skimproof/api.py +258 -0
- skimproof-0.8.0/src/skimproof/assets/brief.css +56 -0
- skimproof-0.8.0/src/skimproof/assets/brief.js +98 -0
- skimproof-0.8.0/src/skimproof/bundle.py +346 -0
- skimproof-0.8.0/src/skimproof/checks.py +750 -0
- skimproof-0.8.0/src/skimproof/cli.py +144 -0
- skimproof-0.8.0/src/skimproof/figures.py +130 -0
- skimproof-0.8.0/src/skimproof/ingest.py +642 -0
- skimproof-0.8.0/src/skimproof/layout.py +349 -0
- skimproof-0.8.0/src/skimproof/links.py +77 -0
- skimproof-0.8.0/src/skimproof/ocr.py +148 -0
- skimproof-0.8.0/src/skimproof/page.js +230 -0
- skimproof-0.8.0/src/skimproof/plan.py +216 -0
- skimproof-0.8.0/src/skimproof/py.typed +0 -0
- skimproof-0.8.0/src/skimproof/render.py +443 -0
- skimproof-0.8.0/src/skimproof/text.py +150 -0
- skimproof-0.8.0/src/skimproof/vendor/copy-as-markdown.LICENSE +21 -0
- skimproof-0.8.0/src/skimproof/vendor/copy-as-markdown.js +28394 -0
- skimproof-0.8.0/src/skimproof/verify.py +123 -0
skimproof-0.8.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bruno Volpato
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
skimproof-0.8.0/PKG-INFO
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: skimproof
|
|
3
|
+
Version: 0.8.0
|
|
4
|
+
Summary: Condense long technical reading into a brief that keeps its proof: every sentence is anchored, every omission is listed.
|
|
5
|
+
Project-URL: Homepage, https://bvolpato.github.io/skimproof/
|
|
6
|
+
Project-URL: Repository, https://github.com/bvolpato/skimproof
|
|
7
|
+
Author: Bruno Volpato
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
License-File: src/skimproof/vendor/copy-as-markdown.LICENSE
|
|
11
|
+
Keywords: agents,citations,figures,grounding,llm,reading,skills,summarization
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Topic :: Text Processing
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Python: >=3.12
|
|
20
|
+
Requires-Dist: markdown-it-py<5,>=3.0
|
|
21
|
+
Requires-Dist: pillow>=11
|
|
22
|
+
Requires-Dist: playwright>=1.50
|
|
23
|
+
Requires-Dist: pypdfium2>=4.30
|
|
24
|
+
Provides-Extra: ocr
|
|
25
|
+
Requires-Dist: ocrmac>=1.0; (sys_platform == 'darwin') and extra == 'ocr'
|
|
26
|
+
Requires-Dist: onnxruntime>=1.20; extra == 'ocr'
|
|
27
|
+
Requires-Dist: rapidocr>=3.0; extra == 'ocr'
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
<p align="center">
|
|
31
|
+
<picture>
|
|
32
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/bvolpato/skimproof/main/assets/wordmark-dark.svg">
|
|
33
|
+
<img src="https://raw.githubusercontent.com/bvolpato/skimproof/main/assets/wordmark.svg" width="340" alt="skimproof">
|
|
34
|
+
</picture>
|
|
35
|
+
</p>
|
|
36
|
+
|
|
37
|
+
<p align="center"><strong>Skim the text. Keep the proof.</strong></p>
|
|
38
|
+
|
|
39
|
+
<p align="center">
|
|
40
|
+
<a href="https://bvolpato.github.io/skimproof/"><b>Site and live example</b></a> ·
|
|
41
|
+
<a href="https://github.com/bvolpato/skimproof/blob/main/evals/RESULTS.md">Results</a> ·
|
|
42
|
+
<a href="https://github.com/bvolpato/skimproof/blob/main/docs/RESEARCH.md">Research</a>
|
|
43
|
+
</p>
|
|
44
|
+
|
|
45
|
+
Give your coding agent a long article, a paper, a PDF, or a folder of documents. You get one short page in which **each statement shows the source sentences that it rests on, word for word**, and everything that was left out is listed.
|
|
46
|
+
|
|
47
|
+
<p align="center">
|
|
48
|
+
<a href="https://bvolpato.github.io/skimproof/#example"><img src="https://raw.githubusercontent.com/bvolpato/skimproof/main/assets/example.png" width="820" alt="A source on the left and its brief on the right. Two threads join a limit in the brief to the source sentences that it rests on, with the verdict of an independent reader below."></a>
|
|
49
|
+
</p>
|
|
50
|
+
|
|
51
|
+
## Use it
|
|
52
|
+
|
|
53
|
+
Install the skill one time:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Claude Code
|
|
57
|
+
claude plugin marketplace add bvolpato/skimproof && claude plugin install skimproof@skimproof
|
|
58
|
+
|
|
59
|
+
# Other agents: copy the skill folder
|
|
60
|
+
git clone https://github.com/bvolpato/skimproof && cp -R skimproof/skills/skimproof ~/.agents/skills/
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Then ask your agent:
|
|
64
|
+
|
|
65
|
+
> Skim https://example.com/long-article
|
|
66
|
+
|
|
67
|
+
That is all that you type. Several links or a folder become one brief. To choose where it goes, say so: "Skim https://example.com/long-article into ~/skims/article". The skill needs [uv](https://docs.astral.sh/uv/), and the first run downloads a headless Chromium.
|
|
68
|
+
|
|
69
|
+
## What happens, and when the LLM runs
|
|
70
|
+
|
|
71
|
+
| | Step | Who | LLM |
|
|
72
|
+
|---|---|---|---|
|
|
73
|
+
| 1 | `skimproof capture <link> -o <folder>` saves the text with a number for each sentence, keeps the figures, and writes `task.md` | script | no |
|
|
74
|
+
| 2 | The agent follows `task.md`: it reads `read.md` one time, and writes `brief.md` | **your agent** | **yes** |
|
|
75
|
+
| 3 | `skimproof build <folder>` checks each statement against its quotes, and writes `brief.html` | script | no |
|
|
76
|
+
|
|
77
|
+
Your agent runs both commands, with the same folder. The folder is the bundle: it holds the text, the figures, the task, and the brief. Without `-o`, `capture` makes one from the last part of the first link or file name, in the current directory: `long-article.skim`. It does not replace a bundle unless you add `--force`, and then it keeps the old one as `<folder>.old`.
|
|
78
|
+
|
|
79
|
+
**skimproof never calls a model**: it has no API key and no model setting. The LLM is the agent that you already use, for example Claude Code, Codex, or Cursor. If step 3 finds an error, the same agent repairs `brief.md`.
|
|
80
|
+
|
|
81
|
+
Step 2 uses one agent or more, by the size of the source. `capture` decides, and prints it:
|
|
82
|
+
|
|
83
|
+
| Source | Who reads | Task files |
|
|
84
|
+
|---|---|---|
|
|
85
|
+
| Up to about 3,000 words | The agent that you talk with | `task.md` |
|
|
86
|
+
| Up to about 25,000 words | One more agent, so that the text does not fill your conversation | `task.md` |
|
|
87
|
+
| Larger | One reader for each 18,000 words or so, at the same time, and then one editor | `parts/01.task.md`, ..., then `task.md` |
|
|
88
|
+
| You ask for a second opinion | One fresh agent that sees only the statements and their quotes | `verify.d/01.md` |
|
|
89
|
+
|
|
90
|
+
Each task is a file, so you can read exactly what a model was told. An agent that supports no other agents follows the tasks itself, one after the other. In one run with version 0.5, six documents with 7,500 words took one agent 5.7 minutes and 82,000 tokens ([evals/QUICK.md](https://github.com/bvolpato/skimproof/blob/main/evals/QUICK.md)).
|
|
91
|
+
|
|
92
|
+
A brief is plain text. Each line ends with the numbers of its source sentences, and `f02` is a figure:
|
|
93
|
+
|
|
94
|
+
```markdown
|
|
95
|
+
# Title
|
|
96
|
+
## Answer
|
|
97
|
+
Median delay fell from 48 to 9 minutes in a 12-week trial of one harbor. [12 40-42]
|
|
98
|
+
Keep in mind: It was not tested in a storm. [88]
|
|
99
|
+

|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Use it from Python
|
|
103
|
+
|
|
104
|
+
The same two steps, and a function of yours in place of the agent:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
uv add "skimproof @ git+https://github.com/bvolpato/skimproof@v0.8.0"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
import anthropic
|
|
112
|
+
import skimproof
|
|
113
|
+
|
|
114
|
+
client = anthropic.Anthropic()
|
|
115
|
+
|
|
116
|
+
def llm(prompt: str) -> str: # any model: skimproof gives a prompt, and you return the reply
|
|
117
|
+
with client.messages.stream(model="claude-opus-5-5", max_tokens=32000, thinking={"type": "adaptive"}, messages=[{"role": "user", "content": prompt}]) as s:
|
|
118
|
+
m = s.get_final_message()
|
|
119
|
+
if m.stop_reason != "end_turn":
|
|
120
|
+
raise RuntimeError(m.stop_reason) # a brief that was cut off would look complete
|
|
121
|
+
return "".join(b.text for b in m.content if b.type == "text")
|
|
122
|
+
|
|
123
|
+
r = skimproof.skim("https://example.com/long-article", "article", llm=llm, purpose="an engineer who must decide")
|
|
124
|
+
print(r.page) # article/brief.html, or None if an error is left
|
|
125
|
+
for s in r.statements:
|
|
126
|
+
print(s.text, [q.text for q in s.quotes])
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`skim` is `capture`, the model calls, and `build`. If `build` finds errors, the model gets them one time to repair its brief. A repair that drops other statements is refused. For your own agents or your own control flow, use the parts:
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
b = skimproof.capture("https://example.com/long-article", "article-2") # no model
|
|
133
|
+
for task in b.tasks: # readers of a large source can run at the same time, and the last task writes the brief
|
|
134
|
+
task.save(llm(task.prompt)) # or: an agent with file tools follows task.file
|
|
135
|
+
r = skimproof.build(b) # no model
|
|
136
|
+
r.errors, r.warnings, r.statements, r.left_out
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
If a model call fails, the folder stays, and `skimproof.finish("article", llm=llm)` runs only the missing calls. Failures that you can act on raise `skimproof.SkimError`. For scanned pages and text in images, install `skimproof[ocr]`. A function that gets only text does not see the figures. An agent that follows `task.file` can open them.
|
|
140
|
+
|
|
141
|
+
## What the scripts check
|
|
142
|
+
|
|
143
|
+
- **Build stops** at a number or a unit that the quotes do not have, a lost bound such as "at least 93%", a line of a command that is not in the source, or a statement with no citation. There is no page until the agent repairs it.
|
|
144
|
+
- **Build warns** about a number word or a heading number that has no source, a lost negative, a lost qualifier, or a wider scope, and shows the strongest sentences that were left out. The agent decides.
|
|
145
|
+
- **The page shows** the quotes of each statement, contradictions, and every source sentence that the brief does not use.
|
|
146
|
+
- **Capture keeps** figures in their native format, with alt text, caption, drawn text, and OCR apart. A moving drawing is taken at its end state. PDFs, manual pages, and RFCs become chapters, lists, and code. Scanned pages are read with OCR. Formulas keep their TeX, or are rebuilt from how they are drawn.
|
|
147
|
+
|
|
148
|
+
The scripts cannot see a wrong actor or an added cause. For that, ask for a second opinion ([verify.md](https://github.com/bvolpato/skimproof/blob/main/skills/skimproof/references/verify.md)). To give a reason for each sentence that is left out, there is a slower [full proof](https://github.com/bvolpato/skimproof/blob/main/skills/skimproof/references/full.md).
|
|
149
|
+
|
|
150
|
+
## Evidence
|
|
151
|
+
|
|
152
|
+
These tests measured the full proof, which is optional, and not the fast default. Two tests on fresh public documents, planned and published before any brief existed ([evals/CONFIRM.md](https://github.com/bvolpato/skimproof/blob/main/evals/CONFIRM.md), [evals/confirm](https://github.com/bvolpato/skimproof/tree/main/evals/confirm)):
|
|
153
|
+
|
|
154
|
+
- **Coverage is kept.** Fresh readers answered 75.6% of 90 questions from a skimproof brief, from a one-shot brief, and from a brief that its writer reviewed. No text scored 0, and the full document scored 100.
|
|
155
|
+
- **Few errors.** 0 errors in about 110 sentences, against 2 for one-shot and 1 for self-review. The auditors found 96% of errors that were planted on purpose. The difference is too small to be meaningful, because all three were already clean.
|
|
156
|
+
- **Planted errors are fixed.** 24 of 24. A fresh reviewer without the tool also fixed 24 of 24.
|
|
157
|
+
|
|
158
|
+
So a skimproof brief is as complete and as accurate as a careful fresh review, at about four times the cost. It is not a better editor. What it adds is a record that a person can check: the quotes behind each sentence, a verdict for each sentence, and everything that was left out. One model family, three documents, and model readers instead of people. Earlier designs, and why they changed, are in [evals/RESULTS.md](https://github.com/bvolpato/skimproof/blob/main/evals/RESULTS.md). The [research page](https://github.com/bvolpato/skimproof/blob/main/docs/RESEARCH.md) gives the source of each rule and what it does not show.
|
|
159
|
+
|
|
160
|
+
## Wikis and fetch tools
|
|
161
|
+
|
|
162
|
+
Text from a wiki, a fetch tool, or an MCP server goes in a folder, with a title, a link, a group, and a date in front matter. [sources.md](https://github.com/bvolpato/skimproof/blob/main/skills/skimproof/references/sources.md) has the format and the checks for lost images. For Confluence, `skills/skimproof/scripts/confluence-pages` saves pages, the pages below them, and their images.
|
|
163
|
+
|
|
164
|
+
## Development
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
uv sync --locked --group dev --config-file uv.toml
|
|
168
|
+
uv run --config-file uv.toml pytest -q
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Lock with `uv lock --config-file uv.toml`. A plain `uv lock` can copy settings from your own uv config into the lockfile.
|
|
172
|
+
|
|
173
|
+
## Privacy
|
|
174
|
+
|
|
175
|
+
The tool stores nothing outside the bundle directory. Capture uses a browser on your machine and downloads only the page and its images. The saved source and `brief.html` have local file names and no local paths. The task files have the path of the bundle, so share `brief.html` and not the folder. Your agent decides where the text goes, so use it with documents that your model provider may see.
|
|
176
|
+
|
|
177
|
+
## Limits
|
|
178
|
+
|
|
179
|
+
- Text and images only. A table drawn as an image is read by OCR, not as rows. OCR makes mistakes, so look at the page before you use a number from a scan. Audio and video files are not read.
|
|
180
|
+
- Capture runs page scripts, so do not point it at a page that you would not open.
|
|
181
|
+
- The checks prove form. A verdict from a model is evidence, not proof.
|
|
182
|
+
- No second reader runs unless you ask. The full proof costs about 5 times a one-shot brief.
|
|
183
|
+
|
|
184
|
+
MIT license. The bundled `copy-as-markdown` library is MIT, see `src/skimproof/vendor`.
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/bvolpato/skimproof/main/assets/wordmark-dark.svg">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/bvolpato/skimproof/main/assets/wordmark.svg" width="340" alt="skimproof">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<p align="center"><strong>Skim the text. Keep the proof.</strong></p>
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
<a href="https://bvolpato.github.io/skimproof/"><b>Site and live example</b></a> ·
|
|
12
|
+
<a href="https://github.com/bvolpato/skimproof/blob/main/evals/RESULTS.md">Results</a> ·
|
|
13
|
+
<a href="https://github.com/bvolpato/skimproof/blob/main/docs/RESEARCH.md">Research</a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
Give your coding agent a long article, a paper, a PDF, or a folder of documents. You get one short page in which **each statement shows the source sentences that it rests on, word for word**, and everything that was left out is listed.
|
|
17
|
+
|
|
18
|
+
<p align="center">
|
|
19
|
+
<a href="https://bvolpato.github.io/skimproof/#example"><img src="https://raw.githubusercontent.com/bvolpato/skimproof/main/assets/example.png" width="820" alt="A source on the left and its brief on the right. Two threads join a limit in the brief to the source sentences that it rests on, with the verdict of an independent reader below."></a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
## Use it
|
|
23
|
+
|
|
24
|
+
Install the skill one time:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Claude Code
|
|
28
|
+
claude plugin marketplace add bvolpato/skimproof && claude plugin install skimproof@skimproof
|
|
29
|
+
|
|
30
|
+
# Other agents: copy the skill folder
|
|
31
|
+
git clone https://github.com/bvolpato/skimproof && cp -R skimproof/skills/skimproof ~/.agents/skills/
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Then ask your agent:
|
|
35
|
+
|
|
36
|
+
> Skim https://example.com/long-article
|
|
37
|
+
|
|
38
|
+
That is all that you type. Several links or a folder become one brief. To choose where it goes, say so: "Skim https://example.com/long-article into ~/skims/article". The skill needs [uv](https://docs.astral.sh/uv/), and the first run downloads a headless Chromium.
|
|
39
|
+
|
|
40
|
+
## What happens, and when the LLM runs
|
|
41
|
+
|
|
42
|
+
| | Step | Who | LLM |
|
|
43
|
+
|---|---|---|---|
|
|
44
|
+
| 1 | `skimproof capture <link> -o <folder>` saves the text with a number for each sentence, keeps the figures, and writes `task.md` | script | no |
|
|
45
|
+
| 2 | The agent follows `task.md`: it reads `read.md` one time, and writes `brief.md` | **your agent** | **yes** |
|
|
46
|
+
| 3 | `skimproof build <folder>` checks each statement against its quotes, and writes `brief.html` | script | no |
|
|
47
|
+
|
|
48
|
+
Your agent runs both commands, with the same folder. The folder is the bundle: it holds the text, the figures, the task, and the brief. Without `-o`, `capture` makes one from the last part of the first link or file name, in the current directory: `long-article.skim`. It does not replace a bundle unless you add `--force`, and then it keeps the old one as `<folder>.old`.
|
|
49
|
+
|
|
50
|
+
**skimproof never calls a model**: it has no API key and no model setting. The LLM is the agent that you already use, for example Claude Code, Codex, or Cursor. If step 3 finds an error, the same agent repairs `brief.md`.
|
|
51
|
+
|
|
52
|
+
Step 2 uses one agent or more, by the size of the source. `capture` decides, and prints it:
|
|
53
|
+
|
|
54
|
+
| Source | Who reads | Task files |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| Up to about 3,000 words | The agent that you talk with | `task.md` |
|
|
57
|
+
| Up to about 25,000 words | One more agent, so that the text does not fill your conversation | `task.md` |
|
|
58
|
+
| Larger | One reader for each 18,000 words or so, at the same time, and then one editor | `parts/01.task.md`, ..., then `task.md` |
|
|
59
|
+
| You ask for a second opinion | One fresh agent that sees only the statements and their quotes | `verify.d/01.md` |
|
|
60
|
+
|
|
61
|
+
Each task is a file, so you can read exactly what a model was told. An agent that supports no other agents follows the tasks itself, one after the other. In one run with version 0.5, six documents with 7,500 words took one agent 5.7 minutes and 82,000 tokens ([evals/QUICK.md](https://github.com/bvolpato/skimproof/blob/main/evals/QUICK.md)).
|
|
62
|
+
|
|
63
|
+
A brief is plain text. Each line ends with the numbers of its source sentences, and `f02` is a figure:
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
# Title
|
|
67
|
+
## Answer
|
|
68
|
+
Median delay fell from 48 to 9 minutes in a 12-week trial of one harbor. [12 40-42]
|
|
69
|
+
Keep in mind: It was not tested in a storm. [88]
|
|
70
|
+

|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Use it from Python
|
|
74
|
+
|
|
75
|
+
The same two steps, and a function of yours in place of the agent:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
uv add "skimproof @ git+https://github.com/bvolpato/skimproof@v0.8.0"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
import anthropic
|
|
83
|
+
import skimproof
|
|
84
|
+
|
|
85
|
+
client = anthropic.Anthropic()
|
|
86
|
+
|
|
87
|
+
def llm(prompt: str) -> str: # any model: skimproof gives a prompt, and you return the reply
|
|
88
|
+
with client.messages.stream(model="claude-opus-5-5", max_tokens=32000, thinking={"type": "adaptive"}, messages=[{"role": "user", "content": prompt}]) as s:
|
|
89
|
+
m = s.get_final_message()
|
|
90
|
+
if m.stop_reason != "end_turn":
|
|
91
|
+
raise RuntimeError(m.stop_reason) # a brief that was cut off would look complete
|
|
92
|
+
return "".join(b.text for b in m.content if b.type == "text")
|
|
93
|
+
|
|
94
|
+
r = skimproof.skim("https://example.com/long-article", "article", llm=llm, purpose="an engineer who must decide")
|
|
95
|
+
print(r.page) # article/brief.html, or None if an error is left
|
|
96
|
+
for s in r.statements:
|
|
97
|
+
print(s.text, [q.text for q in s.quotes])
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`skim` is `capture`, the model calls, and `build`. If `build` finds errors, the model gets them one time to repair its brief. A repair that drops other statements is refused. For your own agents or your own control flow, use the parts:
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
b = skimproof.capture("https://example.com/long-article", "article-2") # no model
|
|
104
|
+
for task in b.tasks: # readers of a large source can run at the same time, and the last task writes the brief
|
|
105
|
+
task.save(llm(task.prompt)) # or: an agent with file tools follows task.file
|
|
106
|
+
r = skimproof.build(b) # no model
|
|
107
|
+
r.errors, r.warnings, r.statements, r.left_out
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
If a model call fails, the folder stays, and `skimproof.finish("article", llm=llm)` runs only the missing calls. Failures that you can act on raise `skimproof.SkimError`. For scanned pages and text in images, install `skimproof[ocr]`. A function that gets only text does not see the figures. An agent that follows `task.file` can open them.
|
|
111
|
+
|
|
112
|
+
## What the scripts check
|
|
113
|
+
|
|
114
|
+
- **Build stops** at a number or a unit that the quotes do not have, a lost bound such as "at least 93%", a line of a command that is not in the source, or a statement with no citation. There is no page until the agent repairs it.
|
|
115
|
+
- **Build warns** about a number word or a heading number that has no source, a lost negative, a lost qualifier, or a wider scope, and shows the strongest sentences that were left out. The agent decides.
|
|
116
|
+
- **The page shows** the quotes of each statement, contradictions, and every source sentence that the brief does not use.
|
|
117
|
+
- **Capture keeps** figures in their native format, with alt text, caption, drawn text, and OCR apart. A moving drawing is taken at its end state. PDFs, manual pages, and RFCs become chapters, lists, and code. Scanned pages are read with OCR. Formulas keep their TeX, or are rebuilt from how they are drawn.
|
|
118
|
+
|
|
119
|
+
The scripts cannot see a wrong actor or an added cause. For that, ask for a second opinion ([verify.md](https://github.com/bvolpato/skimproof/blob/main/skills/skimproof/references/verify.md)). To give a reason for each sentence that is left out, there is a slower [full proof](https://github.com/bvolpato/skimproof/blob/main/skills/skimproof/references/full.md).
|
|
120
|
+
|
|
121
|
+
## Evidence
|
|
122
|
+
|
|
123
|
+
These tests measured the full proof, which is optional, and not the fast default. Two tests on fresh public documents, planned and published before any brief existed ([evals/CONFIRM.md](https://github.com/bvolpato/skimproof/blob/main/evals/CONFIRM.md), [evals/confirm](https://github.com/bvolpato/skimproof/tree/main/evals/confirm)):
|
|
124
|
+
|
|
125
|
+
- **Coverage is kept.** Fresh readers answered 75.6% of 90 questions from a skimproof brief, from a one-shot brief, and from a brief that its writer reviewed. No text scored 0, and the full document scored 100.
|
|
126
|
+
- **Few errors.** 0 errors in about 110 sentences, against 2 for one-shot and 1 for self-review. The auditors found 96% of errors that were planted on purpose. The difference is too small to be meaningful, because all three were already clean.
|
|
127
|
+
- **Planted errors are fixed.** 24 of 24. A fresh reviewer without the tool also fixed 24 of 24.
|
|
128
|
+
|
|
129
|
+
So a skimproof brief is as complete and as accurate as a careful fresh review, at about four times the cost. It is not a better editor. What it adds is a record that a person can check: the quotes behind each sentence, a verdict for each sentence, and everything that was left out. One model family, three documents, and model readers instead of people. Earlier designs, and why they changed, are in [evals/RESULTS.md](https://github.com/bvolpato/skimproof/blob/main/evals/RESULTS.md). The [research page](https://github.com/bvolpato/skimproof/blob/main/docs/RESEARCH.md) gives the source of each rule and what it does not show.
|
|
130
|
+
|
|
131
|
+
## Wikis and fetch tools
|
|
132
|
+
|
|
133
|
+
Text from a wiki, a fetch tool, or an MCP server goes in a folder, with a title, a link, a group, and a date in front matter. [sources.md](https://github.com/bvolpato/skimproof/blob/main/skills/skimproof/references/sources.md) has the format and the checks for lost images. For Confluence, `skills/skimproof/scripts/confluence-pages` saves pages, the pages below them, and their images.
|
|
134
|
+
|
|
135
|
+
## Development
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
uv sync --locked --group dev --config-file uv.toml
|
|
139
|
+
uv run --config-file uv.toml pytest -q
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Lock with `uv lock --config-file uv.toml`. A plain `uv lock` can copy settings from your own uv config into the lockfile.
|
|
143
|
+
|
|
144
|
+
## Privacy
|
|
145
|
+
|
|
146
|
+
The tool stores nothing outside the bundle directory. Capture uses a browser on your machine and downloads only the page and its images. The saved source and `brief.html` have local file names and no local paths. The task files have the path of the bundle, so share `brief.html` and not the folder. Your agent decides where the text goes, so use it with documents that your model provider may see.
|
|
147
|
+
|
|
148
|
+
## Limits
|
|
149
|
+
|
|
150
|
+
- Text and images only. A table drawn as an image is read by OCR, not as rows. OCR makes mistakes, so look at the page before you use a number from a scan. Audio and video files are not read.
|
|
151
|
+
- Capture runs page scripts, so do not point it at a page that you would not open.
|
|
152
|
+
- The checks prove form. A verdict from a model is evidence, not proof.
|
|
153
|
+
- No second reader runs unless you ask. The full proof costs about 5 times a one-shot brief.
|
|
154
|
+
|
|
155
|
+
MIT license. The bundled `copy-as-markdown` library is MIT, see `src/skimproof/vendor`.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.27"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "skimproof"
|
|
7
|
+
version = "0.8.0"
|
|
8
|
+
description = "Condense long technical reading into a brief that keeps its proof: every sentence is anchored, every omission is listed."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.12"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE", "src/skimproof/vendor/*.LICENSE"]
|
|
13
|
+
authors = [{ name = "Bruno Volpato" }]
|
|
14
|
+
keywords = ["summarization", "reading", "agents", "skills", "grounding", "figures", "citations", "llm"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Programming Language :: Python :: 3.14",
|
|
21
|
+
"Topic :: Text Processing",
|
|
22
|
+
"Typing :: Typed",
|
|
23
|
+
]
|
|
24
|
+
dependencies = [
|
|
25
|
+
"markdown-it-py>=3.0,<5",
|
|
26
|
+
"pillow>=11",
|
|
27
|
+
"playwright>=1.50",
|
|
28
|
+
"pypdfium2>=4.30",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.optional-dependencies]
|
|
32
|
+
ocr = [
|
|
33
|
+
"onnxruntime>=1.20",
|
|
34
|
+
"rapidocr>=3.0",
|
|
35
|
+
"ocrmac>=1.0; sys_platform == 'darwin'",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[project.scripts]
|
|
39
|
+
skimproof = "skimproof.cli:main"
|
|
40
|
+
|
|
41
|
+
[project.urls]
|
|
42
|
+
Homepage = "https://bvolpato.github.io/skimproof/"
|
|
43
|
+
Repository = "https://github.com/bvolpato/skimproof"
|
|
44
|
+
|
|
45
|
+
[dependency-groups]
|
|
46
|
+
dev = ["pytest>=8", "ruff>=0.9"]
|
|
47
|
+
|
|
48
|
+
[tool.hatch.build.targets.wheel]
|
|
49
|
+
packages = ["src/skimproof"]
|
|
50
|
+
|
|
51
|
+
[tool.hatch.build.targets.sdist]
|
|
52
|
+
include = ["/src", "/README.md", "/LICENSE"]
|
|
53
|
+
|
|
54
|
+
[tool.ruff]
|
|
55
|
+
line-length = 110
|
|
56
|
+
extend-exclude = ["src/skimproof/vendor"]
|
|
57
|
+
|
|
58
|
+
[tool.pytest.ini_options]
|
|
59
|
+
testpaths = ["tests"]
|
|
60
|
+
markers = ["browser: needs a Playwright Chromium"]
|
|
61
|
+
|
|
62
|
+
[tool.ruff.lint]
|
|
63
|
+
select = ["E4", "E7", "E9", "F", "I", "UP", "B"]
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""Skim the text. Keep the proof."""
|
|
2
|
+
|
|
3
|
+
from .api import Bundle, Quote, Result, Statement, Task, build, capture, finish, skim
|
|
4
|
+
from .bundle import SkimError
|
|
5
|
+
from .checks import Issue
|
|
6
|
+
|
|
7
|
+
__version__ = "0.8.0"
|
|
8
|
+
__all__ = ["Bundle", "Issue", "Quote", "Result", "SkimError", "Statement", "Task", "build", "capture", "finish", "skim"]
|