source-snapshot
Skill7 starsChanged 4 months agoMITView on GitHub
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.
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Cherwayway/agent-context-patchtheir own version, first seen Jul 11, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- Cherwayway/agent-context-patch★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository30 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- beadsSkill
- azadvertizerSkill
- business-planSkill
- c7searchSkill
- clear-and-humanSkill
- convert-to-webpSkill
- cv-and-humanSkill
- cv-cover-letterSkill
- cv-evidence-baseSkill
- dev-fleetSkill
- excalidraw-diagramSkill
- frontier-roundsSkill
- ghost-publishSkill
- hook-and-humanSkill
- interview-panelSkill
- job-feedsSkill
- markdown-converterSkill
- nano-banana-pro-jsonSkill
- readabilitySkill
- report-builderSkill
- social-image-prepSkill
- terraform-registrySkill
- terragrunt-skillSkill
- transcribe-summarizeSkill
- travel-planningSkill
- trilium-captureSkill
- use-linearisSkill
- ux-auditSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
If you find yourself fetching the same URL/endpoint across runs, that's the signal to snapshot it.
- Distinctive: line 83
Never silently fall back to a live fetch when a snapshot is stale.
- Very specific: line 93
Run it by its absolute path — it lives in this skill's base directory (announced when the skill loads, usually …
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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 olddefuddle-cliis deprecated, "merged into defuddle"; sameparse … --mdinterface). The producer resolves a runner automatically (installeddefuddlebinary →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 annpx …@latestcall — 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
<script>/<style>; nav, sidebar, and footer chrome come through). For a prose article you want the boilerplate gone, which is exactly what a main-content extractor does. That's the only reason defuddle is preferred here — not any inability of markitdown to read web pages. - Reference docs, API pages, tables, specs → the
markdown-converterskill (markitdown). Structure — headings, tables, links — is the part you'll cite, so preserve it rather than flattening to prose. - APIs / registries / anything with a schema → request structured output (JSON/YAML)
and store it as data, not prose. A
registry-snapshot.jsonthe verifier checks by key beats a page it matches by string. Prefer the source's cached/offline mode (e.g. a cached provider schema) over a live call where one exists.
The procedure
- Fetch the source (record the exact URL/endpoint + the time, from
args— the clock is unavailable mid-run, so pass timestamps in). - Extract / normalize with the right extractor for the type (above).
- Write a provenance header, then the content, to a stable path. Name the file so the same source maps to the same path (slug or content hash).
- Commit the artifact. Review changes with
git diff— a snapshot diff is how you see upstream drift.
Provenance header (every snapshot)
For Markdown artifacts, a YAML front-matter block:
---
source_url: https://...
retrieved_at: 2026-06-11T00:00:00Z # passed in; do not invent
extractor: markitdown 0.x | defuddle | readability
content_sha256: <hash of the normalized body>
pinned_version: "1.2.3" # for versioned sources (registry, package)
---For JSON artifacts, the same fields under a top-level "_provenance" key. Provenance is
what makes a snapshot auditable and a citation trustworthy.
Pinning & refresh
- Pin a version for versioned sources (a registry module, a package). The snapshot is tied to that version; bumping it is a deliberate, reviewable change.
- Refresh on a cadence, not per-run — a scheduled job or a
make refresh-*target that re-snapshots and commits. The diff is the changelog. - Never silently fall back to a live fetch when a snapshot is stale; surface staleness so the caller decides.
Producer: scripts/snapshot.py
A stdlib-only helper that makes the routing above resilient — it detects which extractors are actually installed, picks one by content type, falls back when the preferred is missing, and fails cleanly (exit 1, structured error) when none can handle the type — it never crashes or fabricates.
Run it by its absolute path — it lives in this skill's base directory (announced when the
skill loads, usually ~/.claude/skills/source-snapshot); a bare snapshot.py won't resolve
from the repo you're working in. It's stdlib-only, so uv or python3 both work. Define a
srcsnap function at the start of each command block (a function passes arguments correctly
under bash and zsh — a plain $VAR doesn't word-split in zsh — and shell state doesn't persist
between tool calls, so re-declare it per block):
# uv is the preferred runner; resolve it even when it's not on a bare PATH (non-interactive
# shells often drop ~/.local/bin or the Homebrew bin -> `uv: command not found`):
UV="$(command -v uv || ls "$HOME/.local/bin/uv" "$HOME/.cargo/bin/uv" /opt/homebrew/bin/uv /usr/local/bin/uv 2>/dev/null | head -1)"
srcsnap() { "$UV" run python "$HOME/.claude/skills/source-snapshot/scripts/snapshot.py" "$@"; }
# uv not installed? It's stdlib-only, so plain python3 works too:
# srcsnap() { python3 "$HOME/.claude/skills/source-snapshot/scripts/snapshot.py" "$@"; }
# Decide what would be used, without fetching (deterministic):
srcsnap --format json plan --content-type prose
# Force availability for tests/CI (or to preview a leaner box):
srcsnap --have markitdown plan --content-type prose # -> markitdown (fell back)
srcsnap --have none plan --content-type prose # -> exit 1, clean error
# Extract + write a provenance-stamped artifact:
srcsnap run https://example.com/post --content-type prose --out snapshots/post.md
srcsnap run report.pdf --content-type doc --out snapshots/report.mdPreference: prose → defuddle > readability > markitdown; doc → markitdown.
markitdown is the most reliable fallback (works via uvx 'markitdown[all]' even with no
local install). For defuddle the producer auto-resolves the runner and the verified CLI
shape (defuddle parse {src} --md); you only need an env override for a custom install or
a different prose tool ({src} = source slot):
# Usually unnecessary — the producer already finds defuddle. Override only for a custom path:
export SNAPSHOT_DEFUDDLE_CMD="defuddle parse {src} --md"
export SNAPSHOT_READABILITY_CMD="readable {src}"Tip — kill the startup friction for good: install defuddle once so it's a PATH binary
and never re-resolves: pnpm add -g defuddle (gives the defuddle command; use the
defuddle package, not the deprecated defuddle-cli). The producer then uses it directly;
no dlx/npx, no per-run download.
Resilience is covered by evals/ (the no-markitdown / no-defuddle matrix) — run
cd evals && uv run python grade.py.
How this feeds the fleet
Snapshots are fact-verifier's tier-1 sources: a committed registry-snapshot.json
or cached doc lets it cite snapshot.json:line deterministically and offline, instead of
hitting the network and hoping. Build the retriever once; reuse the artifact across many
agent runs. See docs/agent-fleet-architecture.md.
Anti-patterns
- Re-fetching the same source live on every run (non-deterministic, slow, rate-limited).
- Storing raw HTML or a whole noisy page when you needed one section.
- Snapshots with no provenance — you can't tell what they are or when they drifted.
- Flattening structured data (tables, schemas) to prose, then trying to match it by string.
- Inventing a
retrieved_ator a CLI invocation — pass timestamps in; verify commands.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

