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.
cargo install cargo-usage-rulesOr with binstall:
cargo binstall cargo-usage-rulesOr from source:
cargo install --git https://github.com/pallas-jp/cargo_usage_rulescargo usage-rules sync --allcargo usage-rules listcargo usage-rules sync --all --output AI.mdcargo usage-rules sync --inline serde,tokio,clapcargo usage-rules sync --all --remove old-crate,deprecated-dep# Markdown links (default)
cargo usage-rules sync --all --link-to-folder usage-rules
# Claude @ links
cargo usage-rules sync --all --link-to-folder usage-rules --link-style atIn 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.
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).
To make your crate discoverable by cargo-usage-rules, add a usage-rules.md file to your crate's root directory:
# My Awesome Crate
## Quick Start
[Your usage guidance for AI agents here]
## Common Patterns
[Examples and best practices]
## Common Mistakes
[What to avoid]