crates.io AGENTS.md

A set of project instructions for crates.io, the Rust package registry. It describes the repository's Rust backend, Svelte frontend, shared crates, tests, and development guidance.

In plain words
What is it for?
It is for locating relevant files, understanding how the server and Svelte application are organized, and following the project's build, testing, and implementation practices.
Why use it?
It gives contributors a map of the codebase and its conventions before they change backend, frontend, database, worker, or API code.

Instructions file for CodexOpenCode

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 instructions/rust-lang/crates.io/agents-md
Clone the repo
git clone --depth 1 https://github.com/rust-lang/crates.io

Made for: Codex, OpenCode.

Per session 2,498 This file is loaded in full into every session.
When invoked 2,498 The same file — it is already loaded in full.
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.02498 $0.02498
Opus 5 $0.01249 $0.01249
Sonnet 5 $0.00500 $0.00500
Haiku 4.5 $0.00250 $0.00250

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

Security

Grade A, and why

crates.io 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 2d 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 · 235 lines

How it starts

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

crates.io

Repository Layout

  • /src/ - Backend Rust application code
    • /src/bin/crates-io/ - Combined backend entry point for the server, background worker, monitor, and administrative commands
    • /src/controllers/ - API controllers organized by domain (krate/, user/, version/, trustpub/, github/, admin/)
    • /src/worker/jobs/ - Background job implementations (crate analysis, README rendering, OG image generation, database dumps)
    • /src/middleware/ - Request processing middleware (auth, rate limiting, logging, error handling)
    • /src/tests/ - Backend integration tests with snapshot testing using insta
    • /src/config/ - Configuration loading and validation
    • /src/util/ - Shared utilities (errors, authentication, pagination)
  • /svelte/ - Frontend SvelteKit application
    • /svelte/src/routes/ - File-based routes and page components
    • /svelte/src/lib/ - Shared components, stores, services, and utilities
    • /svelte/static/ - Static assets served at / (favicon, robots.txt, etc.)
  • /crates/ - Workspace crates providing specialized functionality
    • crates_io_api_types/ - API response serialization types
    • crates_io_database/ - Database models and schema (Diesel ORM)
    • crates_io_worker/ - Background job queue system
    • crates_io_index/ - Git index management for crate metadata
    • crates_io_tarball/ - Package tarball processing and validation
    • crates_io_trustpub/ - Trusted Publishing implementation
    • crates_io_markdown/, crates_io_linecount/ - Content processing
  • /migrations/ - Database migrations (260+ historical migrations managed by Diesel)
  • /e2e/ - Playwright tests for the frontend with accessibility checks
  • /packages/ - MSW (Mock Service Worker) test utilities for API mocking
  • /script/ - Development utilities
  • /docs/ - Project documentation (CONTRIBUTING.md, ARCHITECTURE.md, PR review guidelines)

General Guidance

  • Read /docs/CONTRIBUTING.md for comprehensive setup instructions and contribution guidelines.
  • Use cargo insta accept instead of cargo insta review when updating snapshot tests.
  • Use #[expect(...)] instead of #[allow(...)] to silence warnings that should be resolved later.
  • Match existing code style within each area (backend Rust follows workspace lints, frontend follows ESLint/Prettier config).
  • Add documentation comments to new types and functions; existing code may lack comments, but new code should have them.

Read the full file on GitHub · 235 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. 2d ago First seen · 235 lines · 2,498 tokens per session scan A 897ebe573e21

Subscribe to this mod's changes

crates.io AGENTS.md is an instructions file published in the GitHub repository rust-lang/crates.io (3,691 stars, last pushed today), licensed Apache-2.0. It adds 2,498 tokens to every session, about $0.0125 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.