agentleFS
d-o-hubd-o-hub/github-template-ai-agents/.agents/skills/do-web-doc-resolver/SKILL.md

do-web-doc-resolver

Skill2 starsChanged 10 days agoMITView on GitHub

Python resolver for URLs and queries into compact, LLM-ready markdown. Use this skill when fetching documentation, resolving web URLs, or building context from web sources — even if they just say "read this doc page" or "get the docs for X". Uses progressive free-first cascade with quality scoring, circuit breakers, layered routing memory, trace-based evaluation, and agent-friendly docs validation. Not for web-search-researcher, agent-browser.

  • Reads credentials
  • Installs packages

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    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
  1. Distinctive:

    Search for technical information across the web

    line 22
  2. Very specific:

    Structured Tool Contracts: Every provider returns ProviderResult(ok, content, error, meta) with ProviderMeta(tool, duration_ms, cache_hit, …

    line 72

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

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

Web Doc Resolver Skill

Resolve URLs and queries into compact, LLM-ready markdown using a progressive, free-first cascade with 2026 production patterns.

When to Use

  • Fetch and parse documentation from a URL
  • Search for technical information across the web
  • Build context from web sources for AI agents
  • Validate content against agent-docs-spec v0.3.0
  • Trace resolution trajectories for debugging

Prerequisites

  • Python 3.10+ in an isolated virtual environment.
  • From the skill directory, run python -m pip install . to install the base package and dependencies declared in pyproject.toml before the quick start.
  • Install provider, ML, or database extras only for the features that need them; text resolution does not require the optional visual/ML stack.

Quick Start

python -m scripts.cli "https://docs.rust-lang.org/book/"
python -m scripts.cli "Rust async programming" --profile quality --json

Cascade Strategy

URL: Cache → llms.txt → Jina → Direct Fetch → Firecrawl → Mistral Browser → DuckDuckGo

Query: Cache → Exa MCP → Exa SDK → Tavily → Serper → DuckDuckGo → Mistral Web Search

Providers (12 total)

ProviderTypeFreeLatency
llms_txtURLYes~100ms
jinaURLYes~300-1500ms
exa_mcpQueryYesVaries
duckduckgoQueryYes~2s
direct_fetchURLYes~500ms
exa, tavily, serperQueryNo~1s
firecrawl, mistral_*URL/QueryNo~2-3s
docling, ocrURLNo~3-5s

Execution Profiles

ProfileAttemptsPaidLatencyQuality
free306s0.70
fast214s0.60
balanced4-61-29-12s0.65
quality6-103-515-20s0.55

Key Features

Structured Tool Contracts: Every provider returns ProviderResult(ok, content, error, meta) with ProviderMeta(tool, duration_ms, cache_hit, quality_score, error_type).

Layered Routing Memory: TTL-based decay (30 days), metadata filtering, recency weighting. See scripts/routing_memory.py.

Structured Resolution Evidence: CLI --json reports available source, quality, and provider metrics. Trace model types live in scripts/models.py; the CLI has no --trace flag.

Agent-Friendly Docs Validation: Validates against agent-docs-spec v0.3.0 — 10 checks across 7 categories.

Quality Scoring: Content scored 0.0-1.0. Penalties: too_short(-0.35), missing_links(-0.15), duplicate_heavy(-0.25), noisy(-0.20).

Circuit Breakers: 3 failures → 300s cooldown per provider.

Configuration

export EXA_API_KEY="" TAVILY_API_KEY="" FIRECRAWL_API_KEY="" MISTRAL_API_KEY=""
export WEB_RESOLVER_MAX_CHARS=8000 WEB_RESOLVER_MIN_CHARS=200

Output

{"source": "jina", "content": "...", "score": 0.87,
 "metrics": {"total_latency_ms": 1234, "provider_metrics": [...], "paid_usage": False},
 "trace": {"trace_id": "...", "steps": [...], "success": True}}  # when --trace

File Structure

scripts/
├── resolve.py           # Main orchestrator & CLI
├── models.py            # Data models, enums, trace types
├── providers_impl.py    # 12 provider implementations
├── quality.py           # Content quality scoring
├── docs_validation.py   # Agent-docs-spec v0.3.0 checks
├── routing_memory.py    # Layered memory with TTL decay
├── routing.py           # Budget-aware routing
├── circuit_breaker.py   # Circuit breaker patterns
├── cache_negative.py    # Negative cache
├── synthesis.py         # LLM synthesis gate
└── utils.py             # Utilities

See Also

  • web-search-researcher — Web search and research
  • agent-browser — Browser automation

Rationalizations

RationalizationReality
"I'll just use the cheapest provider for everything."Free providers often have lower quality, latency, or reliability; cascading with quality scoring ensures acceptable results.
"Circuit breakers are overkill — errors are rare."Without circuit breakers, a failing provider consumes budget and time on every request, degrading the entire cascade.
"The sync and async fetchers share one URL validator."They do not. utils/http.py and utils/async_http.py each define their own _normalize_host/is_safe_url. Patch one and the async path keeps the old rules.

Red Flags

  • Ignoring quality scores and accepting low-quality content without validation
  • Disabling circuit breakers or skipping cooldown periods during provider failures
  • Not setting max character limits — fetching unbounded content wastes tokens
  • A host-validation change landing in utils/http.py with no matching utils/async_http.py change and no async test case
  • Adding another IP encoding to _normalize_host instead of rejecting non-canonical hosts and checking the resolved address
  • A resolution failure reaching the allow return, or an IPv6 literal embedding a v4 address (::/96, 64:ff9b::/96, 2002::/16) judged only against IPv4 networks

References

TopicFile
Agent-docs-spechttps://github.com/agent-ecosystem/agent-docs-spec
Memory 2026https://mem0.ai/blog/state-of-ai-agent-memory-2026
Agent architecturehttps://andriifurmanets.com/blogs/ai-agents-2026-practical-architecture-tools-memory-evals-guardrails
Web research optimizationreferences/web-research-optimization.md - Token budgets, quality scoring, caching, profile selection

Voice & Context

  • Default: professional + blog
  • Reference: voice-profiles skill for definitions and auto-detection.

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.