Heuristic:1broseidon Ketch Layered Fallback
| Knowledge Sources | |
|---|---|
| Domains | Extraction, Layered_Fallback, Optimization |
| Last Updated | 2026-10-27 00:00 GMT |
Overview
Best-method-first extraction pipeline that tries the strongest structural method and falls back only as far as needed, so a page that the landmark stage handles never pays for readability or raw-html conversion.
The Insight (Rule of Thumb)
- Action: Run extraction stages in descending strength: structural (landmark → uniform sections → prose root), then readability, then raw HTML→markdown. Stop at the first stage that produces usable prose.
- Value: The structural stage prunes by element identity (what a node is: `<article>`, `<main>`, `<nav>`) before by layout, so chrome is removed deterministically. Readability is a fallback for pages the structural stage can't parse, not a default. The `extract_mode` config (`clean` default vs `complete`) widens what structural extraction may drop.
- Trade-off: Structural extraction is stricter and can return less text than a readability pass on ambiguous pages, but it avoids readability's false-positive "main content" guesses on chrome-heavy sites. Paying for both on every page would double extraction cost for no gain on the common case.
- Compatibility: Selector mode (`--select`) skips content selection entirely and extracts only matching elements. Charset decoding (declared or `<meta>`) runs before any stage so the extractor always sees UTF-8.
Reasoning
The pipeline is ordered so the common case (a well-structured page) is handled by the cheapest correct method, and the expensive fallbacks run only when the cheap one gives up. A readability-first pipeline would mis-extract chrome on sites with clear landmarks; a raw-HTML-only pipeline would dump nav and footer into the markdown.
The structural stage's identity-based pruning is the key: it removes nodes by what they are (`<nav>`, `<aside>`, `<footer>`, forms, scripts) rather than by heuristics about text density, so it doesn't need the full readability scoring pass for pages with good landmarks. Readability remains for the long tail of pages with no landmarks and no clear structure.
The `clean`/`complete` extract mode widens or narrows what the structural stage may drop: `clean` (default) drops boilerplate aggressively for agents; `complete` keeps more for fidelity. The mode is a config-level choice, not a per-stage one.