--- name: source-snapshot description: >- Fetch an external page, doc or API/registry result once and keep it in the repo as a pinned, provenance-stamped snapshot that agents re-read instead of fetching live, so facts an agent relies on (docs, API behaviour, registry data, prices, schemas) stay reproducible offline. Also for deciding snapshot versus live fetch, and which extractor to use. A one-off conversion to Markdown with nothing kept is markdown-converter. license: MIT --- # Source Snapshot The core move: **separate retrieval from consumption.** Retrieve once, deterministically, into a pinned artifact with provenance. Then agents and the LLM read the *artifact*, never the live source. Same input → same artifact → same downstream behavior. Live `WebFetch`/MCP on every run is the non-determinism you're removing. ## When to snapshot vs. fetch live | Situation | Do | |---|---| | Fact gates a decision **and** is reused (docs, registry data, schemas, versions) | **Snapshot** to a pinned artifact, commit it | | One-off exploration, throwaway lookup | Fetch live (`WebFetch`, MCP, `c7search`) — no artifact | | Value changes the build output if it drifts (IaC generation, pinned deps) | **Snapshot + pin a version**; refresh on a cadence, never live-per-run | If you find yourself fetching the same URL/endpoint across runs, that's the signal to snapshot it. ## Choose the extractor by content type - **Article / blog / prose** → main-content extractor (Defuddle, or Mozilla Readability) → Markdown. Strips nav/ads/chrome; the cleaned result is small and stable. Defuddle is often *not* a PATH binary — the npm package is **`defuddle`** (the old `defuddle-cli` is deprecated, "merged into defuddle"; same `parse … --md` interface). The producer resolves a runner automatically (installed `defuddle` binary → `pnpm dlx defuddle` → `bunx` → `npx defuddle`) and never pins `@latest`, so a cached package is reused instead of re-downloaded. If no prose extractor is available, it falls back to markitdown. **Don't hand-write an `npx …@latest` call** — that forces a reinstall and is blocked outright in pnpm-enforced environments. - **Why not just markitdown for an article?** markitdown *can* fetch a URL — but it does a **faithful full-page** HTML→Markdown conversion (it only drops `