# pagesift

> Local-first web and document ingestion engine in Rust — HTTP/browser capture, layout-aware PDF/Office/OCR parsing, persistent sync, verifiable data graphs, evidence-grounded AI context compilation, and live claim resolution. One self-hosted Rust binary with a CLI, Firecrawl v1/v2 and Jina Reader HTTP APIs, an MCP server, a C ABI, and native Python and Node.js packages. Apache-2.0 license.

## Runtime Profile

- **Execution planes:** Entry surfaces (`CLI`, `HTTP`, `MCP`, `Python`, `Node.js`, `C ABI`) -> Policy & SSRF-guarded fetch (`pagesift-hooks`, `pagesift-policy`, `pagesift-net`, opt-in `pagesift-itna`) -> Adaptive strategy (`pagesift-plan`: conditional HTTP, embedded JSON synthesis, or `pagesift-cdp` browser fallback) -> Native Rust parsers & extractors (`pagesift-html`, `pagesift-content`, `pagesift-extract`, `pagesift-pdf`, `pagesift-office`, `pagesift-syntax`, `pagesift-ocr`/`infer`/`gpu`) -> Provenance, state, Context compilation & Resolve verification (`pagesift-graph`, `pagesift-store`, `pagesift-sink`) on a cgroup-bounded NUMA worker pool (`pagesift-flow`).
- **Inputs:** URLs, HTML, PDF (text layer + optional PP-OCRv6 and PP-FormulaNet), standalone uploaded images (`.png`, `.jpg`, `.gif`, `.bmp`, `.tif`, `.webp` when `--ocr` / `[ocr] enabled = true`), Office (`.docx`, `.doc`, `.xlsx`, `.xlsb`, `.xls`, `.pptx`, `.ppt`), OpenDocument, RTF, WordPerfect, HWP, e-books (EPUB, MOBI, FB2), email (`.eml`, `.mbox`, `.msg`), archives (`zip`, `tar`, `gz`, `bz2`, `xz`, `7z`), SQLite/dBASE/CSV, text/notebooks, 373 source-code and config languages, and WARC archives.
- **Outputs:** Clean Markdown, HTML, raw HTML, links, exported images/attachments, RAG chunks, schema-validated JSON with selector repair, `DataGraph` (`graph.jsonl`, `graph_summary.json`, citations, claim lifecycles, conflicts, `fact_clusters`, `?asOf=`), `Context` (`KnowledgeUnit`, `ContextDelta`, multi-strategy `ContextSearchReport`, token- & `MustKeep`-constrained `ContextPack` with `provenanceManifest`, and bounded `ContextActionOutcome`), `Resolve` (persistent `ConclusionRecord`, atomic claim verification verdicts, `CounterSearchAudit`, `ResolveEvent` change streams, live incremental reconciliation, and conservative `Learn` calibration), and structured warnings when captures are partial or degraded.
- **Install:** `cargo install pagesift --locked` · `pip install pagesift` · `npm install @pagesift/node` · `docker run -p 3002:3002 ghcr.io/yolow92/pagesift:1.7.0`
- **Primary calls:** `pagesift scrape --graph https://example.com` · `pagesift scrape report.pdf` · `pagesift sync init --id docs --seed https://example.com` · `pagesift context pack --store ./data/store --source-id docs "query"` · `pagesift resolve check --store ./data/store --source-id docs "answer"` · `pagesift graph inspect ./data/graph.jsonl` · `pagesift.scrape(url).markdown` · `(await new Scraper().scrape(url)).markdown` · `curl localhost:3002/r/https://example.com`
- **MCP (`pagesift mcp` / `pagesift mcp http --port 3003`):** `pagesift_scrape`, `pagesift_batch_scrape`, `pagesift_crawl`, `pagesift_poll_job`, `pagesift_cancel_job`, `pagesift_map`, `pagesift_interact`, `pagesift_interact_stop`, `pagesift_sync`, `pagesift_graph_query`, `pagesift_context`, `pagesift_resolve`, plus model-backed `pagesift_agent` and `pagesift_agent_status`.
- **Operational boundaries:** Self-hosted only; image URLs and standalone image uploads without `[ocr] enabled` return `UNSUPPORTED_OPTION`; animated WebP is rejected with a clear error; interactive CAPTCHAs pause and surface as needing human completion rather than bypassing; `[ocr]` formula/layout models run on CPU while text recognition uses NVIDIA GPU when available; `/v2/agent` requires a user-supplied model endpoint; `Context` `search`/`pack` and `Resolve` `check` never issue network requests unless `allowNetworkAcquisition` is explicitly enabled within `allowedHosts` and policy bounds.

## Docs

- [README](https://github.com/YOLOW92/pagesift/blob/main/README.md): overview, install, examples, architecture diagrams, workspace crate map, and constraints
- [Resolve](https://github.com/YOLOW92/pagesift/blob/main/docs/resolve.md): evidence-driven `ConclusionRecord` graph, deterministic seven-layer `Check`, active `Counter` search, bounded `Gap` acquisition, Salsa-style `Live` reconciliation, and conservative `Learn` calibration
- [Context](https://github.com/YOLOW92/pagesift/blob/main/docs/context.md): `KnowledgeUnit`, `ContextDelta`, multi-strategy `Search`, budget-constrained `ContextPack`, bounded `Action`, and drift-guarded `Learn`
- [Architecture](https://github.com/YOLOW92/pagesift/blob/main/docs/architecture.md): end-to-end crate pipeline, statistical adaptation (`delta = 0.05`), NUMA/cgroup execution, multi-server gateway/worker/standby topology, incremental delivery, and media publication
- [File parse API](https://github.com/YOLOW92/pagesift/blob/main/docs/parse-api.md): `POST /v2/parse`, format matrix, `parsers` options, OCR modes, limits, and error codes
- [Monitoring & Sync](https://github.com/YOLOW92/pagesift/blob/main/docs/monitor.md): `/v2/monitor` and `/v2/sources`, adaptive intervals, substantive diffing, webhooks, and limits
- [Structured extraction](https://github.com/YOLOW92/pagesift/blob/main/docs/structured-extract.md): schemas, selector memory, and selector relocation
- [Agent API](https://github.com/YOLOW92/pagesift/blob/main/docs/agent-api.md): `POST /v2/agent` bounded evidence-verification loop
- [Browser sessions](https://github.com/YOLOW92/pagesift/blob/main/docs/interact.md): `keepSession` and `/interact`
- [Jina Reader compatibility](https://github.com/YOLOW92/pagesift/blob/main/docs/jina-reader.md): `/r/` and `/s/` endpoints and headers
- [Shared MCP service](https://github.com/YOLOW92/pagesift/blob/main/docs/mcp-service.md): running a local shared MCP daemon for multiple agents
- [Benchmarks](https://github.com/YOLOW92/pagesift/blob/main/docs/benchmarks.md): evaluation methodology, frozen datasets, and recorded results
- [Example config](https://github.com/YOLOW92/pagesift/blob/main/docs/pagesift.example.toml): server, OCR, browser, storage, and policy configuration

## Releases & Licensing

- [Release notes (1.7.0)](https://github.com/YOLOW92/pagesift/blob/main/docs/releases/1.7.0.md): latest release details (evidence-driven Resolve engine — persistent `ConclusionRecord` graph in `ns::RESOLVE`, deterministic seven-layer `Check`, active `Counter` search, VOI-bounded `Gap` acquisition, early-cutoff `Live` reconciliation, conservative PAV/CUSUM `Learn`, and full Rust/HTTP/Cluster/CLI/MCP/FFI/Python/Node parity; [1.6.3](https://github.com/YOLOW92/pagesift/blob/main/docs/releases/1.6.3.md), [1.6.0 Context & Loop evaluation](https://github.com/YOLOW92/pagesift/blob/main/docs/releases/1.6.0.md))
- [Changelog](https://github.com/YOLOW92/pagesift/blob/main/docs/CHANGELOG.md): full version history
- [License (Apache-2.0)](https://github.com/YOLOW92/pagesift/blob/main/LICENSE) · [Commercial licensing](https://github.com/YOLOW92/pagesift/blob/main/docs/COMMERCIAL.md)
