oxidizer / bytesbuf
AGENTS.md178 starsChanged 3 months agoMITView on GitHub
Code in this crate should follow the Microsoft Rust Guidelines. These assumptions shape how we write and optimize code in this crate. Keep them in mind when proposing or reviewing changes, especially performance-related ones. Our types are intended to be used in a thread-isolated architecture where mutexes are almost never contended. Any mutex that exists does so for safety in degenerate scenarios (e.g. memory allocated on one thread but released on another), not because we expect concurrent access on the…
In this repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- crates/fetch/AGENTS.mdAGENTS.md
- crates/seatbelt/AGENTS.mdAGENTS.md
- crates/seatbelt/examples/AGENTS.mdAGENTS.md
- cargo-anvil-adoptionSkill
- code-reviewSkill
The file
Files
AI Agents Guidelines for bytesbuf
Code in this crate should follow the Microsoft Rust Guidelines.
Design Assumptions
These assumptions shape how we write and optimize code in this crate. Keep them in mind when proposing or reviewing changes, especially performance-related ones.
Thread-isolated architecture (mutexes are never contended)
Our types are intended to be used in a thread-isolated architecture where mutexes are almost never contended. Any mutex that exists does so for safety in degenerate scenarios (e.g. memory allocated on one thread but released on another), not because we expect concurrent access on the hot path. We never optimize for contention and we never expect a mutex to be contended.
Spans per buffer/view (0 to hundreds)
We expect our buffers and views to consist of different numbers of spans in real-world scenarios, ranging from 0 to hundreds. Code must handle the full range correctly, not just the small-count case.
Inline spans are performance-sensitive
Assembling a buffer/view from a small handful of existing spans can be a performance-sensitive scenario for some workloads. Therefore, we inline a small number of spans directly in our buffer/view objects, avoiding extra heap allocations for the common case. We accept that this makes our buffer/view objects larger as a deliberate trade-off.
Metrics-driven fine-tuning (via the nm crate)
We rely on metrics emitted via the nm crate to fine-tune our constants and algorithms according
to real-world customer data. Fine-tuning for synthetic test data is not a priority. The nm crate
is designed for low-level metrics and is low overhead — acceptable to emit even on hot paths in
release builds — so do not remove or feature-gate these metrics purely on hot-path performance
grounds.
Buffer/view size matches the unit of work
Our buffers and views are intended to match the unit of work size in the customer operation. For example, the chunk size when copying data or performing I/O, or an entire HTTP request/response when performing buffered HTTP. Design and tuning decisions should assume buffers/views are sized to one unit of work, not arbitrarily large or arbitrarily small.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

