huggingface_hub: Instructions file for Codex

AGENTS.md

huggingface_hub AGENTS.md is an instructions file for Codex, OpenCode from huggingface/huggingface_hub. It costs 2,565 tokens per session, scanned A, original, Apache-2.0.

A development guide for huggingface_hub, a Python client library for storing and retrieving machine-learning files from the Hugging Face Hub.

In plain words
What is it for?
Use it when developing the client library, updating generated files, checking code quality, or running selected or complete test suites.
Why use it?
It explains setup, important source areas, and the commands for formatting, linting, type-checking, and running tests.

Instructions file for CodexOpenCode ✓ vendor

Written for Codex and OpenCode: the file is AGENTS.md.

This is huggingface/huggingface_hub's own configuration. It tells Codex and OpenCode how to work on huggingface_hub itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything huggingface_hub configures →

About the project

Hugging Face Hub is a platform for sharing and using machine-learning models, datasets, and hosted applications. Its official command-line tool and Python client let developers and coding agents search, download, upload, manage, run inference with, and collaborate around those resources.

huggingface/huggingface_hub · 4,033 stars · on GitHub · huggingface.co

Reuse

Borrowing it

Nothing to install: this file belongs to huggingface/huggingface_hub. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/huggingface/huggingface_hub/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/huggingface/huggingface_hub

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for huggingface_hub AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/huggingface/huggingface_hub/agents-md/github.svg)](https://agentmods.dev/instructions/huggingface/huggingface_hub/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/huggingface/huggingface_hub/agents-md"><img src="https://agentmods.dev/badge/instructions/huggingface/huggingface_hub/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for huggingface_hub AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/huggingface/huggingface_hub/agents-md"><img src="https://agentmods.dev/badge/instructions/huggingface/huggingface_hub/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 2,565 This file is loaded in full into every session.
When invoked 2,565 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.02565 $0.02565
Opus 5.5 $0.01026 $0.01026
Sonnet 5.5 $0.00513 $0.00513
Haiku 4.5 $0.00257 $0.00257

Measured 2mo ago against content hash 01f752a05361, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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 2mo 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.

AGENTS.md · 144 lines

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 by utils/check_static_imports.py; run make style to update.
  • hf_api.py — Main HfApi class (~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_folder now handles large/resumable uploads).
  • hf_file_system.py — HfFileSystem (fsspec-based POSIX-like filesystem for Hub repos).
  • hub_mixin.py — ModelHubMixin base class for ML framework integration (save/load to Hub).
  • repocard.py / repocard_data.py — RepoCard, ModelCard, DatasetCard and their metadata.
  • community.py — Discussion, DiscussionComment and 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.).

Read the full file on GitHub · 144 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. 2mo ago First seen · 144 lines · 2,565 tokens per session scan A 01f752a05361

Subscribe to this mod's changes

huggingface_hub AGENTS.md is an instructions file published in the GitHub repository huggingface/huggingface_hub (4,033 stars, last pushed yesterday), licensed Apache-2.0. It adds 2,565 tokens to every session, about $0.0103 per session on Opus 5.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.

Related

huggingface_hub AGENTS.md compared with instructions from other repositories

huggingface_hub AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
huggingface_hub AGENTS.mdhuggingface/huggingface_hubInstructions file4.0kyesterdayApache-2.0A2,565Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode