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.
npx agentmods add instructions/huggingface/huggingface_hub/agents-mdgit clone --depth 1 https://github.com/huggingface/huggingface_hubWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.02565 | $0.02565 |
| Opus 5 | $0.01282 | $0.01282 |
| Sonnet 5 | $0.00513 | $0.00513 |
| Haiku 4.5 | $0.00257 | $0.00257 |
Grade A, and why
huggingface_hub AGENTS.md 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 yesterday.
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.
How it starts
The opening of the file, as written. The whole thing — 144 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Agent Guide for huggingface_hub
Project overview
Python client library for the Hugging Face Hub. Source code is in src/huggingface_hub/, tests in tests/.
Setup
- Virtualenv:
.venv(everything pre-installed in editable mode with dev extras). - Activate:
source .venv/bin/activate(or prefix commands with.venv/bin/python).
Key commands
| Command | What it does |
|---|---|
make style |
Auto-format code (ruff format + fix), update generated files (static imports, __all__, async client, CLI reference) |
make quality |
Check formatting, linting, generated files, and type-check (ty check src) |
pytest tests/test_<module>.py |
Run a specific test file |
pytest tests/test_<module>.py -k "test_name" |
Run a single test |
pytest tests/ |
Run all tests (slow, many require network/auth) |
Always run make style then make quality before committing.
Code structure
Core modules (src/huggingface_hub/)
__init__.py— Public API surface. Static imports are auto-generated byutils/check_static_imports.py; runmake styleto update.hf_api.py— MainHfApiclass (~11k lines). Repo CRUD, uploads, downloads, discussions, PRs, collections, and more. Most Hub operations live here.file_download.py—hf_hub_download, caching logic, ETag/metadata resolution, xet download support._snapshot_download.py—snapshot_download(download an entire repo)._commit_api.py— Low-level commit operations (CommitOperationAdd,CommitOperationDelete,CommitOperationCopy), LFS upload handling._commit_scheduler.py— Background scheduled commits._upload_large_folder.py— Chunked upload for very large folders (deprecated;upload_foldernow handles large/resumable uploads).hf_file_system.py—HfFileSystem(fsspec-based POSIX-like filesystem for Hub repos).hub_mixin.py—ModelHubMixinbase class for ML framework integration (save/load to Hub).repocard.py/repocard_data.py—RepoCard,ModelCard,DatasetCardand their metadata.community.py—Discussion,DiscussionCommentand event deserialization.lfs.py— Git LFS batch upload utilities._login.py—login(),logout(),notebook_login(), token management._inference_endpoints.py— Inference endpoint CRUD and scaling._jobs_api.py— Training jobs API._space_api.py— Space runtime/hardware/storage types._webhooks_server.py/_webhooks_payload.py— Webhook server and payload definitions.constants.py— All environment-variable-driven constants (timeouts, cache paths, endpoints).errors.py— Custom exception hierarchy (HfHubHTTPError,RepositoryNotFoundError, etc.).
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.
- yesterday First seen · 144 lines · 2,565 tokens per session scan A 01f752a05361
huggingface_hub AGENTS.md is an instructions file published in the GitHub repository huggingface/huggingface_hub (3,857 stars, last pushed 3d ago), licensed Apache-2.0. It adds 2,565 tokens to every session, about $0.0128 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-30.
Other instructions, from other repositories
transformers copilot-instructions.md
Instructions for huggingface/transformers, covering copilot-instructions.md guide for hugging face transformers, core project structure, coding conventions for hugging face transformers, copying and inheritance and testing.
transformers AGENTS.md
Instructions for huggingface/transformers, a project described as: 🤗 Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.
PINA AGENTS.md
Instructions for PINA-org/PINA, covering pina — physics-informed neural architectures, quick reference, workflow: problem → model → solver → trainer, problem types and condition types.
presidio-research AGENTS.md
AGENTS.md instructions for data-privacy-stack/presidio-research, covering agents.md — codebase patterns, project setup, canonicalmapper, five issue types (issuetype enum) and resolution dataclass fields.
transformers CLAUDE.md
Instructions for huggingface/transformers, a project described as: 🤗 Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.
Traintools AGENTS.md
AGENTS.md instructions for AparajeetS/Traintools, covering traintools agent guide, discovery, when to suggest traintools, routing and integration rules.