Wegent / backend-rs
AGENTS.md867 starsChanged 3 months agoApache-2.0View on GitHub
Read the repository contributor guide first. This directory is the Rust side of an incremental API migration, not a second default backend. The Python backend/ remains the default implementation while Rust dependencies and the migration surface are still stabilizing. - Implement every new public API in backend/, not here. - Implement an existing API here only after it is an active migrated Rust API: it has a Rust handler registered by Application and the active WEGENT_RS_ROUTES_FILE selects the same method…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository7 other files it gives its agents.
- AGENTS.mdAGENTS.md
- frontend/AGENTS.mdAGENTS.md
- wework/AGENTS.mdAGENTS.md
- wework-mobile/AGENTS.mdAGENTS.md
- backend-rs/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- tests/CLAUDE.mdCLAUDE.md
The file
We split this AGENTS.md into the rules it gives an agent
9 rules. About 0 are common, 5 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 3
Read the repository contributor guide first.
- Distinctive: line 16
Do not copy a behavior change into both implementations unless the task explicitly requires parity on both runtime paths.
- Very specific: line 26
Treat config/routes.toml as the checked-in inventory of public APIs owned by Rust.
- Very specific: line 29
If the task sets WEGENT_RS_ROUTES_FILE, inspect that effective file instead.
- Distinctive: line 30
Do not create or maintain a separate endpoint list.
- Distinctive: line 50
Keep public handlers small and delegate reusable logic to focused modules.
- Very specific: line 51
Do not use unsafe; the crate forbids it.
- Very specific: line 52
Prefer the existing brz-* abstractions and pinned dependency versions over introducing another web, logging, metrics, or database framework.
- Distinctive: line 54
Add focused tests for changed request handling and compatibility behavior.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Wegent backend-rs contributor guide
Read the repository contributor guide first. This directory is the Rust side of an incremental API migration, not a second default backend.
API ownership
The Python backend/ remains the default implementation while Rust
dependencies and the migration surface are still stabilizing.
- Implement every new public API in
backend/, not here. - Implement an existing API here only after it is an active migrated Rust API:
it has a Rust handler registered by
Applicationand the activeWEGENT_RS_ROUTES_FILEselects the same method and path. - Implement all other existing APIs in
backend/. - Do not copy a behavior change into both implementations unless the task explicitly requires parity on both runtime paths.
The checked-in config/routes.toml activates only the APIs that have completed
cutover; every other request is forwarded to Python. Shared Rust modules such as
authentication, MySQL, and FastAPI-compatibility helpers do not by themselves
make an API migrated.
Finding migrated APIs
Treat config/routes.toml as the checked-in inventory of public APIs owned by
Rust. For an existing API, find its matching [[routes]] entry by method and
path, then verify that Application registers the corresponding Rust handler.
If the task sets WEGENT_RS_ROUTES_FILE, inspect that effective file instead.
Do not create or maintain a separate endpoint list; the route configuration is
the single source of truth. A route migration must update the handler, route
entry, and focused compatibility tests in the same change.
Changing config/routes.toml, adding a public Rust handler, or adding or
upgrading a Rust dependency is migration work. Do it only when the task
explicitly includes that scope. If handler registration and route selection
disagree, stop and ask for direction.
Migration compatibility
For a Rust-owned API, preserve the observable Python contract unless the task explicitly changes it: method and path matching, authentication, request and response JSON shape, status codes, error bodies, headers, uploads, streaming, and upgrade behavior. Use the existing Python endpoint and its tests as the compatibility reference. Keep gateway fallback behavior intact for all non-selected routes.
Rust conventions and verification
- Keep public handlers small and delegate reusable logic to focused modules.
- Do not use
unsafe; the crate forbids it. - Prefer the existing
brz-*abstractions and pinned dependency versions over introducing another web, logging, metrics, or database framework. - Add focused tests for changed request handling and compatibility behavior.
For Rust code changes, run the relevant commands from this directory:
cargo fmt --check
cargo test
cargo clippy --all-targets -- -D warningsDoes 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.

