agentleFS
kepanokepano/defuddle/AGENTS.md

defuddle

AGENTS.md9.8k starsChanged 49 days agoMITView on GitHub

Extracts main content from web pages as clean HTML. Changes must work across these environments:

Trending

More talk lately.about the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 5 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 4 mentionsAug 2026: 9 mentionsSep 2026: 4 mentionsOct 2026: 16 mentionsNov 2026: 15 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the kepano/defuddle repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about kepano/defuddle

The biggest 5 of 60 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 60

Talked about on GitHub, Bluesky, Hacker News and the web (60 times).

On GitHub · 50

45 more on GitHub

On Bluesky · 8

3 more on Bluesky

On Hacker News · 1

On the web · 1

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 31,439 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

The file

We split this AGENTS.md into the rules it gives an agent

3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Never use innerHTML directly.

    line 7
  2. Very specific:

    Always use curl to test the Worker or defuddle.md.

    line 19
  3. Very specific:

    Start with { debug: true } and inspect result.debug.removals and result.debug.contentSelector.

    line 33

≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Defuddle

Extracts main content from web pages as clean HTML.

Security

  • Never use innerHTML directly. Use parseHTML() from src/utils/dom.ts (template-based parsing without script execution or resource loading).
  • Escape every page-derived value interpolated into HTML with escapeHtml(), or build nodes with createElement/setAttribute and serializeHTML(). Downstream sanitization does not replace escaping at the point of interpolation.
  • Strip javascript:, blob:, and non-image data: URLs from href/src. Allow data:image/* except as an iframe src. Strip iframe srcdoc and all on* event handlers.
  • Preserve sanitization regardless of pipeline options. See isDangerousUrl() in src/utils/dom.ts and _stripUnsafeElements() in src/defuddle.ts.
  • Cover new extractors with a poisoned-attribute case in tests/extractor-xss.test.ts.

Build and test

  • npm run build — build all bundles.
  • npm test — run Vitest.
  • For extraction fixes, add a minimal HTML fixture in tests/fixtures/ with correct expected output in tests/expected/. Verify the same fixture fails before the fix and passes afterward; do not change expectations to match buggy behavior.
  • Anonymize fixtures: replace real names, emails, URLs, and identifying content with generic placeholders.
  • Always use curl to test the Worker or defuddle.md; never open those URLs in a browser.
  • Local Worker: run cd website && npx wrangler dev, then curl http://localhost:8787/https://stephango.com/saw.
  • Production: curl https://defuddle.md/https://stephango.com/saw.

Runtime compatibility

Changes must work across these environments:

  • Browser (defuddle, defuddle/full): native DOM.
  • Node.js (defuddle/node): async API accepting any DOM Document, including linkedom, JSDOM, and happy-dom.
  • CLI (src/cli.ts) and Cloudflare Worker (website/src/convert.ts): linkedom; the Worker is the most constrained environment.

Debugging extraction

  • Start with { debug: true } and inspect result.debug.removals and result.debug.contentSelector. Debug mode preserves class/id/data attributes and skips div flattening.
  • Disable removal steps individually to isolate content loss. Use contentSelector to bypass incorrect main-content detection.
  • For selector issues, inspect EXACT_SELECTORS and PARTIAL_SELECTORS in src/constants.ts. Elements inside <pre> or <code> are protected from selector removal.
  • Standardize footnotes and callouts before removals: CSS sidenotes may use display:none, and callout classes such as .alert otherwise match clutter selectors.

Common pitfalls

  • UMD bundles use webpack export: 'default'; expose named exports as static properties on the default class (see src/index.full.ts).
  • getElementsByTagName returns live HTMLCollections. Use Array.from() before mutating the DOM.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.