cargo-usage-rules
A cargo subcommand that aggregates usage-rules.md files from your Rust project dependencies into a single file for AI agent consumption.
Inspired by the Elixir ash-project/usage_rules. They have some pretty compelling evidence of it's efficacy.
Installation
Or with binstall:
Or from source:
Usage
Sync all dependencies
List available packages with usage rules
Sync with custom output file
Inline specific packages
Exclude specific packages
Create separate files with links (folder mode)
# Markdown links (default)
# Claude @ links
Usage Reccomendations
In my experience using the inspiring project, linked mode works great and doesn't pollute the context window, so syncing all with the default linked mode.
If you have few dependencies then inline might be more performant for you, but YMMV.
How It Works
cargo-usage-rules scans your Rust project dependencies (from crates.io, git, local paths, etc) for:
usage-rules.mdfiles (main usage guidance)
It then aggregates these files into a single output file (default: Agents.md)
with clear package boundaries marked by HTML comments.
This project also has some general rust guidance (see the base file) inspired by various sources (see acknowledgements).
Creating Usage Rules for Your Crate
To make your crate discoverable by cargo-usage-rules, add a usage-rules.md file to your crate's root directory:
[Your usage guidance for AI agents here]
[Examples and best practices]
[What to avoid]