Metadata-Version: 2.5
Name: skimproof
Version: 0.9.0
Summary: Condense long technical reading into a brief that keeps its proof: every sentence is anchored, every omission is listed.
Project-URL: Homepage, https://bvolpato.github.io/skimproof/
Project-URL: Repository, https://github.com/bvolpato/skimproof
Author: Bruno Volpato
License-Expression: MIT
License-File: LICENSE
License-File: src/skimproof/vendor/copy-as-markdown.LICENSE
Keywords: agents,citations,figures,grounding,llm,reading,skills,summarization
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Text Processing
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: markdown-it-py<5,>=3.0
Requires-Dist: pillow>=11
Requires-Dist: playwright>=1.50
Requires-Dist: pypdfium2>=4.30
Provides-Extra: code
Requires-Dist: tree-sitter-bash<0.26,>=0.25; extra == 'code'
Requires-Dist: tree-sitter-c-sharp<0.25,>=0.23; extra == 'code'
Requires-Dist: tree-sitter-c<0.25,>=0.24; extra == 'code'
Requires-Dist: tree-sitter-cpp<0.24,>=0.23.4; extra == 'code'
Requires-Dist: tree-sitter-go<0.26,>=0.25; extra == 'code'
Requires-Dist: tree-sitter-java<0.24,>=0.23.5; extra == 'code'
Requires-Dist: tree-sitter-javascript<0.26,>=0.25; extra == 'code'
Requires-Dist: tree-sitter-kotlin<2,>=1.1; extra == 'code'
Requires-Dist: tree-sitter-php<0.26,>=0.24; extra == 'code'
Requires-Dist: tree-sitter-python<0.26,>=0.25; extra == 'code'
Requires-Dist: tree-sitter-ruby<0.24,>=0.23; extra == 'code'
Requires-Dist: tree-sitter-rust<0.25,>=0.24; extra == 'code'
Requires-Dist: tree-sitter-scala<0.27,>=0.26; extra == 'code'
Requires-Dist: tree-sitter-swift<0.8,>=0.7; extra == 'code'
Requires-Dist: tree-sitter-typescript<0.24,>=0.23.2; extra == 'code'
Requires-Dist: tree-sitter-zig<2,>=1.1; extra == 'code'
Requires-Dist: tree-sitter<0.28,>=0.25; extra == 'code'
Provides-Extra: ocr
Requires-Dist: ocrmac>=1.0; (sys_platform == 'darwin') and extra == 'ocr'
Requires-Dist: onnxruntime>=1.20; extra == 'ocr'
Requires-Dist: rapidocr>=3.0; extra == 'ocr'
Description-Content-Type: text/markdown

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/bvolpato/skimproof/main/assets/wordmark-dark.svg">
    <img src="https://raw.githubusercontent.com/bvolpato/skimproof/main/assets/wordmark.svg" width="340" alt="skimproof">
  </picture>
</p>

<p align="center"><strong>Skim the text. Keep the proof.</strong></p>

<p align="center">
  <a href="https://bvolpato.github.io/skimproof/"><b>Site and live example</b></a> ·
  <a href="https://github.com/bvolpato/skimproof/blob/main/evals/RESULTS.md">Results</a> ·
  <a href="https://github.com/bvolpato/skimproof/blob/main/docs/RESEARCH.md">Research</a>
</p>

Give your coding agent a long article, a paper, a PDF, a folder of documents, or a whole repository. You get one short page in which **each statement shows the source sentences or the lines of code that it rests on, word for word**, and everything that was left out is listed.

<p align="center">
  <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>
</p>

## Use it

Install the skill one time:

```bash
# Claude Code
claude plugin marketplace add bvolpato/skimproof && claude plugin install skimproof@skimproof

# Other agents: copy the skill folder
git clone https://github.com/bvolpato/skimproof && cp -R skimproof/skills/skimproof ~/.agents/skills/
```

Then ask your agent:

> Skim https://example.com/long-article

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.

## What happens, and when the LLM runs

| | Step | Who | LLM |
|---|---|---|---|
| 1 | `skimproof capture <link> -o <folder>` saves the text with a number for each sentence, keeps the figures, and writes `task.md` | script | no |
| 2 | The agent follows `task.md`: it reads `read.md` one time, and writes `brief.md` | **your agent** | **yes** |
| 3 | `skimproof build <folder>` checks each statement against its quotes, and writes `brief.html` | script | no |

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`.

**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`.

Step 2 uses one agent or more, by the size of the source. `capture` decides, and prints it:

| Source | Who reads | Task files |
|---|---|---|
| Up to about 3,000 words | The agent that you talk with | `task.md` |
| Up to about 25,000 words | One more agent, so that the text does not fill your conversation | `task.md` |
| 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` |
| You ask for a second opinion | One fresh agent that sees only the statements and their quotes | `verify.d/01.md` |

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)).

**Length.** By default, the content decides, and there is no word target. The task tells the agent to keep what the reader acts on or decides by: how it works, rules, requirements, defaults, numbers, limits, exceptions, risks, what is not supported or still open, the evidence for a main claim, contradictions, and exact examples of the commands that matter. Details to look up, such as all options, become one line that cites their sentences, and the page shows the text. Repeats, motivation, general background, second examples, history, and credits are left out. To guide the length, tell your agent: "Skim https://example.com/long-article in about 2,000 words", or "in 10 minutes". The agent then adds `--words 2000`, or `--words 2400`, to `capture`. `capture` prints the length that the size of the source suggests, and `--suggest-words` uses it as the target. The target is for the whole brief, and `build` prints the actual length next to it. In Python, use `words=N` or `suggest_words=True`, and compare `r.brief_words` with `r.target_words`.

A brief is plain text. Each line ends with the numbers of its source sentences, and `f02` is a figure:

```markdown
# Title
## Answer
Median delay fell from 48 to 9 minutes in a 12-week trial of one harbor. [12 40-42]
Keep in mind: It was not tested in a storm. [88]
![The outer zone started slowest and gained most](f02)
```

## Skim a repository

> Skim https://github.com/bvolpato/ivygrep

A repository, or a folder of code, becomes one page that a new contributor reads in 10 to 15 minutes: the parts and **a picture of who calls whom that a script draws from the calls**, flows in which **each arrow cites the line of the call**, what is stored and where, where to start a change, and limits. See the [page about ivygrep](https://bvolpato.github.io/skimproof/demos/ivygrep.html): 84,921 lines of source in 14 minutes.

<p align="center">
  <a href="https://bvolpato.github.io/skimproof/demos/ivygrep.html"><img src="https://raw.githubusercontent.com/bvolpato/skimproof/main/assets/repository.png" width="620" alt="The page of a repository: boxes for the parts with arrows for the calls between them, and below it a flow in which each step names two functions and shows the line of the call."></a>
</p>

| | Step | Who | LLM |
|---|---|---|---|
| 1 | `skimproof capture <folder or repository link>` sorts the committed files into source, tests, generated, and vendored code, parses the source, and writes a map of what is central | script | no |
| 2 | The agent writes `outline.json`: the parts, the flows, and what is set aside. `build` checks that each source file has a place, and writes `focus.md`, the code to read | **your agent** | **yes** |
| 3 | The agent reads the code and writes `brief.md` | **your agent** | **yes** |
| 4 | `skimproof build <folder>` checks each citation and arrow, draws the picture, and writes `brief.html` | script | no |

- **An arrow is proved, a name match, or inferred, and the page shows which.** Proved: an import, a path, or a known type names the target. On ten public projects, 37,002 of 37,009 proved calls had the same target in the Go type checker, the TypeScript compiler, clang, or [jedi](https://github.com/davidhalter/jedi) ([how](https://github.com/bvolpato/skimproof/blob/main/evals/CODE.md#calls)). The other languages have tests with small projects only. Name match: the line names it, and the type is not known. Inferred: HTTP, a queue, a trait. The picture counts proved calls, and a dashed line is a step of a flow that the syntax does not prove.
- **`build` stops** at a line that does not exist, a name that is not in the cited lines, a call outside the function that it claims, a citation that shows only a signature, or a source file that no part has and nobody set aside.
- **Vendored code is mentioned and not read**: its name, its version, and who imports it. `.gitattributes` decides if it says something. Submodules, generated code, and JavaScript that is compiled from TypeScript are set apart too.
- **Documents and code that disagree** are on the page as conflicts.
- **No code of the repository runs**, only committed files are read, and links go to that commit. With `--no-snippets`, the page links to lines and has no code in it.

Calls are parsed for Rust, Go, Java, Python, JavaScript, TypeScript (Node, Bun, and `tsconfig` paths), C, C++, C#, Kotlin, Scala, Swift, Ruby, PHP, shell, and Zig. In other languages, files can be cited, and arrows are name matches or inferred. The skill has what it needs. In Python, install `skimproof[code]`. For a very large repository, give a folder of it. For more depth, add `--team` (several readers, two to three times the tokens).

Tested on three public repositories with 15 questions each that were written from the code before any page existed ([evals/CODE.md](https://github.com/bvolpato/skimproof/blob/main/evals/CODE.md)). Closed book, fresh readers answered 73% to 85% of the points from the page, and 2% to 8% from the README. Readers who explored the code with the questions in hand answered 90% to 97%. One page costs 300,000 to 540,000 tokens and 6 to 12 minutes.

## Use it from Python

The same two steps, and a function of yours in place of the agent:

```bash
uv add skimproof
```

```python
import anthropic
import skimproof

client = anthropic.Anthropic()

def llm(prompt: str) -> str:  # any model: skimproof gives a prompt, and you return the reply
    with client.messages.stream(model="claude-opus-5-5", max_tokens=32000, thinking={"type": "adaptive"}, messages=[{"role": "user", "content": prompt}]) as s:
        m = s.get_final_message()
    if m.stop_reason != "end_turn":
        raise RuntimeError(m.stop_reason)  # a brief that was cut off would look complete
    return "".join(b.text for b in m.content if b.type == "text")

r = skimproof.skim("https://example.com/long-article", "article", llm=llm, purpose="an engineer who must decide")
print(r.page)                        # article/brief.html, or None if an error is left
for s in r.statements:
    print(s.text, [q.text for q in s.quotes])
```

`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:

```python
b = skimproof.capture("https://example.com/long-article", "article-2")  # no model
for task in b.tasks:          # readers of a large source can run at the same time, and the last task writes the brief
    task.save(llm(task.prompt))  # or: an agent with file tools follows task.file
r = skimproof.build(b)        # no model
r.errors, r.warnings, r.statements, r.left_out
```

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]`. For repositories, install `skimproof[code]`: `skimproof.skim("path/to/project", "project", llm=llm)`. A function that gets only text does not see the figures. An agent that follows `task.file` can open them.

## What the scripts check

- **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.
- **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.
- **The page shows** the quotes of each statement, contradictions, and every source sentence that the brief does not use.
- **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.

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).

## Evidence

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)):

- **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.
- **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.
- **Planted errors are fixed.** 24 of 24. A fresh reviewer without the tool also fixed 24 of 24.

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.

## Wikis and fetch tools

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.

## Development

```bash
uv sync --locked --group dev --config-file uv.toml
uv run --config-file uv.toml pytest -q
```

Lock with `uv lock --config-file uv.toml`. A plain `uv lock` can copy settings from your own uv config into the lockfile.

## Privacy

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. The page of a repository has lines of its code, and the bundle has a copy of it: use `--no-snippets` for code that others must not see. Your agent decides where the text goes, so use it with documents that your model provider may see.

## Limits

- 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.
- Capture runs page scripts, so do not point it at a page that you would not open.
- For code, the checks see a wrong line, and not a wrong story: for a decision, use a second reader. Plugins, macros, and events are inferred at best. Reasons come only from documents and comments.
- The checks prove form. A verdict from a model is evidence, not proof.
- No second reader runs unless you ask. The full proof costs about 5 times a one-shot brief.

MIT license. The bundled `copy-as-markdown` library is MIT, see `src/skimproof/vendor`.
