fetch-docs

A command that finds and indexes documentation for a project’s runtime dependencies, meaning the libraries the application needs to run. It also handles workspace-based projects that contain several packages in one repository.

In plain words
What is it for?
Use it to analyze project dependencies, exclude development tools and internal packages, check the documentation cache, and fetch missing library documentation.
Why use it?
It avoids manually identifying which dependencies need documentation and skips development-only or already cached packages.

Command

Part of the claude-local-docs plugin — 2 commands, 1 hook, 1 MCP server shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/matteodante/claude-local-docs/fetch-docs
Clone the repo
git clone --depth 1 https://github.com/matteodante/claude-local-docs

Or install claude-local-docs, the plugin that ships this one along with the rest of its 2 commands, 1 hook, 1 MCP server.

Per session 8 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,723 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00008 $0.02723
Opus 5 $0.00004 $0.01362
Sonnet 5 $0.00002 $0.00545
Haiku 4.5 $0.00001 $0.00272

Measured 3d ago against content hash b6949f1f87c5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

fetch-docs scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/fetch-docs.md · 227 lines

How it starts

The opening of the file, as written. The whole thing — 227 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Fetch Documentation for Project Dependencies

You are a documentation indexing agent. Your job is to discover and index the best available documentation for each runtime dependency in this project.

Steps

1. Analyze Dependencies

Call analyze_dependencies to get the full dependency list. This automatically:

  • Detects monorepos (pnpm workspaces, npm/yarn workspaces)
  • Resolves catalog: versions from pnpm-workspace.yaml
  • Collects deps from ALL workspace packages
  • Deduplicates and tags each dep as runtime or dev

2. Filter Dependencies

From the returned list, skip all of the following:

  • All dev dependencies (eslint, prettier, typescript, vitest, jest, etc.)
  • All @types/* packages (these are just TypeScript type definitions)
  • Workspace-internal packages (listed in workspacePackages)
  • Known tooling that doesn't need docs: tslib, tsconfig-*, eslint-*, prettier-*, @eslint/*

This leaves only runtime dependencies that actually need documentation.

3. Check Existing Cache

Call list_docs to see which libraries are already indexed. Skip any library that was fetched within the last 7 days unless the user explicitly asks to refresh.

4. Fetch Documentation

For each remaining library, follow this strategy. The goal is to find the best quality source — llms-full.txt > llms.txt (expanded index) > homepage HTML > README.

Step A: Check Known URLs first

Before any probing, check if the library is in the Known URLs Reference below. If there's a known llms-full.txt or llms.txt URL, use it directly with fetch_and_store_doc. This is the fastest path.

Step B: discover_and_fetch_docs (automatic probing)

For libraries NOT in the known list, call discover_and_fetch_docs. This tool automatically:

  1. Checks npm registry for llms/llmsFull fields in package.json (newest convention)
  2. Probes homepage (skipping GitHub homepages), docs.{domain}, llms.{domain}, /docs/ subpath for llms-full.txt/llms.txt
  3. Validates redirect domains (rejects cross-domain redirects like GitHub → docs.github.com)
  4. Validates content quality (rejects 404 pages, too-short content)
  5. Probes GitHub raw for llms-full.txt/llms.txt on main/master branches
  6. Falls back to README.md from GitHub
  7. Falls back to homepage HTML → markdown conversion
  8. Detects index files and expands them by fetching linked pages

Read the full file on GitHub · 227 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 227 lines · 8 tokens per session scan A b6949f1f87c5

Subscribe to this mod's changes

fetch-docs is a command published in the GitHub repository matteodante/claude-local-docs (5 stars, last pushed 6mo ago), licensed MIT. It adds 8 tokens to every session and 2,723 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.